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

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

Issue 2756793002: RELAND: Shape Detection: move the Mac service to the sandboxed GPU process (Closed)
Patch Set: moved shapedetection-security-test.html to non-fast LayoutTests to use the mock mojo service Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-security-test.html ('k') | 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src=../../resources/testharness.js></script> 2 <script src=../resources/testharness.js></script>
3 <script src=../../resources/testharnessreport.js></script> 3 <script src=../resources/testharnessreport.js></script>
4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/mock-facedetection.js"></script>
4 <script> 6 <script>
5 7
6 // Returns a Promise that is resolve()d if detect() is rejected. Needs an input 8 // Returns a Promise that is resolve()d if detect() is rejected. Needs an input
7 // |element| (e.g. an HTMLImageElement or HTMLVideoElement) and a |url| to load. 9 // |element| (e.g. an HTMLImageElement or HTMLVideoElement) and a |url| to load.
8 function detectOnElementAndExpectError(createDetector, element, url) { 10 function detectOnElementAndExpectError(createDetector, element, url) {
9 return new Promise(function(resolve, reject) { 11 return new Promise(function(resolve, reject) {
10 var tryDetection = function() { 12 var tryDetection = function() {
11 var detector = createDetector(); 13 var theMock = null;
12 detector.detect(element) 14 mockFaceDetectionProviderReady
15 .then(mock => {
16 return createDetector();
17 })
18 .then(detector => {
19 return detector.detect(element);
20 })
13 .then(detectionResult => { 21 .then(detectionResult => {
14 reject("Promise should have been rejected."); 22 reject("Promise should have been rejected.");
15 }) 23 })
16 .catch(error => { 24 .catch(error => {
17 resolve(error); 25 resolve(error);
18 }); 26 });
19 }; 27 };
20 element.onload = tryDetection; 28 element.onload = tryDetection;
21 element.onerror = tryDetection; 29 element.onerror = tryDetection;
22 element.src = url; 30 element.src = url;
23 }); 31 });
24 }; 32 };
25 33
26 // This test verifies that a Detector will reject an undecodable image. 34 // This test verifies that a Detector will reject an undecodable image.
27 var createTestForBadImage = function(createDetector) { 35 var createTestForBadImage = function(createDetector) {
28 promise_test(function(t) { 36 promise_test(function(t) {
29 var image = new Image(); 37 var image = new Image();
30 return detectOnElementAndExpectError(createDetector, image, 38 return detectOnElementAndExpectError(createDetector, image,
31 "../../external/wpt/images/broken.png") 39 "../external/wpt/images/broken.png")
32 .then(function(error) { 40 .then(function(error) {
33 assert_equals(error.name, "InvalidStateError"); 41 assert_equals(error.name, "InvalidStateError");
34 }); 42 });
35 }, "Detector should reject undecodable images with an InvalidStateError."); 43 }, "Detector should reject undecodable images with an InvalidStateError.");
36 }; 44 };
37 45
38 generate_tests(createTestForBadImage, [ 46 generate_tests(createTestForBadImage, [
39 [ "Face", () => { return new FaceDetector(); } ], 47 [ "Face", () => { return new FaceDetector(); } ],
40 [ "Barcode", () => { return new BarcodeDetector(); } ], 48 [ "Barcode", () => { return new BarcodeDetector(); } ],
41 [ "Text", () => { return new TextDetector(); } ] 49 [ "Text", () => { return new TextDetector(); } ]
(...skipping 11 matching lines...) Expand all
53 }, "Detector should reject undecodable videos with an InvalidStateError."); 61 }, "Detector should reject undecodable videos with an InvalidStateError.");
54 }; 62 };
55 63
56 generate_tests(createTestForBadVideo, [ 64 generate_tests(createTestForBadVideo, [
57 [ "Face", () => { return new FaceDetector(); } ], 65 [ "Face", () => { return new FaceDetector(); } ],
58 [ "Barcode", () => { return new BarcodeDetector(); } ], 66 [ "Barcode", () => { return new BarcodeDetector(); } ],
59 [ "Text", () => { return new TextDetector(); } ] 67 [ "Text", () => { return new TextDetector(); } ]
60 ]); 68 ]);
61 69
62 </script> 70 </script>
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/shapedetection/shapedetection-security-test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698