Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: net/spdy/spdy_session_unittest.cc

Issue 8990001: base::Bind: Convert most of net/http. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clang. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 11 matching lines...) Expand all
22 } 22 }
23 protected: 23 protected:
24 virtual void TearDown() { 24 virtual void TearDown() {
25 // Wanted to be 100% sure PING is disabled. 25 // Wanted to be 100% sure PING is disabled.
26 SpdySession::set_enable_ping_based_connection_checking(false); 26 SpdySession::set_enable_ping_based_connection_checking(false);
27 } 27 }
28 }; 28 };
29 29
30 class TestSpdyStreamDelegate : public net::SpdyStream::Delegate { 30 class TestSpdyStreamDelegate : public net::SpdyStream::Delegate {
31 public: 31 public:
32 explicit TestSpdyStreamDelegate(OldCompletionCallback* callback) 32 explicit TestSpdyStreamDelegate(const CompletionCallback& callback)
33 : callback_(callback) {} 33 : callback_(callback) {}
34 virtual ~TestSpdyStreamDelegate() {} 34 virtual ~TestSpdyStreamDelegate() {}
35 35
36 virtual bool OnSendHeadersComplete(int status) { return true; } 36 virtual bool OnSendHeadersComplete(int status) { return true; }
37 37
38 virtual int OnSendBody() { 38 virtual int OnSendBody() {
39 return ERR_UNEXPECTED; 39 return ERR_UNEXPECTED;
40 } 40 }
41 41
42 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) { 42 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) {
43 return ERR_UNEXPECTED; 43 return ERR_UNEXPECTED;
44 } 44 }
45 45
46 virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response, 46 virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response,
47 base::Time response_time, 47 base::Time response_time,
48 int status) { 48 int status) {
49 return status; 49 return status;
50 } 50 }
51 51
52 virtual void OnDataReceived(const char* buffer, int bytes) { 52 virtual void OnDataReceived(const char* buffer, int bytes) {
53 } 53 }
54 54
55 virtual void OnDataSent(int length) { 55 virtual void OnDataSent(int length) {
56 } 56 }
57 57
58 virtual void OnClose(int status) { 58 virtual void OnClose(int status) {
59 OldCompletionCallback* callback = callback_; 59 CompletionCallback callback = callback_;
60 callback_ = NULL; 60 callback_.Reset();
61 callback->Run(OK); 61 callback.Run(OK);
62 } 62 }
63 63
64 virtual void set_chunk_callback(net::ChunkCallback *) {} 64 virtual void set_chunk_callback(net::ChunkCallback *) {}
65 65
66 private: 66 private:
67 OldCompletionCallback* callback_; 67 CompletionCallback callback_;
68 }; 68 };
69 69
70
71 // Test the SpdyIOBuffer class. 70 // Test the SpdyIOBuffer class.
72 TEST_F(SpdySessionTest, SpdyIOBuffer) { 71 TEST_F(SpdySessionTest, SpdyIOBuffer) {
73 std::priority_queue<SpdyIOBuffer> queue_; 72 std::priority_queue<SpdyIOBuffer> queue_;
74 const size_t kQueueSize = 100; 73 const size_t kQueueSize = 100;
75 74
76 // Insert 100 items; pri 100 to 1. 75 // Insert 100 items; pri 100 to 1.
77 for (size_t index = 0; index < kQueueSize; ++index) { 76 for (size_t index = 0; index < kQueueSize; ++index) {
78 SpdyIOBuffer buffer(new IOBuffer(), 0, kQueueSize - index, NULL); 77 SpdyIOBuffer buffer(new IOBuffer(), 0, kQueueSize - index, NULL);
79 queue_.push(buffer); 78 queue_.push(buffer);
80 } 79 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 false, 211 false,
213 false)); 212 false));
214 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); 213 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
215 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), 214 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(),
216 transport_params, MEDIUM, CompletionCallback(), 215 transport_params, MEDIUM, CompletionCallback(),
217 http_session->GetTransportSocketPool(), 216 http_session->GetTransportSocketPool(),
218 BoundNetLog())); 217 BoundNetLog()));
219 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); 218 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK));
220 219
221 scoped_refptr<SpdyStream> spdy_stream1; 220 scoped_refptr<SpdyStream> spdy_stream1;
222 TestOldCompletionCallback callback1; 221 TestCompletionCallback callback1;
223 EXPECT_EQ(OK, session->CreateStream(url, 222 EXPECT_EQ(OK, session->CreateStream(url,
224 MEDIUM, 223 MEDIUM,
225 &spdy_stream1, 224 &spdy_stream1,
226 BoundNetLog(), 225 BoundNetLog(),
227 &callback1)); 226 callback1.callback()));
228 scoped_ptr<TestSpdyStreamDelegate> delegate( 227 scoped_ptr<TestSpdyStreamDelegate> delegate(
229 new TestSpdyStreamDelegate(&callback1)); 228 new TestSpdyStreamDelegate(callback1.callback()));
230 spdy_stream1->SetDelegate(delegate.get()); 229 spdy_stream1->SetDelegate(delegate.get());
231 230
232 base::TimeTicks before_ping_time = base::TimeTicks::Now(); 231 base::TimeTicks before_ping_time = base::TimeTicks::Now();
233 232
234 // Enable sending of PING. 233 // Enable sending of PING.
235 SpdySession::set_enable_ping_based_connection_checking(true); 234 SpdySession::set_enable_ping_based_connection_checking(true);
236 SpdySession::set_connection_at_risk_of_loss_seconds(0); 235 SpdySession::set_connection_at_risk_of_loss_seconds(0);
237 SpdySession::set_trailing_ping_delay_time_ms(0); 236 SpdySession::set_trailing_ping_delay_time_ms(0);
238 SpdySession::set_hung_interval_ms(50); 237 SpdySession::set_hung_interval_ms(50);
239 238
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 false, 299 false,
301 false)); 300 false));
302 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); 301 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
303 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), 302 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(),
304 transport_params, MEDIUM, CompletionCallback(), 303 transport_params, MEDIUM, CompletionCallback(),
305 http_session->GetTransportSocketPool(), 304 http_session->GetTransportSocketPool(),
306 BoundNetLog())); 305 BoundNetLog()));
307 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); 306 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK));
308 307
309 scoped_refptr<SpdyStream> spdy_stream1; 308 scoped_refptr<SpdyStream> spdy_stream1;
310 TestOldCompletionCallback callback1; 309 TestCompletionCallback callback1;
311 EXPECT_EQ(OK, session->CreateStream(url, 310 EXPECT_EQ(OK, session->CreateStream(url,
312 MEDIUM, 311 MEDIUM,
313 &spdy_stream1, 312 &spdy_stream1,
314 BoundNetLog(), 313 BoundNetLog(),
315 &callback1)); 314 callback1.callback()));
316 scoped_ptr<TestSpdyStreamDelegate> delegate( 315 scoped_ptr<TestSpdyStreamDelegate> delegate(
317 new TestSpdyStreamDelegate(&callback1)); 316 new TestSpdyStreamDelegate(callback1.callback()));
318 spdy_stream1->SetDelegate(delegate.get()); 317 spdy_stream1->SetDelegate(delegate.get());
319 318
320 // Enable sending of PING. 319 // Enable sending of PING.
321 SpdySession::set_enable_ping_based_connection_checking(true); 320 SpdySession::set_enable_ping_based_connection_checking(true);
322 SpdySession::set_connection_at_risk_of_loss_seconds(0); 321 SpdySession::set_connection_at_risk_of_loss_seconds(0);
323 SpdySession::set_trailing_ping_delay_time_ms(0); 322 SpdySession::set_trailing_ping_delay_time_ms(0);
324 SpdySession::set_hung_interval_ms(0); 323 SpdySession::set_hung_interval_ms(0);
325 324
326 // Send a PING frame. 325 // Send a PING frame.
327 session->WritePingFrame(1); 326 session->WritePingFrame(1);
(...skipping 14 matching lines...) Expand all
342 341
343 EXPECT_TRUE(session->IsClosed()); 342 EXPECT_TRUE(session->IsClosed());
344 EXPECT_EQ(0u, session->num_active_streams()); 343 EXPECT_EQ(0u, session->num_active_streams());
345 EXPECT_EQ(0u, session->num_unclaimed_pushed_streams()); 344 EXPECT_EQ(0u, session->num_unclaimed_pushed_streams());
346 EXPECT_FALSE(spdy_session_pool->HasSession(pair)); 345 EXPECT_FALSE(spdy_session_pool->HasSession(pair));
347 346
348 // Delete the first session. 347 // Delete the first session.
349 session = NULL; 348 session = NULL;
350 } 349 }
351 350
352 class StreamReleaserCallback : public CallbackRunner<Tuple1<int> > { 351 class StreamReleaserCallback : public TestCompletionCallbackBase {
353 public: 352 public:
354 StreamReleaserCallback(SpdySession* session, 353 StreamReleaserCallback(SpdySession* session,
355 SpdyStream* first_stream) 354 SpdyStream* first_stream)
356 : session_(session), first_stream_(first_stream) {} 355 : session_(session),
357 ~StreamReleaserCallback() {} 356 first_stream_(first_stream),
357 ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
358 base::Bind(&StreamReleaserCallback::OnComplete,
359 base::Unretained(this)))) {
360 }
358 361
359 int WaitForResult() { return callback_.WaitForResult(); } 362 virtual ~StreamReleaserCallback() {}
360 363
361 virtual void RunWithParams(const Tuple1<int>& params) { 364 scoped_refptr<SpdyStream>* stream() { return &stream_; }
365
366 const CompletionCallback& callback() const { return callback_; }
367
368 private:
369 void OnComplete(int result) {
362 session_->CloseSessionOnError(ERR_FAILED, false); 370 session_->CloseSessionOnError(ERR_FAILED, false);
363 session_ = NULL; 371 session_ = NULL;
364 first_stream_->Cancel(); 372 first_stream_->Cancel();
365 first_stream_ = NULL; 373 first_stream_ = NULL;
366 stream_->Cancel(); 374 stream_->Cancel();
367 stream_ = NULL; 375 stream_ = NULL;
368 callback_.RunWithParams(params); 376 SetResult(result);
369 } 377 }
370 378
371 scoped_refptr<SpdyStream>* stream() { return &stream_; }
372
373 private:
374 scoped_refptr<SpdySession> session_; 379 scoped_refptr<SpdySession> session_;
375 scoped_refptr<SpdyStream> first_stream_; 380 scoped_refptr<SpdyStream> first_stream_;
376 scoped_refptr<SpdyStream> stream_; 381 scoped_refptr<SpdyStream> stream_;
377 TestOldCompletionCallback callback_; 382 CompletionCallback callback_;
378 }; 383 };
379 384
380 // TODO(kristianm): Could also test with more sessions where some are idle, 385 // TODO(kristianm): Could also test with more sessions where some are idle,
381 // and more than one session to a HostPortPair. 386 // and more than one session to a HostPortPair.
382 TEST_F(SpdySessionTest, CloseIdleSessions) { 387 TEST_F(SpdySessionTest, CloseIdleSessions) {
383 SpdySessionDependencies session_deps; 388 SpdySessionDependencies session_deps;
384 scoped_refptr<HttpNetworkSession> http_session( 389 scoped_refptr<HttpNetworkSession> http_session(
385 SpdySessionDependencies::SpdyCreateSession(&session_deps)); 390 SpdySessionDependencies::SpdyCreateSession(&session_deps));
386 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool()); 391 SpdySessionPool* spdy_session_pool(http_session->spdy_session_pool());
387 392
388 // Set up session 1 393 // Set up session 1
389 const std::string kTestHost1("http://www.a.com"); 394 const std::string kTestHost1("http://www.a.com");
390 HostPortPair test_host_port_pair1(kTestHost1, 80); 395 HostPortPair test_host_port_pair1(kTestHost1, 80);
391 HostPortProxyPair pair1(test_host_port_pair1, ProxyServer::Direct()); 396 HostPortProxyPair pair1(test_host_port_pair1, ProxyServer::Direct());
392 scoped_refptr<SpdySession> session1 = 397 scoped_refptr<SpdySession> session1 =
393 spdy_session_pool->Get(pair1, BoundNetLog()); 398 spdy_session_pool->Get(pair1, BoundNetLog());
394 scoped_refptr<SpdyStream> spdy_stream1; 399 scoped_refptr<SpdyStream> spdy_stream1;
395 TestOldCompletionCallback callback1; 400 TestCompletionCallback callback1;
396 GURL url1(kTestHost1); 401 GURL url1(kTestHost1);
397 EXPECT_EQ(OK, session1->CreateStream(url1, 402 EXPECT_EQ(OK, session1->CreateStream(url1,
398 MEDIUM, /* priority, not important */ 403 MEDIUM, /* priority, not important */
399 &spdy_stream1, 404 &spdy_stream1,
400 BoundNetLog(), 405 BoundNetLog(),
401 &callback1)); 406 callback1.callback()));
402 407
403 // Set up session 2 408 // Set up session 2
404 const std::string kTestHost2("http://www.b.com"); 409 const std::string kTestHost2("http://www.b.com");
405 HostPortPair test_host_port_pair2(kTestHost2, 80); 410 HostPortPair test_host_port_pair2(kTestHost2, 80);
406 HostPortProxyPair pair2(test_host_port_pair2, ProxyServer::Direct()); 411 HostPortProxyPair pair2(test_host_port_pair2, ProxyServer::Direct());
407 scoped_refptr<SpdySession> session2 = 412 scoped_refptr<SpdySession> session2 =
408 spdy_session_pool->Get(pair2, BoundNetLog()); 413 spdy_session_pool->Get(pair2, BoundNetLog());
409 scoped_refptr<SpdyStream> spdy_stream2; 414 scoped_refptr<SpdyStream> spdy_stream2;
410 TestOldCompletionCallback callback2; 415 TestCompletionCallback callback2;
411 GURL url2(kTestHost2); 416 GURL url2(kTestHost2);
412 EXPECT_EQ(OK, session2->CreateStream(url2, 417 EXPECT_EQ(OK, session2->CreateStream(
413 MEDIUM, /* priority, not important */ 418 url2, MEDIUM, /* priority, not important */
414 &spdy_stream2, 419 &spdy_stream2, BoundNetLog(), callback2.callback()));
415 BoundNetLog(),
416 &callback2));
417 420
418 // Set up session 3 421 // Set up session 3
419 const std::string kTestHost3("http://www.c.com"); 422 const std::string kTestHost3("http://www.c.com");
420 HostPortPair test_host_port_pair3(kTestHost3, 80); 423 HostPortPair test_host_port_pair3(kTestHost3, 80);
421 HostPortProxyPair pair3(test_host_port_pair3, ProxyServer::Direct()); 424 HostPortProxyPair pair3(test_host_port_pair3, ProxyServer::Direct());
422 scoped_refptr<SpdySession> session3 = 425 scoped_refptr<SpdySession> session3 =
423 spdy_session_pool->Get(pair3, BoundNetLog()); 426 spdy_session_pool->Get(pair3, BoundNetLog());
424 scoped_refptr<SpdyStream> spdy_stream3; 427 scoped_refptr<SpdyStream> spdy_stream3;
425 TestOldCompletionCallback callback3; 428 TestCompletionCallback callback3;
426 GURL url3(kTestHost3); 429 GURL url3(kTestHost3);
427 EXPECT_EQ(OK, session3->CreateStream(url3, 430 EXPECT_EQ(OK, session3->CreateStream(
428 MEDIUM, /* priority, not important */ 431 url3, MEDIUM, /* priority, not important */
429 &spdy_stream3, 432 &spdy_stream3, BoundNetLog(), callback3.callback()));
430 BoundNetLog(),
431 &callback3));
432 433
433 // All sessions are active and not closed 434 // All sessions are active and not closed
434 EXPECT_TRUE(session1->is_active()); 435 EXPECT_TRUE(session1->is_active());
435 EXPECT_FALSE(session1->IsClosed()); 436 EXPECT_FALSE(session1->IsClosed());
436 EXPECT_TRUE(session2->is_active()); 437 EXPECT_TRUE(session2->is_active());
437 EXPECT_FALSE(session2->IsClosed()); 438 EXPECT_FALSE(session2->IsClosed());
438 EXPECT_TRUE(session3->is_active()); 439 EXPECT_TRUE(session3->is_active());
439 EXPECT_FALSE(session3->IsClosed()); 440 EXPECT_FALSE(session3->IsClosed());
440 441
441 // Should not do anything, all are active 442 // Should not do anything, all are active
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 false)); 545 false));
545 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); 546 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
546 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), 547 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(),
547 transport_params, MEDIUM, CompletionCallback(), 548 transport_params, MEDIUM, CompletionCallback(),
548 http_session->GetTransportSocketPool(), 549 http_session->GetTransportSocketPool(),
549 BoundNetLog())); 550 BoundNetLog()));
550 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); 551 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK));
551 552
552 // Create 2 streams. First will succeed. Second will be pending. 553 // Create 2 streams. First will succeed. Second will be pending.
553 scoped_refptr<SpdyStream> spdy_stream1; 554 scoped_refptr<SpdyStream> spdy_stream1;
554 TestOldCompletionCallback callback1; 555 TestCompletionCallback callback1;
555 GURL url("http://www.google.com"); 556 GURL url("http://www.google.com");
556 EXPECT_EQ(OK, 557 EXPECT_EQ(OK,
557 session->CreateStream(url, 558 session->CreateStream(url,
558 MEDIUM, /* priority, not important */ 559 MEDIUM, /* priority, not important */
559 &spdy_stream1, 560 &spdy_stream1,
560 BoundNetLog(), 561 BoundNetLog(),
561 &callback1)); 562 callback1.callback()));
562 563
563 StreamReleaserCallback stream_releaser(session, spdy_stream1); 564 StreamReleaserCallback stream_releaser(session, spdy_stream1);
564 565
565 ASSERT_EQ(ERR_IO_PENDING, 566 ASSERT_EQ(ERR_IO_PENDING,
566 session->CreateStream(url, 567 session->CreateStream(url,
567 MEDIUM, /* priority, not important */ 568 MEDIUM, /* priority, not important */
568 stream_releaser.stream(), 569 stream_releaser.stream(),
569 BoundNetLog(), 570 BoundNetLog(),
570 &stream_releaser)); 571 stream_releaser.callback()));
571 572
572 // Make sure |stream_releaser| holds the last refs. 573 // Make sure |stream_releaser| holds the last refs.
573 session = NULL; 574 session = NULL;
574 spdy_stream1 = NULL; 575 spdy_stream1 = NULL;
575 576
576 EXPECT_EQ(OK, stream_releaser.WaitForResult()); 577 EXPECT_EQ(OK, stream_releaser.WaitForResult());
577 } 578 }
578 579
579 // Start with max concurrent streams set to 1. Request two streams. When the 580 // Start with max concurrent streams set to 1. Request two streams. When the
580 // first completes, have the callback close itself, which should trigger the 581 // first completes, have the callback close itself, which should trigger the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 false)); 629 false));
629 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); 630 scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle);
630 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), 631 EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(),
631 transport_params, MEDIUM, CompletionCallback(), 632 transport_params, MEDIUM, CompletionCallback(),
632 http_session->GetTransportSocketPool(), 633 http_session->GetTransportSocketPool(),
633 BoundNetLog())); 634 BoundNetLog()));
634 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK)); 635 EXPECT_EQ(OK, session->InitializeWithSocket(connection.release(), false, OK));
635 636
636 // Use scoped_ptr to let us invalidate the memory when we want to, to trigger 637 // Use scoped_ptr to let us invalidate the memory when we want to, to trigger
637 // a valgrind error if the callback is invoked when it's not supposed to be. 638 // a valgrind error if the callback is invoked when it's not supposed to be.
638 scoped_ptr<TestOldCompletionCallback> callback(new TestOldCompletionCallback); 639 scoped_ptr<TestCompletionCallback> callback(new TestCompletionCallback);
639 640
640 // Create 2 streams. First will succeed. Second will be pending. 641 // Create 2 streams. First will succeed. Second will be pending.
641 scoped_refptr<SpdyStream> spdy_stream1; 642 scoped_refptr<SpdyStream> spdy_stream1;
642 GURL url("http://www.google.com"); 643 GURL url("http://www.google.com");
643 ASSERT_EQ(OK, 644 ASSERT_EQ(OK,
644 session->CreateStream(url, 645 session->CreateStream(url,
645 MEDIUM, /* priority, not important */ 646 MEDIUM, /* priority, not important */
646 &spdy_stream1, 647 &spdy_stream1,
647 BoundNetLog(), 648 BoundNetLog(),
648 callback.get())); 649 callback->callback()));
649 650
650 scoped_refptr<SpdyStream> spdy_stream2; 651 scoped_refptr<SpdyStream> spdy_stream2;
651 ASSERT_EQ(ERR_IO_PENDING, 652 ASSERT_EQ(ERR_IO_PENDING,
652 session->CreateStream(url, 653 session->CreateStream(url,
653 MEDIUM, /* priority, not important */ 654 MEDIUM, /* priority, not important */
654 &spdy_stream2, 655 &spdy_stream2,
655 BoundNetLog(), 656 BoundNetLog(),
656 callback.get())); 657 callback->callback()));
657 658
658 // Release the first one, this will allow the second to be created. 659 // Release the first one, this will allow the second to be created.
659 spdy_stream1->Cancel(); 660 spdy_stream1->Cancel();
660 spdy_stream1 = NULL; 661 spdy_stream1 = NULL;
661 662
662 session->CancelPendingCreateStreams(&spdy_stream2); 663 session->CancelPendingCreateStreams(&spdy_stream2);
663 callback.reset(); 664 callback.reset();
664 665
665 // Should not crash when running the pending callback. 666 // Should not crash when running the pending callback.
666 MessageLoop::current()->RunAllPending(); 667 MessageLoop::current()->RunAllPending();
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 test_http_server_properties->SetSpdySettings(test_host_port_pair, 901 test_http_server_properties->SetSpdySettings(test_host_port_pair,
901 test_settings); 902 test_settings);
902 EXPECT_NE(0u, test_http_server_properties->GetSpdySettings( 903 EXPECT_NE(0u, test_http_server_properties->GetSpdySettings(
903 test_host_port_pair).size()); 904 test_host_port_pair).size());
904 spdy_session_pool->OnIPAddressChanged(); 905 spdy_session_pool->OnIPAddressChanged();
905 EXPECT_EQ(0u, test_http_server_properties->GetSpdySettings( 906 EXPECT_EQ(0u, test_http_server_properties->GetSpdySettings(
906 test_host_port_pair).size()); 907 test_host_port_pair).size());
907 } 908 }
908 909
909 } // namespace net 910 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698