| Index: base/callback_registry_unittest.cc
|
| diff --git a/base/callback_registry_unittest.cc b/base/callback_registry_unittest.cc
|
| index 3459c073f1607079727953760feaa8b4a5a90ccc..5e8fbd268fde964cea3c816641b330f93ba48968 100644
|
| --- a/base/callback_registry_unittest.cc
|
| +++ b/base/callback_registry_unittest.cc
|
| @@ -35,20 +35,20 @@ class Remover {
|
| removal_subscription_.reset();
|
| }
|
| void SetSubscriptionToRemove(
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> sub) {
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> sub) {
|
| removal_subscription_ = sub.Pass();
|
| }
|
|
|
| int total_;
|
|
|
| private:
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> removal_subscription_;
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> removal_subscription_;
|
| DISALLOW_COPY_AND_ASSIGN(Remover);
|
| };
|
|
|
| class Adder {
|
| public:
|
| - explicit Adder(CallbackRegistry<void>* cb_reg)
|
| + explicit Adder(CallbackRegistry<void(void)>* cb_reg)
|
| : added_(false),
|
| total_(0),
|
| cb_reg_(cb_reg) {}
|
| @@ -65,20 +65,20 @@ class Adder {
|
| int total_;
|
|
|
| private:
|
| - CallbackRegistry<void>* cb_reg_;
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> subscription_;
|
| + CallbackRegistry<void(void)>* cb_reg_;
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> subscription_;
|
| DISALLOW_COPY_AND_ASSIGN(Adder);
|
| };
|
|
|
| // Sanity check that closures added to the list will be run, and those removed
|
| // from the list will not be run.
|
| TEST(CallbackRegistryTest, BasicTest) {
|
| - CallbackRegistry<void> cb_reg;
|
| + CallbackRegistry<void(void)> cb_reg;
|
| Listener a, b, c;
|
|
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> a_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&a)));
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> b_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b)));
|
|
|
| EXPECT_TRUE(a_subscription.get());
|
| @@ -91,7 +91,7 @@ TEST(CallbackRegistryTest, BasicTest) {
|
|
|
| b_subscription.reset();
|
|
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> c_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> c_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&c)));
|
|
|
| cb_reg.Notify();
|
| @@ -108,12 +108,12 @@ TEST(CallbackRegistryTest, BasicTest) {
|
| // Sanity check that callbacks with details added to the list will be run, with
|
| // the correct details, and those removed from the list will not be run.
|
| TEST(CallbackRegistryTest, BasicTestWithParams) {
|
| - CallbackRegistry<int> cb_reg;
|
| + CallbackRegistry<void(const int&)> cb_reg;
|
| Listener a(1), b(-1), c(1);
|
|
|
| - scoped_ptr<CallbackRegistry<int>::Subscription> a_subscription =
|
| + scoped_ptr<CallbackRegistry<void(const int&)>::Subscription> a_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&a)));
|
| - scoped_ptr<CallbackRegistry<int>::Subscription> b_subscription =
|
| + scoped_ptr<CallbackRegistry<void(const int&)>::Subscription> b_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&b)));
|
|
|
| EXPECT_TRUE(a_subscription.get());
|
| @@ -126,7 +126,7 @@ TEST(CallbackRegistryTest, BasicTestWithParams) {
|
|
|
| b_subscription.reset();
|
|
|
| - scoped_ptr<CallbackRegistry<int>::Subscription> c_subscription =
|
| + scoped_ptr<CallbackRegistry<void(const int&)>::Subscription> c_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementByMultipleOfScaler, Unretained(&c)));
|
|
|
| cb_reg.Notify(10);
|
| @@ -143,23 +143,23 @@ TEST(CallbackRegistryTest, BasicTestWithParams) {
|
| // Test the a callback can remove itself or a different callback from the list
|
| // during iteration without invalidating the iterator.
|
| TEST(CallbackRegistryTest, RemoveCallbacksDuringIteration) {
|
| - CallbackRegistry<void> cb_reg;
|
| + CallbackRegistry<void(void)> cb_reg;
|
| Listener a, b;
|
| Remover remover_1, remover_2;
|
|
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> remover_1_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> remover_1_sub =
|
| cb_reg.Add(Bind(&Remover::IncrementTotalAndRemove,
|
| Unretained(&remover_1)));
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> remover_2_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> remover_2_sub =
|
| cb_reg.Add(Bind(&Remover::IncrementTotalAndRemove,
|
| Unretained(&remover_2)));
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> a_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&a)));
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> b_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b)));
|
|
|
| // |remover_1| will remove itself.
|
| - remover_1.SetSubscriptionToRemove(remover_1_subscription.Pass());
|
| + remover_1.SetSubscriptionToRemove(remover_1_sub.Pass());
|
| // |remover_2| will remove a.
|
| remover_2.SetSubscriptionToRemove(a_subscription.Pass());
|
|
|
| @@ -185,12 +185,12 @@ TEST(CallbackRegistryTest, RemoveCallbacksDuringIteration) {
|
| // without invalidating the iterator. The newly added callback should be run on
|
| // the current iteration as will all other callbacks in the list.
|
| TEST(CallbackRegistryTest, AddCallbacksDuringIteration) {
|
| - CallbackRegistry<void> cb_reg;
|
| + CallbackRegistry<void(void)> cb_reg;
|
| Adder a(&cb_reg);
|
| Listener b;
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> a_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> a_subscription =
|
| cb_reg.Add(Bind(&Adder::AddCallback, Unretained(&a)));
|
| - scoped_ptr<CallbackRegistry<void>::Subscription> b_subscription =
|
| + scoped_ptr<CallbackRegistry<void(void)>::Subscription> b_subscription =
|
| cb_reg.Add(Bind(&Listener::IncrementTotal, Unretained(&b)));
|
|
|
| cb_reg.Notify();
|
| @@ -207,7 +207,7 @@ TEST(CallbackRegistryTest, AddCallbacksDuringIteration) {
|
|
|
| // Sanity check: notifying an empty list is a no-op.
|
| TEST(CallbackRegistryTest, EmptyList) {
|
| - CallbackRegistry<void> cb_reg;
|
| + CallbackRegistry<void(void)> cb_reg;
|
|
|
| cb_reg.Notify();
|
| }
|
|
|