Chromium Code Reviews| Index: net/websockets/websocket_stream_test.cc |
| diff --git a/net/websockets/websocket_stream_test.cc b/net/websockets/websocket_stream_test.cc |
| index 03a593de0e9a4b7c5f98f4fed36b65ed793a7554..c691199147802457734fb3b432bbade2010c5cf1 100644 |
| --- a/net/websockets/websocket_stream_test.cc |
| +++ b/net/websockets/websocket_stream_test.cc |
| @@ -124,6 +124,23 @@ class WebSocketStreamCreateTest : public ::testing::Test { |
| CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); |
| } |
| + void CreateAndConnectCustomResponseWithCookies( |
| + const std::string& socket_url, |
| + const std::string& socket_host, |
| + const std::string& socket_path, |
|
Ryan Sleevi
2015/01/24 04:13:07
Why is this not simply a single GURL?
[edit: I gu
Adam Rice
2015/01/26 06:38:59
Because then both the production code and the test
Ryan Sleevi
2015/01/27 00:47:22
I'm sorry, I don't understand this?
It's not your
Adam Rice
2015/01/27 06:32:46
In principle, yes. However, if the implementation
Ryan Sleevi
2015/01/27 22:28:10
Because quality matters. Because I've had to deal
|
| + const std::vector<std::string>& sub_protocols, |
| + const std::string& origin, |
| + const std::string& cookies, |
| + const std::string& extra_request_headers, |
| + const std::string& response_body, |
| + scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { |
| + url_request_context_host_.SetExpectations( |
| + WebSocketStandardRequestWithCookies(socket_path, socket_host, origin, |
| + cookies, extra_request_headers), |
| + response_body); |
| + CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); |
| + } |
| + |
| // |extra_request_headers| and |extra_response_headers| must end in "\r\n" or |
| // errors like "Unable to perform synchronous IO while stopped" will occur. |
| void CreateAndConnectStandard( |
| @@ -141,6 +158,25 @@ class WebSocketStreamCreateTest : public ::testing::Test { |
| WebSocketStandardResponse(extra_response_headers), timer.Pass()); |
| } |
| + // |cookies| must be empty or end with "\r\n". |
| + // |extra_request_headers| and |extra_response_headers| must end in "\r\n" or |
| + // errors like "Unable to perform synchronous IO while stopped" will occur. |
|
Ryan Sleevi
2015/01/24 04:13:08
Both of these seem undesirable. Can this be expres
Adam Rice
2015/01/26 06:38:59
How? We can't make compile-time assertions about t
Ryan Sleevi
2015/01/27 00:47:22
It seems entirely pointless to require "" or "some
Adam Rice
2015/01/27 06:32:46
That's logic. Logic requires tests. At some point
Ryan Sleevi
2015/01/27 22:28:10
I'm sorry, I really have to disagree with you on y
|
| + void CreateAndConnectStandardWithCookies( |
| + const std::string& socket_url, |
| + const std::string& socket_host, |
| + const std::string& socket_path, |
| + const std::vector<std::string>& sub_protocols, |
| + const std::string& origin, |
| + const std::string& cookies, |
| + const std::string& extra_request_headers, |
| + const std::string& extra_response_headers, |
| + scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { |
| + CreateAndConnectCustomResponseWithCookies( |
| + socket_url, socket_host, socket_path, sub_protocols, origin, cookies, |
| + extra_request_headers, |
| + WebSocketStandardResponse(extra_response_headers), timer.Pass()); |
| + } |
| + |
| void CreateAndConnectRawExpectations( |
| const std::string& socket_url, |
| const std::vector<std::string>& sub_protocols, |
| @@ -416,6 +452,79 @@ class WebSocketStreamCreateUMATest : public ::testing::Test { |
| } |
| }; |
| +struct WebSocketStreamUseCookieTestParameter { |
|
Ryan Sleevi
2015/01/24 04:13:08
Document & Pluralize (Parameters)
|
| + WebSocketStreamUseCookieTestParameter(const GURL& url, |
|
Ryan Sleevi
2015/01/24 04:13:07
Document
|
| + const GURL& cookie_url, |
| + const std::string& origin, |
| + const std::string& cookie_line, |
| + const std::string& cookies) |
| + : url(url), |
| + cookie_url(cookie_url), |
| + origin(origin), |
| + cookie_line(cookie_line), |
| + cookies(cookies) {} |
| + |
| + const GURL url; |
| + const GURL cookie_url; |
| + const std::string origin; |
| + const std::string cookie_line; |
| + const std::string cookies; |
|
Ryan Sleevi
2015/01/24 04:13:07
Making these const prevents operator=, which would
|
| +}; |
| + |
| +class WebSocketStreamUseCookieTest |
| + : public WebSocketStreamCreateTest, |
| + public ::testing::WithParamInterface< |
| + WebSocketStreamUseCookieTestParameter> { |
| + public: |
| + void SetCookie(CookieStore* store, |
| + const GURL& url, |
| + const std::string& cookie_line) { |
| + class RunLoop { |
|
Ryan Sleevi
2015/01/24 04:13:07
This is deeply confusing, because it shadows a nam
|
| + public: |
| + void Run() { run_loop_.Run(); } |
| + void Quit(bool) { run_loop_.Quit(); } |
| + |
| + private: |
| + base::RunLoop run_loop_; |
| + }; |
| + |
| + RunLoop run_loop; |
| + store->SetCookieWithOptionsAsync( |
| + url, cookie_line, CookieOptions(), |
| + base::Bind(&RunLoop::Quit, base::Unretained(&run_loop))); |
|
Ryan Sleevi
2015/01/24 04:13:07
You should be using https://code.google.com/p/chro
Adam Rice
2015/01/26 06:38:59
We need to swallow the bool parameter that SetCook
Ryan Sleevi
2015/01/27 00:47:22
Then just use a bound free function
static void I
|
| + run_loop.Run(); |
| + } |
| +}; |
| + |
| +class WebSocketStreamSetCookieTest |
| + : public WebSocketStreamCreateTest, |
| + public ::testing::WithParamInterface< |
| + WebSocketStreamUseCookieTestParameter> { |
| + public: |
| + std::string GetCookies(CookieStore* store, const GURL& url) { |
| + struct GetCookiesHelper { |
| + void Run() { run_loop_.Run(); } |
| + void Quit(const std::string& cookies) { |
| + cookies_ = cookies; |
| + run_loop_.Quit(); |
| + } |
| + |
| + const std::string& cookies() const { return cookies_; } |
| + |
| + private: |
| + base::RunLoop run_loop_; |
| + std::string cookies_; |
| + }; |
| + GetCookiesHelper helper; |
| + |
| + store->GetCookiesWithOptionsAsync( |
| + url, CookieOptions(), |
| + base::Bind(&GetCookiesHelper::Quit, base::Unretained(&helper))); |
|
Ryan Sleevi
2015/01/24 04:13:08
static void StashCookiesHelper(const base::Closure
|
| + helper.Run(); |
| + return helper.cookies(); |
| + } |
| +}; |
| + |
| // Confirm that the basic case works as expected. |
| TEST_F(WebSocketStreamCreateTest, SimpleSuccess) { |
| CreateAndConnectStandard("ws://localhost/", "localhost", "/", |
| @@ -1381,5 +1490,431 @@ TEST_F(WebSocketStreamCreateUMATest, Failed) { |
| EXPECT_EQ(0, samples->GetCount(FAILED)); |
| } |
| +TEST_P(WebSocketStreamUseCookieTest, UseCookie) { |
| + // In case we use a TLS connection. |
|
Ryan Sleevi
2015/01/24 04:13:07
This comment doesn't make sense. It sounds like yo
|
| + ssl_data_.push_back(new SSLSocketDataProvider(ASYNC, OK)); |
| + |
| + CookieStore* store = |
| + url_request_context_host_.GetURLRequestContext()->cookie_store(); |
| + |
| + const GURL& url = GetParam().url; |
| + const GURL& cookie_url = GetParam().cookie_url; |
| + const std::string& origin = GetParam().origin; |
| + const std::string& cookie_line = GetParam().cookie_line; |
| + const std::string& cookies = GetParam().cookies; |
| + |
| + SetCookie(store, cookie_url, cookie_line); |
| + |
| + CreateAndConnectStandardWithCookies(url.spec(), url.host(), url.path(), |
| + NoSubProtocols(), origin, cookies, "", |
| + ""); |
|
Ryan Sleevi
2015/01/24 04:13:08
s/""/std::string()/
|
| + |
| + RunUntilIdle(); |
| + EXPECT_FALSE(has_failed()); |
| +} |
| + |
| +INSTANTIATE_TEST_CASE_P( |
| + WebSocketStreamUseCookieTest, |
| + WebSocketStreamUseCookieTest, |
| + ::testing::Values( |
| + // Non-secure cookies for ws |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
|
Ryan Sleevi
2015/01/24 04:13:07
If you deal with the constness I mentioned above,
yhirano
2015/01/26 07:01:40
IIUC having constant members is not related to ini
Ryan Sleevi
2015/01/27 00:47:22
Using { } to initialize POD structs is not a C++11
Adam Rice
2015/01/27 06:32:46
Indeed. Brace-initialisation of function arguments
Ryan Sleevi
2015/01/27 22:28:10
This hasn't applied to unit tests historically, bu
|
| + GURL("http://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
|
Ryan Sleevi
2015/01/24 04:13:08
The amount of copy-pasta for thees \r\n makes it s
|
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("https://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("ws://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("wss://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + // Non-secure cookies for wss |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("http://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("https://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("ws://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("wss://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + // Secure-cookies for ws |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("https://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; secure", |
| + ""), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("wss://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; secure", |
| + ""), |
| + |
| + // Secure-cookies for wss |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("https://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; secure", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("wss://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; secure", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + // Non-secure cookies for ws (sharing domain) |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + // Non-secure cookies for wss (sharing domain) |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; Domain=example.com", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + // Secure-cookies for ws (sharing domain) |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("ws://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; Domain=example.com; secure", |
| + ""), |
|
Ryan Sleevi
2015/01/24 04:13:08
s/""/std::string()/
|
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("ws://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie; Domain=example.com; secure", |
| + ""), |
| + |
| + // Secure-cookies for wss (sharing domain) |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("wss://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; Domain=example.com; secure", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("wss://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie; Domain=example.com; secure", |
| + "Cookie: test-cookie\r\n"), |
| + |
| + // Non-matching cookies for ws |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + ""), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + ""), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + ""), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + ""), |
| + |
| + // Non-matching cookies for wss |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + ""), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + ""), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + ""), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + ""))); |
| + |
| +TEST_P(WebSocketStreamSetCookieTest, SetCookie) { |
| + // In case we use a TLS connection. |
| + ssl_data_.push_back(new SSLSocketDataProvider(ASYNC, OK)); |
| + |
| + const GURL& url = GetParam().url; |
| + const GURL& cookie_url = GetParam().cookie_url; |
| + const std::string& origin = GetParam().origin; |
| + const std::string& cookie_line = GetParam().cookie_line; |
| + const std::string& cookies = GetParam().cookies; |
| + |
| + const std::string response = base::StringPrintf( |
| + "HTTP/1.1 101 Switching Protocols\r\n" |
| + "Upgrade: websocket\r\n" |
| + "Connection: Upgrade\r\n" |
| + "%s" |
| + "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" |
| + "\r\n", |
| + cookies.c_str()); |
| + |
| + CookieStore* store = |
| + url_request_context_host_.GetURLRequestContext()->cookie_store(); |
| + |
| + CreateAndConnectCustomResponse(url.spec(), url.host(), url.path(), |
| + NoSubProtocols(), origin, "", response); |
| + |
| + RunUntilIdle(); |
| + EXPECT_FALSE(has_failed()); |
| + |
| + EXPECT_EQ(cookie_line, GetCookies(store, cookie_url)); |
| +} |
| + |
| +INSTANTIATE_TEST_CASE_P( |
| + WebSocketStreamSetCookieTest, |
| + WebSocketStreamSetCookieTest, |
| + ::testing::Values( |
| + // Cookies for ws |
|
Adam Rice
2015/01/23 12:58:00
Nitpick: the cookie comes *from* ws (or is "set by
|
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("http://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("https://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("ws://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("wss://www.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + // Cookies for wss |
|
Adam Rice
2015/01/23 12:58:00
Maybe we should test that the "Secure" attribute w
|
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("http://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("https://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("ws://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("wss://www.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + // cookies for ws (sharing domain) |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("ws://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("ws://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("ws://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("ws://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "http://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + // cookies for wss (sharing domain) |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("wss://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("wss://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("wss://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter( |
| + GURL("wss://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "https://www.example.com", |
| + "test-cookie", |
| + "Set-Cookie: test-cookie; Domain=example.com\r\n"), |
| + |
| + // Non-matching cookies for ws |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "http://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "http://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "http://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "http://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + // Non-matching cookies for wss |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("http://www2.example.com"), |
| + "https://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("https://www2.example.com"), |
| + "https://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("ws://www2.example.com"), |
| + "https://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"), |
| + |
| + WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), |
| + GURL("wss://www2.example.com"), |
| + "https://www.example.com", |
| + "", |
| + "Set-Cookie: test-cookie\r\n"))); |
| + |
| } // namespace |
| } // namespace net |