| OLD | NEW |
| 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/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 false}, | 211 false}, |
| 212 | 212 |
| 213 // Different names. | 213 // Different names. |
| 214 {{"Marion", "Mitchell", "Morrison"}, {"Marion", "M.", "Morrison"}, false}, | 214 {{"Marion", "Mitchell", "Morrison"}, {"Marion", "M.", "Morrison"}, false}, |
| 215 {{"Marion", "Mitchell", "Morrison"}, {"MARION", "M.", "MORRISON"}, false}, | 215 {{"Marion", "Mitchell", "Morrison"}, {"MARION", "M.", "MORRISON"}, false}, |
| 216 {{"Marion", "Mitchell", "Morrison"}, | 216 {{"Marion", "Mitchell", "Morrison"}, |
| 217 {"David", "Mitchell", "Morrison"}, | 217 {"David", "Mitchell", "Morrison"}, |
| 218 false}, | 218 false}, |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { | 221 for (size_t i = 0; i < arraysize(test_cases); ++i) { |
| 222 SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i)); | 222 SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i)); |
| 223 | 223 |
| 224 // Construct the starting_profile. | 224 // Construct the starting_profile. |
| 225 NameInfo starting_profile; | 225 NameInfo starting_profile; |
| 226 starting_profile.SetRawInfo(NAME_FIRST, | 226 starting_profile.SetRawInfo(NAME_FIRST, |
| 227 ASCIIToUTF16(test_cases[i].starting_names[0])); | 227 ASCIIToUTF16(test_cases[i].starting_names[0])); |
| 228 starting_profile.SetRawInfo(NAME_MIDDLE, | 228 starting_profile.SetRawInfo(NAME_MIDDLE, |
| 229 ASCIIToUTF16(test_cases[i].starting_names[1])); | 229 ASCIIToUTF16(test_cases[i].starting_names[1])); |
| 230 starting_profile.SetRawInfo(NAME_LAST, | 230 starting_profile.SetRawInfo(NAME_LAST, |
| 231 ASCIIToUTF16(test_cases[i].starting_names[2])); | 231 ASCIIToUTF16(test_cases[i].starting_names[2])); |
| 232 | 232 |
| 233 // Construct the additional_profile. | 233 // Construct the additional_profile. |
| 234 NameInfo additional_profile; | 234 NameInfo additional_profile; |
| 235 additional_profile.SetRawInfo( | 235 additional_profile.SetRawInfo( |
| 236 NAME_FIRST, ASCIIToUTF16(test_cases[i].additional_names[0])); | 236 NAME_FIRST, ASCIIToUTF16(test_cases[i].additional_names[0])); |
| 237 additional_profile.SetRawInfo( | 237 additional_profile.SetRawInfo( |
| 238 NAME_MIDDLE, ASCIIToUTF16(test_cases[i].additional_names[1])); | 238 NAME_MIDDLE, ASCIIToUTF16(test_cases[i].additional_names[1])); |
| 239 additional_profile.SetRawInfo( | 239 additional_profile.SetRawInfo( |
| 240 NAME_LAST, ASCIIToUTF16(test_cases[i].additional_names[2])); | 240 NAME_LAST, ASCIIToUTF16(test_cases[i].additional_names[2])); |
| 241 | 241 |
| 242 // Verify the test expectations. | 242 // Verify the test expectations. |
| 243 EXPECT_EQ(test_cases[i].expected_result, | 243 EXPECT_EQ(test_cases[i].expected_result, |
| 244 starting_profile.ParsedNamesAreEqual(additional_profile)); | 244 starting_profile.ParsedNamesAreEqual(additional_profile)); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 } // namespace autofill | 248 } // namespace autofill |
| OLD | NEW |