OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <title>TextTrackCue.track</title> | 2 <title>TextTrackCue.track</title> |
3 <script src=../../../../../resources/testharness.js></script> | 3 <script src=../../../../../resources/testharness.js></script> |
4 <script src=../../../../../resources/testharnessreport.js></script> | 4 <script src=../../../../../resources/testharnessreport.js></script> |
5 <div id=log></div> | 5 <div id=log></div> |
6 <script> | 6 <script> |
7 setup(function(){ | 7 setup(function(){ |
8 window.video = document.createElement('video'); | 8 window.video = document.createElement('video'); |
9 window.t1 = video.addTextTrack('subtitles'); | 9 window.t1 = video.addTextTrack('subtitles'); |
10 document.body.appendChild(video); | 10 document.body.appendChild(video); |
11 }); | 11 }); |
12 test(function(){ | 12 test(function(){ |
13 var c1 = new TextTrackCue(0, 1, 'text1'); | 13 var c1 = new VTTCue(0, 1, 'text1'); |
14 assert_equals(c1.track, null); | 14 assert_equals(c1.track, null); |
15 t1.addCue(c1); | 15 t1.addCue(c1); |
16 assert_equals(c1.track, t1); | 16 assert_equals(c1.track, t1); |
17 t1.removeCue(c1); | 17 t1.removeCue(c1); |
18 assert_equals(c1.track, null); | 18 assert_equals(c1.track, null); |
19 }, document.title+', script-created cue'); | 19 }, document.title+', script-created cue'); |
20 | 20 |
21 var t_parsed = async_test(document.title+', parsed cue'); | 21 var t_parsed = async_test(document.title+', parsed cue'); |
22 t_parsed.step(function(){ | 22 t_parsed.step(function(){ |
23 var t = document.createElement('track'); | 23 var t = document.createElement('track'); |
24 t.onload = this.step_func(function(){ | 24 t.onload = this.step_func(function(){ |
25 var c = t.track.cues[0]; | 25 var c = t.track.cues[0]; |
26 assert_equals(c.track, t.track); | 26 assert_equals(c.track, t.track); |
27 t.track.removeCue(c); | 27 t.track.removeCue(c); |
28 assert_equals(c.track, null); | 28 assert_equals(c.track, null); |
29 this.done(); | 29 this.done(); |
30 }); | 30 }); |
31 t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:0
0:00.001\ntest'); | 31 t.src = 'data:text/vtt,'+encodeURIComponent('WEBVTT\n\n00:00:00.000 --> 00:0
0:00.001\ntest'); |
32 t.track.mode = 'showing'; | 32 t.track.mode = 'showing'; |
33 video.appendChild(t); | 33 video.appendChild(t); |
34 }); | 34 }); |
35 </script> | 35 </script> |
OLD | NEW |