Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable.html

Issue 1867303002: Convert track tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify GC invocation as per comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-cue-is-reachable-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698