blob: 89a73730efaf6409572ab407fb248675343da874 [file] [log] [blame]
Fritz Heidenfcda0e02023-09-05 22:48:041<!DOCTYPE html>
2<html>
3 <title>
Mark Foltz (Google)1c4413c2023-09-18 10:52:004 Test that the Promise returned by prompt() is rejected when user cancels device selection
Fritz Heidenfcda0e02023-09-05 22:48:045 </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 <p>
14 Click the button below to prompt for a remote playback device and
15 <b>cancel the selection</b> of a device!
16 </p>
17 <button id="prompt-button">Pick device</button>
18 </body>
19 <script>
Mark Foltz (Google)1c4413c2023-09-18 10:52:0020 async_test(t => {
Fritz Heidenfcda0e02023-09-05 22:48:0421 let v = document.createElement("video");
22 v.src = getVideoURI("/media/movie_5");
23
24 let button = document.getElementById("prompt-button");
25 button.onclick = t.step_func(() =>
26 v.remote
27 .prompt()
28 .then(t.unreached_func())
29 .catch(
Mark Foltz (Google)1c4413c2023-09-18 10:52:0030 t.step_func_done(error =>
Fritz Heidenfcda0e02023-09-05 22:48:0431 assert_equals(error.name, "NotAllowedError")
32 )
33 )
34 );
Mark Foltz (Google)1c4413c2023-09-18 10:52:0035 }, "Test that the Promise returned by prompt() is rejected when user cancels device selection.");
Fritz Heidenfcda0e02023-09-05 22:48:0436 </script>
37</html>