blob: e46474349312e3e1c0dd630f1845eb8d80966ea3 [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');
runWithKeyDown(() => {
video.requestPictureInPicture()
.then(pipWindow => {
window.pipWindow = pipWindow;
testExpected('pipWindow.width', 0, '>');
testExpected('pipWindow.height', 0, '>');
document.exitPictureInPicture().then(endTest).catch(() => {
failTest('Failed to exit the Picture-in-Picture mode.');
});
})
.catch(error => {
failTest("Failed to enter the Picture-in-Picture mode.");
});
});
});
</script>
</head>
<body>
<div>This tests that a pip window is returned correctly when a video element enters the Picture-in-Picture mode.</div>
<video controls></video>
</body>
</html>