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

Side by Side Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 1478623004: Convert enable_pre_sync_backup flag to new flags system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 25 matching lines...) Expand all
36 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" 36 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h"
37 #include "components/signin/core/browser/signin_manager.h" 37 #include "components/signin/core/browser/signin_manager.h"
38 #include "components/strings/grit/components_strings.h" 38 #include "components/strings/grit/components_strings.h"
39 #include "components/sync_driver/data_type_manager.h" 39 #include "components/sync_driver/data_type_manager.h"
40 #include "components/sync_driver/data_type_manager_observer.h" 40 #include "components/sync_driver/data_type_manager_observer.h"
41 #include "components/sync_driver/fake_data_type_controller.h" 41 #include "components/sync_driver/fake_data_type_controller.h"
42 #include "components/sync_driver/glue/sync_backend_host_mock.h" 42 #include "components/sync_driver/glue/sync_backend_host_mock.h"
43 #include "components/sync_driver/pref_names.h" 43 #include "components/sync_driver/pref_names.h"
44 #include "components/sync_driver/signin_manager_wrapper.h" 44 #include "components/sync_driver/signin_manager_wrapper.h"
45 #include "components/sync_driver/sync_api_component_factory_mock.h" 45 #include "components/sync_driver/sync_api_component_factory_mock.h"
46 #include "components/sync_driver/sync_driver_features.h"
46 #include "components/sync_driver/sync_driver_switches.h" 47 #include "components/sync_driver/sync_driver_switches.h"
47 #include "components/sync_driver/sync_prefs.h" 48 #include "components/sync_driver/sync_prefs.h"
48 #include "components/sync_driver/sync_service_observer.h" 49 #include "components/sync_driver/sync_service_observer.h"
49 #include "components/sync_driver/sync_util.h" 50 #include "components/sync_driver/sync_util.h"
50 #include "components/syncable_prefs/testing_pref_service_syncable.h" 51 #include "components/syncable_prefs/testing_pref_service_syncable.h"
51 #include "components/version_info/version_info_values.h" 52 #include "components/version_info/version_info_values.h"
52 #include "content/public/test/test_browser_thread_bundle.h" 53 #include "content/public/test/test_browser_thread_bundle.h"
53 #include "google_apis/gaia/gaia_constants.h" 54 #include "google_apis/gaia/gaia_constants.h"
54 #include "testing/gmock/include/gmock/gmock.h" 55 #include "testing/gmock/include/gmock/gmock.h"
55 #include "testing/gtest/include/gtest/gtest.h" 56 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 ->UpdateCredentials(secondary_account_id, "second_account_refresh_token"); 678 ->UpdateCredentials(secondary_account_id, "second_account_refresh_token");
678 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) 679 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())
679 ->RevokeCredentials(secondary_account_id); 680 ->RevokeCredentials(secondary_account_id);
680 EXPECT_FALSE(service()->GetAccessTokenForTest().empty()); 681 EXPECT_FALSE(service()->GetAccessTokenForTest().empty());
681 682
682 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) 683 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())
683 ->RevokeCredentials(primary_account_id); 684 ->RevokeCredentials(primary_account_id);
684 EXPECT_TRUE(service()->GetAccessTokenForTest().empty()); 685 EXPECT_TRUE(service()->GetAccessTokenForTest().empty());
685 } 686 }
686 687
687 #if defined(ENABLE_PRE_SYNC_BACKUP) 688 #if BUILDFLAG(ENABLE_PRE_SYNC_BACKUP)
688 TEST_F(ProfileSyncServiceTest, DontStartBackupOnBrowserStart) { 689 TEST_F(ProfileSyncServiceTest, DontStartBackupOnBrowserStart) {
689 CreateServiceWithoutSignIn(); 690 CreateServiceWithoutSignIn();
690 InitializeForFirstSync(); 691 InitializeForFirstSync();
691 PumpLoop(); 692 PumpLoop();
692 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode()); 693 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode());
693 } 694 }
694 695
695 TEST_F(ProfileSyncServiceTest, BackupBeforeFirstSync) { 696 TEST_F(ProfileSyncServiceTest, BackupBeforeFirstSync) {
696 CreateServiceWithoutSignIn(); 697 CreateServiceWithoutSignIn();
697 ExpectDataTypeManagerCreation(2, GetDefaultConfigureCalledCallback()); 698 ExpectDataTypeManagerCreation(2, GetDefaultConfigureCalledCallback());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode()); 777 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode());
777 778
778 // First sync time is erased after rollback is done. 779 // First sync time is erased after rollback is done.
779 EXPECT_TRUE(sync_prefs.GetFirstSyncTime().is_null()); 780 EXPECT_TRUE(sync_prefs.GetFirstSyncTime().is_null());
780 781
781 EXPECT_EQ(2u, delete_dir_param.size()); 782 EXPECT_EQ(2u, delete_dir_param.size());
782 EXPECT_FALSE(delete_dir_param[0]); 783 EXPECT_FALSE(delete_dir_param[0]);
783 EXPECT_FALSE(delete_dir_param[1]); 784 EXPECT_FALSE(delete_dir_param[1]);
784 } 785 }
785 786
786 #endif 787 #endif // ENABLE_PRE_SYNC_BACKUP
787 788
788 // Verify that LastSyncedTime is cleared when the user signs out. 789 // Verify that LastSyncedTime is cleared when the user signs out.
789 TEST_F(ProfileSyncServiceTest, ClearLastSyncedTimeOnSignOut) { 790 TEST_F(ProfileSyncServiceTest, ClearLastSyncedTimeOnSignOut) {
790 IssueTestTokens(); 791 IssueTestTokens();
791 CreateService(AUTO_START); 792 CreateService(AUTO_START);
792 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback()); 793 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
793 ExpectSyncBackendHostCreation(1); 794 ExpectSyncBackendHostCreation(1);
794 InitializeForNthSync(); 795 InitializeForNthSync();
795 EXPECT_TRUE(service()->IsSyncActive()); 796 EXPECT_TRUE(service()->IsSyncActive());
796 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW), 797 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW),
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if 1071 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if
1071 // entry for sessions exists in map. 1072 // entry for sessions exists in map.
1072 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { 1073 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) {
1073 CreateService(browser_sync::AUTO_START); 1074 CreateService(browser_sync::AUTO_START);
1074 service()->OnSessionRestoreComplete(); 1075 service()->OnSessionRestoreComplete();
1075 service()->OnSyncCycleCompleted(); 1076 service()->OnSyncCycleCompleted();
1076 } 1077 }
1077 1078
1078 } // namespace 1079 } // namespace
1079 } // namespace browser_sync 1080 } // namespace browser_sync
OLDNEW
« no previous file with comments | « build/config/features.gni ('k') | chrome/browser/sync/test/integration/single_client_backup_rollback_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698