Chromium Code Reviews| Index: chrome/browser/sync/profile_sync_service.cc |
| diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc |
| index 366026f19d0ee7d468d93903afe21b9b920ee832..78d5c95ce237705dee6be03958a2e8ab029052e0 100644 |
| --- a/chrome/browser/sync/profile_sync_service.cc |
| +++ b/chrome/browser/sync/profile_sync_service.cc |
| @@ -472,6 +472,33 @@ syncer::InvalidatorState ProfileSyncService::GetInvalidatorState() const { |
| return invalidator_registrar_.GetInvalidatorState(); |
| } |
| +// test method for system test to allow a test to send in an invalidation |
|
Mihai Parparita -not on Chrome
2012/09/14 20:02:49
More comments that need to be capitalized and end
|
| +void ProfileSyncService::SendInvalidationForTest( |
| + const std::string& id_name, |
| + const std::string& payload) { |
| + // the list of ids to notify |
| + syncer::ObjectIdSet notify_ids; |
| + |
| + // find a registered id (if any) with the same name |
| + syncer::ObjectIdSet registered_ids = |
| + invalidator_registrar_.GetAllRegisteredIds(); |
| + syncer::ObjectIdSet::const_iterator it = registered_ids.begin(); |
| + for (; it != registered_ids.end(); ++it) { |
| + if (0 == id_name.compare(it->name())) { |
| + // if we find a registered id with the same name, insert a copy of it |
| + // into the list of ids we will notify |
| + notify_ids.insert(invalidation::ObjectId(it->source(), it->name())); |
| + } |
| + } |
| + |
| + // build an object state map, and use it to forward the call to |
| + // registered clients such as PushMessagingHandler::OnIncomingNotification |
| + // as if this came from the server |
| + const syncer::ObjectIdStateMap& id_state_map = |
| + ObjectIdSetToStateMap(notify_ids, payload); |
| + OnIncomingInvalidation(id_state_map, syncer::REMOTE_INVALIDATION); |
| +} |
| + |
| void ProfileSyncService::Shutdown() { |
| ShutdownImpl(false); |
| } |