| 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-barcodedetection.js"></script> | 5 <script src="resources/mock-barcodedetection.js"></script> |
| 6 <script src="resources/mock-facedetection.js"></script> | 6 <script src="resources/mock-facedetection.js"></script> |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 var createTestForImageBitmap = function(detectorName, mockReady, | 9 var createTestForImageBitmap = function(detectorName, mockReady, |
| 10 detectionResultTest) { | 10 detectionResultTest) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 }) | 22 }) |
| 23 .catch(error => { | 23 .catch(error => { |
| 24 assert_unreached('createImageBitmap() error: ' + error); | 24 assert_unreached('createImageBitmap() error: ' + error); |
| 25 }) | 25 }) |
| 26 .then(mock => { | 26 .then(mock => { |
| 27 theMock = mock; | 27 theMock = mock; |
| 28 var detector = eval("new " + detectorName + "();"); | 28 var detector = eval("new " + detectorName + "();"); |
| 29 return detector; | 29 return detector; |
| 30 }) | 30 }) |
| 31 .catch(error => { | 31 .catch(error => { |
| 32 assert_unreached("Error creating MockFaceDetection: " + error); | 32 assert_unreached("Error creating Mock Detector: " + error); |
| 33 }) | 33 }) |
| 34 .then(detector => { | 34 .then(detector => { |
| 35 return detector.detect(theImageBitmap); | 35 return detector.detect(theImageBitmap); |
| 36 }) | 36 }) |
| 37 .then(detectionResult => { | 37 .then(detectionResult => { |
| 38 detectionResultTest(detectionResult, theMock); | 38 detectionResultTest(detectionResult, theMock); |
| 39 t.done(); | 39 t.done(); |
| 40 }) | 40 }) |
| 41 .catch(error => { | 41 .catch(error => { |
| 42 assert_unreached("Error during detect(img): " + error); | 42 assert_unreached("Error during detect(img): " + error); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 71 ], | 71 ], |
| 72 [ | 72 [ |
| 73 "Barcode", | 73 "Barcode", |
| 74 "BarcodeDetector", | 74 "BarcodeDetector", |
| 75 () => { return mockBarcodeDetectionReady; }, | 75 () => { return mockBarcodeDetectionReady; }, |
| 76 BarcodeDetectorDetectionResultTest | 76 BarcodeDetectorDetectionResultTest |
| 77 ] | 77 ] |
| 78 ]); | 78 ]); |
| 79 | 79 |
| 80 </script> | 80 </script> |
| OLD | NEW |