OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that a detached TextTrackList can still be used without crashing.</t
itle> |
3 <head> | 3 <script src="../../resources/gc.js"></script> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../../resources/testharness.js"></script> |
| 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script> |
| 7 async_test(function(t) { |
| 8 var video = document.createElement("video"); |
5 | 9 |
6 <script src=../media-file.js></script> | 10 // Register an event handler on video element's TextTrackList. |
7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 11 var tracks = video.textTracks; |
8 (Please avoid writing new tests using video-test.js) --> | 12 tracks.onaddtrack = handler; |
9 <script src=../video-test.js></script> | |
10 <script> | |
11 var tracks; | |
12 | 13 |
13 function handler() | 14 // Clear "video" to bring about its release. |
14 { | 15 video = null; |
15 consoleWrite("PASS (no crash)"); | |
16 } | |
17 | 16 |
18 function start() | 17 // Force garbage collection. |
19 { | 18 gc(); |
20 var video = document.createElement("video"); | |
21 | 19 |
22 consoleWrite("** Register an event handler on video element's Te
xtTrackList."); | 20 setTimeout(t.step_func_done(function() { |
23 tracks = video.textTracks; | 21 // Inspect and invoke the handler. |
24 tracks.onaddtrack = handler; | 22 assert_equals(tracks.onaddtrack, handler); |
| 23 tracks.onaddtrack(); |
| 24 }), 0); |
25 | 25 |
26 // Clear 'video' to bring about its release (non-Oilpan.) | 26 function handler() { |
27 video = null; | 27 // PASS (no crash). |
28 consoleWrite("<br>** Force garbage collection."); | 28 } |
29 gc(); | 29 }); |
30 consoleWrite("** Inspect and invoke the handler."); | 30 </script> |
31 testExpected("tracks.onaddtrack", handler); | |
32 tracks.onaddtrack(); | |
33 consoleWrite(""); | |
34 endTest(); | |
35 } | |
36 | |
37 </script> | |
38 </head> | |
39 <body onload="start()"> | |
40 <p>Test that a detached TextTrackList can still be used without crashing
.</p> | |
41 </body> | |
42 </html> | |
OLD | NEW |