tor-browser

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

prompt-and-watch-availability-no-device-manual.html (1679B)


      1 <!DOCTYPE html>
      2 <html>
      3  <title>
      4    Test that watchAvailability() runs the callback with false when there is no device for the user to select
      5  </title>
      6  <script src="/resources/testharness.js"></script>
      7  <script src="/resources/testharnessreport.js"></script>
      8  <script src="/common/media.js"></script>
      9  <script>
     10    setup({ explicit_timeout: true });
     11  </script>
     12  <body>
     13    <div id="prep">
     14      <p>Please make sure <b>no device is available</b> for remote playback.</p>
     15      <button id="prompt-button-prep">Show devices</button>
     16      <button id="start-button">Start test</button>
     17    </div>
     18    <div id="pick-device" style="display: none">
     19      <p>
     20        Click the button below to prompt for a remote playback device and
     21        cancel!
     22      </p>
     23      <button id="prompt-button">Pick device</button>
     24    </div>
     25  </body>
     26  <script src="./prepare-device.js"></script>
     27  <script>
     28    let v = document.createElement("video");
     29    v.src = getVideoURI("/media/movie_5");
     30 
     31    async_test(t => {
     32      let deviceAvailable = false;
     33      let button = document.getElementById("prompt-button");
     34      button.onclick = function () {
     35        v.remote
     36          .watchAvailability(t.step_func(avail => (deviceAvailable = avail)))
     37          .then(
     38            t.step_func(() => {
     39              assert_false(deviceAvailable);
     40              promise_rejects_dom(t, 'NotFoundError', v.remote.prompt())
     41              .then(() => {
     42                t.done();
     43              });
     44            }),
     45            t.unreached_func()
     46          );
     47      };
     48    }, "Test that watchAvailability() runs the callback with false when there is no device for the user to select.");
     49  </script>
     50 </html>