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