OLD | NEW |
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/quic/quic_session.h" | 5 #include "net/quic/quic_session.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( | 531 .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( |
532 &session_, &TestSession::SendStreamData, stream4->id())))); | 532 &session_, &TestSession::SendStreamData, stream4->id())))); |
533 EXPECT_CALL(*stream6, OnCanWrite()) | 533 EXPECT_CALL(*stream6, OnCanWrite()) |
534 .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( | 534 .WillOnce(testing::IgnoreResult(Invoke(CreateFunctor( |
535 &session_, &TestSession::SendStreamData, stream6->id())))); | 535 &session_, &TestSession::SendStreamData, stream6->id())))); |
536 | 536 |
537 // Expect that we only send one packet, the writes from different streams | 537 // Expect that we only send one packet, the writes from different streams |
538 // should be bundled together. | 538 // should be bundled together. |
539 MockPacketWriter* writer = static_cast<MockPacketWriter*>( | 539 MockPacketWriter* writer = static_cast<MockPacketWriter*>( |
540 QuicConnectionPeer::GetWriter(session_.connection())); | 540 QuicConnectionPeer::GetWriter(session_.connection())); |
541 EXPECT_CALL(*writer, WritePacket(_, _, _, _)) | 541 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) |
542 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); | 542 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); |
543 EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _, _)); | 543 EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _, _)); |
544 session_.OnCanWrite(); | 544 session_.OnCanWrite(); |
545 EXPECT_FALSE(session_.WillingAndAbleToWrite()); | 545 EXPECT_FALSE(session_.WillingAndAbleToWrite()); |
546 } | 546 } |
547 | 547 |
548 TEST_P(QuicSessionTestServer, OnCanWriteCongestionControlBlocks) { | 548 TEST_P(QuicSessionTestServer, OnCanWriteCongestionControlBlocks) { |
549 InSequence s; | 549 InSequence s; |
550 | 550 |
551 // Drive congestion control manually. | 551 // Drive congestion control manually. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 QuicSpdySessionPeer::SetHeadersStream(&session_, headers_stream); | 676 QuicSpdySessionPeer::SetHeadersStream(&session_, headers_stream); |
677 EXPECT_CALL(*headers_stream, OnCanWrite()); | 677 EXPECT_CALL(*headers_stream, OnCanWrite()); |
678 | 678 |
679 session_.OnCanWrite(); | 679 session_.OnCanWrite(); |
680 EXPECT_FALSE(session_.WillingAndAbleToWrite()); | 680 EXPECT_FALSE(session_.WillingAndAbleToWrite()); |
681 } | 681 } |
682 | 682 |
683 TEST_P(QuicSessionTestServer, SendGoAway) { | 683 TEST_P(QuicSessionTestServer, SendGoAway) { |
684 MockPacketWriter* writer = static_cast<MockPacketWriter*>( | 684 MockPacketWriter* writer = static_cast<MockPacketWriter*>( |
685 QuicConnectionPeer::GetWriter(session_.connection())); | 685 QuicConnectionPeer::GetWriter(session_.connection())); |
686 EXPECT_CALL(*writer, WritePacket(_, _, _, _)) | 686 EXPECT_CALL(*writer, WritePacket(_, _, _, _, _)) |
687 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); | 687 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); |
688 EXPECT_CALL(*connection_, SendGoAway(_, _, _)) | 688 EXPECT_CALL(*connection_, SendGoAway(_, _, _)) |
689 .WillOnce(Invoke(connection_, &MockConnection::ReallySendGoAway)); | 689 .WillOnce(Invoke(connection_, &MockConnection::ReallySendGoAway)); |
690 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); | 690 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); |
691 EXPECT_TRUE(session_.goaway_sent()); | 691 EXPECT_TRUE(session_.goaway_sent()); |
692 | 692 |
693 const QuicStreamId kTestStreamId = 5u; | 693 const QuicStreamId kTestStreamId = 5u; |
694 EXPECT_CALL(*connection_, | 694 EXPECT_CALL(*connection_, |
695 SendRstStream(kTestStreamId, QUIC_STREAM_PEER_GOING_AWAY, 0)) | 695 SendRstStream(kTestStreamId, QUIC_STREAM_PEER_GOING_AWAY, 0)) |
696 .Times(0); | 696 .Times(0); |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 session_.max_open_incoming_streams()); | 1236 session_.max_open_incoming_streams()); |
1237 } | 1237 } |
1238 | 1238 |
1239 EXPECT_EQ(session_.max_open_outgoing_streams(), | 1239 EXPECT_EQ(session_.max_open_outgoing_streams(), |
1240 kDefaultMaxStreamsPerConnection); | 1240 kDefaultMaxStreamsPerConnection); |
1241 } | 1241 } |
1242 | 1242 |
1243 } // namespace | 1243 } // namespace |
1244 } // namespace test | 1244 } // namespace test |
1245 } // namespace net | 1245 } // namespace net |
OLD | NEW |