| 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 "chrome/browser/chromeos/login/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 MessageLoop message_loop_; | 211 MessageLoop message_loop_; |
| 212 content::TestBrowserThread ui_thread_; | 212 content::TestBrowserThread ui_thread_; |
| 213 content::TestBrowserThread file_thread_; | 213 content::TestBrowserThread file_thread_; |
| 214 content::TestBrowserThread io_thread_; | 214 content::TestBrowserThread io_thread_; |
| 215 | 215 |
| 216 std::string username_; | 216 std::string username_; |
| 217 std::string password_; | 217 std::string password_; |
| 218 std::string username_hash_; | 218 std::string username_hash_; |
| 219 std::string hash_ascii_; | 219 std::string hash_ascii_; |
| 220 | 220 |
| 221 ScopedStubCrosEnabler stub_cros_enabler_; |
| 221 ScopedDeviceSettingsTestHelper device_settings_test_helper_; | 222 ScopedDeviceSettingsTestHelper device_settings_test_helper_; |
| 222 | 223 ScopedTestCrosSettings test_cros_settings_; |
| 223 // Initializes / shuts down a stub CrosLibrary. | |
| 224 ScopedStubCrosEnabler stub_cros_enabler_; | |
| 225 | 224 |
| 226 // Mocks, destroyed by CrosLibrary class. | 225 // Mocks, destroyed by CrosLibrary class. |
| 227 MockCertLibrary* mock_cert_library_; | 226 MockCertLibrary* mock_cert_library_; |
| 228 MockCryptohomeLibrary* mock_cryptohome_library_; | 227 MockCryptohomeLibrary* mock_cryptohome_library_; |
| 229 ScopedMockUserManagerEnabler mock_user_manager_; | 228 ScopedMockUserManagerEnabler mock_user_manager_; |
| 230 | 229 |
| 231 cryptohome::MockAsyncMethodCaller* mock_caller_; | 230 cryptohome::MockAsyncMethodCaller* mock_caller_; |
| 232 | 231 |
| 233 MockConsumer consumer_; | 232 MockConsumer consumer_; |
| 234 scoped_refptr<ParallelAuthenticator> auth_; | 233 scoped_refptr<ParallelAuthenticator> auth_; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); | 325 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
| 327 EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, | 326 EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, |
| 328 SetAndResolveState(auth_, state_.release())); | 327 SetAndResolveState(auth_, state_.release())); |
| 329 } | 328 } |
| 330 | 329 |
| 331 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { | 330 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { |
| 332 FailOnLoginSuccess(); // Set failing on success as the default... | 331 FailOnLoginSuccess(); // Set failing on success as the default... |
| 333 LoginFailure failure = LoginFailure(LoginFailure::OWNER_REQUIRED); | 332 LoginFailure failure = LoginFailure(LoginFailure::OWNER_REQUIRED); |
| 334 ExpectLoginFailure(failure); | 333 ExpectLoginFailure(failure); |
| 335 | 334 |
| 336 MockDBusThreadManager* mock_dbus_thread_manager = | 335 MockDBusThreadManager* mock_dbus_thread_manager = new MockDBusThreadManager; |
| 337 new MockDBusThreadManager; | |
| 338 EXPECT_CALL(*mock_dbus_thread_manager, GetSystemBus()) | 336 EXPECT_CALL(*mock_dbus_thread_manager, GetSystemBus()) |
| 339 .WillRepeatedly(Return(reinterpret_cast<dbus::Bus*>(NULL))); | 337 .WillRepeatedly(Return(reinterpret_cast<dbus::Bus*>(NULL))); |
| 340 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); | 338 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); |
| 341 EXPECT_CALL(*mock_dbus_thread_manager->mock_cryptohome_client(), Unmount(_)) | 339 EXPECT_CALL(*mock_dbus_thread_manager->mock_cryptohome_client(), Unmount(_)) |
| 342 .WillOnce(DoAll(SetArgPointee<0>(true), Return(true))); | 340 .WillOnce(DoAll(SetArgPointee<0>(true), Return(true))); |
| 343 | 341 |
| 344 CrosSettingsProvider* device_settings_provider; | 342 CrosSettingsProvider* device_settings_provider; |
| 345 StubCrosSettingsProvider stub_settings_provider; | 343 StubCrosSettingsProvider stub_settings_provider; |
| 346 // Set up state as though a cryptohome mount attempt has occurred | 344 // Set up state as though a cryptohome mount attempt has occurred |
| 347 // and succeeded but we are in safe mode and the current user is not owner. | 345 // and succeeded but we are in safe mode and the current user is not owner. |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 .WillOnce(Return(std::string())) | 795 .WillOnce(Return(std::string())) |
| 798 .RetiresOnSaturation(); | 796 .RetiresOnSaturation(); |
| 799 | 797 |
| 800 auth_->AuthenticateToUnlock(UserContext(username_, | 798 auth_->AuthenticateToUnlock(UserContext(username_, |
| 801 std::string(), | 799 std::string(), |
| 802 std::string())); | 800 std::string())); |
| 803 message_loop_.Run(); | 801 message_loop_.Run(); |
| 804 } | 802 } |
| 805 | 803 |
| 806 } // namespace chromeos | 804 } // namespace chromeos |
| OLD | NEW |