| 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 |
| 223 // Initializes / shuts down a stub CrosLibrary. | |
| 224 ScopedStubCrosEnabler stub_cros_enabler_; | |
| 225 | |
| 226 // Mocks, destroyed by CrosLibrary class. | 224 // Mocks, destroyed by CrosLibrary class. |
| 227 MockCertLibrary* mock_cert_library_; | 225 MockCertLibrary* mock_cert_library_; |
| 228 MockCryptohomeLibrary* mock_cryptohome_library_; | 226 MockCryptohomeLibrary* mock_cryptohome_library_; |
| 229 ScopedMockUserManagerEnabler mock_user_manager_; | 227 ScopedMockUserManagerEnabler mock_user_manager_; |
| 230 | 228 |
| 231 cryptohome::MockAsyncMethodCaller* mock_caller_; | 229 cryptohome::MockAsyncMethodCaller* mock_caller_; |
| 232 | 230 |
| 233 MockConsumer consumer_; | 231 MockConsumer consumer_; |
| 234 scoped_refptr<ParallelAuthenticator> auth_; | 232 scoped_refptr<ParallelAuthenticator> auth_; |
| 235 scoped_ptr<TestAttemptState> state_; | 233 scoped_ptr<TestAttemptState> state_; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); | 324 state_->PresetCryptohomeStatus(true, cryptohome::MOUNT_ERROR_NONE); |
| 327 EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, | 325 EXPECT_EQ(ParallelAuthenticator::OFFLINE_LOGIN, |
| 328 SetAndResolveState(auth_, state_.release())); | 326 SetAndResolveState(auth_, state_.release())); |
| 329 } | 327 } |
| 330 | 328 |
| 331 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { | 329 TEST_F(ParallelAuthenticatorTest, ResolveOwnerNeededFailedMount) { |
| 332 FailOnLoginSuccess(); // Set failing on success as the default... | 330 FailOnLoginSuccess(); // Set failing on success as the default... |
| 333 LoginFailure failure = LoginFailure(LoginFailure::OWNER_REQUIRED); | 331 LoginFailure failure = LoginFailure(LoginFailure::OWNER_REQUIRED); |
| 334 ExpectLoginFailure(failure); | 332 ExpectLoginFailure(failure); |
| 335 | 333 |
| 336 MockDBusThreadManager* mock_dbus_thread_manager = | 334 MockDBusThreadManager* mock_dbus_thread_manager = new MockDBusThreadManager; |
| 337 new MockDBusThreadManager; | |
| 338 EXPECT_CALL(*mock_dbus_thread_manager, GetSystemBus()) | 335 EXPECT_CALL(*mock_dbus_thread_manager, GetSystemBus()) |
| 339 .WillRepeatedly(Return(reinterpret_cast<dbus::Bus*>(NULL))); | 336 .WillRepeatedly(Return(reinterpret_cast<dbus::Bus*>(NULL))); |
| 340 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); | 337 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); |
| 341 EXPECT_CALL(*mock_dbus_thread_manager->mock_cryptohome_client(), Unmount(_)) | 338 EXPECT_CALL(*mock_dbus_thread_manager->mock_cryptohome_client(), Unmount(_)) |
| 342 .WillOnce(DoAll(SetArgPointee<0>(true), Return(true))); | 339 .WillOnce(DoAll(SetArgPointee<0>(true), Return(true))); |
| 343 | 340 |
| 344 CrosSettingsProvider* device_settings_provider; | 341 CrosSettingsProvider* device_settings_provider; |
| 345 StubCrosSettingsProvider stub_settings_provider; | 342 StubCrosSettingsProvider stub_settings_provider; |
| 346 // Set up state as though a cryptohome mount attempt has occurred | 343 // 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. | 344 // 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())) | 794 .WillOnce(Return(std::string())) |
| 798 .RetiresOnSaturation(); | 795 .RetiresOnSaturation(); |
| 799 | 796 |
| 800 auth_->AuthenticateToUnlock(UserContext(username_, | 797 auth_->AuthenticateToUnlock(UserContext(username_, |
| 801 std::string(), | 798 std::string(), |
| 802 std::string())); | 799 std::string())); |
| 803 message_loop_.Run(); | 800 message_loop_.Run(); |
| 804 } | 801 } |
| 805 | 802 |
| 806 } // namespace chromeos | 803 } // namespace chromeos |
| OLD | NEW |