Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/chromeos/login/auth/cryptohome_authenticator_unittest.cc

Issue 2257103002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 UserContext expected_user_context(user_context_with_transformed_key_); 758 UserContext expected_user_context(user_context_with_transformed_key_);
759 expected_user_context.SetUserIDHash( 759 expected_user_context.SetUserIDHash(
760 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername); 760 cryptohome::MockAsyncMethodCaller::kFakeSanitizedUsername);
761 ExpectLoginSuccess(expected_user_context); 761 ExpectLoginSuccess(expected_user_context);
762 FailOnLoginFailure(); 762 FailOnLoginFailure();
763 763
764 // Set up mock homedir methods to respond with key metadata indicating that a 764 // Set up mock homedir methods to respond with key metadata indicating that a
765 // pre-hashed key was used to create the cryptohome and allow a successful 765 // pre-hashed key was used to create the cryptohome and allow a successful
766 // mount when this pre-hashed key is used. 766 // mount when this pre-hashed key is used.
767 767
768 ExpectGetKeyDataExCall( 768 ExpectGetKeyDataExCall(base::MakeUnique<int64_t>(Key::KEY_TYPE_SALTED_SHA256),
769 base::WrapUnique(new int64_t(Key::KEY_TYPE_SALTED_SHA256)), 769 base::MakeUnique<std::string>(kSalt));
770 base::WrapUnique(new std::string(kSalt)));
771 ExpectMountExCall(false /* expect_create_attempt */); 770 ExpectMountExCall(false /* expect_create_attempt */);
772 771
773 auth_->AuthenticateToLogin(NULL, user_context_); 772 auth_->AuthenticateToLogin(NULL, user_context_);
774 base::RunLoop().Run(); 773 base::RunLoop().Run();
775 } 774 }
776 775
777 TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) { 776 TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) {
778 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256, kSalt); 777 CreateTransformedKey(Key::KEY_TYPE_SALTED_SHA256, kSalt);
779 778
780 FailOnLoginSuccess(); 779 FailOnLoginSuccess();
781 ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME)); 780 ExpectLoginFailure(AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME));
782 781
783 // Set up mock homedir methods to respond with key metadata indicating that a 782 // Set up mock homedir methods to respond with key metadata indicating that a
784 // pre-hashed key was used to create the cryptohome but without the required 783 // pre-hashed key was used to create the cryptohome but without the required
785 // salt. 784 // salt.
786 ExpectGetKeyDataExCall( 785 ExpectGetKeyDataExCall(base::MakeUnique<int64_t>(Key::KEY_TYPE_SALTED_SHA256),
787 base::WrapUnique(new int64_t(Key::KEY_TYPE_SALTED_SHA256)), 786 std::unique_ptr<std::string>());
788 std::unique_ptr<std::string>());
789 787
790 auth_->AuthenticateToLogin(NULL, user_context_); 788 auth_->AuthenticateToLogin(NULL, user_context_);
791 base::RunLoop().Run(); 789 base::RunLoop().Run();
792 } 790 }
793 791
794 } // namespace chromeos 792 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698