OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/autofill/autofill_common_test.h" | 7 #include "chrome/browser/autofill/autofill_common_test.h" |
8 #include "chrome/browser/autofill/credit_card.h" | 8 #include "chrome/browser/autofill/credit_card.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 // Verify that we preserve exactly what the user typed for credit card numbers. | 128 // Verify that we preserve exactly what the user typed for credit card numbers. |
129 TEST(CreditCardTest, SetInfoCreditCardNumber) { | 129 TEST(CreditCardTest, SetInfoCreditCardNumber) { |
130 CreditCard card; | 130 CreditCard card; |
131 | 131 |
132 autofill_test::SetCreditCardInfo(&card, "Bob Dylan", | 132 autofill_test::SetCreditCardInfo(&card, "Bob Dylan", |
133 "4321-5432-6543-xxxx", "07", "2013"); | 133 "4321-5432-6543-xxxx", "07", "2013"); |
134 EXPECT_EQ(ASCIIToUTF16("4321-5432-6543-xxxx"), | 134 EXPECT_EQ(ASCIIToUTF16("4321-5432-6543-xxxx"), |
135 card.GetInfo(CREDIT_CARD_NUMBER)); | 135 card.GetInfo(CREDIT_CARD_NUMBER)); |
136 } | 136 } |
| 137 |
| 138 // Verify that we can handle both numeric and named months. |
| 139 TEST(CreditCardTest, SetInfoExpirationMonth) { |
| 140 CreditCard card; |
| 141 |
| 142 card.SetInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("05")); |
| 143 EXPECT_EQ(ASCIIToUTF16("05"), card.GetInfo(CREDIT_CARD_EXP_MONTH)); |
| 144 |
| 145 card.SetInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("7")); |
| 146 EXPECT_EQ(ASCIIToUTF16("07"), card.GetInfo(CREDIT_CARD_EXP_MONTH)); |
| 147 |
| 148 card.SetInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("January")); |
| 149 EXPECT_EQ(ASCIIToUTF16("01"), card.GetInfo(CREDIT_CARD_EXP_MONTH)); |
| 150 |
| 151 card.SetInfo(CREDIT_CARD_EXP_MONTH, ASCIIToUTF16("Apr")); |
| 152 EXPECT_EQ(ASCIIToUTF16("04"), card.GetInfo(CREDIT_CARD_EXP_MONTH)); |
| 153 } |
OLD | NEW |