| Index: third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html b/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html
|
| index d3133193e89260ac5e6df6d6780e4b418f4c566b..147eced4947dbb491eb21059c1b1f6635a1d261a 100644
|
| --- a/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html
|
| +++ b/third_party/WebKit/LayoutTests/media/track/track-disabled-addcue.html
|
| @@ -1,46 +1,34 @@
|
| <!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 onLoad()
|
| - {
|
| - if (window.testRunner)
|
| - testRunner.dumpAsText();
|
| +<title>Test adding cues to a disabled text track. </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 cueDuration = 0.1;
|
| + var video = document.createElement("video");
|
| + var track = video.addTextTrack("subtitles");
|
| + track.mode = "disabled";
|
|
|
| - var cueDuration = 0.1;
|
| - var video = document.querySelector("#vid");
|
| - var track = video.addTextTrack("subtitles");
|
| - track.mode = "disabled";
|
| + for (var i = 0; i < 10; ++i) {
|
| + var start = i * cueDuration;
|
| + var end = start + cueDuration;
|
| + track.addCue(new VTTCue(start, end, "Test Cue " + i));
|
| + }
|
|
|
| - for (var i = 0; i < 10; ++i) {
|
| - var start = i * cueDuration;
|
| - var end = start + cueDuration;
|
| - track.addCue(new VTTCue(start, end, "Test Cue " + i));
|
| - }
|
| + // Waiting for 2 cue durations to elapse.
|
| + video.ontimeupdate = t.step_func(function(e) {
|
| + if (e.target.currentTime < (2 * cueDuration))
|
| + return;
|
|
|
| - consoleWrite("Waiting for 2 cue durations to elapse.");
|
| + // End test after at least 2 cueDurations to make sure the test
|
| + // doesn't crash during the period the first 2 cues would have been
|
| + // rendered if the track was not disabled.
|
| + // 2 cue durations have elapsed.
|
| + t.done();
|
| + });
|
|
|
| - video.addEventListener('timeupdate', function (e)
|
| - {
|
| - if (e.target.currentTime < 2 * cueDuration)
|
| - return;
|
| -
|
| - // End test after at least 2 cueDurations to make sure the test
|
| - // doesn't crash during the period the first 2 cues would have been
|
| - // rendered if the track was not disabled.
|
| - consoleWrite("2 cue durations have elapsed.");
|
| - endTest();
|
| - });
|
| - video.play();
|
| - }
|
| - </script>
|
| - </head>
|
| - <body onload="onLoad()">
|
| - <p>Test adding cues to a disabled text track. </p>
|
| - <video id="vid" src="../content/test.ogv" controls></video>
|
| - </body>
|
| -</html>
|
| + video.src = findMediaFile("video", "../content/test");
|
| + video.play();
|
| +});
|
| +</script>
|
|
|