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

Unified Diff: net/http/http_util_unittest.cc

Issue 73633002: Add more test cases for HttpUtil::PathForRequest() and SpecForRequest() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_util_unittest.cc
diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc
index fe2d8b47496ea29b529596d65dd3e22e9e54e8e7..54acf68d3c3d52c3bc28aa4b0f9ee3603ac098cd 100644
--- a/net/http/http_util_unittest.cc
+++ b/net/http/http_util_unittest.cc
@@ -612,6 +612,21 @@ TEST(HttpUtilTest, RequestUrlSanitize) {
"http://user:pass@google.com",
"http://google.com/",
"/"
+ },
+ { // https scheme
+ "https://www.google.com:78/foobar?query=1#hash",
+ "https://www.google.com:78/foobar?query=1",
+ "/foobar?query=1"
+ },
+ { // WebSocket's ws scheme
+ "ws://www.google.com:78/foobar?query=1#hash",
+ "ws://www.google.com:78/foobar?query=1",
+ "/foobar?query=1"
+ },
+ { // WebSocket's wss scheme
+ "wss://www.google.com:78/foobar?query=1#hash",
+ "wss://www.google.com:78/foobar?query=1",
+ "/foobar?query=1"
}
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) {
@@ -624,6 +639,13 @@ TEST(HttpUtilTest, RequestUrlSanitize) {
}
}
+// Test SpecForRequest() for "ftp" scheme.
+TEST(HttpUtilTest, SpecForRequestForUrlWithFtpScheme) {
+ GURL ftp_url("ftp://user:pass@google.com/pub/chromium/");
+ EXPECT_EQ("ftp://google.com/pub/chromium/",
+ HttpUtil::SpecForRequest(ftp_url));
+}
+
TEST(HttpUtilTest, GenerateAcceptLanguageHeader) {
EXPECT_EQ(std::string("en-US,fr;q=0.8,de;q=0.6"),
HttpUtil::GenerateAcceptLanguageHeader("en-US,fr,de"));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698