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 9 namespace autofill { 10 TestPersonalDataManager()11TestPersonalDataManager::TestPersonalDataManager() 12 : PersonalDataManager("en-US") {} 13 ~TestPersonalDataManager()14TestPersonalDataManager::~TestPersonalDataManager() {} 15 AddTestingProfile(AutofillProfile * profile)16void TestPersonalDataManager::AddTestingProfile(AutofillProfile* profile) { 17 profiles_.push_back(profile); 18 NotifyPersonalDataChanged(); 19 } 20 AddTestingCreditCard(CreditCard * credit_card)21void TestPersonalDataManager::AddTestingCreditCard(CreditCard* credit_card) { 22 credit_cards_.push_back(credit_card); 23 NotifyPersonalDataChanged(); 24 } 25 GetProfiles() const26const std::vector<AutofillProfile*>& TestPersonalDataManager::GetProfiles() 27 const { 28 return profiles_; 29 } 30 web_profiles() const31const std::vector<AutofillProfile*>& TestPersonalDataManager::web_profiles() 32 const { 33 return profiles_; 34 } 35 36 const std::vector<CreditCard*>& TestPersonalDataManager:: GetCreditCards() const37 GetCreditCards() const { 38 return credit_cards_; 39 } 40 SaveImportedProfile(const AutofillProfile & imported_profile)41std::string TestPersonalDataManager::SaveImportedProfile( 42 const AutofillProfile& imported_profile) { 43 imported_profile_ = imported_profile; 44 return imported_profile.guid(); 45 } 46 SaveImportedCreditCard(const CreditCard & imported_credit_card)47std::string TestPersonalDataManager::SaveImportedCreditCard( 48 const CreditCard& imported_credit_card) { 49 imported_credit_card_ = imported_credit_card; 50 return imported_credit_card.guid(); 51 } 52 CountryCodeForCurrentTimezone() const53std::string TestPersonalDataManager::CountryCodeForCurrentTimezone() 54 const { 55 return timezone_country_code_; 56 } 57 GetDefaultCountryCodeForNewAddress() const58const std::string& TestPersonalDataManager::GetDefaultCountryCodeForNewAddress() 59 const { 60 if (default_country_code_.empty()) 61 return PersonalDataManager::GetDefaultCountryCodeForNewAddress(); 62 63 return default_country_code_; 64 } 65 66 } // namespace autofill 67