| 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 | 740 |
| 741 // BidirectionalStreamImpl::Delegate to wait until response headers are | 741 // BidirectionalStreamImpl::Delegate to wait until response headers are |
| 742 // received. | 742 // received. |
| 743 class TestBidirectionalDelegate : public BidirectionalStreamImpl::Delegate { | 743 class TestBidirectionalDelegate : public BidirectionalStreamImpl::Delegate { |
| 744 public: | 744 public: |
| 745 void WaitUntilDone() { loop_.Run(); } | 745 void WaitUntilDone() { loop_.Run(); } |
| 746 | 746 |
| 747 const SpdyHeaderBlock& response_headers() const { return response_headers_; } | 747 const SpdyHeaderBlock& response_headers() const { return response_headers_; } |
| 748 | 748 |
| 749 private: | 749 private: |
| 750 void OnHeadersSent() override {} | 750 void OnStreamReady() override {} |
| 751 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override { | 751 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override { |
| 752 response_headers_ = response_headers; | 752 response_headers_ = response_headers; |
| 753 loop_.Quit(); | 753 loop_.Quit(); |
| 754 } | 754 } |
| 755 void OnDataRead(int bytes_read) override { NOTREACHED(); } | 755 void OnDataRead(int bytes_read) override { NOTREACHED(); } |
| 756 void OnDataSent() override { NOTREACHED(); } | 756 void OnDataSent() override { NOTREACHED(); } |
| 757 void OnTrailersReceived(const SpdyHeaderBlock& trailers) override { | 757 void OnTrailersReceived(const SpdyHeaderBlock& trailers) override { |
| 758 NOTREACHED(); | 758 NOTREACHED(); |
| 759 } | 759 } |
| 760 void OnFailed(int error) override { NOTREACHED(); } | 760 void OnFailed(int error) override { NOTREACHED(); } |
| (...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 ASSERT_TRUE(waiter.bidirectional_stream_impl()); | 1642 ASSERT_TRUE(waiter.bidirectional_stream_impl()); |
| 1643 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); | 1643 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); |
| 1644 | 1644 |
| 1645 BidirectionalStreamRequestInfo bidi_request_info; | 1645 BidirectionalStreamRequestInfo bidi_request_info; |
| 1646 bidi_request_info.method = "GET"; | 1646 bidi_request_info.method = "GET"; |
| 1647 bidi_request_info.url = GURL("https://www.example.org/"); | 1647 bidi_request_info.url = GURL("https://www.example.org/"); |
| 1648 bidi_request_info.end_stream_on_headers = true; | 1648 bidi_request_info.end_stream_on_headers = true; |
| 1649 bidi_request_info.priority = LOWEST; | 1649 bidi_request_info.priority = LOWEST; |
| 1650 | 1650 |
| 1651 TestBidirectionalDelegate delegate; | 1651 TestBidirectionalDelegate delegate; |
| 1652 stream_impl->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); | 1652 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, |
| 1653 nullptr); |
| 1653 delegate.WaitUntilDone(); | 1654 delegate.WaitUntilDone(); |
| 1654 | 1655 |
| 1655 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); | 1656 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); |
| 1656 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); | 1657 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); |
| 1657 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); | 1658 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); |
| 1658 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); | 1659 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); |
| 1659 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | 1660 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetTransportSocketPool( |
| 1660 HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1661 HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| 1661 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetSSLSocketPool( | 1662 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetSSLSocketPool( |
| 1662 HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1663 HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 ASSERT_TRUE(waiter.bidirectional_stream_impl()); | 1768 ASSERT_TRUE(waiter.bidirectional_stream_impl()); |
| 1768 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); | 1769 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); |
| 1769 | 1770 |
| 1770 BidirectionalStreamRequestInfo bidi_request_info; | 1771 BidirectionalStreamRequestInfo bidi_request_info; |
| 1771 bidi_request_info.method = "GET"; | 1772 bidi_request_info.method = "GET"; |
| 1772 bidi_request_info.url = GURL("https://www.example.org/"); | 1773 bidi_request_info.url = GURL("https://www.example.org/"); |
| 1773 bidi_request_info.end_stream_on_headers = true; | 1774 bidi_request_info.end_stream_on_headers = true; |
| 1774 bidi_request_info.priority = LOWEST; | 1775 bidi_request_info.priority = LOWEST; |
| 1775 | 1776 |
| 1776 TestBidirectionalDelegate delegate; | 1777 TestBidirectionalDelegate delegate; |
| 1777 stream_impl->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); | 1778 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, |
| 1779 nullptr); |
| 1778 delegate.WaitUntilDone(); | 1780 delegate.WaitUntilDone(); |
| 1779 | 1781 |
| 1780 // Make sure the BidirectionalStream negotiated goes through QUIC. | 1782 // Make sure the BidirectionalStream negotiated goes through QUIC. |
| 1781 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); | 1783 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); |
| 1782 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); | 1784 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); |
| 1783 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); | 1785 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); |
| 1784 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); | 1786 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); |
| 1785 // There is no Http2 socket pool. | 1787 // There is no Http2 socket pool. |
| 1786 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | 1788 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( |
| 1787 HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1789 HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 2044 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 2043 | 2045 |
| 2044 // Make sure there is no orphaned job. it is already canceled. | 2046 // Make sure there is no orphaned job. it is already canceled. |
| 2045 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 2047 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
| 2046 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 2048 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
| 2047 } | 2049 } |
| 2048 | 2050 |
| 2049 } // namespace | 2051 } // namespace |
| 2050 | 2052 |
| 2051 } // namespace net | 2053 } // namespace net |
| OLD | NEW |