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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-security-test.html

Issue 2441953002: Shape Detection: Add two layout tests for face detection (Closed)
Patch Set: reillyg@ comments on naming and description 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 | third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp » ('j') | 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): Consider adding tests for image with only one dimension
7 // equal to zero.
8
9 // Returns a Promise that is resolve()d if detect() fails.
10 function detectFaceAndExpectError(imageUrl) {
11 return new Promise(function(resolve, reject) {
12 var image = new Image();
13 var faceDetector = new FaceDetector();
14 var tryFaceDetection = function() {
15 faceDetector.detect(image)
16 .then(faceDetectionResult => {
17 reject("Promise for this test image should have been rejected.");
18 })
19 .catch(error => {
20 resolve(error);
21 });
22 };
23 image.onload = tryFaceDetection;
24 image.onerror = tryFaceDetection;
25 image.src = imageUrl;
26 });
27 }
28
29 // This test verifies that FaceDetector will reject an empty image.
30 promise_test(function(t) {
31 return detectFaceAndExpectError("")
32 .then(function(error) {
33 assert_equals(error.name, "InvalidStateError");
34 assert_equals(error.message, "HTMLImageElement is empty.");
35 });
36 }, "FaceDetector should reject empty images with InvalidStateError.");
37
38 // This test verifies that FaceDetector will reject an undecodable image.
39 promise_test(function(t) {
40 return detectFaceAndExpectError("../../imported/wpt/images/broken.png")
41 .then(function(error) {
42 assert_equals(error.name, "InvalidStateError");
43 assert_regexp_match(error.message, /Unable to decompress*/);
44 });
45 }, "FaceDetector should reject undecodable images with InvalidStateError.");
46
47 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/shapedetection/FaceDetector.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698