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

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

Issue 2424793002: Revert of Replace for loops with |arraysize| with for each loops (Closed)
Patch Set: Created 4 years, 2 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 30 matching lines...) Expand all
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
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
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_profile.cc ('k') | components/autofill/core/browser/credit_card.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698