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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chromeos/attestation/attestation_flow.h"
6
7 #include "base/basictypes.h"
8 #include "base/callback.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10
11 namespace chromeos {
12 namespace attestation {
13
14 // A fake server proxy which just appends "_response" to every request.
15 class FakeServerProxy : public ServerProxy {
16 public:
17 FakeServerProxy();
18 virtual ~FakeServerProxy();
19
20 void set_result(bool result) {
21 result_ = result;
22 }
23
24 virtual void SendEnrollRequest(const std::string& request,
25 const DataCallback& callback) OVERRIDE;
26
27 virtual void SendCertificateRequest(const std::string& request,
28 const DataCallback& callback) OVERRIDE;
29
30 private:
31 bool result_;
32
33 DISALLOW_COPY_AND_ASSIGN(FakeServerProxy);
34 };
35
36 class MockServerProxy : public ServerProxy {
37 public:
38 MockServerProxy();
39 virtual ~MockServerProxy();
40
41 void DeferToFake(bool result);
42 MOCK_METHOD2(SendEnrollRequest,
43 void(const std::string&, const DataCallback&));
44 MOCK_METHOD2(SendCertificateRequest,
45 void(const std::string&, const DataCallback&));
46
47 private:
48 FakeServerProxy fake_;
49 };
50
51 // This class can be used to mock AttestationFlow callbacks.
52 class MockObserver {
53 public:
54 MockObserver();
55 virtual ~MockObserver();
56
57 MOCK_METHOD2(MockCertificateCallback, void(bool, const std::string&));
58 };
59
60 } // namespace attestation
61 } // namespace chromeos
OLDNEW
« 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