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

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender_test.cc

Issue 242593002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fix. Use uint32 instead of int Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/quic_ack_notifier.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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/quic/congestion_control/rtt_stats.h" 9 #include "net/quic/congestion_control/rtt_stats.h"
10 #include "net/quic/congestion_control/tcp_cubic_sender.h" 10 #include "net/quic/congestion_control/tcp_cubic_sender.h"
(...skipping 18 matching lines...) Expand all
29 bool reno, 29 bool reno,
30 QuicTcpCongestionWindow max_tcp_congestion_window) 30 QuicTcpCongestionWindow max_tcp_congestion_window)
31 : TcpCubicSender( 31 : TcpCubicSender(
32 clock, &rtt_stats_, reno, max_tcp_congestion_window, &stats_) { 32 clock, &rtt_stats_, reno, max_tcp_congestion_window, &stats_) {
33 } 33 }
34 34
35 QuicTcpCongestionWindow congestion_window() { 35 QuicTcpCongestionWindow congestion_window() {
36 return congestion_window_; 36 return congestion_window_;
37 } 37 }
38 38
39 const HybridSlowStart& hybrid_slow_start() const {
40 return hybrid_slow_start_;
41 }
42
39 RttStats rtt_stats_; 43 RttStats rtt_stats_;
40 QuicConnectionStats stats_; 44 QuicConnectionStats stats_;
41 45
42 using TcpCubicSender::AvailableSendWindow; 46 using TcpCubicSender::AvailableSendWindow;
43 using TcpCubicSender::SendWindow; 47 using TcpCubicSender::SendWindow;
44 }; 48 };
45 49
46 class TcpCubicSenderTest : public ::testing::Test { 50 class TcpCubicSenderTest : public ::testing::Test {
47 protected: 51 protected:
48 TcpCubicSenderTest() 52 TcpCubicSenderTest()
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // one. 190 // one.
187 for (int i = 0; i < 69; ++i) { 191 for (int i = 0; i < 69; ++i) {
188 SendAvailableSendWindow(); 192 SendAvailableSendWindow();
189 AckNPackets(2); 193 AckNPackets(2);
190 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 194 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
191 } 195 }
192 SendAvailableSendWindow(); 196 SendAvailableSendWindow();
193 AckNPackets(2); 197 AckNPackets(2);
194 expected_send_window += kDefaultTCPMSS; 198 expected_send_window += kDefaultTCPMSS;
195 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 199 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
200
201 // Now RTO and ensure slow start gets reset.
202 EXPECT_TRUE(sender_->hybrid_slow_start().started());
203 sender_->OnRetransmissionTimeout(true);
204 EXPECT_FALSE(sender_->hybrid_slow_start().started());
196 } 205 }
197 206
198 TEST_F(TcpCubicSenderTest, SlowStartPacketLoss) { 207 TEST_F(TcpCubicSenderTest, SlowStartPacketLoss) {
199 // Make sure that we fall out of slow start when we encounter a packet loss. 208 // Make sure that we fall out of slow start when we encounter a packet loss.
200 QuicCongestionFeedbackFrame feedback; 209 QuicCongestionFeedbackFrame feedback;
201 // At startup make sure we can send. 210 // At startup make sure we can send.
202 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 211 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
203 HAS_RETRANSMITTABLE_DATA).IsZero()); 212 HAS_RETRANSMITTABLE_DATA).IsZero());
204 // Get default QuicCongestionFeedbackFrame from receiver. 213 // Get default QuicCongestionFeedbackFrame from receiver.
205 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback)); 214 ASSERT_TRUE(receiver_->GenerateCongestionFeedback(&feedback));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // We need to ack another window before we increase CWND by 1. 257 // We need to ack another window before we increase CWND by 1.
249 for (size_t i = 0; i < number_of_packets_in_window - 2; ++i) { 258 for (size_t i = 0; i < number_of_packets_in_window - 2; ++i) {
250 AckNPackets(1); 259 AckNPackets(1);
251 SendAvailableSendWindow(); 260 SendAvailableSendWindow();
252 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 261 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
253 } 262 }
254 263
255 AckNPackets(1); 264 AckNPackets(1);
256 expected_send_window += kDefaultTCPMSS; 265 expected_send_window += kDefaultTCPMSS;
257 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 266 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
267
268 // Now RTO and ensure slow start gets reset.
269 EXPECT_TRUE(sender_->hybrid_slow_start().started());
270 sender_->OnRetransmissionTimeout(true);
271 EXPECT_FALSE(sender_->hybrid_slow_start().started());
258 } 272 }
259 273
260 TEST_F(TcpCubicSenderTest, SlowStartPacketLossPRR) { 274 TEST_F(TcpCubicSenderTest, SlowStartPacketLossPRR) {
261 // Test based on the first example in RFC6937. 275 // Test based on the first example in RFC6937.
262 // Make sure that we fall out of slow start when we encounter a packet loss. 276 // Make sure that we fall out of slow start when we encounter a packet loss.
263 QuicCongestionFeedbackFrame feedback; 277 QuicCongestionFeedbackFrame feedback;
264 // At startup make sure we can send. 278 // At startup make sure we can send.
265 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(), 279 EXPECT_TRUE(sender_->TimeUntilSend(clock_.Now(),
266 HAS_RETRANSMITTABLE_DATA).IsZero()); 280 HAS_RETRANSMITTABLE_DATA).IsZero());
267 // Get default QuicCongestionFeedbackFrame from receiver. 281 // Get default QuicCongestionFeedbackFrame from receiver.
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } 639 }
626 640
627 // Next ack should cause congestion window to grow by 1MSS. 641 // Next ack should cause congestion window to grow by 1MSS.
628 AckNPackets(2); 642 AckNPackets(2);
629 expected_send_window += kDefaultTCPMSS; 643 expected_send_window += kDefaultTCPMSS;
630 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 644 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
631 } 645 }
632 646
633 } // namespace test 647 } // namespace test
634 } // namespace net 648 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/quic_ack_notifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698