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> |