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

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

Issue 1931123002: [Autofill] Make PersonalDataManager::OverwriteWith case sensitive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 std::string additional_names[3]; 181 std::string additional_names[3];
182 bool expected_result; 182 bool expected_result;
183 }; 183 };
184 184
185 struct TestCase test_cases[] = { 185 struct TestCase test_cases[] = {
186 // Identical name comparison. 186 // Identical name comparison.
187 {{"Marion", "Mitchell", "Morrison"}, 187 {{"Marion", "Mitchell", "Morrison"},
188 {"Marion", "Mitchell", "Morrison"}, 188 {"Marion", "Mitchell", "Morrison"},
189 true}, 189 true},
190 190
191 // Case-insensative comparisons. 191 // Case-sensitive comparisons.
192 {{"Marion", "Mitchell", "Morrison"}, 192 {{"Marion", "Mitchell", "Morrison"},
193 {"Marion", "Mitchell", "MORRISON"}, 193 {"Marion", "Mitchell", "MORRISON"},
194 true}, 194 false},
195 {{"Marion", "Mitchell", "Morrison"}, 195 {{"Marion", "Mitchell", "Morrison"},
196 {"MARION", "Mitchell", "MORRISON"}, 196 {"MARION", "Mitchell", "MORRISON"},
197 true}, 197 false},
198 {{"Marion", "Mitchell", "Morrison"}, 198 {{"Marion", "Mitchell", "Morrison"},
199 {"MARION", "MITCHELL", "MORRISON"}, 199 {"MARION", "MITCHELL", "MORRISON"},
200 true}, 200 false},
201 {{"Marion", "", "Mitchell Morrison"}, 201 {{"Marion", "", "Mitchell Morrison"},
202 {"MARION", "", "MITCHELL MORRISON"}, 202 {"MARION", "", "MITCHELL MORRISON"},
203 true}, 203 false},
204 {{"Marion Mitchell", "", "Morrison"}, 204 {{"Marion Mitchell", "", "Morrison"},
205 {"MARION MITCHELL", "", "MORRISON"}, 205 {"MARION MITCHELL", "", "MORRISON"},
206 true}, 206 false},
207 207
208 // Identical full names but different canonical forms. 208 // Identical full names but different canonical forms.
209 {{"Marion", "Mitchell", "Morrison"}, 209 {{"Marion", "Mitchell", "Morrison"},
210 {"Marion", "", "Mitchell Morrison"}, 210 {"Marion", "", "Mitchell Morrison"},
211 false}, 211 false},
212 {{"Marion", "Mitchell", "Morrison"}, 212 {{"Marion", "Mitchell", "Morrison"},
213 {"Marion Mitchell", "", "MORRISON"}, 213 {"Marion Mitchell", "", "MORRISON"},
214 false}, 214 false},
215 215
216 // Different names. 216 // Different names.
217 {{"Marion", "Mitchell", "Morrison"}, {"Marion", "M.", "Morrison"}, false}, 217 {{"Marion", "Mitchell", "Morrison"}, {"Marion", "M.", "Morrison"}, false},
218 {{"Marion", "Mitchell", "Morrison"}, {"MARION", "M.", "MORRISON"}, false}, 218 {{"Marion", "Mitchell", "Morrison"}, {"MARION", "M.", "MORRISON"}, false},
219 {{"Marion", "Mitchell", "Morrison"}, 219 {{"Marion", "Mitchell", "Morrison"},
220 {"David", "Mitchell", "Morrison"}, 220 {"David", "Mitchell", "Morrison"},
221 false}, 221 false},
222 222
223 // Non-ASCII characters. 223 // Non-ASCII characters.
224 {{"M\xc3\xa1rion Mitchell", "", "Morrison"}, 224 {{"M\xc3\xa1rion Mitchell", "", "Morrison"},
225 {"M\xc3\x81RION MITCHELL", "", "MORRISON"}, 225 {"M\xc3\xa1rion Mitchell", "", "Morrison"},
226 true}, 226 true},
227 }; 227 };
228 228
229 for (size_t i = 0; i < arraysize(test_cases); ++i) { 229 for (size_t i = 0; i < arraysize(test_cases); ++i) {
230 SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i)); 230 SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i));
231 231
232 // Construct the starting_profile. 232 // Construct the starting_profile.
233 NameInfo starting_profile; 233 NameInfo starting_profile;
234 starting_profile.SetRawInfo(NAME_FIRST, 234 starting_profile.SetRawInfo(NAME_FIRST,
235 UTF8ToUTF16(test_cases[i].starting_names[0])); 235 UTF8ToUTF16(test_cases[i].starting_names[0]));
(...skipping 11 matching lines...) Expand all
247 additional_profile.SetRawInfo( 247 additional_profile.SetRawInfo(
248 NAME_LAST, UTF8ToUTF16(test_cases[i].additional_names[2])); 248 NAME_LAST, UTF8ToUTF16(test_cases[i].additional_names[2]));
249 249
250 // Verify the test expectations. 250 // Verify the test expectations.
251 EXPECT_EQ(test_cases[i].expected_result, 251 EXPECT_EQ(test_cases[i].expected_result,
252 starting_profile.ParsedNamesAreEqual(additional_profile)); 252 starting_profile.ParsedNamesAreEqual(additional_profile));
253 } 253 }
254 } 254 }
255 255
256 } // namespace autofill 256 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/contact_info.cc ('k') | components/test/data/autofill/merge/input/addressLinesLessInfo.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698