Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable.html |
| diff --git a/third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable.html b/third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable.html |
| index 4ebb933f9dac975a250b28f777b34b149bf486aa..d85a98f7973e734d83135183479b762a188ab015 100644 |
| --- a/third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable.html |
| +++ b/third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable.html |
| @@ -1,50 +1,43 @@ |
| <!DOCTYPE html> |
| -<html> |
| - <head> |
| - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| - |
| - <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
| - (Please avoid writing new tests using video-test.js) --> |
| - <script src=../video-test.js></script> |
| - <script> |
| - |
| - function forceGC() |
| - { |
| - if (window.GCController) |
| - return GCController.collectAll(); |
| - |
| +<title>Ensure that a TextTrackCue won't be collected if it has a custom property.</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +async_test(function(t) { |
| + var video = document.createElement('video'); |
| + var trackElement = document.createElement('track'); |
| + |
| + trackElement.onload = t.step_func(function() { |
| + assert_equals(video.textTracks[0].cues.length, 4); |
| + assert_equals(video.textTracks[0].cues[1].startTime, 31); |
| + |
| + video.textTracks[0].cues[1].myProperty = 'tuna salad?'; |
| + assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?'); |
| + |
| + function gcCallback() { |
| + assert_equals(video.textTracks[0].cues.length, 4); |
| + assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?'); |
| + t.done(); |
| + } |
| + |
| + function forceAsyncGC() { |
|
philipj_slow
2016/04/12 08:43:34
I'd say just include resources/gc.js, and do this:
Srirama
2016/04/12 09:54:57
Done. Thanks, looks much simpler and cleaner.
|
| + if (GCController) { |
| + GCController.collectAll(); |
| + } else { |
| // Force garbage collection |
| - for (var ndx = 0; ndx < 99000; ndx++) |
| - var str = new String("1234"); |
| + for (var index = 0; index < 99000; index++) |
| + var str = new String('1234'); |
| } |
| - function trackLoaded() |
| - { |
| - findMediaElement(); |
| - |
| - consoleWrite("** Validate."); |
| - testExpected("video.textTracks[0].cues.length", 4); |
| - testExpected("video.textTracks[0].cues[1].startTime", 31); |
| + setTimeout(t.step_func(gcCallback), 0); |
| + } |
| - consoleWrite("<br>** Add a custom property to a cue."); |
| - run("video.textTracks[0].cues[1].myProperty = 'tuna salad?'"); |
| - testExpected("video.textTracks[0].cues[1].myProperty", "tuna salad?"); |
| - |
| - consoleWrite("<br>** Force garbage collection."); |
| - forceGC(); |
| - testExpected("video.textTracks[0].cues.length", 4); |
| - testExpected("video.textTracks[0].cues[1].myProperty", "tuna salad?"); |
| - |
| - consoleWrite(""); |
| - endTest(); |
| - } |
| + forceAsyncGC(); |
| + }); |
| - </script> |
| - </head> |
| - <body> |
| - <p>Ensure that a TextTrackCue won't be collected if it has a custom property.</p> |
| - <video> |
| - <track src="captions-webvtt/tc013-settings.vtt" kind="captions" onload="trackLoaded()" default> |
| - </video> |
| - </body> |
| -</html> |
| + trackElement.src = 'captions-webvtt/tc013-settings.vtt'; |
| + trackElement.kind = 'captions'; |
| + trackElement.default = true; |
| + video.appendChild(trackElement); |
| +}); |
| +</script> |