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

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

Issue 772513004: Add new E2E sync multi profiles tests. This should not affect any existing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: implement OnSyncCycleCompleted send refresh notifications Created 6 years 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
Index: chrome/browser/sync/test/integration/sync_test.cc
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc
index 541c371847f9cdf301f58072d3dfe41e373401f8..f757b285a3c38f90f7655e2e9fafc3bd3c07f9ad 100644
--- a/chrome/browser/sync/test/integration/sync_test.cc
+++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/test/integration/fake_server_invalidation_service.h"
#include "chrome/browser/sync/test/integration/p2p_invalidation_forwarder.h"
+#include "chrome/browser/sync/test/integration/p2p_sync_refresher.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/single_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
@@ -388,6 +389,7 @@ bool SyncTest::SetupClients() {
browsers_.resize(num_clients_);
clients_.resize(num_clients_);
invalidation_forwarders_.resize(num_clients_);
+ sync_refreshers_.resize(num_clients_);
fake_server_invalidation_services_.resize(num_clients_);
for (int i = 0; i < num_clients_; ++i) {
InitializeInstance(i);
@@ -483,7 +485,8 @@ void SyncTest::InitializeInvalidations(int index) {
fake_server_invalidation_services_[index] = invalidation_service;
} else if (server_type_ == EXTERNAL_LIVE_SERVER) {
// DO NOTHING. External live sync servers use GCM to notify profiles of any
- // invalidations in sync'ed data.
+ // invalidations in sync'ed data. In this case, to notify other profiles of
+ // invalidations, we use sync refresh notifications instead.
} else {
invalidation::P2PInvalidationService* p2p_invalidation_service =
static_cast<invalidation::P2PInvalidationService*>(
@@ -527,6 +530,19 @@ bool SyncTest::SetupSync() {
AwaitQuiescence();
}
+ // SyncRefresher is used instead of invalidations to notify other profiles to
+ // do a sync refresh on committed data sets. This is only needed when running
+ // tests against external live server, otherwise invalidation service is used.
+ // With external live servers, the profiles commit data on first sync cycle
+ // automatically after signing in. To avoid misleading sync commit
+ // notifications at start up, we start the SyncRefresher observers post
+ // client set up.
+ if (server_type_ == EXTERNAL_LIVE_SERVER) {
+ for (int i = 0; i < num_clients_; ++i) {
+ sync_refreshers_[i] = new P2PSyncRefresher(clients_[i]->service());
+ }
+ }
+
return true;
}
@@ -554,6 +570,7 @@ void SyncTest::TearDownOnMainThread() {
// corruption in QuitBrowser().
CHECK_EQ(0U, chrome::GetTotalBrowserCount());
invalidation_forwarders_.clear();
+ sync_refreshers_.clear();
fake_server_invalidation_services_.clear();
clients_.clear();
}

Powered by Google App Engine
This is Rietveld 408576698