blob: 544119a713f7ed2ae180cfd2ac03632b9f5480a6 [file] [log] [blame]
<script src="../../../resources/js-test-pre.js"></script>
<script src="../resources/media-controls-loader.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 <code>RemainingTimeSupport</code> behavior.");
const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
const media = document.querySelector("video");
const mediaController = createControls(shadowRoot, media, null);
mediaController.controls.timeControl.durationTimeLabel?.element.click();
media.addEventListener("timeupdate", (event) => {
debug("");
debug("timeupdate event was dispatched");
shouldBecomeEqual("mediaController.controls.timeControl.remainingTimeLabel.value", "media.currentTime - media.duration", () => {
debug("");
shadowRoot.host.remove();
media.remove();
finishJSTest();
});
});
media.addEventListener("durationchange", event => {
debug("durationchange event was dispatched");
shouldBecomeEqual("mediaController.controls.timeControl.remainingTimeLabel.value", "-media.duration", () => {
media.currentTime = 2;
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>