Index: third_party/WebKit/LayoutTests/media/video-canvas-source.html |
diff --git a/third_party/WebKit/LayoutTests/media/video-canvas-source.html b/third_party/WebKit/LayoutTests/media/video-canvas-source.html |
index ae6a2da73c8afb342f603a0b47948894e092d9fb..0832004b1459f3c4fb11e1bbc3bc3f13071339d4 100644 |
--- a/third_party/WebKit/LayoutTests/media/video-canvas-source.html |
+++ b/third_party/WebKit/LayoutTests/media/video-canvas-source.html |
@@ -1,46 +1,26 @@ |
-<html> |
- <head> |
- <title>Drawing to canvas using video with source element does not taint canvas</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 src="../resources/js-test.js"></script> |
- <script> |
- var ctx; |
- var width; |
- var height; |
+<!DOCTYPE html> |
+<title>Verify that drawing to canvas using video with source element does not taint canvas</title> |
+<script src="../resources/testharness.js"></script> |
+<script src="../resources/testharnessreport.js"></script> |
+<script src="media-file.js"></script> |
+<video></video> |
+<canvas></canvas> |
+<script> |
+async_test(function(t) { |
+ var video = document.querySelector("video"); |
+ var canvas = document.querySelector("canvas"); |
- function canplaythrough() |
- { |
- width = video.videoWidth / 2; |
- height = video.videoHeight / 2; |
+ video.oncanplaythrough = t.step_func_done(function() { |
+ var width = video.videoWidth / 2; |
+ var height = video.videoHeight / 2; |
+ var ctx = canvas.getContext("2d"); |
+ video.pause(); |
+ ctx.drawImage(video, 0, 0, width, height); |
+ assert_not_equals(ctx.getImageData(0, 0, width, height), null); |
+ }); |
- ctx = canvas.getContext("2d"); |
- video.pause(); |
- ctx.drawImage(video, 0, 0, width, height); |
- shouldBeTrue("!!ctx.getImageData(0, 0, width, height)"); |
- endTest(); |
- } |
- |
- function start() |
- { |
- description("Test to ensure we don't taint a canvas when drawing from a video the uses source elements rather than the src attribute"); |
- findMediaElement(); |
- canvas = document.getElementsByTagName('canvas')[0]; |
- waitForEvent('canplaythrough', canplaythrough); |
- var mediaFile = findMediaFile("video", "content/counting"); |
- disableFullTestDetailsPrinting(); |
- runSilently("var source = document.createElement('source'); source.src = '" + mediaFile + "'; video.appendChild(source)"); |
- enableFullTestDetailsPrinting(); |
- } |
- </script> |
- </head> |
- |
- <body onload="start()" > |
- <p id="description"></p> |
- <video controls></video> |
- <canvas width="160" height="120" ></canvas> |
- <div id="console"></div> |
- </body> |
-</html> |
+ var source = document.createElement("source"); |
+ source.src = findMediaFile("video", "content/counting"); |
+ video.appendChild(source); |
+}); |
+</script> |