| 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 30 matching lines...) Expand all Loading... |
| 41 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
| 42 #include "chrome/test/base/scoped_testing_local_state.h" | 42 #include "chrome/test/base/scoped_testing_local_state.h" |
| 43 #include "chrome/test/base/testing_browser_process.h" | 43 #include "chrome/test/base/testing_browser_process.h" |
| 44 #include "chromeos/chromeos_switches.h" | 44 #include "chromeos/chromeos_switches.h" |
| 45 #include "chromeos/cryptohome/mock_async_method_caller.h" | 45 #include "chromeos/cryptohome/mock_async_method_caller.h" |
| 46 #include "chromeos/dbus/mock_cryptohome_client.h" | 46 #include "chromeos/dbus/mock_cryptohome_client.h" |
| 47 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 47 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
| 48 #include "chromeos/dbus/mock_session_manager_client.h" | 48 #include "chromeos/dbus/mock_session_manager_client.h" |
| 49 #include "chromeos/disks/disk_mount_manager.h" | 49 #include "chromeos/disks/disk_mount_manager.h" |
| 50 #include "chromeos/disks/mock_disk_mount_manager.h" | 50 #include "chromeos/disks/mock_disk_mount_manager.h" |
| 51 #include "chromeos/login/login_state.h" |
| 51 #include "content/public/browser/browser_thread.h" | 52 #include "content/public/browser/browser_thread.h" |
| 52 #include "content/public/test/test_browser_thread.h" | 53 #include "content/public/test/test_browser_thread.h" |
| 53 #include "content/public/test/test_utils.h" | 54 #include "content/public/test/test_utils.h" |
| 54 #include "google_apis/gaia/gaia_auth_consumer.h" | 55 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 55 #include "google_apis/gaia/gaia_urls.h" | 56 #include "google_apis/gaia/gaia_urls.h" |
| 56 #include "net/url_request/test_url_fetcher_factory.h" | 57 #include "net/url_request/test_url_fetcher_factory.h" |
| 57 #include "net/url_request/url_fetcher_delegate.h" | 58 #include "net/url_request/url_fetcher_delegate.h" |
| 58 #include "net/url_request/url_request.h" | 59 #include "net/url_request/url_request.h" |
| 59 #include "net/url_request/url_request_context_getter.h" | 60 #include "net/url_request/url_request_context_getter.h" |
| 60 #include "net/url_request/url_request_status.h" | 61 #include "net/url_request/url_request_status.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 212 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 212 command_line->AppendSwitchASCII( | 213 command_line->AppendSwitchASCII( |
| 213 ::switches::kDeviceManagementUrl, kDMServer); | 214 ::switches::kDeviceManagementUrl, kDMServer); |
| 214 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 215 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 215 | 216 |
| 216 // DBusThreadManager should be initialized before io_thread_state_, as | 217 // DBusThreadManager should be initialized before io_thread_state_, as |
| 217 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, | 218 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, |
| 218 // which is part of io_thread_state_. | 219 // which is part of io_thread_state_. |
| 219 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); | 220 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); |
| 220 | 221 |
| 222 LoginState::Initialize(); |
| 221 ConnectivityStateHelper::InitializeForTesting( | 223 ConnectivityStateHelper::InitializeForTesting( |
| 222 &mock_connectivity_state_helper_); | 224 &mock_connectivity_state_helper_); |
| 223 | 225 |
| 224 input_method::InitializeForTesting(&mock_input_method_manager_); | 226 input_method::InitializeForTesting(&mock_input_method_manager_); |
| 225 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); | 227 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); |
| 226 mock_disk_mount_manager_.SetupDefaultReplies(); | 228 mock_disk_mount_manager_.SetupDefaultReplies(); |
| 227 | 229 |
| 228 // Likewise, SessionManagerClient should also be initialized before | 230 // Likewise, SessionManagerClient should also be initialized before |
| 229 // io_thread_state_. | 231 // io_thread_state_. |
| 230 MockSessionManagerClient* session_managed_client = | 232 MockSessionManagerClient* session_managed_client = |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 mock_async_method_caller_ = NULL; | 317 mock_async_method_caller_ = NULL; |
| 316 | 318 |
| 317 UserManager::Get()->Shutdown(); | 319 UserManager::Get()->Shutdown(); |
| 318 | 320 |
| 319 InvokeOnIO( | 321 InvokeOnIO( |
| 320 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this))); | 322 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this))); |
| 321 | 323 |
| 322 // LoginUtils instance must not outlive Profile instances. | 324 // LoginUtils instance must not outlive Profile instances. |
| 323 LoginUtils::Set(NULL); | 325 LoginUtils::Set(NULL); |
| 324 | 326 |
| 327 LoginState::Shutdown(); |
| 328 |
| 325 // These trigger some tasks that have to run while BrowserThread::UI | 329 // These trigger some tasks that have to run while BrowserThread::UI |
| 326 // exists. Delete all the profiles before deleting the connector. | 330 // exists. Delete all the profiles before deleting the connector. |
| 327 browser_process_->SetProfileManager(NULL); | 331 browser_process_->SetProfileManager(NULL); |
| 328 connector_ = NULL; | 332 connector_ = NULL; |
| 329 browser_process_->SetBrowserPolicyConnector(NULL); | 333 browser_process_->SetBrowserPolicyConnector(NULL); |
| 330 QuitIOLoop(); | 334 QuitIOLoop(); |
| 331 RunUntilIdle(); | 335 RunUntilIdle(); |
| 332 } | 336 } |
| 333 | 337 |
| 334 void TearDownOnIO() { | 338 void TearDownOnIO() { |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 } | 725 } |
| 722 | 726 |
| 723 INSTANTIATE_TEST_CASE_P( | 727 INSTANTIATE_TEST_CASE_P( |
| 724 LoginUtilsBlockingLoginTestInstance, | 728 LoginUtilsBlockingLoginTestInstance, |
| 725 LoginUtilsBlockingLoginTest, | 729 LoginUtilsBlockingLoginTest, |
| 726 testing::Values(0, 1, 2, 3, 4, 5)); | 730 testing::Values(0, 1, 2, 3, 4, 5)); |
| 727 | 731 |
| 728 } // namespace | 732 } // namespace |
| 729 | 733 |
| 730 } | 734 } |
| OLD | NEW |