| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/spdy/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include "net/base/ip_endpoint.h" | 7 #include "net/base/ip_endpoint.h" |
| 8 #include "net/spdy/spdy_io_buffer.h" | 8 #include "net/spdy/spdy_io_buffer.h" |
| 9 #include "net/spdy/spdy_session_pool.h" | 9 #include "net/spdy/spdy_session_pool.h" |
| 10 #include "net/spdy/spdy_stream.h" | 10 #include "net/spdy/spdy_stream.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); | 133 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
| 134 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 134 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
| 135 scoped_refptr<SpdySession> session = | 135 scoped_refptr<SpdySession> session = |
| 136 spdy_session_pool->Get(pair, BoundNetLog()); | 136 spdy_session_pool->Get(pair, BoundNetLog()); |
| 137 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); | 137 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); |
| 138 | 138 |
| 139 scoped_refptr<TransportSocketParams> transport_params( | 139 scoped_refptr<TransportSocketParams> transport_params( |
| 140 new TransportSocketParams(test_host_port_pair, | 140 new TransportSocketParams(test_host_port_pair, |
| 141 MEDIUM, | 141 MEDIUM, |
| 142 GURL(), | |
| 143 false, | 142 false, |
| 144 false)); | 143 false)); |
| 145 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 144 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 146 EXPECT_EQ(OK, | 145 EXPECT_EQ(OK, |
| 147 connection->Init(test_host_port_pair.ToString(), | 146 connection->Init(test_host_port_pair.ToString(), |
| 148 transport_params, MEDIUM, | 147 transport_params, MEDIUM, |
| 149 NULL, http_session->transport_socket_pool(), | 148 NULL, http_session->transport_socket_pool(), |
| 150 BoundNetLog())); | 149 BoundNetLog())); |
| 151 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 150 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
| 152 | 151 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); | 203 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
| 205 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 204 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
| 206 scoped_refptr<SpdySession> session = | 205 scoped_refptr<SpdySession> session = |
| 207 spdy_session_pool->Get(pair, BoundNetLog()); | 206 spdy_session_pool->Get(pair, BoundNetLog()); |
| 208 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); | 207 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); |
| 209 | 208 |
| 210 | 209 |
| 211 scoped_refptr<TransportSocketParams> transport_params( | 210 scoped_refptr<TransportSocketParams> transport_params( |
| 212 new TransportSocketParams(test_host_port_pair, | 211 new TransportSocketParams(test_host_port_pair, |
| 213 MEDIUM, | 212 MEDIUM, |
| 214 GURL(), | |
| 215 false, | 213 false, |
| 216 false)); | 214 false)); |
| 217 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 215 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 218 EXPECT_EQ(OK, | 216 EXPECT_EQ(OK, |
| 219 connection->Init(test_host_port_pair.ToString(), | 217 connection->Init(test_host_port_pair.ToString(), |
| 220 transport_params, | 218 transport_params, |
| 221 MEDIUM, | 219 MEDIUM, |
| 222 NULL, | 220 NULL, |
| 223 http_session->transport_socket_pool(), | 221 http_session->transport_socket_pool(), |
| 224 BoundNetLog())); | 222 BoundNetLog())); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 294 |
| 297 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); | 295 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
| 298 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 296 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
| 299 scoped_refptr<SpdySession> session = | 297 scoped_refptr<SpdySession> session = |
| 300 spdy_session_pool->Get(pair, BoundNetLog()); | 298 spdy_session_pool->Get(pair, BoundNetLog()); |
| 301 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); | 299 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); |
| 302 | 300 |
| 303 scoped_refptr<TransportSocketParams> transport_params( | 301 scoped_refptr<TransportSocketParams> transport_params( |
| 304 new TransportSocketParams(test_host_port_pair, | 302 new TransportSocketParams(test_host_port_pair, |
| 305 MEDIUM, | 303 MEDIUM, |
| 306 GURL(), | |
| 307 false, | 304 false, |
| 308 false)); | 305 false)); |
| 309 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 306 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 310 EXPECT_EQ(OK, | 307 EXPECT_EQ(OK, |
| 311 connection->Init(test_host_port_pair.ToString(), | 308 connection->Init(test_host_port_pair.ToString(), |
| 312 transport_params, | 309 transport_params, |
| 313 MEDIUM, | 310 MEDIUM, |
| 314 NULL, | 311 NULL, |
| 315 http_session->transport_socket_pool(), | 312 http_session->transport_socket_pool(), |
| 316 BoundNetLog())); | 313 BoundNetLog())); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 540 |
| 544 // Create a session. | 541 // Create a session. |
| 545 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 542 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
| 546 scoped_refptr<SpdySession> session = | 543 scoped_refptr<SpdySession> session = |
| 547 spdy_session_pool->Get(pair, BoundNetLog()); | 544 spdy_session_pool->Get(pair, BoundNetLog()); |
| 548 ASSERT_TRUE(spdy_session_pool->HasSession(pair)); | 545 ASSERT_TRUE(spdy_session_pool->HasSession(pair)); |
| 549 | 546 |
| 550 scoped_refptr<TransportSocketParams> transport_params( | 547 scoped_refptr<TransportSocketParams> transport_params( |
| 551 new TransportSocketParams(test_host_port_pair, | 548 new TransportSocketParams(test_host_port_pair, |
| 552 MEDIUM, | 549 MEDIUM, |
| 553 GURL(), | |
| 554 false, | 550 false, |
| 555 false)); | 551 false)); |
| 556 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 552 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 557 EXPECT_EQ(OK, | 553 EXPECT_EQ(OK, |
| 558 connection->Init(test_host_port_pair.ToString(), | 554 connection->Init(test_host_port_pair.ToString(), |
| 559 transport_params, MEDIUM, | 555 transport_params, MEDIUM, |
| 560 NULL, http_session->transport_socket_pool(), | 556 NULL, http_session->transport_socket_pool(), |
| 561 BoundNetLog())); | 557 BoundNetLog())); |
| 562 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 558 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
| 563 | 559 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 625 |
| 630 // Create a session. | 626 // Create a session. |
| 631 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 627 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
| 632 scoped_refptr<SpdySession> session = | 628 scoped_refptr<SpdySession> session = |
| 633 spdy_session_pool->Get(pair, BoundNetLog()); | 629 spdy_session_pool->Get(pair, BoundNetLog()); |
| 634 ASSERT_TRUE(spdy_session_pool->HasSession(pair)); | 630 ASSERT_TRUE(spdy_session_pool->HasSession(pair)); |
| 635 | 631 |
| 636 scoped_refptr<TransportSocketParams> transport_params( | 632 scoped_refptr<TransportSocketParams> transport_params( |
| 637 new TransportSocketParams(test_host_port_pair, | 633 new TransportSocketParams(test_host_port_pair, |
| 638 MEDIUM, | 634 MEDIUM, |
| 639 GURL(), | |
| 640 false, | 635 false, |
| 641 false)); | 636 false)); |
| 642 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 637 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 643 EXPECT_EQ(OK, | 638 EXPECT_EQ(OK, |
| 644 connection->Init(test_host_port_pair.ToString(), | 639 connection->Init(test_host_port_pair.ToString(), |
| 645 transport_params, MEDIUM, | 640 transport_params, MEDIUM, |
| 646 NULL, http_session->transport_socket_pool(), | 641 NULL, http_session->transport_socket_pool(), |
| 647 BoundNetLog())); | 642 BoundNetLog())); |
| 648 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 643 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
| 649 | 644 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 spdy_session_pool->http_server_properties()->SetSpdySettings( | 724 spdy_session_pool->http_server_properties()->SetSpdySettings( |
| 730 test_host_port_pair, settings); | 725 test_host_port_pair, settings); |
| 731 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); | 726 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); |
| 732 scoped_refptr<SpdySession> session = | 727 scoped_refptr<SpdySession> session = |
| 733 spdy_session_pool->Get(pair, BoundNetLog()); | 728 spdy_session_pool->Get(pair, BoundNetLog()); |
| 734 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); | 729 EXPECT_TRUE(spdy_session_pool->HasSession(pair)); |
| 735 | 730 |
| 736 scoped_refptr<TransportSocketParams> transport_params( | 731 scoped_refptr<TransportSocketParams> transport_params( |
| 737 new TransportSocketParams(test_host_port_pair, | 732 new TransportSocketParams(test_host_port_pair, |
| 738 MEDIUM, | 733 MEDIUM, |
| 739 GURL(), | |
| 740 false, | 734 false, |
| 741 false)); | 735 false)); |
| 742 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 736 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 743 EXPECT_EQ(OK, | 737 EXPECT_EQ(OK, |
| 744 connection->Init(test_host_port_pair.ToString(), | 738 connection->Init(test_host_port_pair.ToString(), |
| 745 transport_params, MEDIUM, | 739 transport_params, MEDIUM, |
| 746 NULL, http_session->transport_socket_pool(), | 740 NULL, http_session->transport_socket_pool(), |
| 747 BoundNetLog())); | 741 BoundNetLog())); |
| 748 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 742 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
| 749 MessageLoop::current()->RunAllPending(); | 743 MessageLoop::current()->RunAllPending(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); | 797 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); |
| 804 EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[0].pair)); | 798 EXPECT_FALSE(spdy_session_pool->HasSession(test_hosts[0].pair)); |
| 805 scoped_refptr<SpdySession> session = | 799 scoped_refptr<SpdySession> session = |
| 806 spdy_session_pool->Get(test_hosts[0].pair, BoundNetLog()); | 800 spdy_session_pool->Get(test_hosts[0].pair, BoundNetLog()); |
| 807 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[0].pair)); | 801 EXPECT_TRUE(spdy_session_pool->HasSession(test_hosts[0].pair)); |
| 808 | 802 |
| 809 HostPortPair test_host_port_pair(test_hosts[0].name, kTestPort); | 803 HostPortPair test_host_port_pair(test_hosts[0].name, kTestPort); |
| 810 scoped_refptr<TransportSocketParams> transport_params( | 804 scoped_refptr<TransportSocketParams> transport_params( |
| 811 new TransportSocketParams(test_host_port_pair, | 805 new TransportSocketParams(test_host_port_pair, |
| 812 MEDIUM, | 806 MEDIUM, |
| 813 GURL(), | |
| 814 false, | 807 false, |
| 815 false)); | 808 false)); |
| 816 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); | 809 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); |
| 817 EXPECT_EQ(OK, | 810 EXPECT_EQ(OK, |
| 818 connection->Init(test_host_port_pair.ToString(), | 811 connection->Init(test_host_port_pair.ToString(), |
| 819 transport_params, MEDIUM, | 812 transport_params, MEDIUM, |
| 820 NULL, http_session->transport_socket_pool(), | 813 NULL, http_session->transport_socket_pool(), |
| 821 BoundNetLog())); | 814 BoundNetLog())); |
| 822 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); | 815 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); |
| 823 | 816 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 test_http_server_properties->SetSpdySettings(test_host_port_pair, | 910 test_http_server_properties->SetSpdySettings(test_host_port_pair, |
| 918 test_settings); | 911 test_settings); |
| 919 EXPECT_NE(0u, test_http_server_properties->GetSpdySettings( | 912 EXPECT_NE(0u, test_http_server_properties->GetSpdySettings( |
| 920 test_host_port_pair).size()); | 913 test_host_port_pair).size()); |
| 921 spdy_session_pool->OnIPAddressChanged(); | 914 spdy_session_pool->OnIPAddressChanged(); |
| 922 EXPECT_EQ(0u, test_http_server_properties->GetSpdySettings( | 915 EXPECT_EQ(0u, test_http_server_properties->GetSpdySettings( |
| 923 test_host_port_pair).size()); | 916 test_host_port_pair).size()); |
| 924 } | 917 } |
| 925 | 918 |
| 926 } // namespace net | 919 } // namespace net |
| OLD | NEW |