OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/easy_unlock/easy_unlock_challenge_wrappe
r.h" | 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_challenge_wrappe
r.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "components/proximity_auth/cryptauth/proto/securemessage.pb.h" | 8 #include "components/proximity_auth/cryptauth/proto/securemessage.pb.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 void SaveResult(std::string* result_out, const std::string& result) { | 23 void SaveResult(std::string* result_out, const std::string& result) { |
24 *result_out = result; | 24 *result_out = result; |
25 } | 25 } |
26 | 26 |
27 class TestableEasyUnlockChallengeWrapper : public EasyUnlockChallengeWrapper { | 27 class TestableEasyUnlockChallengeWrapper : public EasyUnlockChallengeWrapper { |
28 public: | 28 public: |
29 TestableEasyUnlockChallengeWrapper() | 29 TestableEasyUnlockChallengeWrapper() |
30 : EasyUnlockChallengeWrapper(kChallenge, | 30 : EasyUnlockChallengeWrapper(kChallenge, |
31 kChannelBindingData, | 31 kChannelBindingData, |
32 kUserId, | 32 AccountId::FromUserEmail(kUserId), |
33 nullptr) {} | 33 nullptr) {} |
34 ~TestableEasyUnlockChallengeWrapper() override {} | 34 ~TestableEasyUnlockChallengeWrapper() override {} |
35 | 35 |
36 private: | 36 private: |
37 void SignUsingTpmKey( | 37 void SignUsingTpmKey( |
38 const std::string& data_to_sign, | 38 const std::string& data_to_sign, |
39 const base::Callback<void(const std::string&)>& callback) override { | 39 const base::Callback<void(const std::string&)>& callback) override { |
40 std::string expected_salt = std::string(kSalt); | 40 std::string expected_salt = std::string(kSalt); |
41 std::string expected_channel_binding_data = | 41 std::string expected_channel_binding_data = |
42 std::string(kChannelBindingData); | 42 std::string(kChannelBindingData); |
(...skipping 27 matching lines...) Expand all Loading... |
70 ASSERT_TRUE(challenge_secure_message.ParseFromString(wrapped_challenge)); | 70 ASSERT_TRUE(challenge_secure_message.ParseFromString(wrapped_challenge)); |
71 EXPECT_EQ(kChallenge, challenge_secure_message.header_and_body()); | 71 EXPECT_EQ(kChallenge, challenge_secure_message.header_and_body()); |
72 | 72 |
73 securemessage::SecureMessage signature_secure_message; | 73 securemessage::SecureMessage signature_secure_message; |
74 ASSERT_TRUE(signature_secure_message.ParseFromString( | 74 ASSERT_TRUE(signature_secure_message.ParseFromString( |
75 challenge_secure_message.signature())); | 75 challenge_secure_message.signature())); |
76 EXPECT_EQ(kSignature, signature_secure_message.signature()); | 76 EXPECT_EQ(kSignature, signature_secure_message.signature()); |
77 } | 77 } |
78 | 78 |
79 } // namespace chromeos | 79 } // namespace chromeos |
OLD | NEW |