Index: third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html b/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html |
index a34f2852008ffd403ca66f9190d3a4ed74a0e070..a1c3facd0f2b62d474e87bbfc65888a1137a419e 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html |
+++ b/third_party/WebKit/LayoutTests/media/video-duration-known-after-eos.html |
@@ -1,48 +1,23 @@ |
<!DOCTYPE HTML> |
- |
-<html> |
- <head> |
- <title>local video</title> |
- |
- <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> |
- function ended() |
- { |
- testExpected("video.duration", 0, '>'); |
- endTest(); |
- } |
- |
- function playing() |
- { |
- video.removeEventListener("playing", playing); |
- run("video.currentTime = video.duration - 0.2"); |
- } |
- |
- function loadedmetadata() |
- { |
- video.addEventListener("ended", ended); |
- video.addEventListener("playing", playing); |
- |
- run("video.play()"); |
- } |
- |
- function start() |
- { |
- findMediaElement(); |
- |
- video.addEventListener("loadedmetadata", loadedmetadata); |
- video.src = findMediaFile("video", "content/test"); |
- consoleWrite(""); |
- } |
- |
- </script> |
- </head> |
- <body onload="start()"> |
- <video controls autobuffer></video> |
- <p>Tests that duration is known after playback ended.</p> |
- </body> |
-</html> |
+<title>Tests that duration is known after playback ended.</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.onended = t.step_func_done(function() { |
+ assert_greater_than(video.duration, 0); |
+ }); |
+ |
+ video.onplaying = t.step_func(function() { |
+ video.onplaying = null; |
+ video.currentTime = video.duration - 0.2; |
+ }); |
+ |
+ video.src = findMediaFile("video", "content/test"); |
+ video.play(); |
+}); |
+</script> |