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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 581 } |
582 | 582 |
583 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) { | 583 void VerifyStreamsClosed(const NormalSpdyTransactionHelper& helper) { |
584 // This lengthy block is reaching into the pool to dig out the active | 584 // This lengthy block is reaching into the pool to dig out the active |
585 // session. Once we have the session, we verify that the streams are | 585 // session. Once we have the session, we verify that the streams are |
586 // all closed and not leaked at this point. | 586 // all closed and not leaked at this point. |
587 const GURL& url = helper.request().url; | 587 const GURL& url = helper.request().url; |
588 int port = helper.test_params().ssl_type == SPDYNPN ? 443 : 80; | 588 int port = helper.test_params().ssl_type == SPDYNPN ? 443 : 80; |
589 HostPortPair host_port_pair(url.host(), port); | 589 HostPortPair host_port_pair(url.host(), port); |
590 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 590 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
591 kPrivacyModeDisabled); | 591 PRIVACY_MODE_DISABLED); |
592 BoundNetLog log; | 592 BoundNetLog log; |
593 const scoped_refptr<HttpNetworkSession>& session = helper.session(); | 593 const scoped_refptr<HttpNetworkSession>& session = helper.session(); |
594 base::WeakPtr<SpdySession> spdy_session = | 594 base::WeakPtr<SpdySession> spdy_session = |
595 session->spdy_session_pool()->FindAvailableSession(key, log); | 595 session->spdy_session_pool()->FindAvailableSession(key, log); |
596 ASSERT_TRUE(spdy_session != NULL); | 596 ASSERT_TRUE(spdy_session != NULL); |
597 EXPECT_EQ(0u, spdy_session->num_active_streams()); | 597 EXPECT_EQ(0u, spdy_session->num_active_streams()); |
598 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); | 598 EXPECT_EQ(0u, spdy_session->num_unclaimed_pushed_streams()); |
599 } | 599 } |
600 | 600 |
601 void RunServerPushTest(OrderedSocketData* data, | 601 void RunServerPushTest(OrderedSocketData* data, |
(...skipping 4161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4763 EXPECT_TRUE(response->was_fetched_via_spdy); | 4763 EXPECT_TRUE(response->was_fetched_via_spdy); |
4764 out.rv = ReadTransaction(trans, &out.response_data); | 4764 out.rv = ReadTransaction(trans, &out.response_data); |
4765 EXPECT_EQ(OK, out.rv); | 4765 EXPECT_EQ(OK, out.rv); |
4766 out.status_line = response->headers->GetStatusLine(); | 4766 out.status_line = response->headers->GetStatusLine(); |
4767 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); | 4767 EXPECT_EQ("HTTP/1.1 200 OK", out.status_line); |
4768 EXPECT_EQ("hello!", out.response_data); | 4768 EXPECT_EQ("hello!", out.response_data); |
4769 | 4769 |
4770 // Check that the SpdySession is still in the SpdySessionPool. | 4770 // Check that the SpdySession is still in the SpdySessionPool. |
4771 HostPortPair host_port_pair("www.google.com", helper.port()); | 4771 HostPortPair host_port_pair("www.google.com", helper.port()); |
4772 SpdySessionKey session_pool_key_direct( | 4772 SpdySessionKey session_pool_key_direct( |
4773 host_port_pair, ProxyServer::Direct(), kPrivacyModeDisabled); | 4773 host_port_pair, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
4774 EXPECT_TRUE(HasSpdySession(spdy_session_pool, session_pool_key_direct)); | 4774 EXPECT_TRUE(HasSpdySession(spdy_session_pool, session_pool_key_direct)); |
4775 SpdySessionKey session_pool_key_proxy( | 4775 SpdySessionKey session_pool_key_proxy( |
4776 host_port_pair, | 4776 host_port_pair, |
4777 ProxyServer::FromURI("www.foo.com", ProxyServer::SCHEME_HTTP), | 4777 ProxyServer::FromURI("www.foo.com", ProxyServer::SCHEME_HTTP), |
4778 kPrivacyModeDisabled); | 4778 PRIVACY_MODE_DISABLED); |
4779 EXPECT_FALSE(HasSpdySession(spdy_session_pool, session_pool_key_proxy)); | 4779 EXPECT_FALSE(HasSpdySession(spdy_session_pool, session_pool_key_proxy)); |
4780 | 4780 |
4781 // Set up data for the proxy connection. | 4781 // Set up data for the proxy connection. |
4782 const char kConnect443[] = {"CONNECT www.google.com:443 HTTP/1.1\r\n" | 4782 const char kConnect443[] = {"CONNECT www.google.com:443 HTTP/1.1\r\n" |
4783 "Host: www.google.com\r\n" | 4783 "Host: www.google.com\r\n" |
4784 "Proxy-Connection: keep-alive\r\n\r\n"}; | 4784 "Proxy-Connection: keep-alive\r\n\r\n"}; |
4785 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n" | 4785 const char kConnect80[] = {"CONNECT www.google.com:80 HTTP/1.1\r\n" |
4786 "Host: www.google.com\r\n" | 4786 "Host: www.google.com\r\n" |
4787 "Proxy-Connection: keep-alive\r\n\r\n"}; | 4787 "Proxy-Connection: keep-alive\r\n\r\n"}; |
4788 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; | 4788 const char kHTTP200[] = {"HTTP/1.1 200 OK\r\n\r\n"}; |
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6546 // since we're send-stalled. | 6546 // since we're send-stalled. |
6547 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); | 6547 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
6548 | 6548 |
6549 // Read in WINDOW_UPDATE or SETTINGS frame. | 6549 // Read in WINDOW_UPDATE or SETTINGS frame. |
6550 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); | 6550 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); |
6551 rv = callback.WaitForResult(); | 6551 rv = callback.WaitForResult(); |
6552 helper.VerifyDataConsumed(); | 6552 helper.VerifyDataConsumed(); |
6553 } | 6553 } |
6554 | 6554 |
6555 } // namespace net | 6555 } // namespace net |
OLD | NEW |