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

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

Issue 2456993003: Improve caption button behavior for video player. (Closed)
Patch Set: Addresss feedback Created 4 years, 1 month 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: third_party/WebKit/LayoutTests/media/media-controls.js
diff --git a/third_party/WebKit/LayoutTests/media/media-controls.js b/third_party/WebKit/LayoutTests/media/media-controls.js
index 673e92aac340729f0748358ae9e20de04396ab20..367b0c3711beb07a63aec5e09509ba6878508f98 100644
--- a/third_party/WebKit/LayoutTests/media/media-controls.js
+++ b/third_party/WebKit/LayoutTests/media/media-controls.js
@@ -133,7 +133,8 @@ function clickAtCoordinates(x, y)
function textTrackListItemAtIndex(video, index)
{
var textTrackListElementID = "-internal-media-controls-text-track-list";
- var textTrackListElement = mediaControlsElement(internals.shadowRoot(video).firstChild, textTrackListElementID);
+ var textTrackListElement = mediaControlsElement(
+ internals.shadowRoot(video).firstChild, textTrackListElementID);
if (!textTrackListElement)
throw "Failed to find text track list element";
@@ -145,10 +146,16 @@ function textTrackListItemAtIndex(video, index)
}
}
-function clickTextTrackAtIndex(video, index)
+function clickCaptionButton(video)
{
- var captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button");
+ var captionsButtonCoordinates =
+ mediaControlsButtonCoordinates(video, "toggle-closed-captions-button");
clickAtCoordinates(captionsButtonCoordinates[0], captionsButtonCoordinates[1]);
+}
+
+function clickTextTrackAtIndex(video, index)
+{
+ clickCaptionButton(video);
var trackListItemElement = textTrackListItemAtIndex(video, index);
var trackListItemCoordinates = elementCoordinates(trackListItemElement);
clickAtCoordinates(trackListItemCoordinates[0], trackListItemCoordinates[1]);
@@ -159,6 +166,18 @@ function turnClosedCaptionsOff(video)
clickTextTrackAtIndex(video, -1);
}
+function checkCaptionsVisible(video, captions)
+{
+ for (var i = 0; i < captions.length; i++) {
+ assert_equals(textTrackCueElementByIndex(video, i).innerText, captions[i]);
+ }
+}
+
+function checkCaptionsHidden(video)
+{
+ assert_equals(textTrackDisplayElement(video), null);
+}
+
function runAfterHideMediaControlsTimerFired(func, mediaElement)
{
if (mediaElement.paused)
« no previous file with comments | « content/app/strings/content_strings.grd ('k') | third_party/WebKit/LayoutTests/media/video-controls-caption-single-track.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698