Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<title>Test of picture-in-picture</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="resources/utils.js"></script>
<body>
<script>
promise_test(async () => {
const frame = attachFencedFrameContext();
const result = await frame.execute(async () => {
const video = document.body.appendChild(document.createElement("video"));
try {
await video.requestPictureInPicture();
return 'PIP request succeeded.';
} catch (e) {
if (e.name == 'SecurityError') {
return 'PIP request failed';
} else {
return `PIP request failed but not with SecurityError - ${e.name}: ${e.message}`;
}
}
});
assert_equals(
result, 'PIP request failed',
'PIP request must fail in a fenced frame by permissions policy.');
}, 'Test HTMLVideoElement.requestPictureInPicture');
</script>
</body>