[WPT] mocking sensor timestamp always return 0 when running tests without Layout test runner |
|||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36 Steps to reproduce the problem: After the CL[1] landed, mock implementations of the Sensor and SensorProvider mojo interfaces are enabled in WPT generic sensor tests. When running generic sensor tests with WPT test runner, sensor.timestamp always return 0. [1] https://chromium-review.googlesource.com/c/chromium/src/+/980886 What is the expected behavior? mocking sensor timestamp is activated. What went wrong? Look at following code snippet in sensor.cc[2] file, it may restrict the mocking timestamp being activated only when running LayoutTest. if (LayoutTestSupport::IsRunningLayoutTest()) { // In layout tests performance.now() * 0.001 is passed to the shared buffer. return sensor_proxy_->GetReading().timestamp() * 1000; } return performance->MonotonicTimeToDOMHighResTimeStamp( TimeTicksFromSeconds(sensor_proxy_->GetReading().timestamp())); } [2] https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/sensor/sensor.cc?rcl=c740e9566cecb197774f2f83c18b5759819ef07d&l=131 Did this work before? N/A Chrome version: 67.0.3396.87 Channel: stable OS Version: 10.0 Flash Version: raphael.kubo.da.costa@, alexander.shalamov@, PTAL.
,
Jun 18 2018
For future reference, Wangmin's comment on GitHub provides some additional context: https://github.com/web-platform-tests/wpt/issues/10906#issuecomment-388394993 This is one of the issues we have when running the sensors tests with `wpt' instead of run_webkit_tests.py; one other annoying one Wanming also described is that if one test fails all others also seem to because GenericSensorTestChromium.reset() ends up not being called.
,
Jun 18 2018
Also for future reference (especially for myself), here's how I'm currently running the wpt tool:
no_proxy=127.0.0.1 ./wpt run --binary `which google-chrome-beta` --binary-arg=--no-proxy-server --binary-arg=--enable-blink-features=MojoJS,MojoJSTest chrome gyroscope/Gyroscope.https.html
,
Jun 18 2018
,
Jun 21 2018
raphael.kubo.da.costa@, thanks for taking look at this issue.
I found another similar issue that when I use mock values to test screen-coordinate-system in w-p-t[1], following code snippet in file sensor_proxy.cc[2] restricts simulating turning device 90 degrees on the right only invokes when tests is running in Layout test runner.
uint16_t GetScreenOrientationAngleForPage(Page* page) {
if (LayoutTestSupport::IsRunningLayoutTest()) {
// Simulate that the device is turned 90 degrees on the right.
// 'orientation_angle' must be 270 as per
// https://w3c.github.io/screen-orientation/#dfn-update-the-orientation-information.
return 270;
}
return page->GetChromeClient().GetScreenInfo().orientation_angle;
}
[1] https://github.com/web-platform-tests/wpt/pull/11600/files
[2] https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/sensor/sensor_proxy.cc?q=isRunningLayoutTest&dr=C&l=69
|
|||
►
Sign in to add a comment |
|||
Comment 1 by raphael....@intel.com
, Jun 15 2018Owner: raphael....@intel.com
Status: Assigned (was: Unconfirmed)