1// Copyright 2013 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#ifndef COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_MOCK_WALLET_CLIENT_H_ 6#define COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_MOCK_WALLET_CLIENT_H_ 7 8#include "base/basictypes.h" 9#include "base/compiler_specific.h" 10#include "base/memory/scoped_ptr.h" 11#include "components/autofill/content/browser/wallet/instrument.h" 12#include "components/autofill/content/browser/wallet/wallet_address.h" 13#include "components/autofill/content/browser/wallet/wallet_client.h" 14#include "components/autofill/content/browser/wallet/wallet_items.h" 15#include "testing/gmock/include/gmock/gmock.h" 16 17namespace autofill { 18namespace wallet { 19 20// A mock version of WalletClient that never issues real requests, just records 21// mock calls to each entry point. 22class MockWalletClient : public WalletClient { 23 public: 24 MockWalletClient(net::URLRequestContextGetter* context, 25 WalletClientDelegate* delegate, 26 const GURL& source_url); 27 virtual ~MockWalletClient(); 28 29 MOCK_METHOD0(GetWalletItems, void()); 30 31 MOCK_METHOD2(AcceptLegalDocuments, 32 void(const std::vector<WalletItems::LegalDocument*>& documents, 33 const std::string& google_transaction_id)); 34 35 MOCK_METHOD2(AuthenticateInstrument, 36 void(const std::string& instrument_id, 37 const std::string& card_verification_number)); 38 39 MOCK_METHOD1(GetFullWallet, 40 void(const WalletClient::FullWalletRequest& request)); 41 42 // Methods with scoped_ptrs can't be mocked but by using the implementation 43 // below the same effect can be achieved. 44 virtual void SaveToWallet( 45 scoped_ptr<Instrument> instrument, 46 scoped_ptr<Address> address, 47 const WalletItems::MaskedInstrument* reference_instrument, 48 const Address* reference_address) OVERRIDE; 49 50 MOCK_METHOD4(SaveToWalletMock, 51 void(Instrument* instrument, 52 Address* address, 53 const WalletItems::MaskedInstrument* reference_instrument, 54 const Address* reference_address)); 55 56 private: 57 DISALLOW_COPY_AND_ASSIGN(MockWalletClient); 58}; 59 60} // namespace wallet 61} // namespace autofill 62 63#endif // COMPONENTS_AUTOFILL_CONTENT_BROWSER_WALLET_MOCK_WALLET_CLIENT_H_ 64