OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chromeos/cryptohome/mock_async_method_caller.h" | 5 #include "chromeos/cryptohome/mock_async_method_caller.h" |
6 | 6 |
7 using ::testing::Invoke; | 7 using ::testing::Invoke; |
8 using ::testing::WithArgs; | 8 using ::testing::WithArgs; |
9 using ::testing::_; | 9 using ::testing::_; |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 .WillByDefault( | 48 .WillByDefault( |
49 WithArgs<0>(Invoke(this, | 49 WithArgs<0>(Invoke(this, |
50 &MockAsyncMethodCaller::FakeCreateEnrollRequest))); | 50 &MockAsyncMethodCaller::FakeCreateEnrollRequest))); |
51 ON_CALL(*this, AsyncTpmAttestationEnroll(_, _)) | 51 ON_CALL(*this, AsyncTpmAttestationEnroll(_, _)) |
52 .WillByDefault( | 52 .WillByDefault( |
53 WithArgs<1>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); | 53 WithArgs<1>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); |
54 ON_CALL(*this, AsyncTpmAttestationCreateCertRequest(_, _, _, _)) | 54 ON_CALL(*this, AsyncTpmAttestationCreateCertRequest(_, _, _, _)) |
55 .WillByDefault( | 55 .WillByDefault( |
56 WithArgs<3>(Invoke(this, | 56 WithArgs<3>(Invoke(this, |
57 &MockAsyncMethodCaller::FakeCreateCertRequest))); | 57 &MockAsyncMethodCaller::FakeCreateCertRequest))); |
58 ON_CALL(*this, AsyncTpmAttestationFinishCertRequest(_, _, _, _)) | 58 ON_CALL(*this, AsyncTpmAttestationFinishCertRequest(_, _, _, _, _)) |
59 .WillByDefault( | 59 .WillByDefault( |
60 WithArgs<3>(Invoke(this, | 60 WithArgs<4>(Invoke(this, |
61 &MockAsyncMethodCaller::FakeFinishCertRequest))); | 61 &MockAsyncMethodCaller::FakeFinishCertRequest))); |
62 ON_CALL(*this, AsyncGetSanitizedUsername(_, _)) | 62 ON_CALL(*this, AsyncGetSanitizedUsername(_, _)) |
63 .WillByDefault( | 63 .WillByDefault( |
64 WithArgs<1>(Invoke(this, | 64 WithArgs<1>(Invoke(this, |
65 &MockAsyncMethodCaller:: | 65 &MockAsyncMethodCaller:: |
66 FakeGetSanitizedUsername))); | 66 FakeGetSanitizedUsername))); |
67 ON_CALL(*this, TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _)) | 67 ON_CALL(*this, TpmAttestationSignEnterpriseChallenge(_, _, _, _, _, _, _, _)) |
68 .WillByDefault( | 68 .WillByDefault( |
69 WithArgs<6>(Invoke(this, | 69 WithArgs<7>(Invoke(this, |
70 &MockAsyncMethodCaller::FakeEnterpriseChallenge))); | 70 &MockAsyncMethodCaller::FakeEnterpriseChallenge))); |
71 ON_CALL(*this, TpmAttestationRegisterKey(_, _, _)) | 71 ON_CALL(*this, TpmAttestationRegisterKey(_, _, _, _)) |
72 .WillByDefault( | 72 .WillByDefault( |
73 WithArgs<2>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); | 73 WithArgs<3>(Invoke(this, &MockAsyncMethodCaller::DoCallback))); |
74 } | 74 } |
75 | 75 |
76 void MockAsyncMethodCaller::DoCallback(Callback callback) { | 76 void MockAsyncMethodCaller::DoCallback(Callback callback) { |
77 callback.Run(success_, return_code_); | 77 callback.Run(success_, return_code_); |
78 } | 78 } |
79 | 79 |
80 void MockAsyncMethodCaller::FakeCreateEnrollRequest( | 80 void MockAsyncMethodCaller::FakeCreateEnrollRequest( |
81 const DataCallback& callback) { | 81 const DataCallback& callback) { |
82 callback.Run(success_, kFakeAttestationEnrollRequest); | 82 callback.Run(success_, kFakeAttestationEnrollRequest); |
83 } | 83 } |
(...skipping 12 matching lines...) Expand all Loading... |
96 const DataCallback& callback) { | 96 const DataCallback& callback) { |
97 callback.Run(success_, kFakeSanitizedUsername); | 97 callback.Run(success_, kFakeSanitizedUsername); |
98 } | 98 } |
99 | 99 |
100 void MockAsyncMethodCaller::FakeEnterpriseChallenge( | 100 void MockAsyncMethodCaller::FakeEnterpriseChallenge( |
101 const DataCallback& callback) { | 101 const DataCallback& callback) { |
102 callback.Run(success_, kFakeChallengeResponse); | 102 callback.Run(success_, kFakeChallengeResponse); |
103 } | 103 } |
104 | 104 |
105 } // namespace cryptohome | 105 } // namespace cryptohome |
OLD | NEW |