| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "components/autofill/core/browser/validation.h" | 10 #include "components/autofill/core/browser/validation.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 "6011 0009 9013 9424", | 37 "6011 0009 9013 9424", |
| 38 "3530-1113-3330-0000", | 38 "3530-1113-3330-0000", |
| 39 "3566002020360505", | 39 "3566002020360505", |
| 40 "5555 5555 5555 4444", | 40 "5555 5555 5555 4444", |
| 41 "5105-1051-0510-5100", | 41 "5105-1051-0510-5100", |
| 42 "4111111111111111", | 42 "4111111111111111", |
| 43 "4012 8888 8888 1881", | 43 "4012 8888 8888 1881", |
| 44 "4222-2222-2222-2", | 44 "4222-2222-2222-2", |
| 45 "5019717010103742", | 45 "5019717010103742", |
| 46 "6331101999990016", | 46 "6331101999990016", |
| 47 | 47 "6247130048162403", |
| 48 // A UnionPay card that doesn't pass the Luhn checksum | |
| 49 "6200000000000000", | |
| 50 }; | 48 }; |
| 51 const char* const kInvalidNumbers[] = { | 49 const char* const kInvalidNumbers[] = { |
| 52 "4111 1111 112", /* too short */ | 50 "4111 1111 112", /* too short */ |
| 53 "41111111111111111115", /* too long */ | 51 "41111111111111111115", /* too long */ |
| 54 "4111-1111-1111-1110", /* wrong Luhn checksum */ | 52 "4111-1111-1111-1110", /* wrong Luhn checksum */ |
| 55 "3056 9309 0259 04aa", /* non-digit characters */ | 53 "3056 9309 0259 04aa", /* non-digit characters */ |
| 56 }; | 54 }; |
| 57 const char kCurrentDate[]="1 May 2013"; | 55 const char kCurrentDate[]="1 May 2013"; |
| 58 const IntExpirationDate kValidCreditCardIntExpirationDate[] = { | 56 const IntExpirationDate kValidCreditCardIntExpirationDate[] = { |
| 59 { 2013, 5 }, // Valid month in current year. | 57 { 2013, 5 }, // Valid month in current year. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kAmericanExpressCard))); | 153 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kAmericanExpressCard))); |
| 156 EXPECT_FALSE(IsValidCreditCardSecurityCode( | 154 EXPECT_FALSE(IsValidCreditCardSecurityCode( |
| 157 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kVisaCard))); | 155 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kVisaCard))); |
| 158 EXPECT_TRUE(IsValidCreditCardSecurityCode( | 156 EXPECT_TRUE(IsValidCreditCardSecurityCode( |
| 159 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kInvalidNumbers[0]))); | 157 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kInvalidNumbers[0]))); |
| 160 EXPECT_FALSE(IsValidCreditCardSecurityCode( | 158 EXPECT_FALSE(IsValidCreditCardSecurityCode( |
| 161 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kInvalidNumbers[0]))); | 159 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kInvalidNumbers[0]))); |
| 162 } | 160 } |
| 163 | 161 |
| 164 } // namespace autofill | 162 } // namespace autofill |
| OLD | NEW |