Add CHECK to diagnose the crash.
[chromium-blink-merge.git] / chromeos / attestation / mock_attestation_flow.cc
blob4b109755903a22b2b7c713e0e0c963efda1227df
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"
9 using testing::_;
10 using testing::DefaultValue;
11 using testing::Invoke;
13 namespace chromeos {
14 namespace attestation {
16 FakeServerProxy::FakeServerProxy() : result_(true) {}
18 FakeServerProxy::~FakeServerProxy() {}
20 void FakeServerProxy::SendEnrollRequest(const std::string& request,
21 const DataCallback& callback) {
22 callback.Run(result_, request + "_response");
25 void FakeServerProxy::SendCertificateRequest(const std::string& request,
26 const DataCallback& callback) {
27 callback.Run(result_, request + "_response");
30 MockServerProxy::MockServerProxy() {
31 DefaultValue<PrivacyCAType>::Set(DEFAULT_PCA);
34 MockServerProxy::~MockServerProxy() {}
36 void MockServerProxy::DeferToFake(bool success) {
37 fake_.set_result(success);
38 ON_CALL(*this, SendEnrollRequest(_, _))
39 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendEnrollRequest));
40 ON_CALL(*this, SendCertificateRequest(_, _))
41 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendCertificateRequest));
44 MockObserver::MockObserver() {}
46 MockObserver::~MockObserver() {}
48 MockAttestationFlow::MockAttestationFlow()
49 : AttestationFlow(NULL, NULL, scoped_ptr<ServerProxy>()) {}
51 MockAttestationFlow::~MockAttestationFlow() {}
53 } // namespace attestation
54 } // namespace chromeos