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

Unified Diff: third_party/WebKit/LayoutTests/shapedetection/detectface.html

Issue 2369693002: Shapedetection module: Blink side implementation (Closed)
Patch Set: Refactor code into getSharedBufferHandle() && Update *-expected.txt Created 4 years, 3 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: third_party/WebKit/LayoutTests/shapedetection/detectface.html
diff --git a/third_party/WebKit/LayoutTests/shapedetection/detectface.html b/third_party/WebKit/LayoutTests/shapedetection/detectface.html
new file mode 100644
index 0000000000000000000000000000000000000000..cd55a8a993654cf99ee2cc837fc0639469b9a698
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shapedetection/detectface.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/mojo-helpers.js"></script>
+<script src="resources/mock-shapedetection.js"></script>
+<body>
+<img id='img' src='../media/content/greenbox.png'/>
+</body>
+<script>
+
+// This test verifies that FaceDetector can detect(). A mock mojo
+// server is implemented in mock-shapedetection.js.
+
+async_test(function(t) {
+ var img = document.getElementById("img");
+
+ var theMock = null;
+ mockShapeDetectionReady
+ .then(mock => {
+ theMock = mock;
+ return new FaceDetector();
+ })
+ .catch(error => {
+ assert_unreached("Error creating MockShapeDetection: " + error);
+ })
+ .then(detector => {
+ return detector.detect(img);
+ })
+ .then(boundingBoxes => {
+ uint32ArrayReceivedByMock = theMock.getFrameData();
mcasas 2016/09/30 02:14:59 s/uint32ArrayReceivedByMock/const receivedImage/ ?
xianglu 2016/09/30 16:37:40 Done.
+ assert_equals(uint32ArrayReceivedByMock.byteLength, 2500, "int32ArrayReceivedByMock.byteLength");
+ assert_equals(uint32ArrayReceivedByMock[0], 4278255360, "First pixel received by mock should be green.");
mcasas 2016/09/30 02:14:59 const GREEN_PIXEL = 0xFFFF0000; assert_equals(uint
xianglu 2016/09/30 16:37:40 Done.
+ assert_equals(boundingBoxes.length, 3, "boundingBox.length");
+ t.done();
+ })
+ .catch(error => {
+ assert_unreached("Error during detect(img): " + error);
+ });
+
+}, 'exercises the ShapeDetection API detect()');
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698