Chromium Code Reviews| 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 823be3d4fe068ce6d2600f75e48762970aea2c18..b97f58c0090f4accca3b365bc678b065b7742085 100644 |
| --- a/components/autofill/core/common/autofill_util_unittest.cc |
| +++ b/components/autofill/core/common/autofill_util_unittest.cc |
| @@ -99,4 +99,35 @@ TEST(AutofillUtilTest, GetTextSelectionStart) { |
| } |
| } |
| +// Tests for LowercaseAndTokenizeAttributeString |
| +TEST(AutofillUtilTest, LowercaseAndTokenizeAttributeString) { |
| + const std::vector<std::string> empty_vector; |
|
vabr (Chromium)
2016/10/13 12:49:31
nit: Constants have a different naming scheme. Her
jdoerrie
2016/10/13 13:45:07
Done.
|
| + |
| + const struct { |
| + const char* const attribute; |
| + std::vector<std::string> tokens; |
| + } kTestCases[] = { |
| + // Test leading and trailing whitespace, test tabs and newlines |
| + {"foo bar baz", {"foo", "bar", "baz"}}, |
| + {" foo bar baz ", {"foo", "bar", "baz"}}, |
| + {"foo\tbar baz ", {"foo", "bar", "baz"}}, |
| + {"foo\nbar baz ", {"foo", "bar", "baz"}}, |
| + |
| + // Test different forms of capitalization |
| + {"FOO BAR BAZ", {"foo", "bar", "baz"}}, |
| + {"foO baR bAz", {"foo", "bar", "baz"}}, |
| + |
| + // Test collapsing of multiple whitespace characters in a row |
| + {" \t\t\n\n ", empty_vector}, |
| + {"foO baR bAz", {"foo", "bar", "baz"}}, |
| + }; |
| + |
| + for (size_t i = 0; i < arraysize(kTestCases); ++i) { |
| + SCOPED_TRACE(testing::Message() << "attribute = " |
| + << kTestCases[i].attribute); |
| + |
| + EXPECT_EQ(LowercaseAndTokenizeAttributeString(kTestCases[i].attribute), |
|
vabr (Chromium)
2016/10/13 12:49:31
nit: Please reverse the order of the arguments of
jdoerrie
2016/10/13 13:45:07
Done.
|
| + kTestCases[i].tokens); |
| + } |
| +} |
| } // namespace autofill |