test_personal_data_manager.cc revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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#include "components/autofill/core/browser/test_personal_data_manager.h"
6
7#include "components/autofill/core/browser/personal_data_manager_observer.h"
8
9namespace autofill {
10
11TestPersonalDataManager::TestPersonalDataManager()
12    : PersonalDataManager("en-US"),
13      default_country_code_("US") {}
14
15TestPersonalDataManager::~TestPersonalDataManager() {}
16
17void TestPersonalDataManager::AddTestingProfile(AutofillProfile* profile) {
18  profiles_.push_back(profile);
19  FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_,
20                    OnPersonalDataChanged());
21}
22
23void TestPersonalDataManager::AddTestingCreditCard(CreditCard* credit_card) {
24  credit_cards_.push_back(credit_card);
25  FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_,
26                    OnPersonalDataChanged());
27}
28
29const std::vector<AutofillProfile*>& TestPersonalDataManager::GetProfiles()
30    const {
31  return profiles_;
32}
33
34const std::vector<CreditCard*>& TestPersonalDataManager::
35    GetCreditCards() const {
36  return credit_cards_;
37}
38
39std::string TestPersonalDataManager::SaveImportedProfile(
40    const AutofillProfile& imported_profile) {
41  imported_profile_ = imported_profile;
42  return imported_profile.guid();
43}
44
45std::string TestPersonalDataManager::SaveImportedCreditCard(
46    const CreditCard& imported_credit_card) {
47  imported_credit_card_ = imported_credit_card;
48  return imported_credit_card.guid();
49}
50
51const std::string& TestPersonalDataManager::GetDefaultCountryCodeForNewAddress()
52    const {
53  return default_country_code_;
54}
55
56}  // namespace autofill
57