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

Unified Diff: LayoutTests/media/video-controls-captions-multiple-clicks.html

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
Index: LayoutTests/media/video-controls-captions-multiple-clicks.html
diff --git a/LayoutTests/media/video-controls-captions-multiple-clicks.html b/LayoutTests/media/video-controls-captions-multiple-clicks.html
new file mode 100644
index 0000000000000000000000000000000000000000..f898c0634b15e39c323f9a0f87da1cf7658aeb8e
--- /dev/null
+++ b/LayoutTests/media/video-controls-captions-multiple-clicks.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>Test closed caption button toggling.</title>
+ <script src=media-file.js></script>
+ <script src=media-controls.js></script>
+ <script src=video-test.js></script>
+ <script>
+ var displayElement;
+ var track;
+ var text = ["First", "Second", "Third"];
+
+ function addTextTrack()
+ {
+ track = video.addTextTrack('captions');
+
+ for(var i = 0; i < 3; i++) {
+ var cue = new TextTrackCue(0, 120, text[i]);
+ track.addCue(cue);
+ }
+ }
+
+ function checkCaptionsDisplay()
+ {
+ for (var i = 0; i < 3; i++) {
+ try {
+ displayElement = textTrackDisplayElement(video, 'display', i);
+ testExpected("displayElement.innerText", text[i]);
+ } catch(e) {
+ consoleWrite(e);
+ }
+ }
+ }
+
+ function startTest()
+ {
+ if (!window.eventSender) {
+ consoleWrite("No eventSender found.");
+ failTest();
+ }
+
+ addTextTrack();
+
+ findMediaElement();
+ testClosedCaptionsButtonVisibility(true);
+
+ consoleWrite("");
+ consoleWrite("** The captions track should be listed in textTracks, but not yet loaded. **");
+ testExpected("video.textTracks.length", 1);
+ testExpected("video.textTracks[0].mode", "hidden");
+ checkCaptionsDisplay();
+
+ consoleWrite("");
+ consoleWrite("** Captions track should become visible after button is clicked **");
+ clickCCButton();
+ checkCaptionsDisplay();
+
+ consoleWrite("");
+ consoleWrite("** Captions should not be visible after button is clicked again **");
+ clickCCButton();
+ checkCaptionsDisplay();
+
+ consoleWrite("");
+ consoleWrite("** Captions should become visible after button is clicked again **");
+ clickCCButton();
+ checkCaptionsDisplay();
+
+ consoleWrite("");
+ endTest();
+ }
+
+ function loaded()
+ {
+ findMediaElement();
+ waitForEvent('canplaythrough', startTest);
+
+ video.src = findMediaFile('video', 'content/counting');
+ }
+ </script>
+</head>
+<body onload="loaded()">
+ <p>Tests that multiple toggles of the closed captions button still display captions</p>
+ <video controls></video>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698