<!DOCTYPE html>
<title>Test Picture-in-Picture element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="resources/picture-in-picture-helpers.js"></script>
<body></body>
<script>
promise_test(t => {
assert_equals(document.pictureInPictureElement, null);
const video = document.createElement('video');
return requestPictureInPictureWithTrustedClick(video)
.then(() => {
assert_equals(document.pictureInPictureElement, video);
return document.exitPictureInPicture();
})
.then(() => {
assert_equals(document.pictureInPictureElement, null);
})
});
</script>