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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc004-magic-header.html

Issue 1970483002: Convert track-webvtt-tc[003-005] 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 the magic file header "WEBVTT" leads to the file properly reco gnized as a WebVTT file.</title>
3 <head> 3 <script src="track-helpers.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 src="captions-webvtt/tc004-webvtt-file.vtt">
8 <track src="captions-webvtt/tc004-webvtt-rubbish.vtt">
9 <track src="captions-webvtt/tc004-no-webvtt.vtt">
10 </video>
11 <script>
12 async_test(function(t) {
13 var video = document.querySelector("video");
14
15 var trackElements = document.querySelectorAll("track");
16 trackElements[0].onload = t.step_func(trackLoaded);
17 trackElements[1].onload = t.step_func(trackLoaded);
18 trackElements[2].onerror = t.step_func(trackLoaded);
19
20 enableAllTextTracks(video.textTracks);
5 21
6 <script src=../media-file.js></script> 22 var numberOfTracksLoaded = 0;
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 23 function trackLoaded() {
8 (Please avoid writing new tests using video-test.js) --> 24 numberOfTracksLoaded++;
9 <script src=../video-test.js></script> 25 if (numberOfTracksLoaded != 3)
10 <script> 26 return;
11 27
12 numberOfTrackTests = 3; 28 testTrack(0);
29 testTrack(1);
30 testTrackError(2);
31 t.done();
32 }
13 33
14 function trackLoaded() 34 function testTrack(index) {
35 var expected = [
15 { 36 {
16 numberOfTracksLoaded++; 37 id : "1",
17 if (numberOfTracksLoaded == numberOfTrackTests) { 38 startTime : 0,
18 testTrack(0); 39 endTime : 30.5,
19 testTrack(1); 40 text : "Bear is Coming!!!!!"
20 testTrackError(2); 41 },
21 } 42 {
43 id : "2",
44 startTime : 31,
45 endTime : 1200.5,
46 text : "I said Bear is coming!!!!"
22 } 47 }
48 ];
23 49
24 function testTrack(i) 50 assert_cues_equal(video.textTracks[index].cues, expected);
25 { 51 }
26 findMediaElement();
27 var expected =
28 {
29 length : 2,
30 tests:
31 [
32 {
33 property : "id",
34 values : [1, 2],
35 },
36 {
37 property : "startTime",
38 values : [0.0, 31.0],
39 },
40 {
41 property : "endTime",
42 values : [30.5, 1200.5],
43 },
44 {
45 property : "text",
46 values : ["Bear is Coming!!!!!", "I said Bear is com ing!!!!"],
47 },
48 ],
49 };
50 testCues(i, expected);
51 52
52 allTestsEnded(); 53 function testTrackError(index) {
53 } 54 assert_cues_equal(video.textTracks[index].cues, []);
54 55 }
55 function testTrackError(i) 56 });
56 { 57 </script>
57 findMediaElement();
58 var expected =
59 {
60 length : 0,
61 tests:
62 [],
63 };
64 testCues(i, expected);
65
66 allTestsEnded();
67 }
68 </script>
69 </head>
70 <body onload="enableAllTextTracks()">
71 <p>Tests that the magic file header "WEBVTT" leads to the file properly recognized as a WebVTT file.</p>
72 <video>
73 <track src="captions-webvtt/tc004-webvtt-file.vtt" onload="trackLoad ed()">
74 <track src="captions-webvtt/tc004-webvtt-rubbish.vtt" onload="trackL oaded()">
75 <track src="captions-webvtt/tc004-no-webvtt.vtt" onerror="trackLoade d()">
76 </video>
77 </body>
78 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698