blob: cc7e6244105133cdfdcad8213ae0faa4d422845e [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 => {
findMediaElement();
run('internals.settings.setAllowsPictureInPictureMediaPlayback(true)');
run('internals.setPictureInPictureAPITestEnabled(video, true)');
run('video.src = findMediaFile("video", "../content/test")');
await waitFor(video, 'canplaythrough');
runWithKeyDown(function() {
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>