Chromium Code Reviews| 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> |