blob: 89d227cf8902b69b235b841f86515dfe46cf9fa7 [file] [log] [blame]
<!DOCTYPE html>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-utils.js" type="text/javascript"></script>
<body>
<video src="../../content/test.mp4" style="width: 320px; height: 240px;" controls></video>
<div id="shadow"></div>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Testing the rewind button in fullscreen.");
const media = document.querySelector("video");
const button = document.body.appendChild(document.createElement("button"));
button.addEventListener("click", () => media.webkitEnterFullscreen());
media.addEventListener("loadedmetadata", () => {
pressOnElement(button);
shouldBecomeEqual('!!window.internals.shadowRoot(media).lastChild.querySelector("button.rewind")', "true", () => {
shouldBeTrue("media.webkitDisplayingFullscreen");
debug("");
debug("Setting media.currentTime to 5s");
media.currentTime = 5;
shouldBe("media.currentTime", "5");
shouldBeTrue("media.paused");
debug("");
debug("Starting to press on the skip back button");
const forwardButtonElement = window.internals.shadowRoot(media).lastChild.querySelector("button.rewind");
forwardButtonElement.dispatchEvent(new MouseEvent("mousedown"));
shouldBecomeEqual("media.currentTime < 4.5", "true", () => {
forwardButtonElement.dispatchEvent(new MouseEvent("mouseup"));
shouldBeTrue("media.paused");
debug("");
media.remove();
button.remove();
finishJSTest();
});
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>