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

Unified Diff: chrome/browser/sync/profile_sync_service_factory.cc

Issue 2328393002: [Sync] Add a sanity integration test for USS. (Closed)
Patch Set: Ensure static changes don't persist between tests. Created 4 years, 3 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
Index: chrome/browser/sync/profile_sync_service_factory.cc
diff --git a/chrome/browser/sync/profile_sync_service_factory.cc b/chrome/browser/sync/profile_sync_service_factory.cc
index b485f60fde017820800299082f705cb56e57b9b5..783f9679d6695382081436d0487365dbb979fb9d 100644
--- a/chrome/browser/sync/profile_sync_service_factory.cc
+++ b/chrome/browser/sync/profile_sync_service_factory.cc
@@ -170,8 +170,12 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor(
? ProfileSyncService::AUTO_START
: ProfileSyncService::MANUAL_START;
- init_params.sync_client =
- base::WrapUnique(new browser_sync::ChromeSyncClient(profile));
+ if (!client_factory_) {
skym 2016/09/12 19:57:49 Might consider also having a default factory as a
maxbogue 2016/09/13 03:44:54 That's harder to unset, and I don't believe I'm su
+ init_params.sync_client =
+ base::MakeUnique<browser_sync::ChromeSyncClient>(profile);
+ } else {
+ init_params.sync_client = client_factory_->Run(profile);
+ }
init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime);
init_params.base_directory = profile->GetPath();
@@ -196,3 +200,13 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor(
bool ProfileSyncServiceFactory::HasProfileSyncService(Profile* profile) {
return GetInstance()->GetServiceForBrowserContext(profile, false) != NULL;
}
+
+// static
+void ProfileSyncServiceFactory::SetSyncClientFactoryForTest(
+ SyncClientFactory* client_factory) {
+ client_factory_ = client_factory;
+}
+
+// static
+ProfileSyncServiceFactory::SyncClientFactory*
+ ProfileSyncServiceFactory::client_factory_ = nullptr;
skym 2016/09/12 19:57:49 Again, I'd set this in the .h personally.
maxbogue 2016/09/13 03:44:54 Can't, sadly. It's a compile error: error: non-co

Powered by Google App Engine
This is Rietveld 408576698