https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 933c42829a0b57ae83016a14eaafb152d37d343b authored by Yoav Weiss on 21 December 2018, 21:00:08 UTC
Fix resource-timing.html document.domain test
Tip revision: 933c428
xrSession_cancelAnimationFrame_invalidhandle.https.html
<!DOCTYPE html>
<body>
  <script src=/resources/testharness.js></script>
  <script src=/resources/testharnessreport.js></script>
  <script src="resources/webxr_util.js"></script>
  <canvas></canvas>
  <script>
    let immersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
      + "behavior when given invalid handles on immersive testSession";
    let nonImmersiveTestName = "XRSession cancelAnimationFrame does not have unexpected "
      + "behavior when given invalid handles on non-immersive testSession";

    let fakeDeviceInitParams = { supportsImmersive:true };

    let immersiveSessionOptions = { immersive: true };
    let nonImmersiveSessionOptions = { outputContext: getOutputContext() };

    let testFunction = (testSession) => new Promise((resolve) => {
      let counter = 0;

      function onFrame(time, vrFrame) {
        if(counter <= 10) {
          testSession.requestAnimationFrame(onFrame);
        } else {
          resolve();
        }
        counter++;
      }

      let handle = testSession.requestAnimationFrame(onFrame);
      testSession.cancelAnimationFrame(0);
      testSession.cancelAnimationFrame(-1);
      testSession.cancelAnimationFrame(handle + 1);
      testSession.cancelAnimationFrame(handle - 1);
      testSession.cancelAnimationFrame(0.5);
      testSession.cancelAnimationFrame(null);
    });

    xr_session_promise_test(
      immersiveTestName, testFunction, fakeDeviceInitParams, immersiveSessionOptions);
    xr_session_promise_test(
      nonImmersiveTestName, testFunction, fakeDeviceInitParams, nonImmersiveSessionOptions);

  </script>
</body>
back to top