test_personal_data_manager.h revision d0247b1b59f9c528cb6df88b4f2b9afaf80d181e
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_BROWSER_AUTOFILL_TEST_PERSONAL_DATA_MANAGER_H_
6#define COMPONENTS_BROWSER_AUTOFILL_TEST_PERSONAL_DATA_MANAGER_H_
7
8#include <vector>
9
10#include "components/autofill/core/browser/autofill_profile.h"
11#include "components/autofill/core/browser/credit_card.h"
12#include "components/autofill/core/browser/personal_data_manager.h"
13
14namespace autofill {
15
16// A simplistic PersonalDataManager used for testing.
17class TestPersonalDataManager : public PersonalDataManager {
18 public:
19  TestPersonalDataManager();
20  virtual ~TestPersonalDataManager();
21
22  // Adds |profile| to |profiles_|. This does not take ownership of |profile|.
23  void AddTestingProfile(AutofillProfile* profile);
24
25  // Adds |credit_card| to |credit_cards_|. This does not take ownership of
26  // |credit_card|.
27  void AddTestingCreditCard(CreditCard* credit_card);
28
29  virtual const std::vector<AutofillProfile*>& GetProfiles() OVERRIDE;
30  virtual const std::vector<CreditCard*>& GetCreditCards() const OVERRIDE;
31
32  virtual std::string SaveImportedProfile(
33      const AutofillProfile& imported_profile) OVERRIDE;
34  virtual std::string SaveImportedCreditCard(
35      const CreditCard& imported_credit_card) OVERRIDE;
36
37  const AutofillProfile& imported_profile() { return imported_profile_; }
38  const CreditCard& imported_credit_card() { return imported_credit_card_; }
39
40 private:
41  std::vector<AutofillProfile*> profiles_;
42  std::vector<CreditCard*> credit_cards_;
43  AutofillProfile imported_profile_;
44  CreditCard imported_credit_card_;
45};
46
47}  // namespace autofill
48
49#endif  // COMPONENTS_BROWSER_AUTOFILL_TEST_PERSONAL_DATA_MANAGER_H_
50