| 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 | 737 |
| 738 // BidirectionalStreamImpl::Delegate to wait until response headers are | 738 // BidirectionalStreamImpl::Delegate to wait until response headers are |
| 739 // received. | 739 // received. |
| 740 class TestBidirectionalDelegate : public BidirectionalStreamImpl::Delegate { | 740 class TestBidirectionalDelegate : public BidirectionalStreamImpl::Delegate { |
| 741 public: | 741 public: |
| 742 void WaitUntilDone() { loop_.Run(); } | 742 void WaitUntilDone() { loop_.Run(); } |
| 743 | 743 |
| 744 const SpdyHeaderBlock& response_headers() const { return response_headers_; } | 744 const SpdyHeaderBlock& response_headers() const { return response_headers_; } |
| 745 | 745 |
| 746 private: | 746 private: |
| 747 void OnHeadersSent() override {} | 747 void OnStreamReady() override {} |
| 748 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override { | 748 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override { |
| 749 response_headers_ = response_headers; | 749 response_headers_ = response_headers; |
| 750 loop_.Quit(); | 750 loop_.Quit(); |
| 751 } | 751 } |
| 752 void OnDataRead(int bytes_read) override { NOTREACHED(); } | 752 void OnDataRead(int bytes_read) override { NOTREACHED(); } |
| 753 void OnDataSent() override { NOTREACHED(); } | 753 void OnDataSent() override { NOTREACHED(); } |
| 754 void OnTrailersReceived(const SpdyHeaderBlock& trailers) override { | 754 void OnTrailersReceived(const SpdyHeaderBlock& trailers) override { |
| 755 NOTREACHED(); | 755 NOTREACHED(); |
| 756 } | 756 } |
| 757 void OnFailed(int error) override { NOTREACHED(); } | 757 void OnFailed(int error) override { NOTREACHED(); } |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 ASSERT_TRUE(waiter.bidirectional_stream_impl()); | 1613 ASSERT_TRUE(waiter.bidirectional_stream_impl()); |
| 1614 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); | 1614 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); |
| 1615 | 1615 |
| 1616 BidirectionalStreamRequestInfo bidi_request_info; | 1616 BidirectionalStreamRequestInfo bidi_request_info; |
| 1617 bidi_request_info.method = "GET"; | 1617 bidi_request_info.method = "GET"; |
| 1618 bidi_request_info.url = GURL("https://www.example.org/"); | 1618 bidi_request_info.url = GURL("https://www.example.org/"); |
| 1619 bidi_request_info.end_stream_on_headers = true; | 1619 bidi_request_info.end_stream_on_headers = true; |
| 1620 bidi_request_info.priority = LOWEST; | 1620 bidi_request_info.priority = LOWEST; |
| 1621 | 1621 |
| 1622 TestBidirectionalDelegate delegate; | 1622 TestBidirectionalDelegate delegate; |
| 1623 stream_impl->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); | 1623 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, |
| 1624 nullptr); |
| 1624 delegate.WaitUntilDone(); | 1625 delegate.WaitUntilDone(); |
| 1625 | 1626 |
| 1626 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); | 1627 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); |
| 1627 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); | 1628 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); |
| 1628 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); | 1629 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); |
| 1629 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); | 1630 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); |
| 1630 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | 1631 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetTransportSocketPool( |
| 1631 HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1632 HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| 1632 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetSSLSocketPool( | 1633 EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetSSLSocketPool( |
| 1633 HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1634 HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 ASSERT_TRUE(waiter.bidirectional_stream_impl()); | 1739 ASSERT_TRUE(waiter.bidirectional_stream_impl()); |
| 1739 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); | 1740 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); |
| 1740 | 1741 |
| 1741 BidirectionalStreamRequestInfo bidi_request_info; | 1742 BidirectionalStreamRequestInfo bidi_request_info; |
| 1742 bidi_request_info.method = "GET"; | 1743 bidi_request_info.method = "GET"; |
| 1743 bidi_request_info.url = GURL("https://www.example.org/"); | 1744 bidi_request_info.url = GURL("https://www.example.org/"); |
| 1744 bidi_request_info.end_stream_on_headers = true; | 1745 bidi_request_info.end_stream_on_headers = true; |
| 1745 bidi_request_info.priority = LOWEST; | 1746 bidi_request_info.priority = LOWEST; |
| 1746 | 1747 |
| 1747 TestBidirectionalDelegate delegate; | 1748 TestBidirectionalDelegate delegate; |
| 1748 stream_impl->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); | 1749 stream_impl->Start(&bidi_request_info, BoundNetLog(), false, &delegate, |
| 1750 nullptr); |
| 1749 delegate.WaitUntilDone(); | 1751 delegate.WaitUntilDone(); |
| 1750 | 1752 |
| 1751 // Make sure the BidirectionalStream negotiated goes through QUIC. | 1753 // Make sure the BidirectionalStream negotiated goes through QUIC. |
| 1752 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); | 1754 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); |
| 1753 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); | 1755 EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); |
| 1754 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); | 1756 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); |
| 1755 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); | 1757 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); |
| 1756 // There is no Http2 socket pool. | 1758 // There is no Http2 socket pool. |
| 1757 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( | 1759 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( |
| 1758 HttpNetworkSession::NORMAL_SOCKET_POOL))); | 1760 HttpNetworkSession::NORMAL_SOCKET_POOL))); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2000 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 2002 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 2001 | 2003 |
| 2002 // Make sure there is no orphaned job. it is already canceled. | 2004 // Make sure there is no orphaned job. it is already canceled. |
| 2003 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 2005 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
| 2004 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 2006 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
| 2005 } | 2007 } |
| 2006 | 2008 |
| 2007 } // namespace | 2009 } // namespace |
| 2008 | 2010 |
| 2009 } // namespace net | 2011 } // namespace net |
| OLD | NEW |