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/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'); |
| 9 var trackElement = document.createElement('track'); |
5 | 10 |
6 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 11 trackElement.onload = t.step_func(function() { |
7 (Please avoid writing new tests using video-test.js) --> | 12 assert_equals(video.textTracks[0].cues.length, 4); |
8 <script src=../video-test.js></script> | 13 assert_equals(video.textTracks[0].cues[1].startTime, 31); |
9 <script> | |
10 | 14 |
11 function forceGC() | 15 video.textTracks[0].cues[1].myProperty = 'tuna salad?'; |
12 { | 16 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?'); |
13 if (window.GCController) | |
14 return GCController.collectAll(); | |
15 | 17 |
16 // Force garbage collection | 18 gc(); |
17 for (var ndx = 0; ndx < 99000; ndx++) | 19 setTimeout(t.step_func_done(function() { |
18 var str = new String("1234"); | 20 assert_equals(video.textTracks[0].cues.length, 4); |
19 } | 21 assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?')
; |
| 22 }), 0); |
| 23 }); |
20 | 24 |
21 function trackLoaded() | 25 trackElement.src = 'captions-webvtt/tc013-settings.vtt'; |
22 { | 26 trackElement.kind = 'captions'; |
23 findMediaElement(); | 27 trackElement.default = true; |
24 | 28 video.appendChild(trackElement); |
25 consoleWrite("** Validate."); | 29 }); |
26 testExpected("video.textTracks[0].cues.length", 4); | 30 </script> |
27 testExpected("video.textTracks[0].cues[1].startTime", 31); | |
28 | |
29 consoleWrite("<br>** Add a custom property to a cue."); | |
30 run("video.textTracks[0].cues[1].myProperty = 'tuna salad?'"); | |
31 testExpected("video.textTracks[0].cues[1].myProperty", "tuna sal
ad?"); | |
32 | |
33 consoleWrite("<br>** Force garbage collection."); | |
34 forceGC(); | |
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 |