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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc009-timings-hour.html

Issue 1962593002: Convert track-webvtt-tc[008-010] tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test failure Created 4 years, 6 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 cue timings that contain hours (they are optional), and tests vario us syntax errors in timings with hours.</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/tc009-timings-hour.vtt">
8 <track src="captions-webvtt/tc009-timings-hour-error.vtt">
9 </video>
10 <script>
11 async_test(function(t) {
12 var video = document.querySelector("video");
5 13
6 <script src=../media-file.js></script> 14 var trackElements = document.querySelectorAll("track");
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 15 for (var i = 0; i < video.textTracks.length; i++)
8 (Please avoid writing new tests using video-test.js) --> 16 trackElements[i].onload = t.step_func(trackLoaded);
9 <script src=../video-test.js></script>
10 <script>
11 17
12 numberOfTrackTests = 2; 18 enableAllTextTracks(video.textTracks);
13 19
14 function trackLoaded() 20 var numberOfTracksLoaded = 0;
21 function trackLoaded() {
22 numberOfTracksLoaded++;
23 if (numberOfTracksLoaded != 2)
24 return;
25
26 testTrack0();
27 testTrack1();
28 t.done();
29 }
30
31 function testTrack0() {
32 var expected = [
15 { 33 {
16 numberOfTracksLoaded++; 34 id : "1",
17 if (numberOfTracksLoaded == numberOfTrackTests) { 35 startTime : 0,
18 testTrack0(); 36 endTime : 30.5,
19 testTrack1(); 37 text : "Bear is Coming!!!!!"
20 } 38 },
39 {
40 id : "2",
41 startTime : 31,
42 endTime : 60.5,
43 text : "I said Bear is coming!!!!"
44 },
45 {
46 id : "3",
47 startTime : 61,
48 endTime : 361200.5,
49 text : "I said Bear is coming now!!!!"
21 } 50 }
51 ];
22 52
23 function testTrack0() 53 assert_cues_equal(video.textTracks[0].cues, expected);
24 { 54 }
25 findMediaElement();
26 var expected =
27 {
28 length : 3,
29 tests:
30 [
31 {
32 property : "id",
33 values : ["1", "2", "3"],
34 },
35 {
36 property : "startTime",
37 values : [0.0, 31.0, 61.0],
38 },
39 {
40 property : "endTime",
41 values : [30.5, 60.5, 361200.5],
42 },
43 {
44 property : "text",
45 values : ["Bear is Coming!!!!!", "I said Bear is com ing!!!!", "I said Bear is coming now!!!!"],
46 },
47 ],
48 };
49 testCues(0, expected);
50 55
51 allTestsEnded(); 56 function testTrack1() {
52 } 57 // Test that all the cues are ignored.
53 58 assert_cues_equal(video.textTracks[1].cues, []);
54 function testTrack1() 59 }
55 { 60 });
56 findMediaElement(); 61 </script>
57 var expected =
58 {
59 length : 0,
60 tests:
61 [],
62 };
63 testCues(1, expected);
64
65 allTestsEnded();
66 }
67 </script>
68 </head>
69 <body onload="enableAllTextTracks()">
70 <p>Tests cue timings that contain hours (they are optional), and tests v arious syntax errors in timings with hours.</p>
71 <video>
72 <track src="captions-webvtt/tc009-timings-hour.vtt" onload="trackLoa ded()">
73 <track src="captions-webvtt/tc009-timings-hour-error.vtt" onload="tr ackLoaded()">
74 </video>
75 </body>
76 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698