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

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

Issue 2132623002: Landing Recent QUIC changes until 2016-07-02 02:45 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing comment about RPCs Created 4 years, 5 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
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_packets.h" 5 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 expected_send_window += kDefaultTCPMSS; 236 expected_send_window += kDefaultTCPMSS;
237 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 237 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
238 238
239 // Now RTO and ensure slow start gets reset. 239 // Now RTO and ensure slow start gets reset.
240 EXPECT_TRUE(sender_->hybrid_slow_start().started()); 240 EXPECT_TRUE(sender_->hybrid_slow_start().started());
241 sender_->OnRetransmissionTimeout(true); 241 sender_->OnRetransmissionTimeout(true);
242 EXPECT_FALSE(sender_->hybrid_slow_start().started()); 242 EXPECT_FALSE(sender_->hybrid_slow_start().started());
243 } 243 }
244 244
245 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithLargeReduction) { 245 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithLargeReduction) {
246 FLAGS_quic_sslr_limit_reduction = true;
247 QuicConfig config; 246 QuicConfig config;
248 QuicTagVector options; 247 QuicTagVector options;
249 options.push_back(kSSLR); 248 options.push_back(kSSLR);
250 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 249 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
251 sender_->SetFromConfig(config, Perspective::IS_SERVER); 250 sender_->SetFromConfig(config, Perspective::IS_SERVER);
252 251
253 sender_->SetNumEmulatedConnections(1); 252 sender_->SetNumEmulatedConnections(1);
254 const int kNumberOfAcks = (kDefaultWindowTCP / (2 * kDefaultTCPMSS)) - 1; 253 const int kNumberOfAcks = (kDefaultWindowTCP / (2 * kDefaultTCPMSS)) - 1;
255 for (int i = 0; i < kNumberOfAcks; ++i) { 254 for (int i = 0; i < kNumberOfAcks; ++i) {
256 // Send our full send window. 255 // Send our full send window.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 330 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
332 331
333 // Lose 10 packets in recovery and verify that congestion window is reduced 332 // Lose 10 packets in recovery and verify that congestion window is reduced
334 // by 5 packets. 333 // by 5 packets.
335 LoseNPackets(10, kDefaultTCPMSS / 2); 334 LoseNPackets(10, kDefaultTCPMSS / 2);
336 expected_send_window -= 5 * kDefaultTCPMSS; 335 expected_send_window -= 5 * kDefaultTCPMSS;
337 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 336 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
338 } 337 }
339 338
340 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithMaxHalfReduction) { 339 TEST_F(TcpCubicSenderPacketsTest, SlowStartPacketLossWithMaxHalfReduction) {
341 FLAGS_quic_sslr_limit_reduction = true;
342 QuicConfig config; 340 QuicConfig config;
343 QuicTagVector options; 341 QuicTagVector options;
344 options.push_back(kSSLR); 342 options.push_back(kSSLR);
345 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 343 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
346 sender_->SetFromConfig(config, Perspective::IS_SERVER); 344 sender_->SetFromConfig(config, Perspective::IS_SERVER);
347 345
348 sender_->SetNumEmulatedConnections(1); 346 sender_->SetNumEmulatedConnections(1);
349 const int kNumberOfAcks = kInitialCongestionWindowPackets / 2; 347 const int kNumberOfAcks = kInitialCongestionWindowPackets / 2;
350 for (int i = 0; i < kNumberOfAcks; ++i) { 348 for (int i = 0; i < kNumberOfAcks; ++i) {
351 // Send our full send window. 349 // Send our full send window.
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 sender_->slowstart_threshold()); 1019 sender_->slowstart_threshold());
1022 1020
1023 // Resets cwnd and slow start threshold on connection migrations. 1021 // Resets cwnd and slow start threshold on connection migrations.
1024 sender_->OnConnectionMigration(); 1022 sender_->OnConnectionMigration();
1025 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); 1023 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
1026 EXPECT_EQ(kMaxCongestionWindowPackets, sender_->slowstart_threshold()); 1024 EXPECT_EQ(kMaxCongestionWindowPackets, sender_->slowstart_threshold());
1027 EXPECT_FALSE(sender_->hybrid_slow_start().started()); 1025 EXPECT_FALSE(sender_->hybrid_slow_start().started());
1028 } 1026 }
1029 1027
1030 TEST_F(TcpCubicSenderPacketsTest, DefaultMaxCwnd) { 1028 TEST_F(TcpCubicSenderPacketsTest, DefaultMaxCwnd) {
1031 ValueRestore<bool> old_flag(&FLAGS_quic_ignore_srbf, true);
1032 RttStats rtt_stats; 1029 RttStats rtt_stats;
1033 QuicConnectionStats stats; 1030 QuicConnectionStats stats;
1034 std::unique_ptr<SendAlgorithmInterface> sender(SendAlgorithmInterface::Create( 1031 std::unique_ptr<SendAlgorithmInterface> sender(SendAlgorithmInterface::Create(
1035 &clock_, &rtt_stats, kCubic, &stats, kInitialCongestionWindow)); 1032 &clock_, &rtt_stats, kCubic, &stats, kInitialCongestionWindow));
1036 1033
1037 SendAlgorithmInterface::CongestionVector acked_packets; 1034 SendAlgorithmInterface::CongestionVector acked_packets;
1038 SendAlgorithmInterface::CongestionVector missing_packets; 1035 SendAlgorithmInterface::CongestionVector missing_packets;
1039 for (uint64_t i = 1; i < kDefaultMaxCongestionWindowPackets; ++i) { 1036 for (uint64_t i = 1; i < kDefaultMaxCongestionWindowPackets; ++i) {
1040 acked_packets.clear(); 1037 acked_packets.clear();
1041 acked_packets.push_back(std::make_pair(i, 1350)); 1038 acked_packets.push_back(std::make_pair(i, 1350));
1042 sender->OnCongestionEvent(true, sender->GetCongestionWindow(), 1039 sender->OnCongestionEvent(true, sender->GetCongestionWindow(),
1043 acked_packets, missing_packets); 1040 acked_packets, missing_packets);
1044 } 1041 }
1045 EXPECT_EQ(kDefaultMaxCongestionWindowPackets, 1042 EXPECT_EQ(kDefaultMaxCongestionWindowPackets,
1046 sender->GetCongestionWindow() / kDefaultTCPMSS); 1043 sender->GetCongestionWindow() / kDefaultTCPMSS);
1047 } 1044 }
1048 1045
1049 } // namespace test 1046 } // namespace test
1050 } // namespace net 1047 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender_packets.cc ('k') | net/quic/congestion_control/windowed_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698