Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 <script src="../resources/mojo-helpers.js"></script> | |
| 5 <script src="resources/mock-shapedetection.js"></script> | |
| 6 <body> | |
| 7 <img id='img' src='../media/content/greenbox.png'/> | |
| 8 </body> | |
| 9 <script> | |
| 10 async_test(function(t) { | |
| 11 var img = document.getElementById("img"); | |
| 12 var theMock = null; | |
| 13 mockShapeDetectionReady | |
| 14 .then(mock => { | |
| 15 theMock = mock; | |
| 16 return new FaceDetector(); | |
| 17 }) | |
| 18 .catch(error => { | |
| 19 assert_unreached("Error creating MockShapeDetection: " + error); | |
| 20 }) | |
| 21 .then(detectorWithDefault => { | |
| 22 return detectorWithDefault.detect(img); | |
| 23 }) | |
| 24 .then(t.step_func(faceDetectionResult => { | |
| 25 assert_equals(theMock.getMaxDetectedFaces(), 10, "default maxDetectedFac es"); | |
| 26 assert_equals(theMock.getFastMode(), false, "default maxDetectedFaces"); | |
| 27 return new FaceDetector({ | |
| 28 maxDetectedFaces: 7, | |
| 29 fastMode: true, | |
| 30 }); | |
|
mcasas
2016/11/21 23:19:26
nit: collapse l.27-30 ?
xianglu
2016/11/22 00:59:13
Done.
| |
| 31 })) | |
| 32 .then(detectorWithOptions => { | |
| 33 return detectorWithOptions.detect(img) | |
| 34 }) | |
| 35 .then(t.step_func(faceDetectionResult => { | |
| 36 assert_equals(theMock.getMaxDetectedFaces(), 7, "maxDetectedFaces"); | |
| 37 assert_equals(theMock.getFastMode(), true, "maxDetectedFaces"); | |
| 38 t.done(); | |
| 39 })) | |
| 40 .catch(error => { | |
| 41 assert_unreached("Error creating detectors: " + error); | |
| 42 }); | |
| 43 }, "Test that FaceDetectionOptions are correctly propagated"); | |
| 44 </script> | |
| OLD | NEW |