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

Side by Side Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours.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: 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Tests cue timings that do not contain hours (they are optional), and test s various syntax errors in timings without 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/tc008-timings-no-hour.vtt">
8 <track src="captions-webvtt/tc008-timings-no-hour-errors.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 : 120.5,
49 text : "I said Bear is coming now!!!!"
50 },
51 {
52 id : "4",
53 startTime : 121,
54 endTime : 180.5,
55 text : "tab separators"
21 } 56 }
57 ];
22 58
23 function testTrack0() 59 var cues = video.textTracks[0].cues;
24 { 60 assert_equals(cues.length, 4);
25 findMediaElement(); 61 assert_cues_equal(cues, expected);
mlamouri (slow - plz ping) 2016/05/20 12:44:26 Same as the other review, you can test the length
Srirama 2016/05/20 13:37:08 Done.
26 var expected = 62 }
27 {
28 length : 4,
29 tests:
30 [
31 {
32 property : "id",
33 values : ["1", "2", "3", "4"],
34 },
35 {
36 property : "startTime",
37 values : [0.0, 31.0, 61.0, 121.0],
38 },
39 {
40 property : "endTime",
41 values : [30.5, 60.5, 120.5, 180.5],
42 },
43 {
44 property : "text",
45 values : ["Bear is Coming!!!!!", "I said Bear is com ing!!!!", "I said Bear is coming now!!!!", "tab separators"],
46 },
47 ],
48 };
49 testCues(0, expected);
50 63
51 allTestsEnded(); 64 function testTrack1() {
52 } 65 // Test that all the cues are ignored.
53 66 assert_equals(video.textTracks[1].cues.length, 0);
54 function testTrack1() 67 }
55 { 68 });
56 findMediaElement(); 69 </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 do not contain hours (they are optional), and tests various syntax errors in timings without hours.</p>
71 <video>
72 <track src="captions-webvtt/tc008-timings-no-hour.vtt" onload="track Loaded()">
73 <track src="captions-webvtt/tc008-timings-no-hour-errors.vtt" onload ="trackLoaded()">
74 </video>
75 </body>
76 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698