blob: 58d1ed8d8e3eb6f348d0b389c725e9b5c5a87590 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<body>
<video src="../../content/test.mp4" style="width: 320px; height: 240px;" controls autoplay></video>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("This test pauses the video, presses the fullscreen button, and drags the controls when the mouse is over a button. It should follow the mouse drag.");
const media = document.querySelector("video");
const shadowRoot = window.internals.shadowRoot(media);
let mediaControls = shadowRoot.lastChild;
media.addEventListener("webkitbeginfullscreen", () => {
debug("webkitbeginfullscreen");
});
media.addEventListener("webkitfullscreenchange", () => {
if (media.webkitDisplayingFullscreen) {
mediaControls = shadowRoot.lastChild;
shouldBecomeEqual("!!mediaControls.querySelector('.buttons-container.left')", "true", () => {
shouldBecomeEqualToString("mediaControls.querySelector('.buttons-container.left').style.width", "118px", () => {
const bounds = mediaControls.querySelector(".controls-bar").getBoundingClientRect();
eventSender.mouseMoveTo(bounds.left + 210, bounds.top + 25);
eventSender.mouseDown();
eventSender.mouseMoveTo(bounds.left + 160, bounds.top - 75);
eventSender.mouseUp();
window.requestAnimationFrame(() => {
shouldBeEqualToString("mediaControls.querySelector('.controls-bar').style.transform", "translate(-50px, -100px)");
finishJSTest();
});
});
});
}
});
media.addEventListener("play", () => {
media.pause();
window.requestAnimationFrame(() => {
const bounds = mediaControls.querySelector("button.fullscreen").getBoundingClientRect();
eventSender.mouseMoveTo(bounds.left + 1, bounds.top + 1);
eventSender.mouseDown();
eventSender.mouseUp();
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>