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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>Test closed caption button toggling.</title>
6 <script src=media-file.js></script>
7 <script src=media-controls.js></script>
8 <script src=video-test.js></script>
9 <script>
10 var displayElement;
11 var track;
12 var text = ["First", "Second", "Third"];
13
14 function addTextTrack()
15 {
16 track = video.addTextTrack('captions');
17
18 for(var i = 0; i < 3; i++) {
19 var cue = new TextTrackCue(0, 120, text[i]);
20 track.addCue(cue);
21 }
22 }
23
24 function checkCaptionsDisplay()
25 {
26 for (var i = 0; i < 3; i++) {
27 try {
28 displayElement = textTrackDisplayElement(video, 'display', i );
29 testExpected("displayElement.innerText", text[i]);
30 } catch(e) {
31 consoleWrite(e);
32 }
33 }
34 }
35
36 function startTest()
37 {
38 if (!window.eventSender) {
39 consoleWrite("No eventSender found.");
40 failTest();
41 }
42
43 addTextTrack();
44
45 findMediaElement();
46 testClosedCaptionsButtonVisibility(true);
47
48 consoleWrite("");
49 consoleWrite("** The captions track should be listed in textTracks, but not yet loaded. **");
50 testExpected("video.textTracks.length", 1);
51 testExpected("video.textTracks[0].mode", "hidden");
52 checkCaptionsDisplay();
53
54 consoleWrite("");
55 consoleWrite("** Captions track should become visible after button i s clicked **");
56 clickCCButton();
57 checkCaptionsDisplay();
58
59 consoleWrite("");
60 consoleWrite("** Captions should not be visible after button is clic ked again **");
61 clickCCButton();
62 checkCaptionsDisplay();
63
64 consoleWrite("");
65 consoleWrite("** Captions should become visible after button is clic ked again **");
66 clickCCButton();
67 checkCaptionsDisplay();
68
69 consoleWrite("");
70 endTest();
71 }
72
73 function loaded()
74 {
75 findMediaElement();
76 waitForEvent('canplaythrough', startTest);
77
78 video.src = findMediaFile('video', 'content/counting');
79 }
80 </script>
81 </head>
82 <body onload="loaded()">
83 <p>Tests that multiple toggles of the closed captions button still display c aptions</p>
84 <video controls></video>
85 </body>
86 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698