Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / chromeos / attestation / mock_attestation_flow.cc
blob71de13e17860bfb604fc5ad8c87a0f4421463c12
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 "testing/gmock/include/gmock/gmock.h"
9 using testing::_;
10 using testing::Invoke;
12 namespace chromeos {
13 namespace attestation {
15 FakeServerProxy::FakeServerProxy() : result_(true) {}
17 FakeServerProxy::~FakeServerProxy() {}
19 void FakeServerProxy::SendEnrollRequest(const std::string& request,
20 const DataCallback& callback) {
21 callback.Run(result_, request + "_response");
24 void FakeServerProxy::SendCertificateRequest(const std::string& request,
25 const DataCallback& callback) {
26 callback.Run(result_, request + "_response");
29 MockServerProxy::MockServerProxy() {}
31 MockServerProxy::~MockServerProxy() {}
33 void MockServerProxy::DeferToFake(bool success) {
34 fake_.set_result(success);
35 ON_CALL(*this, SendEnrollRequest(_, _))
36 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendEnrollRequest));
37 ON_CALL(*this, SendCertificateRequest(_, _))
38 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendCertificateRequest));
41 MockObserver::MockObserver() {}
43 MockObserver::~MockObserver() {}
45 } // namespace attestation
46 } // namespace chromeos