Chromium Code Reviews| 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..052448eb594b17853dbcf13df74b9f494db58aaa 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,40 @@ |
| <!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"); |
| + video.src = findMediaFile("video", "../content/test"); |
| + video.oncanplaythrough = t.step_func(attemptTests); |
| + |
| + 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(); |
| + }); |
| + |
| + var track = document.querySelector("track"); |
| + track.onload = t.step_func(attemptTests); |
| + |
| + var eventCount = 0; |
|
fs
2016/06/13 15:20:18
Maybe it would be possible to sequence this as:
t
Srirama
2016/06/13 17:33:38
Done. I think the intention of waiting for 'canpla
|
| + function attemptTests() { |
| + eventCount++; |
| + if (eventCount != 2) |
| + return; |
| + |
| + assert_equals(track.track.cues.length, 3); |
| + video.currentTime = 0.5; |
| + } |
| +}); |
| +</script> |