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

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

Issue 1694443004: [Autofill] Add credit card first and last name heuristics predictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/autofill/core/browser/autofill_data_util.h"
6
7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace autofill {
11 namespace data_util {
12
13 TEST(AutofillDataUtilTest, SplitName) {
14 typedef struct {
15 std::string full_name;
16 std::string given_name;
17 std::string middle_name;
18 std::string family_name;
19
20 } TestCase;
21
22 TestCase test_cases[] = {
23 // Full name including given, middle and family names.
24 {"Homer Jay Simpson", "Homer", "Jay", "Simpson"},
25 // No middle name.
26 {"Moe Szyslak", "Moe", "", "Szyslak"},
27 // Common name prefixes removed.
28 {"Reverend Timothy Lovejoy", "Timothy", "", "Lovejoy"},
29 // Common name suffixes removed.
30 {"John Frink Phd", "John", "", "Frink"},
31 // Exception to the name suffix removal.
32 {"John Ma", "John", "", "Ma"},
33 // Common family name prefixes not considered a middle name.
34 {"Milhouse Van Houten", "Milhouse", "", "Van Houten"}};
35
36 for (TestCase test_case : test_cases) {
37 NameParts name_parts = SplitName(base::UTF8ToUTF16(test_case.full_name));
38
39 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.family_name), name_parts.family);
42 }
43 }
44
45 } // namespace data_util
46 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_data_util.cc ('k') | components/autofill/core/browser/autofill_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698