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" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/prefs/pref_registry_simple.h" | 13 #include "base/prefs/pref_registry_simple.h" |
14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/synchronization/waitable_event.h" | 16 #include "base/synchronization/waitable_event.h" |
17 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "chrome/browser/chrome_content_browser_client.h" | 19 #include "chrome/browser/chrome_content_browser_client.h" |
20 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 21 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
21 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 22 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
22 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 23 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
23 #include "chrome/browser/chromeos/login/auth/authenticator.h" | 24 #include "chrome/browser/chromeos/login/auth/authenticator.h" |
24 #include "chrome/browser/chromeos/login/users/user_manager.h" | 25 #include "chrome/browser/chromeos/login/users/user_manager.h" |
25 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
26 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 27 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
27 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 28 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
28 #include "chrome/browser/chromeos/settings/cros_settings.h" | 29 #include "chrome/browser/chromeos/settings/cros_settings.h" |
29 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 30 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
30 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 31 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 connector_ = | 252 connector_ = |
252 browser_process_->platform_part()->browser_policy_connector_chromeos(); | 253 browser_process_->platform_part()->browser_policy_connector_chromeos(); |
253 connector_->Init(local_state_.Get(), | 254 connector_->Init(local_state_.Get(), |
254 browser_process_->system_request_context()); | 255 browser_process_->system_request_context()); |
255 | 256 |
256 io_thread_state_.reset(new IOThread(local_state_.Get(), | 257 io_thread_state_.reset(new IOThread(local_state_.Get(), |
257 browser_process_->policy_service(), | 258 browser_process_->policy_service(), |
258 NULL, NULL)); | 259 NULL, NULL)); |
259 browser_process_->SetIOThread(io_thread_state_.get()); | 260 browser_process_->SetIOThread(io_thread_state_.get()); |
260 | 261 |
| 262 browser_process_->platform_part()->InitializeSessionManager( |
| 263 *CommandLine::ForCurrentProcess(), NULL, true); |
| 264 |
261 #if defined(ENABLE_RLZ) | 265 #if defined(ENABLE_RLZ) |
262 rlz_initialized_cb_ = base::Bind(&base::DoNothing); | 266 rlz_initialized_cb_ = base::Bind(&base::DoNothing); |
263 rlz_lib::testing::SetRlzStoreDirectory(scoped_temp_dir_.path()); | 267 rlz_lib::testing::SetRlzStoreDirectory(scoped_temp_dir_.path()); |
264 RLZTracker::EnableZeroDelayForTesting(); | 268 RLZTracker::EnableZeroDelayForTesting(); |
265 #endif | 269 #endif |
266 | 270 |
267 // Message center is used by UserManager. | 271 // Message center is used by UserManager. |
268 message_center::MessageCenter::Initialize(); | 272 message_center::MessageCenter::Initialize(); |
269 | 273 |
270 RunUntilIdle(); | 274 RunUntilIdle(); |
271 } | 275 } |
272 | 276 |
273 virtual void TearDown() OVERRIDE { | 277 virtual void TearDown() OVERRIDE { |
274 cryptohome::AsyncMethodCaller::Shutdown(); | 278 cryptohome::AsyncMethodCaller::Shutdown(); |
275 mock_async_method_caller_ = NULL; | 279 mock_async_method_caller_ = NULL; |
276 | 280 |
277 message_center::MessageCenter::Shutdown(); | 281 message_center::MessageCenter::Shutdown(); |
278 | 282 |
279 test_user_manager_.reset(); | 283 KioskAppManager::Shutdown(); |
280 | 284 |
281 InvokeOnIO( | 285 InvokeOnIO( |
282 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this))); | 286 base::Bind(&LoginUtilsTest::TearDownOnIO, base::Unretained(this))); |
283 | 287 |
| 288 test_user_manager_.reset(); |
| 289 |
284 // LoginUtils instance must not outlive Profile instances. | 290 // LoginUtils instance must not outlive Profile instances. |
285 LoginUtils::Set(NULL); | 291 LoginUtils::Set(NULL); |
286 | 292 |
287 system::StatisticsProvider::SetTestProvider(NULL); | 293 system::StatisticsProvider::SetTestProvider(NULL); |
288 | 294 |
289 // The invalidator has to shut down before DeviceOAuth2TokenServiceFactory | 295 // The invalidator has to shut down before DeviceOAuth2TokenServiceFactory |
290 // and the ProfileManager. | 296 // and the ProfileManager. |
291 connector_->ShutdownInvalidator(); | 297 connector_->ShutdownInvalidator(); |
292 | 298 |
293 input_method::Shutdown(); | 299 input_method::Shutdown(); |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 } | 710 } |
705 | 711 |
706 INSTANTIATE_TEST_CASE_P( | 712 INSTANTIATE_TEST_CASE_P( |
707 LoginUtilsBlockingLoginTestInstance, | 713 LoginUtilsBlockingLoginTestInstance, |
708 LoginUtilsBlockingLoginTest, | 714 LoginUtilsBlockingLoginTest, |
709 testing::Values(0, 1, 2, 3, 4, 5)); | 715 testing::Values(0, 1, 2, 3, 4, 5)); |
710 | 716 |
711 } // namespace | 717 } // namespace |
712 | 718 |
713 } // namespace chromeos | 719 } // namespace chromeos |
OLD | NEW |