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

Unified Diff: third_party/WebKit/LayoutTests/media/video-canvas-source.html

Issue 2112003002: Convert video-canvas* and video-capture* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use timeupdate event 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-canvas-source-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/video-canvas-source-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698