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/input_method/input_method_configuration.h" | 21 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
22 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" | 22 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" |
23 #include "chrome/browser/chromeos/login/auth/authenticator.h" | 23 #include "chrome/browser/chromeos/login/auth/authenticator.h" |
| 24 #include "chrome/browser/chromeos/login/auth/key.h" |
24 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" | 25 #include "chrome/browser/chromeos/login/auth/login_status_consumer.h" |
25 #include "chrome/browser/chromeos/login/auth/user_context.h" | 26 #include "chrome/browser/chromeos/login/auth/user_context.h" |
26 #include "chrome/browser/chromeos/login/users/user_manager.h" | 27 #include "chrome/browser/chromeos/login/users/user_manager.h" |
27 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 28 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
28 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 29 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
29 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 30 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
30 #include "chrome/browser/chromeos/settings/cros_settings.h" | 31 #include "chrome/browser/chromeos/settings/cros_settings.h" |
31 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 32 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
32 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 33 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
33 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" | 34 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 &device_settings_test_helper, new MockOwnerKeyUtil()); | 393 &device_settings_test_helper, new MockOwnerKeyUtil()); |
393 | 394 |
394 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _)) | 395 EXPECT_CALL(*mock_async_method_caller_, AsyncMount(_, _, _, _)) |
395 .WillRepeatedly(Return()); | 396 .WillRepeatedly(Return()); |
396 EXPECT_CALL(*mock_async_method_caller_, AsyncGetSanitizedUsername(_, _)) | 397 EXPECT_CALL(*mock_async_method_caller_, AsyncGetSanitizedUsername(_, _)) |
397 .WillRepeatedly(Return()); | 398 .WillRepeatedly(Return()); |
398 | 399 |
399 scoped_refptr<Authenticator> authenticator = | 400 scoped_refptr<Authenticator> authenticator = |
400 LoginUtils::Get()->CreateAuthenticator(this); | 401 LoginUtils::Get()->CreateAuthenticator(this); |
401 UserContext user_context(username); | 402 UserContext user_context(username); |
402 user_context.SetPassword("password"); | 403 user_context.SetKey(Key("password")); |
403 user_context.SetUserIDHash(username); | 404 user_context.SetUserIDHash(username); |
404 authenticator->CompleteLogin(ProfileHelper::GetSigninProfile(), | 405 authenticator->CompleteLogin(ProfileHelper::GetSigninProfile(), |
405 user_context); | 406 user_context); |
406 | 407 |
407 // Setting |kHasCookies| to false prevents ProfileAuthData::Transfer from | 408 // Setting |kHasCookies| to false prevents ProfileAuthData::Transfer from |
408 // waiting for an IO task before proceeding. | 409 // waiting for an IO task before proceeding. |
409 const bool kHasCookies = false; | 410 const bool kHasCookies = false; |
410 const bool kHasActiveSession = false; | 411 const bool kHasActiveSession = false; |
411 user_context.SetAuthFlow(UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); | 412 user_context.SetAuthFlow(UserContext::AUTH_FLOW_GAIA_WITHOUT_SAML); |
412 LoginUtils::Get()->PrepareProfile(user_context, | 413 LoginUtils::Get()->PrepareProfile(user_context, |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 698 } |
698 | 699 |
699 INSTANTIATE_TEST_CASE_P( | 700 INSTANTIATE_TEST_CASE_P( |
700 LoginUtilsBlockingLoginTestInstance, | 701 LoginUtilsBlockingLoginTestInstance, |
701 LoginUtilsBlockingLoginTest, | 702 LoginUtilsBlockingLoginTest, |
702 testing::Values(0, 1, 2, 3, 4, 5)); | 703 testing::Values(0, 1, 2, 3, 4, 5)); |
703 | 704 |
704 } // namespace | 705 } // namespace |
705 | 706 |
706 } // namespace chromeos | 707 } // namespace chromeos |
OLD | NEW |