Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html |
| diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html b/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html |
| index c8a03a80b10d58c6d3cb902c9f75552647d9aeb7..0bc8873989cea3cab21054953b4c5105338530bd 100644 |
| --- a/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html |
| +++ b/third_party/WebKit/LayoutTests/media/track/track-cue-nothing-to-render.html |
| @@ -1,65 +1,50 @@ |
| <!DOCTYPE html> |
| -<html> |
| - <head> |
| - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| - |
| - <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 src=../media-controls.js></script> |
| - |
| - <script> |
| - |
| - var testTrack; |
| - var seekedCount = 0; |
| - var info = [ |
| - 0.5, "", |
| - 1.5, "Lorem ipsum dolor sit amet,", |
| - 2.5, "", |
| - 3.3, "consectetuer adipiscing elit,", |
| - 0.6, "", |
| - 5.9, "sed diam nonummy nibh euismod tincidunt", |
| - 4.4, "", |
| - 7.9, "ut laoreet dolore magna aliquam erat volutpat." |
| - ]; |
| - |
| - function seeked() |
| - { |
| - var time = info[seekedCount]; |
| - var cueText = info[seekedCount + 1]; |
| - seekedCount += 2; |
| - |
| - testExpected("video.currentTime.toFixed(1)", time.toFixed(1)); |
| - if (cueText.length) |
| - testExpected("testTrack.track.activeCues[0].text", cueText); |
| - testExpected("textTrackDisplayElement(video, 'display').innerText", cueText); |
| - |
| - if (seekedCount >= info.length) { |
| - consoleWrite(""); |
| - endTest(); |
| - return; |
| - } |
| - |
| - consoleWrite(""); |
| - run("video.currentTime = " + (info[seekedCount])); |
| +<title>Test that cues are rendered and removed.</title> |
| +<script src="../media-file.js"></script> |
| +<script src="../media-controls.js"></script> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<video> |
| + <track src="captions-webvtt/captions-gaps.vtt" kind="captions" default> |
| +</video> |
| +<script> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| + var testTrack = document.querySelector("track"); |
| + video.src = findMediaFile("video", "../content/counting"); |
| + |
| + var seekTimeIndex = 0; |
| + var info = [ |
| + 0.5, "", |
| + 1.5, "Lorem ipsum dolor sit amet,", |
| + 2.5, "", |
| + 3.3, "consectetuer adipiscing elit,", |
| + 0.6, "", |
| + 5.9, "sed diam nonummy nibh euismod tincidunt", |
| + 4.4, "", |
| + 7.9, "ut laoreet dolore magna aliquam erat volutpat." |
| + ]; |
| + |
| + video.onseeked = t.step_func(function() { |
| + var time = info[seekTimeIndex]; |
| + assert_equals(video.currentTime, time); |
| + var cueText = info[++seekTimeIndex]; |
| + ++seekTimeIndex; |
| + |
| + assert_equals(video.currentTime.toFixed(1), time.toFixed(1)); |
| + if (cueText.length) { |
| + assert_equals(testTrack.track.activeCues[0].text, cueText); |
| + assert_equals(textTrackDisplayElement(video, "display").innerText, cueText); |
|
mlamouri (slow - plz ping)
2016/04/19 15:16:29
It seems that this could be outside of the if/else
Srirama
2016/04/19 16:31:02
As i mentioned in my previous CL, this is also sam
|
| + } else { |
| + assert_equals(testTrack.track.activeCues.length, 0); |
| } |
| - function loaded() |
| - { |
| - findMediaElement(); |
| - testTrack = document.querySelector('track'); |
| - video.src = findMediaFile('video', '../content/counting'); |
| - waitForEvent('seeked', seeked); |
| - waitForEventOnce('canplaythrough', function() { video.currentTime = .5; }); |
| - } |
| + if (seekTimeIndex >= info.length) |
| + t.done(); |
| + |
| + video.currentTime = info[seekTimeIndex]; |
| + }); |
| - </script> |
| - </head> |
| - <body onload="loaded()"> |
| - <video controls > |
| - <track src="captions-webvtt/captions-gaps.vtt" kind="captions" default> |
| - </video> |
| - <p>Test that cues are rendered and removed.</p> |
| - </body> |
| -</html> |
| + video.currentTime = 0.5; |
|
philipj_slow
2016/04/21 12:46:15
Use info[0] here?
|
| +}); |
| +</script> |