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

Side by Side Diff: third_party/WebKit/LayoutTests/media/media-controls.js

Issue 2121613002: Convert video-controls-[captions, overlay, track]* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 var captionsButtonElement; 1 var captionsButtonElement;
2 var captionsButtonCoordinates; 2 var captionsButtonCoordinates;
3 3
4 // As specified in mediaControls.css, this is how long it takes to fade out cont rols 4 // As specified in mediaControls.css, this is how long it takes to fade out cont rols
5 const controlsFadeOutDurationMs = 300; 5 const controlsFadeOutDurationMs = 300;
6 6
7 // The timeout for the hide-after-no-mouse-movement behavior. Defined (and 7 // The timeout for the hide-after-no-mouse-movement behavior. Defined (and
8 // should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls' 8 // should mirror) the value 'timeWithoutMouseMovementBeforeHidingMediaControls'
9 // in MediaControls.cpp. 9 // in MediaControls.cpp.
10 const controlsMouseMovementTimeoutMs = 3000; 10 const controlsMouseMovementTimeoutMs = 3000;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 function selectTextTrack(video, index) 169 function selectTextTrack(video, index)
170 { 170 {
171 clickCCButton(); 171 clickCCButton();
172 var trackListItemElement = textTrackListItemAtIndex(video, index); 172 var trackListItemElement = textTrackListItemAtIndex(video, index);
173 var trackListItemCoordinates = elementCoordinates(trackListItemElement); 173 var trackListItemCoordinates = elementCoordinates(trackListItemElement);
174 clickAtCoordinates(trackListItemCoordinates[0], trackListItemCoordinates[1]) ; 174 clickAtCoordinates(trackListItemCoordinates[0], trackListItemCoordinates[1]) ;
175 } 175 }
176 176
177 function selectTextTrackAtIndex(video, index)
178 {
179 var captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggl e-closed-captions-button");
180 clickAtCoordinates(captionsButtonCoordinates[0], captionsButtonCoordinates[1 ]);
181 var trackListItemElement = textTrackListItemAtIndex(video, index);
182 var trackListItemCoordinates = elementCoordinates(trackListItemElement);
183 clickAtCoordinates(trackListItemCoordinates[0], trackListItemCoordinates[1]) ;
184 }
185
177 function turnClosedCaptionsOff(video) 186 function turnClosedCaptionsOff(video)
178 { 187 {
179 selectTextTrack(video, -1); 188 selectTextTrackAtIndex(video, -1);
180 } 189 }
181 190
182 function runAfterHideMediaControlsTimerFired(func, mediaElement) 191 function runAfterHideMediaControlsTimerFired(func, mediaElement)
183 { 192 {
184 if (mediaElement.paused) 193 if (mediaElement.paused)
185 throw "The media element is not playing"; 194 throw "The media element is not playing";
186 195
187 // Compute the time it'll take until the controls will be invisible - 196 // Compute the time it'll take until the controls will be invisible -
188 // assuming playback has been started prior to invoking this 197 // assuming playback has been started prior to invoking this
189 // function. Allow 500ms slack. 198 // function. Allow 500ms slack.
190 var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDuration Ms + 500; 199 var hideTimeoutMs = controlsMouseMovementTimeoutMs + controlsFadeOutDuration Ms + 500;
191 200
192 if (!mediaElement.loop && hideTimeoutMs >= 1000 * (mediaElement.duration - m ediaElement.currentTime)) 201 if (!mediaElement.loop && hideTimeoutMs >= 1000 * (mediaElement.duration - m ediaElement.currentTime))
193 throw "The media will end before the controls have been hidden"; 202 throw "The media will end before the controls have been hidden";
194 203
195 setTimeout(func, hideTimeoutMs); 204 setTimeout(func, hideTimeoutMs);
196 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698