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

Unified Diff: base/bind_unittest.cc

Issue 8048008: Add new helper that can adapt Callbacks with return values for Closures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments. Created 9 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
« no previous file with comments | « base/bind_helpers.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind_unittest.cc
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc
index 8718d1da85f75fd53ea9f5f66d54506fc8d2adea..dde2226f64cb82c4bf41d54bab6fa8e852b796d2 100644
--- a/base/bind_unittest.cc
+++ b/base/bind_unittest.cc
@@ -4,12 +4,6 @@
#include "base/bind.h"
-#if defined(BASE_CALLBACK_H_)
-// We explicitly do not want to include callback.h so people are not tempted
-// to use bind.h in a headerfile for getting the Callback types.
-#error "base/bind.h should avoid pulling in callback.h by default."
-#endif
-
#include "base/callback.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -317,6 +311,15 @@ TEST_F(BindTest, ReturnValues) {
EXPECT_EQ(51337, const_method_const_obj_cb.Run());
}
+// IgnoreReturn adapter test.
+// - Function with return value, and no params can be converted to Closure.
+TEST_F(BindTest, IgnoreReturn) {
+ EXPECT_CALL(static_func_mock_, IntMethod0()).WillOnce(Return(1337));
+ Callback<int(void)> normal_cb = Bind(&IntFunc0);
+ Closure c = IgnoreReturn(normal_cb);
+ c.Run();
+}
+
// Argument binding tests.
// - Argument binding to primitive.
// - Argument binding to primitive pointer.
« no previous file with comments | « base/bind_helpers.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698