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

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

Issue 2522143002: ShapeDetection: split mojom into face and barcode interfaces (Closed)
Patch Set: Created 4 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 unified diff | Download patch
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> 4 <script src="../resources/mojo-helpers.js"></script>
5 <script src="resources/mock-shapedetection.js"></script> 5 <script src="resources/mock-facedetection.js"></script>
6 <body> 6 <body>
7 <img id='img' src='../media/content/greenbox.png'/> 7 <img id='img' src='../media/content/greenbox.png'/>
8 </body> 8 </body>
9 <script> 9 <script>
10 async_test(function(t) { 10 async_test(function(t) {
11 var img = document.getElementById("img"); 11 var img = document.getElementById("img");
12 var theMock = null; 12 var theMock = null;
13 mockShapeDetectionReady 13 mockFaceDetectionReady
14 .then(mock => { 14 .then(mock => {
15 theMock = mock; 15 theMock = mock;
16 return new FaceDetector(); 16 return new FaceDetector();
17 }) 17 })
18 .catch(error => { 18 .catch(error => {
19 assert_unreached("Error creating MockShapeDetection: " + error); 19 assert_unreached("Error creating MockShapeDetection: " + error);
20 }) 20 })
21 .then(detectorWithDefault => { 21 .then(detectorWithDefault => {
22 return detectorWithDefault.detect(img); 22 return detectorWithDefault.detect(img);
23 }) 23 })
24 .then(t.step_func(faceDetectionResult => { 24 .then(t.step_func(faceDetectionResult => {
25 assert_equals(theMock.getMaxDetectedFaces(), 10, "default maxDetectedFac es"); 25 assert_equals(theMock.getMaxDetectedFaces(), 10, "default maxDetectedFac es");
26 assert_equals(theMock.getFastMode(), false, "default maxDetectedFaces"); 26 assert_equals(theMock.getFastMode(), false, "default maxDetectedFaces");
27 return new FaceDetector({maxDetectedFaces: 7, fastMode: true}); 27 return new FaceDetector({maxDetectedFaces: 7, fastMode: true});
28 })) 28 }))
29 .then(detectorWithOptions => { 29 .then(detectorWithOptions => {
30 return detectorWithOptions.detect(img) 30 return detectorWithOptions.detect(img)
31 }) 31 })
32 .then(t.step_func(faceDetectionResult => { 32 .then(t.step_func(faceDetectionResult => {
33 assert_equals(theMock.getMaxDetectedFaces(), 7, "maxDetectedFaces"); 33 assert_equals(theMock.getMaxDetectedFaces(), 7, "maxDetectedFaces");
34 assert_equals(theMock.getFastMode(), true, "maxDetectedFaces"); 34 assert_equals(theMock.getFastMode(), true, "maxDetectedFaces");
35 t.done(); 35 t.done();
36 })) 36 }))
37 .catch(error => { 37 .catch(error => {
38 assert_unreached("Error creating detectors: " + error); 38 assert_unreached("Error creating detectors: " + error);
39 }); 39 });
40 }, "Test that FaceDetectionOptions are correctly propagated"); 40 }, "Test that FaceDetectionOptions are correctly propagated");
41 </script> 41 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698