Home | History | Annotate | Download | only in browser
      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 
     11 TestPersonalDataManager::TestPersonalDataManager()
     12     : PersonalDataManager("en-US") {}
     13 
     14 TestPersonalDataManager::~TestPersonalDataManager() {}
     15 
     16 void TestPersonalDataManager::AddTestingProfile(AutofillProfile* profile) {
     17   profiles_.push_back(profile);
     18   NotifyPersonalDataChanged();
     19 }
     20 
     21 void TestPersonalDataManager::AddTestingCreditCard(CreditCard* credit_card) {
     22   credit_cards_.push_back(credit_card);
     23   NotifyPersonalDataChanged();
     24 }
     25 
     26 const std::vector<AutofillProfile*>& TestPersonalDataManager::GetProfiles()
     27     const {
     28   return profiles_;
     29 }
     30 
     31 const std::vector<AutofillProfile*>& TestPersonalDataManager::web_profiles()
     32     const {
     33   return profiles_;
     34 }
     35 
     36 const std::vector<CreditCard*>& TestPersonalDataManager::
     37     GetCreditCards() const {
     38   return credit_cards_;
     39 }
     40 
     41 std::string TestPersonalDataManager::SaveImportedProfile(
     42     const AutofillProfile& imported_profile) {
     43   imported_profile_ = imported_profile;
     44   return imported_profile.guid();
     45 }
     46 
     47 std::string TestPersonalDataManager::SaveImportedCreditCard(
     48     const CreditCard& imported_credit_card) {
     49   imported_credit_card_ = imported_credit_card;
     50   return imported_credit_card.guid();
     51 }
     52 
     53 std::string TestPersonalDataManager::CountryCodeForCurrentTimezone()
     54     const {
     55   return timezone_country_code_;
     56 }
     57 
     58 const 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