OLD | NEW |
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" |
11 #include "components/autofill/core/browser/validation.h" | 11 #include "components/autofill/core/browser/validation.h" |
12 #include "components/autofill/core/common/form_field_data.h" | 12 #include "components/autofill/core/common/form_field_data.h" |
13 #include "grit/webkit_resources.h" | 13 #include "grit/webkit_resources.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
| 16 using base::ASCIIToUTF16; |
| 17 |
16 namespace autofill { | 18 namespace autofill { |
17 namespace { | 19 namespace { |
18 | 20 |
19 // From https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card
_numbers.htm | 21 // From https://www.paypalobjects.com/en_US/vhelp/paypalmanager_help/credit_card
_numbers.htm |
20 const char* const kValidNumbers[] = { | 22 const char* const kValidNumbers[] = { |
21 "378282246310005", | 23 "378282246310005", |
22 "3714 4963 5398 431", | 24 "3714 4963 5398 431", |
23 "3787-3449-3671-000", | 25 "3787-3449-3671-000", |
24 "5610591081018250", | 26 "5610591081018250", |
25 "3056 9309 0259 04", | 27 "3056 9309 0259 04", |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 520 |
519 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 521 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { |
520 base::string16 card_number = ASCIIToUTF16(test_cases[i].card_number); | 522 base::string16 card_number = ASCIIToUTF16(test_cases[i].card_number); |
521 SCOPED_TRACE(card_number); | 523 SCOPED_TRACE(card_number); |
522 EXPECT_EQ(test_cases[i].type, CreditCard::GetCreditCardType(card_number)); | 524 EXPECT_EQ(test_cases[i].type, CreditCard::GetCreditCardType(card_number)); |
523 EXPECT_EQ(test_cases[i].is_valid, IsValidCreditCardNumber(card_number)); | 525 EXPECT_EQ(test_cases[i].is_valid, IsValidCreditCardNumber(card_number)); |
524 } | 526 } |
525 } | 527 } |
526 | 528 |
527 } // namespace autofill | 529 } // namespace autofill |
OLD | NEW |