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

Unified Diff: components/browser_sync/browser/profile_sync_service_unittest.cc

Issue 2113453006: [Sync] Stop purging sync data on restart for users who haven't finished setup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « components/browser_sync/browser/profile_sync_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_sync/browser/profile_sync_service_unittest.cc
diff --git a/components/browser_sync/browser/profile_sync_service_unittest.cc b/components/browser_sync/browser/profile_sync_service_unittest.cc
index 92ceb54e375685eddea5b468430c1e680f676785..5ac0adfcdd4bae556e05914baa7c9fcd5ed72afd 100644
--- a/components/browser_sync/browser/profile_sync_service_unittest.cc
+++ b/components/browser_sync/browser/profile_sync_service_unittest.cc
@@ -415,6 +415,27 @@ TEST_F(ProfileSyncServiceTest, SuccessfulInitialization) {
EXPECT_TRUE(service()->IsSyncActive());
}
+// Verify that an initialization where first setup is not complete does not
+// purge preferences and/or the directory.
+TEST_F(ProfileSyncServiceTest, NeedsConfirmation) {
+ prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged,
+ new base::FundamentalValue(false));
+ IssueTestTokens();
+ CreateService(ProfileSyncService::MANUAL_START);
+ ExpectSyncBackendHostCreation(1);
+ sync_driver::SyncPrefs sync_prefs(prefs());
+ base::Time now = base::Time::Now();
+ sync_prefs.SetLastSyncedTime(now);
+ sync_prefs.SetKeepEverythingSynced(true);
+ service()->Initialize();
+ EXPECT_FALSE(service()->IsSyncActive());
+
+ // The last sync time shouldn't be cleared.
+ // TODO(zea): figure out a way to check that the directory itself wasn't
+ // cleared.
+ EXPECT_EQ(now, sync_prefs.GetLastSyncedTime());
+}
+
// Verify that the SetSetupInProgress function call updates state
// and notifies observers.
TEST_F(ProfileSyncServiceTest, SetupInProgress) {
« no previous file with comments | « components/browser_sync/browser/profile_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698