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

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

Issue 754433003: Update from https://crrev.com/305340 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 <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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 694 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
695 } 695 }
696 696
697 // Next ack should cause congestion window to grow by 1MSS. 697 // Next ack should cause congestion window to grow by 1MSS.
698 SendAvailableSendWindow(); 698 SendAvailableSendWindow();
699 AckNPackets(2); 699 AckNPackets(2);
700 expected_send_window += kDefaultTCPMSS; 700 expected_send_window += kDefaultTCPMSS;
701 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow()); 701 EXPECT_EQ(expected_send_window, sender_->GetCongestionWindow());
702 } 702 }
703 703
704 TEST_F(TcpCubicSenderTest, BandwidthResumption) {
705 // Test that when provided with CachedNetworkParameters and opted in to the
706 // bandwidth resumption experiment, that the TcpCubicSender sets initial CWND
707 // appropriately.
708
709 // Set some common values.
710 CachedNetworkParameters cached_network_params;
711 const QuicPacketCount kNumberOfPackets = 123;
712 const int kBandwidthEstimateBytesPerSecond =
713 kNumberOfPackets * kMaxPacketSize;
714 cached_network_params.set_bandwidth_estimate_bytes_per_second(
715 kBandwidthEstimateBytesPerSecond);
716 cached_network_params.set_min_rtt_ms(1000);
717
718 // Ensure that an old estimate is not used for bandwidth resumption.
719 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() -
720 (kNumSecondsPerHour + 1));
721 sender_->ResumeConnectionState(cached_network_params);
722 EXPECT_EQ(10u, sender_->congestion_window());
723
724 // If the estimate is new enough, make sure it is used.
725 cached_network_params.set_timestamp(clock_.WallNow().ToUNIXSeconds() -
726 (kNumSecondsPerHour - 1));
727 sender_->ResumeConnectionState(cached_network_params);
728 EXPECT_EQ(kNumberOfPackets, sender_->congestion_window());
729 }
730
704 } // namespace test 731 } // namespace test
705 } // namespace net 732 } // 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
This is Rietveld 408576698