state-attribute-changes-when-selecting-device-manual.html (1638B)
1 <!DOCTYPE html> 2 <html> 3 <title> 4 Test that the remote playback state changes when selecting a device 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! 22 </p> 23 <button id="prompt-button">Pick device</button> 24 </div> 25 </body> 26 <script src="./prepare-device.js"></script> 27 <script> 28 let v = document.createElement("video"); 29 v.src = getVideoURI("/media/movie_5"); 30 31 async_test(t => { 32 assert_equals(v.remote.state, "disconnected"); 33 34 function callback(available) { 35 promise_test(() => { 36 return v.remote.prompt().then( 37 t.step_func(() => { 38 assert_equals(v.remote.state, "connecting"); 39 }) 40 ); 41 }, "Prompt call resolves"); 42 } 43 44 let button = document.getElementById("prompt-button"); 45 button.onclick = () => { 46 v.remote.watchAvailability(t.step_func_done(callback)).then( 47 t.step_func(() => {}), 48 t.unreached_func() 49 ); 50 }; 51 }, "Test that the remote playback state changes when selecting a device."); 52 </script> 53 </html>