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

Unified Diff: third_party/WebKit/LayoutTests/media/track/text-track-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
Index: third_party/WebKit/LayoutTests/media/track/text-track-is-reachable.html
diff --git a/third_party/WebKit/LayoutTests/media/track/text-track-is-reachable.html b/third_party/WebKit/LayoutTests/media/track/text-track-is-reachable.html
index 059d48b8ac8b5f518b38df57ead71787e91ce54e..26a6a003f76308cf378abb00d52bd11a87dfb848 100644
--- a/third_party/WebKit/LayoutTests/media/track/text-track-is-reachable.html
+++ b/third_party/WebKit/LayoutTests/media/track/text-track-is-reachable.html
@@ -1,51 +1,30 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <script src=../media-file.js></script>
- <!-- 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.length", 1);
- testExpected("video.textTracks[0].kind", "captions");
-
- consoleWrite("<br>** Add a custom property to the track.");
- run("video.textTracks[0].myProperty = 'egg salad!?'");
- testExpected("video.textTracks[0].myProperty", "egg salad!?");
-
- consoleWrite("<br>** Force garbage collection.");
- forceGC();
- testExpected("video.textTracks[0].cues.length", 4);
- testExpected("video.textTracks[0].myProperty", "egg salad!?");
-
- consoleWrite("");
- endTest();
- }
-
- </script>
- </head>
- <body>
- <p>Ensure that a TextTrack 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 TextTrack 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.length, 1);
+ assert_equals(video.textTracks[0].kind, 'captions');
+
+ video.textTracks[0].myProperty = 'egg salad!?';
+ assert_equals(video.textTracks[0].myProperty, 'egg salad!?');
+
+ gc();
+ setTimeout(t.step_func_done(function() {
+ assert_equals(video.textTracks[0].cues.length, 4);
+ assert_equals(video.textTracks[0].myProperty, 'egg salad!?');
+ }), 0);
+ });
+
+ trackElement.src = 'captions-webvtt/tc013-settings.vtt';
+ trackElement.kind = 'captions';
+ trackElement.default = true;
+ video.appendChild(trackElement);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698