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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/video-cross-origin-via-dom.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-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>

Powered by Google App Engine
This is Rietveld 408576698