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

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

Issue 2711893003: Shape detection: moar content_browsertests (face, qr/barcode) (Closed)
Patch Set: Created 3 years, 10 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/shape_detection_test.html
diff --git a/content/test/data/media/face_detection_test.html b/content/test/data/media/shape_detection_test.html
similarity index 62%
rename from content/test/data/media/face_detection_test.html
rename to content/test/data/media/shape_detection_test.html
index 16b5dd73cb5c4ecbf979cab6dfec5d6460afb773..9840d253dc1316e8b60210540abab76471c798f0 100644
--- a/content/test/data/media/face_detection_test.html
+++ b/content/test/data/media/shape_detection_test.html
@@ -10,15 +10,17 @@
<script>
var img = document.getElementById("myImage");
- function detectFacesOnImageUrl(url) {
- img.src = url;
+ function detectShapesOnImageUrl(detector, url) {
+ var detector = eval('new ' + detector + '()');
+ console.log(detector);
img.onload = function() {
- var detector = new FaceDetector();
+ console.log('image loaded');
var results = "";
detector.detect(img)
- .then(detectedFaces => {
- for (var i = 0; i < detectedFaces.length; i++) {
- var boundingBox = detectedFaces[i].boundingBox;
+ .then(detectedObjects => {
+ console.log('something detected');
+ for (var i = 0; i < detectedObjects.length; i++) {
+ var boundingBox = detectedObjects[i].boundingBox;
var result = boundingBox.x + "," + boundingBox.y + "," +
boundingBox.width + "," + boundingBox.height;
results += result + "#";
@@ -26,10 +28,12 @@
window.domAutomationController.send(results);
})
.catch(error => {
+ console.log('something failed');
Reilly Grant (use Gerrit) 2017/02/28 00:35:11 These logs seem like leftovers from development. T
mcasas 2017/02/28 18:10:18 Done.
error = new Error("Error during detection:" + error.message);
window.domAutomationController.send(error.message);
});
}
+ img.src = url;
}
</script>
</html>

Powered by Google App Engine
This is Rietveld 408576698