| <!DOCTYPE html> |
| <script src="../../../resources/js-test-pre.js"></script> |
| <body> |
| <video src="../../content/test.mp4" style="position: absolute; left: 0; top: 0; width: 320px; height: 240px;" controls autoplay data-auto-hide-delay="250"></video> |
| <script type="text/javascript"> |
| |
| window.jsTestIsAsync = true; |
| |
| description("Testing the controls bar fades out as expected after the auto-hide delay expires upon first play."); |
| |
| let controlsBar; |
| |
| document.querySelector("video").addEventListener("play", (event) => { |
| const media = event.target; |
| |
| window.requestAnimationFrame(() => { |
| controlsBar = window.internals.shadowRoot(media).querySelector(".controls-bar"); |
| |
| debug("Video started playing, controls bar is visible by default."); |
| shouldBeFalse("controlsBar.classList.contains('faded')"); |
| }); |
| |
| setTimeout(() => { |
| debug(""); |
| debug("Auto-hide timer has been going for 200ms, controls bar should still be visible."); |
| shouldBeFalse("controlsBar.classList.contains('faded')"); |
| }, 200); |
| |
| setTimeout(() => { |
| debug(""); |
| debug("Auto-hide timer has elapsed, controls bar should be faded."); |
| shouldBeTrue("controlsBar.classList.contains('faded')"); |
| |
| debug(""); |
| media.remove(); |
| finishJSTest(); |
| }, 300); |
| }); |
| |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |