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

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

Issue 2172373002: [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@2743
Patch Set: 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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