Index: LayoutTests/http/tests/security/webgl-remote-read-remote-image-allowed.html |
diff --git a/LayoutTests/http/tests/security/webgl-remote-read-remote-image-allowed.html b/LayoutTests/http/tests/security/webgl-remote-read-remote-image-allowed.html |
index 152fd07a95c05b88eeacf65c36624b60d9d5f96a..28b4e6e10f9812faa4ee41baffc58e991b13b46f 100644 |
--- a/LayoutTests/http/tests/security/webgl-remote-read-remote-image-allowed.html |
+++ b/LayoutTests/http/tests/security/webgl-remote-read-remote-image-allowed.html |
@@ -1,3 +1,6 @@ |
+<!doctype html> |
+<html> |
+<body> |
<pre id="console"></pre> |
<script> |
if (window.testRunner) { |
@@ -51,8 +54,11 @@ test = function(canvas, description) |
testToDataURL(canvas, description); |
} |
-var image = new Image(); |
-image.onload = function() { |
+testResource = function (resource, resourceType, continuation) |
+{ |
+ log(""); |
+ log("Testing " + resourceType + "..."); |
+ |
var canvas = document.createElement("canvas"); |
canvas.width = 100; |
canvas.height = 100; |
@@ -76,26 +82,52 @@ image.onload = function() { |
log("\n"); |
log("Tainted canvas:"); |
- // Test reading from a canvas after uploading a remote image as a texture |
+ // Test reading from a canvas after uploading a remote resource as a texture |
var texture = gl.createTexture(); |
gl.bindTexture(gl.TEXTURE_2D, texture); |
- testTexImage2D(gl, image, "image"); |
+ testTexImage2D(gl, resource, resourceType); |
- test(canvas, "remote image"); |
+ test(canvas, "remote " + resourceType); |
// Now test reading from a canvas after uploading a tainted canvas onto it |
var dirtyCanvas = document.createElement("canvas"); |
dirtyCanvas.width = 100; |
dirtyCanvas.height = 100; |
var dirtyContext = dirtyCanvas.getContext("2d"); |
- dirtyContext.drawImage(image, 0, 0, 100, 100); |
+ dirtyContext.drawImage(resource, 0, 0, 100, 100); |
testTexImage2D(gl, dirtyCanvas, "canvas"); |
test(canvas, "CORS-untained canvas"); |
+ continuation(); |
+} |
+ |
+testImage = function () |
+{ |
+ var image = new Image(); |
+ image.onload = testResource.bind(null, image, "image", testVideo); |
+ image.crossOrigin = "anonymous"; |
+ image.src = "http://localhost:8000/security/resources/abe-allow-star.php"; |
+} |
+ |
+testVideo = function () |
+{ |
+ var video = document.createElement('video'); |
+ video.oncanplay = testResource.bind(null, video, "video", finishUp); |
+ video.crossOrigin = "anonymous"; |
+ var name = "../../media/resources/test.ogv"; |
+ var type = "video/ogg"; |
+ video.src = "http://localhost:8000/security/resources/video-cross-origin-allow.php?name=" + name + "&type=" + type; |
+} |
+ |
+finishUp = function () |
+{ |
+ log("DONE"); |
if (window.testRunner) |
testRunner.notifyDone(); |
} |
-image.crossOrigin = "anonymous"; |
-image.src = "http://localhost:8000/security/resources/abe-allow-star.php"; |
+ |
+testImage(); |
</script> |
+</body> |
+</html> |