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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
151 FakeCryptohomeClient::GetStubSystemSalt())); | 151 FakeCryptohomeClient::GetStubSystemSalt())); |
152 } | 152 } |
153 | 153 |
154 virtual ~CryptohomeAuthenticatorTest() {} | 154 ~CryptohomeAuthenticatorTest() override {} |
155 | 155 |
156 virtual void SetUp() { | 156 void SetUp() override { |
157 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 157 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
158 switches::kLoginManager); | 158 switches::kLoginManager); |
159 | 159 |
160 mock_caller_ = new cryptohome::MockAsyncMethodCaller; | 160 mock_caller_ = new cryptohome::MockAsyncMethodCaller; |
161 cryptohome::AsyncMethodCaller::InitializeForTesting(mock_caller_); | 161 cryptohome::AsyncMethodCaller::InitializeForTesting(mock_caller_); |
162 mock_homedir_methods_ = new cryptohome::MockHomedirMethods; | 162 mock_homedir_methods_ = new cryptohome::MockHomedirMethods; |
163 mock_homedir_methods_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); | 163 mock_homedir_methods_->SetUp(true, cryptohome::MOUNT_ERROR_NONE); |
164 cryptohome::HomedirMethods::InitializeForTesting(mock_homedir_methods_); | 164 cryptohome::HomedirMethods::InitializeForTesting(mock_homedir_methods_); |
165 | 165 |
166 fake_cryptohome_client_ = new FakeCryptohomeClient; | 166 fake_cryptohome_client_ = new FakeCryptohomeClient; |
167 chromeos::DBusThreadManager::GetSetterForTesting()->SetCryptohomeClient( | 167 chromeos::DBusThreadManager::GetSetterForTesting()->SetCryptohomeClient( |
168 scoped_ptr<CryptohomeClient>(fake_cryptohome_client_)); | 168 scoped_ptr<CryptohomeClient>(fake_cryptohome_client_)); |
169 | 169 |
170 SystemSaltGetter::Initialize(); | 170 SystemSaltGetter::Initialize(); |
171 | 171 |
172 auth_ = new ChromeCryptohomeAuthenticator(&consumer_); | 172 auth_ = new ChromeCryptohomeAuthenticator(&consumer_); |
173 state_.reset(new TestAttemptState(user_context_, false)); | 173 state_.reset(new TestAttemptState(user_context_, false)); |
174 } | 174 } |
175 | 175 |
176 // Tears down the test fixture. | 176 // Tears down the test fixture. |
177 virtual void TearDown() { | 177 void TearDown() override { |
178 SystemSaltGetter::Shutdown(); | 178 SystemSaltGetter::Shutdown(); |
179 DBusThreadManager::Shutdown(); | 179 DBusThreadManager::Shutdown(); |
180 | 180 |
181 cryptohome::AsyncMethodCaller::Shutdown(); | 181 cryptohome::AsyncMethodCaller::Shutdown(); |
182 mock_caller_ = NULL; | 182 mock_caller_ = NULL; |
183 cryptohome::HomedirMethods::Shutdown(); | 183 cryptohome::HomedirMethods::Shutdown(); |
184 mock_homedir_methods_ = NULL; | 184 mock_homedir_methods_ = NULL; |
185 } | 185 } |
186 | 186 |
187 void CreateTransformedKey(Key::KeyType type, const std::string& salt) { | 187 void CreateTransformedKey(Key::KeyType type, const std::string& salt) { |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 // salt. | 790 // salt. |
791 ExpectGetKeyDataExCall( | 791 ExpectGetKeyDataExCall( |
792 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), | 792 make_scoped_ptr(new int64(Key::KEY_TYPE_SALTED_SHA256)), |
793 scoped_ptr<std::string>()); | 793 scoped_ptr<std::string>()); |
794 | 794 |
795 auth_->AuthenticateToLogin(NULL, user_context_); | 795 auth_->AuthenticateToLogin(NULL, user_context_); |
796 base::RunLoop().Run(); | 796 base::RunLoop().Run(); |
797 } | 797 } |
798 | 798 |
799 } // namespace chromeos | 799 } // namespace chromeos |
OLD | NEW |