OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
5 | 5 |
6 <script src=../media-file.js></script> | 6 <script src=../media-file.js></script> |
| 7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 8 (Please avoid writing new tests using video-test.js) --> |
7 <script src=../video-test.js></script> | 9 <script src=../video-test.js></script> |
8 <script> | 10 <script> |
9 | 11 |
10 var numberOfTrackTests = 2; | 12 var numberOfTrackTests = 2; |
11 | 13 |
12 function trackLoaded() | 14 function trackLoaded() |
13 { | 15 { |
14 numberOfTracksLoaded++; | 16 numberOfTracksLoaded++; |
15 if (numberOfTracksLoaded == numberOfTrackTests) { | 17 if (numberOfTracksLoaded == numberOfTrackTests) { |
16 testTrack(0); | 18 testTrack(0); |
17 testTrackError(1); | 19 testTrackError(1); |
18 } | 20 } |
19 } | 21 } |
20 | 22 |
21 function testTrack(i) | 23 function testTrack(i) |
22 { | 24 { |
23 findMediaElement(); | 25 findMediaElement(); |
24 testExpected("video.textTracks[" + i + "].cues.length", "3"); | 26 testExpected("video.textTracks[" + i + "].cues.length", "3"); |
25 | 27 |
26 var fragment = document.createDocumentFragment(); | 28 var fragment = document.createDocumentFragment(); |
27 var cspan = document.createElement("span"); | 29 var cspan = document.createElement("span"); |
28 cspan.className = "blue"; | 30 cspan.className = "blue"; |
29 cspan.title = "Speaker"; | 31 cspan.title = "Speaker"; |
30 cspan.appendChild(document.createTextNode("Bear is Coming!!!!!")
); | 32 cspan.appendChild(document.createTextNode("Bear is Coming!!!!!")
); |
31 fragment.appendChild(cspan); | 33 fragment.appendChild(cspan); |
32 fragment.appendChild(document.createTextNode("\nText span with a
class and an annotation.")); | 34 fragment.appendChild(document.createTextNode("\nText span with a
class and an annotation.")); |
33 | 35 |
34 testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].ge
tCueAsHTML()), true); | 36 testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].ge
tCueAsHTML()), true); |
35 | 37 |
36 fragment = document.createDocumentFragment(); | 38 fragment = document.createDocumentFragment(); |
37 cspan = document.createElement("span"); | 39 cspan = document.createElement("span"); |
38 cspan.title = "Doe Hunter"; | 40 cspan.title = "Doe Hunter"; |
39 cspan.appendChild(document.createTextNode("I said Bear is coming
!!!!")); | 41 cspan.appendChild(document.createTextNode("I said Bear is coming
!!!!")); |
40 fragment.appendChild(cspan); | 42 fragment.appendChild(cspan); |
41 | 43 |
42 testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].ge
tCueAsHTML()), true); | 44 testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].ge
tCueAsHTML()), true); |
43 | 45 |
44 | 46 |
45 fragment = document.createDocumentFragment(); | 47 fragment = document.createDocumentFragment(); |
46 fragment.appendChild(document.createTextNode("I said ")); | 48 fragment.appendChild(document.createTextNode("I said ")); |
47 cspan = document.createElement("span"); | 49 cspan = document.createElement("span"); |
48 cspan.className = "blue"; | 50 cspan.className = "blue"; |
49 cspan.title = "Speaker"; | 51 cspan.title = "Speaker"; |
50 cspan.appendChild(document.createTextNode("Bear is coming now"))
; | 52 cspan.appendChild(document.createTextNode("Bear is coming now"))
; |
51 fragment.appendChild(cspan); | 53 fragment.appendChild(cspan); |
52 fragment.appendChild(document.createTextNode("!!!!")); | 54 fragment.appendChild(document.createTextNode("!!!!")); |
53 | 55 |
54 testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].ge
tCueAsHTML()), true); | 56 testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].ge
tCueAsHTML()), true); |
55 | 57 |
56 allTestsEnded(); | 58 allTestsEnded(); |
57 } | 59 } |
58 | 60 |
59 function testTrackError(i) | 61 function testTrackError(i) |
60 { | 62 { |
61 findMediaElement(); | 63 findMediaElement(); |
62 testExpected("video.textTracks[" + i + "].cues.length", "3"); | 64 testExpected("video.textTracks[" + i + "].cues.length", "3"); |
63 | 65 |
64 var fragment = document.createDocumentFragment(); | 66 var fragment = document.createDocumentFragment(); |
65 fragment.appendChild(document.createTextNode("Bear is Coming!!!!
!")); | 67 fragment.appendChild(document.createTextNode("Bear is Coming!!!!
!")); |
66 fragment.appendChild(document.createTextNode("\nThis is two anno
tations for an empty tag.")); | 68 fragment.appendChild(document.createTextNode("\nThis is two anno
tations for an empty tag.")); |
67 | 69 |
68 | 70 |
69 testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].ge
tCueAsHTML()), true); | 71 testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].ge
tCueAsHTML()), true); |
70 | 72 |
71 fragment = document.createDocumentFragment(); | 73 fragment = document.createDocumentFragment(); |
72 fragment.appendChild(document.createTextNode("I said Bear is com
ing!!!!")); | 74 fragment.appendChild(document.createTextNode("I said Bear is com
ing!!!!")); |
73 fragment.appendChild(document.createTextNode("\nThis does not pa
rse as a voice tag.")); | 75 fragment.appendChild(document.createTextNode("\nThis does not pa
rse as a voice tag.")); |
74 | 76 |
75 testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].ge
tCueAsHTML()), true); | 77 testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].ge
tCueAsHTML()), true); |
76 | 78 |
77 fragment = document.createDocumentFragment(); | 79 fragment = document.createDocumentFragment(); |
78 fragment.appendChild(document.createTextNode("I said ")); | 80 fragment.appendChild(document.createTextNode("I said ")); |
79 fragment.appendChild(document.createTextNode("Bear is coming now
")); | 81 fragment.appendChild(document.createTextNode("Bear is coming now
")); |
80 fragment.appendChild(document.createTextNode("!!!!\nThis does no
t parse as a voice tag.")); | 82 fragment.appendChild(document.createTextNode("!!!!\nThis does no
t parse as a voice tag.")); |
81 | 83 |
82 testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].ge
tCueAsHTML()), true); | 84 testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].ge
tCueAsHTML()), true); |
83 | 85 |
84 allTestsEnded(); | 86 allTestsEnded(); |
85 } | 87 } |
86 </script> | 88 </script> |
87 </head> | 89 </head> |
88 <body onload="enableAllTextTracks()"> | 90 <body onload="enableAllTextTracks()"> |
89 <p>Tests cues with voice markup <v>.</p> | 91 <p>Tests cues with voice markup <v>.</p> |
90 <video> | 92 <video> |
91 <track src="captions-webvtt/tc026-voice.vtt" onload="trackLoaded()"> | 93 <track src="captions-webvtt/tc026-voice.vtt" onload="trackLoaded()"> |
92 <track src="captions-webvtt/tc026-voice-bad.vtt" onload="trackLoaded
()"> | 94 <track src="captions-webvtt/tc026-voice-bad.vtt" onload="trackLoaded
()"> |
93 </video> | 95 </video> |
94 </body> | 96 </body> |
95 </html> | 97 </html> |
OLD | NEW |