Index: sync/notifier/p2p_notifier_unittest.cc |
diff --git a/sync/notifier/p2p_notifier_unittest.cc b/sync/notifier/p2p_notifier_unittest.cc |
index 6a62038bb6710e8bfb0b686a3de0ec2752f44f9e..1095a53eb6d68550f156db91ef40a39f1d5df5ad 100644 |
--- a/sync/notifier/p2p_notifier_unittest.cc |
+++ b/sync/notifier/p2p_notifier_unittest.cc |
@@ -9,7 +9,7 @@ |
#include "jingle/notifier/listener/fake_push_client.h" |
#include "sync/internal_api/public/base/model_type.h" |
#include "sync/internal_api/public/base/model_type_state_map.h" |
-#include "sync/notifier/fake_sync_notifier_observer.h" |
+#include "sync/notifier/fake_invalidation_handler.h" |
#include "sync/notifier/object_id_state_map_test_util.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -25,11 +25,11 @@ class P2PNotifierTest : public testing::Test { |
scoped_ptr<notifier::PushClient>(fake_push_client_), |
NOTIFY_OTHERS), |
next_sent_notification_to_reflect_(0) { |
- p2p_notifier_.RegisterHandler(&fake_observer_); |
+ p2p_notifier_.RegisterHandler(&fake_handler_); |
} |
virtual ~P2PNotifierTest() { |
- p2p_notifier_.UnregisterHandler(&fake_observer_); |
+ p2p_notifier_.UnregisterHandler(&fake_handler_); |
} |
ModelTypeStateMap MakeStateMap(ModelTypeSet types) { |
@@ -51,7 +51,7 @@ class P2PNotifierTest : public testing::Test { |
// Owned by |p2p_notifier_|. |
notifier::FakePushClient* fake_push_client_; |
P2PNotifier p2p_notifier_; |
- FakeSyncNotifierObserver fake_observer_; |
+ FakeInvalidationHandler fake_handler_; |
private: |
size_t next_sent_notification_to_reflect_; |
@@ -140,7 +140,7 @@ TEST_F(P2PNotifierTest, P2PNotificationDataNonDefault) { |
TEST_F(P2PNotifierTest, NotificationsBasic) { |
const ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES); |
- p2p_notifier_.UpdateRegisteredIds(&fake_observer_, |
+ p2p_notifier_.UpdateRegisteredIds(&fake_handler_, |
ModelTypeSetToObjectIdSet(enabled_types)); |
p2p_notifier_.SetUniqueId("sender"); |
@@ -162,24 +162,24 @@ TEST_F(P2PNotifierTest, NotificationsBasic) { |
ReflectSentNotifications(); |
fake_push_client_->EnableNotifications(); |
EXPECT_EQ(NO_NOTIFICATION_ERROR, |
- fake_observer_.GetNotificationsDisabledReason()); |
+ fake_handler_.GetNotificationsDisabledReason()); |
ReflectSentNotifications(); |
- EXPECT_EQ(1, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount()); |
EXPECT_THAT( |
ModelTypeStateMapToObjectIdStateMap(MakeStateMap(enabled_types)), |
- Eq(fake_observer_.GetLastNotificationIdStateMap())); |
- EXPECT_EQ(REMOTE_NOTIFICATION, fake_observer_.GetLastNotificationSource()); |
+ Eq(fake_handler_.GetLastNotificationIdStateMap())); |
+ EXPECT_EQ(REMOTE_NOTIFICATION, fake_handler_.GetLastNotificationSource()); |
// Sent with target NOTIFY_OTHERS so should not be propagated to |
- // |fake_observer_|. |
+ // |fake_handler_|. |
{ |
ModelTypeSet changed_types(THEMES, APPS); |
p2p_notifier_.SendNotification(changed_types); |
} |
ReflectSentNotifications(); |
- EXPECT_EQ(1, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount()); |
} |
// Set up the P2PNotifier and send out notifications with various |
@@ -190,7 +190,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) { |
const ModelTypeSet changed_types(THEMES, APPS); |
const ModelTypeSet expected_types(THEMES); |
- p2p_notifier_.UpdateRegisteredIds(&fake_observer_, |
+ p2p_notifier_.UpdateRegisteredIds(&fake_handler_, |
ModelTypeSetToObjectIdSet(enabled_types)); |
p2p_notifier_.SetUniqueId("sender"); |
@@ -199,19 +199,19 @@ TEST_F(P2PNotifierTest, SendNotificationData) { |
ReflectSentNotifications(); |
fake_push_client_->EnableNotifications(); |
EXPECT_EQ(NO_NOTIFICATION_ERROR, |
- fake_observer_.GetNotificationsDisabledReason()); |
+ fake_handler_.GetNotificationsDisabledReason()); |
ReflectSentNotifications(); |
- EXPECT_EQ(1, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount()); |
EXPECT_THAT( |
ModelTypeStateMapToObjectIdStateMap(MakeStateMap(enabled_types)), |
- Eq(fake_observer_.GetLastNotificationIdStateMap())); |
- EXPECT_EQ(REMOTE_NOTIFICATION, fake_observer_.GetLastNotificationSource()); |
+ Eq(fake_handler_.GetLastNotificationIdStateMap())); |
+ EXPECT_EQ(REMOTE_NOTIFICATION, fake_handler_.GetLastNotificationSource()); |
// Should be dropped. |
p2p_notifier_.SendNotificationDataForTest(P2PNotificationData()); |
ReflectSentNotifications(); |
- EXPECT_EQ(1, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(1, fake_handler_.GetNotificationCount()); |
const ObjectIdStateMap& expected_ids = |
ModelTypeStateMapToObjectIdStateMap(MakeStateMap(expected_types)); |
@@ -220,67 +220,67 @@ TEST_F(P2PNotifierTest, SendNotificationData) { |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender", NOTIFY_SELF, changed_types)); |
ReflectSentNotifications(); |
- EXPECT_EQ(2, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount()); |
EXPECT_THAT( |
expected_ids, |
- Eq(fake_observer_.GetLastNotificationIdStateMap())); |
+ Eq(fake_handler_.GetLastNotificationIdStateMap())); |
// Should be dropped. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender2", NOTIFY_SELF, changed_types)); |
ReflectSentNotifications(); |
- EXPECT_EQ(2, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount()); |
// Should be dropped. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender", NOTIFY_SELF, ModelTypeSet())); |
ReflectSentNotifications(); |
- EXPECT_EQ(2, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount()); |
// Should be dropped. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender", NOTIFY_OTHERS, changed_types)); |
ReflectSentNotifications(); |
- EXPECT_EQ(2, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(2, fake_handler_.GetNotificationCount()); |
// Should be propagated. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender2", NOTIFY_OTHERS, changed_types)); |
ReflectSentNotifications(); |
- EXPECT_EQ(3, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(3, fake_handler_.GetNotificationCount()); |
EXPECT_THAT( |
expected_ids, |
- Eq(fake_observer_.GetLastNotificationIdStateMap())); |
+ Eq(fake_handler_.GetLastNotificationIdStateMap())); |
// Should be dropped. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender2", NOTIFY_OTHERS, ModelTypeSet())); |
ReflectSentNotifications(); |
- EXPECT_EQ(3, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(3, fake_handler_.GetNotificationCount()); |
// Should be propagated. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender", NOTIFY_ALL, changed_types)); |
ReflectSentNotifications(); |
- EXPECT_EQ(4, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(4, fake_handler_.GetNotificationCount()); |
EXPECT_THAT( |
expected_ids, |
- Eq(fake_observer_.GetLastNotificationIdStateMap())); |
+ Eq(fake_handler_.GetLastNotificationIdStateMap())); |
// Should be propagated. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender2", NOTIFY_ALL, changed_types)); |
ReflectSentNotifications(); |
- EXPECT_EQ(5, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(5, fake_handler_.GetNotificationCount()); |
EXPECT_THAT( |
expected_ids, |
- Eq(fake_observer_.GetLastNotificationIdStateMap())); |
+ Eq(fake_handler_.GetLastNotificationIdStateMap())); |
// Should be dropped. |
p2p_notifier_.SendNotificationDataForTest( |
P2PNotificationData("sender2", NOTIFY_ALL, ModelTypeSet())); |
ReflectSentNotifications(); |
- EXPECT_EQ(5, fake_observer_.GetNotificationCount()); |
+ EXPECT_EQ(5, fake_handler_.GetNotificationCount()); |
} |
} // namespace |