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

Unified Diff: chromeos/attestation/mock_attestation_flow.h

Issue 11932004: Implemented attestation message flow for Chrome OS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chromeos/attestation/attestation_flow_unittest.cc ('k') | chromeos/attestation/mock_attestation_flow.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/attestation/mock_attestation_flow.h
diff --git a/chromeos/attestation/mock_attestation_flow.h b/chromeos/attestation/mock_attestation_flow.h
new file mode 100644
index 0000000000000000000000000000000000000000..c9dc9d57892483ed6160737b5284b10ed55d2d49
--- /dev/null
+++ b/chromeos/attestation/mock_attestation_flow.h
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/attestation/attestation_flow.h"
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "testing/gmock/include/gmock/gmock.h"
+
+namespace chromeos {
+namespace attestation {
+
+// A fake server proxy which just appends "_response" to every request.
+class FakeServerProxy : public ServerProxy {
+ public:
+ FakeServerProxy();
+ virtual ~FakeServerProxy();
+
+ void set_result(bool result) {
+ result_ = result;
+ }
+
+ virtual void SendEnrollRequest(const std::string& request,
+ const DataCallback& callback) OVERRIDE;
+
+ virtual void SendCertificateRequest(const std::string& request,
+ const DataCallback& callback) OVERRIDE;
+
+ private:
+ bool result_;
+
+ DISALLOW_COPY_AND_ASSIGN(FakeServerProxy);
+};
+
+class MockServerProxy : public ServerProxy {
+ public:
+ MockServerProxy();
+ virtual ~MockServerProxy();
+
+ void DeferToFake(bool result);
+ MOCK_METHOD2(SendEnrollRequest,
+ void(const std::string&, const DataCallback&));
+ MOCK_METHOD2(SendCertificateRequest,
+ void(const std::string&, const DataCallback&));
+
+ private:
+ FakeServerProxy fake_;
+};
+
+// This class can be used to mock AttestationFlow callbacks.
+class MockObserver {
+ public:
+ MockObserver();
+ virtual ~MockObserver();
+
+ MOCK_METHOD2(MockCertificateCallback, void(bool, const std::string&));
+};
+
+} // namespace attestation
+} // namespace chromeos
« no previous file with comments | « chromeos/attestation/attestation_flow_unittest.cc ('k') | chromeos/attestation/mock_attestation_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698