event-handlers-manual.html (2059B)
1 <!DOCTYPE html> 2 <html> 3 <title> 4 Test that all event handlers are called when a remote playback device is connected 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 a device for remote playback is <b>available.</b></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 select 21 one! After connecting to the device, please click again and disconnect 22 from device. 23 </p> 24 <button id="prompt-button">Pick device</button> 25 <button id="disconnect-button" style="display: none"> 26 Disconnect device 27 </button> 28 </div> 29 </body> 30 <script src="./prepare-device.js"></script> 31 <script> 32 let v = document.createElement("video"); 33 v.src = getVideoURI("/media/movie_5"); 34 35 async_test(t => { 36 let promptButton = document.getElementById("prompt-button"); 37 let disconnectButton = document.getElementById("disconnect-button"); 38 39 const w = new EventWatcher(t, v.remote, ['connecting', 'connect', 'disconnect']); 40 w.wait_for(['connecting', 'connect', 'disconnect']).then(t.step_func_done()); 41 42 promptButton.onclick = () => { 43 promise_test(() => { 44 return v.remote.prompt().then(() => { 45 promptButton.style.display = "none"; 46 disconnectButton.style.display = "inline"; 47 }); 48 }, "Prompt to connect to the device"); 49 }; 50 51 disconnectButton.onclick = () => { 52 promise_test(() => { 53 return v.remote.prompt() 54 }, "Prompt to disconnect from the device") 55 }; 56 }, "Test that all event handlers are called when a remote playback device is connected."); 57 </script> 58 </html>