Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: third_party/WebKit/LayoutTests/media/video-play-pause-events.html

Issue 2090593002: Convert video-play* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/video-play-pause-events.html
diff --git a/third_party/WebKit/LayoutTests/media/video-play-pause-events.html b/third_party/WebKit/LayoutTests/media/video-play-pause-events.html
index 9b86f65c70144e09ac454bacc1ff06fad6fd242b..1bc3c2e6e4e31acb281c0cc4eab3b1f29f0d8e3b 100644
--- a/third_party/WebKit/LayoutTests/media/video-play-pause-events.html
+++ b/third_party/WebKit/LayoutTests/media/video-play-pause-events.html
@@ -1,28 +1,38 @@
-<video controls></video>
-<p>Test that calling play() and pause() triggers async play, timeupdate and pause events.</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>
+<!DOCTYPE html>
+<title>Test that calling play() and pause() triggers async play, timeupdate and pause events.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="media-file.js"></script>
+<video></video>
<script>
- video.src = findMediaFile("video", "content/test.mp4");
+async_test(function(t) {
+ var eventCount = 0;
+ var video = document.querySelector("video");
- waitForEvent("loadstart");
- waitForEvent("ratechange");
- waitForEvent("waiting");
- waitForEvent("ratechange");
- waitForEvent("durationchange");
- waitForEvent("loadedmetadata");
- waitForEvent("loadeddata");
- waitForEvent("canplay");
- waitForEvent("canplaythrough");
- waitForEvent("play");
- waitForEvent("timeupdate");
- waitForEvent('pause', function () { testExpected("video.paused", true); endTest(); } );
+ video.onloadstart = t.step_func(function() {});
+ video.onratechange = t.step_func(function() {});
+ video.onwaiting = 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.oncanplaythrough = t.step_func(function() {});
+ video.onplay = t.step_func(function() {
+ eventCount++;
+ });
- run("video.play()");
- run("video.pause()");
+ video.ontimeupdate = t.step_func(function() {
+ eventCount++;
+ });
- consoleWrite("SCRIPT DONE");
-</script>
+ video.onpause = t.step_func_done(function () {
+ assert_equals(eventCount, 2);
+ assert_true(video.paused);
+ });
+
+ video.src = findMediaFile("video", "content/test");
+ video.play();
+ video.pause();
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698