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 | |
| 11 // This test verifies that FaceDetector can detect(). A mock mojo | |
| 12 // server is implemented in mock-shapedetection.js. | |
| 13 | |
| 14 async_test(function(t) { | |
| 15 var img = document.getElementById("img"); | |
| 16 | |
| 17 var theMock = null; | |
| 18 mockShapeDetectionReady | |
| 19 .then(mock => { | |
| 20 theMock = mock; | |
| 21 return new FaceDetector(); | |
| 22 }) | |
| 23 .catch(error => { | |
| 24 assert_unreached("Error creating MockShapeDetection: " + error); | |
| 25 }) | |
| 26 .then(detector => { | |
| 27 return detector.detect(img); | |
| 28 }) | |
| 29 .then(boundingBoxes => { | |
| 30 uint32ArrayReceivedByMock = theMock.getFrameData(); | |
|
mcasas
2016/09/30 02:14:59
s/uint32ArrayReceivedByMock/const receivedImage/ ?
xianglu
2016/09/30 16:37:40
Done.
| |
| 31 assert_equals(uint32ArrayReceivedByMock.byteLength, 2500, "int32ArrayRecei vedByMock.byteLength"); | |
| 32 assert_equals(uint32ArrayReceivedByMock[0], 4278255360, "First pixel recei ved by mock should be green."); | |
|
mcasas
2016/09/30 02:14:59
const GREEN_PIXEL = 0xFFFF0000;
assert_equals(uint
xianglu
2016/09/30 16:37:40
Done.
| |
| 33 assert_equals(boundingBoxes.length, 3, "boundingBox.length"); | |
| 34 t.done(); | |
| 35 }) | |
| 36 .catch(error => { | |
| 37 assert_unreached("Error during detect(img): " + error); | |
| 38 }); | |
| 39 | |
| 40 }, 'exercises the ShapeDetection API detect()'); | |
| 41 | |
| 42 </script> | |
| OLD | NEW |