Update V8 to version 4.6.55.
[chromium-blink-merge.git] / chromeos / attestation / mock_attestation_flow.h
blobefefd94f3125651e9c882a062016d5d858c95f96
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"
14 namespace chromeos {
15 namespace attestation {
17 // A fake server proxy which just appends "_response" to every request.
18 class FakeServerProxy : public ServerProxy {
19 public:
20 FakeServerProxy();
21 ~FakeServerProxy() override;
23 void set_result(bool result) {
24 result_ = result;
27 void SendEnrollRequest(const std::string& request,
28 const DataCallback& callback) override;
30 void SendCertificateRequest(const std::string& request,
31 const DataCallback& callback) override;
33 private:
34 bool result_;
36 DISALLOW_COPY_AND_ASSIGN(FakeServerProxy);
39 class MockServerProxy : public ServerProxy {
40 public:
41 MockServerProxy();
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());
51 private:
52 FakeServerProxy fake_;
55 // This class can be used to mock AttestationFlow callbacks.
56 class MockObserver {
57 public:
58 MockObserver();
59 virtual ~MockObserver();
61 MOCK_METHOD2(MockCertificateCallback, void(bool, const std::string&));
64 class MockAttestationFlow : public AttestationFlow {
65 public:
66 MockAttestationFlow();
67 virtual ~MockAttestationFlow();
69 MOCK_METHOD5(GetCertificate, void(AttestationCertificateProfile,
70 const std::string&,
71 const std::string&,
72 bool,
73 const CertificateCallback&));
76 } // namespace attestation
77 } // namespace chromeos
79 #endif // CHROMEOS_ATTESTATION_MOCK_ATTESTATION_FLOW_H_