Index: LayoutTests/media/media-controls.js |
diff --git a/LayoutTests/media/media-controls.js b/LayoutTests/media/media-controls.js |
index 30da5ba7c7f3eaff3f03266baf70c73687df2b4d..7b4c1fc25d03933fad4f87ced1afec31b99812d9 100644 |
--- a/LayoutTests/media/media-controls.js |
+++ b/LayoutTests/media/media-controls.js |
@@ -1,6 +1,16 @@ |
var captionsButtonElement; |
var captionsButtonCoordinates; |
+// These reflect the values used to fade in/out the media controls. Should |
+// mirror the values 'fadeInDuration'/'fadeOutDuration' in MediaControlElements.cpp. |
philipj_slow
2014/05/26 13:38:47
Add a comment in MediaControlsElements.cpp to poin
fs
2014/05/26 15:02:09
Done.
|
+const controlsFadeInDurationMs = 100; |
+const controlsFadeOutDurationMs = 300; |
+ |
+// The timeout for the hide-after-no-mouse-movement behavior. Defined (and |
+// should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls' |
+// in MediaControls.cpp. |
philipj_slow
2014/05/26 13:38:47
Same.
fs
2014/05/26 15:02:09
Done.
|
+const controlsMouseMovementTimeoutMs = 3000; |
+ |
function mediaControlsElement(first, id) |
{ |
for (var element = first; element; element = element.nextSibling) { |
@@ -109,3 +119,15 @@ function clickCCButton() |
eventSender.mouseDown(); |
eventSender.mouseUp(); |
} |
+ |
+function runAfterControlsHidden(func, mediaElement) |
+{ |
+ if (mediaElement && mediaElement.paused) |
philipj_slow
2014/05/26 13:38:47
It looks like the second argument is always includ
fs
2014/05/26 15:02:09
Maybe a bit too forward-thinking of me (I.e. allow
|
+ throw "The media element is not playing"; |
+ |
+ // Compute the time it'll take until the controls will be invisible - |
+ // assuming playback has been started prior to invoking this |
+ // function. Allow 500ms slack. |
+ var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDurationMs + 500; |
philipj_slow
2014/05/26 13:38:47
Maybe check that hideTimeoutMs >= 1000 * (mediaEle
fs
2014/05/26 15:02:09
Makes sense. Added (w/ added .loop).
|
+ setTimeout(func, hideTimeoutMs); |
+} |