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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-active-cues.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/track-active-cues.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-active-cues.html b/third_party/WebKit/LayoutTests/media/track/track-active-cues.html
index 5c751a15aaf21b8fd21617fa584611cd5e5ef3e7..78ac354ac39fbdae3ea572c5650ec6d093c73b24 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-active-cues.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-active-cues.html
@@ -1,55 +1,39 @@
<!doctype html>
-<html>
- <head>
- <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 clearSrc()
- {
- consoleWrite("<br>** Video and track loaded, one cue should be active **");
- testExpected("trackElement.track.activeCues.length", 1);
-
- consoleWrite("<br>** Clear video 'src' and force reload **");
- run("video.src = ''");
- consoleWrite("");
- }
-
- function videoError()
- {
- consoleWrite("** 'error' event, no cues should be active **)");
- testExpected("event.target", video);
- testExpected("video.error", null, "!=");
- testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
- testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
- testExpected("trackElement.track.activeCues.length", 0);
-
- consoleWrite("");
- endTest();
- }
-
- function setup()
- {
- consoleWrite("");
-
- findMediaElement();
- trackElement = document.querySelector('track');
-
- waitForEventsAndCall([[video, 'canplaythrough'], [trackElement, 'load'], [trackElement, 'cuechange']], clearSrc);
-
- video.src = findMediaFile("video", "../content/test");
- }
-
- </script>
- </head>
- <body onload="setup()">
- <video controls onerror="videoError()">
- <track src="captions-webvtt/captions-fast.vtt" kind="captions" default>
- </video>
-
- <p>Test to ensure that a no text track cues are active after the video is unloaded.</p>
-
- </body>
-</html>
+<title>Test to ensure that no text track cues are active after the video is unloaded.</title>
+<script src="../media-file.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+async_test(function(t) {
+ var eventCount = 0;
+
+ function eventCallback() {
+ eventCount++;
+ if (eventCount == 3) {
+ assert_equals(trackElement.track.activeCues.length, 1);
+ video.src = '';
+ }
+ }
+
+ var video = document.createElement('video');
+ video.src = findMediaFile('video', '../content/test');
+ var trackElement = document.createElement('track');
+
+ trackElement.onload = t.step_func(eventCallback);
+ trackElement.oncuechange = t.step_func(eventCallback);
+ video.oncanplaythrough = t.step_func(eventCallback);
+
+ video.onerror = t.step_func_done(function() {
+ assert_equals(event.target, video);
+ assert_not_equals(video.error, null);
+ assert_equals(video.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
+ assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
+ assert_equals(trackElement.track.activeCues.length, 0);
+ });
+
+ trackElement.src = 'captions-webvtt/captions-fast.vtt';
+ trackElement.kind = 'captions';
+ trackElement.default = true;
+ video.appendChild(trackElement);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698