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