tor-browser

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

depth_sensing_notEnabled.https.html (1868B)


      1 <!DOCTYPE html>
      2 <script src=/resources/testharness.js></script>
      3 <script src=/resources/testharnessreport.js></script>
      4 <script src="../resources/webxr_util.js"></script>
      5 <script src="../resources/webxr_test_constants.js"></script>
      6 
      7 <script>
      8 
      9 const testFunctionCpu = function (session, controller, t) {
     10  return session.requestReferenceSpace('viewer').then((viewerSpace) => {
     11    let done = false;
     12 
     13    session.requestAnimationFrame((time, frame) => {
     14      const pose = frame.getViewerPose(viewerSpace);
     15      for(const view of pose.views) {
     16        assert_throws_dom("NotSupportedError", () => frame.getDepthInformation(view),
     17                          "getDepthInformation() should throw when depth sensing is disabled");
     18      }
     19 
     20      done = true;
     21    });
     22 
     23    return t.step_wait(() => done);
     24  });
     25 };
     26 
     27 const testFunctionGpu = function (session, controller, t, sessionObjects) {
     28  return session.requestReferenceSpace('viewer').then((viewerSpace) => {
     29    let done = false;
     30 
     31    const glBinding = new XRWebGLBinding(session, sessionObjects.gl);
     32 
     33    session.requestAnimationFrame((time, frame) => {
     34      const pose = frame.getViewerPose(viewerSpace);
     35      for(const view of pose.views) {
     36        t.step(() => {
     37          assert_throws_dom("NotSupportedError", () => glBinding.getDepthInformation(view),
     38                            "getDepthInformation() should throw when depth sensing is disabled");
     39        });
     40      }
     41 
     42      done = true;
     43    });
     44 
     45    return t.step_wait(() => done);
     46  });
     47 };
     48 
     49 xr_session_promise_test(
     50  "XRFrame.getDepthInformation() rejects if depth sensing is not enabled on a session",
     51  testFunctionCpu,
     52  IMMERSIVE_AR_DEVICE,
     53  'immersive-ar');
     54 
     55 xr_session_promise_test(
     56  "XRWebGLBinding.getDepthInformation() rejects if depth sensing is not enabled on a session",
     57  testFunctionGpu,
     58  IMMERSIVE_AR_DEVICE,
     59  'immersive-ar');
     60 
     61 </script>