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) { |