blob: 1eac6e378a5a11e392c712bb6a754b06ca9df0ac [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<meta name="viewport" content="width=device-width">
<script src="../resources/media-controls-utils.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<script src="../../../resources/js-test-pre.js"></script>
<body>
<video src="../../content/counting-subtitled.m4v" style="position: absolute; left: 0; top: 0; width: 600px;" autoplay controls muted playsinline></video>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Ensure we have the Off text track selected by default.");
const media = document.querySelector("video");
const shadowRoot = window.internals.shadowRoot(media);
window.internals.setMediaControlsMaximumRightContainerButtonCountOverride(media, 100); // A finite value larger than anything likely.
let checkedItems = null;
media.addEventListener("play", () => {
media.pause();
shouldBecomeDifferent("shadowRoot.querySelector('button.tracks')", "null", () => {
shouldBecomeDifferent("shadowRoot.querySelector('button.tracks').getBoundingClientRect().width", "0", async () => {
debug("Tapping tracks button...");
await pressOnElement(shadowRoot.querySelector("button.tracks"));
contextmenu = await getTracksContextMenu();
checkedItems = contextmenu[0].children.filter((item) => item.checked);
shouldBe("checkedItems.length", "1");
shouldBeEqualToString("checkedItems[0].title", "Off");
media.remove();
finishJSTest();
});
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>