| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <title>TextTrackCue.startTime</title> | 2 <title>TextTrackCue.startTime</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(-1, 1, 'text1'); | 13 var c1 = new VTTCue(-1, 1, 'text1'); |
| 14 assert_equals(c1.startTime, -1); | 14 assert_equals(c1.startTime, -1); |
| 15 c1.startTime = c1.startTime; | 15 c1.startTime = c1.startTime; |
| 16 assert_equals(c1.startTime, -1); | 16 assert_equals(c1.startTime, -1); |
| 17 assert_throws(new TypeError(), function(){ c1.startTime = NaN; }); | 17 assert_throws(new TypeError(), function(){ c1.startTime = NaN; }); |
| 18 assert_throws(new TypeError(), function(){ c1.startTime = +Infinity; }); | 18 assert_throws(new TypeError(), function(){ c1.startTime = +Infinity; }); |
| 19 assert_throws(new TypeError(), function(){ c1.startTime = -Infinity; }); | 19 assert_throws(new TypeError(), function(){ c1.startTime = -Infinity; }); |
| 20 }, document.title+', script-created cue'); | 20 }, document.title+', script-created cue'); |
| 21 | 21 |
| 22 var t_parsed = async_test(document.title+', parsed cue'); | 22 var t_parsed = async_test(document.title+', parsed cue'); |
| 23 t_parsed.step(function(){ | 23 t_parsed.step(function(){ |
| 24 var t = document.createElement('track'); | 24 var t = document.createElement('track'); |
| 25 t.onload = this.step_func(function(){ | 25 t.onload = this.step_func(function(){ |
| 26 var c = t.track.cues; | 26 var c = t.track.cues; |
| 27 assert_equals(c[0].startTime, 0); | 27 assert_equals(c[0].startTime, 0); |
| 28 assert_equals(c[1].startTime, 3600); | 28 assert_equals(c[1].startTime, 3600); |
| 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 '\n\nfoobar\n01:00:00.000
--> 01:00:00.001\ntest'); | 32 '\n\nfoobar\n01:00:00.000
--> 01:00:00.001\ntest'); |
| 33 t.track.mode = 'showing'; | 33 t.track.mode = 'showing'; |
| 34 video.appendChild(t); | 34 video.appendChild(t); |
| 35 }); | 35 }); |
| 36 </script> | 36 </script> |
| OLD | NEW |