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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
14 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" | 14 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" |
15 #include "chrome/browser/chromeos/cros/mock_library_loader.h" | 15 #include "chrome/browser/chromeos/cros/mock_library_loader.h" |
16 #include "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h" | 16 #include "chrome/browser/chromeos/cryptohome/mock_async_method_caller.h" |
| 17 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
17 #include "chrome/browser/chromeos/login/authenticator.h" | 18 #include "chrome/browser/chromeos/login/authenticator.h" |
18 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 19 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
19 #include "chrome/browser/chromeos/login/user_manager.h" | 20 #include "chrome/browser/chromeos/login/user_manager.h" |
20 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
21 #include "chrome/browser/net/predictor.h" | 22 #include "chrome/browser/net/predictor.h" |
22 #include "chrome/browser/policy/browser_policy_connector.h" | 23 #include "chrome/browser/policy/browser_policy_connector.h" |
23 #include "chrome/browser/policy/cloud_policy_data_store.h" | 24 #include "chrome/browser/policy/cloud_policy_data_store.h" |
24 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 25 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
25 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
26 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, kDMServer); | 121 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, kDMServer); |
121 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 122 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
122 | 123 |
123 local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, ""); | 124 local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, ""); |
124 | 125 |
125 // DBusThreadManager should be initialized before io_thread_state_, as | 126 // DBusThreadManager should be initialized before io_thread_state_, as |
126 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, | 127 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, |
127 // which is part of io_thread_state_. | 128 // which is part of io_thread_state_. |
128 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); | 129 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); |
129 | 130 |
| 131 input_method::InputMethodManager::InitializeForTesting( |
| 132 &mock_input_method_manager_); |
| 133 |
130 // Likewise, SessionManagerClient should also be initialized before | 134 // Likewise, SessionManagerClient should also be initialized before |
131 // io_thread_state_. | 135 // io_thread_state_. |
132 MockSessionManagerClient* session_managed_client = | 136 MockSessionManagerClient* session_managed_client = |
133 mock_dbus_thread_manager_.mock_session_manager_client(); | 137 mock_dbus_thread_manager_.mock_session_manager_client(); |
134 EXPECT_CALL(*session_managed_client, RetrieveDevicePolicy(_)) | 138 EXPECT_CALL(*session_managed_client, RetrieveDevicePolicy(_)) |
135 .WillRepeatedly(MockSessionManagerClientPolicyCallback("")); | 139 .WillRepeatedly(MockSessionManagerClientPolicyCallback("")); |
136 | 140 |
137 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; | 141 mock_async_method_caller_ = new cryptohome::MockAsyncMethodCaller; |
138 cryptohome::AsyncMethodCaller::InitializeForTesting( | 142 cryptohome::AsyncMethodCaller::InitializeForTesting( |
139 mock_async_method_caller_); | 143 mock_async_method_caller_); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 MessageLoop loop_; | 350 MessageLoop loop_; |
347 TestingBrowserProcess* browser_process_; | 351 TestingBrowserProcess* browser_process_; |
348 ScopedTestingLocalState local_state_; | 352 ScopedTestingLocalState local_state_; |
349 | 353 |
350 content::TestBrowserThread ui_thread_; | 354 content::TestBrowserThread ui_thread_; |
351 content::TestBrowserThread file_thread_; | 355 content::TestBrowserThread file_thread_; |
352 content::TestBrowserThread io_thread_; | 356 content::TestBrowserThread io_thread_; |
353 scoped_ptr<IOThread> io_thread_state_; | 357 scoped_ptr<IOThread> io_thread_state_; |
354 | 358 |
355 MockDBusThreadManager mock_dbus_thread_manager_; | 359 MockDBusThreadManager mock_dbus_thread_manager_; |
| 360 input_method::MockInputMethodManager mock_input_method_manager_; |
356 TestURLFetcherFactory test_url_fetcher_factory_; | 361 TestURLFetcherFactory test_url_fetcher_factory_; |
357 | 362 |
358 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; | 363 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; |
359 | 364 |
360 policy::BrowserPolicyConnector* connector_; | 365 policy::BrowserPolicyConnector* connector_; |
361 MockCryptohomeLibrary* cryptohome_; | 366 MockCryptohomeLibrary* cryptohome_; |
362 Profile* prepared_profile_; | 367 Profile* prepared_profile_; |
363 | 368 |
364 private: | 369 private: |
365 ScopedTempDir scoped_temp_dir_; | 370 ScopedTempDir scoped_temp_dir_; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 } | 509 } |
505 | 510 |
506 INSTANTIATE_TEST_CASE_P( | 511 INSTANTIATE_TEST_CASE_P( |
507 LoginUtilsBlockingLoginTestInstance, | 512 LoginUtilsBlockingLoginTestInstance, |
508 LoginUtilsBlockingLoginTest, | 513 LoginUtilsBlockingLoginTest, |
509 testing::Values(0, 1, 2, 3, 4, 5)); | 514 testing::Values(0, 1, 2, 3, 4, 5)); |
510 | 515 |
511 } // namespace | 516 } // namespace |
512 | 517 |
513 } | 518 } |
OLD | NEW |