Chromium Code Reviews

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

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 432 matching lines...)
443 443
444 TEST_F(TcpCubicSenderTest, RTOCongestionWindowNoRetransmission) { 444 TEST_F(TcpCubicSenderTest, RTOCongestionWindowNoRetransmission) {
445 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); 445 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
446 446
447 // Expect the window to remain unchanged if the RTO fires but no 447 // Expect the window to remain unchanged if the RTO fires but no
448 // packets are retransmitted. 448 // packets are retransmitted.
449 sender_->OnRetransmissionTimeout(false); 449 sender_->OnRetransmissionTimeout(false);
450 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); 450 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
451 } 451 }
452 452
453 TEST_F(TcpCubicSenderTest, RTOTwiceOnlyHalvesSsthresh) {
454 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
455
456 sender_->OnRetransmissionTimeout(true);
457 EXPECT_EQ(2 * kDefaultTCPMSS, sender_->GetCongestionWindow());
458 EXPECT_EQ(5u, sender_->slowstart_threshold());
459
460 sender_->OnRetransmissionTimeout(true);
461 EXPECT_EQ(2 * kDefaultTCPMSS, sender_->GetCongestionWindow());
462 EXPECT_EQ(5u, sender_->slowstart_threshold());
463
464 AckNPackets(2);
465
466 EXPECT_EQ(4 * kDefaultTCPMSS, sender_->GetCongestionWindow());
467 EXPECT_EQ(5u, sender_->slowstart_threshold());
468
469 sender_->OnRetransmissionTimeout(true);
470 EXPECT_EQ(2 * kDefaultTCPMSS, sender_->GetCongestionWindow());
471 EXPECT_EQ(2u, sender_->slowstart_threshold());
472 }
473
453 TEST_F(TcpCubicSenderTest, RetransmissionDelay) { 474 TEST_F(TcpCubicSenderTest, RetransmissionDelay) {
454 const int64 kRttMs = 10; 475 const int64 kRttMs = 10;
455 const int64 kDeviationMs = 3; 476 const int64 kDeviationMs = 3;
456 EXPECT_EQ(QuicTime::Delta::Zero(), sender_->RetransmissionDelay()); 477 EXPECT_EQ(QuicTime::Delta::Zero(), sender_->RetransmissionDelay());
457 478
458 sender_->rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(kRttMs), 479 sender_->rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(kRttMs),
459 QuicTime::Delta::Zero(), clock_.Now()); 480 QuicTime::Delta::Zero(), clock_.Now());
460 481
461 // Initial value is to set the median deviation to half of the initial 482 // Initial value is to set the median deviation to half of the initial
462 // rtt, the median in then multiplied by a factor of 4 and finally the 483 // rtt, the median in then multiplied by a factor of 4 and finally the
(...skipping 272 matching lines...)
735 756
736 cached_network_params.set_bandwidth_estimate_bytes_per_second( 757 cached_network_params.set_bandwidth_estimate_bytes_per_second(
737 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); 758 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize);
738 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); 759 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params));
739 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, 760 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption,
740 sender_->congestion_window()); 761 sender_->congestion_window());
741 } 762 }
742 763
743 } // namespace test 764 } // namespace test
744 } // namespace net 765 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/congestion_control/tcp_loss_algorithm.cc » ('j') | no next file with comments »

Powered by Google App Engine