OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
5 | 5 |
6 <script src="../media-file.js"></script> | 6 <script src="../media-file.js"></script> |
7 <script src="../video-test.js"></script> | 7 <script src="../video-test.js"></script> |
8 <script src="../../resources/testharness.js"></script> | 8 <script src="../../resources/testharness.js"></script> |
9 <script src="../../resources/testharnessreport.js"></script> | 9 <script src="../../resources/testharnessreport.js"></script> |
10 </head> | 10 </head> |
11 <body> | 11 <body> |
12 <script> | 12 <script> |
13 async_test(function(test) | 13 async_test(function(test) |
14 { | 14 { |
15 var video = document.createElement("video"); | 15 var video = document.createElement("video"); |
16 // add to body to prevent GC pending http://crbug.com/400659 | |
17 document.body.appendChild(video); | |
18 var track; | 16 var track; |
19 | 17 |
20 function trackRemoved() | 18 function trackRemoved() |
21 { | 19 { |
22 assert_equals(event.target, video.textTracks); | 20 assert_equals(event.target, video.textTracks); |
23 assert_equals(event instanceof window.TrackEvent, true); | 21 assert_equals(event instanceof window.TrackEvent, true); |
24 assert_equals(event.track, track); | 22 assert_equals(event.track, track); |
25 test.done(); | 23 test.done(); |
26 } | 24 } |
27 | 25 |
28 var trackElement = document.createElement('track'); | 26 var trackElement = document.createElement('track'); |
29 video.appendChild(trackElement); | 27 video.appendChild(trackElement); |
30 | 28 |
31 trackElement.src = 'captions-webvtt/tc004-webvtt-file.vtt'; | 29 trackElement.src = 'captions-webvtt/tc004-webvtt-file.vtt'; |
32 trackElement.track.mode = 'hidden'; | 30 trackElement.track.mode = 'hidden'; |
33 | 31 |
34 assert_equals(video.textTracks.length, 1); | 32 assert_equals(video.textTracks.length, 1); |
35 | 33 |
36 track = video.textTracks[0]; | 34 track = video.textTracks[0]; |
37 video.removeChild(trackElement); | 35 video.removeChild(trackElement); |
38 video.textTracks.addEventListener("removetrack", test.step_func(
trackRemoved)); | 36 video.textTracks.addEventListener("removetrack", test.step_func(
trackRemoved)); |
39 }, "Tests that the 'removetrack' event is fired when an out-of-band
TextTrack is removed."); | 37 }, "Tests that the 'removetrack' event is fired when an out-of-band
TextTrack is removed."); |
40 | 38 |
41 async_test(function(test) | 39 async_test(function(test) |
42 { | 40 { |
43 var video = document.createElement("video"); | 41 var video = document.createElement("video"); |
44 // add to body to prevent GC pending http://crbug.com/400659 | |
45 document.body.appendChild(video); | |
46 | 42 |
47 // Create an out-of-band text track by adding a track element. | 43 // Create an out-of-band text track by adding a track element. |
48 var trackElement = document.createElement('track'); | 44 var trackElement = document.createElement('track'); |
49 | 45 |
50 trackElement.addEventListener("error", test.step_func(function() | 46 trackElement.addEventListener("error", test.step_func(function() |
51 { | 47 { |
52 assert_unreached("'error' event on track element should not
fire.") | 48 assert_unreached("'error' event on track element should not
fire.") |
53 })); | 49 })); |
54 | 50 |
55 video.appendChild(trackElement); | 51 video.appendChild(trackElement); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 assert_unreached("'removetrack' event should not fire.") | 98 assert_unreached("'removetrack' event should not fire.") |
103 })); | 99 })); |
104 | 100 |
105 video.src = url; | 101 video.src = url; |
106 }, "Tests that the 'removetrack' event is NOT fired for inband TextT
rack on a failed load."); | 102 }, "Tests that the 'removetrack' event is NOT fired for inband TextT
rack on a failed load."); |
107 | 103 |
108 </script> | 104 </script> |
109 <div id="log"></div> | 105 <div id="log"></div> |
110 </body> | 106 </body> |
111 </html> | 107 </html> |
OLD | NEW |