[safe-browsing] Database full hash matches like prefix match.
[chromium-blink-merge.git] / chromeos / attestation / mock_attestation_flow.cc
blobb6eda5b3ab3f0da5343b4178e619ee3c0e0a2ada
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 #include "chromeos/attestation/mock_attestation_flow.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "testing/gmock/include/gmock/gmock.h"
10 using testing::_;
11 using testing::DefaultValue;
12 using testing::Invoke;
14 namespace chromeos {
15 namespace attestation {
17 FakeServerProxy::FakeServerProxy() : result_(true) {}
19 FakeServerProxy::~FakeServerProxy() {}
21 void FakeServerProxy::SendEnrollRequest(const std::string& request,
22 const DataCallback& callback) {
23 callback.Run(result_, request + "_response");
26 void FakeServerProxy::SendCertificateRequest(const std::string& request,
27 const DataCallback& callback) {
28 callback.Run(result_, request + "_response");
31 MockServerProxy::MockServerProxy() {
32 DefaultValue<PrivacyCAType>::Set(DEFAULT_PCA);
35 MockServerProxy::~MockServerProxy() {}
37 void MockServerProxy::DeferToFake(bool success) {
38 fake_.set_result(success);
39 ON_CALL(*this, SendEnrollRequest(_, _))
40 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendEnrollRequest));
41 ON_CALL(*this, SendCertificateRequest(_, _))
42 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendCertificateRequest));
45 MockObserver::MockObserver() {}
47 MockObserver::~MockObserver() {}
49 MockAttestationFlow::MockAttestationFlow()
50 : AttestationFlow(NULL, NULL, scoped_ptr<ServerProxy>()) {}
52 MockAttestationFlow::~MockAttestationFlow() {}
54 } // namespace attestation
55 } // namespace chromeos