Index: Source/platform/network/HTTPParsersTest.cpp |
diff --git a/Source/platform/network/HTTPParsersTest.cpp b/Source/platform/network/HTTPParsersTest.cpp |
index 0431b3f13dbc59bf322202c750f3e0d3df0a0573..ab57dfc66e04e3e99d1576e4e3f854f608e3ebe7 100644 |
--- a/Source/platform/network/HTTPParsersTest.cpp |
+++ b/Source/platform/network/HTTPParsersTest.cpp |
@@ -239,5 +239,29 @@ TEST(HTTPParsersTest, CommaDelimitedHeaderSet) |
EXPECT_TRUE(set2.contains("fo\to")); |
} |
+TEST(HTTPParsersTest, HTTPFieldContent) |
+{ |
+ const UChar hiraganaA[2] = { 0x3042, 0 }; |
+ |
+ EXPECT_TRUE(blink::isValidHTTPFieldContentRFC7230("\xd0\xa1")); |
+ EXPECT_TRUE(blink::isValidHTTPFieldContentRFC7230("t t")); |
+ EXPECT_TRUE(blink::isValidHTTPFieldContentRFC7230("t\tt")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230(" ")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("\x7f")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("t\rt")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("t\nt")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("t\bt")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("t\vt")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230(" t")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("t ")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230(String("t\0t", 3))); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230(String("\0", 1))); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230(String("test \0, 6"))); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230(String("test "))); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230("test\r\n data")); |
+ EXPECT_FALSE(blink::isValidHTTPFieldContentRFC7230(String(hiraganaA))); |
+} |
+ |
} // namespace blink |