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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_session_spdy3_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/host_cache.h" 7 #include "net/base/host_cache.h"
8 #include "net/base/ip_endpoint.h" 8 #include "net/base/ip_endpoint.h"
9 #include "net/base/net_log_unittest.h" 9 #include "net/base/net_log_unittest.h"
10 #include "net/spdy/spdy_io_buffer.h" 10 #include "net/spdy/spdy_io_buffer.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 // Give the session a SPDY2 framer. 390 // Give the session a SPDY2 framer.
391 session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(2)); 391 session->buffered_spdy_framer_.reset(new BufferedSpdyFramer(2));
392 392
393 // Create the associated stream and add to active streams. 393 // Create the associated stream and add to active streams.
394 scoped_ptr<SpdyHeaderBlock> request_headers(new SpdyHeaderBlock); 394 scoped_ptr<SpdyHeaderBlock> request_headers(new SpdyHeaderBlock);
395 (*request_headers)["scheme"] = "http"; 395 (*request_headers)["scheme"] = "http";
396 (*request_headers)["host"] = "www.google.com"; 396 (*request_headers)["host"] = "www.google.com";
397 (*request_headers)["url"] = "/"; 397 (*request_headers)["url"] = "/";
398 398
399 scoped_refptr<SpdyStream> stream( 399 scoped_refptr<SpdyStream> stream(
400 new SpdyStream(session, false, session->net_log_)); 400 new SpdyStream(session.get(), false, session->net_log_));
401 stream->set_spdy_headers(request_headers.Pass()); 401 stream->set_spdy_headers(request_headers.Pass());
402 session->ActivateStream(stream); 402 session->ActivateStream(stream.get());
403 403
404 SpdyHeaderBlock headers; 404 SpdyHeaderBlock headers;
405 headers["url"] = "http://www.google.com/a.dat"; 405 headers["url"] = "http://www.google.com/a.dat";
406 session->OnSynStream(2, 1, 0, 0, true, false, headers); 406 session->OnSynStream(2, 1, 0, 0, true, false, headers);
407 407
408 // Verify that there is one unclaimed push stream. 408 // Verify that there is one unclaimed push stream.
409 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams()); 409 EXPECT_EQ(1u, session->num_unclaimed_pushed_streams());
410 SpdySession::PushedStreamMap::iterator iter = 410 SpdySession::PushedStreamMap::iterator iter =
411 session->unclaimed_pushed_streams_.find("http://www.google.com/a.dat"); 411 session->unclaimed_pushed_streams_.find("http://www.google.com/a.dat");
412 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter); 412 EXPECT_TRUE(session->unclaimed_pushed_streams_.end() != iter);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 spdy_session_pool->CloseIdleSessions(); 616 spdy_session_pool->CloseIdleSessions();
617 EXPECT_TRUE(session1->is_active()); 617 EXPECT_TRUE(session1->is_active());
618 EXPECT_FALSE(session1->IsClosed()); 618 EXPECT_FALSE(session1->IsClosed());
619 EXPECT_TRUE(session2->is_active()); 619 EXPECT_TRUE(session2->is_active());
620 EXPECT_FALSE(session2->IsClosed()); 620 EXPECT_FALSE(session2->IsClosed());
621 EXPECT_TRUE(session3->is_active()); 621 EXPECT_TRUE(session3->is_active());
622 EXPECT_FALSE(session3->IsClosed()); 622 EXPECT_FALSE(session3->IsClosed());
623 623
624 // Make sessions 1 and 3 inactive, but keep them open. 624 // Make sessions 1 and 3 inactive, but keep them open.
625 // Session 2 still open and active 625 // Session 2 still open and active
626 session1->CloseCreatedStream(spdy_stream1, OK); 626 session1->CloseCreatedStream(spdy_stream1.get(), OK);
627 session3->CloseCreatedStream(spdy_stream3, OK); 627 session3->CloseCreatedStream(spdy_stream3.get(), OK);
628 EXPECT_FALSE(session1->is_active()); 628 EXPECT_FALSE(session1->is_active());
629 EXPECT_FALSE(session1->IsClosed()); 629 EXPECT_FALSE(session1->IsClosed());
630 EXPECT_TRUE(session2->is_active()); 630 EXPECT_TRUE(session2->is_active());
631 EXPECT_FALSE(session2->IsClosed()); 631 EXPECT_FALSE(session2->IsClosed());
632 EXPECT_FALSE(session3->is_active()); 632 EXPECT_FALSE(session3->is_active());
633 EXPECT_FALSE(session3->IsClosed()); 633 EXPECT_FALSE(session3->IsClosed());
634 634
635 // Should close session 1 and 3, 2 should be left open 635 // Should close session 1 and 3, 2 should be left open
636 spdy_session_pool->CloseIdleSessions(); 636 spdy_session_pool->CloseIdleSessions();
637 EXPECT_FALSE(session1->is_active()); 637 EXPECT_FALSE(session1->is_active());
638 EXPECT_TRUE(session1->IsClosed()); 638 EXPECT_TRUE(session1->IsClosed());
639 EXPECT_TRUE(session2->is_active()); 639 EXPECT_TRUE(session2->is_active());
640 EXPECT_FALSE(session2->IsClosed()); 640 EXPECT_FALSE(session2->IsClosed());
641 EXPECT_FALSE(session3->is_active()); 641 EXPECT_FALSE(session3->is_active());
642 EXPECT_TRUE(session3->IsClosed()); 642 EXPECT_TRUE(session3->IsClosed());
643 643
644 // Should not do anything 644 // Should not do anything
645 spdy_session_pool->CloseIdleSessions(); 645 spdy_session_pool->CloseIdleSessions();
646 EXPECT_TRUE(session2->is_active()); 646 EXPECT_TRUE(session2->is_active());
647 EXPECT_FALSE(session2->IsClosed()); 647 EXPECT_FALSE(session2->IsClosed());
648 648
649 // Make 2 not active 649 // Make 2 not active
650 session2->CloseCreatedStream(spdy_stream2, OK); 650 session2->CloseCreatedStream(spdy_stream2.get(), OK);
651 EXPECT_FALSE(session2->is_active()); 651 EXPECT_FALSE(session2->is_active());
652 EXPECT_FALSE(session2->IsClosed()); 652 EXPECT_FALSE(session2->IsClosed());
653 653
654 // This should close session 2 654 // This should close session 2
655 spdy_session_pool->CloseIdleSessions(); 655 spdy_session_pool->CloseIdleSessions();
656 EXPECT_FALSE(session2->is_active()); 656 EXPECT_FALSE(session2->is_active());
657 EXPECT_TRUE(session2->IsClosed()); 657 EXPECT_TRUE(session2->IsClosed());
658 } 658 }
659 659
660 // Start with max concurrent streams set to 1. Request two streams. Receive a 660 // Start with max concurrent streams set to 1. Request two streams. Receive a
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 scoped_refptr<SpdyStream> spdy_stream1; 728 scoped_refptr<SpdyStream> spdy_stream1;
729 TestCompletionCallback callback1; 729 TestCompletionCallback callback1;
730 GURL url("http://www.google.com"); 730 GURL url("http://www.google.com");
731 EXPECT_EQ(OK, 731 EXPECT_EQ(OK,
732 session->CreateStream(url, 732 session->CreateStream(url,
733 MEDIUM, /* priority, not important */ 733 MEDIUM, /* priority, not important */
734 &spdy_stream1, 734 &spdy_stream1,
735 BoundNetLog(), 735 BoundNetLog(),
736 callback1.callback())); 736 callback1.callback()));
737 737
738 StreamReleaserCallback stream_releaser(session, spdy_stream1); 738 StreamReleaserCallback stream_releaser(session.get(), spdy_stream1.get());
739 739
740 ASSERT_EQ(ERR_IO_PENDING, 740 ASSERT_EQ(ERR_IO_PENDING,
741 session->CreateStream(url, 741 session->CreateStream(url,
742 MEDIUM, /* priority, not important */ 742 MEDIUM, /* priority, not important */
743 stream_releaser.stream(), 743 stream_releaser.stream(),
744 BoundNetLog(), 744 BoundNetLog(),
745 stream_releaser.callback())); 745 stream_releaser.callback()));
746 746
747 // Make sure |stream_releaser| holds the last refs. 747 // Make sure |stream_releaser| holds the last refs.
748 session = NULL; 748 session = NULL;
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 session->CloseSessionOnError(ERR_ABORTED, true, ""); 1588 session->CloseSessionOnError(ERR_ABORTED, true, "");
1589 1589
1590 EXPECT_TRUE(spdy_stream1->closed()); 1590 EXPECT_TRUE(spdy_stream1->closed());
1591 EXPECT_TRUE(spdy_stream2->closed()); 1591 EXPECT_TRUE(spdy_stream2->closed());
1592 1592
1593 spdy_stream1 = NULL; 1593 spdy_stream1 = NULL;
1594 spdy_stream2 = NULL; 1594 spdy_stream2 = NULL;
1595 } 1595 }
1596 1596
1597 } // namespace net 1597 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_pool.cc ('k') | net/spdy/spdy_session_spdy3_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698