OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/websockets/websocket_stream.h" | 5 #include "net/websockets/websocket_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 const std::string& extra_request_headers, | 117 const std::string& extra_request_headers, |
118 const std::string& response_body, | 118 const std::string& response_body, |
119 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { | 119 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { |
120 url_request_context_host_.SetExpectations( | 120 url_request_context_host_.SetExpectations( |
121 WebSocketStandardRequest(socket_path, socket_host, origin, | 121 WebSocketStandardRequest(socket_path, socket_host, origin, |
122 extra_request_headers), | 122 extra_request_headers), |
123 response_body); | 123 response_body); |
124 CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); | 124 CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); |
125 } | 125 } |
126 | 126 |
127 void CreateAndConnectCustomResponseWithCookies( | |
128 const std::string& socket_url, | |
129 const std::string& socket_host, | |
130 const std::string& socket_path, | |
131 const std::vector<std::string>& sub_protocols, | |
132 const std::string& origin, | |
133 const std::string& cookies, | |
134 const std::string& extra_request_headers, | |
135 const std::string& response_body, | |
136 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { | |
137 url_request_context_host_.SetExpectations( | |
138 WebSocketStandardRequestWithCookies(socket_path, socket_host, origin, | |
139 cookies, extra_request_headers), | |
140 response_body); | |
141 CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); | |
142 } | |
143 | |
127 // |extra_request_headers| and |extra_response_headers| must end in "\r\n" or | 144 // |extra_request_headers| and |extra_response_headers| must end in "\r\n" or |
128 // errors like "Unable to perform synchronous IO while stopped" will occur. | 145 // errors like "Unable to perform synchronous IO while stopped" will occur. |
129 void CreateAndConnectStandard( | 146 void CreateAndConnectStandard( |
130 const std::string& socket_url, | 147 const std::string& socket_url, |
131 const std::string& socket_host, | 148 const std::string& socket_host, |
132 const std::string& socket_path, | 149 const std::string& socket_path, |
133 const std::vector<std::string>& sub_protocols, | 150 const std::vector<std::string>& sub_protocols, |
134 const std::string& origin, | 151 const std::string& origin, |
135 const std::string& extra_request_headers, | 152 const std::string& extra_request_headers, |
136 const std::string& extra_response_headers, | 153 const std::string& extra_response_headers, |
137 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { | 154 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { |
138 CreateAndConnectCustomResponse( | 155 CreateAndConnectCustomResponse( |
139 socket_url, socket_host, socket_path, sub_protocols, origin, | 156 socket_url, socket_host, socket_path, sub_protocols, origin, |
140 extra_request_headers, | 157 extra_request_headers, |
141 WebSocketStandardResponse(extra_response_headers), timer.Pass()); | 158 WebSocketStandardResponse(extra_response_headers), timer.Pass()); |
142 } | 159 } |
143 | 160 |
161 // |cookies| must be empty or end with "\r\n". | |
162 // |extra_request_headers| and |extra_response_headers| must end in "\r\n" or | |
163 // errors like "Unable to perform synchronous IO while stopped" will occur. | |
164 void CreateAndConnectStandardWithCookies( | |
165 const std::string& socket_url, | |
166 const std::string& socket_host, | |
167 const std::string& socket_path, | |
168 const std::vector<std::string>& sub_protocols, | |
169 const std::string& origin, | |
170 const std::string& cookies, | |
171 const std::string& extra_request_headers, | |
172 const std::string& extra_response_headers, | |
173 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { | |
174 CreateAndConnectCustomResponseWithCookies( | |
175 socket_url, socket_host, socket_path, sub_protocols, origin, cookies, | |
176 extra_request_headers, | |
177 WebSocketStandardResponse(extra_response_headers), timer.Pass()); | |
178 } | |
179 | |
144 void CreateAndConnectRawExpectations( | 180 void CreateAndConnectRawExpectations( |
145 const std::string& socket_url, | 181 const std::string& socket_url, |
146 const std::vector<std::string>& sub_protocols, | 182 const std::vector<std::string>& sub_protocols, |
147 const std::string& origin, | 183 const std::string& origin, |
148 scoped_ptr<DeterministicSocketData> socket_data, | 184 scoped_ptr<DeterministicSocketData> socket_data, |
149 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { | 185 scoped_ptr<base::Timer> timer = scoped_ptr<base::Timer>()) { |
150 AddRawExpectations(socket_data.Pass()); | 186 AddRawExpectations(socket_data.Pass()); |
151 CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); | 187 CreateAndConnectStream(socket_url, sub_protocols, origin, timer.Pass()); |
152 } | 188 } |
153 | 189 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 }; | 445 }; |
410 | 446 |
411 scoped_ptr<base::HistogramSamples> GetSamples(const std::string& name) { | 447 scoped_ptr<base::HistogramSamples> GetSamples(const std::string& name) { |
412 base::HistogramBase* histogram = | 448 base::HistogramBase* histogram = |
413 base::StatisticsRecorder::FindHistogram(name); | 449 base::StatisticsRecorder::FindHistogram(name); |
414 return histogram ? histogram->SnapshotSamples() | 450 return histogram ? histogram->SnapshotSamples() |
415 : scoped_ptr<base::HistogramSamples>(); | 451 : scoped_ptr<base::HistogramSamples>(); |
416 } | 452 } |
417 }; | 453 }; |
418 | 454 |
455 struct WebSocketStreamUseCookieTestParameter { | |
456 WebSocketStreamUseCookieTestParameter(const GURL& url, | |
457 const GURL& cookie_url, | |
458 const std::string& origin, | |
459 const std::string& cookie_line, | |
460 const std::string& cookies) | |
461 : url(url), | |
462 cookie_url(cookie_url), | |
463 origin(origin), | |
464 cookie_line(cookie_line), | |
465 cookies(cookies) {} | |
466 | |
467 const GURL url; | |
Adam Rice
2015/01/23 11:14:02
Personally I would make all these types const char
yhirano
2015/01/23 12:19:00
I would like to leave it as is, because of type ch
| |
468 const GURL cookie_url; | |
469 const std::string origin; | |
470 const std::string cookie_line; | |
471 const std::string cookies; | |
472 }; | |
473 | |
474 class WebSocketStreamUseCookieTest | |
475 : public WebSocketStreamCreateTest, | |
476 public ::testing::WithParamInterface< | |
477 WebSocketStreamUseCookieTestParameter> { | |
478 public: | |
479 void SetCookie(CookieStore* store, | |
480 const GURL& url, | |
481 const std::string& cookie_line) { | |
482 class RunLoop { | |
483 public: | |
484 void Run() { run_loop_.Run(); } | |
485 void Quit(bool) { run_loop_.Quit(); } | |
486 | |
487 private: | |
488 base::RunLoop run_loop_; | |
489 }; | |
490 | |
491 RunLoop run_loop; | |
492 store->SetCookieWithOptionsAsync( | |
493 url, cookie_line, CookieOptions(), | |
494 base::Bind(&RunLoop::Quit, base::Unretained(&run_loop))); | |
495 run_loop.Run(); | |
496 } | |
497 }; | |
498 | |
499 class WebSocketStreamSetCookieTest | |
500 : public WebSocketStreamCreateTest, | |
501 public ::testing::WithParamInterface< | |
502 WebSocketStreamUseCookieTestParameter> { | |
503 public: | |
504 std::string GetCookies(CookieStore* store, const GURL& url) { | |
505 struct GetCookies { | |
Adam Rice
2015/01/23 11:14:02
I find having a struct called GetCookies inside a
yhirano
2015/01/23 12:19:00
Done.
| |
506 void Run() { | |
507 run_loop_.Run(); | |
508 ; | |
Adam Rice
2015/01/23 11:14:02
This semi-colon does nothing!
yhirano
2015/01/23 12:19:00
Done.
| |
509 } | |
510 void Quit(const std::string& cookies) { | |
511 cookies_ = cookies; | |
512 run_loop_.Quit(); | |
513 } | |
514 | |
515 const std::string& cookies() const { return cookies_; } | |
516 | |
517 private: | |
518 base::RunLoop run_loop_; | |
519 std::string cookies_; | |
520 }; | |
521 GetCookies callback; | |
522 | |
523 store->GetCookiesWithOptionsAsync( | |
524 url, CookieOptions(), | |
525 base::Bind(&GetCookies::Quit, base::Unretained(&callback))); | |
526 callback.Run(); | |
527 return callback.cookies(); | |
528 } | |
529 }; | |
530 | |
419 // Confirm that the basic case works as expected. | 531 // Confirm that the basic case works as expected. |
420 TEST_F(WebSocketStreamCreateTest, SimpleSuccess) { | 532 TEST_F(WebSocketStreamCreateTest, SimpleSuccess) { |
421 CreateAndConnectStandard("ws://localhost/", "localhost", "/", | 533 CreateAndConnectStandard("ws://localhost/", "localhost", "/", |
422 NoSubProtocols(), "http://localhost", "", ""); | 534 NoSubProtocols(), "http://localhost", "", ""); |
423 EXPECT_FALSE(request_info_); | 535 EXPECT_FALSE(request_info_); |
424 EXPECT_FALSE(response_info_); | 536 EXPECT_FALSE(response_info_); |
425 RunUntilIdle(); | 537 RunUntilIdle(); |
426 EXPECT_FALSE(has_failed()); | 538 EXPECT_FALSE(has_failed()); |
427 EXPECT_TRUE(stream_); | 539 EXPECT_TRUE(stream_); |
428 EXPECT_TRUE(request_info_); | 540 EXPECT_TRUE(request_info_); |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1374 scoped_ptr<base::HistogramSamples> samples(GetSamples(name)); | 1486 scoped_ptr<base::HistogramSamples> samples(GetSamples(name)); |
1375 ASSERT_TRUE(samples); | 1487 ASSERT_TRUE(samples); |
1376 if (original) { | 1488 if (original) { |
1377 samples->Subtract(*original); // Cancel the original values. | 1489 samples->Subtract(*original); // Cancel the original values. |
1378 } | 1490 } |
1379 EXPECT_EQ(1, samples->GetCount(INCOMPLETE)); | 1491 EXPECT_EQ(1, samples->GetCount(INCOMPLETE)); |
1380 EXPECT_EQ(0, samples->GetCount(CONNECTED)); | 1492 EXPECT_EQ(0, samples->GetCount(CONNECTED)); |
1381 EXPECT_EQ(0, samples->GetCount(FAILED)); | 1493 EXPECT_EQ(0, samples->GetCount(FAILED)); |
1382 } | 1494 } |
1383 | 1495 |
1496 TEST_P(WebSocketStreamUseCookieTest, UseCookie) { | |
1497 // In case we use a TLS connection. | |
1498 ssl_data_.push_back(new SSLSocketDataProvider(ASYNC, OK)); | |
1499 | |
1500 CookieStore* store = | |
1501 url_request_context_host_.GetURLRequestContext()->cookie_store(); | |
1502 | |
1503 const GURL& url = GetParam().url; | |
1504 const GURL& cookie_url = GetParam().cookie_url; | |
1505 const std::string& origin = GetParam().origin; | |
1506 const std::string& cookie_line = GetParam().cookie_line; | |
1507 const std::string& cookies = GetParam().cookies; | |
1508 | |
1509 SetCookie(store, cookie_url, cookie_line); | |
1510 | |
1511 CreateAndConnectStandardWithCookies(url.spec(), url.host(), url.path(), | |
1512 NoSubProtocols(), origin, cookies, "", | |
1513 ""); | |
1514 | |
1515 RunUntilIdle(); | |
1516 EXPECT_FALSE(has_failed()); | |
1517 } | |
1518 | |
1519 INSTANTIATE_TEST_CASE_P( | |
1520 WebSocketStreamUseCookieTest, | |
1521 WebSocketStreamUseCookieTest, | |
1522 ::testing::Values( | |
1523 // Non-secure cookies for ws | |
1524 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1525 GURL("http://www.example.com"), | |
1526 "http://www.example.com", | |
1527 "test-cookie", | |
1528 "Cookie: test-cookie\r\n"), | |
1529 | |
1530 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1531 GURL("https://www.example.com"), | |
1532 "http://www.example.com", | |
1533 "test-cookie", | |
1534 "Cookie: test-cookie\r\n"), | |
1535 | |
1536 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1537 GURL("ws://www.example.com"), | |
1538 "http://www.example.com", | |
1539 "test-cookie", | |
1540 "Cookie: test-cookie\r\n"), | |
1541 | |
1542 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1543 GURL("wss://www.example.com"), | |
1544 "http://www.example.com", | |
1545 "test-cookie", | |
1546 "Cookie: test-cookie\r\n"), | |
1547 | |
1548 // Non-secure cookies for wss | |
1549 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1550 GURL("http://www.example.com"), | |
1551 "https://www.example.com", | |
1552 "test-cookie", | |
1553 "Cookie: test-cookie\r\n"), | |
1554 | |
1555 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1556 GURL("https://www.example.com"), | |
1557 "https://www.example.com", | |
1558 "test-cookie", | |
1559 "Cookie: test-cookie\r\n"), | |
1560 | |
1561 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1562 GURL("ws://www.example.com"), | |
1563 "https://www.example.com", | |
1564 "test-cookie", | |
1565 "Cookie: test-cookie\r\n"), | |
1566 | |
1567 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1568 GURL("wss://www.example.com"), | |
1569 "https://www.example.com", | |
1570 "test-cookie", | |
1571 "Cookie: test-cookie\r\n"), | |
1572 | |
1573 // Secure-cookies for ws | |
1574 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1575 GURL("https://www.example.com"), | |
1576 "http://www.example.com", | |
1577 "test-cookie; secure", | |
1578 ""), | |
1579 | |
1580 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1581 GURL("wss://www.example.com"), | |
1582 "http://www.example.com", | |
1583 "test-cookie; secure", | |
1584 ""), | |
1585 | |
1586 // Secure-cookies for wss | |
1587 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1588 GURL("https://www.example.com"), | |
1589 "https://www.example.com", | |
1590 "test-cookie; secure", | |
1591 "Cookie: test-cookie\r\n"), | |
1592 | |
1593 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1594 GURL("wss://www.example.com"), | |
1595 "https://www.example.com", | |
1596 "test-cookie; secure", | |
1597 "Cookie: test-cookie\r\n"), | |
1598 | |
1599 // Non-secure cookies for ws (sharing domain) | |
1600 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1601 GURL("http://www2.example.com"), | |
1602 "http://www.example.com", | |
1603 "test-cookie; Domain=example.com", | |
1604 "Cookie: test-cookie\r\n"), | |
1605 | |
1606 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1607 GURL("https://www2.example.com"), | |
1608 "http://www.example.com", | |
1609 "test-cookie; Domain=example.com", | |
1610 "Cookie: test-cookie\r\n"), | |
1611 | |
1612 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1613 GURL("ws://www2.example.com"), | |
1614 "http://www.example.com", | |
1615 "test-cookie; Domain=example.com", | |
1616 "Cookie: test-cookie\r\n"), | |
1617 | |
1618 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1619 GURL("wss://www2.example.com"), | |
1620 "http://www.example.com", | |
1621 "test-cookie; Domain=example.com", | |
1622 "Cookie: test-cookie\r\n"), | |
1623 | |
1624 // Non-secure cookies for wss (sharing domain) | |
1625 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1626 GURL("http://www2.example.com"), | |
1627 "https://www.example.com", | |
1628 "test-cookie; Domain=example.com", | |
1629 "Cookie: test-cookie\r\n"), | |
1630 | |
1631 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1632 GURL("https://www2.example.com"), | |
1633 "https://www.example.com", | |
1634 "test-cookie; Domain=example.com", | |
1635 "Cookie: test-cookie\r\n"), | |
1636 | |
1637 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1638 GURL("ws://www2.example.com"), | |
1639 "https://www.example.com", | |
1640 "test-cookie; Domain=example.com", | |
1641 "Cookie: test-cookie\r\n"), | |
1642 | |
1643 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1644 GURL("wss://www2.example.com"), | |
1645 "https://www.example.com", | |
1646 "test-cookie; Domain=example.com", | |
1647 "Cookie: test-cookie\r\n"), | |
1648 | |
1649 // Secure-cookies for ws (sharing domain) | |
1650 WebSocketStreamUseCookieTestParameter( | |
1651 GURL("ws://www.example.com"), | |
1652 GURL("https://www2.example.com"), | |
1653 "http://www.example.com", | |
1654 "test-cookie; Domain=example.com; secure", | |
1655 ""), | |
1656 | |
1657 WebSocketStreamUseCookieTestParameter( | |
1658 GURL("ws://www.example.com"), | |
1659 GURL("wss://www2.example.com"), | |
1660 "http://www.example.com", | |
1661 "test-cookie; Domain=example.com; secure", | |
1662 ""), | |
1663 | |
1664 // Secure-cookies for wss (sharing domain) | |
1665 WebSocketStreamUseCookieTestParameter( | |
1666 GURL("wss://www.example.com"), | |
1667 GURL("https://www2.example.com"), | |
1668 "https://www.example.com", | |
1669 "test-cookie; Domain=example.com; secure", | |
1670 "Cookie: test-cookie\r\n"), | |
1671 | |
1672 WebSocketStreamUseCookieTestParameter( | |
1673 GURL("wss://www.example.com"), | |
1674 GURL("wss://www2.example.com"), | |
1675 "https://www.example.com", | |
1676 "test-cookie; Domain=example.com; secure", | |
1677 "Cookie: test-cookie\r\n"), | |
1678 | |
1679 // Non-maching cookies for ws | |
Adam Rice
2015/01/23 11:14:03
"matching" (and below).
yhirano
2015/01/23 12:19:00
Done.
| |
1680 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1681 GURL("http://www2.example.com"), | |
1682 "http://www.example.com", | |
1683 "test-cookie", | |
1684 ""), | |
1685 | |
1686 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1687 GURL("https://www2.example.com"), | |
1688 "http://www.example.com", | |
1689 "test-cookie", | |
1690 ""), | |
1691 | |
1692 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1693 GURL("ws://www2.example.com"), | |
1694 "http://www.example.com", | |
1695 "test-cookie", | |
1696 ""), | |
1697 | |
1698 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1699 GURL("wss://www2.example.com"), | |
1700 "http://www.example.com", | |
1701 "test-cookie", | |
1702 ""), | |
1703 | |
1704 // Non-maching cookies for wss | |
1705 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1706 GURL("http://www2.example.com"), | |
1707 "https://www.example.com", | |
1708 "test-cookie", | |
1709 ""), | |
1710 | |
1711 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1712 GURL("https://www2.example.com"), | |
1713 "https://www.example.com", | |
1714 "test-cookie", | |
1715 ""), | |
1716 | |
1717 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1718 GURL("ws://www2.example.com"), | |
1719 "https://www.example.com", | |
1720 "test-cookie", | |
1721 ""), | |
1722 | |
1723 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1724 GURL("wss://www2.example.com"), | |
1725 "https://www.example.com", | |
1726 "test-cookie", | |
1727 ""))); | |
1728 | |
1729 TEST_P(WebSocketStreamSetCookieTest, SetCookie) { | |
1730 // In case we use a TLS connection. | |
1731 ssl_data_.push_back(new SSLSocketDataProvider(ASYNC, OK)); | |
1732 | |
1733 const GURL& url = GetParam().url; | |
1734 const GURL& cookie_url = GetParam().cookie_url; | |
1735 const std::string& origin = GetParam().origin; | |
1736 const std::string& cookie_line = GetParam().cookie_line; | |
1737 const std::string& cookies = GetParam().cookies; | |
1738 | |
1739 const std::string response = base::StringPrintf( | |
1740 "HTTP/1.1 101 Switching Protocols\r\n" | |
1741 "Upgrade: websocket\r\n" | |
1742 "Connection: Upgrade\r\n" | |
1743 "%s" | |
1744 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" | |
1745 "\r\n", | |
1746 cookies.c_str()); | |
1747 | |
1748 CookieStore* store = | |
1749 url_request_context_host_.GetURLRequestContext()->cookie_store(); | |
1750 | |
1751 CreateAndConnectCustomResponse(url.spec(), url.host(), url.path(), | |
1752 NoSubProtocols(), origin, "", response); | |
1753 | |
1754 RunUntilIdle(); | |
1755 EXPECT_FALSE(has_failed()); | |
1756 | |
1757 EXPECT_EQ(cookie_line, GetCookies(store, cookie_url)); | |
1758 } | |
1759 | |
1760 INSTANTIATE_TEST_CASE_P( | |
1761 WebSocketStreamSetCookieTest, | |
1762 WebSocketStreamSetCookieTest, | |
1763 ::testing::Values( | |
1764 // Cookies for ws | |
1765 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1766 GURL("http://www.example.com"), | |
1767 "http://www.example.com", | |
1768 "test-cookie", | |
1769 "Set-Cookie: test-cookie\r\n"), | |
1770 | |
1771 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1772 GURL("https://www.example.com"), | |
1773 "http://www.example.com", | |
1774 "test-cookie", | |
1775 "Set-Cookie: test-cookie\r\n"), | |
1776 | |
1777 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1778 GURL("ws://www.example.com"), | |
1779 "http://www.example.com", | |
1780 "test-cookie", | |
1781 "Set-Cookie: test-cookie\r\n"), | |
1782 | |
1783 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1784 GURL("wss://www.example.com"), | |
1785 "http://www.example.com", | |
1786 "test-cookie", | |
1787 "Set-Cookie: test-cookie\r\n"), | |
1788 | |
1789 // Cookies for wss | |
1790 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1791 GURL("http://www.example.com"), | |
1792 "https://www.example.com", | |
1793 "test-cookie", | |
1794 "Set-Cookie: test-cookie\r\n"), | |
1795 | |
1796 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1797 GURL("https://www.example.com"), | |
1798 "https://www.example.com", | |
1799 "test-cookie", | |
1800 "Set-Cookie: test-cookie\r\n"), | |
1801 | |
1802 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1803 GURL("ws://www.example.com"), | |
1804 "https://www.example.com", | |
1805 "test-cookie", | |
1806 "Set-Cookie: test-cookie\r\n"), | |
1807 | |
1808 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1809 GURL("wss://www.example.com"), | |
1810 "https://www.example.com", | |
1811 "test-cookie", | |
1812 "Set-Cookie: test-cookie\r\n"), | |
1813 | |
1814 // cookies for ws (sharing domain) | |
1815 WebSocketStreamUseCookieTestParameter( | |
1816 GURL("ws://www.example.com"), | |
1817 GURL("http://www2.example.com"), | |
1818 "http://www.example.com", | |
1819 "test-cookie", | |
1820 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1821 | |
1822 WebSocketStreamUseCookieTestParameter( | |
1823 GURL("ws://www.example.com"), | |
1824 GURL("https://www2.example.com"), | |
1825 "http://www.example.com", | |
1826 "test-cookie", | |
1827 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1828 | |
1829 WebSocketStreamUseCookieTestParameter( | |
1830 GURL("ws://www.example.com"), | |
1831 GURL("ws://www2.example.com"), | |
1832 "http://www.example.com", | |
1833 "test-cookie", | |
1834 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1835 | |
1836 WebSocketStreamUseCookieTestParameter( | |
1837 GURL("ws://www.example.com"), | |
1838 GURL("wss://www2.example.com"), | |
1839 "http://www.example.com", | |
1840 "test-cookie", | |
1841 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1842 | |
1843 // cookies for wss (sharing domain) | |
1844 WebSocketStreamUseCookieTestParameter( | |
1845 GURL("wss://www.example.com"), | |
1846 GURL("http://www2.example.com"), | |
1847 "https://www.example.com", | |
1848 "test-cookie", | |
1849 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1850 | |
1851 WebSocketStreamUseCookieTestParameter( | |
1852 GURL("wss://www.example.com"), | |
1853 GURL("https://www2.example.com"), | |
1854 "https://www.example.com", | |
1855 "test-cookie", | |
1856 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1857 | |
1858 WebSocketStreamUseCookieTestParameter( | |
1859 GURL("wss://www.example.com"), | |
1860 GURL("ws://www2.example.com"), | |
1861 "https://www.example.com", | |
1862 "test-cookie", | |
1863 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1864 | |
1865 WebSocketStreamUseCookieTestParameter( | |
1866 GURL("wss://www.example.com"), | |
1867 GURL("wss://www2.example.com"), | |
1868 "https://www.example.com", | |
1869 "test-cookie", | |
1870 "Set-Cookie: test-cookie; Domain=example.com\r\n"), | |
1871 | |
1872 // Non-maching cookies for ws | |
1873 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1874 GURL("http://www2.example.com"), | |
1875 "http://www.example.com", | |
1876 "", | |
1877 "Set-Cookie: test-cookie\r\n"), | |
1878 | |
1879 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1880 GURL("https://www2.example.com"), | |
1881 "http://www.example.com", | |
1882 "", | |
1883 "Set-Cookie: test-cookie\r\n"), | |
1884 | |
1885 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1886 GURL("ws://www2.example.com"), | |
1887 "http://www.example.com", | |
1888 "", | |
1889 "Set-Cookie: test-cookie\r\n"), | |
1890 | |
1891 WebSocketStreamUseCookieTestParameter(GURL("ws://www.example.com"), | |
1892 GURL("wss://www2.example.com"), | |
1893 "http://www.example.com", | |
1894 "", | |
1895 "Set-Cookie: test-cookie\r\n"), | |
1896 | |
1897 // Non-maching cookies for wss | |
1898 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1899 GURL("http://www2.example.com"), | |
1900 "https://www.example.com", | |
1901 "", | |
1902 "Set-Cookie: test-cookie\r\n"), | |
1903 | |
1904 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1905 GURL("https://www2.example.com"), | |
1906 "https://www.example.com", | |
1907 "", | |
1908 "Set-Cookie: test-cookie\r\n"), | |
1909 | |
1910 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1911 GURL("ws://www2.example.com"), | |
1912 "https://www.example.com", | |
1913 "", | |
1914 "Set-Cookie: test-cookie\r\n"), | |
1915 | |
1916 WebSocketStreamUseCookieTestParameter(GURL("wss://www.example.com"), | |
1917 GURL("wss://www2.example.com"), | |
1918 "https://www.example.com", | |
1919 "", | |
1920 "Set-Cookie: test-cookie\r\n"))); | |
1921 | |
1384 } // namespace | 1922 } // namespace |
1385 } // namespace net | 1923 } // namespace net |
OLD | NEW |