| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 417 // Verify that an initialization where first setup is not complete does not |
| 418 // purge preferences and/or the directory. | 418 // start up the backend. |
| 419 TEST_F(ProfileSyncServiceTest, NeedsConfirmation) { | 419 TEST_F(ProfileSyncServiceTest, NeedsConfirmation) { |
| 420 prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged, | 420 prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged, |
| 421 new base::FundamentalValue(false)); | 421 new base::FundamentalValue(false)); |
| 422 IssueTestTokens(); | 422 IssueTestTokens(); |
| 423 CreateService(ProfileSyncService::MANUAL_START); | 423 CreateService(ProfileSyncService::MANUAL_START); |
| 424 ExpectSyncBackendHostCreation(1); | |
| 425 sync_driver::SyncPrefs sync_prefs(prefs()); | 424 sync_driver::SyncPrefs sync_prefs(prefs()); |
| 426 base::Time now = base::Time::Now(); | 425 base::Time now = base::Time::Now(); |
| 427 sync_prefs.SetLastSyncedTime(now); | 426 sync_prefs.SetLastSyncedTime(now); |
| 428 sync_prefs.SetKeepEverythingSynced(true); | 427 sync_prefs.SetKeepEverythingSynced(true); |
| 429 service()->Initialize(); | 428 service()->Initialize(); |
| 430 EXPECT_FALSE(service()->IsSyncActive()); | 429 EXPECT_FALSE(service()->IsSyncActive()); |
| 431 | 430 |
| 432 // The last sync time shouldn't be cleared. | 431 // The last sync time shouldn't be cleared. |
| 433 // TODO(zea): figure out a way to check that the directory itself wasn't | 432 // TODO(zea): figure out a way to check that the directory itself wasn't |
| 434 // cleared. | 433 // cleared. |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if | 929 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if |
| 931 // entry for sessions exists in map. | 930 // entry for sessions exists in map. |
| 932 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { | 931 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { |
| 933 CreateService(ProfileSyncService::AUTO_START); | 932 CreateService(ProfileSyncService::AUTO_START); |
| 934 service()->OnSessionRestoreComplete(); | 933 service()->OnSessionRestoreComplete(); |
| 935 service()->OnSyncCycleCompleted(); | 934 service()->OnSyncCycleCompleted(); |
| 936 } | 935 } |
| 937 | 936 |
| 938 } // namespace | 937 } // namespace |
| 939 } // namespace browser_sync | 938 } // namespace browser_sync |
| OLD | NEW |