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

Side by Side 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 4 years, 12 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <script src="/js-test-resources/js-test.js"></script> 4 <script src="/js-test-resources/js-test.js"></script>
5 <script> 5 <script>
6 description("The image bitmap factories should throw exceptions on cross-origin access."); 6 description("The image bitmap factories should not throw exceptions on cross-ori gin 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.
7 7
8 window.jsTestIsAsync = true; 8 window.jsTestIsAsync = true;
9 var reason; 9 var reason;
10 10
11 function shouldBeRejected(promise, message) { 11 function shouldBeAccepted(promise, message) {
12 return promise.then(function() { 12 return promise.then(function() {
13 testFailed('Resolved unexpectedly: ' + message); 13 testPassed('Resolved as expected: ' + message);
14 }, function(e) { 14 }, function(e) {
15 reason = e; 15 reason = e;
16 testPassed('Rejected as expected: ' + message); 16 testFailed('Rejected unexpectedly: ' + message);
17 shouldBeTrue('reason instanceof Error'); 17 shouldBeTrue('reason instanceof Error');
18 debug(e); 18 debug(e);
19 }); 19 });
20 } 20 }
21 21
22 Promise.resolve().then(function() { 22 Promise.resolve().then(function() {
23 return new Promise(function(resolve, reject) { 23 return new Promise(function(resolve, reject) {
24 var image = document.createElement('img'); 24 var image = document.createElement('img');
25 image.addEventListener('load', resolve.bind(undefined, image)); 25 image.addEventListener('load', resolve.bind(undefined, image));
26 image.src = 'http://localhost:8080/security/resources/abe.png'; 26 image.src = 'http://localhost:8080/security/resources/abe.png';
27 document.body.appendChild(image); 27 document.body.appendChild(image);
28 }).then(function(image) { 28 }).then(function(image) {
29 return shouldBeRejected(createImageBitmap(image, 0, 0, 10, 10), 'image') ; 29 return shouldBeAccepted(createImageBitmap(image, 0, 0, 10, 10), 'image') ;
30 }); 30 });
31 }).then(function() { 31 }).then(function() {
32 return new Promise(function(resolve, reject) { 32 return new Promise(function(resolve, reject) {
33 var image = document.createElement('img');
34 image.addEventListener('load', resolve.bind(undefined, image));
35 image.src = 'http://localhost:8080/security/resources/abe.png';
36 var canvas = document.createElement("canvas");
37 canvas.width = 10;
38 canvas.height = 10;
39 var context = canvas.getContext("2d");
40 context.drawImage(image, 0, 0, 10, 10);
41 }).then(function(canvas) {
42 return shouldBeAccepted(createImageBitmap(canvas, 0, 0, 10, 10), 'canvas ');
43 });
44 }).then(function() {
45 return new Promise(function(resolve, reject) {
33 var video = document.createElement('video'); 46 var video = document.createElement('video');
34 video.src = 'http://localhost:8080/media/resources/load-video.php?name=t est.ogv&amp;type=video/ogv'; 47 video.src = 'http://localhost:8080/media/resources/load-video.php?name=t est.ogv&amp;type=video/ogv';
35 video.addEventListener('playing', resolve.bind(undefined, video)); 48 video.addEventListener('playing', resolve.bind(undefined, video));
36 document.body.appendChild(video); 49 document.body.appendChild(video);
37 video.play(); 50 video.play();
38 }).then(function(video) { 51 }).then(function(video) {
39 return shouldBeRejected(createImageBitmap(video, 0, 0, 10, 10), 'video') ; 52 return shouldBeAccepted(createImageBitmap(video, 0, 0, 10, 10), 'video') ;
40 }); 53 });
41 }).catch(function(e) { 54 }).catch(function(e) {
42 testFailed('Unexpected rejection: ' + e); 55 testFailed('Unexpected rejection: ' + e);
43 }).then(finishJSTest, finishJSTest); 56 }).then(finishJSTest, finishJSTest);
44 </script> 57 </script>
45 </body> 58 </body>
46 </html> 59 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698