Bug 1603336 [wpt PR 20737] - Various webxr WPT fixes, a=testonly
authorManish Goregaokar <manishsmail@gmail.com>
Tue, 17 Dec 2019 16:21:02 +0000
changeset 507786 c6dbb106ae576d0dae4ef26b2de2a6d892ec3880
parent 507785 e0bdc22c9bf9c74d0468e7f2b10ad3812489c438
child 507787 709d9a62d4cb89f411d12b3ae9f4014618c73b7d
push id103625
push userwptsync@mozilla.com
push dateThu, 19 Dec 2019 11:17:20 +0000
treeherderautoland@f03309629a99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1603336, 20737
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1603336 [wpt PR 20737] - Various webxr WPT fixes, a=testonly Automatic update from web-platform-tests Update webxr timestamp test to not compare against window.rAF() The exact desired behavior is unclear, see https://github.com/immersive-web/webxr/issues/943 and https://github.com/immersive-web/webxr/issues/225 -- Fix xrDevice_requestSession_no_mode to test for a throw, not a rejection -- Allow spawning inline sessions without interaction -- wpt-commits: be18a267fd4eaac9228ce681c68b3f7fa73d19e3, e9a537ff548399c0ff48f4d554081a86af30fb56, 39bacd5cc2180c62ca0468e646be16f81f353f28 wpt-pr: 20737
testing/web-platform/tests/webxr/xrDevice_requestSession_no_mode.https.html
testing/web-platform/tests/webxr/xrSession_requestAnimationFrame_timestamp.https.html
testing/web-platform/tests/webxr/xrWebGLLayer_constructor.https.html
--- a/testing/web-platform/tests/webxr/xrDevice_requestSession_no_mode.https.html
+++ b/testing/web-platform/tests/webxr/xrDevice_requestSession_no_mode.https.html
@@ -6,18 +6,17 @@
   <script src="resources/webxr_test_constants.js"></script>
   <script>
     xr_promise_test(
       "Requesting a session with no mode rejects",
       (t) => {
         return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
           .then( (controller) => new Promise((resolve) => {
             navigator.xr.test.simulateUserActivation( () => {
-              resolve(promise_rejects(
-                t,
-                new TypeError(),
-                navigator.xr.requestSession()
-              ))
+              t.step_func(() => {
+                assert_throws(new TypeError(), () => navigator.xr.requestSession())
+              })
+              resolve()
             });
           }));
       });
   </script>
 </body>
--- a/testing/web-platform/tests/webxr/xrSession_requestAnimationFrame_timestamp.https.html
+++ b/testing/web-platform/tests/webxr/xrSession_requestAnimationFrame_timestamp.https.html
@@ -15,43 +15,47 @@ let nonImmersiveTestName = "XRFrame getV
 let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
 
 let testFunction = function(session, fakeDeviceController, t) {
   return session.requestReferenceSpace('viewer')
     .then((referenceSpace) => new Promise((resolve, reject) => {
       let counter = 0;
       let windowFrameTime = 0;
       let frameTime = 0;
+      let lastFrameTime = 0;
+      let firstFrame = true;
 
       function onFrameFirst(time, xrFrame) {
+        lastFrameTime = frameTime;
         frameTime = time;
+        firstFrame = false;
         let now = performance.now();
 
         t.step( () => {
           // This callback must be the first one called.
           assert_equals(counter, 0);
 
-          // window.requestAnimationFrame and session.requestAnimationFrame
-          // should be providing timestamps that are on the same scale and
-          // within a resonable margin of error of eachother. This means that
-          // this frame's timestamp should be larger than one provided to a
-          // previous window.requestAnimationFrame and should also be within
-          // a sane delta of it. One minute is probably overly generous here,
-          // but it will at least catch cases where the times are reported with
-          // entirely different bases.
-          assert_greater_than(frameTime, windowFrameTime);
-          assert_approx_equals(frameTime, windowFrameTime, ONE_MINUTE);
+          if (!firstFrame) {
+            assert_greater_than(frameTime, lastFrameTime);
+            assert_approx_equals(frameTime, lastFrameTime, TEN_SECONDS);
+          }
 
           // There's going to be some disparity between performance.now() and
           // the timestamp passed into the callback, but it shouldn't be huge.
           // If they're more than ten seconds apart something has gone horribly
           // wrong.
           assert_approx_equals(frameTime, now, TEN_SECONDS);
         });
 
+        if (firstFrame) {
+          session.requestAnimationFrame(onFrameFirst);
+        } else {
+          resolve();
+        }
+
         counter++;
       }
 
       function onFrameSubsequent(time, xrFrame) {
         t.step( () => {
           // The timestamp passed to this callback should be exactly equal to
           // the one passed to the first callback in this set.
           assert_equals(time, frameTime);
@@ -60,31 +64,24 @@ let testFunction = function(session, fak
         counter++;
       }
 
       function onFrameLast(time, xrFrame) {
         t.step( () => {
           // Make sure all the previous callbacks fired as expected.
           assert_equals(counter, 11);
         });
-
-        // Finished.
-        resolve();
       }
 
-      window.requestAnimationFrame((time) => {
-        windowFrameTime = time;
-
-        // Queue up several callbacks
-        session.requestAnimationFrame(onFrameFirst);
-        for (let i = 0; i < 10; ++i) {
-          session.requestAnimationFrame(onFrameSubsequent);
-        }
-        session.requestAnimationFrame(onFrameLast);
-      });
+      session.requestAnimationFrame(onFrameFirst);
+      // Queue up several callbacks
+      for (let i = 0; i < 10; ++i) {
+        session.requestAnimationFrame(onFrameSubsequent);
+      }
+      session.requestAnimationFrame(onFrameLast);
 
     }));
 };
 
 xr_session_promise_test(
   immersiveTestName, testFunction, fakeDeviceInitParams, 'immersive-vr');
 xr_session_promise_test(
   nonImmersiveTestName, testFunction, fakeDeviceInitParams, 'inline');
--- a/testing/web-platform/tests/webxr/xrWebGLLayer_constructor.https.html
+++ b/testing/web-platform/tests/webxr/xrWebGLLayer_constructor.https.html
@@ -26,22 +26,24 @@ xr_promise_test("Ensure that XRWebGLLaye
           }
         });
     })
     .then(() => {
       return new Promise((resolve) => {
         navigator.xr.test.simulateUserActivation(() => {
           navigator.xr.requestSession('immersive-vr')
           .then((session) => {
-            try {
-              let webglLayerIncompatible = new XRWebGLLayer(session, gl);
-              assert_unreached("XRWebGLLayer should fail when created with a context that is not XRCompatible")
-            } catch (err) {
-              assert_equals(err.name, "InvalidStateError");
-            }
+            t.step_func(() => {
+              try {
+                let webglLayerIncompatible = new XRWebGLLayer(session, gl);
+                assert_unreached("XRWebGLLayer should fail when created with a context that is not XRCompatible")
+              } catch (err) {
+                assert_equals(err.name, "InvalidStateError");
+              }
+            })
 
             gl.makeXRCompatible();
 
             try {
               let webglLayerGood = new XRWebGLLayer(session, gl);
             } catch (err) {
               reject("XRWebGLLayer should not fail with valid arguments");
             }