Index: sync/notifier/invalidation_notifier_unittest.cc |
diff --git a/sync/notifier/invalidation_notifier_unittest.cc b/sync/notifier/invalidation_notifier_unittest.cc |
index b0b64c744a85c282d783a1531a0828c95d97f6b1..be1a662278d37a1bf0244697bb7d1f910664fd17 100644 |
--- a/sync/notifier/invalidation_notifier_unittest.cc |
+++ b/sync/notifier/invalidation_notifier_unittest.cc |
@@ -50,11 +50,10 @@ class InvalidationNotifierTest : public testing::Test { |
initial_invalidation_state, |
MakeWeakHandle(mock_tracker_.AsWeakPtr()), |
"fake_client_info")); |
- invalidation_notifier_->AddObserver(&mock_observer_); |
} |
void ResetNotifier() { |
- invalidation_notifier_->RemoveObserver(&mock_observer_); |
+ invalidation_notifier_->UpdateRegisteredIds(&mock_observer_, ObjectIdSet()); |
// Stopping the invalidation notifier stops its scheduler, which deletes any |
// pending tasks without running them. Some tasks "run and delete" another |
// task, so they must be run in order to avoid leaking the inner task. |
@@ -75,15 +74,18 @@ TEST_F(InvalidationNotifierTest, Basic) { |
CreateAndObserveNotifier("fake_state"); |
InSequence dummy; |
- ModelTypePayloadMap type_payloads; |
- type_payloads[PREFERENCES] = "payload"; |
- type_payloads[BOOKMARKS] = "payload"; |
- type_payloads[AUTOFILL] = "payload"; |
+ ModelTypeSet models(PREFERENCES, |
akalin
2012/07/21 01:09:47
fit on one line?
dcheng
2012/07/21 14:06:53
Done.
|
+ BOOKMARKS, |
+ AUTOFILL); |
+ invalidation_notifier_->UpdateRegisteredIds( |
+ &mock_observer_, ModelTypeSetToObjectIdSet(models)); |
+ ModelTypePayloadMap type_payloads = |
akalin
2012/07/21 01:09:47
const ref
dcheng
2012/07/21 14:06:53
Done.
|
+ ModelTypePayloadMapFromEnumSet(models, "payload"); |
EXPECT_CALL(mock_observer_, OnNotificationsEnabled()); |
- EXPECT_CALL(mock_observer_, |
- OnIncomingNotification(type_payloads, |
- REMOTE_NOTIFICATION)); |
+ EXPECT_CALL(mock_observer_, OnIncomingNotification( |
+ ModelTypePayloadMapToObjectIdPayloadMap(type_payloads), |
+ REMOTE_NOTIFICATION)); |
EXPECT_CALL(mock_observer_, |
OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR)); |
EXPECT_CALL(mock_observer_, |
@@ -99,14 +101,8 @@ TEST_F(InvalidationNotifierTest, Basic) { |
invalidation_notifier_->OnNotificationsEnabled(); |
- ObjectIdPayloadMap id_payloads; |
- for (ModelTypePayloadMap::const_iterator it = type_payloads.begin(); |
- it != type_payloads.end(); ++it) { |
- invalidation::ObjectId id; |
- ASSERT_TRUE(RealModelTypeToObjectId(it->first, &id)); |
- id_payloads[id] = "payload"; |
- } |
- invalidation_notifier_->OnInvalidate(id_payloads); |
+ invalidation_notifier_->OnInvalidate( |
+ ModelTypePayloadMapToObjectIdPayloadMap(type_payloads)); |
invalidation_notifier_->OnNotificationsDisabled( |
TRANSIENT_NOTIFICATION_ERROR); |