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

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

Issue 1532473002: Add a origin clean flag in ImageBitmap class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: handle canvas Created 5 years 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/cross-origin-createImageBitmap.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html
index b5b56246330c1651dda1cd7b99ac56b1721b2f14..9258465382d35c7cf6368ad926b8734a028574e4 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html
+++ b/third_party/WebKit/LayoutTests/http/tests/security/cross-origin-createImageBitmap.html
@@ -3,17 +3,17 @@
<body>
<script src="/js-test-resources/js-test.js"></script>
<script>
-description("The image bitmap factories should throw exceptions on cross-origin access.");
+description("The image bitmap factories should not throw exceptions on cross-origin access.");
Justin Novosad 2015/12/23 18:06:34 The test needs to do more. You need to verify that
xidachen 2015/12/29 15:04:14 Done.
window.jsTestIsAsync = true;
var reason;
-function shouldBeRejected(promise, message) {
+function shouldBeAccepted(promise, message) {
return promise.then(function() {
- testFailed('Resolved unexpectedly: ' + message);
+ testPassed('Resolved as expected: ' + message);
}, function(e) {
reason = e;
- testPassed('Rejected as expected: ' + message);
+ testFailed('Rejected unexpectedly: ' + message);
shouldBeTrue('reason instanceof Error');
debug(e);
});
@@ -26,7 +26,20 @@ Promise.resolve().then(function() {
image.src = 'http://localhost:8080/security/resources/abe.png';
document.body.appendChild(image);
}).then(function(image) {
- return shouldBeRejected(createImageBitmap(image, 0, 0, 10, 10), 'image');
+ return shouldBeAccepted(createImageBitmap(image, 0, 0, 10, 10), 'image');
+ });
+}).then(function() {
+ return new Promise(function(resolve, reject) {
+ var image = document.createElement('img');
+ image.addEventListener('load', resolve.bind(undefined, image));
+ image.src = 'http://localhost:8080/security/resources/abe.png';
+ var canvas = document.createElement("canvas");
+ canvas.width = 10;
+ canvas.height = 10;
+ var context = canvas.getContext("2d");
+ context.drawImage(image, 0, 0, 10, 10);
+ }).then(function(canvas) {
+ return shouldBeAccepted(createImageBitmap(canvas, 0, 0, 10, 10), 'canvas');
});
}).then(function() {
return new Promise(function(resolve, reject) {
@@ -36,7 +49,7 @@ Promise.resolve().then(function() {
document.body.appendChild(video);
video.play();
}).then(function(video) {
- return shouldBeRejected(createImageBitmap(video, 0, 0, 10, 10), 'video');
+ return shouldBeAccepted(createImageBitmap(video, 0, 0, 10, 10), 'video');
});
}).catch(function(e) {
testFailed('Unexpected rejection: ' + e);

Powered by Google App Engine
This is Rietveld 408576698