Chromium Code Reviews| 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..63e3e9007811d56237506838b06191f1d0c274b9 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) |
|
mlamouri (slow - plz ping)
2016/04/29 12:39:12
nit: can you add parenthesis?
Srirama
2016/04/29 13:17:08
Done.
|
| + 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> |