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

Unified Diff: third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp

Issue 2708043002: ParsedContentType parameter name matching should be case insensitive (Closed)
Patch Set: done Created 3 years, 10 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 | « third_party/WebKit/Source/platform/network/ParsedContentType.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp
diff --git a/third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp b/third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp
index e6ffdba4793da2f87947f7cb9e2729f171479ec0..7a40f21fec02b2ec4ed2a2eb4dae12ac30fa4d5e 100644
--- a/third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp
+++ b/third_party/WebKit/Source/platform/network/ParsedContentTypeTest.cpp
@@ -56,6 +56,14 @@ TEST(ParsedContentTypeTest, InvalidMimeTypeWithCharset) {
EXPECT_EQ(String(), t.charset());
}
+TEST(ParsedContentTypeTest, CaseInsensitiveCharset) {
+ ParsedContentType t("text/plain; cHaRsEt=utf-8");
+
+ EXPECT_TRUE(t.isValid());
+ EXPECT_EQ("text/plain", t.mimeType());
+ EXPECT_EQ("utf-8", t.charset());
+}
+
TEST(ParsedContentTypeTest, Validity) {
EXPECT_TRUE(isValid("text/plain"));
EXPECT_TRUE(isValid("text/plain; charset=utf-8"));
@@ -95,21 +103,23 @@ TEST(ParsedContentTypeTest, Validity) {
}
TEST(ParsedContentTypeTest, ParameterName) {
- String input = "x/t; y=z ; y= u ; t=r;s= \"t \\u\\\"x\" ;Q=U;T=S";
+ String input = "x/t; y=z ; y= u ; t=r;k= \"t \\u\\\"x\" ;Q=U;T=S";
ParsedContentType t(input);
EXPECT_TRUE(t.isValid());
- EXPECT_EQ(5u, t.parameterCount());
+ EXPECT_EQ(4u, t.parameterCount());
EXPECT_EQ(String(), t.parameterValueForName("a"));
EXPECT_EQ(String(), t.parameterValueForName("x"));
EXPECT_EQ("u", t.parameterValueForName("y"));
- EXPECT_EQ("r", t.parameterValueForName("t"));
- EXPECT_EQ("t u\"x", t.parameterValueForName("s"));
+ EXPECT_EQ("S", t.parameterValueForName("t"));
+ EXPECT_EQ("t u\"x", t.parameterValueForName("k"));
EXPECT_EQ("U", t.parameterValueForName("Q"));
EXPECT_EQ("S", t.parameterValueForName("T"));
- // TODO(yhirano): Case-sensitivity is mis-implemented.
+ String kelvin = String::fromUTF8("\xe2\x84\xaa");
+ DCHECK_EQ(kelvin.lower(), "k");
+ EXPECT_EQ(String(), t.parameterValueForName(kelvin));
}
TEST(ParsedContentTypeTest, RelaxedParameterName) {
« no previous file with comments | « third_party/WebKit/Source/platform/network/ParsedContentType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698