Index: LayoutTests/media/controls-cast-overlay-slow-fade.html |
diff --git a/LayoutTests/media/controls-cast-overlay-slow-fade.html b/LayoutTests/media/controls-cast-overlay-slow-fade.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3b4c5ecfb7e6d7fa9df446728f5fb7393a931b5f |
--- /dev/null |
+++ b/LayoutTests/media/controls-cast-overlay-slow-fade.html |
@@ -0,0 +1,62 @@ |
+<!doctype html> |
+<html> |
+ <head> |
+ <title>Test that the overlay cast button fades at the right time (neither too soon nor too late).</title> |
+ <script src="../resources/testharness.js"></script> |
+ <script src="../resources/testharnessreport.js"></script> |
+ <script src="media-file.js"></script> |
+ <script src="media-controls.js"></script> |
+ <script src="video-test.js"></script> |
+ </head> |
+ <body> |
+ <video loop></video> |
+ <script> |
+ var controls; |
+ var test; |
+ // The cast button should be visible for at least the controlsMouseMovementTimeout, and no more |
+ // than that plus the fadeout time. Allow 500ms margin at either side. |
+ var hideTimeoutLowerBound = controlsMouseMovementTimeoutMs - 500; |
+ var hideTimeoutUpperBound = controlsMouseMovementTimeoutMs + controlsFadeOutDurationMs + 500; |
+ function overlayCastButton(element) |
+ { |
+ var controlID = "-internal-media-controls-overlay-cast-button"; |
+ var button = mediaControlsElement(window.internals.shadowRoot(element).firstChild, controlID); |
+ return button; |
+ } |
+ function playing() |
+ { |
+ setTimeout(function() |
philipj_slow
2015/09/21 13:19:10
These also need to be wrapped in step_func. Note t
aberent
2015/09/21 14:59:20
Done. Making 'playing' an anonymous function, and
philipj_slow
2015/09/21 15:05:13
Yep, that looks good.
|
+ { |
+ button = overlayCastButton(video); |
+ // Now should have cast button |
+ style = window.getComputedStyle(button); |
+ visibility = style.getPropertyValue("visibility"); |
+ display = style.getPropertyValue("display"); |
+ assert_true(((display != "none")) && (visibility == "visible"), |
+ "button should exist, display = \"" + display + '\"'); |
+ }, hideTimeoutLowerBound); |
+ setTimeout(function() |
+ { |
+ button = overlayCastButton(video); |
+ // Cast button shoud be gone |
+ style = window.getComputedStyle(button); |
+ visibility = style.getPropertyValue("visibility"); |
+ display = style.getPropertyValue("display"); |
+ assert_false(((display != "none")) && (visibility == "visible"), |
+ "button should not exist, display = \"" + display + '\"'); |
+ test.done(); |
+ }, hideTimeoutUpperBound); |
+ } |
+ |
+ async_test(function(t) |
+ { |
+ test = t; |
philipj_slow
2015/09/21 13:19:10
Each step needs to be wrapped in t.step_func, othe
aberent
2015/09/21 14:59:19
Done.
|
+ findMediaElement(); |
+ video.src = findMediaFile("video", "content/test"); |
+ video.addEventListener("playing", playing); |
philipj_slow
2015/09/21 13:19:10
t.step_func(playing).
aberent
2015/09/21 14:59:19
Done.
|
+ internals.mediaPlayerRemoteRouteAvailabilityChanged(video, true); |
+ video.play(); |
+ }); |
+ </script> |
+ </body> |
+</html> |