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

Side by Side Diff: third_party/WebKit/LayoutTests/media/video-controls-captions.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
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 functionality.</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 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 8 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
9 (Please avoid writing new tests using video-test.js) --> 9 (Please avoid writing new tests using video-test.js) -->
10 <script src=video-test.js></script> 10 <script src=video-test.js></script>
11 <script> 11 <script>
12 var track; 12 var track;
13 13
14 function addTextTrackThroughJS() 14 function addTextTrackThroughJS()
15 { 15 {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 findMediaElement(); 63 findMediaElement();
64 testClosedCaptionsButtonVisibility(true); 64 testClosedCaptionsButtonVisibility(true);
65 65
66 consoleWrite(""); 66 consoleWrite("");
67 consoleWrite("** The captions track should be listed in textTracks, but not yet loaded. **"); 67 consoleWrite("** The captions track should be listed in textTracks, but not yet loaded. **");
68 testExpected("video.textTracks.length", 1); 68 testExpected("video.textTracks.length", 1);
69 testExpected("video.textTracks[0].mode", "disabled"); 69 testExpected("video.textTracks[0].mode", "disabled");
70 checkCaptionsDisplay(); 70 checkCaptionsDisplay();
71 71
72 consoleWrite(""); 72 consoleWrite("");
73 consoleWrite("** Captions track should load and captions should beco me visible after button is clicked **"); 73 consoleWrite("** Captions track should load and captions should beco me visible after a track is selected **");
74 74
75 // Note: the test flow continues with "testCCButtonToggling" when th e 75 // Note: the test flow continues with "testCCTrackSelectionFunctiona lity" when the
76 // "load" event of the single TextTrack fires up. While the test str ucture 76 // "load" event of the single TextTrack fires up. While the test str ucture
77 // might seem weird, this avoids timeouts. 77 // might seem weird, this avoids timeouts.
78 clickCCButton(); 78 selectTextTrack(video, 0);
79 } 79 }
80 80
81 function testCCButtonToggling() 81 function testCCTrackSelectionFunctionality()
82 { 82 {
83 checkCaptionsDisplay(); 83 checkCaptionsDisplay();
84 84
85 consoleWrite(""); 85 consoleWrite("");
86 consoleWrite("** Captions should not be visible after button is clic ked again **"); 86 consoleWrite("** Captions should not be visible after Off is clicked **");
87 clickCCButton(); 87 turnClosedCaptionsOff(video);
88 checkCaptionsDisplay(); 88 checkCaptionsDisplay();
89 89
90 removeHTMLTrackElement(); 90 removeHTMLTrackElement();
91 testClosedCaptionsButtonVisibility(false); 91 testClosedCaptionsButtonVisibility(false);
92 92
93 addUnloadableHTMLTrackElement(); 93 addUnloadableHTMLTrackElement();
94 testClosedCaptionsButtonVisibility(true); 94 testClosedCaptionsButtonVisibility(true);
95 95
96 consoleWrite(""); 96 consoleWrite("");
97 clickCCButton(); 97 selectTextTrack(video, 0);
98 } 98 }
99 99
100 function trackError() 100 function trackError()
101 { 101 {
102 consoleWrite("** Track failed to load **"); 102 consoleWrite("** Track failed to load **");
103 testClosedCaptionsButtonVisibility(false); 103 testClosedCaptionsButtonVisibility(false);
104 104
105 addTextTrackThroughJS(); 105 addTextTrackThroughJS();
106 testClosedCaptionsButtonVisibility(true); 106 testClosedCaptionsButtonVisibility(true);
107 107
108 endTest(); 108 endTest();
109 } 109 }
110 110
111 function loaded() 111 function loaded()
112 { 112 {
113 findMediaElement(); 113 findMediaElement();
114 waitForEvent('canplaythrough', startTest); 114 waitForEvent('canplaythrough', startTest);
115 115
116 video.src = findMediaFile('video', 'content/counting'); 116 video.src = findMediaFile('video', 'content/counting');
117 } 117 }
118 </script> 118 </script>
119 </head> 119 </head>
120 <body onload="loaded()"> 120 <body onload="loaded()">
121 <p>Tests that the closed captions button, when toggled, updates the text tra ck display area.</p> 121 <p>Tests that the closed captions button enables track switching</p>
122 <video controls> 122 <video controls>
123 <track src="track/captions-webvtt/captions-fast.vtt" kind="captions" onl oad="testCCButtonToggling()"> 123 <track src="track/captions-webvtt/captions-fast.vtt" kind="captions" onl oad="testCCTrackSelectionFunctionality()">
124 </video> 124 </video>
125 </body> 125 </body>
126 </html> 126 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698