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

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

Issue 125253004: Simplify RTO interaction between the QUIC sent packet manager and the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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_connection_test.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/quic/congestion_control/tcp_cubic_sender.h" 5 #include "net/quic/congestion_control/tcp_cubic_sender.h"
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/tcp_receiver.h" 9 #include "net/quic/congestion_control/tcp_receiver.h"
10 #include "net/quic/test_tools/mock_clock.h" 10 #include "net/quic/test_tools/mock_clock.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 SendAvailableSendWindow(); 233 SendAvailableSendWindow();
234 AckNPackets(1); 234 AckNPackets(1);
235 expected_send_window += kDefaultTCPMSS; 235 expected_send_window += kDefaultTCPMSS;
236 EXPECT_EQ(expected_send_window, sender_->SendWindow()); 236 EXPECT_EQ(expected_send_window, sender_->SendWindow());
237 } 237 }
238 238
239 TEST_F(TcpCubicSenderTest, RTOCongestionWindow) { 239 TEST_F(TcpCubicSenderTest, RTOCongestionWindow) {
240 EXPECT_EQ(kDefaultWindowTCP, sender_->SendWindow()); 240 EXPECT_EQ(kDefaultWindowTCP, sender_->SendWindow());
241 241
242 // Expect the window to decrease to the minimum once the RTO fires. 242 // Expect the window to decrease to the minimum once the RTO fires.
243 sender_->OnRetransmissionTimeout(); 243 sender_->OnRetransmissionTimeout(true);
244 EXPECT_EQ(2 * kDefaultTCPMSS, sender_->SendWindow()); 244 EXPECT_EQ(2 * kDefaultTCPMSS, sender_->SendWindow());
245 } 245 }
246 246
247 TEST_F(TcpCubicSenderTest, RTOCongestionWindowNoRetransmission) {
248 EXPECT_EQ(kDefaultWindowTCP, sender_->SendWindow());
249
250 // Expect the window to remain unchanged if the RTO fires but no
251 // packets are retransmitted.
252 sender_->OnRetransmissionTimeout(false);
253 EXPECT_EQ(kDefaultWindowTCP, sender_->SendWindow());
254 }
255
247 TEST_F(TcpCubicSenderTest, RetransmissionDelay) { 256 TEST_F(TcpCubicSenderTest, RetransmissionDelay) {
248 const int64 kRttMs = 10; 257 const int64 kRttMs = 10;
249 const int64 kDeviationMs = 3; 258 const int64 kDeviationMs = 3;
250 EXPECT_EQ(QuicTime::Delta::Zero(), sender_->RetransmissionDelay()); 259 EXPECT_EQ(QuicTime::Delta::Zero(), sender_->RetransmissionDelay());
251 260
252 sender_->AckAccounting(QuicTime::Delta::FromMilliseconds(kRttMs)); 261 sender_->AckAccounting(QuicTime::Delta::FromMilliseconds(kRttMs));
253 262
254 // Initial value is to set the median deviation to half of the initial 263 // Initial value is to set the median deviation to half of the initial
255 // rtt, the median in then multiplied by a factor of 4 and finally the 264 // rtt, the median in then multiplied by a factor of 4 and finally the
256 // smoothed rtt is added which is the initial rtt. 265 // smoothed rtt is added which is the initial rtt.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 config.set_server_initial_congestion_window(2 * congestion_window, 421 config.set_server_initial_congestion_window(2 * congestion_window,
413 2 * congestion_window); 422 2 * congestion_window);
414 EXPECT_EQ(2 * congestion_window, config.server_initial_congestion_window()); 423 EXPECT_EQ(2 * congestion_window, config.server_initial_congestion_window());
415 424
416 sender_->SetFromConfig(config, true); 425 sender_->SetFromConfig(config, true);
417 EXPECT_EQ(2 * congestion_window, sender_->congestion_window()); 426 EXPECT_EQ(2 * congestion_window, sender_->congestion_window());
418 } 427 }
419 428
420 } // namespace test 429 } // namespace test
421 } // namespace net 430 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698