| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 CreditCard* GetCreditCardWithGUID(const char* guid) { | 91 CreditCard* GetCreditCardWithGUID(const char* guid) { |
| 92 for (std::vector<CreditCard *>::iterator it = credit_cards_.begin(); | 92 for (std::vector<CreditCard *>::iterator it = credit_cards_.begin(); |
| 93 it != credit_cards_.end(); ++it){ | 93 it != credit_cards_.end(); ++it){ |
| 94 if (!(*it)->guid().compare(guid)) | 94 if (!(*it)->guid().compare(guid)) |
| 95 return *it; | 95 return *it; |
| 96 } | 96 } |
| 97 return NULL; | 97 return NULL; |
| 98 } | 98 } |
| 99 | 99 |
| 100 void AddProfile(AutofillProfile* profile) { | 100 void AddProfile(AutofillProfile* profile) { |
| 101 web_profiles_->push_back(profile); | 101 web_profiles_.push_back(profile); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void AddCreditCard(CreditCard* credit_card) { | 104 void AddCreditCard(CreditCard* credit_card) { |
| 105 credit_cards_->push_back(credit_card); | 105 credit_cards_.push_back(credit_card); |
| 106 } | 106 } |
| 107 | 107 |
| 108 virtual void RemoveProfile(const std::string& guid) OVERRIDE { | 108 virtual void RemoveProfile(const std::string& guid) OVERRIDE { |
| 109 AutofillProfile* profile = GetProfileWithGUID(guid.c_str()); | 109 AutofillProfile* profile = GetProfileWithGUID(guid.c_str()); |
| 110 | 110 |
| 111 web_profiles_.erase( | 111 web_profiles_.erase( |
| 112 std::remove(web_profiles_.begin(), web_profiles_.end(), profile), | 112 std::remove(web_profiles_.begin(), web_profiles_.end(), profile), |
| 113 web_profiles_.end()); | 113 web_profiles_.end()); |
| 114 } | 114 } |
| 115 | 115 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 129 credit_cards_.reset(); | 129 credit_cards_.reset(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void CreateTestCreditCardsYearAndMonth(const char* year, const char* month) { | 132 void CreateTestCreditCardsYearAndMonth(const char* year, const char* month) { |
| 133 ClearCreditCards(); | 133 ClearCreditCards(); |
| 134 CreditCard* credit_card = new CreditCard; | 134 CreditCard* credit_card = new CreditCard; |
| 135 autofill_test::SetCreditCardInfo(credit_card, "Miku Hatsune", | 135 autofill_test::SetCreditCardInfo(credit_card, "Miku Hatsune", |
| 136 "4234567890654321", // Visa | 136 "4234567890654321", // Visa |
| 137 month, year); | 137 month, year); |
| 138 credit_card->set_guid("00000000-0000-0000-0000-000000000007"); | 138 credit_card->set_guid("00000000-0000-0000-0000-000000000007"); |
| 139 credit_cards_->push_back(credit_card); | 139 credit_cards_.push_back(credit_card); |
| 140 } | 140 } |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 void CreateTestAutofillProfiles(ScopedVector<AutofillProfile>* profiles) { | 143 void CreateTestAutofillProfiles(ScopedVector<AutofillProfile>* profiles) { |
| 144 AutofillProfile* profile = new AutofillProfile; | 144 AutofillProfile* profile = new AutofillProfile; |
| 145 autofill_test::SetProfileInfo(profile, "Elvis", "Aaron", | 145 autofill_test::SetProfileInfo(profile, "Elvis", "Aaron", |
| 146 "Presley", "theking@gmail.com", "RCA", | 146 "Presley", "theking@gmail.com", "RCA", |
| 147 "3734 Elvis Presley Blvd.", "Apt. 10", | 147 "3734 Elvis Presley Blvd.", "Apt. 10", |
| 148 "Memphis", "Tennessee", "38116", "USA", | 148 "Memphis", "Tennessee", "38116", "USA", |
| 149 "12345678901"); | 149 "12345678901"); |
| (...skipping 2978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3128 | 3128 |
| 3129 AutofillManager* autofill_manager = tab_contents()->autofill_manager(); | 3129 AutofillManager* autofill_manager = tab_contents()->autofill_manager(); |
| 3130 EXPECT_TRUE(autofill_manager->external_delegate()); | 3130 EXPECT_TRUE(autofill_manager->external_delegate()); |
| 3131 | 3131 |
| 3132 AutocompleteHistoryManager* autocomplete_history_manager = | 3132 AutocompleteHistoryManager* autocomplete_history_manager = |
| 3133 tab_contents()->autocomplete_history_manager(); | 3133 tab_contents()->autocomplete_history_manager(); |
| 3134 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); | 3134 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); |
| 3135 } | 3135 } |
| 3136 | 3136 |
| 3137 #endif // OS_ANDROID | 3137 #endif // OS_ANDROID |
| OLD | NEW |