OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test disabling a track.</title> |
3 <head> | 3 <video> |
4 <script src="../media-file.js"></script> | 4 <track kind="subtitles" src="captions-webvtt/captions.vtt"/> |
5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 5 </video> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <script src="../media-file.js"></script> |
7 <script src="../video-test.js"></script> | 7 <script src="../../resources/testharness.js"></script> |
8 <script> | 8 <script src="../../resources/testharnessreport.js"></script> |
9 if (window.testRunner) | 9 <script> |
10 testRunner.dumpAsText(); | 10 async_test(function(t) { |
| 11 var video = document.querySelector("video"); |
| 12 video.textTracks[0].mode = "disabled"; |
11 | 13 |
12 waitForEvent('loadstart', function () | 14 // Waiting for the duration of the first cue to elapse. |
13 { | 15 video.ontimeupdate = t.step_func(function (e) { |
14 var video = document.getElementById('vid'); | 16 if (e.target.currentTime < 1) |
15 video.textTracks[0].mode = "disabled"; | 17 return; |
16 | 18 |
17 consoleWrite("Waiting for the duration of the first cue to elaps
e."); | 19 // End test after the duration of the first cue to make sure |
18 video.addEventListener('timeupdate', function (e) | 20 // the test doesn't crash during the period this cue would |
19 { | 21 // have been rendered if the track was not disabled. |
20 if (e.target.currentTime < 1) | 22 // The duration of the first cue has elapsed. |
21 return; | 23 t.done(); |
| 24 }); |
22 | 25 |
23 // End test after the duration of the first cue to make su
re the test | 26 video.src = findMediaFile("video", "../content/test"); |
24 // doesn't crash during the period this cue would have bee
n | 27 video.play(); |
25 // rendered if the track was not disabled. | 28 }); |
26 consoleWrite("The duration of the first cue has elapsed.")
; | 29 </script> |
27 endTest(); | |
28 }); | |
29 }); | |
30 | |
31 </script> | |
32 </head> | |
33 <body> | |
34 <video id="vid" src="../content/test.ogv" autoplay controls> | |
35 <track kind='subtitles' srclang='en' label='English' src='captions-w
ebvtt/captions.vtt' /> | |
36 </video> | |
37 </body> | |
38 </html> | |
OLD | NEW |