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

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: add async GC functionality 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..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>
« 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