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

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

Issue 18927003: [Autofill] Don't validate China UnionPay cards with the Luhn checksum. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Parens for order of operations Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « components/autofill/core/browser/validation.cc ('k') | components/autofill_strings.grdp » ('j') | 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/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "base/time/time.h" 6 #include "base/time/time.h"
7 #include "components/autofill/core/browser/validation.h" 7 #include "components/autofill/core/browser/validation.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace autofill { 10 namespace autofill {
(...skipping 21 matching lines...) Expand all
32 "6011 0009 9013 9424", 32 "6011 0009 9013 9424",
33 "3530-1113-3330-0000", 33 "3530-1113-3330-0000",
34 "3566002020360505", 34 "3566002020360505",
35 "5555 5555 5555 4444", 35 "5555 5555 5555 4444",
36 "5105-1051-0510-5100", 36 "5105-1051-0510-5100",
37 "4111111111111111", 37 "4111111111111111",
38 "4012 8888 8888 1881", 38 "4012 8888 8888 1881",
39 "4222-2222-2222-2", 39 "4222-2222-2222-2",
40 "5019717010103742", 40 "5019717010103742",
41 "6331101999990016", 41 "6331101999990016",
42
43 // A UnionPay card that doesn't pass the Luhn checksum
44 "6200000000000000",
42 }; 45 };
43 const char* const kInvalidNumbers[] = { 46 const char* const kInvalidNumbers[] = {
44 "4111 1111 112", /* too short */ 47 "4111 1111 112", /* too short */
45 "41111111111111111115", /* too long */ 48 "41111111111111111115", /* too long */
46 "4111-1111-1111-1110", /* wrong Luhn checksum */ 49 "4111-1111-1111-1110", /* wrong Luhn checksum */
47 "3056 9309 0259 04aa", /* non-digit characters */ 50 "3056 9309 0259 04aa", /* non-digit characters */
48 }; 51 };
49 const char kCurrentDate[]="1 May 2013"; 52 const char kCurrentDate[]="1 May 2013";
50 const ExpirationDate kValidCreditCardExpirationDate[] = { 53 const ExpirationDate kValidCreditCardExpirationDate[] = {
51 { "2013", "5" }, // Valid month in current year. 54 { "2013", "5" }, // Valid month in current year.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kAmericanExpressCard))); 190 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kAmericanExpressCard)));
188 EXPECT_FALSE(autofill::IsValidCreditCardSecurityCode( 191 EXPECT_FALSE(autofill::IsValidCreditCardSecurityCode(
189 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kVisaCard))); 192 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kVisaCard)));
190 EXPECT_TRUE(autofill::IsValidCreditCardSecurityCode( 193 EXPECT_TRUE(autofill::IsValidCreditCardSecurityCode(
191 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kInvalidNumbers[0]))); 194 ASCIIToUTF16(kVisaCVC), ASCIIToUTF16(kInvalidNumbers[0])));
192 EXPECT_FALSE(autofill::IsValidCreditCardSecurityCode( 195 EXPECT_FALSE(autofill::IsValidCreditCardSecurityCode(
193 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kInvalidNumbers[0]))); 196 ASCIIToUTF16(kAmericanExpressCVC), ASCIIToUTF16(kInvalidNumbers[0])));
194 } 197 }
195 198
196 } // namespace autofill 199 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/validation.cc ('k') | components/autofill_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698