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

Side by Side Diff: net/quic/quic_connection_test.cc

Issue 285193006: Don't set QUIC's write alarm if we are connection flow control blocked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Created 6 years, 7 months 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/quic/quic_connection.cc ('k') | net/quic/quic_protocol.h » ('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/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 EXPECT_CALL(*receive_algorithm_, 603 EXPECT_CALL(*receive_algorithm_,
604 RecordIncomingPacket(_, _, _)).Times(AnyNumber()); 604 RecordIncomingPacket(_, _, _)).Times(AnyNumber());
605 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) 605 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
606 .Times(AnyNumber()); 606 .Times(AnyNumber());
607 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()).WillRepeatedly( 607 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()).WillRepeatedly(
608 Return(QuicTime::Delta::Zero())); 608 Return(QuicTime::Delta::Zero()));
609 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly( 609 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly(
610 Return(kMaxPacketSize)); 610 Return(kMaxPacketSize));
611 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) 611 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
612 .WillByDefault(Return(true)); 612 .WillByDefault(Return(true));
613 EXPECT_CALL(visitor_, HasPendingWrites()).Times(AnyNumber()); 613 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).Times(AnyNumber());
614 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber()); 614 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber());
615 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber()); 615 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber());
616 EXPECT_CALL(visitor_, HasOpenDataStreams()).WillRepeatedly(Return(false)); 616 EXPECT_CALL(visitor_, HasOpenDataStreams()).WillRepeatedly(Return(false));
617 617
618 EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) 618 EXPECT_CALL(*loss_algorithm_, GetLossTimeout())
619 .WillRepeatedly(Return(QuicTime::Zero())); 619 .WillRepeatedly(Return(QuicTime::Zero()));
620 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) 620 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
621 .WillRepeatedly(Return(SequenceNumberSet())); 621 .WillRepeatedly(Return(SequenceNumberSet()));
622 } 622 }
623 623
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1768 EXPECT_TRUE(writer_->stream_frames()[0].fin); 1768 EXPECT_TRUE(writer_->stream_frames()[0].fin);
1769 } 1769 }
1770 1770
1771 TEST_P(QuicConnectionTest, OnCanWrite) { 1771 TEST_P(QuicConnectionTest, OnCanWrite) {
1772 // Visitor's OnCanWrite will send data, but will have more pending writes. 1772 // Visitor's OnCanWrite will send data, but will have more pending writes.
1773 EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll( 1773 EXPECT_CALL(visitor_, OnCanWrite()).WillOnce(DoAll(
1774 IgnoreResult(InvokeWithoutArgs(&connection_, 1774 IgnoreResult(InvokeWithoutArgs(&connection_,
1775 &TestConnection::SendStreamData3)), 1775 &TestConnection::SendStreamData3)),
1776 IgnoreResult(InvokeWithoutArgs(&connection_, 1776 IgnoreResult(InvokeWithoutArgs(&connection_,
1777 &TestConnection::SendStreamData5)))); 1777 &TestConnection::SendStreamData5))));
1778 EXPECT_CALL(visitor_, HasPendingWrites()).WillOnce(Return(true)); 1778 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).WillOnce(Return(true));
1779 EXPECT_CALL(*send_algorithm_, 1779 EXPECT_CALL(*send_algorithm_,
1780 TimeUntilSend(_, _, _)).WillRepeatedly( 1780 TimeUntilSend(_, _, _)).WillRepeatedly(
1781 testing::Return(QuicTime::Delta::Zero())); 1781 testing::Return(QuicTime::Delta::Zero()));
1782 1782
1783 connection_.OnCanWrite(); 1783 connection_.OnCanWrite();
1784 1784
1785 // Parse the last packet and ensure it's the two stream frames from 1785 // Parse the last packet and ensure it's the two stream frames from
1786 // two different streams. 1786 // two different streams.
1787 EXPECT_EQ(2u, writer_->frame_count()); 1787 EXPECT_EQ(2u, writer_->frame_count());
1788 EXPECT_EQ(2u, writer_->stream_frames().size()); 1788 EXPECT_EQ(2u, writer_->stream_frames().size());
(...skipping 2182 matching lines...) Expand 10 before | Expand all | Expand 10 after
3971 QuicBlockedFrame blocked; 3971 QuicBlockedFrame blocked;
3972 blocked.stream_id = 3; 3972 blocked.stream_id = 3;
3973 EXPECT_CALL(visitor_, OnBlockedFrames(_)); 3973 EXPECT_CALL(visitor_, OnBlockedFrames(_));
3974 ProcessFramePacket(QuicFrame(&blocked)); 3974 ProcessFramePacket(QuicFrame(&blocked));
3975 EXPECT_TRUE(ack_alarm->IsSet()); 3975 EXPECT_TRUE(ack_alarm->IsSet());
3976 } 3976 }
3977 3977
3978 } // namespace 3978 } // namespace
3979 } // namespace test 3979 } // namespace test
3980 } // namespace net 3980 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698