OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Ensure that a TextTrackCue won't be collected if it has a custom property
.</title> |
3 <head> | 3 <script src="../../resources/testharness.js"></script> |
4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 function forceGC() |
| 7 { |
| 8 if (window.GCController) |
| 9 return GCController.collectAll(); |
5 | 10 |
6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 11 // Force garbage collection |
7 (Please avoid writing new tests using video-test.js) --> | 12 for (var index = 0; index < 99000; index++) |
8 <script src=../video-test.js></script> | 13 var str = new String('1234'); |
9 <script> | 14 } |
10 | 15 |
11 function forceGC() | 16 async_test(function(t) { |
12 { | 17 var video = document.createElement('video'); |
13 if (window.GCController) | 18 var trackElement = document.createElement('track'); |
14 return GCController.collectAll(); | |
15 | 19 |
16 // Force garbage collection | 20 trackElement.onload = t.step_func_done(function() { |
17 for (var ndx = 0; ndx < 99000; ndx++) | 21 assert_equals(video.textTracks[0].cues.length, 4); |
18 var str = new String("1234"); | 22 assert_equals(video.textTracks[0].cues[1].startTime, 31); |
19 } | |
20 | 23 |
21 function trackLoaded() | 24 video.textTracks[0].cues[1].myProperty = 'tuna salad?'; |
22 { | 25 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?'); |
23 findMediaElement(); | |
24 | 26 |
25 consoleWrite("** Validate."); | 27 forceGC(); |
26 testExpected("video.textTracks[0].cues.length", 4); | 28 assert_equals(video.textTracks[0].cues.length, 4); |
27 testExpected("video.textTracks[0].cues[1].startTime", 31); | 29 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?'); |
| 30 }); |
28 | 31 |
29 consoleWrite("<br>** Add a custom property to a cue."); | 32 trackElement.src = 'captions-webvtt/tc013-settings.vtt'; |
30 run("video.textTracks[0].cues[1].myProperty = 'tuna salad?'"); | 33 trackElement.kind = 'captions'; |
31 testExpected("video.textTracks[0].cues[1].myProperty", "tuna sal
ad?"); | 34 trackElement.default = true; |
32 | 35 video.appendChild(trackElement); |
33 consoleWrite("<br>** Force garbage collection."); | 36 }); |
34 forceGC(); | 37 </script> |
35 testExpected("video.textTracks[0].cues.length", 4); | |
36 testExpected("video.textTracks[0].cues[1].myProperty", "tuna sal
ad?"); | |
37 | |
38 consoleWrite(""); | |
39 endTest(); | |
40 } | |
41 | |
42 </script> | |
43 </head> | |
44 <body> | |
45 <p>Ensure that a TextTrackCue won't be collected if it has a custom prop
erty.</p> | |
46 <video> | |
47 <track src="captions-webvtt/tc013-settings.vtt" kind="captions" onlo
ad="trackLoaded()" default> | |
48 </video> | |
49 </body> | |
50 </html> | |
OLD | NEW |