| 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..60c5010b3166f4bee473a63d577cac0656630da9 100644
|
| --- a/components/autofill/core/common/autofill_util_unittest.cc
|
| +++ b/components/autofill/core/common/autofill_util_unittest.cc
|
| @@ -99,4 +99,33 @@ TEST(AutofillUtilTest, GetTextSelectionStart) {
|
| }
|
| }
|
|
|
| +// Tests for LowercaseAndTokenizeAttributeString
|
| +TEST(AutofillUtilTest, LowercaseAndTokenizeAttributeString) {
|
| + 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 ", std::vector<std::string>()},
|
| + {"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(kTestCases[i].tokens,
|
| + LowercaseAndTokenizeAttributeString(kTestCases[i].attribute));
|
| + }
|
| +}
|
| } // namespace autofill
|
|
|