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

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

Issue 1626853005: [Autofill] Trim expiration month select values before converting them to months. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more comments Created 4 years, 10 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/autofill_field.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 "components/autofill/core/browser/autofill_field.h" 5 #include "components/autofill/core/browser/autofill_field.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 TEST_F(AutofillFieldTest, FillSelectControlWithExpirationMonth) { 463 TEST_F(AutofillFieldTest, FillSelectControlWithExpirationMonth) {
464 typedef struct { 464 typedef struct {
465 std::vector<const char*> select_values; 465 std::vector<const char*> select_values;
466 std::vector<const char*> select_contents; 466 std::vector<const char*> select_contents;
467 } TestCase; 467 } TestCase;
468 468
469 TestCase test_cases[] = { 469 TestCase test_cases[] = {
470 // Values start at 1. 470 // Values start at 1.
471 {{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, 471 {{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
472 NotNumericMonthsContentsNoPlaceholder()}, 472 NotNumericMonthsContentsNoPlaceholder()},
473 // Values start at 1 but single digits are whitespace padded!
474 {{" 1", " 2", " 3", " 4", " 5", " 6", " 7", " 8", " 9", "10", "11", "12"},
475 NotNumericMonthsContentsNoPlaceholder()},
473 // Values start at 0. 476 // Values start at 0.
474 {{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"}, 477 {{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"},
475 NotNumericMonthsContentsNoPlaceholder()}, 478 NotNumericMonthsContentsNoPlaceholder()},
476 // Values start at 00. 479 // Values start at 00.
477 {{"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11"}, 480 {{"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11"},
478 NotNumericMonthsContentsNoPlaceholder()}, 481 NotNumericMonthsContentsNoPlaceholder()},
479 // Values start at 0 and the first content is a placeholder. 482 // Values start at 0 and the first content is a placeholder.
480 {{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}, 483 {{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"},
481 NotNumericMonthsContentsWithPlaceholder()}, 484 NotNumericMonthsContentsWithPlaceholder()},
482 // Values start at 1 and the first content is a placeholder. 485 // Values start at 1 and the first content is a placeholder.
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 index = kBadIndex; 810 index = kBadIndex;
808 ret = AutofillField::FindValueInSelectControl( 811 ret = AutofillField::FindValueInSelectControl(
809 field, UTF8ToUTF16("NoVaScOtIa"), &index); 812 field, UTF8ToUTF16("NoVaScOtIa"), &index);
810 EXPECT_TRUE(ret); 813 EXPECT_TRUE(ret);
811 EXPECT_EQ(2U, index); 814 EXPECT_EQ(2U, index);
812 } 815 }
813 } 816 }
814 817
815 } // namespace 818 } // namespace
816 } // namespace autofill 819 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_field.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698