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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 104 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
105 data.set_connect_data(connect_data); | 105 data.set_connect_data(connect_data); |
106 session_deps_.socket_factory->AddSocketDataProvider(&data); | 106 session_deps_.socket_factory->AddSocketDataProvider(&data); |
107 | 107 |
108 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 108 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
109 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 109 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
110 | 110 |
111 CreateNetworkSession(); | 111 CreateNetworkSession(); |
112 | 112 |
113 // Setup the first session to the first host. | 113 // Setup the first session to the first host. |
114 scoped_refptr<SpdySession> session = | 114 base::WeakPtr<SpdySession> session = |
115 CreateInsecureSpdySession(http_session_, test_key, BoundNetLog()); | 115 CreateInsecureSpdySession(http_session_, test_key, BoundNetLog()); |
116 | 116 |
117 // Flush the SpdySession::OnReadComplete() task. | 117 // Flush the SpdySession::OnReadComplete() task. |
118 base::MessageLoop::current()->RunUntilIdle(); | 118 base::MessageLoop::current()->RunUntilIdle(); |
119 | 119 |
120 // Verify that we have sessions for everything. | 120 // Verify that we have sessions for everything. |
121 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); | 121 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); |
122 | 122 |
123 // Set the stream to create a new session when it is closed. | 123 // Set the stream to create a new session when it is closed. |
124 base::WeakPtr<SpdyStream> spdy_stream = | 124 base::WeakPtr<SpdyStream> spdy_stream = |
(...skipping 24 matching lines...) Expand all Loading... |
149 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 149 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
150 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 150 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
151 | 151 |
152 CreateNetworkSession(); | 152 CreateNetworkSession(); |
153 | 153 |
154 // Set up session 1 | 154 // Set up session 1 |
155 const std::string kTestHost1("http://www.a.com"); | 155 const std::string kTestHost1("http://www.a.com"); |
156 HostPortPair test_host_port_pair1(kTestHost1, 80); | 156 HostPortPair test_host_port_pair1(kTestHost1, 80); |
157 SpdySessionKey key1(test_host_port_pair1, ProxyServer::Direct(), | 157 SpdySessionKey key1(test_host_port_pair1, ProxyServer::Direct(), |
158 kPrivacyModeDisabled); | 158 kPrivacyModeDisabled); |
159 scoped_refptr<SpdySession> session1 = | 159 base::WeakPtr<SpdySession> session1 = |
160 CreateInsecureSpdySession(http_session_, key1, BoundNetLog()); | 160 CreateInsecureSpdySession(http_session_, key1, BoundNetLog()); |
161 GURL url1(kTestHost1); | 161 GURL url1(kTestHost1); |
162 base::WeakPtr<SpdyStream> spdy_stream1 = | 162 base::WeakPtr<SpdyStream> spdy_stream1 = |
163 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 163 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
164 session1, url1, MEDIUM, BoundNetLog()); | 164 session1, url1, MEDIUM, BoundNetLog()); |
165 ASSERT_TRUE(spdy_stream1.get() != NULL); | 165 ASSERT_TRUE(spdy_stream1.get() != NULL); |
166 | 166 |
167 // Set up session 2 | 167 // Set up session 2 |
168 session_deps_.socket_factory->AddSocketDataProvider(&data); | 168 session_deps_.socket_factory->AddSocketDataProvider(&data); |
169 const std::string kTestHost2("http://www.b.com"); | 169 const std::string kTestHost2("http://www.b.com"); |
170 HostPortPair test_host_port_pair2(kTestHost2, 80); | 170 HostPortPair test_host_port_pair2(kTestHost2, 80); |
171 SpdySessionKey key2(test_host_port_pair2, ProxyServer::Direct(), | 171 SpdySessionKey key2(test_host_port_pair2, ProxyServer::Direct(), |
172 kPrivacyModeDisabled); | 172 kPrivacyModeDisabled); |
173 scoped_refptr<SpdySession> session2 = | 173 base::WeakPtr<SpdySession> session2 = |
174 CreateInsecureSpdySession(http_session_, key2, BoundNetLog()); | 174 CreateInsecureSpdySession(http_session_, key2, BoundNetLog()); |
175 GURL url2(kTestHost2); | 175 GURL url2(kTestHost2); |
176 base::WeakPtr<SpdyStream> spdy_stream2 = | 176 base::WeakPtr<SpdyStream> spdy_stream2 = |
177 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 177 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
178 session2, url2, MEDIUM, BoundNetLog()); | 178 session2, url2, MEDIUM, BoundNetLog()); |
179 ASSERT_TRUE(spdy_stream2.get() != NULL); | 179 ASSERT_TRUE(spdy_stream2.get() != NULL); |
180 | 180 |
181 // Set up session 3 | 181 // Set up session 3 |
182 session_deps_.socket_factory->AddSocketDataProvider(&data); | 182 session_deps_.socket_factory->AddSocketDataProvider(&data); |
183 const std::string kTestHost3("http://www.c.com"); | 183 const std::string kTestHost3("http://www.c.com"); |
184 HostPortPair test_host_port_pair3(kTestHost3, 80); | 184 HostPortPair test_host_port_pair3(kTestHost3, 80); |
185 SpdySessionKey key3(test_host_port_pair3, ProxyServer::Direct(), | 185 SpdySessionKey key3(test_host_port_pair3, ProxyServer::Direct(), |
186 kPrivacyModeDisabled); | 186 kPrivacyModeDisabled); |
187 scoped_refptr<SpdySession> session3 = | 187 base::WeakPtr<SpdySession> session3 = |
188 CreateInsecureSpdySession(http_session_, key3, BoundNetLog()); | 188 CreateInsecureSpdySession(http_session_, key3, BoundNetLog()); |
189 GURL url3(kTestHost3); | 189 GURL url3(kTestHost3); |
190 base::WeakPtr<SpdyStream> spdy_stream3 = | 190 base::WeakPtr<SpdyStream> spdy_stream3 = |
191 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 191 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
192 session3, url3, MEDIUM, BoundNetLog()); | 192 session3, url3, MEDIUM, BoundNetLog()); |
193 ASSERT_TRUE(spdy_stream3.get() != NULL); | 193 ASSERT_TRUE(spdy_stream3.get() != NULL); |
194 | 194 |
195 // All sessions are active and not closed | 195 // All sessions are active and not closed |
196 EXPECT_TRUE(session1->is_active()); | 196 EXPECT_TRUE(session1->is_active()); |
197 EXPECT_FALSE(session1->IsClosed()); | 197 EXPECT_FALSE(session1->IsClosed()); |
(...skipping 19 matching lines...) Expand all Loading... |
217 EXPECT_EQ(NULL, spdy_stream3.get()); | 217 EXPECT_EQ(NULL, spdy_stream3.get()); |
218 EXPECT_FALSE(session1->is_active()); | 218 EXPECT_FALSE(session1->is_active()); |
219 EXPECT_FALSE(session1->IsClosed()); | 219 EXPECT_FALSE(session1->IsClosed()); |
220 EXPECT_TRUE(session2->is_active()); | 220 EXPECT_TRUE(session2->is_active()); |
221 EXPECT_FALSE(session2->IsClosed()); | 221 EXPECT_FALSE(session2->IsClosed()); |
222 EXPECT_FALSE(session3->is_active()); | 222 EXPECT_FALSE(session3->is_active()); |
223 EXPECT_FALSE(session3->IsClosed()); | 223 EXPECT_FALSE(session3->IsClosed()); |
224 | 224 |
225 // Should close session 1 and 3, 2 should be left open | 225 // Should close session 1 and 3, 2 should be left open |
226 spdy_session_pool_->CloseCurrentIdleSessions(); | 226 spdy_session_pool_->CloseCurrentIdleSessions(); |
227 EXPECT_FALSE(session1->is_active()); | 227 EXPECT_TRUE(session1 == NULL); |
228 EXPECT_TRUE(session1->IsClosed()); | |
229 EXPECT_TRUE(session2->is_active()); | 228 EXPECT_TRUE(session2->is_active()); |
230 EXPECT_FALSE(session2->IsClosed()); | 229 EXPECT_FALSE(session2->IsClosed()); |
231 EXPECT_FALSE(session3->is_active()); | 230 EXPECT_TRUE(session3 == NULL); |
232 EXPECT_TRUE(session3->IsClosed()); | |
233 | 231 |
234 // Should not do anything | 232 // Should not do anything |
235 spdy_session_pool_->CloseCurrentIdleSessions(); | 233 spdy_session_pool_->CloseCurrentIdleSessions(); |
236 EXPECT_TRUE(session2->is_active()); | 234 EXPECT_TRUE(session2->is_active()); |
237 EXPECT_FALSE(session2->IsClosed()); | 235 EXPECT_FALSE(session2->IsClosed()); |
238 | 236 |
239 // Make 2 not active | 237 // Make 2 not active |
240 session2->CloseCreatedStream(spdy_stream2, OK); | 238 session2->CloseCreatedStream(spdy_stream2, OK); |
241 EXPECT_EQ(NULL, spdy_stream2.get()); | 239 EXPECT_EQ(NULL, spdy_stream2.get()); |
242 EXPECT_FALSE(session2->is_active()); | 240 EXPECT_FALSE(session2->is_active()); |
243 EXPECT_FALSE(session2->IsClosed()); | 241 EXPECT_FALSE(session2->IsClosed()); |
244 | 242 |
245 // This should close session 2 | 243 // This should close session 2 |
246 spdy_session_pool_->CloseCurrentIdleSessions(); | 244 spdy_session_pool_->CloseCurrentIdleSessions(); |
247 EXPECT_FALSE(session2->is_active()); | 245 EXPECT_TRUE(session2 == NULL); |
248 EXPECT_TRUE(session2->IsClosed()); | |
249 } | 246 } |
250 | 247 |
251 // Set up a SpdyStream to create a new session when it is closed. | 248 // Set up a SpdyStream to create a new session when it is closed. |
252 // CloseAllSessions should close the newly-created session. | 249 // CloseAllSessions should close the newly-created session. |
253 TEST_P(SpdySessionPoolTest, CloseAllSessions) { | 250 TEST_P(SpdySessionPoolTest, CloseAllSessions) { |
254 const char kTestHost[] = "www.foo.com"; | 251 const char kTestHost[] = "www.foo.com"; |
255 const int kTestPort = 80; | 252 const int kTestPort = 80; |
256 | 253 |
257 session_deps_.host_resolver->set_synchronous_mode(true); | 254 session_deps_.host_resolver->set_synchronous_mode(true); |
258 | 255 |
(...skipping 11 matching lines...) Expand all Loading... |
270 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 267 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
271 data.set_connect_data(connect_data); | 268 data.set_connect_data(connect_data); |
272 session_deps_.socket_factory->AddSocketDataProvider(&data); | 269 session_deps_.socket_factory->AddSocketDataProvider(&data); |
273 | 270 |
274 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 271 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
275 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 272 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
276 | 273 |
277 CreateNetworkSession(); | 274 CreateNetworkSession(); |
278 | 275 |
279 // Setup the first session to the first host. | 276 // Setup the first session to the first host. |
280 scoped_refptr<SpdySession> session = | 277 base::WeakPtr<SpdySession> session = |
281 CreateInsecureSpdySession(http_session_, test_key, BoundNetLog()); | 278 CreateInsecureSpdySession(http_session_, test_key, BoundNetLog()); |
282 | 279 |
283 // Flush the SpdySession::OnReadComplete() task. | 280 // Flush the SpdySession::OnReadComplete() task. |
284 base::MessageLoop::current()->RunUntilIdle(); | 281 base::MessageLoop::current()->RunUntilIdle(); |
285 | 282 |
286 // Verify that we have sessions for everything. | 283 // Verify that we have sessions for everything. |
287 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); | 284 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_key)); |
288 | 285 |
289 // Set the stream to create a new session when it is closed. | 286 // Set the stream to create a new session when it is closed. |
290 base::WeakPtr<SpdyStream> spdy_stream = | 287 base::WeakPtr<SpdyStream> spdy_stream = |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); | 354 StaticSocketDataProvider data(reads, arraysize(reads), NULL, 0); |
358 data.set_connect_data(connect_data); | 355 data.set_connect_data(connect_data); |
359 session_deps_.socket_factory->AddSocketDataProvider(&data); | 356 session_deps_.socket_factory->AddSocketDataProvider(&data); |
360 | 357 |
361 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); | 358 SSLSocketDataProvider ssl(SYNCHRONOUS, OK); |
362 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); | 359 session_deps_.socket_factory->AddSSLSocketDataProvider(&ssl); |
363 | 360 |
364 CreateNetworkSession(); | 361 CreateNetworkSession(); |
365 | 362 |
366 // Setup the first session to the first host. | 363 // Setup the first session to the first host. |
367 scoped_refptr<SpdySession> session = | 364 base::WeakPtr<SpdySession> session = |
368 CreateInsecureSpdySession( | 365 CreateInsecureSpdySession( |
369 http_session_, test_hosts[0].key, BoundNetLog()); | 366 http_session_, test_hosts[0].key, BoundNetLog()); |
370 | 367 |
371 // Flush the SpdySession::OnReadComplete() task. | 368 // Flush the SpdySession::OnReadComplete() task. |
372 base::MessageLoop::current()->RunUntilIdle(); | 369 base::MessageLoop::current()->RunUntilIdle(); |
373 | 370 |
374 // The third host has no overlap with the first, so it can't pool IPs. | 371 // The third host has no overlap with the first, so it can't pool IPs. |
375 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 372 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
376 | 373 |
377 // The second host overlaps with the first, and should IP pool. | 374 // The second host overlaps with the first, and should IP pool. |
378 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 375 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
379 | 376 |
380 // Verify that the second host, through a proxy, won't share the IP. | 377 // Verify that the second host, through a proxy, won't share the IP. |
381 SpdySessionKey proxy_key(test_hosts[1].key.host_port_pair(), | 378 SpdySessionKey proxy_key(test_hosts[1].key.host_port_pair(), |
382 ProxyServer::FromPacString("HTTP http://proxy.foo.com/"), | 379 ProxyServer::FromPacString("HTTP http://proxy.foo.com/"), |
383 kPrivacyModeDisabled); | 380 kPrivacyModeDisabled); |
384 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, proxy_key)); | 381 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, proxy_key)); |
385 | 382 |
386 // Overlap between 2 and 3 does is not transitive to 1. | 383 // Overlap between 2 and 3 does is not transitive to 1. |
387 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 384 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
388 | 385 |
389 // Create a new session to host 2. | 386 // Create a new session to host 2. |
390 session_deps_.socket_factory->AddSocketDataProvider(&data); | 387 session_deps_.socket_factory->AddSocketDataProvider(&data); |
391 scoped_refptr<SpdySession> session2 = | 388 base::WeakPtr<SpdySession> session2 = |
392 CreateInsecureSpdySession( | 389 CreateInsecureSpdySession( |
393 http_session_, test_hosts[2].key, BoundNetLog()); | 390 http_session_, test_hosts[2].key, BoundNetLog()); |
394 | 391 |
395 // Verify that we have sessions for everything. | 392 // Verify that we have sessions for everything. |
396 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); | 393 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); |
397 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 394 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
398 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 395 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
399 | 396 |
400 // Grab the session to host 1 and verify that it is the same session | 397 // Grab the session to host 1 and verify that it is the same session |
401 // we got with host 0, and that is a different from host 2's session. | 398 // we got with host 0, and that is a different from host 2's session. |
402 scoped_refptr<SpdySession> session1 = | 399 base::WeakPtr<SpdySession> session1 = |
403 spdy_session_pool_->FindAvailableSession( | 400 spdy_session_pool_->FindAvailableSession( |
404 test_hosts[1].key, BoundNetLog()); | 401 test_hosts[1].key, BoundNetLog()); |
405 EXPECT_EQ(session.get(), session1.get()); | 402 EXPECT_EQ(session.get(), session1.get()); |
406 EXPECT_NE(session2.get(), session1.get()); | 403 EXPECT_NE(session2.get(), session1.get()); |
407 | 404 |
408 // Remove the aliases and observe that we still have a session for host1. | 405 // Remove the aliases and observe that we still have a session for host1. |
409 SpdySessionPoolPeer pool_peer(spdy_session_pool_); | 406 SpdySessionPoolPeer pool_peer(spdy_session_pool_); |
410 pool_peer.RemoveAliases(test_hosts[0].key); | 407 pool_peer.RemoveAliases(test_hosts[0].key); |
411 pool_peer.RemoveAliases(test_hosts[1].key); | 408 pool_peer.RemoveAliases(test_hosts[1].key); |
412 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 409 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
413 | 410 |
414 // Expire the host cache | 411 // Expire the host cache |
415 session_deps_.host_resolver->GetHostCache()->clear(); | 412 session_deps_.host_resolver->GetHostCache()->clear(); |
416 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 413 EXPECT_TRUE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
417 | 414 |
418 // Cleanup the sessions. | 415 // Cleanup the sessions. |
419 switch (close_sessions_type) { | 416 switch (close_sessions_type) { |
420 case SPDY_POOL_CLOSE_SESSIONS_MANUALLY: | 417 case SPDY_POOL_CLOSE_SESSIONS_MANUALLY: |
421 session->CloseSessionOnError(ERR_ABORTED, std::string()); | 418 session->CloseSessionOnError(ERR_ABORTED, std::string()); |
422 session = NULL; | 419 EXPECT_TRUE(session == NULL); |
423 session2->CloseSessionOnError(ERR_ABORTED, std::string()); | 420 session2->CloseSessionOnError(ERR_ABORTED, std::string()); |
424 session2 = NULL; | 421 EXPECT_TRUE(session2 == NULL); |
425 break; | 422 break; |
426 case SPDY_POOL_CLOSE_CURRENT_SESSIONS: | 423 case SPDY_POOL_CLOSE_CURRENT_SESSIONS: |
427 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); | 424 spdy_session_pool_->CloseCurrentSessions(ERR_ABORTED); |
428 break; | 425 break; |
429 case SPDY_POOL_CLOSE_IDLE_SESSIONS: | 426 case SPDY_POOL_CLOSE_IDLE_SESSIONS: |
430 GURL url(test_hosts[0].url); | 427 GURL url(test_hosts[0].url); |
431 base::WeakPtr<SpdyStream> spdy_stream = | 428 base::WeakPtr<SpdyStream> spdy_stream = |
432 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, | 429 CreateStreamSynchronously(SPDY_BIDIRECTIONAL_STREAM, |
433 session, url, MEDIUM, BoundNetLog()); | 430 session, url, MEDIUM, BoundNetLog()); |
434 GURL url1(test_hosts[1].url); | 431 GURL url1(test_hosts[1].url); |
(...skipping 17 matching lines...) Expand all Loading... |
452 EXPECT_FALSE(session1->is_active()); | 449 EXPECT_FALSE(session1->is_active()); |
453 EXPECT_FALSE(session1->IsClosed()); | 450 EXPECT_FALSE(session1->IsClosed()); |
454 EXPECT_TRUE(session2->is_active()); | 451 EXPECT_TRUE(session2->is_active()); |
455 EXPECT_FALSE(session2->IsClosed()); | 452 EXPECT_FALSE(session2->IsClosed()); |
456 | 453 |
457 // Test that calling CloseIdleSessions, does not cause a crash. | 454 // Test that calling CloseIdleSessions, does not cause a crash. |
458 // http://crbug.com/181400 | 455 // http://crbug.com/181400 |
459 spdy_session_pool_->CloseCurrentIdleSessions(); | 456 spdy_session_pool_->CloseCurrentIdleSessions(); |
460 | 457 |
461 // Verify spdy_session and spdy_session1 are closed. | 458 // Verify spdy_session and spdy_session1 are closed. |
462 EXPECT_FALSE(session->is_active()); | 459 EXPECT_TRUE(session == NULL); |
463 EXPECT_TRUE(session->IsClosed()); | 460 EXPECT_TRUE(session1 == NULL); |
464 EXPECT_FALSE(session1->is_active()); | |
465 EXPECT_TRUE(session1->IsClosed()); | |
466 EXPECT_TRUE(session2->is_active()); | 461 EXPECT_TRUE(session2->is_active()); |
467 EXPECT_FALSE(session2->IsClosed()); | 462 EXPECT_FALSE(session2->IsClosed()); |
468 | 463 |
469 spdy_stream2->Cancel(); | 464 spdy_stream2->Cancel(); |
470 EXPECT_EQ(NULL, spdy_stream.get()); | 465 EXPECT_EQ(NULL, spdy_stream.get()); |
471 EXPECT_EQ(NULL, spdy_stream1.get()); | 466 EXPECT_EQ(NULL, spdy_stream1.get()); |
472 EXPECT_EQ(NULL, spdy_stream2.get()); | 467 EXPECT_EQ(NULL, spdy_stream2.get()); |
473 session2->CloseSessionOnError(ERR_ABORTED, std::string()); | 468 session2->CloseSessionOnError(ERR_ABORTED, std::string()); |
474 session2 = NULL; | 469 EXPECT_TRUE(session2 == NULL); |
475 break; | 470 break; |
476 } | 471 } |
477 | 472 |
478 // Verify that the map is all cleaned up. | 473 // Verify that the map is all cleaned up. |
479 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); | 474 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[0].key)); |
480 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); | 475 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[1].key)); |
481 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); | 476 EXPECT_FALSE(HasSpdySession(spdy_session_pool_, test_hosts[2].key)); |
482 } | 477 } |
483 | 478 |
484 TEST_P(SpdySessionPoolTest, IPPooling) { | 479 TEST_P(SpdySessionPoolTest, IPPooling) { |
485 RunIPPoolingTest(SPDY_POOL_CLOSE_SESSIONS_MANUALLY); | 480 RunIPPoolingTest(SPDY_POOL_CLOSE_SESSIONS_MANUALLY); |
486 } | 481 } |
487 | 482 |
488 TEST_P(SpdySessionPoolTest, IPPoolingCloseCurrentSessions) { | 483 TEST_P(SpdySessionPoolTest, IPPoolingCloseCurrentSessions) { |
489 RunIPPoolingTest(SPDY_POOL_CLOSE_CURRENT_SESSIONS); | 484 RunIPPoolingTest(SPDY_POOL_CLOSE_CURRENT_SESSIONS); |
490 } | 485 } |
491 | 486 |
492 TEST_P(SpdySessionPoolTest, IPPoolingCloseIdleSessions) { | 487 TEST_P(SpdySessionPoolTest, IPPoolingCloseIdleSessions) { |
493 RunIPPoolingTest(SPDY_POOL_CLOSE_IDLE_SESSIONS); | 488 RunIPPoolingTest(SPDY_POOL_CLOSE_IDLE_SESSIONS); |
494 } | 489 } |
495 | 490 |
496 } // namespace | 491 } // namespace |
497 | 492 |
498 } // namespace net | 493 } // namespace net |
OLD | NEW |