Index: third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html |
index 4dcca7f5048246d7eddae064152572511b8ba2c6..4b1cbc9eac60d218430f1975adbac91b09d6ec10 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.html |
@@ -1,36 +1,24 @@ |
-<!doctype html> |
-<html> |
- <body onload="start()"> |
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
- (Please avoid writing new tests using video-test.js) --> |
- <script src=../../media-resources/video-test.js></script> |
- <script src=../../media-resources/media-file.js></script> |
- <script> |
- waitForEvent('error', function() { |
- failTest("error: " + JSON.stringify(video.error)); |
- }); |
+<!DOCTYPE html> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<script src="../../media-resources/media-file.js"></script> |
+<canvas></canvas> |
+<script> |
+async_test(function(t) { |
+ var video = document.createElement("video"); |
+ video.crossOrigin = "anonymous"; |
- waitForEvent('playing', function() { |
- try { |
- var ctx = document.getElementsByTagName('canvas')[0].getContext("2d"); |
- ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); |
- ctx.getImageData(0, 0, video.videoWidth, video.videoHeight); |
- } catch (e) { |
- failTest("Caught error: " + e); |
- } |
- endTest(); |
- }); |
+ video.onerror = t.unreached_func(); |
+ video.onplaying = t.step_func_done(function() { |
+ var ctx = document.querySelector("canvas").getContext("2d"); |
+ ctx.drawImage(video, 0, 0, video.videoWidth, video.videoHeight); |
+ ctx.getImageData(0, 0, video.videoWidth, video.videoHeight); |
+ }); |
- function start() { |
- mediaElement = video = document.createElement("video"); |
- mediaElement.crossOrigin = "anonymous"; |
- document.body.appendChild(mediaElement); |
- var mediaFile = findMediaFile("video", "../../media/resources/test"); |
- var type = mimeTypeForExtension(mediaFile.split('.').pop()); |
- video.src = "http://localhost:8080/security/resources/video-cross-origin-allow.php?no-preflight&name=" + mediaFile + "&type=" + type; |
- video.play(); |
- } |
- </script> |
- <canvas></canvas> |
- </body> |
-</head> |
+ document.body.appendChild(video); |
+ var mediaFile = findMediaFile("video", "../../media/resources/test"); |
+ var type = mimeTypeForExtension(mediaFile.split('.').pop()); |
+ video.src = "http://localhost:8080/security/resources/video-cross-origin-allow.php?no-preflight&name=" + mediaFile + "&type=" + type; |
+ video.play(); |
+}); |
+</script> |