blob: d32c3b921f064feb20a3f217c61cf515679d7a9b [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(() => {
document.exitPictureInPicture().then(endTest).catch(() => {
failTest('Failed to exit the Picture-in-Picture mode.');
});
})
.catch(() => {
failTest('request Picture-in-Picture does not resolve on user click.');
});
});
});
</script>
</head>
<body>
<div>This tests that request Picture-in-Picture resolves on user click.</div>
<video controls></video>
</body>
</html>