| 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 <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 30 matching lines...) Expand all Loading... |
| 41 { "John Smith, MA", "John", "", "Smith" }, | 41 { "John Smith, MA", "John", "", "Smith" }, |
| 42 { "John Jacob Jingleheimer Smith", "John Jacob", "Jingleheimer", "Smith" }, | 42 { "John Jacob Jingleheimer Smith", "John Jacob", "Jingleheimer", "Smith" }, |
| 43 { "Virgil", "Virgil", "", "" }, | 43 { "Virgil", "Virgil", "", "" }, |
| 44 { "Murray Gell-Mann", "Murray", "", "Gell-Mann" }, | 44 { "Murray Gell-Mann", "Murray", "", "Gell-Mann" }, |
| 45 { "Mikhail Yevgrafovich Saltykov-Shchedrin", "Mikhail", "Yevgrafovich", | 45 { "Mikhail Yevgrafovich Saltykov-Shchedrin", "Mikhail", "Yevgrafovich", |
| 46 "Saltykov-Shchedrin" }, | 46 "Saltykov-Shchedrin" }, |
| 47 { "Arthur Ignatius Conan Doyle", "Arthur Ignatius", "Conan", "Doyle" }, | 47 { "Arthur Ignatius Conan Doyle", "Arthur Ignatius", "Conan", "Doyle" }, |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 TEST(NameInfoTest, SetFullName) { | 50 TEST(NameInfoTest, SetFullName) { |
| 51 for (const FullNameTestCase& test_case : full_name_test_cases) { | 51 for (size_t i = 0; i < arraysize(full_name_test_cases); ++i) { |
| 52 const FullNameTestCase& test_case = full_name_test_cases[i]; |
| 52 SCOPED_TRACE(test_case.full_name_input); | 53 SCOPED_TRACE(test_case.full_name_input); |
| 53 | 54 |
| 54 NameInfo name; | 55 NameInfo name; |
| 55 name.SetInfo(AutofillType(NAME_FULL), | 56 name.SetInfo(AutofillType(NAME_FULL), |
| 56 ASCIIToUTF16(test_case.full_name_input), | 57 ASCIIToUTF16(test_case.full_name_input), |
| 57 "en-US"); | 58 "en-US"); |
| 58 EXPECT_EQ(ASCIIToUTF16(test_case.given_name_output), | 59 EXPECT_EQ(ASCIIToUTF16(test_case.given_name_output), |
| 59 name.GetInfo(AutofillType(NAME_FIRST), "en-US")); | 60 name.GetInfo(AutofillType(NAME_FIRST), "en-US")); |
| 60 EXPECT_EQ(ASCIIToUTF16(test_case.middle_name_output), | 61 EXPECT_EQ(ASCIIToUTF16(test_case.middle_name_output), |
| 61 name.GetInfo(AutofillType(NAME_MIDDLE), "en-US")); | 62 name.GetInfo(AutofillType(NAME_MIDDLE), "en-US")); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 name.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16(test_cases[i].middle)); | 374 name.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16(test_cases[i].middle)); |
| 374 name.SetRawInfo(NAME_LAST, UTF8ToUTF16(test_cases[i].last)); | 375 name.SetRawInfo(NAME_LAST, UTF8ToUTF16(test_cases[i].last)); |
| 375 name.SetRawInfo(NAME_FULL, UTF8ToUTF16(test_cases[i].full)); | 376 name.SetRawInfo(NAME_FULL, UTF8ToUTF16(test_cases[i].full)); |
| 376 | 377 |
| 377 // Verify the test expectations. | 378 // Verify the test expectations. |
| 378 EXPECT_EQ(test_cases[i].expected_result, name.NamePartsAreEmpty()); | 379 EXPECT_EQ(test_cases[i].expected_result, name.NamePartsAreEmpty()); |
| 379 } | 380 } |
| 380 } | 381 } |
| 381 | 382 |
| 382 } // namespace autofill | 383 } // namespace autofill |
| OLD | NEW |