blob: ef8fcfc56022bdba82595102d83008ace9f6c516 [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-loader.js" type="text/javascript"></script>
<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
<body>
<style type="text/css" media="screen">
video, #host {
position: absolute;
top: 0;
left: 0;
width: 800px;
height: 240px;
}
</style>
<video controls></video>
<div id="host"></div>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Testing the <code>PiPSupport</code> behavior when clicking the PiP button.");
if (window.internals)
window.internals.settings.setAllowsPictureInPictureMediaPlayback(true);
const container = document.querySelector("div#host");
const media = document.querySelector("video");
const mediaController = createControls(container, media, null);
media.addEventListener("webkitpresentationmodechanged", () => {
shouldBeEqualToString("media.webkitPresentationMode", "picture-in-picture");
container.remove();
media.remove();
finishMediaControlsTest();
});
media.addEventListener("playing", () => {
shouldBecomeDifferent("mediaController.controls.pipButton.element.getBoundingClientRect().width", "0", () => {
media.pause();
pressOnElement(mediaController.controls.pipButton.element);
});
});
media.src = "../../content/test.mp4";
media.play();
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>