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

Side by Side Diff: third_party/WebKit/LayoutTests/shapedetection/detectface.html

Issue 2369693002: Shapedetection module: Blink side implementation (Closed)
Patch Set: tests outside the [0, 1] range Created 4 years, 2 months 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
(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(faceDetectionResult => {
30 const imageReceivedByMock = theMock.getFrameData();
31 assert_equals(imageReceivedByMock.byteLength, 2500, "imageReceivedByMock.b yteLength");
32 const GREEN_PIXEL = 0xFF00FF00;
33 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "pixel must be green");
34 assert_equals(faceDetectionResult.length, 3, "faceDetectionResult.length") ;
35 t.done();
36 })
37 .catch(error => {
38 assert_unreached("Error during detect(img): " + error);
39 });
40
41 }, 'exercises the ShapeDetection API detect()');
42
43 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698