| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auth/parallel_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/parallel_authenticator.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 22 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 23 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 23 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 24 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" | 24 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" |
| 25 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 25 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| 26 #include "chrome/test/base/testing_browser_process.h" | 26 #include "chrome/test/base/testing_browser_process.h" |
| 27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
| 28 #include "chrome/test/base/testing_profile_manager.h" | 28 #include "chrome/test/base/testing_profile_manager.h" |
| 29 #include "chromeos/chromeos_switches.h" | 29 #include "chromeos/chromeos_switches.h" |
| 30 #include "chromeos/cryptohome/mock_async_method_caller.h" | 30 #include "chromeos/cryptohome/mock_async_method_caller.h" |
| 31 #include "chromeos/cryptohome/system_salt_getter.h" | 31 #include "chromeos/cryptohome/system_salt_getter.h" |
| 32 #include "chromeos/dbus/dbus_thread_manager.h" |
| 32 #include "chromeos/dbus/fake_cryptohome_client.h" | 33 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 33 #include "chromeos/dbus/fake_dbus_thread_manager.h" | |
| 34 #include "chromeos/login/auth/key.h" | 34 #include "chromeos/login/auth/key.h" |
| 35 #include "chromeos/login/auth/mock_auth_status_consumer.h" | 35 #include "chromeos/login/auth/mock_auth_status_consumer.h" |
| 36 #include "chromeos/login/auth/test_attempt_state.h" | 36 #include "chromeos/login/auth/test_attempt_state.h" |
| 37 #include "chromeos/login/auth/user_context.h" | 37 #include "chromeos/login/auth/user_context.h" |
| 38 #include "content/public/test/test_browser_thread_bundle.h" | 38 #include "content/public/test/test_browser_thread_bundle.h" |
| 39 #include "crypto/nss_util_internal.h" | 39 #include "crypto/nss_util_internal.h" |
| 40 #include "crypto/scoped_test_nss_chromeos_user.h" | 40 #include "crypto/scoped_test_nss_chromeos_user.h" |
| 41 #include "google_apis/gaia/mock_url_fetcher_factory.h" | 41 #include "google_apis/gaia/mock_url_fetcher_factory.h" |
| 42 #include "net/base/net_errors.h" | 42 #include "net/base/net_errors.h" |
| 43 #include "net/url_request/url_request_status.h" | 43 #include "net/url_request/url_request_status.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 } | 136 } |
| 137 | 137 |
| 138 virtual ~ParallelAuthenticatorTest() {} | 138 virtual ~ParallelAuthenticatorTest() {} |
| 139 | 139 |
| 140 virtual void SetUp() { | 140 virtual void SetUp() { |
| 141 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kLoginManager); | 141 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kLoginManager); |
| 142 | 142 |
| 143 mock_caller_ = new cryptohome::MockAsyncMethodCaller; | 143 mock_caller_ = new cryptohome::MockAsyncMethodCaller; |
| 144 cryptohome::AsyncMethodCaller::InitializeForTesting(mock_caller_); | 144 cryptohome::AsyncMethodCaller::InitializeForTesting(mock_caller_); |
| 145 | 145 |
| 146 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; | |
| 147 fake_cryptohome_client_ = new FakeCryptohomeClient; | 146 fake_cryptohome_client_ = new FakeCryptohomeClient; |
| 148 fake_dbus_thread_manager->SetCryptohomeClient( | 147 chromeos::DBusThreadManager::InitializeForTesting()->SetCryptohomeClient( |
| 149 scoped_ptr<CryptohomeClient>(fake_cryptohome_client_)); | 148 scoped_ptr<CryptohomeClient>(fake_cryptohome_client_)); |
| 150 DBusThreadManager::InitializeForTesting(fake_dbus_thread_manager); | |
| 151 | 149 |
| 152 SystemSaltGetter::Initialize(); | 150 SystemSaltGetter::Initialize(); |
| 153 | 151 |
| 154 OwnerSettingsService::SetOwnerKeyUtilForTesting(owner_key_util_); | 152 OwnerSettingsService::SetOwnerKeyUtilForTesting(owner_key_util_); |
| 155 | 153 |
| 156 auth_ = new ParallelAuthenticator(&consumer_); | 154 auth_ = new ParallelAuthenticator(&consumer_); |
| 157 state_.reset(new TestAttemptState(user_context_, false)); | 155 state_.reset(new TestAttemptState(user_context_, false)); |
| 158 } | 156 } |
| 159 | 157 |
| 160 // Tears down the test fixture. | 158 // Tears down the test fixture. |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 733 mock_caller_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
| 736 EXPECT_CALL(*mock_caller_, AsyncCheckKey(user_context_.GetUserID(), _, _)) | 734 EXPECT_CALL(*mock_caller_, AsyncCheckKey(user_context_.GetUserID(), _, _)) |
| 737 .Times(1) | 735 .Times(1) |
| 738 .RetiresOnSaturation(); | 736 .RetiresOnSaturation(); |
| 739 | 737 |
| 740 auth_->AuthenticateToUnlock(user_context_); | 738 auth_->AuthenticateToUnlock(user_context_); |
| 741 base::MessageLoop::current()->Run(); | 739 base::MessageLoop::current()->Run(); |
| 742 } | 740 } |
| 743 | 741 |
| 744 } // namespace chromeos | 742 } // namespace chromeos |
| OLD | NEW |