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

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

Issue 1490713002: Revert of 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"
47 #include "components/sync_driver/sync_driver_switches.h" 46 #include "components/sync_driver/sync_driver_switches.h"
48 #include "components/sync_driver/sync_prefs.h" 47 #include "components/sync_driver/sync_prefs.h"
49 #include "components/sync_driver/sync_service_observer.h" 48 #include "components/sync_driver/sync_service_observer.h"
50 #include "components/sync_driver/sync_util.h" 49 #include "components/sync_driver/sync_util.h"
51 #include "components/syncable_prefs/testing_pref_service_syncable.h" 50 #include "components/syncable_prefs/testing_pref_service_syncable.h"
52 #include "components/version_info/version_info_values.h" 51 #include "components/version_info/version_info_values.h"
53 #include "content/public/test/test_browser_thread_bundle.h" 52 #include "content/public/test/test_browser_thread_bundle.h"
54 #include "google_apis/gaia/gaia_constants.h" 53 #include "google_apis/gaia/gaia_constants.h"
55 #include "testing/gmock/include/gmock/gmock.h" 54 #include "testing/gmock/include/gmock/gmock.h"
56 #include "testing/gtest/include/gtest/gtest.h" 55 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 ->UpdateCredentials(secondary_account_id, "second_account_refresh_token"); 677 ->UpdateCredentials(secondary_account_id, "second_account_refresh_token");
679 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) 678 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())
680 ->RevokeCredentials(secondary_account_id); 679 ->RevokeCredentials(secondary_account_id);
681 EXPECT_FALSE(service()->GetAccessTokenForTest().empty()); 680 EXPECT_FALSE(service()->GetAccessTokenForTest().empty());
682 681
683 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) 682 ProfileOAuth2TokenServiceFactory::GetForProfile(profile())
684 ->RevokeCredentials(primary_account_id); 683 ->RevokeCredentials(primary_account_id);
685 EXPECT_TRUE(service()->GetAccessTokenForTest().empty()); 684 EXPECT_TRUE(service()->GetAccessTokenForTest().empty());
686 } 685 }
687 686
688 #if BUILDFLAG(ENABLE_PRE_SYNC_BACKUP) 687 #if defined(ENABLE_PRE_SYNC_BACKUP)
689 TEST_F(ProfileSyncServiceTest, DontStartBackupOnBrowserStart) { 688 TEST_F(ProfileSyncServiceTest, DontStartBackupOnBrowserStart) {
690 CreateServiceWithoutSignIn(); 689 CreateServiceWithoutSignIn();
691 InitializeForFirstSync(); 690 InitializeForFirstSync();
692 PumpLoop(); 691 PumpLoop();
693 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode()); 692 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode());
694 } 693 }
695 694
696 TEST_F(ProfileSyncServiceTest, BackupBeforeFirstSync) { 695 TEST_F(ProfileSyncServiceTest, BackupBeforeFirstSync) {
697 CreateServiceWithoutSignIn(); 696 CreateServiceWithoutSignIn();
698 ExpectDataTypeManagerCreation(2, GetDefaultConfigureCalledCallback()); 697 ExpectDataTypeManagerCreation(2, GetDefaultConfigureCalledCallback());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode()); 776 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode());
778 777
779 // First sync time is erased after rollback is done. 778 // First sync time is erased after rollback is done.
780 EXPECT_TRUE(sync_prefs.GetFirstSyncTime().is_null()); 779 EXPECT_TRUE(sync_prefs.GetFirstSyncTime().is_null());
781 780
782 EXPECT_EQ(2u, delete_dir_param.size()); 781 EXPECT_EQ(2u, delete_dir_param.size());
783 EXPECT_FALSE(delete_dir_param[0]); 782 EXPECT_FALSE(delete_dir_param[0]);
784 EXPECT_FALSE(delete_dir_param[1]); 783 EXPECT_FALSE(delete_dir_param[1]);
785 } 784 }
786 785
787 #endif // ENABLE_PRE_SYNC_BACKUP 786 #endif
788 787
789 // Verify that LastSyncedTime is cleared when the user signs out. 788 // Verify that LastSyncedTime is cleared when the user signs out.
790 TEST_F(ProfileSyncServiceTest, ClearLastSyncedTimeOnSignOut) { 789 TEST_F(ProfileSyncServiceTest, ClearLastSyncedTimeOnSignOut) {
791 IssueTestTokens(); 790 IssueTestTokens();
792 CreateService(AUTO_START); 791 CreateService(AUTO_START);
793 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback()); 792 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback());
794 ExpectSyncBackendHostCreation(1); 793 ExpectSyncBackendHostCreation(1);
795 InitializeForNthSync(); 794 InitializeForNthSync();
796 EXPECT_TRUE(service()->IsSyncActive()); 795 EXPECT_TRUE(service()->IsSyncActive());
797 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW), 796 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW),
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if 1070 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if
1072 // entry for sessions exists in map. 1071 // entry for sessions exists in map.
1073 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { 1072 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) {
1074 CreateService(browser_sync::AUTO_START); 1073 CreateService(browser_sync::AUTO_START);
1075 service()->OnSessionRestoreComplete(); 1074 service()->OnSessionRestoreComplete();
1076 service()->OnSyncCycleCompleted(); 1075 service()->OnSyncCycleCompleted();
1077 } 1076 }
1078 1077
1079 } // namespace 1078 } // namespace
1080 } // namespace browser_sync 1079 } // 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