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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-mode-triggers-loading.html

Issue 1942633002: Convert track-mode* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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 <title>Tests that a "metadata" track does not load automatically, but does load when the mode is changed.</title>
3 <head> 3 <script src="../media-file.js"></script>
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <video>
7 <track kind="metadata" src="captions-webvtt/metadata.vtt">
8 </video>
9 <script>
10 async_test(function(t) {
11 var video = document.querySelector("video");
5 12
6 <script src=../media-file.js></script> 13 // Check initial metadata track state.
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 14 var track = document.querySelectorAll("track")[0];
8 (Please avoid writing new tests using video-test.js) --> 15 assert_equals(track.readyState, HTMLTrackElement.NONE);
9 <script src=../video-test.js></script> 16 assert_equals(video.textTracks[0].mode, "disabled");
10 <script>
11 17
12 function trackLoaded() 18 video.src = findMediaFile("video", "../content/test");
13 { 19 video.oncanplaythrough = t.step_func(canplaythrough);
14 consoleWrite("EVENT(load) -- &lt;track&gt;"); 20 track.onload = t.step_func_done(trackLoaded);
15 consoleWrite("<i>**check metadata track state<" + "/i>");
16 testExpected("track.readyState", HTMLTrackElement.LOADED);
17 testExpected("track.track.mode", "hidden");
18 testExpected("video.textTracks[0].cues.length", 12);
19 testExpected("video.textTracks[0].cues[11].startTime", 22);
20 consoleWrite("");
21 endTest();
22 }
23 21
24 function canplaythrough() 22 function trackLoaded() {
25 { 23 assert_equals(track.readyState, HTMLTrackElement.LOADED);
26 consoleWrite("EVENT(canplaythrough) -- &lt;video&gt;"); 24 assert_equals(track.track.mode, "hidden");
27 consoleWrite("<i>**change metadata track mode so it loads<" + "/ i>"); 25 assert_equals(video.textTracks[0].cues.length, 12);
28 testExpected("track.readyState", HTMLTrackElement.NONE); 26 assert_equals(video.textTracks[0].cues[11].startTime, 22);
29 testExpected("video.textTracks[0].mode", "disabled"); 27 }
30 testExpected("video.textTracks[0].cues", null);
31 run("video.textTracks[0].mode = 'hidden'");
32 consoleWrite("");
33 }
34 28
35 function start() 29 function canplaythrough() {
36 { 30 assert_equals(track.readyState, HTMLTrackElement.NONE);
37 consoleWrite("<br>EVENT(load) -- &lt;body&gt;"); 31 assert_equals(video.textTracks[0].mode, "disabled");
38 findMediaElement(); 32 assert_equals(video.textTracks[0].cues, null);
39 33 // Change metadata track mode so it loads.
40 consoleWrite("<i>**check initial metadata track state<" + "/i>") ; 34 video.textTracks[0].mode = "hidden";
41 track = document.querySelectorAll('track')[0]; 35 }
42 testExpected("track.readyState", HTMLTrackElement.NONE); 36 });
43 testExpected("video.textTracks[0].mode", "disabled"); 37 </script>
44
45 video.src = findMediaFile("video", "../content/test");
46 consoleWrite("");
47 }
48 </script>
49 </head>
50
51 <body onload="start()">
52 <p>Tests that a 'metadata' track does not load automatically, but does l oad when the mode is changed.</p>
53 <video oncanplaythrough="canplaythrough()" >
54 <track kind="metadata" src="captions-webvtt/metadata.vtt" onload="tr ackLoaded()">
55 </video>
56 </body>
57 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698