tor-browser

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

nested_fullscreen.https.html (2573B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/resources/testdriver.js"></script>
      5 <script src="/resources/testdriver-vendor.js"></script>
      6 <script src="../resources/webxr_util.js"></script>
      7 <script src="../resources/webxr_test_constants.js"></script>
      8 <script src="../resources/webxr_test_asserts.js"></script>
      9 
     10 <style type="text/css">
     11  div {
     12      padding: 10px;
     13      min-width: 10px;
     14      min-height: 10px;
     15  }
     16  iframe {
     17    border: 0;
     18    width: 20px;
     19    height: 20px;
     20  }
     21 </style>
     22 <div id="div_overlay">
     23  <canvas>
     24  </canvas>
     25 </div>
     26 <div id="div_other">
     27  <p>test text</p>
     28 </div>
     29 
     30 <script>
     31 
     32 const fakeDeviceInitParams = {
     33  supportedModes: ["immersive-ar"],
     34  views: VALID_VIEWS,
     35  viewerOrigin: IDENTITY_TRANSFORM,
     36  supportedFeatures: ALL_FEATURES,
     37 };
     38 
     39 // This test verifies that WebXR DOM Overlay mode works when the document is
     40 // already in fullscreen mode when the session starts. (This should work both
     41 // for a fullscreen-based overlay implementation and for one that treats the
     42 // overlay as an independent output.)
     43 promise_test(
     44  async (setup) => {
     45    setup.add_cleanup(() => document.exitFullscreen());
     46 
     47    // Fullscreen the <body> element before running the test. Currently, this
     48    // can't be an arbitrary element because the simulateUserActivation call
     49    // adds a button to <body> which is only clickable if it's visible.
     50    await test_driver.bless("fullscreen",
     51                            () => document.body.requestFullscreen());
     52 
     53    const overlayElement = document.getElementById('div_overlay');
     54 
     55    xr_session_promise_test(
     56      "Check XR session from fullscreen",
     57      (session, fakeDeviceController, t) => {
     58        // The overlay element should have a transparent background.
     59        assert_equals(window.getComputedStyle(overlayElement).backgroundColor,
     60                      'rgba(0, 0, 0, 0)');
     61 
     62        // Check that the pseudostyle is set.
     63        assert_equals(document.querySelector(':xr-overlay'), overlayElement);
     64 
     65        // Wait for one animation frame before exiting.
     66        return new Promise((resolve) => session.requestAnimationFrame(resolve));
     67      },
     68      fakeDeviceInitParams, 'immersive-ar', {
     69        requiredFeatures: ['dom-overlay'],
     70        domOverlay: { root: overlayElement }
     71      }
     72    );
     73 
     74    // The setup promise_test automatically succeeds if it gets here
     75    // without raising an exception. It'll pass even on systems that
     76    // don't support WebXR or DOM Overlay.
     77  },
     78  "fullscreen setup"
     79 );
     80 
     81 </script>