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

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

Issue 2502723002: ShapeDetection: implement barcode detection, blink part (Closed)
Patch Set: haraken@ comments Created 4 years, 1 month 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.detect works on an HTMLImageElement.
12 // Uses the mock mojo server implemented in mock-shapedetection.js.
13 async_test(function(t) {
14 var img = document.getElementById("img");
15
16 var theMock = null;
17 mockShapeDetectionReady
18 .then(mock => {
19 theMock = mock;
20 return new FaceDetector();
21 })
22 .catch(error => {
23 assert_unreached("Error creating MockShapeDetection: " + error);
24 })
25 .then(detector => {
26 return detector.detect(img);
27 })
28 .then(faceDetectionResult => {
29 const imageReceivedByMock = theMock.getFrameData();
30 assert_equals(imageReceivedByMock.byteLength, 2500, "Image length");
31 const GREEN_PIXEL = 0xFF00FF00;
32 assert_equals(imageReceivedByMock[0], GREEN_PIXEL, "Pixel color");
33 assert_equals(faceDetectionResult.length, 3, "Number of faces");
34 t.done();
35 })
36 .catch(error => {
37 assert_unreached("Error during detect(img): " + error);
38 });
39
40 }, 'exercises the ShapeDetection API detect(HTMLImageElement)');
41
42 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698