blob: 1b3c3e62c05e98b208953d08b0586bc2361968e8 [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/CC+Subtitles.mov" style="position: absolute; left: 0; top: 0; width: 640px; height: 360px;" controls autoplay></video>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Ensure we have the Auto text track selected by default.");
const media = document.querySelector("video");
const shadowRoot = window.internals.shadowRoot(media);
media.addEventListener("play", () => {
media.pause();
shouldBecomeDifferent("shadowRoot.querySelector('button.tracks')", "null", () => {
shouldBecomeDifferent("shadowRoot.querySelector('button.tracks').getBoundingClientRect().width", "0", () => {
window.internals.setCaptionDisplayMode("automatic");
pressOnElement(shadowRoot.querySelector("button.tracks"));
shouldBecomeDifferent("shadowRoot.querySelector('.tracks-panel')", "null", () => {
shouldBeEqualToString("shadowRoot.querySelectorAll('li.selected')[1].textContent", "Auto (Recommended)");
debug("");
window.internals.setCaptionDisplayMode("forcedonly");
media.remove();
finishJSTest();
});
});
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>