blob: c2876d4cc0bb2dbf2bdab563aba5c53a20184cee [file] [log] [blame]
<html>
<head>
<script src=media-file.js></script>
<script src=video-test.js></script>
<script>
window.addEventListener('load', async event => {
if (!window.internals) {
failTest('This test requires window.internals.');
return;
}
findMediaElement();
run('internals.setMediaElementRestrictions(video, "RequirePageVisibilityToPlayAudio")');
run('video.src = findMediaFile("video", "content/test")');
await waitFor(video, 'canplaythrough');
run('internals.setPageVisibility(false)');
run('promise = video.play()');
await shouldReject(promise);
run('internals.setPageVisibility(true)');
run('promise = video.play()');
await shouldResolve(promise);
run('internals.setPageVisibility(false)');
await waitFor(video, 'pause');
endTest();
});
</script>
</head>
<body>
<video controls loop></video>
</body>
</html>