test_personal_data_manager.cc revision 5d1f7b1de12d16ceb2c938c56701a3e8bfa558f7
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 14TestPersonalDataManager::~TestPersonalDataManager() {} 15 16void TestPersonalDataManager::AddTestingProfile(AutofillProfile* profile) { 17 profiles_.push_back(profile); 18 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, 19 OnPersonalDataChanged()); 20} 21 22void TestPersonalDataManager::AddTestingCreditCard(CreditCard* credit_card) { 23 credit_cards_.push_back(credit_card); 24 FOR_EACH_OBSERVER(PersonalDataManagerObserver, observers_, 25 OnPersonalDataChanged()); 26} 27 28const std::vector<AutofillProfile*>& TestPersonalDataManager::GetProfiles() 29 const { 30 return profiles_; 31} 32 33const std::vector<AutofillProfile*>& TestPersonalDataManager::web_profiles() 34 const { 35 return profiles_; 36} 37 38const std::vector<CreditCard*>& TestPersonalDataManager:: 39 GetCreditCards() const { 40 return credit_cards_; 41} 42 43std::string TestPersonalDataManager::SaveImportedProfile( 44 const AutofillProfile& imported_profile) { 45 imported_profile_ = imported_profile; 46 return imported_profile.guid(); 47} 48 49std::string TestPersonalDataManager::SaveImportedCreditCard( 50 const CreditCard& imported_credit_card) { 51 imported_credit_card_ = imported_credit_card; 52 return imported_credit_card.guid(); 53} 54 55std::string TestPersonalDataManager::CountryCodeForCurrentTimezone() 56 const { 57 return timezone_country_code_; 58} 59 60} // namespace autofill 61