| 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_chromeos.h" | 21 #include "chrome/browser/chromeos/ownership/owner_settings_service.h" |
| 22 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" | 22 #include "chrome/browser/chromeos/ownership/owner_settings_service_factory.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 class CryptohomeAuthenticatorTest : public testing::Test { | 130 class CryptohomeAuthenticatorTest : public testing::Test { |
| 131 public: | 131 public: |
| 132 CryptohomeAuthenticatorTest() | 132 CryptohomeAuthenticatorTest() |
| 133 : user_context_("me@nowhere.org"), | 133 : user_context_("me@nowhere.org"), |
| 134 user_manager_(new FakeUserManager()), | 134 user_manager_(new FakeUserManager()), |
| 135 user_manager_enabler_(user_manager_), | 135 user_manager_enabler_(user_manager_), |
| 136 mock_caller_(NULL), | 136 mock_caller_(NULL), |
| 137 mock_homedir_methods_(NULL), | 137 mock_homedir_methods_(NULL), |
| 138 owner_key_util_(new ownership::MockOwnerKeyUtil()) { | 138 owner_key_util_(new ownership::MockOwnerKeyUtil()) { |
| 139 OwnerSettingsServiceChromeOSFactory::GetInstance() | 139 OwnerSettingsServiceFactory::GetInstance()->SetOwnerKeyUtilForTesting( |
| 140 ->SetOwnerKeyUtilForTesting(owner_key_util_); | 140 owner_key_util_); |
| 141 user_context_.SetKey(Key("fakepass")); | 141 user_context_.SetKey(Key("fakepass")); |
| 142 user_context_.SetUserIDHash("me_nowhere_com_hash"); | 142 user_context_.SetUserIDHash("me_nowhere_com_hash"); |
| 143 const user_manager::User* user = | 143 const user_manager::User* user = |
| 144 user_manager_->AddUser(user_context_.GetUserID()); | 144 user_manager_->AddUser(user_context_.GetUserID()); |
| 145 profile_.set_profile_name(user_context_.GetUserID()); | 145 profile_.set_profile_name(user_context_.GetUserID()); |
| 146 | 146 |
| 147 ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, &profile_); | 147 ProfileHelper::Get()->SetUserToProfileMappingForTesting(user, &profile_); |
| 148 | 148 |
| 149 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, | 149 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, |
| 150 SystemSaltGetter::ConvertRawSaltToHexString( | 150 SystemSaltGetter::ConvertRawSaltToHexString( |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 // salt. | 831 // salt. |
| 832 ExpectGetKeyDataExCall( | 832 ExpectGetKeyDataExCall( |
| 833 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), | 833 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), |
| 834 scoped_ptr<std::string>()); | 834 scoped_ptr<std::string>()); |
| 835 | 835 |
| 836 auth_->AuthenticateToLogin(NULL, user_context_); | 836 auth_->AuthenticateToLogin(NULL, user_context_); |
| 837 base::RunLoop().Run(); | 837 base::RunLoop().Run(); |
| 838 } | 838 } |
| 839 | 839 |
| 840 } // namespace chromeos | 840 } // namespace chromeos |
| OLD | NEW |