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

Unified Diff: services/shape_detection/face_detection_impl_mac_unittest.mm

Issue 2755393002: Revert of RELAND: ShapeDetection: use mojom::Bitmap for mojo interface. (Closed)
Patch Set: Created 3 years, 9 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: services/shape_detection/face_detection_impl_mac_unittest.mm
diff --git a/services/shape_detection/face_detection_impl_mac_unittest.mm b/services/shape_detection/face_detection_impl_mac_unittest.mm
index 9b9c56985c0ae183264a18d32259153494478c8b..e07f700fec91406423d9dba6a1bf22e88f703ed4 100644
--- a/services/shape_detection/face_detection_impl_mac_unittest.mm
+++ b/services/shape_detection/face_detection_impl_mac_unittest.mm
@@ -76,12 +76,24 @@
const int num_bytes = size.GetArea() * 4 /* bytes per pixel */;
ASSERT_EQ(num_bytes, image->computeSize64());
+ // Generate a new ScopedSharedBufferHandle of the aproppriate size, map it and
+ // copy the image pixels into it.
+ mojo::ScopedSharedBufferHandle handle =
+ mojo::SharedBufferHandle::Create(num_bytes);
+ ASSERT_TRUE(handle->is_valid());
+
+ mojo::ScopedSharedBufferMapping mapping = handle->Map(num_bytes);
+ ASSERT_TRUE(mapping);
+
+ memcpy(mapping.get(), image->getPixels(), num_bytes);
+
base::RunLoop run_loop;
base::Closure quit_closure = run_loop.QuitClosure();
// Send the image to Detect() and expect the response in callback.
EXPECT_CALL(*this, Detection(1)).WillOnce(RunClosure(quit_closure));
- impl_->Detect(*image, base::Bind(&FaceDetectionImplMacTest::DetectCallback,
- base::Unretained(this)));
+ impl_->Detect(std::move(handle), size.width(), size.height(),
+ base::Bind(&FaceDetectionImplMacTest::DetectCallback,
+ base::Unretained(this)));
run_loop.Run();
}
« no previous file with comments | « services/shape_detection/face_detection_impl_mac.mm ('k') | services/shape_detection/public/interfaces/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698