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/dbus/mock_cryptohome_client.h" | 49 #include "chromeos/dbus/mock_cryptohome_client.h" |
50 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 50 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
51 #include "chromeos/dbus/mock_session_manager_client.h" | 51 #include "chromeos/dbus/mock_session_manager_client.h" |
52 #include "chromeos/disks/disk_mount_manager.h" | 52 #include "chromeos/disks/disk_mount_manager.h" |
53 #include "chromeos/disks/mock_disk_mount_manager.h" | 53 #include "chromeos/disks/mock_disk_mount_manager.h" |
| 54 #include "chromeos/login/login_state.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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 215 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
215 command_line->AppendSwitchASCII( | 216 command_line->AppendSwitchASCII( |
216 ::switches::kDeviceManagementUrl, kDMServer); | 217 ::switches::kDeviceManagementUrl, kDMServer); |
217 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 218 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
218 | 219 |
219 // DBusThreadManager should be initialized before io_thread_state_, as | 220 // DBusThreadManager should be initialized before io_thread_state_, as |
220 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, | 221 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, |
221 // which is part of io_thread_state_. | 222 // which is part of io_thread_state_. |
222 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); | 223 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); |
223 | 224 |
| 225 LoginState::Initialize(); |
224 ConnectivityStateHelper::InitializeForTesting( | 226 ConnectivityStateHelper::InitializeForTesting( |
225 &mock_connectivity_state_helper_); | 227 &mock_connectivity_state_helper_); |
226 | 228 |
227 input_method::InitializeForTesting(&mock_input_method_manager_); | 229 input_method::InitializeForTesting(&mock_input_method_manager_); |
228 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); | 230 disks::DiskMountManager::InitializeForTesting(&mock_disk_mount_manager_); |
229 mock_disk_mount_manager_.SetupDefaultReplies(); | 231 mock_disk_mount_manager_.SetupDefaultReplies(); |
230 | 232 |
231 // Likewise, SessionManagerClient should also be initialized before | 233 // Likewise, SessionManagerClient should also be initialized before |
232 // io_thread_state_. | 234 // io_thread_state_. |
233 MockSessionManagerClient* session_managed_client = | 235 MockSessionManagerClient* session_managed_client = |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 mock_async_method_caller_ = NULL; | 322 mock_async_method_caller_ = NULL; |
321 | 323 |
322 UserManager::Get()->Shutdown(); | 324 UserManager::Get()->Shutdown(); |
323 | 325 |
324 InvokeOnIO( | 326 InvokeOnIO( |
325 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this))); | 327 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this))); |
326 | 328 |
327 // LoginUtils instance must not outlive Profile instances. | 329 // LoginUtils instance must not outlive Profile instances. |
328 LoginUtils::Set(NULL); | 330 LoginUtils::Set(NULL); |
329 | 331 |
| 332 LoginState::Shutdown(); |
| 333 |
330 // These trigger some tasks that have to run while BrowserThread::UI | 334 // These trigger some tasks that have to run while BrowserThread::UI |
331 // exists. Delete all the profiles before deleting the connector. | 335 // exists. Delete all the profiles before deleting the connector. |
332 browser_process_->SetProfileManager(NULL); | 336 browser_process_->SetProfileManager(NULL); |
333 connector_ = NULL; | 337 connector_ = NULL; |
334 browser_process_->SetBrowserPolicyConnector(NULL); | 338 browser_process_->SetBrowserPolicyConnector(NULL); |
335 QuitIOLoop(); | 339 QuitIOLoop(); |
336 RunUntilIdle(); | 340 RunUntilIdle(); |
337 } | 341 } |
338 | 342 |
339 void TearDownOnIO() { | 343 void TearDownOnIO() { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 } | 739 } |
736 | 740 |
737 INSTANTIATE_TEST_CASE_P( | 741 INSTANTIATE_TEST_CASE_P( |
738 LoginUtilsBlockingLoginTestInstance, | 742 LoginUtilsBlockingLoginTestInstance, |
739 LoginUtilsBlockingLoginTest, | 743 LoginUtilsBlockingLoginTest, |
740 testing::Values(0, 1, 2, 3, 4, 5)); | 744 testing::Values(0, 1, 2, 3, 4, 5)); |
741 | 745 |
742 } // namespace | 746 } // namespace |
743 | 747 |
744 } | 748 } |
OLD | NEW |