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.
5 #ifndef CHROMEOS_ATTESTATION_MOCK_ATTESTATION_FLOW_H_
6 #define CHROMEOS_ATTESTATION_MOCK_ATTESTATION_FLOW_H_
8 #include "chromeos/attestation/attestation_flow.h"
10 #include "base/basictypes.h"
11 #include "base/callback.h"
12 #include "testing/gmock/include/gmock/gmock.h"
15 namespace attestation
{
17 // A fake server proxy which just appends "_response" to every request.
18 class FakeServerProxy
: public ServerProxy
{
21 virtual ~FakeServerProxy();
23 void set_result(bool result
) {
27 virtual void SendEnrollRequest(const std::string
& request
,
28 const DataCallback
& callback
) override
;
30 virtual void SendCertificateRequest(const std::string
& request
,
31 const DataCallback
& callback
) override
;
36 DISALLOW_COPY_AND_ASSIGN(FakeServerProxy
);
39 class MockServerProxy
: public ServerProxy
{
42 virtual ~MockServerProxy();
44 void DeferToFake(bool result
);
45 MOCK_METHOD2(SendEnrollRequest
,
46 void(const std::string
&, const DataCallback
&));
47 MOCK_METHOD2(SendCertificateRequest
,
48 void(const std::string
&, const DataCallback
&));
49 MOCK_METHOD0(GetType
, PrivacyCAType());
52 FakeServerProxy fake_
;
55 // This class can be used to mock AttestationFlow callbacks.
59 virtual ~MockObserver();
61 MOCK_METHOD2(MockCertificateCallback
, void(bool, const std::string
&));
64 class MockAttestationFlow
: public AttestationFlow
{
66 MockAttestationFlow();
67 virtual ~MockAttestationFlow();
69 MOCK_METHOD5(GetCertificate
, void(AttestationCertificateProfile
,
73 const CertificateCallback
&));
76 } // namespace attestation
77 } // namespace chromeos
79 #endif // CHROMEOS_ATTESTATION_MOCK_ATTESTATION_FLOW_H_