blob: 2b53fce6b9ef10798f2284462d2ac7e9c712d9dd [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../video-test.js"></script>
<script src="../media-file.js"></script>
<script>
window.addEventListener('load', async event => {
if (!window.internals) {
failTest('This test requires window.internals.');
return;
}
findMediaElement();
run('internals.settings.setAllowsPictureInPictureMediaPlayback(true)');
run('internals.setMockVideoPresentationModeEnabled(true)');
run('video.src = findMediaFile("video", "../content/test")');
await waitFor(video, 'canplaythrough');
run('video.play()');
await waitFor(video, 'playing');
runWithKeyDown(() => {
video.webkitSetPresentationMode('picture-in-picture');
});
await waitFor(video, 'webkitpresentationmodechanged');
run('internals.beginMediaSessionInterruption("enteringbackground")');
testExpected('internals.mediaSessionState(video)', 'Playing');
run('internals.endMediaSessionInterruption("enteringbackground")');
testExpected('internals.mediaSessionState(video)', 'Playing');
endTest();
});
</script>
</head>
<body>
<div>This tests that video is in the correct media session state after ending a background interruption while pipped.</div>
<video controls></video>
</body>
</html>