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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/shapedetection/shapedetection-cross-origin.html

Issue 2440243002: Shape Detection: Add cross-origin layout test for face detection (Closed)
Patch Set: mcasas@ comment Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src=../../../../resources/testharness.js></script>
3 <script src=../../../../resources/testharnessreport.js></script>
4 <script>
5
6 // TODO(xianglu): Move this helper function to a shared location for reuse.
7 function detectFaceAndExpectError(imageUrl) {
8 return new Promise(function(resolve, reject) {
9 var image = new Image();
10 var faceDetector = new FaceDetector();
11 var tryFaceDetection = function() {
12 faceDetector.detect(image)
13 .then(faceDetectionResult => {
14 reject("Promise for this test image should have been rejected.");
15 })
16 .catch(error => {
17 resolve(error);
18 });
19 };
20 image.onload = tryFaceDetection;
21 image.onerror = tryFaceDetection;
22 image.src = imageUrl;
23 });
24 }
25
26 // This test verifies that FaceDetector will reject a cross-origin-image.
27 promise_test(
28 function(t) {
29 // Since security origin is under file://, images using http protocol
30 // is considered of a different origin.
31 return detectFaceAndExpectError(
32 "http://localhost:8080/security/resources/abe.png")
33 .then(function(error) {
34 assert_equals(error.name, "SecurityError");
35 assert_equals(error.message,
36 "Image source from a different origin.");
37 });
38 },
39 "FaceDetector should reject cross-origin-images with SecurityError.");
40 </script>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698