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

Unified Diff: base/callback_unittest.cc

Issue 8914022: Revert 114494 - Remove BindStateHolder and have Bind() return a Callback<> object directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/callback_internal.cc ('k') | base/cancelable_callback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/callback_unittest.cc
===================================================================
--- base/callback_unittest.cc (revision 114494)
+++ base/callback_unittest.cc (working copy)
@@ -9,7 +9,6 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
-
namespace {
class HelperObject {
@@ -27,41 +26,19 @@
static void Run(internal::BindStateBase*) {
}
};
-} // namespace
-namespace internal {
-template <typename Runnable, typename RunType, typename BoundArgsType>
-struct BindState;
-
// White-box testpoints to inject into a Callback<> object for checking
-// comparators and emptiness APIs. Use a BindState that is specialized
-// based on a type we declared in the anonymous namespace above to remove any
-// chance of colliding with another instantiation and breaking the
-// one-definition-rule.
-template <>
-struct BindState<void(void), void(void), void(FakeInvoker)>
- : public BindStateBase {
+// comparators and emptiness APIs.
+class FakeBindState1 : public internal::BindStateBase {
public:
typedef FakeInvoker InvokerType;
};
-template <>
-struct BindState<void(void), void(void),
- void(FakeInvoker, FakeInvoker)>
- : public BindStateBase {
+class FakeBindState2 : public internal::BindStateBase {
public:
typedef FakeInvoker InvokerType;
};
-} // namespace internal
-namespace {
-
-typedef internal::BindState<void(void), void(void), void(FakeInvoker)>
- FakeBindState1;
-typedef internal::BindState<void(void), void(void),
- void(FakeInvoker, FakeInvoker)>
- FakeBindState2;
-
TEST(CallbackOld, OneArg) {
HelperObject obj;
scoped_ptr<Callback1<int*>::Type> callback(
@@ -83,8 +60,8 @@
class CallbackTest : public ::testing::Test {
public:
CallbackTest()
- : callback_a_(new FakeBindState1()),
- callback_b_(new FakeBindState2()) {
+ : callback_a_(MakeBindStateHolder(new FakeBindState1())),
+ callback_b_(MakeBindStateHolder(new FakeBindState2())) {
}
virtual ~CallbackTest() {
@@ -128,7 +105,8 @@
EXPECT_FALSE(callback_b_.Equals(callback_a_));
// We should compare based on instance, not type.
- Callback<void(void)> callback_c(new FakeBindState1());
+ Callback<void(void)> callback_c(
+ MakeBindStateHolder(new FakeBindState1()));
Callback<void(void)> callback_a2 = callback_a_;
EXPECT_TRUE(callback_a_.Equals(callback_a2));
EXPECT_FALSE(callback_a_.Equals(callback_c));
« no previous file with comments | « base/callback_internal.cc ('k') | base/cancelable_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698