blob: 5443030b97638dfe815a87f716e9b13a7bacc711 [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>MuteSupport</code> behavior by using the media API.");
const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
const media = document.querySelector("video");
const mediaController = createControls(shadowRoot, media, null);
shouldBeFalse("mediaController.controls.muteButton.muted");
let numberOfEvents = 0;
media.addEventListener("volumechange", function() {
debug("");
debug("volumechange event was dispatched");
numberOfEvents++;
if (numberOfEvents == 1) {
shouldBeTrue("media.muted");
shouldBeTrue("mediaController.controls.muteButton.muted");
media.muted = false;
} else if (numberOfEvents == 2) {
shouldBeFalse("media.muted");
shouldBeFalse("mediaController.controls.muteButton.muted");
debug("");
shadowRoot.host.remove();
media.remove();
finishJSTest();
}
});
media.muted = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>