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..53102cc8093ea4c095bbaa78ddc521a30757584d 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,30 @@ |
<!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(); |
- |
- // Force garbage collection |
- for (var ndx = 0; ndx < 99000; ndx++) |
- 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); |
- |
- 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(); |
- } |
- |
- </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> |
+<title>Ensure that a TextTrackCue won't be collected if it has a custom property.</title> |
+<script src="../../resources/gc.js"></script> |
+<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?'); |
+ |
+ gc(); |
+ setTimeout(t.step_func_done(function() { |
+ assert_equals(video.textTracks[0].cues.length, 4); |
+ assert_equals(video.textTracks[0].cues[1].myProperty, 'tuna salad?'); |
+ }), 0); |
+ }); |
+ |
+ trackElement.src = 'captions-webvtt/tc013-settings.vtt'; |
+ trackElement.kind = 'captions'; |
+ trackElement.default = true; |
+ video.appendChild(trackElement); |
+}); |
+</script> |