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

Unified Diff: content/test/data/media/face_detection_test.html

Issue 2419273002: Shape Detection: Add two content browser tests for face detection (Closed)
Patch Set: reillyg@ comments 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 side-by-side diff with in-line comments
Download patch
Index: content/test/data/media/face_detection_test.html
diff --git a/content/test/data/media/face_detection_test.html b/content/test/data/media/face_detection_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..f7566473fb33b2396f79f51af757fdacfe0068f7
--- /dev/null
+++ b/content/test/data/media/face_detection_test.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+
+<body>
+ <img id="myImage">
+</body>
+
+<script>
+ var img = document.getElementById("myImage");
+
+ function detectFacesOnImageUrl(url) {
mcasas 2016/10/18 23:15:14 This code, and the content_browsertest, seem to be
xianglu 2016/10/19 23:26:10 Face detection implementation in Java will return
mcasas 2016/10/19 23:41:11 Hmm I guess in that case, no comment is needed, si
+ img.src = url;
+ img.onload = function() {
+ var detector = new FaceDetector();
+ var results = "";
+ detector.detect(img)
+ .then(faceDetectionResult => {
mcasas 2016/10/18 23:15:13 micro-nit: s/faceDetectionResult/detectedFaces/ ?
xianglu 2016/10/19 23:26:10 Done.
+ for (var i=0; i<faceDetectionResult.length; i++) {
+ var boundingBox = faceDetectionResult[i];
mcasas 2016/10/18 23:15:14 const?
xianglu 2016/10/19 23:26:10 If I understand correctly, const in javascript mea
+ var result = "x=" + boundingBox.x + ",y=" + boundingBox.y +
+ ",w=" + boundingBox.width + ",h=" + boundingBox.height;
+ results += result + "#";
+ }
+ window.domAutomationController.send(results);
+ })
+ .catch(error => {
+ var error = new Error("Error during detection:" + error);
+ window.domAutomationController.send(error.stack);
+ });
+
mcasas 2016/10/18 23:15:14 Remove this empty line?
xianglu 2016/10/19 23:26:10 Done.
+ }
+ }
+</script>
+</html>

Powered by Google App Engine
This is Rietveld 408576698