blob: 55226a8bd74aaa9197890649fb971b24a72cd70b [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<body>
<video src="../../content/test.mp4" style="position: absolute; left: 0; top: 0; width: 320px; height: 240px;" controls autoplay></video>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Testing the controls bar appears when the mouse enters and disappears when the mouse leaves the media.");
const media = document.querySelector("video");
const shadowRoot = window.internals.shadowRoot(media);
media.addEventListener("play", (event) => {
shouldBecomeEqual("!!shadowRoot.querySelector('.media-controls')", "true", () => {
debug("");
debug("Video started playing, controls bar should become visible by default.");
shouldBecomeEqual("shadowRoot.querySelector('.media-controls').classList.contains('faded')", "false", () => {
debug("");
debug("Controls bar should become faded when the auto-hide timer elapses.");
shouldBecomeEqual("shadowRoot.querySelector('.media-controls').classList.contains('faded')", "true", () => {
eventSender.mouseMoveTo(100, 100);
debug("");
debug("Mouse moved over the media, controls bar should become visible again.");
shouldBecomeEqual("shadowRoot.querySelector('.media-controls').classList.contains('faded')", "false", () => {
eventSender.mouseMoveTo(400, 400);
debug("");
debug("Mouse moved out of the media, controls bar should become faded.");
shouldBecomeEqual("shadowRoot.querySelector('.media-controls').classList.contains('faded')", "true", () => {
debug("");
media.remove();
finishJSTest();
});
});
});
});
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>