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

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, 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_flow.h"
6
7 #include "testing/gmock/include/gmock/gmock.h"
8
9 namespace chromeos {
10 namespace attestation {
11
12 // A fake server proxy which just appends "_response" to every request.
13 class FakeServerProxy : public ServerProxy {
14 public:
15 FakeServerProxy() : result_(true) {}
16 virtual ~FakeServerProxy() {}
17
18 void set_result(bool result) {
19 result_ = result;
20 }
21 void SendEnrollRequest(const std::string& request,
22 const DataCallback& callback) {
23 callback.Run(result_, request + "_response");
Mattias Nissler (ping if slow) 2013/01/18 13:38:46 #include "base/callback.h"
dkrahn 2013/01/22 22:50:11 Done.
24 }
25 void SendCertificateRequest(const std::string& request,
26 const DataCallback& callback) {
27 callback.Run(result_, request + "_response");
28 }
29
30 private:
31 bool result_;
Mattias Nissler (ping if slow) 2013/01/18 13:38:46 DISALLOW_COPY_AND_ASSIGN(FakeServerProxy) and #inc
dkrahn 2013/01/22 22:50:11 Done.
32 };
33
34 class MockServerProxy : public ServerProxy {
35 public:
36 MockServerProxy();
37 virtual ~MockServerProxy();
38
39 void DeferToFake(bool result);
40 MOCK_METHOD2(SendEnrollRequest,
41 void(const std::string&, const DataCallback&));
42 MOCK_METHOD2(SendCertificateRequest,
43 void(const std::string&, const DataCallback&));
44
45 private:
46 FakeServerProxy fake_;
47 };
48
49 // This class can be used to mock AttestationFlow callbacks.
50 class MockObserver {
51 public:
52 MockObserver();
53 virtual ~MockObserver();
54
55 MOCK_METHOD2(MockCertificateCallback, void(bool, const std::string&));
56 };
57
58 } // namespace attestation
59 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698