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.
5 #include "components/autofill/core/browser/test_personal_data_manager.h"
7 #include "components/autofill/core/browser/personal_data_manager_observer.h"
11 TestPersonalDataManager::TestPersonalDataManager()
12 : PersonalDataManager("en-US") {}
14 TestPersonalDataManager::~TestPersonalDataManager() {}
16 void TestPersonalDataManager::SetTestingPrefService(PrefService
* pref_service
) {
17 SetPrefService(pref_service
);
20 void TestPersonalDataManager::AddTestingProfile(AutofillProfile
* profile
) {
21 profiles_
.push_back(profile
);
22 NotifyPersonalDataChanged();
25 void TestPersonalDataManager::AddTestingCreditCard(CreditCard
* credit_card
) {
26 credit_cards_
.push_back(credit_card
);
27 NotifyPersonalDataChanged();
30 void TestPersonalDataManager::AddTestingServerCreditCard(
31 const CreditCard
& credit_card
) {
32 server_credit_cards_
.push_back(new CreditCard(credit_card
));
35 const std::vector
<AutofillProfile
*>& TestPersonalDataManager::GetProfiles()
40 const std::vector
<AutofillProfile
*>& TestPersonalDataManager::web_profiles()
45 const std::vector
<CreditCard
*>& TestPersonalDataManager::
46 GetCreditCards() const {
50 std::string
TestPersonalDataManager::SaveImportedProfile(
51 const AutofillProfile
& imported_profile
) {
52 imported_profile_
= imported_profile
;
53 return imported_profile
.guid();
56 std::string
TestPersonalDataManager::SaveImportedCreditCard(
57 const CreditCard
& imported_credit_card
) {
58 imported_credit_card_
= imported_credit_card
;
59 return imported_credit_card
.guid();
62 std::string
TestPersonalDataManager::CountryCodeForCurrentTimezone()
64 return timezone_country_code_
;
67 const std::string
& TestPersonalDataManager::GetDefaultCountryCodeForNewAddress()
69 if (default_country_code_
.empty())
70 return PersonalDataManager::GetDefaultCountryCodeForNewAddress();
72 return default_country_code_
;
75 } // namespace autofill