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

Unified Diff: chrome/browser/sync/test/integration/profile_sync_service_harness.cc

Issue 167913002: sync: Add helper class for P2P invalidations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « chrome/browser/sync/test/integration/profile_sync_service_harness.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/test/integration/profile_sync_service_harness.cc
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
index c311344c52b3fc291a93eccbfe40e5482250ab4b..53a305d80295c5a82e672993a02dc0f64add11c2 100644
--- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/sync/about_sync_util.h"
#include "chrome/browser/sync/backend_migrator.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/sync/test/integration/p2p_invalidation_forwarder.h"
#include "chrome/browser/sync/test/integration/status_change_checker.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -205,6 +206,9 @@ bool ProfileSyncServiceHarness::SetupSync(
// Subscribe sync client to notifications from the profile sync service.
if (!service()->HasObserver(this))
service()->AddObserver(this);
+ // Start listening for and emitting notifications of commits.
+ p2p_invalidation_forwarder_.reset(
+ new P2PInvalidationForwarder(service(), p2p_invalidation_service_));
haitaol1 2014/02/19 21:15:21 You don't need p2p_invalidation_service_ if creati
rlarocque 2014/02/19 22:21:14 Good point. I hadn't thought of that. Fixed.
// Tell the sync service that setup is in progress so we don't start syncing
// until we've finished configuration.
@@ -312,15 +316,6 @@ void ProfileSyncServiceHarness::OnStateChanged() {
void ProfileSyncServiceHarness::OnSyncCycleCompleted() {
// Integration tests still use p2p notifications.
haitaol1 2014/02/19 21:15:21 obsolete comment?
rlarocque 2014/02/19 22:21:14 Correct. Removed.
- const SyncSessionSnapshot& snap = GetLastSessionSnapshot();
- bool is_notifiable_commit =
- (snap.model_neutral_state().num_successful_commits > 0);
- if (is_notifiable_commit && p2p_invalidation_service_) {
- syncer::ModelTypeSet model_types =
- snap.model_neutral_state().commit_request_types;
- syncer::ObjectIdSet ids = ModelTypeSetToObjectIdSet(model_types);
- p2p_invalidation_service_->SendInvalidation(ids);
- }
OnStateChanged();
}
« no previous file with comments | « chrome/browser/sync/test/integration/profile_sync_service_harness.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698