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