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

Unified Diff: chromeos/cryptohome/mock_async_method_caller.cc

Issue 11932004: Implemented attestation message flow for Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chromeos/cryptohome/mock_async_method_caller.cc
diff --git a/chromeos/cryptohome/mock_async_method_caller.cc b/chromeos/cryptohome/mock_async_method_caller.cc
index eb2203c227f59128fc9e0a4d547198de72003e30..2f9a93767046e03bb65ed95f936f240352d5a8a8 100644
--- a/chromeos/cryptohome/mock_async_method_caller.cc
+++ b/chromeos/cryptohome/mock_async_method_caller.cc
@@ -10,6 +10,10 @@ using ::testing::_;
namespace cryptohome {
+const char* MockAsyncMethodCaller::kFakeAttestationEnrollRequest = "enrollreq";
+const char* MockAsyncMethodCaller::kFakeAttestationCertRequest = "certreq";
+const char* MockAsyncMethodCaller::kFakeAttestationCert = "cert";
+
MockAsyncMethodCaller::MockAsyncMethodCaller()
: success_(false), return_code_(cryptohome::MOUNT_ERROR_NONE) {
}
@@ -34,10 +38,40 @@ void MockAsyncMethodCaller::SetUp(bool success, MountError return_code) {
ON_CALL(*this, AsyncRemove(_, _))
.WillByDefault(
WithArgs<1>(Invoke(this, &MockAsyncMethodCaller::DoCallback)));
+ ON_CALL(*this, AsyncTpmAttestationCreateEnrollRequest(_))
+ .WillByDefault(
+ WithArgs<0>(Invoke(this,
+ &MockAsyncMethodCaller::FakeCreateEnrollRequest)));
+ ON_CALL(*this, AsyncTpmAttestationEnroll(_, _))
+ .WillByDefault(
+ WithArgs<1>(Invoke(this, &MockAsyncMethodCaller::DoCallback)));
+ ON_CALL(*this, AsyncTpmAttestationCreateCertRequest(_, _))
+ .WillByDefault(
+ WithArgs<1>(Invoke(this,
+ &MockAsyncMethodCaller::FakeCreateCertRequest)));
+ ON_CALL(*this, AsyncTpmAttestationFinishCertRequest(_, _))
+ .WillByDefault(
+ WithArgs<1>(Invoke(this,
+ &MockAsyncMethodCaller::FakeFinishCertRequest)));
}
void MockAsyncMethodCaller::DoCallback(Callback callback) {
callback.Run(success_, return_code_);
}
+void MockAsyncMethodCaller::FakeCreateEnrollRequest(
+ const DataCallback& callback) {
+ callback.Run(success_, kFakeAttestationEnrollRequest);
+}
+
+void MockAsyncMethodCaller::FakeCreateCertRequest(
+ const DataCallback& callback) {
+ callback.Run(success_, kFakeAttestationCertRequest);
+}
+
+void MockAsyncMethodCaller::FakeFinishCertRequest(
+ const DataCallback& callback) {
+ callback.Run(success_, kFakeAttestationCert);
+}
+
} // namespace cryptohome

Powered by Google App Engine
This is Rietveld 408576698