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

Unified Diff: sync/notifier/p2p_notifier_unittest.cc

Issue 10824252: Revert 150990 - [Sync] Avoid unregistering object IDs on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | « sync/notifier/p2p_notifier.cc ('k') | sync/notifier/sync_notifier.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/p2p_notifier_unittest.cc
===================================================================
--- sync/notifier/p2p_notifier_unittest.cc (revision 150991)
+++ sync/notifier/p2p_notifier_unittest.cc (working copy)
@@ -28,11 +28,10 @@
scoped_ptr<notifier::PushClient>(fake_push_client_),
NOTIFY_OTHERS),
next_sent_notification_to_reflect_(0) {
- p2p_notifier_.RegisterHandler(&mock_observer_);
}
virtual ~P2PNotifierTest() {
- p2p_notifier_.UnregisterHandler(&mock_observer_);
+ p2p_notifier_.UpdateRegisteredIds(&mock_observer_, ObjectIdSet());
}
ModelTypePayloadMap MakePayloadMap(ModelTypeSet types) {
@@ -141,16 +140,16 @@
// observer should receive only a notification from the call to
// UpdateEnabledTypes().
TEST_F(P2PNotifierTest, NotificationsBasic) {
- const ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES);
+ ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES);
+ p2p_notifier_.UpdateRegisteredIds(&mock_observer_,
+ ModelTypeSetToObjectIdSet(enabled_types));
+
EXPECT_CALL(mock_observer_, OnNotificationsEnabled());
EXPECT_CALL(mock_observer_, OnIncomingNotification(
ModelTypePayloadMapToObjectIdPayloadMap(MakePayloadMap(enabled_types)),
REMOTE_NOTIFICATION));
- p2p_notifier_.UpdateRegisteredIds(&mock_observer_,
- ModelTypeSetToObjectIdSet(enabled_types));
-
p2p_notifier_.SetUniqueId("sender");
const char kEmail[] = "foo@bar.com";
@@ -184,10 +183,16 @@
// target settings. The notifications received by the observer should
// be consistent with the target settings.
TEST_F(P2PNotifierTest, SendNotificationData) {
- const ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES, THEMES);
- const ModelTypeSet changed_types(THEMES, APPS);
- const ModelTypeSet expected_types(THEMES);
+ ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES, THEMES);
+ ModelTypeSet changed_types(THEMES, APPS);
+ ModelTypeSet expected_types(THEMES);
+ p2p_notifier_.UpdateRegisteredIds(&mock_observer_,
+ ModelTypeSetToObjectIdSet(enabled_types));
+
+ const ModelTypePayloadMap& expected_payload_map =
+ MakePayloadMap(expected_types);
+
EXPECT_CALL(mock_observer_, OnNotificationsEnabled());
EXPECT_CALL(mock_observer_,
OnIncomingNotification(
@@ -195,12 +200,6 @@
MakePayloadMap(enabled_types)),
REMOTE_NOTIFICATION));
- p2p_notifier_.UpdateRegisteredIds(&mock_observer_,
- ModelTypeSetToObjectIdSet(enabled_types));
-
- const ModelTypePayloadMap& expected_payload_map =
- MakePayloadMap(expected_types);
-
p2p_notifier_.SetUniqueId("sender");
p2p_notifier_.UpdateCredentials("foo@bar.com", "fake_token");
« no previous file with comments | « sync/notifier/p2p_notifier.cc ('k') | sync/notifier/sync_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698