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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html

Issue 2202713004: Convert security http tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
Index: third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html
index 78f8e8f9b846632f41ae256935f425588aec617c..5809bbcea6b9525e84977a38eb84cdb4f3b472e3 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-readback.html
@@ -1,35 +1,23 @@
-<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>
+<video crossorigin></video>
+<canvas></canvas>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+ var mediaFile = findMediaFile("video", "../../media/resources/test");
+ var type = mimeTypeForExtension(mediaFile.split('.').pop());
- 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() {
- findMediaElement();
- 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?name=" + mediaFile + "&type=" + type;
- video.play();
- }
- </script>
-
- <video crossorigin></video>
- <canvas></canvas>
- </body>
-</head>
+ video.src = "http://localhost:8080/security/resources/video-cross-origin-allow.php?name=" + mediaFile + "&type=" + type;
+ video.play();
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698