Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html |
| diff --git a/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html b/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html |
| index 9d3c0691499d94b09e5d27bd357cd961b757639c..17df5640b3cd963fb0f9e71fb3a9e84ad83288b6 100644 |
| --- a/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html |
| +++ b/third_party/WebKit/LayoutTests/media/video-timeupdate-during-playback.html |
| @@ -1,58 +1,36 @@ |
| -<html> |
| -<body> |
| - |
| - <video controls></video> |
| - |
| - <p> |
| - Test 'timeupdate' events are posted while playing but not while paused. |
| - </p> |
| - <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> |
| - setSrcByTagName("video", findMediaFile("video", "content/test")); |
| - |
| - var timeupdateEventCount = 0; |
| - var countWhilePlaying = 0; |
| - |
| - function someTimeLater() |
| - { |
| - if (countWhilePlaying != timeupdateEventCount) |
| - failTest("'timeupdate' events posted after pausing"); |
| - endTest(); |
| - } |
| - |
| - function pause() |
| - { |
| - countWhilePlaying = timeupdateEventCount; |
| - setTimeout(someTimeLater, 400) ; |
| - consoleWrite(""); |
| - } |
| - |
| - function playing() |
| - { |
| - setTimeout(function () { run("video.pause()"); }, 500) ; |
| - consoleWrite(""); |
| - } |
| - |
| - mediaElement.addEventListener("timeupdate", function () { ++timeupdateEventCount; }); |
| - |
| - waitForEvent('error'); |
| - waitForEvent("loadstart"); |
| - waitForEvent("waiting"); |
| - waitForEvent("ratechange"); |
| - waitForEvent("durationchange"); |
| - waitForEvent("loadedmetadata"); |
| - waitForEvent("loadeddata"); |
| - waitForEvent("canplay"); |
| - waitForEvent("pause", pause); |
| - waitForEvent("play"); |
| - waitForEvent("playing", playing); |
| - |
| - run("video.play()"); |
| - consoleWrite(""); |
| - </script> |
| - |
| -</body> |
| -</html> |
| +<!DOCTYPE html> |
| +<title>Test "timeupdate" events are posted while playing but not while paused.</title> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script src="media-file.js"></script> |
| +<video></video> |
| +<script> |
| +async_test(function(t) { |
| + var video = document.querySelector("video"); |
| + video.src = findMediaFile("video", "content/test"); |
| + var timeupdateEventCount = 0; |
| + |
| + video.onerror = t.step_func(function() {}); |
|
foolip
2016/07/06 09:22:22
What's the purpose of all of these? Previously the
fs
2016/07/06 09:34:46
EventWatcher could be another way. I think I may h
Srirama
2016/07/06 15:03:45
Removed all these as discussed.
|
| + video.onloadstart = t.step_func(function() {}); |
| + video.onwaiting = t.step_func(function() {}); |
| + video.onratechange = t.step_func(function() {}); |
| + video.ondurationchange = t.step_func(function() {}); |
| + video.onloadedmetadata = t.step_func(function() {}); |
| + video.onloadeddata = t.step_func(function() {}); |
| + video.oncanplay = t.step_func(function() {}); |
| + video.onplay = t.step_func(function() {}); |
| + video.ontimeupdate = t.step_func(function() { ++timeupdateEventCount; }); |
| + video.onplaying = t.step_func(function() { |
| + setTimeout(function() { video.pause(); }, 500) ; |
| + }); |
| + |
| + video.onpause = t.step_func(function() { |
| + var eventCountOnPause = timeupdateEventCount; |
| + setTimeout(t.step_func_done(function() { |
| + assert_equals(eventCountOnPause, timeupdateEventCount, "'timeupdate' events posted after pause") |
| + }), 400); |
| + }); |
| + |
| + video.play(); |
| +}); |
| +</script> |