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/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
45 #include "chrome/test/base/scoped_testing_local_state.h" | 45 #include "chrome/test/base/scoped_testing_local_state.h" |
46 #include "chrome/test/base/testing_browser_process.h" | 46 #include "chrome/test/base/testing_browser_process.h" |
47 #include "chromeos/chromeos_switches.h" | 47 #include "chromeos/chromeos_switches.h" |
48 #include "chromeos/cryptohome/mock_async_method_caller.h" | 48 #include "chromeos/cryptohome/mock_async_method_caller.h" |
49 #include "chromeos/cryptohome/mock_cryptohome_library.h" | 49 #include "chromeos/cryptohome/mock_cryptohome_library.h" |
50 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" | 50 #include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h" |
51 #include "chromeos/disks/disk_mount_manager.h" | 51 #include "chromeos/disks/disk_mount_manager.h" |
52 #include "chromeos/disks/mock_disk_mount_manager.h" | 52 #include "chromeos/disks/mock_disk_mount_manager.h" |
53 #include "chromeos/login/login_state.h" | 53 #include "chromeos/login/login_state.h" |
| 54 #include "chromeos/network/network_handler.h" |
54 #include "content/public/browser/browser_thread.h" | 55 #include "content/public/browser/browser_thread.h" |
55 #include "content/public/test/test_browser_thread.h" | 56 #include "content/public/test/test_browser_thread.h" |
56 #include "content/public/test/test_utils.h" | 57 #include "content/public/test/test_utils.h" |
57 #include "google_apis/gaia/gaia_auth_consumer.h" | 58 #include "google_apis/gaia/gaia_auth_consumer.h" |
58 #include "google_apis/gaia/gaia_urls.h" | 59 #include "google_apis/gaia/gaia_urls.h" |
59 #include "net/url_request/test_url_fetcher_factory.h" | 60 #include "net/url_request/test_url_fetcher_factory.h" |
60 #include "net/url_request/url_fetcher_delegate.h" | 61 #include "net/url_request/url_fetcher_delegate.h" |
61 #include "net/url_request/url_request.h" | 62 #include "net/url_request/url_request.h" |
62 #include "net/url_request/url_request_context_getter.h" | 63 #include "net/url_request/url_request_context_getter.h" |
63 #include "net/url_request/url_request_status.h" | 64 #include "net/url_request/url_request_status.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 210 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
210 | 211 |
211 // DBusThreadManager should be initialized before io_thread_state_, as | 212 // DBusThreadManager should be initialized before io_thread_state_, as |
212 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, | 213 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, |
213 // which is part of io_thread_state_. | 214 // which is part of io_thread_state_. |
214 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); | 215 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); |
215 | 216 |
216 CryptohomeLibrary::Initialize(); | 217 CryptohomeLibrary::Initialize(); |
217 LoginState::Initialize(); | 218 LoginState::Initialize(); |
218 ConnectivityStateHelper::SetForTest(&mock_connectivity_state_helper_); | 219 ConnectivityStateHelper::SetForTest(&mock_connectivity_state_helper_); |
| 220 EXPECT_CALL(mock_connectivity_state_helper_, DefaultNetworkOnline()) |
| 221 .WillRepeatedly(Return(false)); |
219 | 222 |
220 mock_input_method_manager_ = new input_method::MockInputMethodManager(); | 223 mock_input_method_manager_ = new input_method::MockInputMethodManager(); |
221 input_method::InitializeForTesting(mock_input_method_manager_); | 224 input_method::InitializeForTesting(mock_input_method_manager_); |
222 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); | 225 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); |
223 mock_disk_mount_manager_.SetupDefaultReplies(); | 226 mock_disk_mount_manager_.SetupDefaultReplies(); |
224 | 227 |
225 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; | 228 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; |
226 cryptohome::AsyncMethodCaller::InitializeForTesting( | 229 cryptohome::AsyncMethodCaller::InitializeForTesting( |
227 mock_async_method_caller_); | 230 mock_async_method_caller_); |
228 | 231 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 test_device_settings_service_.reset(new ScopedTestDeviceSettingsService); | 272 test_device_settings_service_.reset(new ScopedTestDeviceSettingsService); |
270 test_cros_settings_.reset(new ScopedTestCrosSettings); | 273 test_cros_settings_.reset(new ScopedTestCrosSettings); |
271 test_user_manager_.reset(new ScopedTestUserManager); | 274 test_user_manager_.reset(new ScopedTestUserManager); |
272 | 275 |
273 browser_process_->SetProfileManager( | 276 browser_process_->SetProfileManager( |
274 new ProfileManagerWithoutInit(scoped_temp_dir_.path())); | 277 new ProfileManagerWithoutInit(scoped_temp_dir_.path())); |
275 connector_ = browser_process_->browser_policy_connector(); | 278 connector_ = browser_process_->browser_policy_connector(); |
276 connector_->Init(local_state_.Get(), | 279 connector_->Init(local_state_.Get(), |
277 browser_process_->system_request_context()); | 280 browser_process_->system_request_context()); |
278 | 281 |
| 282 // IOThread creates ProxyConfigServiceImpl which in turn needs |
| 283 // NetworkHandler. Thus initialize it here before creating IOThread. |
| 284 NetworkHandler::Initialize(); |
| 285 |
279 io_thread_state_.reset(new IOThread(local_state_.Get(), | 286 io_thread_state_.reset(new IOThread(local_state_.Get(), |
280 browser_process_->policy_service(), | 287 browser_process_->policy_service(), |
281 NULL, NULL)); | 288 NULL, NULL)); |
282 browser_process_->SetIOThread(io_thread_state_.get()); | 289 browser_process_->SetIOThread(io_thread_state_.get()); |
283 | 290 |
284 #if defined(ENABLE_RLZ) | 291 #if defined(ENABLE_RLZ) |
285 rlz_initialized_cb_ = base::Bind(&base::DoNothing); | 292 rlz_initialized_cb_ = base::Bind(&base::DoNothing); |
286 rlz_lib::testing::SetRlzStoreDirectory(scoped_temp_dir_.path()); | 293 rlz_lib::testing::SetRlzStoreDirectory(scoped_temp_dir_.path()); |
287 RLZTracker::EnableZeroDelayForTesting(); | 294 RLZTracker::EnableZeroDelayForTesting(); |
288 #endif | 295 #endif |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 726 } |
720 | 727 |
721 INSTANTIATE_TEST_CASE_P( | 728 INSTANTIATE_TEST_CASE_P( |
722 LoginUtilsBlockingLoginTestInstance, | 729 LoginUtilsBlockingLoginTestInstance, |
723 LoginUtilsBlockingLoginTest, | 730 LoginUtilsBlockingLoginTest, |
724 testing::Values(0, 1, 2, 3, 4, 5)); | 731 testing::Values(0, 1, 2, 3, 4, 5)); |
725 | 732 |
726 } // namespace | 733 } // namespace |
727 | 734 |
728 } | 735 } |
OLD | NEW |