| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, kDMServer); | 123 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, kDMServer); |
| 123 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 124 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 124 | 125 |
| 125 local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, ""); | 126 local_state_.Get()->RegisterStringPref(prefs::kApplicationLocale, ""); |
| 126 | 127 |
| 127 // DBusThreadManager should be initialized before io_thread_state_, as | 128 // DBusThreadManager should be initialized before io_thread_state_, as |
| 128 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, | 129 // DBusThreadManager is used from chromeos::ProxyConfigServiceImpl, |
| 129 // which is part of io_thread_state_. | 130 // which is part of io_thread_state_. |
| 130 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); | 131 DBusThreadManager::InitializeForTesting(&mock_dbus_thread_manager_); |
| 131 | 132 |
| 133 input_method::InputMethodManager::InitializeForTesting( |
| 134 &mock_input_method_manager_); |
| 135 |
| 132 // Likewise, SessionManagerClient should also be initialized before | 136 // Likewise, SessionManagerClient should also be initialized before |
| 133 // io_thread_state_. | 137 // io_thread_state_. |
| 134 MockSessionManagerClient* session_managed_client = | 138 MockSessionManagerClient* session_managed_client = |
| 135 mock_dbus_thread_manager_.mock_session_manager_client(); | 139 mock_dbus_thread_manager_.mock_session_manager_client(); |
| 136 EXPECT_CALL(*session_managed_client, RetrieveDevicePolicy(_)) | 140 EXPECT_CALL(*session_managed_client, RetrieveDevicePolicy(_)) |
| 137 .WillRepeatedly( | 141 .WillRepeatedly( |
| 138 MockSessionManagerClientRetrievePolicyCallback(&device_policy_)); | 142 MockSessionManagerClientRetrievePolicyCallback(&device_policy_)); |
| 139 EXPECT_CALL(*session_managed_client, RetrieveUserPolicy(_)) | 143 EXPECT_CALL(*session_managed_client, RetrieveUserPolicy(_)) |
| 140 .WillRepeatedly( | 144 .WillRepeatedly( |
| 141 MockSessionManagerClientRetrievePolicyCallback(&user_policy_)); | 145 MockSessionManagerClientRetrievePolicyCallback(&user_policy_)); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 MessageLoop loop_; | 360 MessageLoop loop_; |
| 357 TestingBrowserProcess* browser_process_; | 361 TestingBrowserProcess* browser_process_; |
| 358 ScopedTestingLocalState local_state_; | 362 ScopedTestingLocalState local_state_; |
| 359 | 363 |
| 360 content::TestBrowserThread ui_thread_; | 364 content::TestBrowserThread ui_thread_; |
| 361 content::TestBrowserThread file_thread_; | 365 content::TestBrowserThread file_thread_; |
| 362 content::TestBrowserThread io_thread_; | 366 content::TestBrowserThread io_thread_; |
| 363 scoped_ptr<IOThread> io_thread_state_; | 367 scoped_ptr<IOThread> io_thread_state_; |
| 364 | 368 |
| 365 MockDBusThreadManager mock_dbus_thread_manager_; | 369 MockDBusThreadManager mock_dbus_thread_manager_; |
| 370 input_method::MockInputMethodManager mock_input_method_manager_; |
| 366 TestURLFetcherFactory test_url_fetcher_factory_; | 371 TestURLFetcherFactory test_url_fetcher_factory_; |
| 367 | 372 |
| 368 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; | 373 cryptohome::MockAsyncMethodCaller* mock_async_method_caller_; |
| 369 | 374 |
| 370 policy::BrowserPolicyConnector* connector_; | 375 policy::BrowserPolicyConnector* connector_; |
| 371 MockCryptohomeLibrary* cryptohome_; | 376 MockCryptohomeLibrary* cryptohome_; |
| 372 Profile* prepared_profile_; | 377 Profile* prepared_profile_; |
| 373 | 378 |
| 374 private: | 379 private: |
| 375 ScopedTempDir scoped_temp_dir_; | 380 ScopedTempDir scoped_temp_dir_; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 522 } |
| 518 | 523 |
| 519 INSTANTIATE_TEST_CASE_P( | 524 INSTANTIATE_TEST_CASE_P( |
| 520 LoginUtilsBlockingLoginTestInstance, | 525 LoginUtilsBlockingLoginTestInstance, |
| 521 LoginUtilsBlockingLoginTest, | 526 LoginUtilsBlockingLoginTest, |
| 522 testing::Values(0, 1, 2, 3, 4, 5)); | 527 testing::Values(0, 1, 2, 3, 4, 5)); |
| 523 | 528 |
| 524 } // namespace | 529 } // namespace |
| 525 | 530 |
| 526 } | 531 } |
| OLD | NEW |