| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/auth/chrome_cryptohome_authenticator.h" | 5 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/run_loop.h" | 16 #include "base/run_loop.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
| 20 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 20 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 21 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" | 21 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 22 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.h" | 22 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" |
| 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 23 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 24 #include "chrome/browser/chromeos/settings/cros_settings.h" | 24 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 25 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 25 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 26 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 26 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| 27 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
| 28 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
| 29 #include "chrome/test/base/testing_profile_manager.h" | 29 #include "chrome/test/base/testing_profile_manager.h" |
| 30 #include "chromeos/chromeos_switches.h" | 30 #include "chromeos/chromeos_switches.h" |
| 31 #include "chromeos/cryptohome/cryptohome_parameters.h" | 31 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 32 #include "chromeos/cryptohome/homedir_methods.h" | 32 #include "chromeos/cryptohome/homedir_methods.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 class CryptohomeAuthenticatorTest : public testing::Test { | 129 class CryptohomeAuthenticatorTest : public testing::Test { |
| 130 public: | 130 public: |
| 131 CryptohomeAuthenticatorTest() | 131 CryptohomeAuthenticatorTest() |
| 132 : user_context_("me@nowhere.org"), | 132 : user_context_("me@nowhere.org"), |
| 133 user_manager_(new FakeUserManager()), | 133 user_manager_(new FakeUserManager()), |
| 134 user_manager_enabler_(user_manager_), | 134 user_manager_enabler_(user_manager_), |
| 135 mock_caller_(NULL), | 135 mock_caller_(NULL), |
| 136 mock_homedir_methods_(NULL), | 136 mock_homedir_methods_(NULL), |
| 137 owner_key_util_(new ownership::MockOwnerKeyUtil()) { | 137 owner_key_util_(new ownership::MockOwnerKeyUtil()) { |
| 138 OwnerSettingsServiceFactory::GetInstance()->SetOwnerKeyUtilForTesting( | 138 OwnerSettingsServiceChromeOSFactory::GetInstance() |
| 139 owner_key_util_); | 139 ->SetOwnerKeyUtilForTesting(owner_key_util_); |
| 140 user_context_.SetKey(Key("fakepass")); | 140 user_context_.SetKey(Key("fakepass")); |
| 141 user_context_.SetUserIDHash("me_nowhere_com_hash"); | 141 user_context_.SetUserIDHash("me_nowhere_com_hash"); |
| 142 const user_manager::User* user = | 142 const user_manager::User* user = |
| 143 user_manager_->AddUser(user_context_.GetUserID()); | 143 user_manager_->AddUser(user_context_.GetUserID()); |
| 144 profile_.set_profile_name(user_context_.GetUserID()); | 144 profile_.set_profile_name(user_context_.GetUserID()); |
| 145 | 145 |
| 146 ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, &profile_); | 146 ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, &profile_); |
| 147 | 147 |
| 148 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, | 148 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, |
| 149 SystemSaltGetter::ConvertRawSaltToHexString( | 149 SystemSaltGetter::ConvertRawSaltToHexString( |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 // salt. | 830 // salt. |
| 831 ExpectGetKeyDataExCall( | 831 ExpectGetKeyDataExCall( |
| 832 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), | 832 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), |
| 833 scoped_ptr<std::string>()); | 833 scoped_ptr<std::string>()); |
| 834 | 834 |
| 835 auth_->AuthenticateToLogin(NULL, user_context_); | 835 auth_->AuthenticateToLogin(NULL, user_context_); |
| 836 base::RunLoop().Run(); | 836 base::RunLoop().Run(); |
| 837 } | 837 } |
| 838 | 838 |
| 839 } // namespace chromeos | 839 } // namespace chromeos |
| OLD | NEW |