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

Side by Side Diff: chromeos/attestation/mock_attestation.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, 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 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.h"
6
7 #include "testing/gmock/include/gmock/gmock.h"
8
9
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 remove extra blank line
dkrahn 2013/01/17 23:36:24 Done.
10 namespace chromeos {
11 namespace attestation {
12
13 // A fake server proxy which just appends "_response" to every request.
14 class FakeServerProxy : public ServerProxy {
15 public:
16 FakeServerProxy() : result_(true) {}
17 virtual ~FakeServerProxy() {}
18
19 void set_result(bool result) {
20 result_ = result;
21 }
22 void SendEnrollRequest(const std::string& request,
23 const DataCallback& callback) {
24 callback.Run(result_, request + "_response");
25 }
26 void SendCertificateRequest(const std::string& request,
27 const DataCallback& callback) {
28 callback.Run(result_, request + "_response");
29 }
30
31 private:
32 bool result_;
33 };
34
35 class MockServerProxy : public ServerProxy {
36 public:
37 MockServerProxy();
38 virtual ~MockServerProxy();
39
40 void DeferToFake(bool result);
41 MOCK_METHOD2(SendEnrollRequest,
42 void(const std::string&, const DataCallback&));
43 MOCK_METHOD2(SendCertificateRequest,
44 void(const std::string&, const DataCallback&));
45
46 private:
47 FakeServerProxy fake_;
48 };
49
50 // This mock has methods which can be used as CertificateCallback and
51 // StatusCallback instances.
52 class MockObserver {
53 public:
54 MockObserver();
55 virtual ~MockObserver();
56
57 MOCK_METHOD1(MockStatusCallback, void(bool));
58 MOCK_METHOD2(MockCertificateCallback, void(bool, const std::string&));
59 };
60
61 class MockAttestation : public Attestation {
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 It seems this is unused?
dkrahn 2013/01/17 23:36:24 Removed.
62 public:
63 MockAttestation();
64 virtual ~MockAttestation();
65 };
66
67 }
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 // namespace attestation
dkrahn 2013/01/17 23:36:24 Done.
68 }
Mattias Nissler (ping if slow) 2013/01/16 10:39:26 // namespace chromeos
dkrahn 2013/01/17 23:36:24 Done.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698