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

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

Issue 2844463004: Rename card 'type' into 'issuer network.' (Closed)
Patch Set: read -> use Created 3 years, 7 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
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_test_utils.h" 5 #include "components/autofill/core/browser/autofill_test_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 CreditCard GetVerifiedCreditCard2() { 247 CreditCard GetVerifiedCreditCard2() {
248 CreditCard credit_card(GetCreditCard2()); 248 CreditCard credit_card(GetCreditCard2());
249 credit_card.set_origin(kSettingsOrigin); 249 credit_card.set_origin(kSettingsOrigin);
250 return credit_card; 250 return credit_card;
251 } 251 }
252 252
253 CreditCard GetMaskedServerCard() { 253 CreditCard GetMaskedServerCard() {
254 CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "a123"); 254 CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "a123");
255 test::SetCreditCardInfo(&credit_card, "Bonnie Parker", 255 test::SetCreditCardInfo(&credit_card, "Bonnie Parker",
256 "2109" /* Mastercard */, "12", "2020"); 256 "2109" /* Mastercard */, "12", "2020");
257 credit_card.SetTypeForMaskedCard(kMasterCard); 257 credit_card.SetNetworkForMaskedCard(kMasterCard);
258 return credit_card; 258 return credit_card;
259 } 259 }
260 260
261 CreditCard GetMaskedServerCardAmex() { 261 CreditCard GetMaskedServerCardAmex() {
262 CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "b456"); 262 CreditCard credit_card(CreditCard::MASKED_SERVER_CARD, "b456");
263 test::SetCreditCardInfo(&credit_card, "Justin Thyme", 263 test::SetCreditCardInfo(&credit_card, "Justin Thyme",
264 "8431" /* Amex */, "9", "2020"); 264 "8431" /* Amex */, "9", "2020");
265 credit_card.SetTypeForMaskedCard(kAmericanExpressCard); 265 credit_card.SetNetworkForMaskedCard(kAmericanExpressCard);
266 return credit_card; 266 return credit_card;
267 } 267 }
268 268
269 void SetProfileInfo(AutofillProfile* profile, 269 void SetProfileInfo(AutofillProfile* profile,
270 const char* first_name, const char* middle_name, 270 const char* first_name, const char* middle_name,
271 const char* last_name, const char* email, const char* company, 271 const char* last_name, const char* email, const char* company,
272 const char* address1, const char* address2, const char* city, 272 const char* address1, const char* address2, const char* city,
273 const char* state, const char* zipcode, const char* country, 273 const char* state, const char* zipcode, const char* country,
274 const char* phone) { 274 const char* phone) {
275 check_and_set(profile, NAME_FIRST, first_name); 275 check_and_set(profile, NAME_FIRST, first_name);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 void ReenableSystemServices() { 316 void ReenableSystemServices() {
317 OSCryptMocker::TearDown(); 317 OSCryptMocker::TearDown();
318 } 318 }
319 319
320 void SetServerCreditCards(AutofillTable* table, 320 void SetServerCreditCards(AutofillTable* table,
321 const std::vector<CreditCard>& cards) { 321 const std::vector<CreditCard>& cards) {
322 std::vector<CreditCard> as_masked_cards = cards; 322 std::vector<CreditCard> as_masked_cards = cards;
323 for (CreditCard& card : as_masked_cards) { 323 for (CreditCard& card : as_masked_cards) {
324 card.set_record_type(CreditCard::MASKED_SERVER_CARD); 324 card.set_record_type(CreditCard::MASKED_SERVER_CARD);
325 std::string type = card.type();
326 card.SetNumber(card.LastFourDigits()); 325 card.SetNumber(card.LastFourDigits());
327 card.SetTypeForMaskedCard(type.c_str()); 326 card.SetNetworkForMaskedCard(card.network());
328 } 327 }
329 table->SetServerCreditCards(as_masked_cards); 328 table->SetServerCreditCards(as_masked_cards);
330 329
331 for (const CreditCard& card : cards) { 330 for (const CreditCard& card : cards) {
332 if (card.record_type() != CreditCard::FULL_SERVER_CARD) 331 if (card.record_type() != CreditCard::FULL_SERVER_CARD)
333 continue; 332 continue;
334 333
335 table->UnmaskServerCreditCard(card, card.number()); 334 table->UnmaskServerCreditCard(card, card.number());
336 } 335 }
337 } 336 }
(...skipping 20 matching lines...) Expand all
358 const char* control_type) { 357 const char* control_type) {
359 field->set_signature(signature); 358 field->set_signature(signature);
360 if (name) 359 if (name)
361 field->set_name(name); 360 field->set_name(name);
362 if (control_type) 361 if (control_type)
363 field->set_type(control_type); 362 field->set_type(control_type);
364 } 363 }
365 364
366 } // namespace test 365 } // namespace test
367 } // namespace autofill 366 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_sync_constants.cc ('k') | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698