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

Unified Diff: third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html

Issue 2091973003: Convert video-seek* 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-seek-past-end-paused.html
diff --git a/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html b/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html
index f00d58dd75ca2cb6207cabc375a6fbf76f452cab..50fac627ea46e635bbbae8bb1ca1b6ba6eb9d288 100644
--- a/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html
+++ b/third_party/WebKit/LayoutTests/media/video-seek-past-end-paused.html
@@ -1,72 +1,42 @@
<!DOCTYPE html>
-<html>
- <head>
- <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 timeupdateEventCount = 0;
-
- function doSetup()
- {
- findMediaElement();
- waitForEvent('canplaythrough', canPlayThrough);
- video.src = findMediaFile('video', 'content/test');
- }
- window.addEventListener('load', doSetup, false);
-
- function canPlayThrough()
- {
- testExpected("video.paused", true);
- testExpected("video.ended", false);
- video.addEventListener('timeupdate', timeUpdate);
- run("video.play()");
- }
-
- function timeUpdate()
- {
- ++timeupdateEventCount;
-
- // Wait 2 timeupdate events so we are sure the media engine is
- // playing the media.
- if (timeupdateEventCount == 2) {
- consoleWrite("");
- video.removeEventListener('timeupdate', timeUpdate);
- // Make sure time is advancing.
- testExpected("video.paused", false);
- testExpected("mediaElement.currentTime", 0, '>');
- video.addEventListener('pause', paused);
- video.pause();
- }
- }
-
- function paused() {
- consoleWrite("");
- testExpected("video.paused", true);
- video.addEventListener('seeked', seeked);
- // Seek past end.
- video.currentTime = 500;
- };
-
- function seeked()
- {
- consoleWrite("");
-
- testExpected("video.paused", true);
- // Don't use "testExpected()" so we won't log the actual duration to the
- // results file, as the floating point result may differ with different engines.
- reportExpected(mediaElement.currentTime == mediaElement.duration, "mediaElement.currentTime", "==", "mediaElement.duration", mediaElement.currentTime);
-
- testExpected("video.ended", true);
- consoleWrite("");
- timeupdateEventCount = 0;
- endTest();
- }
- </script>
- </head>
- <body>
- <video controls></video>
- <p>Test that seeking a paused video past its end sets currentTime to duration and leaves the video paused.</p>
- </body>
-</html>
+<title>Test that seeking a paused video past its end sets currentTime to duration and leaves the video 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 timeupdateEventCount = 0;
+ var video = document.querySelector("video");
+ assert_true(video.paused);
+ assert_false(video.ended);
+
+ video.ontimeupdate = t.step_func(function() {
+ if (++timeupdateEventCount != 2)
+ return;
+
+ // Wait for 2 timeupdate events so we are sure the
+ // media engine is playing the media.
+ video.ontimeupdate = null;
+ // Make sure time is advancing.
+ assert_false(video.paused);
+ assert_greater_than(video.currentTime, 0);
+ video.onpause = t.step_func(function() {
+ assert_true(video.paused);
+ video.onseeked = t.step_func_done(function() {
+ assert_true(video.paused);
+ assert_equals(video.currentTime, video.duration);
+ assert_true(video.ended);
+ });
+
+ // Seek past end.
+ video.currentTime = 500;
+ });
+
+ video.pause();
+ });
+
+ video.src = findMediaFile("video", "content/test");
+ video.play();
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698