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. 4 5#include "chromeos/attestation/mock_attestation_flow.h" 6 7#include "base/memory/scoped_ptr.h" 8#include "testing/gmock/include/gmock/gmock.h" 9 10using testing::_; 11using testing::Invoke; 12 13namespace chromeos { 14namespace attestation { 15 16FakeServerProxy::FakeServerProxy() : result_(true) {} 17 18FakeServerProxy::~FakeServerProxy() {} 19 20void FakeServerProxy::SendEnrollRequest(const std::string& request, 21 const DataCallback& callback) { 22 callback.Run(result_, request + "_response"); 23} 24 25void FakeServerProxy::SendCertificateRequest(const std::string& request, 26 const DataCallback& callback) { 27 callback.Run(result_, request + "_response"); 28} 29 30MockServerProxy::MockServerProxy() {} 31 32MockServerProxy::~MockServerProxy() {} 33 34void MockServerProxy::DeferToFake(bool success) { 35 fake_.set_result(success); 36 ON_CALL(*this, SendEnrollRequest(_, _)) 37 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendEnrollRequest)); 38 ON_CALL(*this, SendCertificateRequest(_, _)) 39 .WillByDefault(Invoke(&fake_, &FakeServerProxy::SendCertificateRequest)); 40} 41 42MockObserver::MockObserver() {} 43 44MockObserver::~MockObserver() {} 45 46MockAttestationFlow::MockAttestationFlow() 47 : AttestationFlow(NULL, NULL, scoped_ptr<ServerProxy>()) {} 48 49MockAttestationFlow::~MockAttestationFlow() {} 50 51} // namespace attestation 52} // namespace chromeos 53