| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_pool.h" | 5 #include "net/spdy/spdy_session_pool.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 spdy_session_pool_(NULL) {} | 37 spdy_session_pool_(NULL) {} |
| 38 | 38 |
| 39 void CreateNetworkSession() { | 39 void CreateNetworkSession() { |
| 40 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); | 40 http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_); |
| 41 spdy_session_pool_ = http_session_->spdy_session_pool(); | 41 spdy_session_pool_ = http_session_->spdy_session_pool(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void RunIPPoolingTest(SpdyPoolCloseSessionsType close_sessions_type); | 44 void RunIPPoolingTest(SpdyPoolCloseSessionsType close_sessions_type); |
| 45 | 45 |
| 46 SpdySessionDependencies session_deps_; | 46 SpdySessionDependencies session_deps_; |
| 47 scoped_ptr<HttpNetworkSession> http_session_; | 47 scoped_refptr<HttpNetworkSession> http_session_; |
| 48 SpdySessionPool* spdy_session_pool_; | 48 SpdySessionPool* spdy_session_pool_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 INSTANTIATE_TEST_CASE_P(NextProto, | 51 INSTANTIATE_TEST_CASE_P(NextProto, |
| 52 SpdySessionPoolTest, | 52 SpdySessionPoolTest, |
| 53 testing::Values(kProtoSPDY31, | 53 testing::Values(kProtoSPDY31, |
| 54 kProtoHTTP2)); | 54 kProtoHTTP2)); |
| 55 | 55 |
| 56 // A delegate that opens a new session when it is closed. | 56 // A delegate that opens a new session when it is closed. |
| 57 class SessionOpeningDelegate : public SpdyStream::Delegate { | 57 class SessionOpeningDelegate : public SpdyStream::Delegate { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 data.set_connect_data(connect_data); | 108 data.set_connect_data(connect_data); |
| 109 session_deps_.socket_factory->AddSocketDataProvider(&data); | 109 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 110 | 110 |
| 111 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 111 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
| 112 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 112 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 113 | 113 |
| 114 CreateNetworkSession(); | 114 CreateNetworkSession(); |
| 115 | 115 |
| 116 // Setup the first session to the first host. | 116 // Setup the first session to the first host. |
| 117 base::WeakPtr<SpdySession> session = | 117 base::WeakPtr<SpdySession> session = |
| 118 CreateInsecureSpdySession(http_session_.get(), test_key, BoundNetLog()); | 118 CreateInsecureSpdySession(http_session_, test_key, BoundNetLog()); |
| 119 | 119 |
| 120 // Flush the SpdySession::OnReadComplete() task. | 120 // Flush the SpdySession::OnReadComplete() task. |
| 121 base::MessageLoop::current()->RunUntilIdle(); | 121 base::MessageLoop::current()->RunUntilIdle(); |
| 122 | 122 |
| 123 // Verify that we have sessions for everything. | 123 // Verify that we have sessions for everything. |
| 124 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); | 124 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); |
| 125 | 125 |
| 126 // Set the stream to create a new session when it is closed. | 126 // Set the stream to create a new session when it is closed. |
| 127 base::WeakPtr<SpdyStream> spdy_stream = | 127 base::WeakPtr<SpdyStream> spdy_stream = |
| 128 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 128 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 153 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 153 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 154 | 154 |
| 155 CreateNetworkSession(); | 155 CreateNetworkSession(); |
| 156 | 156 |
| 157 // Set up session 1 | 157 // Set up session 1 |
| 158 const std::string kTestHost1("http://www.a.com"); | 158 const std::string kTestHost1("http://www.a.com"); |
| 159 HostPortPair test_host_port_pair1(kTestHost1, 80); | 159 HostPortPair test_host_port_pair1(kTestHost1, 80); |
| 160 SpdySessionKey key1(test_host_port_pair1, ProxyServer::Direct(), | 160 SpdySessionKey key1(test_host_port_pair1, ProxyServer::Direct(), |
| 161 PRIVACY_MODE_DISABLED); | 161 PRIVACY_MODE_DISABLED); |
| 162 base::WeakPtr<SpdySession> session1 = | 162 base::WeakPtr<SpdySession> session1 = |
| 163 CreateInsecureSpdySession(http_session_.get(), key1, BoundNetLog()); | 163 CreateInsecureSpdySession(http_session_, key1, BoundNetLog()); |
| 164 GURL url1(kTestHost1); | 164 GURL url1(kTestHost1); |
| 165 base::WeakPtr<SpdyStream> spdy_stream1 = | 165 base::WeakPtr<SpdyStream> spdy_stream1 = |
| 166 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 166 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
| 167 session1, url1, MEDIUM, BoundNetLog()); | 167 session1, url1, MEDIUM, BoundNetLog()); |
| 168 ASSERT_TRUE(spdy_stream1.get() != NULL); | 168 ASSERT_TRUE(spdy_stream1.get() != NULL); |
| 169 | 169 |
| 170 // Set up session 2 | 170 // Set up session 2 |
| 171 session_deps_.socket_factory->AddSocketDataProvider(&data); | 171 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 172 const std::string kTestHost2("http://www.b.com"); | 172 const std::string kTestHost2("http://www.b.com"); |
| 173 HostPortPair test_host_port_pair2(kTestHost2, 80); | 173 HostPortPair test_host_port_pair2(kTestHost2, 80); |
| 174 SpdySessionKey key2(test_host_port_pair2, ProxyServer::Direct(), | 174 SpdySessionKey key2(test_host_port_pair2, ProxyServer::Direct(), |
| 175 PRIVACY_MODE_DISABLED); | 175 PRIVACY_MODE_DISABLED); |
| 176 base::WeakPtr<SpdySession> session2 = | 176 base::WeakPtr<SpdySession> session2 = |
| 177 CreateInsecureSpdySession(http_session_.get(), key2, BoundNetLog()); | 177 CreateInsecureSpdySession(http_session_, key2, BoundNetLog()); |
| 178 GURL url2(kTestHost2); | 178 GURL url2(kTestHost2); |
| 179 base::WeakPtr<SpdyStream> spdy_stream2 = | 179 base::WeakPtr<SpdyStream> spdy_stream2 = |
| 180 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 180 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
| 181 session2, url2, MEDIUM, BoundNetLog()); | 181 session2, url2, MEDIUM, BoundNetLog()); |
| 182 ASSERT_TRUE(spdy_stream2.get() != NULL); | 182 ASSERT_TRUE(spdy_stream2.get() != NULL); |
| 183 | 183 |
| 184 // Set up session 3 | 184 // Set up session 3 |
| 185 session_deps_.socket_factory->AddSocketDataProvider(&data); | 185 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 186 const std::string kTestHost3("http://www.c.com"); | 186 const std::string kTestHost3("http://www.c.com"); |
| 187 HostPortPair test_host_port_pair3(kTestHost3, 80); | 187 HostPortPair test_host_port_pair3(kTestHost3, 80); |
| 188 SpdySessionKey key3(test_host_port_pair3, ProxyServer::Direct(), | 188 SpdySessionKey key3(test_host_port_pair3, ProxyServer::Direct(), |
| 189 PRIVACY_MODE_DISABLED); | 189 PRIVACY_MODE_DISABLED); |
| 190 base::WeakPtr<SpdySession> session3 = | 190 base::WeakPtr<SpdySession> session3 = |
| 191 CreateInsecureSpdySession(http_session_.get(), key3, BoundNetLog()); | 191 CreateInsecureSpdySession(http_session_, key3, BoundNetLog()); |
| 192 GURL url3(kTestHost3); | 192 GURL url3(kTestHost3); |
| 193 base::WeakPtr<SpdyStream> spdy_stream3 = | 193 base::WeakPtr<SpdyStream> spdy_stream3 = |
| 194 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 194 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
| 195 session3, url3, MEDIUM, BoundNetLog()); | 195 session3, url3, MEDIUM, BoundNetLog()); |
| 196 ASSERT_TRUE(spdy_stream3.get() != NULL); | 196 ASSERT_TRUE(spdy_stream3.get() != NULL); |
| 197 | 197 |
| 198 // All sessions are active and not closed | 198 // All sessions are active and not closed |
| 199 EXPECT_TRUE(session1->is_active()); | 199 EXPECT_TRUE(session1->is_active()); |
| 200 EXPECT_TRUE(session1->IsAvailable()); | 200 EXPECT_TRUE(session1->IsAvailable()); |
| 201 EXPECT_TRUE(session2->is_active()); | 201 EXPECT_TRUE(session2->is_active()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 data.set_connect_data(connect_data); | 279 data.set_connect_data(connect_data); |
| 280 session_deps_.socket_factory->AddSocketDataProvider(&data); | 280 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 281 | 281 |
| 282 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 282 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
| 283 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 283 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 284 | 284 |
| 285 CreateNetworkSession(); | 285 CreateNetworkSession(); |
| 286 | 286 |
| 287 // Setup the first session to the first host. | 287 // Setup the first session to the first host. |
| 288 base::WeakPtr<SpdySession> session = | 288 base::WeakPtr<SpdySession> session = |
| 289 CreateInsecureSpdySession(http_session_.get(), test_key, BoundNetLog()); | 289 CreateInsecureSpdySession(http_session_, test_key, BoundNetLog()); |
| 290 | 290 |
| 291 // Flush the SpdySession::OnReadComplete() task. | 291 // Flush the SpdySession::OnReadComplete() task. |
| 292 base::MessageLoop::current()->RunUntilIdle(); | 292 base::MessageLoop::current()->RunUntilIdle(); |
| 293 | 293 |
| 294 // Verify that we have sessions for everything. | 294 // Verify that we have sessions for everything. |
| 295 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); | 295 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); |
| 296 | 296 |
| 297 // Set the stream to create a new session when it is closed. | 297 // Set the stream to create a new session when it is closed. |
| 298 base::WeakPtr<SpdyStream> spdy_stream = | 298 base::WeakPtr<SpdyStream> spdy_stream = |
| 299 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 299 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 368 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
| 369 data.set_connect_data(connect_data); | 369 data.set_connect_data(connect_data); |
| 370 session_deps_.socket_factory->AddSocketDataProvider(&data); | 370 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 371 | 371 |
| 372 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 372 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
| 373 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 373 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 374 | 374 |
| 375 CreateNetworkSession(); | 375 CreateNetworkSession(); |
| 376 | 376 |
| 377 // Setup the first session to the first host. | 377 // Setup the first session to the first host. |
| 378 base::WeakPtr<SpdySession> session = CreateInsecureSpdySession( | 378 base::WeakPtr<SpdySession> session = |
| 379 http_session_.get(), test_hosts[0].key, BoundNetLog()); | 379 CreateInsecureSpdySession( |
| 380 http_session_, test_hosts[0].key, BoundNetLog()); |
| 380 | 381 |
| 381 // Flush the SpdySession::OnReadComplete() task. | 382 // Flush the SpdySession::OnReadComplete() task. |
| 382 base::MessageLoop::current()->RunUntilIdle(); | 383 base::MessageLoop::current()->RunUntilIdle(); |
| 383 | 384 |
| 384 // The third host has no overlap with the first, so it can't pool IPs. | 385 // The third host has no overlap with the first, so it can't pool IPs. |
| 385 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 386 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
| 386 | 387 |
| 387 // The second host overlaps with the first, and should IP pool. | 388 // The second host overlaps with the first, and should IP pool. |
| 388 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 389 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
| 389 | 390 |
| 390 // Verify that the second host, through a proxy, won't share the IP. | 391 // Verify that the second host, through a proxy, won't share the IP. |
| 391 SpdySessionKey proxy_key(test_hosts[1].key.host_port_pair(), | 392 SpdySessionKey proxy_key(test_hosts[1].key.host_port_pair(), |
| 392 ProxyServer::FromPacString("HTTP http://proxy.foo.com/"), | 393 ProxyServer::FromPacString("HTTP http://proxy.foo.com/"), |
| 393 PRIVACY_MODE_DISABLED); | 394 PRIVACY_MODE_DISABLED); |
| 394 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, proxy_key)); | 395 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, proxy_key)); |
| 395 | 396 |
| 396 // Overlap between 2 and 3 does is not transitive to 1. | 397 // Overlap between 2 and 3 does is not transitive to 1. |
| 397 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 398 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
| 398 | 399 |
| 399 // Create a new session to host 2. | 400 // Create a new session to host 2. |
| 400 session_deps_.socket_factory->AddSocketDataProvider(&data); | 401 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 401 base::WeakPtr<SpdySession> session2 = CreateInsecureSpdySession( | 402 base::WeakPtr<SpdySession> session2 = |
| 402 http_session_.get(), test_hosts[2].key, BoundNetLog()); | 403 CreateInsecureSpdySession( |
| 404 http_session_, test_hosts[2].key, BoundNetLog()); |
| 403 | 405 |
| 404 // Verify that we have sessions for everything. | 406 // Verify that we have sessions for everything. |
| 405 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); | 407 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); |
| 406 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 408 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
| 407 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 409 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
| 408 | 410 |
| 409 // Grab the session to host 1 and verify that it is the same session | 411 // Grab the session to host 1 and verify that it is the same session |
| 410 // we got with host 0, and that is a different from host 2's session. | 412 // we got with host 0, and that is a different from host 2's session. |
| 411 base::WeakPtr<SpdySession> session1 = | 413 base::WeakPtr<SpdySession> session1 = |
| 412 spdy_session_pool_->FindAvailableSession( | 414 spdy_session_pool_->FindAvailableSession( |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 531 |
| 530 CreateNetworkSession(); | 532 CreateNetworkSession(); |
| 531 | 533 |
| 532 // Set up session A: Going away, but with an active stream. | 534 // Set up session A: Going away, but with an active stream. |
| 533 session_deps_.socket_factory->AddSocketDataProvider(&data); | 535 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 534 const std::string kTestHostA("http://www.a.com"); | 536 const std::string kTestHostA("http://www.a.com"); |
| 535 HostPortPair test_host_port_pairA(kTestHostA, 80); | 537 HostPortPair test_host_port_pairA(kTestHostA, 80); |
| 536 SpdySessionKey keyA( | 538 SpdySessionKey keyA( |
| 537 test_host_port_pairA, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); | 539 test_host_port_pairA, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 538 base::WeakPtr<SpdySession> sessionA = | 540 base::WeakPtr<SpdySession> sessionA = |
| 539 CreateInsecureSpdySession(http_session_.get(), keyA, BoundNetLog()); | 541 CreateInsecureSpdySession(http_session_, keyA, BoundNetLog()); |
| 540 | 542 |
| 541 GURL urlA(kTestHostA); | 543 GURL urlA(kTestHostA); |
| 542 base::WeakPtr<SpdyStream> spdy_streamA = CreateStreamSynchronously( | 544 base::WeakPtr<SpdyStream> spdy_streamA = CreateStreamSynchronously( |
| 543 SPDY_BIDIRECTIONAL_STREAM, sessionA, urlA, MEDIUM, BoundNetLog()); | 545 SPDY_BIDIRECTIONAL_STREAM, sessionA, urlA, MEDIUM, BoundNetLog()); |
| 544 test::StreamDelegateDoNothing delegateA(spdy_streamA); | 546 test::StreamDelegateDoNothing delegateA(spdy_streamA); |
| 545 spdy_streamA->SetDelegate(&delegateA); | 547 spdy_streamA->SetDelegate(&delegateA); |
| 546 | 548 |
| 547 scoped_ptr<SpdyHeaderBlock> headers( | 549 scoped_ptr<SpdyHeaderBlock> headers( |
| 548 spdy_util.ConstructGetHeaderBlock(urlA.spec())); | 550 spdy_util.ConstructGetHeaderBlock(urlA.spec())); |
| 549 spdy_streamA->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); | 551 spdy_streamA->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); |
| 550 EXPECT_TRUE(spdy_streamA->HasUrlFromHeaders()); | 552 EXPECT_TRUE(spdy_streamA->HasUrlFromHeaders()); |
| 551 | 553 |
| 552 base::MessageLoop::current()->RunUntilIdle(); // Allow headers to write. | 554 base::MessageLoop::current()->RunUntilIdle(); // Allow headers to write. |
| 553 EXPECT_TRUE(delegateA.send_headers_completed()); | 555 EXPECT_TRUE(delegateA.send_headers_completed()); |
| 554 | 556 |
| 555 sessionA->MakeUnavailable(); | 557 sessionA->MakeUnavailable(); |
| 556 EXPECT_TRUE(sessionA->IsGoingAway()); | 558 EXPECT_TRUE(sessionA->IsGoingAway()); |
| 557 EXPECT_FALSE(delegateA.StreamIsClosed()); | 559 EXPECT_FALSE(delegateA.StreamIsClosed()); |
| 558 | 560 |
| 559 // Set up session B: Available, with a created stream. | 561 // Set up session B: Available, with a created stream. |
| 560 const std::string kTestHostB("http://www.b.com"); | 562 const std::string kTestHostB("http://www.b.com"); |
| 561 HostPortPair test_host_port_pairB(kTestHostB, 80); | 563 HostPortPair test_host_port_pairB(kTestHostB, 80); |
| 562 SpdySessionKey keyB( | 564 SpdySessionKey keyB( |
| 563 test_host_port_pairB, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); | 565 test_host_port_pairB, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 564 base::WeakPtr<SpdySession> sessionB = | 566 base::WeakPtr<SpdySession> sessionB = |
| 565 CreateInsecureSpdySession(http_session_.get(), keyB, BoundNetLog()); | 567 CreateInsecureSpdySession(http_session_, keyB, BoundNetLog()); |
| 566 EXPECT_TRUE(sessionB->IsAvailable()); | 568 EXPECT_TRUE(sessionB->IsAvailable()); |
| 567 | 569 |
| 568 GURL urlB(kTestHostB); | 570 GURL urlB(kTestHostB); |
| 569 base::WeakPtr<SpdyStream> spdy_streamB = CreateStreamSynchronously( | 571 base::WeakPtr<SpdyStream> spdy_streamB = CreateStreamSynchronously( |
| 570 SPDY_BIDIRECTIONAL_STREAM, sessionB, urlB, MEDIUM, BoundNetLog()); | 572 SPDY_BIDIRECTIONAL_STREAM, sessionB, urlB, MEDIUM, BoundNetLog()); |
| 571 test::StreamDelegateDoNothing delegateB(spdy_streamB); | 573 test::StreamDelegateDoNothing delegateB(spdy_streamB); |
| 572 spdy_streamB->SetDelegate(&delegateB); | 574 spdy_streamB->SetDelegate(&delegateB); |
| 573 | 575 |
| 574 // Set up session C: Draining. | 576 // Set up session C: Draining. |
| 575 session_deps_.socket_factory->AddSocketDataProvider(&data); | 577 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 576 const std::string kTestHostC("http://www.c.com"); | 578 const std::string kTestHostC("http://www.c.com"); |
| 577 HostPortPair test_host_port_pairC(kTestHostC, 80); | 579 HostPortPair test_host_port_pairC(kTestHostC, 80); |
| 578 SpdySessionKey keyC( | 580 SpdySessionKey keyC( |
| 579 test_host_port_pairC, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); | 581 test_host_port_pairC, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 580 base::WeakPtr<SpdySession> sessionC = | 582 base::WeakPtr<SpdySession> sessionC = |
| 581 CreateInsecureSpdySession(http_session_.get(), keyC, BoundNetLog()); | 583 CreateInsecureSpdySession(http_session_, keyC, BoundNetLog()); |
| 582 | 584 |
| 583 sessionC->CloseSessionOnError(ERR_SPDY_PROTOCOL_ERROR, "Error!"); | 585 sessionC->CloseSessionOnError(ERR_SPDY_PROTOCOL_ERROR, "Error!"); |
| 584 EXPECT_TRUE(sessionC->IsDraining()); | 586 EXPECT_TRUE(sessionC->IsDraining()); |
| 585 | 587 |
| 586 spdy_session_pool_->OnIPAddressChanged(); | 588 spdy_session_pool_->OnIPAddressChanged(); |
| 587 | 589 |
| 588 #if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) | 590 #if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) |
| 589 EXPECT_TRUE(sessionA->IsGoingAway()); | 591 EXPECT_TRUE(sessionA->IsGoingAway()); |
| 590 EXPECT_TRUE(sessionB->IsDraining()); | 592 EXPECT_TRUE(sessionB->IsDraining()); |
| 591 EXPECT_TRUE(sessionC->IsDraining()); | 593 EXPECT_TRUE(sessionC->IsDraining()); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 611 EXPECT_TRUE(delegateA.StreamIsClosed()); | 613 EXPECT_TRUE(delegateA.StreamIsClosed()); |
| 612 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose()); | 614 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateA.WaitForClose()); |
| 613 EXPECT_TRUE(delegateB.StreamIsClosed()); | 615 EXPECT_TRUE(delegateB.StreamIsClosed()); |
| 614 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose()); | 616 EXPECT_EQ(ERR_NETWORK_CHANGED, delegateB.WaitForClose()); |
| 615 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) | 617 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) |
| 616 } | 618 } |
| 617 | 619 |
| 618 } // namespace | 620 } // namespace |
| 619 | 621 |
| 620 } // namespace net | 622 } // namespace net |
| OLD | NEW |