OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/webui/settings/people_handler.h" | 5 #include "chrome/browser/ui/webui/settings/people_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 mock_signin_ = static_cast<SigninManagerBase*>( | 198 mock_signin_ = static_cast<SigninManagerBase*>( |
199 SigninManagerFactory::GetForProfile(profile_)); | 199 SigninManagerFactory::GetForProfile(profile_)); |
200 std::string username = GetTestUser(); | 200 std::string username = GetTestUser(); |
201 if (!username.empty()) | 201 if (!username.empty()) |
202 mock_signin_->SetAuthenticatedAccountInfo(username, username); | 202 mock_signin_->SetAuthenticatedAccountInfo(username, username); |
203 | 203 |
204 mock_pss_ = static_cast<ProfileSyncServiceMock*>( | 204 mock_pss_ = static_cast<ProfileSyncServiceMock*>( |
205 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 205 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
206 profile_, BuildMockProfileSyncService)); | 206 profile_, BuildMockProfileSyncService)); |
207 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); | 207 EXPECT_CALL(*mock_pss_, GetAuthError()).WillRepeatedly(ReturnRef(error_)); |
208 ON_CALL(*mock_pss_, GetPassphraseType()).WillByDefault( | 208 ON_CALL(*mock_pss_, GetPassphraseType()) |
209 Return(syncer::IMPLICIT_PASSPHRASE)); | 209 .WillByDefault(Return(syncer::PassphraseType::IMPLICIT_PASSPHRASE)); |
210 ON_CALL(*mock_pss_, GetExplicitPassphraseTime()).WillByDefault( | 210 ON_CALL(*mock_pss_, GetExplicitPassphraseTime()).WillByDefault( |
211 Return(base::Time())); | 211 Return(base::Time())); |
212 ON_CALL(*mock_pss_, GetRegisteredDataTypes()) | 212 ON_CALL(*mock_pss_, GetRegisteredDataTypes()) |
213 .WillByDefault(Return(syncer::ModelTypeSet())); | 213 .WillByDefault(Return(syncer::ModelTypeSet())); |
214 | 214 |
215 mock_pss_->Initialize(); | 215 mock_pss_->Initialize(); |
216 | 216 |
217 handler_.reset(new TestingPeopleHandler(&web_ui_, profile_)); | 217 handler_.reset(new TestingPeopleHandler(&web_ui_, profile_)); |
218 handler_->AllowJavascript(); | 218 handler_->AllowJavascript(); |
219 } | 219 } |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 Mock::VerifyAndClearExpectations(mock_pss_); | 824 Mock::VerifyAndClearExpectations(mock_pss_); |
825 // Clean up so we can loop back to display the dialog again. | 825 // Clean up so we can loop back to display the dialog again. |
826 web_ui_.ClearTrackedCalls(); | 826 web_ui_.ClearTrackedCalls(); |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
830 TEST_F(PeopleHandlerTest, ShowSetupOldGaiaPassphraseRequired) { | 830 TEST_F(PeopleHandlerTest, ShowSetupOldGaiaPassphraseRequired) { |
831 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) | 831 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
832 .WillRepeatedly(Return(true)); | 832 .WillRepeatedly(Return(true)); |
833 EXPECT_CALL(*mock_pss_, GetPassphraseType()) | 833 EXPECT_CALL(*mock_pss_, GetPassphraseType()) |
834 .WillRepeatedly(Return(syncer::FROZEN_IMPLICIT_PASSPHRASE)); | 834 .WillRepeatedly( |
| 835 Return(syncer::PassphraseType::FROZEN_IMPLICIT_PASSPHRASE)); |
835 SetupInitializedProfileSyncService(); | 836 SetupInitializedProfileSyncService(); |
836 SetDefaultExpectationsForConfigPage(); | 837 SetDefaultExpectationsForConfigPage(); |
837 | 838 |
838 // This should display the sync setup dialog (not login). | 839 // This should display the sync setup dialog (not login). |
839 handler_->OpenSyncSetup(false /* creating_supervised_user */); | 840 handler_->OpenSyncSetup(false /* creating_supervised_user */); |
840 | 841 |
841 const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged(); | 842 const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged(); |
842 CheckBool(dictionary, "passphraseRequired", true); | 843 CheckBool(dictionary, "passphraseRequired", true); |
843 CheckBool(dictionary, "passphraseTypeIsCustom", false); | 844 CheckBool(dictionary, "passphraseTypeIsCustom", false); |
844 } | 845 } |
845 | 846 |
846 TEST_F(PeopleHandlerTest, ShowSetupCustomPassphraseRequired) { | 847 TEST_F(PeopleHandlerTest, ShowSetupCustomPassphraseRequired) { |
847 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) | 848 EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
848 .WillRepeatedly(Return(true)); | 849 .WillRepeatedly(Return(true)); |
849 EXPECT_CALL(*mock_pss_, GetPassphraseType()) | 850 EXPECT_CALL(*mock_pss_, GetPassphraseType()) |
850 .WillRepeatedly(Return(syncer::CUSTOM_PASSPHRASE)); | 851 .WillRepeatedly(Return(syncer::PassphraseType::CUSTOM_PASSPHRASE)); |
851 SetupInitializedProfileSyncService(); | 852 SetupInitializedProfileSyncService(); |
852 SetDefaultExpectationsForConfigPage(); | 853 SetDefaultExpectationsForConfigPage(); |
853 | 854 |
854 // This should display the sync setup dialog (not login). | 855 // This should display the sync setup dialog (not login). |
855 handler_->OpenSyncSetup(false /* creating_supervised_user */); | 856 handler_->OpenSyncSetup(false /* creating_supervised_user */); |
856 | 857 |
857 const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged(); | 858 const base::DictionaryValue* dictionary = ExpectSyncPrefsChanged(); |
858 CheckBool(dictionary, "passphraseRequired", true); | 859 CheckBool(dictionary, "passphraseRequired", true); |
859 CheckBool(dictionary, "passphraseTypeIsCustom", true); | 860 CheckBool(dictionary, "passphraseTypeIsCustom", true); |
860 } | 861 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 SetupInitializedProfileSyncService(); | 908 SetupInitializedProfileSyncService(); |
908 EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) | 909 EXPECT_CALL(*mock_pss_, IsEncryptEverythingAllowed()) |
909 .WillRepeatedly(Return(false)); | 910 .WillRepeatedly(Return(false)); |
910 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); | 911 EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0); |
911 handler_->HandleSetEncryption(&list_args); | 912 handler_->HandleSetEncryption(&list_args); |
912 | 913 |
913 ExpectPageStatusResponse(PeopleHandler::kConfigurePageStatus); | 914 ExpectPageStatusResponse(PeopleHandler::kConfigurePageStatus); |
914 } | 915 } |
915 | 916 |
916 } // namespace settings | 917 } // namespace settings |
OLD | NEW |