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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html

Issue 2061663002: Convert track-cues* and track-word* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nit Created 4 years, 6 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-cues-seeking.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html b/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html
index a27e3567f137f4f611aca2fde0b6a8d26d9cf435..0cc439993e549c2c94539605c525c4d6c3d47eb1 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-cues-seeking.html
@@ -1,76 +1,31 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <script src=../media-file.js></script>
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
- <script src=../video-test.js></script>
-
- <script>
-
- var seekedCount = 0;
- var testTrack;
-
- var trackLoaded = false;
- var videoCanPlayThrough = false;
-
- function attemptTests()
- {
- if (!trackLoaded || !videoCanPlayThrough)
- return;
-
- testTrack = document.getElementById("testTrack");
- testExpected("testTrack.track.cues.length", 3);
- run("video.currentTime = 0.5");
- consoleWrite("");
- }
-
- function seeked()
- {
- ++seekedCount;
- consoleWrite("");
-
- activeCues = testTrack.track.activeCues;
-
- testExpected("video.currentTime", seekedCount * 0.5);
- testExpected("activeCues.length", seekedCount - 1);
- run("video.currentTime = " + (seekedCount + 1) * 0.5);
-
- consoleWrite("");
-
- if (seekedCount == 4)
- endTest();
- }
-
- waitForEvent('seeked', seeked);
-
- waitForEventOnce('canplaythrough',
- function ()
- {
- videoCanPlayThrough = true;
- attemptTests();
- }
- );
-
- function loaded()
- {
- trackLoaded = true;
- attemptTests();
- }
-
- function start()
- {
- findMediaElement();
- video.src = findMediaFile("video", "../content/test");
- }
- </script>
- </head>
- <body onload="start()">
- <p>Tests TextTrack's activeCues are indexed and updated during video playback.</p>
- <video controls>
- <track id="testTrack" src="captions-webvtt/cues-overlapping.vtt" kind="subtitles" onload="loaded()" default>
- </video>
- </body>
-</html>
+<title>Tests TextTrack's activeCues are indexed and updated during video playback.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../media-file.js"></script>
+<video>
+ <track src="captions-webvtt/cues-overlapping.vtt" kind="subtitles" default>
+</video>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ var track = document.querySelector("track");
+ track.onload = t.step_func(function() {
+ assert_equals(track.track.cues.length, 3);
+ video.src = findMediaFile("video", "../content/test");
+ video.currentTime = 0.5;
+ });
+
+ var seekedCount = 0;
+ video.onseeked = t.step_func(function() {
+ ++seekedCount;
+
+ assert_equals(video.currentTime, seekedCount * 0.5);
+ assert_equals(track.track.activeCues.length, seekedCount - 1);
+ video.currentTime = (seekedCount + 1) * 0.5;
+
+ if (seekedCount == 4)
+ t.done();
+ });
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698