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

Unified Diff: components/autofill/core/common/autofill_util_unittest.cc

Issue 2478463002: Reland of place for loops with |arraysize| with for each loops (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/common/autofill_regexes_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/common/autofill_util_unittest.cc
diff --git a/components/autofill/core/common/autofill_util_unittest.cc b/components/autofill/core/common/autofill_util_unittest.cc
index 60c5010b3166f4bee473a63d577cac0656630da9..2115b3ed3ab2d5f985c0e1b1cad6281ba0dbdfd8 100644
--- a/components/autofill/core/common/autofill_util_unittest.cc
+++ b/components/autofill/core/common/autofill_util_unittest.cc
@@ -49,17 +49,17 @@
{"ab", "", true, true},
};
- for (size_t i = 0; i < arraysize(kTestCases); ++i) {
+ for (const auto& test_case : kTestCases) {
SCOPED_TRACE(testing::Message()
- << "suggestion = " << kTestCases[i].field_suggestion
- << ", contents = " << kTestCases[i].field_contents
- << ", case_sensitive = " << kTestCases[i].case_sensitive);
+ << "suggestion = " << test_case.field_suggestion
+ << ", contents = " << test_case.field_contents
+ << ", case_sensitive = " << test_case.case_sensitive);
- EXPECT_EQ(kTestCases[i].expected_result,
+ EXPECT_EQ(test_case.expected_result,
FieldIsSuggestionSubstringStartingOnTokenBoundary(
- base::ASCIIToUTF16(kTestCases[i].field_suggestion),
- base::ASCIIToUTF16(kTestCases[i].field_contents),
- kTestCases[i].case_sensitive));
+ base::ASCIIToUTF16(test_case.field_suggestion),
+ base::ASCIIToUTF16(test_case.field_contents),
+ test_case.case_sensitive));
}
}
@@ -85,17 +85,17 @@
{"texample@example.com", "example", false, 16},
};
- for (size_t i = 0; i < arraysize(kTestCases); ++i) {
+ for (const auto& test_case : kTestCases) {
SCOPED_TRACE(testing::Message()
- << "suggestion = " << kTestCases[i].field_suggestion
- << ", contents = " << kTestCases[i].field_contents
- << ", case_sensitive = " << kTestCases[i].case_sensitive);
+ << "suggestion = " << test_case.field_suggestion
+ << ", contents = " << test_case.field_contents
+ << ", case_sensitive = " << test_case.case_sensitive);
- EXPECT_EQ(kTestCases[i].expected_start,
- GetTextSelectionStart(
- base::ASCIIToUTF16(kTestCases[i].field_suggestion),
- base::ASCIIToUTF16(kTestCases[i].field_contents),
- kTestCases[i].case_sensitive));
+ EXPECT_EQ(
+ test_case.expected_start,
+ GetTextSelectionStart(base::ASCIIToUTF16(test_case.field_suggestion),
+ base::ASCIIToUTF16(test_case.field_contents),
+ test_case.case_sensitive));
}
}
@@ -120,12 +120,11 @@
{"foO baR bAz", {"foo", "bar", "baz"}},
};
- for (size_t i = 0; i < arraysize(kTestCases); ++i) {
- SCOPED_TRACE(testing::Message() << "attribute = "
- << kTestCases[i].attribute);
+ for (const auto& test_case : kTestCases) {
+ SCOPED_TRACE(testing::Message() << "attribute = " << test_case.attribute);
- EXPECT_EQ(kTestCases[i].tokens,
- LowercaseAndTokenizeAttributeString(kTestCases[i].attribute));
+ EXPECT_EQ(test_case.tokens,
+ LowercaseAndTokenizeAttributeString(test_case.attribute));
}
}
} // namespace autofill
« no previous file with comments | « components/autofill/core/common/autofill_regexes_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698