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

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

Issue 2411333004: Make HasAutocompleteAttributeValue handle multi-valued strings (Closed)
Patch Set: Make HasAutocompleteAttributeValue handle multi-valued strings 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/autofill/core/common/autofill_util.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 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
« no previous file with comments | « components/autofill/core/common/autofill_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698