Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Unified Diff: LayoutTests/media/media-controls.js

Issue 302603003: Cleanup tests related to controls hiding/fading in/out (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}

Powered by Google App Engine
This is Rietveld 408576698