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

Unified Diff: base/mac/bind_objc_block_unittest.mm

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « base/mac/bind_objc_block.h ('k') | base/memory/scoped_ptr_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/bind_objc_block_unittest.mm
diff --git a/base/mac/bind_objc_block_unittest.mm b/base/mac/bind_objc_block_unittest.mm
index c72fd4a8c2063b4d5c9ee7908e2f539fb23c3b2f..5d15ebaa0afb39e2ea64ee2aa34018d33557e78d 100644
--- a/base/mac/bind_objc_block_unittest.mm
+++ b/base/mac/bind_objc_block_unittest.mm
@@ -64,4 +64,36 @@ TEST(BindObjcBlockTest, TestTwoArguments) {
EXPECT_EQ(result, "fortytwo");
}
+TEST(BindObjcBlockTest, TestThreeArguments) {
+ std::string result;
+ std::string* ptr = &result;
+ base::Callback<void(const std::string&,
+ const std::string&,
+ const std::string&)> c =
+ base::BindBlock(^(const std::string& a,
+ const std::string& b,
+ const std::string& c) {
+ *ptr = a + b + c;
+ });
+ c.Run("six", "times", "nine");
+ EXPECT_EQ(result, "sixtimesnine");
+}
+
+TEST(BindObjcBlockTest, TestSixArguments) {
+ std::string result1;
+ std::string* ptr = &result1;
+ int result2;
+ int* ptr2 = &result2;
+ base::Callback<void(int, int, const std::string&, const std::string&,
+ int, const std::string&)> c =
+ base::BindBlock(^(int a, int b, const std::string& c,
+ const std::string& d, int e, const std::string& f) {
+ *ptr = c + d + f;
+ *ptr2 = a + b + e;
+ });
+ c.Run(1, 2, "infinite", "improbability", 3, "drive");
+ EXPECT_EQ(result1, "infiniteimprobabilitydrive");
+ EXPECT_EQ(result2, 6);
+}
+
} // namespace
« no previous file with comments | « base/mac/bind_objc_block.h ('k') | base/memory/scoped_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698