OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 | 4 |
5 <script src=../media-file.js></script> | 5 <script src=../media-file.js></script> |
| 6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| 7 (Please avoid writing new tests using video-test.js) --> |
6 <script src=../video-test.js></script> | 8 <script src=../video-test.js></script> |
7 <script> | 9 <script> |
8 | 10 |
9 var textTrack; | 11 var textTrack; |
10 var cueCount; | 12 var cueCount; |
11 | 13 |
12 function setMode(value) | 14 function setMode(value) |
13 { | 15 { |
14 run("textTrack.mode = '" + value + "'"); | 16 run("textTrack.mode = '" + value + "'"); |
15 testExpected("textTrack.mode", value); | 17 testExpected("textTrack.mode", value); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 consoleWrite("<b>++ 'disabled'</b>"); | 53 consoleWrite("<b>++ 'disabled'</b>"); |
52 setMode("disabled"); | 54 setMode("disabled"); |
53 | 55 |
54 video.src = findMediaFile("video", "../content/test"); | 56 video.src = findMediaFile("video", "../content/test"); |
55 video.play(); | 57 video.play(); |
56 // Wait for end of first cue (no events should fire while track
is disabled). | 58 // Wait for end of first cue (no events should fire while track
is disabled). |
57 setTimeout(testHiddenAndShowing, 400); | 59 setTimeout(testHiddenAndShowing, 400); |
58 consoleWrite("++ 0 events expected while mode = disabled"); | 60 consoleWrite("++ 0 events expected while mode = disabled"); |
59 consoleWrite(""); | 61 consoleWrite(""); |
60 } | 62 } |
61 | 63 |
62 function testHiddenAndShowing() | 64 function testHiddenAndShowing() |
63 { | 65 { |
64 consoleWrite("<b>++ 'hidden'</b>"); | 66 consoleWrite("<b>++ 'hidden'</b>"); |
65 setMode("hidden"); | 67 setMode("hidden"); |
66 | 68 |
67 consoleWrite("<b>++ 'showing'</b>"); | 69 consoleWrite("<b>++ 'showing'</b>"); |
68 setMode("showing"); | 70 setMode("showing"); |
69 | 71 |
70 consoleWrite("++ at least " + textTrack.cues.length + " events e
xpected while mode = showing"); | 72 consoleWrite("++ at least " + textTrack.cues.length + " events e
xpected while mode = showing"); |
71 } | 73 } |
72 | 74 |
73 waitForEvent('cuechange', | 75 waitForEvent('cuechange', |
74 function (event) | 76 function (event) |
75 { | 77 { |
76 cueCount++; | 78 cueCount++; |
77 if (cueCount == textTrack.cues.length) | 79 if (cueCount == textTrack.cues.length) |
78 endTest(); | 80 endTest(); |
79 | 81 |
80 } | 82 } |
81 ); | 83 ); |
82 | 84 |
83 </script> | 85 </script> |
84 </head> | 86 </head> |
85 <body> | 87 <body> |
86 <p>Tests that the TextTrack mode attribute is appropriately set.</p> | 88 <p>Tests that the TextTrack mode attribute is appropriately set.</p> |
87 <video> | 89 <video> |
88 <track id=track_1 src="captions-webvtt/captions-fast.vtt" onload="st
art()" default> | 90 <track id=track_1 src="captions-webvtt/captions-fast.vtt" onload="st
art()" default> |
89 </video> | 91 </video> |
90 </body> | 92 </body> |
91 </html> | 93 </html> |
OLD | NEW |