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

Unified Diff: components/browser_sync/profile_sync_service_unittest.cc

Issue 2494873003: [Sync] Allow sync start without sign-in if the local sync backend is on. (Closed)
Patch Set: Rebased on ToT. Created 4 years, 1 month 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: components/browser_sync/profile_sync_service_unittest.cc
diff --git a/components/browser_sync/profile_sync_service_unittest.cc b/components/browser_sync/profile_sync_service_unittest.cc
index 6832d2cc173abf0c8f35fa5019eefb95f128ded5..90cb0f0386b24083d625afd18dbe2f95415681c0 100644
--- a/components/browser_sync/profile_sync_service_unittest.cc
+++ b/components/browser_sync/profile_sync_service_unittest.cc
@@ -248,14 +248,24 @@ class ProfileSyncServiceTest : public ::testing::Test {
base::MakeUnique<syncer::FakeDataTypeController>(syncer::BOOKMARKS));
}
-#if defined(OS_WIN) || defined(OS_MACOSX) || \
- (defined(OS_LINUX) && !defined(OS_CHROMEOS))
void CreateServiceWithoutSignIn() {
- CreateService(ProfileSyncService::AUTO_START);
- signin_manager()->SignOut(signin_metrics::SIGNOUT_TEST,
- signin_metrics::SignoutDelete::IGNORE_METRIC);
+ component_factory_ = profile_sync_service_bundle_.component_factory();
+ ProfileSyncServiceBundle::SyncClientBuilder builder(
+ &profile_sync_service_bundle_);
+ ProfileSyncService::InitParams init_params =
+ profile_sync_service_bundle_.CreateBasicInitParams(
+ ProfileSyncService::AUTO_START, builder.Build());
+
+ init_params.local_sync_backend_enabled = true;
+ init_params.local_sync_backend_folder =
+ base::FilePath(FILE_PATH_LITERAL("dummyPath"));
+ init_params.oauth2_token_service = nullptr;
+ init_params.gaia_cookie_manager_service = nullptr;
+
+ service_ = base::MakeUnique<ProfileSyncService>(std::move(init_params));
+ service_->RegisterDataTypeController(
+ base::MakeUnique<syncer::FakeDataTypeController>(syncer::BOOKMARKS));
}
-#endif
void ShutdownAndDeleteService() {
if (service_)
@@ -409,6 +419,19 @@ TEST_F(ProfileSyncServiceTest, SuccessfulInitialization) {
EXPECT_TRUE(service()->IsSyncActive());
}
+// Verify a successful initialization.
+TEST_F(ProfileSyncServiceTest, SuccessfulLocalBackendInitialization) {
+ prefs()->SetManagedPref(syncer::prefs::kSyncManaged,
+ new base::FundamentalValue(false));
+ IssueTestTokens();
+ CreateServiceWithoutSignIn();
+ ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
+ ExpectSyncBackendHostCreation(1);
+ InitializeForNthSync();
+ EXPECT_FALSE(service()->IsManaged());
+ EXPECT_TRUE(service()->IsSyncActive());
+}
+
// Verify that an initialization where first setup is not complete does not
// start up the backend.
TEST_F(ProfileSyncServiceTest, NeedsConfirmation) {

Powered by Google App Engine
This is Rietveld 408576698