blob: 9bfc0876993cf84187137af4202bf4fd9fd6f307 [file] [log] [blame]
<html>
<head>
<script src='media-file.js'></script>
<script src='video-test.js'></script>
<script>
var video;
function start()
{
findMediaElement();
if (window.internals) {
internals.setMockMediaPlaybackTargetPickerEnabled(true);
internals.settings.setAllowsAirPlayForMediaPlayback(true);
}
consoleWrite('** create initial callback');
run('video.disableRemotePlayback = true');
video.remote.watchAvailability(callback).then(failTest).catch(handleInitialError);
}
function callback(available) { };
function handleInitialError(exception)
{
consoleWrite(`EXPECTED ERROR: ${ exception }`);
consoleWrite('** try again without disableRemotePlayback');
run('video.disableRemotePlayback = false');
video.remote.watchAvailability(callback).then(succeeded).catch(failTest);
}
function succeeded(id)
{
consoleWrite('SUCCEEDED');
consoleWrite('** set disableRemotePlayback and try to cancel callback');
run('video.disableRemotePlayback = true');
video.remote.cancelWatchAvailability(id).then(failTest).catch(handleError);
}
function handleError(exception)
{
consoleWrite(`EXPECTED ERROR: ${ exception }`);
endTest();
}
</script>
</head>
<body onload='start()'>
<video controls></video>
<p>Test that trying to watchAvailability on a video with the "disableremoteplayback" attribute set will generate an error.</p>
</body>
</html>