| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <title>Tests that we don't crash when a media element that has text tracks is de
structed.</title> |
| 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 | 5 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src=../media-file.js></script> | 6 <script> |
| 7 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 7 async_test(function(t) { |
| 8 (Please avoid writing new tests using video-test.js) --> | 8 var tracks = []; |
| 9 <script src=../video-test.js></script> | 9 var video = document.createElement('video'); |
| 10 <script> | 10 for (var i = 0; i < 1000; i++) |
| 11 | 11 tracks[i] = video.addTextTrack('captions', 'Captions Track', 'en'); |
| 12 tracks = []; | 12 assert_equals(tracks.length, 1000); |
| 13 | 13 // Destroy the video and force a garbage collection. |
| 14 function startTest() | 14 video = 0; |
| 15 { | 15 gc(); |
| 16 consoleWrite("Create video and add text tracks."); | 16 setTimeout(t.step_func_done(), 0); |
| 17 var video = document.createElement('video'); | 17 }); |
| 18 for (var i = 0; i < 1000; i++) | 18 </script> |
| 19 tracks[i] = video.addTextTrack('captions', 'Captions Track',
'en'); | |
| 20 testExpected("tracks.length", 1000); | |
| 21 consoleWrite(""); | |
| 22 consoleWrite("Destroy the video and force a garbage collection."
); | |
| 23 video = 0; | |
| 24 forceGC(); | |
| 25 consoleWrite("SUCCESS: Did not crash"); | |
| 26 endTest(); | |
| 27 } | |
| 28 | |
| 29 function forceGC() | |
| 30 { | |
| 31 if (window.GCController) | |
| 32 return GCController.collect(); | |
| 33 | |
| 34 // Force garbage collection | |
| 35 for (var ndx = 0; ndx < 99000; ndx++) | |
| 36 var str = new String("1234"); | |
| 37 } | |
| 38 | |
| 39 </script> | |
| 40 </head> | |
| 41 <body onload="startTest()"> | |
| 42 <p>Tests that we don't crash when a media element that has text tracks is de
structed.</p> | |
| 43 </body> | |
| 44 </html> | |
| OLD | NEW |