blob: 6465eebc1f938a30a0f3ab83a66bc6be0a04756d [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/CC+Subtitles.mov" style="width: 640px; height: 360px;" controls autoplay></video>
<script type="text/javascript">
description("Testing that clicking on a paused video's background to dimiss the tracks panel does not resume it.");
window.jsTestIsAsync = true;
const media = document.querySelector("video");
const shadowRoot = window.internals.shadowRoot(media);
media.addEventListener("play", () => {
media.pause();
shouldBeTrue("media.paused");
window.requestAnimationFrame(() => {
clickOnTracksButton();
window.requestAnimationFrame(() => {
clickOnVideoBackground();
shouldBeTrue("media.paused");
debug("");
media.remove();
finishJSTest();
});
});
});
function clickOnTracksButton()
{
debug("");
debug("Clicking on tracks button to show tracks panel");
clickOnElement(shadowRoot.lastChild.querySelector("button.tracks"), 1, 1);
}
function clickOnVideoBackground()
{
debug("");
debug("Clicking on video background");
clickOnElement(media, 5, 5);
}
function clickOnElement(element, relativeX, relativeY)
{
const bounds = element.getBoundingClientRect();
eventSender.mouseMoveTo(bounds.left + relativeX, bounds.top + relativeY);
eventSender.mouseDown();
eventSender.mouseUp();
}
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>