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 (size_t i = 0; i < arraysize(full_name_test_cases); ++i) { | 51 for (const FullNameTestCase& test_case : full_name_test_cases) { |
52 const FullNameTestCase& test_case = full_name_test_cases[i]; | |
53 SCOPED_TRACE(test_case.full_name_input); | 52 SCOPED_TRACE(test_case.full_name_input); |
54 | 53 |
55 NameInfo name; | 54 NameInfo name; |
56 name.SetInfo(AutofillType(NAME_FULL), | 55 name.SetInfo(AutofillType(NAME_FULL), |
57 ASCIIToUTF16(test_case.full_name_input), | 56 ASCIIToUTF16(test_case.full_name_input), |
58 "en-US"); | 57 "en-US"); |
59 EXPECT_EQ(ASCIIToUTF16(test_case.given_name_output), | 58 EXPECT_EQ(ASCIIToUTF16(test_case.given_name_output), |
60 name.GetInfo(AutofillType(NAME_FIRST), "en-US")); | 59 name.GetInfo(AutofillType(NAME_FIRST), "en-US")); |
61 EXPECT_EQ(ASCIIToUTF16(test_case.middle_name_output), | 60 EXPECT_EQ(ASCIIToUTF16(test_case.middle_name_output), |
62 name.GetInfo(AutofillType(NAME_MIDDLE), "en-US")); | 61 name.GetInfo(AutofillType(NAME_MIDDLE), "en-US")); |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 name.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16(test_cases[i].middle)); | 373 name.SetRawInfo(NAME_MIDDLE, UTF8ToUTF16(test_cases[i].middle)); |
375 name.SetRawInfo(NAME_LAST, UTF8ToUTF16(test_cases[i].last)); | 374 name.SetRawInfo(NAME_LAST, UTF8ToUTF16(test_cases[i].last)); |
376 name.SetRawInfo(NAME_FULL, UTF8ToUTF16(test_cases[i].full)); | 375 name.SetRawInfo(NAME_FULL, UTF8ToUTF16(test_cases[i].full)); |
377 | 376 |
378 // Verify the test expectations. | 377 // Verify the test expectations. |
379 EXPECT_EQ(test_cases[i].expected_result, name.NamePartsAreEmpty()); | 378 EXPECT_EQ(test_cases[i].expected_result, name.NamePartsAreEmpty()); |
380 } | 379 } |
381 } | 380 } |
382 | 381 |
383 } // namespace autofill | 382 } // namespace autofill |
OLD | NEW |