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

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

Issue 261993006: Modified to allow to preserve two-word string in first-name and last-name in autofill profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added case-insensativity handling for autofill nameinfo and unit-tests. Created 6 years, 6 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
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/contact_info.h" 5 #include "components/autofill/core/browser/contact_info.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/autofill/core/browser/autofill_type.h" 10 #include "components/autofill/core/browser/autofill_type.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 name.SetRawInfo(NAME_FIRST, ASCIIToUTF16("First")); 98 name.SetRawInfo(NAME_FIRST, ASCIIToUTF16("First"));
99 name.SetRawInfo(NAME_MIDDLE, ASCIIToUTF16("Middle")); 99 name.SetRawInfo(NAME_MIDDLE, ASCIIToUTF16("Middle"));
100 name.SetRawInfo(NAME_LAST, ASCIIToUTF16("Last")); 100 name.SetRawInfo(NAME_LAST, ASCIIToUTF16("Last"));
101 EXPECT_EQ(name.GetRawInfo(NAME_FIRST), ASCIIToUTF16("First")); 101 EXPECT_EQ(name.GetRawInfo(NAME_FIRST), ASCIIToUTF16("First"));
102 EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), ASCIIToUTF16("Middle")); 102 EXPECT_EQ(name.GetRawInfo(NAME_MIDDLE), ASCIIToUTF16("Middle"));
103 EXPECT_EQ(name.GetRawInfo(NAME_LAST), ASCIIToUTF16("Last")); 103 EXPECT_EQ(name.GetRawInfo(NAME_LAST), ASCIIToUTF16("Last"));
104 EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("First Middle Last")); 104 EXPECT_EQ(name.GetRawInfo(NAME_FULL), ASCIIToUTF16("First Middle Last"));
105 } 105 }
106 106
107 TEST(NameInfoTest, Compare) {
108 NameInfo a, b;
109 a.SetRawInfo(NAME_FIRST, ASCIIToUTF16("First"));
110 a.SetRawInfo(NAME_MIDDLE, ASCIIToUTF16("Middle"));
111 a.SetRawInfo(NAME_LAST, ASCIIToUTF16("Last"));
112
113 // Result of assignment should be logically equal to the original NameInfo.
114 b = a;
115 EXPECT_TRUE(a == b);
116
117 // a{first|middle|last} is not equal to b{first||middle last}
118 a.SetRawInfo(NAME_FULL, ASCIIToUTF16("First Middle Last"));
119 b.SetRawInfo(NAME_FIRST, ASCIIToUTF16("First"));
120 b.SetRawInfo(NAME_MIDDLE, base::string16());
121 b.SetRawInfo(NAME_LAST, ASCIIToUTF16("Middle Last"));
122 EXPECT_TRUE(a != b);
123
124 // Case insensitive compare, upper-case the first name and last name.
125 b.SetRawInfo(NAME_FULL, ASCIIToUTF16("FIRST Middle LAST"));
126 EXPECT_TRUE(a == b);
127 }
107 } // namespace autofill 128 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698