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

Side by Side Diff: LayoutTests/media/video-controls-captions-on-off.html

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

Powered by Google App Engine
This is Rietveld 408576698