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

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

Issue 14056005: Added code to enable the first caption track if the user has requested captions and one such track … (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 8 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
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/media/video-controls-captions.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/media/media-controls.js
diff --git a/LayoutTests/media/media-controls.js b/LayoutTests/media/media-controls.js
index e0630476439bc8a4c84ac9bb472f0833f4e212ef..67f9fac06c827f3c50eed5c1dc6d20d7e03bd697 100644
--- a/LayoutTests/media/media-controls.js
+++ b/LayoutTests/media/media-controls.js
@@ -1,3 +1,5 @@
+var captionsButtonElement;
+var captionsButtonCoordinates;
function mediaControlsElement(first, id)
{
@@ -73,3 +75,36 @@ function textTrackDisplayElement(parentElement, id, cueNumber)
return displayElement;
}
+
+function testClosedCaptionsButtonVisibility(expected)
+{
+ try {
+ captionsButtonElement = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-toggle-closed-captions-button");
+ captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button");
+ } catch (exception) {
+ consoleWrite("Failed to find a closed captions button or its coordinates: " + exception);
+ if (expected)
+ failTest();
+ return;
+ }
+
+ consoleWrite("");
+ if (expected == true) {
+ consoleWrite("** Caption button should be visible and enabled because we have a captions track.");
+ testExpected("captionsButtonCoordinates[0]", 0, ">");
+ testExpected("captionsButtonCoordinates[1]", 0, ">");
+ testExpected("captionsButtonElement.disabled", false);
+ } else {
+ consoleWrite("** Caption button should not be visible as there are no caption tracks.");
+ testExpected("captionsButtonCoordinates[0]", 0, "<=");
+ testExpected("captionsButtonCoordinates[1]", 0, "<=");
+ }
+}
+
+function clickCCButton()
+{
+ consoleWrite("*** Click the CC button.");
+ eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordinates[1]);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/media/video-controls-captions.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698