49 lines
1.2 KiB
HTML
49 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="media-file.js"></script>
|
|
<script src="video-test.js"></script>
|
|
<script>
|
|
var error;
|
|
|
|
function didResolvePromise()
|
|
{
|
|
logResult(Failed, "Expected promise to be rejected. Was resolved.");
|
|
|
|
// Wait some time before ending the test towards ensuring that we ended the session interruption.
|
|
endTestLater();
|
|
}
|
|
|
|
function didRejectPromise(e)
|
|
{
|
|
error = e;
|
|
logResult(true, "Promise rejected.");
|
|
testExpected("error.name", "NotSupportedError");
|
|
|
|
// Wait some time before ending the test towards ensuring that we ended the session interruption.
|
|
endTestLater();
|
|
}
|
|
|
|
function runTest()
|
|
{
|
|
if (!window.internals) {
|
|
failTest("This test must be run in DumpRenderTree or WebKitTestRunner.");
|
|
return;
|
|
}
|
|
findMediaElement();
|
|
run('internals.setMediaSessionRestrictions("videoaudio", "InterruptedPlaybackNotPermitted")');
|
|
run('video.src = "non-existent.mp4"');
|
|
testExpected("video.paused", true);
|
|
run('internals.beginMediaSessionInterruption("System")');
|
|
run("video.play().then(didResolvePromise).catch(didRejectPromise)");
|
|
run('internals.endMediaSessionInterruption("MayResumePlaying")');
|
|
}
|
|
|
|
window.onload = runTest;
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<video></video>
|
|
</body>
|
|
</html>
|