| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>Test that the overlay cast button fades at the right time (neither too so
on nor too late).</title> | |
| 3 <script src="../resources/testharness.js"></script> | |
| 4 <script src="../resources/testharnessreport.js"></script> | |
| 5 <script src="media-file.js"></script> | |
| 6 <script src="media-controls.js"></script> | |
| 7 <video loop></video> | |
| 8 <script> | |
| 9 async_test(function(t) { | |
| 10 // The cast button should be visible for at least the controlsMouseMovementT
imeout, | |
| 11 // and no more than that plus the fadeout time. Allow 500ms margin at either
side. | |
| 12 var hideTimeoutLowerBound = controlsMouseMovementTimeoutMs - 500; | |
| 13 var hideTimeoutUpperBound = controlsMouseMovementTimeoutMs + controlsFadeOut
DurationMs + 500; | |
| 14 | |
| 15 var video = document.querySelector("video"); | |
| 16 video.src = findMediaFile("video", "content/test"); | |
| 17 | |
| 18 video.onplaying = t.step_func(function() { | |
| 19 setTimeout(t.step_func(function() { | |
| 20 // Cast button should be visible | |
| 21 assert_true(isCastButtonVisible(), "button should exist"); | |
| 22 }), hideTimeoutLowerBound); | |
| 23 | |
| 24 setTimeout(t.step_func_done(function() { | |
| 25 // Cast button should be gone | |
| 26 assert_false(isCastButtonVisible(), "button should not exist"); | |
| 27 }), hideTimeoutUpperBound); | |
| 28 }); | |
| 29 | |
| 30 internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); | |
| 31 video.play(); | |
| 32 | |
| 33 function isCastButtonVisible() { | |
| 34 var controlID = "-internal-media-controls-overlay-cast-button"; | |
| 35 var button = mediaControlsElement(internals.shadowRoot(video).firstChild
, controlID); | |
| 36 var style = getComputedStyle(button); | |
| 37 var visibility = style.getPropertyValue("visibility"); | |
| 38 var display = style.getPropertyValue("display"); | |
| 39 return (display != "none" && visibility == "visible"); | |
| 40 } | |
| 41 }); | |
| 42 </script> | |
| OLD | NEW |