| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/browser_sync/browser/profile_sync_service.h" | 5 #include "components/browser_sync/browser/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 new base::FundamentalValue(false)); | 407 new base::FundamentalValue(false)); |
| 408 IssueTestTokens(); | 408 IssueTestTokens(); |
| 409 CreateService(ProfileSyncService::AUTO_START); | 409 CreateService(ProfileSyncService::AUTO_START); |
| 410 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback()); | 410 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback()); |
| 411 ExpectSyncBackendHostCreation(1); | 411 ExpectSyncBackendHostCreation(1); |
| 412 InitializeForNthSync(); | 412 InitializeForNthSync(); |
| 413 EXPECT_FALSE(service()->IsManaged()); | 413 EXPECT_FALSE(service()->IsManaged()); |
| 414 EXPECT_TRUE(service()->IsSyncActive()); | 414 EXPECT_TRUE(service()->IsSyncActive()); |
| 415 } | 415 } |
| 416 | 416 |
| 417 // Verify that an initialization where first setup is not complete does not |
| 418 // purge preferences and/or the directory. |
| 419 TEST_F(ProfileSyncServiceTest, NeedsConfirmation) { |
| 420 prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged, |
| 421 new base::FundamentalValue(false)); |
| 422 IssueTestTokens(); |
| 423 CreateService(ProfileSyncService::MANUAL_START); |
| 424 ExpectSyncBackendHostCreation(1); |
| 425 sync_driver::SyncPrefs sync_prefs(prefs()); |
| 426 base::Time now = base::Time::Now(); |
| 427 sync_prefs.SetLastSyncedTime(now); |
| 428 sync_prefs.SetKeepEverythingSynced(true); |
| 429 service()->Initialize(); |
| 430 EXPECT_FALSE(service()->IsSyncActive()); |
| 431 |
| 432 // The last sync time shouldn't be cleared. |
| 433 // TODO(zea): figure out a way to check that the directory itself wasn't |
| 434 // cleared. |
| 435 EXPECT_EQ(now, sync_prefs.GetLastSyncedTime()); |
| 436 } |
| 437 |
| 417 // Verify that the SetSetupInProgress function call updates state | 438 // Verify that the SetSetupInProgress function call updates state |
| 418 // and notifies observers. | 439 // and notifies observers. |
| 419 TEST_F(ProfileSyncServiceTest, SetupInProgress) { | 440 TEST_F(ProfileSyncServiceTest, SetupInProgress) { |
| 420 CreateService(ProfileSyncService::AUTO_START); | 441 CreateService(ProfileSyncService::AUTO_START); |
| 421 InitializeForFirstSync(); | 442 InitializeForFirstSync(); |
| 422 | 443 |
| 423 TestSyncServiceObserver observer(service()); | 444 TestSyncServiceObserver observer(service()); |
| 424 service()->AddObserver(&observer); | 445 service()->AddObserver(&observer); |
| 425 | 446 |
| 426 service()->SetSetupInProgress(true); | 447 service()->SetSetupInProgress(true); |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if | 930 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if |
| 910 // entry for sessions exists in map. | 931 // entry for sessions exists in map. |
| 911 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { | 932 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { |
| 912 CreateService(ProfileSyncService::AUTO_START); | 933 CreateService(ProfileSyncService::AUTO_START); |
| 913 service()->OnSessionRestoreComplete(); | 934 service()->OnSessionRestoreComplete(); |
| 914 service()->OnSyncCycleCompleted(); | 935 service()->OnSyncCycleCompleted(); |
| 915 } | 936 } |
| 916 | 937 |
| 917 } // namespace | 938 } // namespace |
| 918 } // namespace browser_sync | 939 } // namespace browser_sync |
| OLD | NEW |