OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <title>TextTrackCueList getter</title> | 2 <title>TextTrackCueList getter</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 cues = t1.cues; | 13 var cues = t1.cues; |
14 assert_equals(cues[0], undefined, 'cues[0] before'); | 14 assert_equals(cues[0], undefined, 'cues[0] before'); |
15 var c1 = new TextTrackCue(0, 1, 'text1'); | 15 var c1 = new VTTCue(0, 1, 'text1'); |
16 t1.addCue(c1); | 16 t1.addCue(c1); |
17 assert_equals(cues[0], c1, 'cues[0]'); | 17 assert_equals(cues[0], c1, 'cues[0]'); |
18 assert_equals(cues[1], undefined, 'cues[1]'); | 18 assert_equals(cues[1], undefined, 'cues[1]'); |
19 assert_equals(cues[-1], undefined, 'cues[-1]'); | 19 assert_equals(cues[-1], undefined, 'cues[-1]'); |
20 t1.removeCue(c1); | 20 t1.removeCue(c1); |
21 assert_equals(cues[0], undefined, 'cues[0] after'); | 21 assert_equals(cues[0], undefined, 'cues[0] after'); |
22 }); | 22 }); |
23 test(function(){ | 23 test(function(){ |
24 var cues = t1.cues; | 24 var cues = t1.cues; |
25 assert_equals(cues[0], undefined); | 25 assert_equals(cues[0], undefined); |
26 cues[0] = 'foo'; | 26 cues[0] = 'foo'; |
27 assert_equals(cues[0], undefined); | 27 assert_equals(cues[0], undefined); |
28 var c1 = new TextTrackCue(0, 1, 'text1'); | 28 var c1 = new VTTCue(0, 1, 'text1'); |
29 t1.addCue(c1); | 29 t1.addCue(c1); |
30 assert_equals(cues[0], c1); | 30 assert_equals(cues[0], c1); |
31 cues[0] = 'foo'; | 31 cues[0] = 'foo'; |
32 assert_equals(cues[0], c1); | 32 assert_equals(cues[0], c1); |
33 t1.removeCue(c1); | 33 t1.removeCue(c1); |
34 }, document.title+', no indexed set/create'); | 34 }, document.title+', no indexed set/create'); |
35 test(function(){ | 35 test(function(){ |
36 'use strict'; | 36 'use strict'; |
37 var cues = t1.cues; | 37 var cues = t1.cues; |
38 assert_equals(cues[0], undefined); | 38 assert_equals(cues[0], undefined); |
39 assert_throws(new TypeError(), function() { cues[0] = 'foo'; }); | 39 assert_throws(new TypeError(), function() { cues[0] = 'foo'; }); |
40 assert_equals(cues[0], undefined); | 40 assert_equals(cues[0], undefined); |
41 var c1 = new TextTrackCue(0, 1, 'text1'); | 41 var c1 = new VTTCue(0, 1, 'text1'); |
42 t1.addCue(c1); | 42 t1.addCue(c1); |
43 assert_equals(cues[0], c1); | 43 assert_equals(cues[0], c1); |
44 assert_throws(new TypeError(), function() { cues[0] = 'foo'; }); | 44 assert_throws(new TypeError(), function() { cues[0] = 'foo'; }); |
45 assert_equals(cues[0], c1); | 45 assert_equals(cues[0], c1); |
46 t1.removeCue(c1); | 46 t1.removeCue(c1); |
47 }, document.title+', no indexed set/create (strict)'); | 47 }, document.title+', no indexed set/create (strict)'); |
48 | 48 |
49 </script> | 49 </script> |
OLD | NEW |