| Fritz Heiden | fcda0e0 | 2023-09-05 22:48:04 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <title> |
| Mark Foltz (Google) | 1c4413c | 2023-09-18 10:52:00 | [diff] [blame] | 4 | Test that the Promise returned by prompt() is rejected when user cancels device selection |
| Fritz Heiden | fcda0e0 | 2023-09-05 22:48:04 | [diff] [blame] | 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 | <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) | 1c4413c | 2023-09-18 10:52:00 | [diff] [blame] | 20 | async_test(t => { |
| Fritz Heiden | fcda0e0 | 2023-09-05 22:48:04 | [diff] [blame] | 21 | 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) | 1c4413c | 2023-09-18 10:52:00 | [diff] [blame] | 30 | t.step_func_done(error => |
| Fritz Heiden | fcda0e0 | 2023-09-05 22:48:04 | [diff] [blame] | 31 | assert_equals(error.name, "NotAllowedError") |
| 32 | ) |
| 33 | ) |
| 34 | ); |
| Mark Foltz (Google) | 1c4413c | 2023-09-18 10:52:00 | [diff] [blame] | 35 | }, "Test that the Promise returned by prompt() is rejected when user cancels device selection."); |
| Fritz Heiden | fcda0e0 | 2023-09-05 22:48:04 | [diff] [blame] | 36 | </script> |
| 37 | </html> |