blob: e0e849a17f30e7d9b922c6dd1f0b4d78022b36ea [file] [edit]
<!DOCTYPE html>
<html>
<title>
Test that remote playback state changes when connecting and disconnecting.
</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/media.js"></script>
<script>
setup({ explicit_timeout: true });
</script>
<body>
<div id="prep">
<p>Please make sure a device for remote playback is <b>available.</b></p>
<button id="prompt-button-prep">Show devices</button>
<button id="start-button">Start test</button>
</div>
<div id="pick-device" style="display: none">
<p>
Click the button below to prompt for a remote playback device and select
one! After connecting to the device, please click again and disconnect
from device.
</p>
<button id="prompt-button">Pick device</button>
<button id="disconnect-button" style="display: none">
Disconnect device
</button>
</div>
</body>
<script src="./prepare-device.js"></script>
<script>
let v = document.createElement("video");
v.src = getVideoURI("/media/movie_5");
async_test((t) => {
v.remote.onconnecting = () => assert_equals(v.remote.state, "connecting");
v.remote.onconneced = () => assert_equals(v.remote.state, "connected");
v.remote.ondisconnected = () =>
assert_equals(v.remote.state, "disconnected");
let button = document.getElementById("prompt-button");
let disconnectButton = document.getElementById("disconnect-button");
button.onclick = () => {
promise_test(() => {
return v.remote.prompt().then(() => {
button.style.display = "none";
disconnectButton.style.display = "inline";
});
}, "Prompt to connect device");
};
disconnectButton.onclick = () => {
promise_test(() => {
return v.remote.prompt().then(() => t.done());
}, "Prompt to disconnect device");
};
}, "Test that remote playback state changes when connecting and disconnecting.");
</script>
</html>