| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Tests that any text other than "-->" is recognized as optional cue identi
fier.</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 <script> |
| 7 check_cues_from_track("captions-webvtt/tc006-cue-id.vtt", function(track) { |
| 8 var expected = [ |
| 9 { id: "random_id", startTime: 0, endTime: 30.5, text: "Bear is Coming!!!
!!" }, |
| 10 { id: "another random identifier", startTime: 31, endTime: 60.5, text: "
I said Bear is coming!!!!" }, |
| 11 { id: "identifier--too", startTime: 61, endTime: 120.5, text: "I said Be
ar is coming now!!!!" }, |
| 12 { id: "identifier--too", startTime: 121, endTime: 180.5, text: "Duplicat
e identifier" } |
| 13 ]; |
| 5 | 14 |
| 6 <script src=../media-file.js></script> | 15 assert_cues_match(track.cues, expected); |
| 7 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 16 }); |
| 8 (Please avoid writing new tests using video-test.js) --> | |
| 9 <script src=../video-test.js></script> | |
| 10 <script> | |
| 11 | 17 |
| 12 numberOfTrackTests = 2; | 18 check_cues_from_track("captions-webvtt/tc006-cue-id-error.vtt", function(track)
{ |
| 19 var expected = [ |
| 20 { id: "", startTime: 0, endTime: 30.5, text: "Bear is Coming!!!!!" }, |
| 21 { id: "", startTime: 31, endTime: 60.5, text: "I said Bear is coming!!!!
" }, |
| 22 { id: "", startTime: 61, endTime: 1200.5, text: "I said Bear is coming n
ow!!!!" } |
| 23 ]; |
| 13 | 24 |
| 14 function trackLoaded() | 25 assert_cues_match(track.cues, expected); |
| 15 { | 26 }); |
| 16 numberOfTracksLoaded++; | 27 </script> |
| 17 if (numberOfTracksLoaded == numberOfTrackTests) { | |
| 18 testTrack0(); | |
| 19 testTrack1(); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 function testTrack0() | |
| 24 { | |
| 25 findMediaElement(); | |
| 26 | |
| 27 var expected = | |
| 28 { | |
| 29 length : 4, | |
| 30 tests: | |
| 31 [ | |
| 32 { | |
| 33 property : "id", | |
| 34 values : ["random_id", "another random identifier",
"identifier--too", "identifier--too"], | |
| 35 }, | |
| 36 { | |
| 37 property : "startTime", | |
| 38 values : [0.0, 31.0, 61.0, 121.0], | |
| 39 }, | |
| 40 { | |
| 41 property : "endTime", | |
| 42 values : [30.5, 60.5, 120.5, 180.5], | |
| 43 }, | |
| 44 { | |
| 45 property : "text", | |
| 46 values : ["Bear is Coming!!!!!", "I said Bear is com
ing!!!!", "I said Bear is coming now!!!!", "Duplicate identifier"], | |
| 47 }, | |
| 48 ], | |
| 49 }; | |
| 50 testCues(0, expected); | |
| 51 | |
| 52 allTestsEnded(); | |
| 53 } | |
| 54 | |
| 55 function testTrack1() | |
| 56 { | |
| 57 findMediaElement(); | |
| 58 var expected = | |
| 59 { | |
| 60 length : 0, | |
| 61 tests: | |
| 62 [], | |
| 63 }; | |
| 64 testCues(1, expected); | |
| 65 | |
| 66 allTestsEnded(); | |
| 67 } | |
| 68 </script> | |
| 69 </head> | |
| 70 <body onload="enableAllTextTracks()"> | |
| 71 <p>Tests that any text other than "-->" is recognized as optional cue id
entifier.</p> | |
| 72 <video> | |
| 73 <track src="captions-webvtt/tc006-cue-id.vtt" onload="trackLoaded()"
> | |
| 74 <track src="captions-webvtt/tc006-cue-id-error.vtt" onload="trackLoa
ded()"> | |
| 75 </video> | |
| 76 </body> | |
| 77 </html> | |
| OLD | NEW |