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

Side by Side Diff: content/test/data/media/face_detection_test.html

Issue 2419273002: Shape Detection: Add two content browser tests for face detection (Closed)
Patch Set: Approximate comparisons 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 <html>
3 <head>
4 </head>
5
6 <body>
7 <img id="myImage">
8 </body>
9
10 <script>
11 var img = document.getElementById("myImage");
12
13 //Content browser tests only support detecting one face or none(for now).
14 function detectFacesOnImageUrl(url) {
15 img.src = url;
16 img.onload = function() {
17 var detector = new FaceDetector();
18 var results = "";
19 detector.detect(img)
20 .then(boundingBoxes => {
21 for (var i=0; i<boundingBoxes.length; i++) {
22 var boundingBox = boundingBoxes[i];
23 var result = boundingBox.x + "," + boundingBox.y + "," +
24 boundingBox.width + "," + boundingBox.height;
25 results += result + "#";
26 }
27 window.domAutomationController.send(results);
28 })
29 .catch(error => {
30 error = new Error("Error during detection:" + error);
31 window.domAutomationController.send(error.stack);
32 });
33 }
34 }
35 </script>
36 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698