| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 | 1634 |
| 1635 TestBidirectionalDelegate delegate; | 1635 TestBidirectionalDelegate delegate; |
| 1636 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, | 1636 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, |
| 1637 nullptr); | 1637 nullptr); |
| 1638 delegate.WaitUntilDone(); | 1638 delegate.WaitUntilDone(); |
| 1639 | 1639 |
| 1640 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); | 1640 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); |
| 1641 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); | 1641 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); |
| 1642 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); | 1642 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); |
| 1643 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); | 1643 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); |
| 1644 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | |
| 1645 HttpNetworkSession::NORMAL_SOCKET_POOL))); | |
| 1646 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetSSLSocketPool( | |
| 1647 HttpNetworkSession::NORMAL_SOCKET_POOL))); | |
| 1648 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | |
| 1649 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | |
| 1650 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetSSLSocketPool( | |
| 1651 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | |
| 1652 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1644 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 1653 } | 1645 } |
| 1654 | 1646 |
| 1655 // Tests that when QUIC is not enabled for bidirectional streaming, HTTP/2 is | 1647 // Tests that when QUIC is not enabled for bidirectional streaming, HTTP/2 is |
| 1656 // used instead. | 1648 // used instead. |
| 1657 TEST_P(HttpStreamFactoryBidirectionalQuicTest, | 1649 TEST_P(HttpStreamFactoryBidirectionalQuicTest, |
| 1658 RequestBidirectionalStreamImplQuicNotEnabled) { | 1650 RequestBidirectionalStreamImplQuicNotEnabled) { |
| 1659 GURL url = GURL("https://www.example.org"); | 1651 GURL url = GURL("https://www.example.org"); |
| 1660 | 1652 |
| 1661 // Make the http job fail. | 1653 // Make the http job fail. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1761 TestBidirectionalDelegate delegate; | 1753 TestBidirectionalDelegate delegate; |
| 1762 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, | 1754 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, |
| 1763 nullptr); | 1755 nullptr); |
| 1764 delegate.WaitUntilDone(); | 1756 delegate.WaitUntilDone(); |
| 1765 | 1757 |
| 1766 // Make sure the BidirectionalStream negotiated goes through QUIC. | 1758 // Make sure the BidirectionalStream negotiated goes through QUIC. |
| 1767 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); | 1759 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); |
| 1768 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); | 1760 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); |
| 1769 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); | 1761 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); |
| 1770 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); | 1762 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); |
| 1771 // There is no Http2 socket pool. | |
| 1772 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | |
| 1773 HttpNetworkSession::NORMAL_SOCKET_POOL))); | |
| 1774 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetSSLSocketPool( | |
| 1775 HttpNetworkSession::NORMAL_SOCKET_POOL))); | |
| 1776 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | |
| 1777 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | |
| 1778 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetSSLSocketPool( | |
| 1779 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); | |
| 1780 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1763 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 1781 } | 1764 } |
| 1782 | 1765 |
| 1783 TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamImplFailure) { | 1766 TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamImplFailure) { |
| 1784 SpdySessionDependencies session_deps(GetParam(), | 1767 SpdySessionDependencies session_deps(GetParam(), |
| 1785 ProxyService::CreateDirect()); | 1768 ProxyService::CreateDirect()); |
| 1786 | 1769 |
| 1787 MockRead mock_read(ASYNC, OK); | 1770 MockRead mock_read(ASYNC, OK); |
| 1788 SequencedSocketData socket_data(&mock_read, 1, nullptr, 0); | 1771 SequencedSocketData socket_data(&mock_read, 1, nullptr, 0); |
| 1789 socket_data.set_connect_data(MockConnect(ASYNC, OK)); | 1772 socket_data.set_connect_data(MockConnect(ASYNC, OK)); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2015 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1998 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 2016 | 1999 |
| 2017 // Make sure there is no orphaned job. it is already canceled. | 2000 // Make sure there is no orphaned job. it is already canceled. |
| 2018 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 2001 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
| 2019 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 2002 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
| 2020 } | 2003 } |
| 2021 | 2004 |
| 2022 } // namespace | 2005 } // namespace |
| 2023 | 2006 |
| 2024 } // namespace net | 2007 } // namespace net |
| OLD | NEW |