diff options
author | tyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-29 19:59:30 +0000 |
---|---|---|
committer | tyoshino@chromium.org <tyoshino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-29 19:59:30 +0000 |
commit | 9b8da4a39ad6c94b2f464c418bf844cc3ede0d6d (patch) | |
tree | ab030963229f33dce196086fe6a09188b439e0ad /net/http/http_util_unittest.cc | |
parent | 3275e82423c2628ef0659500b8cebdac27ba2f40 (diff) | |
download | chromium_src-9b8da4a39ad6c94b2f464c418bf844cc3ede0d6d.zip chromium_src-9b8da4a39ad6c94b2f464c418bf844cc3ede0d6d.tar.gz chromium_src-9b8da4a39ad6c94b2f464c418bf844cc3ede0d6d.tar.bz2 |
Add more test cases for HttpUtil::PathForRequest() and SpecForRequest()
https://codereview.chromium.org/68213017/ made them able to handle
WebSocket schemes. Add tests to check that.
Bonus: some more non-WebSocket cases to increase coverage.
BUG=303568
Review URL: https://codereview.chromium.org/73633002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@237941 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_util_unittest.cc')
-rw-r--r-- | net/http/http_util_unittest.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/http/http_util_unittest.cc b/net/http/http_util_unittest.cc index fe2d8b4..54acf68 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")); |