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

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

Issue 1080883002: Remove some more bad ASCII-centric autofill code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 5 years, 8 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
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/guid.h" 6 #include "base/guid.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/autofill/core/browser/autofill_test_utils.h" 8 #include "components/autofill/core/browser/autofill_test_utils.h"
9 #include "components/autofill/core/browser/autofill_type.h" 9 #include "components/autofill/core/browser/autofill_type.h"
10 #include "components/autofill/core/browser/credit_card.h" 10 #include "components/autofill/core/browser/credit_card.h"
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 card.SetInfo( 440 card.SetInfo(
441 AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("January"), "en-US"); 441 AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("January"), "en-US");
442 EXPECT_EQ(ASCIIToUTF16("01"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); 442 EXPECT_EQ(ASCIIToUTF16("01"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH));
443 EXPECT_EQ(1, card.expiration_month()); 443 EXPECT_EQ(1, card.expiration_month());
444 444
445 card.SetInfo( 445 card.SetInfo(
446 AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("Apr"), "en-US"); 446 AutofillType(CREDIT_CARD_EXP_MONTH), ASCIIToUTF16("Apr"), "en-US");
447 EXPECT_EQ(ASCIIToUTF16("04"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); 447 EXPECT_EQ(ASCIIToUTF16("04"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH));
448 EXPECT_EQ(4, card.expiration_month()); 448 EXPECT_EQ(4, card.expiration_month());
449 449
450 card.SetInfo( 450 card.SetInfo(AutofillType(CREDIT_CARD_EXP_MONTH),
451 AutofillType(CREDIT_CARD_EXP_MONTH), UTF8ToUTF16("F\xc3\x89VRIER"), 451 UTF8ToUTF16("FÉVRIER"), "fr-FR");
452 "fr-FR");
453 EXPECT_EQ(ASCIIToUTF16("02"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH)); 452 EXPECT_EQ(ASCIIToUTF16("02"), card.GetRawInfo(CREDIT_CARD_EXP_MONTH));
454 EXPECT_EQ(2, card.expiration_month()); 453 EXPECT_EQ(2, card.expiration_month());
455 } 454 }
456 455
457 TEST(CreditCardTest, CreditCardType) { 456 TEST(CreditCardTest, CreditCardType) {
458 CreditCard card(base::GenerateGUID(), "https://www.example.com/"); 457 CreditCard card(base::GenerateGUID(), "https://www.example.com/");
459 458
460 // The card type cannot be set directly. 459 // The card type cannot be set directly.
461 card.SetRawInfo(CREDIT_CARD_TYPE, ASCIIToUTF16("Visa")); 460 card.SetRawInfo(CREDIT_CARD_TYPE, ASCIIToUTF16("Visa"));
462 EXPECT_EQ(base::string16(), card.GetRawInfo(CREDIT_CARD_TYPE)); 461 EXPECT_EQ(base::string16(), card.GetRawInfo(CREDIT_CARD_TYPE));
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 base::string16 card_number = base::ASCIIToUTF16("test"); 657 base::string16 card_number = base::ASCIIToUTF16("test");
659 int month = 1; 658 int month = 1;
660 int year = 3000; 659 int year = 3000;
661 CreditCard card(card_number, month, year); 660 CreditCard card(card_number, month, year);
662 EXPECT_EQ(card_number, card.number()); 661 EXPECT_EQ(card_number, card.number());
663 EXPECT_EQ(month, card.expiration_month()); 662 EXPECT_EQ(month, card.expiration_month());
664 EXPECT_EQ(year, card.expiration_year()); 663 EXPECT_EQ(year, card.expiration_year());
665 } 664 }
666 665
667 } // namespace autofill 666 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698