blob: 9a21f3cc21181a56e4d26ccb4d81164f5a26e3ab [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/CC+Subtitles.mov" style="position: absolute; left: 0; top: 0; width: 600px;" autoplay controls muted playsinline></video>
<script type="text/javascript">
window.jsTestIsAsync = true;
description("Ensure that clicking the tracks button when the tracks contextmenu is shown makes the contextmenu hide.");
const media = document.querySelector("video");
const shadowRoot = window.internals.shadowRoot(media);
window.internals.setMediaControlsMaximumRightContainerButtonCountOverride(media, 100); // A finite value larger than anything likely.
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"));
await UIHelper.waitForContextMenuToShow();
debug("Context menu shown.");
debug("Tapping tracks button...");
await pressOnElement(shadowRoot.querySelector("button.tracks"));
await UIHelper.waitForContextMenuToHide();
debug("Context menu hidden.");
debug("Tapping tracks button...");
await pressOnElement(shadowRoot.querySelector("button.tracks"));
await UIHelper.waitForContextMenuToShow();
debug("Context menu shown.");
debug("Tapping tracks button...");
await pressOnElement(shadowRoot.querySelector("button.tracks"));
await UIHelper.waitForContextMenuToHide();
debug("Context menu hidden.");
media.remove();
finishJSTest();
});
});
});
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>