Index: third_party/WebKit/LayoutTests/media/video-poster-delayed.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-poster-delayed.html b/third_party/WebKit/LayoutTests/media/video-poster-delayed.html |
index c3b622c9c931b71916035f6981de4e324c3e4b4d..9f378b3d54b6bc493d2cc5e1dc69f75143b44de9 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-poster-delayed.html |
+++ b/third_party/WebKit/LayoutTests/media/video-poster-delayed.html |
@@ -1,55 +1,28 @@ |
<!DOCTYPE HTML5> |
- |
-<html> |
- <head> |
- <title>Delayed load of poster should not overwrite intrinsic size of video</title> |
- <!-- 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 src=media-file.js></script> |
- <style> |
- video { |
- border: 3px solid red; |
- background-color: magenta; |
- } |
- </style> |
- <script> |
- function start() |
- { |
- video = document.getElementById('video'); |
- |
- video.addEventListener("loadeddata", function(ev) { |
- |
- consoleWrite("<br><b>Video loaded</b><br>"); |
- |
- testExpected("video.clientWidth", 320); |
- testExpected("video.clientHeight", 240); |
- testExpected("video.videoWidth", 320); |
- testExpected("video.videoHeight", 240); |
- |
- video.poster = "content/abe.png"; |
- setTimeout(testAfterLoadingPoster, 100); |
- }); |
- |
- video.src = findMediaFile("video", "content/test"); |
- } |
- |
- function testAfterLoadingPoster() |
- { |
- consoleWrite("<br><b>Poster loaded</b><br>"); |
- |
- testExpected("video.clientWidth", 320); |
- testExpected("video.clientHeight", 240); |
- testExpected("video.videoWidth", 320); |
- testExpected("video.videoHeight", 240); |
- |
- endTest(); |
- } |
- </script> |
- </head> |
- |
- |
- <body onload="start()"> |
- <video id=video></video> |
- </body> |
-</html> |
+<title>Delayed load of poster should not overwrite intrinsic size of video.</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.onloadeddata = t.step_func(function() { |
+ testVideoSize(); |
+ video.poster = "content/abe.png"; |
+ var image = document.createElement("img"); |
+ image.src = "content/abe.png"; |
+ image.onload = t.step_func_done(testVideoSize); |
+ }); |
+ |
+ function testVideoSize() { |
+ assert_equals(video.clientWidth, 320); |
+ assert_equals(video.clientHeight, 240); |
+ assert_equals(video.videoWidth, 320); |
+ assert_equals(video.videoHeight, 240); |
+ } |
+ |
+ video.src = findMediaFile("video", "content/test"); |
+}); |
+</script> |