prompt-and-cancel-selection-manual.html (1133B)
1 <!DOCTYPE html> 2 <html> 3 <title> 4 Test that the Promise returned by prompt() is rejected when user cancels device selection 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> 20 async_test(t => { 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( 30 t.step_func_done(error => 31 assert_equals(error.name, "NotAllowedError") 32 ) 33 ) 34 ); 35 }, "Test that the Promise returned by prompt() is rejected when user cancels device selection."); 36 </script> 37 </html>