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

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

Issue 493183002: Move least_packet_awaited_by_peer_ from QuicReceivedPacketManager to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Remove_timestamp_receiver_73627146
Patch Set: Created 6 years, 4 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_received_packet_manager.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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 lost_packets.insert(i * 2); 1112 lost_packets.insert(i * 2);
1113 } 1113 }
1114 } 1114 }
1115 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) 1115 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
1116 .WillOnce(Return(lost_packets)); 1116 .WillOnce(Return(lost_packets));
1117 EXPECT_CALL(entropy_calculator_, 1117 EXPECT_CALL(entropy_calculator_,
1118 EntropyHash(511)).WillOnce(testing::Return(0)); 1118 EntropyHash(511)).WillOnce(testing::Return(0));
1119 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 1119 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
1120 ProcessAckPacket(&frame); 1120 ProcessAckPacket(&frame);
1121 1121
1122 QuicReceivedPacketManager* received_packet_manager = 1122 const QuicSentPacketManager& sent_packet_manager =
1123 QuicConnectionPeer::GetReceivedPacketManager(&connection_); 1123 connection_.sent_packet_manager();
1124 // A truncated ack will not have the true largest observed. 1124 // A truncated ack will not have the true largest observed.
1125 EXPECT_GT(num_packets, 1125 EXPECT_GT(num_packets, sent_packet_manager.largest_observed());
1126 received_packet_manager->peer_largest_observed_packet());
1127 1126
1128 AckPacket(192, &frame); 1127 AckPacket(192, &frame);
1129 1128
1130 // Removing one missing packet allows us to ack 192 and one more range, but 1129 // Removing one missing packet allows us to ack 192 and one more range, but
1131 // 192 has already been declared lost, so it doesn't register as an ack. 1130 // 192 has already been declared lost, so it doesn't register as an ack.
1132 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _)) 1131 EXPECT_CALL(*loss_algorithm_, DetectLostPackets(_, _, _, _))
1133 .WillOnce(Return(SequenceNumberSet())); 1132 .WillOnce(Return(SequenceNumberSet()));
1134 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 1133 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
1135 ProcessAckPacket(&frame); 1134 ProcessAckPacket(&frame);
1136 EXPECT_EQ(num_packets, 1135 EXPECT_EQ(num_packets, sent_packet_manager.largest_observed());
1137 received_packet_manager->peer_largest_observed_packet());
1138 } 1136 }
1139 1137
1140 TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) { 1138 TEST_P(QuicConnectionTest, AckReceiptCausesAckSendBadEntropy) {
1141 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1139 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1142 1140
1143 ProcessPacket(1); 1141 ProcessPacket(1);
1144 // Delay sending, then queue up an ack. 1142 // Delay sending, then queue up an ack.
1145 EXPECT_CALL(*send_algorithm_, 1143 EXPECT_CALL(*send_algorithm_,
1146 TimeUntilSend(_, _, _)).WillOnce( 1144 TimeUntilSend(_, _, _)).WillOnce(
1147 testing::Return(QuicTime::Delta::FromMicroseconds(1))); 1145 testing::Return(QuicTime::Delta::FromMicroseconds(1)));
(...skipping 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after
3957 QuicBlockedFrame blocked; 3955 QuicBlockedFrame blocked;
3958 blocked.stream_id = 3; 3956 blocked.stream_id = 3;
3959 EXPECT_CALL(visitor_, OnBlockedFrames(_)); 3957 EXPECT_CALL(visitor_, OnBlockedFrames(_));
3960 ProcessFramePacket(QuicFrame(&blocked)); 3958 ProcessFramePacket(QuicFrame(&blocked));
3961 EXPECT_TRUE(ack_alarm->IsSet()); 3959 EXPECT_TRUE(ack_alarm->IsSet());
3962 } 3960 }
3963 3961
3964 } // namespace 3962 } // namespace
3965 } // namespace test 3963 } // namespace test
3966 } // namespace net 3964 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_received_packet_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698