Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Tests that cues are affected neither by multiple newlines \n, \r, and \r\ n nor by the absense of seperation line.</title> |
|
fs
2016/06/05 13:04:58
Nit: "separation" (or, I believe better: "a separa
Srirama
2016/06/05 21:12:41
Done.
| |
| 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 <script> | |
| 7 check_cues_from_track("captions-webvtt/tc011-cues.vtt", function(track) { | |
| 8 var expected = [ | |
| 9 { id: "1", startTime: 0, endTime: 30.5, text: "Bear is Coming!!!!!" }, | |
| 10 { id: "2", startTime: 31, endTime: 60.5, text: "I said Bear is coming!!! !" }, | |
| 11 { id: "3", startTime: 61, endTime: 361200.5, text: "I said Bear is comin g now!!!!" } | |
| 12 ]; | |
| 5 | 13 |
| 6 <script src=../media-file.js></script> | 14 assert_cues_match(track.cues, expected); |
| 7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 15 }); |
| 8 (Please avoid writing new tests using video-test.js) --> | |
| 9 <script src=../video-test.js></script> | |
| 10 <script> | |
| 11 | 16 |
| 12 numberOfTrackTests = 2; | 17 check_cues_from_track("captions-webvtt/tc011-cues-no-separation.vtt", function(t rack) { |
| 18 var expected = [ | |
| 19 { id: "1", startTime: 0, endTime: 30.5, text: "Bear is Coming!!!!!\n2" } , | |
| 20 { id: "", startTime: 31, endTime: 60.5, text: "I said Bear is coming!!!! " }, | |
| 21 { id: "", startTime: 61, endTime: 361200.5, text: "I said Bear is coming now!!!!" } | |
| 22 ]; | |
| 13 | 23 |
| 14 function trackLoaded() | 24 assert_cues_match(track.cues, expected); |
| 15 { | 25 }); |
| 16 numberOfTracksLoaded++; | 26 </script> |
| 17 if (numberOfTracksLoaded == numberOfTrackTests) { | |
| 18 testTrack0(); | |
| 19 testTrack1(); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 function testTrack0() | |
| 24 { | |
| 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 | |
| 51 allTestsEnded(); | |
| 52 } | |
| 53 | |
| 54 function testTrack1() | |
| 55 { | |
| 56 findMediaElement(); | |
| 57 var expected = | |
| 58 { | |
| 59 length : 1, | |
| 60 tests: | |
| 61 [], | |
| 62 }; | |
| 63 testCues(1, expected); | |
| 64 | |
| 65 allTestsEnded(); | |
| 66 } | |
| 67 </script> | |
| 68 </head> | |
| 69 <body onload="enableAllTextTracks()"> | |
| 70 <p>Tests that cues are not affected by multiple newlines \n, \r, and \r\n an d that cue not properly separated are treated as one big cue.</p> | |
| 71 <video> | |
| 72 <track src="captions-webvtt/tc011-cues.vtt" onload="trackLoaded()"> | |
| 73 <track src="captions-webvtt/tc011-cues-no-separation.vtt" onload="tr ackLoaded()"> | |
| 74 </video> | |
| 75 </body> | |
| 76 </html> | |
| OLD | NEW |