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