| OLD | NEW |
| 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-facedetection.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 mockFaceDetectionProviderReady | 13 mockFaceDetectionProviderReady |
| 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 => detectorWithDefault.detect(img)) | 21 .then(detectorWithDefault => detectorWithDefault.detect(img)) |
| 22 .then(t.step_func(faceDetectionResult => { | 22 .then(t.step_func(faceDetectionResult => { |
| 23 assert_equals(theMock.getMaxDetectedFaces(), 10, "default maxDetectedFac
es"); | 23 assert_equals(theMock.getMaxDetectedFaces(0), 10, "default maxDetectedFa
ces"); |
| 24 assert_equals(theMock.getFastMode(), false, "default maxDetectedFaces"); | 24 assert_equals(theMock.getFastMode(0), false, "default maxDetectedFaces")
; |
| 25 return new FaceDetector({maxDetectedFaces: 7, fastMode: true}); | 25 return new FaceDetector({maxDetectedFaces: 7, fastMode: true}); |
| 26 })) | 26 })) |
| 27 .then(detectorWithOptions => detectorWithOptions.detect(img)) | 27 .then(detectorWithOptions => detectorWithOptions.detect(img)) |
| 28 .then(t.step_func(faceDetectionResult => { | 28 .then(t.step_func(faceDetectionResult => { |
| 29 assert_equals(theMock.getMaxDetectedFaces(), 7, "maxDetectedFaces"); | 29 assert_equals(theMock.getMaxDetectedFaces(1), 7, "maxDetectedFaces"); |
| 30 assert_equals(theMock.getFastMode(), true, "maxDetectedFaces"); | 30 assert_equals(theMock.getFastMode(1), true, "maxDetectedFaces"); |
| 31 t.done(); | 31 t.done(); |
| 32 })) | 32 })) |
| 33 .catch(error => { | 33 .catch(error => { |
| 34 assert_unreached("Error creating detectors: " + error); | 34 assert_unreached("Error creating detectors: " + error); |
| 35 }); | 35 }); |
| 36 }, "Test that FaceDetectionOptions are correctly propagated"); | 36 }, "Test that FaceDetectionOptions are correctly propagated"); |
| 37 </script> | 37 </script> |
| OLD | NEW |