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

Side by Side Diff: components/browser_sync/browser/profile_sync_service_unittest.cc

Issue 2159453002: [Sync] Don't start up sync when FirstSetupCompleted is false and no setup in progress (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Android fix attempt Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 IssueTestTokens(); 409 IssueTestTokens();
410 CreateService(ProfileSyncService::AUTO_START); 410 CreateService(ProfileSyncService::AUTO_START);
411 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback()); 411 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
412 ExpectSyncBackendHostCreation(1); 412 ExpectSyncBackendHostCreation(1);
413 InitializeForNthSync(); 413 InitializeForNthSync();
414 EXPECT_FALSE(service()->IsManaged()); 414 EXPECT_FALSE(service()->IsManaged());
415 EXPECT_TRUE(service()->IsSyncActive()); 415 EXPECT_TRUE(service()->IsSyncActive());
416 } 416 }
417 417
418 // Verify that an initialization where first setup is not complete does not 418 // Verify that an initialization where first setup is not complete does not
419 // purge preferences and/or the directory. 419 // start up the backend.
420 TEST_F(ProfileSyncServiceTest, NeedsConfirmation) { 420 TEST_F(ProfileSyncServiceTest, NeedsConfirmation) {
421 prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged, 421 prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged,
422 new base::FundamentalValue(false)); 422 new base::FundamentalValue(false));
423 IssueTestTokens(); 423 IssueTestTokens();
424 CreateService(ProfileSyncService::MANUAL_START); 424 CreateService(ProfileSyncService::MANUAL_START);
425 ExpectSyncBackendHostCreation(1);
426 sync_driver::SyncPrefs sync_prefs(prefs()); 425 sync_driver::SyncPrefs sync_prefs(prefs());
427 base::Time now = base::Time::Now(); 426 base::Time now = base::Time::Now();
428 sync_prefs.SetLastSyncedTime(now); 427 sync_prefs.SetLastSyncedTime(now);
429 sync_prefs.SetKeepEverythingSynced(true); 428 sync_prefs.SetKeepEverythingSynced(true);
430 service()->Initialize(); 429 service()->Initialize();
431 EXPECT_FALSE(service()->IsSyncActive()); 430 EXPECT_FALSE(service()->IsSyncActive());
432 431
433 // The last sync time shouldn't be cleared. 432 // The last sync time shouldn't be cleared.
434 // TODO(zea): figure out a way to check that the directory itself wasn't 433 // TODO(zea): figure out a way to check that the directory itself wasn't
435 // cleared. 434 // cleared.
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if 964 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if
966 // entry for sessions exists in map. 965 // entry for sessions exists in map.
967 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { 966 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) {
968 CreateService(ProfileSyncService::AUTO_START); 967 CreateService(ProfileSyncService::AUTO_START);
969 service()->OnSessionRestoreComplete(); 968 service()->OnSessionRestoreComplete();
970 service()->OnSyncCycleCompleted(); 969 service()->OnSyncCycleCompleted();
971 } 970 }
972 971
973 } // namespace 972 } // namespace
974 } // namespace browser_sync 973 } // namespace browser_sync
OLDNEW
« no previous file with comments | « components/browser_sync/browser/profile_sync_service_startup_unittest.cc ('k') | components/sync_driver/startup_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698