Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html |
| diff --git a/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html b/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html |
| index 6a28b4263ac7390b8c465b308ac0adf03a08d480..1f2253212ca8a62756df2d783295182ff66aeb6a 100644 |
| --- a/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html |
| +++ b/third_party/WebKit/LayoutTests/media/track/track-cues-pause-on-exit.html |
| @@ -1,86 +1,54 @@ |
| <!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 videoCanPlayThrough = false; |
| - var trackLoaded = false; |
| - |
| - var currentCue; |
| - var currentCueNumber = 0; |
| - |
| - function runTests() |
| - { |
| - if (!trackLoaded || !videoCanPlayThrough) |
| - return; |
| - |
| - testTrack = document.getElementById("testTrack"); |
| - testExpected("testTrack.track.cues.length", 4); |
| - |
| - consoleWrite(""); |
| - |
| - for (var i = 0; i < testTrack.track.cues.length; ++i) { |
| - testTrack.track.cues[i].pauseOnExit = (i % 2 == 0); |
| - } |
| - |
| - run("video.play()"); |
| - testExpected("video.paused", false); |
| - consoleWrite(""); |
| - |
| - waitForEvent('pause', function() { |
| - waitForEvent('exit', cueExited, false, true, testTrack.track.cues[currentCueNumber]); |
| - }); |
| - } |
| - |
| - function cueExited(evt) |
| - { |
| - currentCue = evt.target; |
| - |
| - |
| - testExpected("currentCue.id", currentCueNumber); |
| - testExpected("video.paused", true); |
| - |
| - run("video.play()"); |
| - |
| - if (currentCueNumber == 2) |
| - endTest(); |
| - |
| - currentCueNumber += 2; |
| - |
| - consoleWrite(""); |
| - } |
| - |
| - function loaded() |
| - { |
| - trackLoaded = true; |
| - |
| - runTests(); |
| - } |
| - |
| - function bodyLoaded() |
| - { |
| - findMediaElement(); |
| - video.src = findMediaFile("video", "../content/test"); |
| - } |
| - |
| - waitForEventOnce('canplaythrough', function() { |
| - video.currentTime = 4.00; |
| - videoCanPlayThrough = true; |
| - |
| - runTests(); |
| - }); |
| - |
| - </script> |
| - </head> |
| - <body onload="bodyLoaded()"> |
| - <p>Tests that the video is paused after cues that have pause-on-exit flag are processed</p> |
| - <video controls> |
| - <track id="testTrack" src="captions-webvtt/simple-captions.vtt" onload="loaded()" default> |
| - </video> |
| - </body> |
| -</html> |
| +<title>Tests that the video is paused after cues that have pause-on-exit flag are processed.</title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script src="../media-file.js"></script> |
| +<video controls> |
| + <track src="captions-webvtt/simple-captions.vtt" default> |
| +</video> |
| +<script> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| + video.src = findMediaFile("video", "../content/test"); |
| + video.oncanplaythrough = t.step_func(function() { |
| + video.oncanplaythrough = null; |
| + video.currentTime = 4.00; |
| + runTests(); |
| + }); |
| + |
| + var track = document.querySelector("track"); |
| + track.onload = t.step_func(runTests); |
|
fs
2016/06/13 15:20:18
See comment on the later test about sequencing.
Srirama
2016/06/13 17:33:38
Done. Removed 'canplaythrough' event, please see m
|
| + |
| + var eventCount = 0; |
| + function runTests() { |
| + eventCount++; |
| + if (eventCount != 2) |
| + return; |
| + |
| + assert_equals(track.track.cues.length, 4); |
| + |
| + for (var i = 0; i < track.track.cues.length; ++i) { |
| + track.track.cues[i].pauseOnExit = (i % 2 == 0); |
| + } |
| + |
| + video.play(); |
| + assert_false(video.paused); |
| + } |
| + |
| + var currentCueNumber = 0; |
| + video.onpause = t.step_func(function() { |
| + track.track.cues[currentCueNumber].onexit = t.step_func(function(event) { |
|
fs
2016/06/13 15:20:18
Maybe these could be installed right after the tra
|
| + var currentCue = event.target; |
| + assert_equals(currentCue.id, currentCueNumber + ""); |
| + assert_true(video.paused); |
| + |
| + video.play(); |
| + |
| + if (currentCueNumber == 2) |
| + t.done(); |
| + |
| + currentCueNumber += 2; |
| + }); |
| + }); |
| +}); |
| +</script> |