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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "net/dns/host_cache.h" | 12 #include "net/dns/host_cache.h" |
13 #include "net/http/http_network_session.h" | 13 #include "net/http/http_network_session.h" |
14 #include "net/socket/client_socket_handle.h" | 14 #include "net/socket/client_socket_handle.h" |
15 #include "net/socket/transport_client_socket_pool.h" | 15 #include "net/socket/transport_client_socket_pool.h" |
16 #include "net/spdy/spdy_session.h" | 16 #include "net/spdy/spdy_session.h" |
| 17 #include "net/spdy/spdy_stream_test_util.h" |
17 #include "net/spdy/spdy_test_util_common.h" | 18 #include "net/spdy/spdy_test_util_common.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 class SpdySessionPoolTest : public ::testing::Test, | 25 class SpdySessionPoolTest : public ::testing::Test, |
25 public ::testing::WithParamInterface<NextProto> { | 26 public ::testing::WithParamInterface<NextProto> { |
26 protected: | 27 protected: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 132 |
132 // Close the current session. | 133 // Close the current session. |
133 spdy_session_pool_->CloseCurrentSessions(net::ERR_ABORTED); | 134 spdy_session_pool_->CloseCurrentSessions(net::ERR_ABORTED); |
134 | 135 |
135 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); | 136 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); |
136 } | 137 } |
137 | 138 |
138 TEST_P(SpdySessionPoolTest, CloseCurrentIdleSessions) { | 139 TEST_P(SpdySessionPoolTest, CloseCurrentIdleSessions) { |
139 MockConnect connect_data(SYNCHRONOUS, OK); | 140 MockConnect connect_data(SYNCHRONOUS, OK); |
140 MockRead reads[] = { | 141 MockRead reads[] = { |
141 MockRead(ASYNC, 0, 0) // EOF | 142 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. |
142 }; | 143 }; |
143 | 144 |
144 session_deps_.host_resolver->set_synchronous_mode(true); | 145 session_deps_.host_resolver->set_synchronous_mode(true); |
145 | 146 |
146 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 147 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
147 data.set_connect_data(connect_data); | 148 data.set_connect_data(connect_data); |
148 session_deps_.socket_factory->AddSocketDataProvider(&data); | 149 session_deps_.socket_factory->AddSocketDataProvider(&data); |
149 | 150 |
150 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 151 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
151 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 152 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 base::WeakPtr<SpdySession> session3 = | 189 base::WeakPtr<SpdySession> session3 = |
189 CreateInsecureSpdySession(http_session_, key3, BoundNetLog()); | 190 CreateInsecureSpdySession(http_session_, key3, BoundNetLog()); |
190 GURL url3(kTestHost3); | 191 GURL url3(kTestHost3); |
191 base::WeakPtr<SpdyStream> spdy_stream3 = | 192 base::WeakPtr<SpdyStream> spdy_stream3 = |
192 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 193 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
193 session3, url3, MEDIUM, BoundNetLog()); | 194 session3, url3, MEDIUM, BoundNetLog()); |
194 ASSERT_TRUE(spdy_stream3.get() != NULL); | 195 ASSERT_TRUE(spdy_stream3.get() != NULL); |
195 | 196 |
196 // All sessions are active and not closed | 197 // All sessions are active and not closed |
197 EXPECT_TRUE(session1->is_active()); | 198 EXPECT_TRUE(session1->is_active()); |
198 EXPECT_FALSE(session1->IsClosed()); | 199 EXPECT_TRUE(session1->IsAvailable()); |
199 EXPECT_TRUE(session2->is_active()); | 200 EXPECT_TRUE(session2->is_active()); |
200 EXPECT_FALSE(session2->IsClosed()); | 201 EXPECT_TRUE(session2->IsAvailable()); |
201 EXPECT_TRUE(session3->is_active()); | 202 EXPECT_TRUE(session3->is_active()); |
202 EXPECT_FALSE(session3->IsClosed()); | 203 EXPECT_TRUE(session3->IsAvailable()); |
203 | 204 |
204 // Should not do anything, all are active | 205 // Should not do anything, all are active |
205 spdy_session_pool_->CloseCurrentIdleSessions(); | 206 spdy_session_pool_->CloseCurrentIdleSessions(); |
206 EXPECT_TRUE(session1->is_active()); | 207 EXPECT_TRUE(session1->is_active()); |
207 EXPECT_FALSE(session1->IsClosed()); | 208 EXPECT_TRUE(session1->IsAvailable()); |
208 EXPECT_TRUE(session2->is_active()); | 209 EXPECT_TRUE(session2->is_active()); |
209 EXPECT_FALSE(session2->IsClosed()); | 210 EXPECT_TRUE(session2->IsAvailable()); |
210 EXPECT_TRUE(session3->is_active()); | 211 EXPECT_TRUE(session3->is_active()); |
211 EXPECT_FALSE(session3->IsClosed()); | 212 EXPECT_TRUE(session3->IsAvailable()); |
212 | 213 |
213 // Make sessions 1 and 3 inactive, but keep them open. | 214 // Make sessions 1 and 3 inactive, but keep them open. |
214 // Session 2 still open and active | 215 // Session 2 still open and active |
215 session1->CloseCreatedStream(spdy_stream1, OK); | 216 session1->CloseCreatedStream(spdy_stream1, OK); |
216 EXPECT_EQ(NULL, spdy_stream1.get()); | 217 EXPECT_EQ(NULL, spdy_stream1.get()); |
217 session3->CloseCreatedStream(spdy_stream3, OK); | 218 session3->CloseCreatedStream(spdy_stream3, OK); |
218 EXPECT_EQ(NULL, spdy_stream3.get()); | 219 EXPECT_EQ(NULL, spdy_stream3.get()); |
219 EXPECT_FALSE(session1->is_active()); | 220 EXPECT_FALSE(session1->is_active()); |
220 EXPECT_FALSE(session1->IsClosed()); | 221 EXPECT_TRUE(session1->IsAvailable()); |
221 EXPECT_TRUE(session2->is_active()); | 222 EXPECT_TRUE(session2->is_active()); |
222 EXPECT_FALSE(session2->IsClosed()); | 223 EXPECT_TRUE(session2->IsAvailable()); |
223 EXPECT_FALSE(session3->is_active()); | 224 EXPECT_FALSE(session3->is_active()); |
224 EXPECT_FALSE(session3->IsClosed()); | 225 EXPECT_TRUE(session3->IsAvailable()); |
225 | 226 |
226 // Should close session 1 and 3, 2 should be left open | 227 // Should close session 1 and 3, 2 should be left open |
227 spdy_session_pool_->CloseCurrentIdleSessions(); | 228 spdy_session_pool_->CloseCurrentIdleSessions(); |
| 229 base::MessageLoop::current()->RunUntilIdle(); |
| 230 |
228 EXPECT_TRUE(session1 == NULL); | 231 EXPECT_TRUE(session1 == NULL); |
229 EXPECT_TRUE(session2->is_active()); | 232 EXPECT_TRUE(session2->is_active()); |
230 EXPECT_FALSE(session2->IsClosed()); | 233 EXPECT_TRUE(session2->IsAvailable()); |
231 EXPECT_TRUE(session3 == NULL); | 234 EXPECT_TRUE(session3 == NULL); |
232 | 235 |
233 // Should not do anything | 236 // Should not do anything |
234 spdy_session_pool_->CloseCurrentIdleSessions(); | 237 spdy_session_pool_->CloseCurrentIdleSessions(); |
| 238 base::MessageLoop::current()->RunUntilIdle(); |
| 239 |
235 EXPECT_TRUE(session2->is_active()); | 240 EXPECT_TRUE(session2->is_active()); |
236 EXPECT_FALSE(session2->IsClosed()); | 241 EXPECT_TRUE(session2->IsAvailable()); |
237 | 242 |
238 // Make 2 not active | 243 // Make 2 not active |
239 session2->CloseCreatedStream(spdy_stream2, OK); | 244 session2->CloseCreatedStream(spdy_stream2, OK); |
| 245 base::MessageLoop::current()->RunUntilIdle(); |
| 246 |
240 EXPECT_EQ(NULL, spdy_stream2.get()); | 247 EXPECT_EQ(NULL, spdy_stream2.get()); |
241 EXPECT_FALSE(session2->is_active()); | 248 EXPECT_FALSE(session2->is_active()); |
242 EXPECT_FALSE(session2->IsClosed()); | 249 EXPECT_TRUE(session2->IsAvailable()); |
243 | 250 |
244 // This should close session 2 | 251 // This should close session 2 |
245 spdy_session_pool_->CloseCurrentIdleSessions(); | 252 spdy_session_pool_->CloseCurrentIdleSessions(); |
| 253 base::MessageLoop::current()->RunUntilIdle(); |
| 254 |
246 EXPECT_TRUE(session2 == NULL); | 255 EXPECT_TRUE(session2 == NULL); |
247 } | 256 } |
248 | 257 |
249 // Set up a SpdyStream to create a new session when it is closed. | 258 // Set up a SpdyStream to create a new session when it is closed. |
250 // CloseAllSessions should close the newly-created session. | 259 // CloseAllSessions should close the newly-created session. |
251 TEST_P(SpdySessionPoolTest, CloseAllSessions) { | 260 TEST_P(SpdySessionPoolTest, CloseAllSessions) { |
252 const char kTestHost[] = "www.foo.com"; | 261 const char kTestHost[] = "www.foo.com"; |
253 const int kTestPort = 80; | 262 const int kTestPort = 80; |
254 | 263 |
255 session_deps_.host_resolver->set_synchronous_mode(true); | 264 session_deps_.host_resolver->set_synchronous_mode(true); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 422 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
414 | 423 |
415 // Expire the host cache | 424 // Expire the host cache |
416 session_deps_.host_resolver->GetHostCache()->clear(); | 425 session_deps_.host_resolver->GetHostCache()->clear(); |
417 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 426 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
418 | 427 |
419 // Cleanup the sessions. | 428 // Cleanup the sessions. |
420 switch (close_sessions_type) { | 429 switch (close_sessions_type) { |
421 case SPDY_POOL_CLOSE_SESSIONS_MANUALLY: | 430 case SPDY_POOL_CLOSE_SESSIONS_MANUALLY: |
422 session->CloseSessionOnError(ERR_ABORTED, std::string()); | 431 session->CloseSessionOnError(ERR_ABORTED, std::string()); |
| 432 session2->CloseSessionOnError(ERR_ABORTED, std::string()); |
| 433 base::MessageLoop::current()->RunUntilIdle(); |
423 EXPECT_TRUE(session == NULL); | 434 EXPECT_TRUE(session == NULL); |
424 session2->CloseSessionOnError(ERR_ABORTED, std::string()); | |
425 EXPECT_TRUE(session2 == NULL); | 435 EXPECT_TRUE(session2 == NULL); |
426 break; | 436 break; |
427 case SPDY_POOL_CLOSE_CURRENT_SESSIONS: | 437 case SPDY_POOL_CLOSE_CURRENT_SESSIONS: |
428 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); | 438 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); |
429 break; | 439 break; |
430 case SPDY_POOL_CLOSE_IDLE_SESSIONS: | 440 case SPDY_POOL_CLOSE_IDLE_SESSIONS: |
431 GURL url(test_hosts[0].url); | 441 GURL url(test_hosts[0].url); |
432 base::WeakPtr<SpdyStream> spdy_stream = | 442 base::WeakPtr<SpdyStream> spdy_stream = |
433 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 443 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
434 session, url, MEDIUM, BoundNetLog()); | 444 session, url, MEDIUM, BoundNetLog()); |
435 GURL url1(test_hosts[1].url); | 445 GURL url1(test_hosts[1].url); |
436 base::WeakPtr<SpdyStream> spdy_stream1 = | 446 base::WeakPtr<SpdyStream> spdy_stream1 = |
437 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 447 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
438 session1, url1, MEDIUM, BoundNetLog()); | 448 session1, url1, MEDIUM, BoundNetLog()); |
439 GURL url2(test_hosts[2].url); | 449 GURL url2(test_hosts[2].url); |
440 base::WeakPtr<SpdyStream> spdy_stream2 = | 450 base::WeakPtr<SpdyStream> spdy_stream2 = |
441 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 451 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
442 session2, url2, MEDIUM, BoundNetLog()); | 452 session2, url2, MEDIUM, BoundNetLog()); |
443 | 453 |
444 // Close streams to make spdy_session and spdy_session1 inactive. | 454 // Close streams to make spdy_session and spdy_session1 inactive. |
445 session->CloseCreatedStream(spdy_stream, OK); | 455 session->CloseCreatedStream(spdy_stream, OK); |
446 EXPECT_EQ(NULL, spdy_stream.get()); | 456 EXPECT_EQ(NULL, spdy_stream.get()); |
447 session1->CloseCreatedStream(spdy_stream1, OK); | 457 session1->CloseCreatedStream(spdy_stream1, OK); |
448 EXPECT_EQ(NULL, spdy_stream1.get()); | 458 EXPECT_EQ(NULL, spdy_stream1.get()); |
449 | 459 |
450 // Check spdy_session and spdy_session1 are not closed. | 460 // Check spdy_session and spdy_session1 are not closed. |
451 EXPECT_FALSE(session->is_active()); | 461 EXPECT_FALSE(session->is_active()); |
452 EXPECT_FALSE(session->IsClosed()); | 462 EXPECT_TRUE(session->IsAvailable()); |
453 EXPECT_FALSE(session1->is_active()); | 463 EXPECT_FALSE(session1->is_active()); |
454 EXPECT_FALSE(session1->IsClosed()); | 464 EXPECT_TRUE(session1->IsAvailable()); |
455 EXPECT_TRUE(session2->is_active()); | 465 EXPECT_TRUE(session2->is_active()); |
456 EXPECT_FALSE(session2->IsClosed()); | 466 EXPECT_TRUE(session2->IsAvailable()); |
457 | 467 |
458 // Test that calling CloseIdleSessions, does not cause a crash. | 468 // Test that calling CloseIdleSessions, does not cause a crash. |
459 // http://crbug.com/181400 | 469 // http://crbug.com/181400 |
460 spdy_session_pool_->CloseCurrentIdleSessions(); | 470 spdy_session_pool_->CloseCurrentIdleSessions(); |
| 471 base::MessageLoop::current()->RunUntilIdle(); |
461 | 472 |
462 // Verify spdy_session and spdy_session1 are closed. | 473 // Verify spdy_session and spdy_session1 are closed. |
463 EXPECT_TRUE(session == NULL); | 474 EXPECT_TRUE(session == NULL); |
464 EXPECT_TRUE(session1 == NULL); | 475 EXPECT_TRUE(session1 == NULL); |
465 EXPECT_TRUE(session2->is_active()); | 476 EXPECT_TRUE(session2->is_active()); |
466 EXPECT_FALSE(session2->IsClosed()); | 477 EXPECT_TRUE(session2->IsAvailable()); |
467 | 478 |
468 spdy_stream2->Cancel(); | 479 spdy_stream2->Cancel(); |
469 EXPECT_EQ(NULL, spdy_stream.get()); | 480 EXPECT_EQ(NULL, spdy_stream.get()); |
470 EXPECT_EQ(NULL, spdy_stream1.get()); | 481 EXPECT_EQ(NULL, spdy_stream1.get()); |
471 EXPECT_EQ(NULL, spdy_stream2.get()); | 482 EXPECT_EQ(NULL, spdy_stream2.get()); |
| 483 |
472 session2->CloseSessionOnError(ERR_ABORTED, std::string()); | 484 session2->CloseSessionOnError(ERR_ABORTED, std::string()); |
| 485 base::MessageLoop::current()->RunUntilIdle(); |
473 EXPECT_TRUE(session2 == NULL); | 486 EXPECT_TRUE(session2 == NULL); |
474 break; | 487 break; |
475 } | 488 } |
476 | 489 |
477 // Verify that the map is all cleaned up. | 490 // Verify that the map is all cleaned up. |
478 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); | 491 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); |
479 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 492 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
480 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 493 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
481 } | 494 } |
482 | 495 |
483 TEST_P(SpdySessionPoolTest, IPPooling) { | 496 TEST_P(SpdySessionPoolTest, IPPooling) { |
484 RunIPPoolingTest(SPDY_POOL_CLOSE_SESSIONS_MANUALLY); | 497 RunIPPoolingTest(SPDY_POOL_CLOSE_SESSIONS_MANUALLY); |
485 } | 498 } |
486 | 499 |
487 TEST_P(SpdySessionPoolTest, IPPoolingCloseCurrentSessions) { | 500 TEST_P(SpdySessionPoolTest, IPPoolingCloseCurrentSessions) { |
488 RunIPPoolingTest(SPDY_POOL_CLOSE_CURRENT_SESSIONS); | 501 RunIPPoolingTest(SPDY_POOL_CLOSE_CURRENT_SESSIONS); |
489 } | 502 } |
490 | 503 |
491 TEST_P(SpdySessionPoolTest, IPPoolingCloseIdleSessions) { | 504 TEST_P(SpdySessionPoolTest, IPPoolingCloseIdleSessions) { |
492 RunIPPoolingTest(SPDY_POOL_CLOSE_IDLE_SESSIONS); | 505 RunIPPoolingTest(SPDY_POOL_CLOSE_IDLE_SESSIONS); |
493 } | 506 } |
494 | 507 |
| 508 // Construct a Pool with SpdySessions in various availability states. Simulate |
| 509 // an IP address change. Ensure sessions gracefully shut down. Regression test |
| 510 // for crbug.com/379469. |
| 511 TEST_P(SpdySessionPoolTest, IPAddressChanged) { |
| 512 MockConnect connect_data(SYNCHRONOUS, OK); |
| 513 MockRead reads[] = { |
| 514 MockRead(SYNCHRONOUS, ERR_IO_PENDING) // Stall forever. |
| 515 }; |
| 516 session_deps_.host_resolver->set_synchronous_mode(true); |
| 517 |
| 518 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
| 519 data.set_connect_data(connect_data); |
| 520 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 521 |
| 522 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
| 523 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 524 |
| 525 CreateNetworkSession(); |
| 526 |
| 527 // Set up session 1: Available, but idle. |
| 528 const std::string kTestHost1("http://www.a.com"); |
| 529 HostPortPair test_host_port_pair1(kTestHost1, 80); |
| 530 SpdySessionKey key1( |
| 531 test_host_port_pair1, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 532 base::WeakPtr<SpdySession> session1 = |
| 533 CreateInsecureSpdySession(http_session_, key1, BoundNetLog()); |
| 534 EXPECT_TRUE(session1->IsAvailable()); |
| 535 |
| 536 // Set up session 2: Going away, but with an active stream. |
| 537 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 538 const std::string kTestHost2("http://www.b.com"); |
| 539 HostPortPair test_host_port_pair2(kTestHost2, 80); |
| 540 SpdySessionKey key2( |
| 541 test_host_port_pair2, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 542 base::WeakPtr<SpdySession> session2 = |
| 543 CreateInsecureSpdySession(http_session_, key2, BoundNetLog()); |
| 544 GURL url2(kTestHost2); |
| 545 base::WeakPtr<SpdyStream> spdy_stream2 = CreateStreamSynchronously( |
| 546 SPDY_BIDIRECTIONAL_STREAM, session2, url2, MEDIUM, BoundNetLog()); |
| 547 test::StreamDelegateDoNothing delegate2(spdy_stream2); |
| 548 spdy_stream2->SetDelegate(&delegate2); |
| 549 |
| 550 scoped_ptr<SpdyHeaderBlock> headers( |
| 551 SpdyTestUtil(GetParam()).ConstructGetHeaderBlock(url2.spec())); |
| 552 spdy_stream2->SendRequestHeaders(headers.Pass(), NO_MORE_DATA_TO_SEND); |
| 553 EXPECT_TRUE(spdy_stream2->HasUrlFromHeaders()); |
| 554 |
| 555 session2->MakeUnavailable(); |
| 556 EXPECT_TRUE(session2->IsGoingAway()); |
| 557 |
| 558 // Set up session 3: Draining. |
| 559 session_deps_.socket_factory->AddSocketDataProvider(&data); |
| 560 const std::string kTestHost3("http://www.c.com"); |
| 561 HostPortPair test_host_port_pair3(kTestHost3, 80); |
| 562 SpdySessionKey key3( |
| 563 test_host_port_pair3, ProxyServer::Direct(), PRIVACY_MODE_DISABLED); |
| 564 base::WeakPtr<SpdySession> session3 = |
| 565 CreateInsecureSpdySession(http_session_, key3, BoundNetLog()); |
| 566 |
| 567 session3->CloseSessionOnError(ERR_SPDY_PROTOCOL_ERROR, "Error!"); |
| 568 EXPECT_TRUE(session3->IsDraining()); |
| 569 |
| 570 spdy_session_pool_->OnIPAddressChanged(); |
| 571 |
| 572 #if defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) |
| 573 // TODO(jgraettinger): This should be draining when crbug.com/324653 is fixed. |
| 574 EXPECT_TRUE(session1->IsGoingAway()); |
| 575 EXPECT_TRUE(session2->IsGoingAway()); |
| 576 EXPECT_TRUE(session3->IsDraining()); |
| 577 |
| 578 EXPECT_FALSE(delegate2.StreamIsClosed()); |
| 579 |
| 580 session1->CloseSessionOnError(ERR_ABORTED, "Closing"); |
| 581 session2->CloseSessionOnError(ERR_ABORTED, "Closing"); |
| 582 |
| 583 EXPECT_TRUE(delegate2.StreamIsClosed()); |
| 584 EXPECT_EQ(ERR_ABORTED, delegate2.WaitForClose()); |
| 585 #else |
| 586 EXPECT_TRUE(session1->IsDraining()); |
| 587 EXPECT_TRUE(session2->IsDraining()); |
| 588 EXPECT_TRUE(session3->IsDraining()); |
| 589 |
| 590 EXPECT_TRUE(delegate2.StreamIsClosed()); |
| 591 EXPECT_EQ(ERR_NETWORK_CHANGED, delegate2.WaitForClose()); |
| 592 #endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS) |
| 593 } |
| 594 |
495 } // namespace | 595 } // namespace |
496 | 596 |
497 } // namespace net | 597 } // namespace net |
OLD | NEW |