| 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 <cryptohi.h> | 5 #include <cryptohi.h> |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 profile_manager_(TestingBrowserProcess::GetGlobal()) {} | 200 profile_manager_(TestingBrowserProcess::GetGlobal()) {} |
| 201 ~EasyUnlockTpmKeyManagerTest() override {} | 201 ~EasyUnlockTpmKeyManagerTest() override {} |
| 202 | 202 |
| 203 void SetUp() override { | 203 void SetUp() override { |
| 204 ASSERT_TRUE(profile_manager_.SetUp()); | 204 ASSERT_TRUE(profile_manager_.SetUp()); |
| 205 const user_manager::User* user = user_manager_->AddUser(test_account_id_); | 205 const user_manager::User* user = user_manager_->AddUser(test_account_id_); |
| 206 username_hash_ = user->username_hash(); | 206 username_hash_ = user->username_hash(); |
| 207 | 207 |
| 208 signin_profile_ = profile_manager_.CreateTestingProfile( | 208 signin_profile_ = profile_manager_.CreateTestingProfile( |
| 209 chrome::kInitialProfile, | 209 chrome::kInitialProfile, |
| 210 scoped_ptr<syncable_prefs::TestingPrefServiceSyncable>(), | 210 std::unique_ptr<syncable_prefs::TestingPrefServiceSyncable>(), |
| 211 base::UTF8ToUTF16(chrome::kInitialProfile), 0 /* avatar id */, | 211 base::UTF8ToUTF16(chrome::kInitialProfile), 0 /* avatar id */, |
| 212 std::string() /* supervized user id */, | 212 std::string() /* supervized user id */, |
| 213 TestingProfile::TestingFactories()); | 213 TestingProfile::TestingFactories()); |
| 214 | 214 |
| 215 user_profile_ = profile_manager_.CreateTestingProfile( | 215 user_profile_ = profile_manager_.CreateTestingProfile( |
| 216 test_account_id_.GetUserEmail(), | 216 test_account_id_.GetUserEmail(), |
| 217 scoped_ptr<syncable_prefs::TestingPrefServiceSyncable>(), | 217 std::unique_ptr<syncable_prefs::TestingPrefServiceSyncable>(), |
| 218 base::UTF8ToUTF16(test_account_id_.GetUserEmail()), 0 /* avatar id */, | 218 base::UTF8ToUTF16(test_account_id_.GetUserEmail()), 0 /* avatar id */, |
| 219 std::string() /* supervized user id */, | 219 std::string() /* supervized user id */, |
| 220 TestingProfile::TestingFactories()); | 220 TestingProfile::TestingFactories()); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void TearDown() override { | 223 void TearDown() override { |
| 224 if (test_nss_user_) | 224 if (test_nss_user_) |
| 225 ResetTestNssUser(); | 225 ResetTestNssUser(); |
| 226 profile_manager_.DeleteTestingProfile(test_account_id_.GetUserEmail()); | 226 profile_manager_.DeleteTestingProfile(test_account_id_.GetUserEmail()); |
| 227 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); | 227 profile_manager_.DeleteTestingProfile(chrome::kInitialProfile); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 update->SetStringWithoutPathExpansion(account_id.GetUserEmail(), encoded); | 332 update->SetStringWithoutPathExpansion(account_id.GetUserEmail(), encoded); |
| 333 } | 333 } |
| 334 | 334 |
| 335 protected: | 335 protected: |
| 336 const AccountId test_account_id_ = AccountId::FromUserEmail(kTestUserId); | 336 const AccountId test_account_id_ = AccountId::FromUserEmail(kTestUserId); |
| 337 | 337 |
| 338 private: | 338 private: |
| 339 content::TestBrowserThreadBundle thread_bundle_; | 339 content::TestBrowserThreadBundle thread_bundle_; |
| 340 | 340 |
| 341 // The NSS system slot used by EasyUnlockTPMKeyManagers in tests. | 341 // The NSS system slot used by EasyUnlockTPMKeyManagers in tests. |
| 342 scoped_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_; | 342 std::unique_ptr<crypto::ScopedTestSystemNSSKeySlot> test_system_slot_; |
| 343 scoped_ptr<crypto::ScopedTestNSSChromeOSUser> test_nss_user_; | 343 std::unique_ptr<crypto::ScopedTestNSSChromeOSUser> test_nss_user_; |
| 344 | 344 |
| 345 // Needed to properly set up signin and user profiles for test. | 345 // Needed to properly set up signin and user profiles for test. |
| 346 user_manager::FakeUserManager* user_manager_; | 346 user_manager::FakeUserManager* user_manager_; |
| 347 chromeos::ScopedUserManagerEnabler user_manager_enabler_; | 347 chromeos::ScopedUserManagerEnabler user_manager_enabler_; |
| 348 TestingProfileManager profile_manager_; | 348 TestingProfileManager profile_manager_; |
| 349 | 349 |
| 350 // The testing profiles that own EasyUnlockTPMKeyManager services. | 350 // The testing profiles that own EasyUnlockTPMKeyManager services. |
| 351 // Owned by |profile_manager_|. | 351 // Owned by |profile_manager_|. |
| 352 TestingProfile* user_profile_; | 352 TestingProfile* user_profile_; |
| 353 TestingProfile* signin_profile_; | 353 TestingProfile* signin_profile_; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 base::Bind(&RecordStringAndRunClosure, &signed_data, loop.QuitClosure())); | 592 base::Bind(&RecordStringAndRunClosure, &signed_data, loop.QuitClosure())); |
| 593 | 593 |
| 594 ASSERT_TRUE(SetUpTestSystemSlot()); | 594 ASSERT_TRUE(SetUpTestSystemSlot()); |
| 595 | 595 |
| 596 loop.Run(); | 596 loop.Run(); |
| 597 | 597 |
| 598 EXPECT_TRUE(signed_data.empty()); | 598 EXPECT_TRUE(signed_data.empty()); |
| 599 } | 599 } |
| 600 | 600 |
| 601 } // namespace | 601 } // namespace |
| OLD | NEW |