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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-controls-captions-multiple-clicks.html

Issue 1079323002: Support text track selection in video controls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and lgtm nits Created 4 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
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 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
9 (Please avoid writing new tests using video-test.js) -->
10 <script src=video-test.js></script>
11 <script>
12 var displayElement;
13 var track;
14 var text = ["First", "Second", "Third"];
15
16 function addTextTrack()
17 {
18 track = video.addTextTrack('captions');
19
20 for(var i = 0; i < 3; i++) {
21 var cue = new VTTCue(0, 120, text[i]);
22 track.addCue(cue);
23 }
24 }
25
26 function checkCaptionsDisplay()
27 {
28 for (var i = 0; i < 3; i++) {
29 try {
30 displayElement = textTrackDisplayElement(video, 'display', i );
31 testExpected("displayElement.innerText", text[i]);
32 } catch(e) {
33 consoleWrite(e);
34 }
35 }
36 }
37
38 function startTest()
39 {
40 if (!window.eventSender) {
41 consoleWrite("No eventSender found.");
42 failTest();
43 }
44
45 addTextTrack();
46
47 findMediaElement();
48 testClosedCaptionsButtonVisibility(true);
49
50 consoleWrite("");
51 consoleWrite("** The captions track should be listed in textTracks, but not yet loaded. **");
52 testExpected("video.textTracks.length", 1);
53 testExpected("video.textTracks[0].mode", "hidden");
54 checkCaptionsDisplay();
55
56 consoleWrite("");
57 consoleWrite("** Captions track should become visible after button i s clicked **");
58 clickCCButton();
59 checkCaptionsDisplay();
60
61 consoleWrite("");
62 consoleWrite("** Captions should not be visible after button is clic ked again **");
63 clickCCButton();
64 checkCaptionsDisplay();
65
66 consoleWrite("");
67 consoleWrite("** Captions should become visible after button is clic ked again **");
68 clickCCButton();
69 checkCaptionsDisplay();
70
71 consoleWrite("");
72 endTest();
73 }
74
75 function loaded()
76 {
77 findMediaElement();
78 waitForEvent('canplaythrough', startTest);
79
80 video.src = findMediaFile('video', 'content/counting');
81 }
82 </script>
83 </head>
84 <body onload="loaded()">
85 <p>Tests that multiple toggles of the closed captions button still display c aptions</p>
86 <video controls></video>
87 </body>
88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698