blob: 4affb8b7aad67d60ccf10e7ae65066b4cb59b597 [file] [log] [blame]
<script src="../../../../../resources/js-test-pre.js"></script>
<script src="/media-resources/modern-media-controls/resources/media-controls-loader.js"></script>
<body>
<video src="http://127.0.0.1:8000/resources/load-and-stall.cgi?name=../../../media/content/test.mp4&mimeType=video/mp4&stallAt=1&stallFor=4" style="width: 320px; height: 240px;" controls></video>
<div id="shadow"></div>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Testing the <code>TimeControl</code> behavior for the loading state.");
const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
const media = document.querySelector("video");
const mediaController = createControls(shadowRoot, media, null);
debug("TimeControl should not be in loading state by default.");
shouldBeFalse("mediaController.controls.timeControl.loading")
media.addEventListener("stalled", function() {
debug("");
debug("Media is stalled, TimeControl should now be in the loading state.");
shouldBeTrue("mediaController.controls.timeControl.loading");
debug("");
shadowRoot.host.remove();
media.remove();
finishJSTest();
});
</script>
<script src="../../../../../resources/js-test-post.js"></script>
</body>