Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: components/autofill/core/browser/autofill_common_test.cc

Issue 23882013: [rAc] Persist selection of newly added cards and addresses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests, add a test Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 "components/autofill/core/browser/autofill_common_test.h" 5 #include "components/autofill/core/browser/autofill_common_test.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/autofill/core/browser/autofill_profile.h" 10 #include "components/autofill/core/browser/autofill_profile.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return profile; 121 return profile;
122 } 122 }
123 123
124 CreditCard GetCreditCard() { 124 CreditCard GetCreditCard() {
125 CreditCard credit_card(base::GenerateGUID(), "http://www.example.com"); 125 CreditCard credit_card(base::GenerateGUID(), "http://www.example.com");
126 SetCreditCardInfo( 126 SetCreditCardInfo(
127 &credit_card, "Test User", "4111111111111111" /* Visa */, "11", "2017"); 127 &credit_card, "Test User", "4111111111111111" /* Visa */, "11", "2017");
128 return credit_card; 128 return credit_card;
129 } 129 }
130 130
131 CreditCard GetCreditCard2() {
132 CreditCard credit_card(base::GenerateGUID(), "https://www.example.com");
133 SetCreditCardInfo(
134 &credit_card, "Someone Else", "378282246310005" /* AmEx */, "07", "2019");
135 return credit_card;
136 }
137
131 CreditCard GetVerifiedCreditCard() { 138 CreditCard GetVerifiedCreditCard() {
132 CreditCard credit_card(GetCreditCard()); 139 CreditCard credit_card(GetCreditCard());
133 credit_card.set_origin(kSettingsOrigin); 140 credit_card.set_origin(kSettingsOrigin);
134 return credit_card; 141 return credit_card;
135 } 142 }
136 143
144 CreditCard GetVerifiedCreditCard2() {
145 CreditCard credit_card(GetCreditCard2());
146 credit_card.set_origin(kSettingsOrigin);
147 return credit_card;
148 }
149
137 void SetProfileInfo(AutofillProfile* profile, 150 void SetProfileInfo(AutofillProfile* profile,
138 const char* first_name, const char* middle_name, 151 const char* first_name, const char* middle_name,
139 const char* last_name, const char* email, const char* company, 152 const char* last_name, const char* email, const char* company,
140 const char* address1, const char* address2, const char* city, 153 const char* address1, const char* address2, const char* city,
141 const char* state, const char* zipcode, const char* country, 154 const char* state, const char* zipcode, const char* country,
142 const char* phone) { 155 const char* phone) {
143 check_and_set(profile, NAME_FIRST, first_name); 156 check_and_set(profile, NAME_FIRST, first_name);
144 check_and_set(profile, NAME_MIDDLE, middle_name); 157 check_and_set(profile, NAME_MIDDLE, middle_name);
145 check_and_set(profile, NAME_LAST, last_name); 158 check_and_set(profile, NAME_LAST, last_name);
146 check_and_set(profile, EMAIL_ADDRESS, email); 159 check_and_set(profile, EMAIL_ADDRESS, email);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Disable auxiliary profiles for unit testing. These reach out to system 198 // Disable auxiliary profiles for unit testing. These reach out to system
186 // services on the Mac. 199 // services on the Mac.
187 if (browser_context) { 200 if (browser_context) {
188 user_prefs::UserPrefs::Get(browser_context)->SetBoolean( 201 user_prefs::UserPrefs::Get(browser_context)->SetBoolean(
189 prefs::kAutofillAuxiliaryProfilesEnabled, false); 202 prefs::kAutofillAuxiliaryProfilesEnabled, false);
190 } 203 }
191 } 204 }
192 205
193 } // namespace test 206 } // namespace test
194 } // namespace autofill 207 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_common_test.h ('k') | components/autofill/core/browser/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698