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 "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 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 ->UpdateCredentials(secondary_account_id, "second_account_refresh_token"); | 678 ->UpdateCredentials(secondary_account_id, "second_account_refresh_token"); |
679 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) | 679 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) |
680 ->RevokeCredentials(secondary_account_id); | 680 ->RevokeCredentials(secondary_account_id); |
681 EXPECT_FALSE(service()->GetAccessTokenForTest().empty()); | 681 EXPECT_FALSE(service()->GetAccessTokenForTest().empty()); |
682 | 682 |
683 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) | 683 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) |
684 ->RevokeCredentials(primary_account_id); | 684 ->RevokeCredentials(primary_account_id); |
685 EXPECT_TRUE(service()->GetAccessTokenForTest().empty()); | 685 EXPECT_TRUE(service()->GetAccessTokenForTest().empty()); |
686 } | 686 } |
687 | 687 |
| 688 // CrOS does not support signout. |
| 689 #if !defined(OS_CHROMEOS) |
| 690 TEST_F(ProfileSyncServiceTest, SignOutRevokeAccessToken) { |
| 691 CreateService(browser_sync::AUTO_START); |
| 692 IssueTestTokens(); |
| 693 ExpectDataTypeManagerCreation(1, GetDefaultConfigureCalledCallback()); |
| 694 ExpectSyncBackendHostCreation(1); |
| 695 InitializeForNthSync(); |
| 696 EXPECT_TRUE(service()->IsSyncActive()); |
| 697 |
| 698 std::string primary_account_id = |
| 699 SigninManagerFactory::GetForProfile(profile()) |
| 700 ->GetAuthenticatedAccountId(); |
| 701 ProfileOAuth2TokenServiceFactory::GetForProfile(profile()) |
| 702 ->LoadCredentials(primary_account_id); |
| 703 base::RunLoop().RunUntilIdle(); |
| 704 EXPECT_FALSE(service()->GetAccessTokenForTest().empty()); |
| 705 |
| 706 SigninManagerFactory::GetForProfile(profile()) |
| 707 ->SignOut(signin_metrics::SIGNOUT_TEST); |
| 708 EXPECT_TRUE(service()->GetAccessTokenForTest().empty()); |
| 709 } |
| 710 #endif |
| 711 |
688 #if BUILDFLAG(ENABLE_PRE_SYNC_BACKUP) | 712 #if BUILDFLAG(ENABLE_PRE_SYNC_BACKUP) |
689 TEST_F(ProfileSyncServiceTest, DontStartBackupOnBrowserStart) { | 713 TEST_F(ProfileSyncServiceTest, DontStartBackupOnBrowserStart) { |
690 CreateServiceWithoutSignIn(); | 714 CreateServiceWithoutSignIn(); |
691 InitializeForFirstSync(); | 715 InitializeForFirstSync(); |
692 PumpLoop(); | 716 PumpLoop(); |
693 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode()); | 717 EXPECT_EQ(ProfileSyncService::IDLE, service()->backend_mode()); |
694 } | 718 } |
695 | 719 |
696 TEST_F(ProfileSyncServiceTest, BackupBeforeFirstSync) { | 720 TEST_F(ProfileSyncServiceTest, BackupBeforeFirstSync) { |
697 CreateServiceWithoutSignIn(); | 721 CreateServiceWithoutSignIn(); |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if | 1095 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if |
1072 // entry for sessions exists in map. | 1096 // entry for sessions exists in map. |
1073 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { | 1097 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { |
1074 CreateService(browser_sync::AUTO_START); | 1098 CreateService(browser_sync::AUTO_START); |
1075 service()->OnSessionRestoreComplete(); | 1099 service()->OnSessionRestoreComplete(); |
1076 service()->OnSyncCycleCompleted(); | 1100 service()->OnSyncCycleCompleted(); |
1077 } | 1101 } |
1078 | 1102 |
1079 } // namespace | 1103 } // namespace |
1080 } // namespace browser_sync | 1104 } // namespace browser_sync |
OLD | NEW |