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

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

Issue 1868003003: Preserving first/middle/last names when an Autofill profile is submitted (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing stevenjb nits Created 4 years, 8 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_data_util.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_data_util.h" 5 #include "components/autofill/core/browser/autofill_data_util.h"
6 6
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 "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
9 10
10 namespace autofill { 11 namespace autofill {
11 namespace data_util { 12 namespace data_util {
12 13
13 TEST(AutofillDataUtilTest, SplitName) { 14 TEST(AutofillDataUtilTest, SplitName) {
14 typedef struct { 15 typedef struct {
15 std::string full_name; 16 std::string full_name;
16 std::string given_name; 17 std::string given_name;
17 std::string middle_name; 18 std::string middle_name;
(...skipping 17 matching lines...) Expand all
35 36
36 for (TestCase test_case : test_cases) { 37 for (TestCase test_case : test_cases) {
37 NameParts name_parts = SplitName(base::UTF8ToUTF16(test_case.full_name)); 38 NameParts name_parts = SplitName(base::UTF8ToUTF16(test_case.full_name));
38 39
39 EXPECT_EQ(base::UTF8ToUTF16(test_case.given_name), name_parts.given); 40 EXPECT_EQ(base::UTF8ToUTF16(test_case.given_name), name_parts.given);
40 EXPECT_EQ(base::UTF8ToUTF16(test_case.middle_name), name_parts.middle); 41 EXPECT_EQ(base::UTF8ToUTF16(test_case.middle_name), name_parts.middle);
41 EXPECT_EQ(base::UTF8ToUTF16(test_case.family_name), name_parts.family); 42 EXPECT_EQ(base::UTF8ToUTF16(test_case.family_name), name_parts.family);
42 } 43 }
43 } 44 }
44 45
46 TEST(AutofillDataUtilTest, ProfileMatchesFullName) {
47 autofill::AutofillProfile profile;
48 autofill::test::SetProfileInfo(
49 &profile, "First", "Middle", "Last", "fml@example.com", "Acme inc",
50 "123 Main", "Apt 2", "Laredo", "TX", "77300", "US", "832-555-1000");
51
52 EXPECT_TRUE(ProfileMatchesFullName(base::UTF8ToUTF16("First Last"), profile));
53
54 EXPECT_TRUE(
55 ProfileMatchesFullName(base::UTF8ToUTF16("First Middle Last"), profile));
56
57 EXPECT_TRUE(
58 ProfileMatchesFullName(base::UTF8ToUTF16("First M Last"), profile));
59
60 EXPECT_TRUE(
61 ProfileMatchesFullName(base::UTF8ToUTF16("First M. Last"), profile));
62
63 EXPECT_FALSE(
64 ProfileMatchesFullName(base::UTF8ToUTF16("Kirby Puckett"), profile));
65 }
66
45 } // namespace data_util 67 } // namespace data_util
46 } // namespace autofill 68 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_data_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698