tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

xrSession_cancelAnimationFrame_invalidhandle.https.html (1509B)


      1 <!DOCTYPE html>
      2 <body>
      3  <script src=/resources/testharness.js></script>
      4  <script src=/resources/testharnessreport.js></script>
      5  <script src="resources/webxr_util.js"></script>
      6  <script src="resources/webxr_test_constants.js"></script>
      7  <script>
      8    let immersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
      9      + "behavior when given invalid handles on immersive testSession";
     10    let nonImmersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
     11      + "behavior when given invalid handles on non-immersive testSession";
     12 
     13    let fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
     14 
     15    let testFunction = (testSession) => new Promise((resolve) => {
     16      let counter = 0;
     17 
     18      function onFrame(time, vrFrame) {
     19        if(counter <= 10) {
     20          testSession.requestAnimationFrame(onFrame);
     21        } else {
     22          resolve();
     23        }
     24        counter++;
     25      }
     26 
     27      let handle = testSession.requestAnimationFrame(onFrame);
     28      testSession.cancelAnimationFrame(0);
     29      testSession.cancelAnimationFrame(-1);
     30      testSession.cancelAnimationFrame(handle + 1);
     31      testSession.cancelAnimationFrame(handle - 1);
     32      testSession.cancelAnimationFrame(0.5);
     33      testSession.cancelAnimationFrame(null);
     34    });
     35 
     36    xr_session_promise_test(
     37      immersiveTestName, testFunction, fakeDeviceInitParams, 'immersive-vr');
     38    xr_session_promise_test(
     39      nonImmersiveTestName, testFunction, fakeDeviceInitParams, 'inline');
     40 
     41  </script>
     42 </body>