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

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

Issue 908673002: Remove QUIC's ReceiveAlgorithmInterface now that it does nothing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Fixing_a_bug_0_85554888
Patch Set: Created 5 years, 10 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 <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"
11 #include "net/quic/congestion_control/tcp_receiver.h"
12 #include "net/quic/crypto/crypto_protocol.h" 11 #include "net/quic/crypto/crypto_protocol.h"
13 #include "net/quic/quic_utils.h" 12 #include "net/quic/quic_utils.h"
14 #include "net/quic/test_tools/mock_clock.h" 13 #include "net/quic/test_tools/mock_clock.h"
15 #include "net/quic/test_tools/quic_config_peer.h" 14 #include "net/quic/test_tools/quic_config_peer.h"
16 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
17 16
18 using std::make_pair; 17 using std::make_pair;
19 using std::min; 18 using std::min;
20 19
21 namespace net { 20 namespace net {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 RttStats rtt_stats_; 57 RttStats rtt_stats_;
59 QuicConnectionStats stats_; 58 QuicConnectionStats stats_;
60 }; 59 };
61 60
62 class TcpCubicSenderTest : public ::testing::Test { 61 class TcpCubicSenderTest : public ::testing::Test {
63 protected: 62 protected:
64 TcpCubicSenderTest() 63 TcpCubicSenderTest()
65 : one_ms_(QuicTime::Delta::FromMilliseconds(1)), 64 : one_ms_(QuicTime::Delta::FromMilliseconds(1)),
66 sender_(new TcpCubicSenderPeer(&clock_, true, 65 sender_(new TcpCubicSenderPeer(&clock_, true,
67 kMaxTcpCongestionWindow)), 66 kMaxTcpCongestionWindow)),
68 receiver_(new TcpReceiver()),
69 sequence_number_(1), 67 sequence_number_(1),
70 acked_sequence_number_(0), 68 acked_sequence_number_(0),
71 bytes_in_flight_(0) { 69 bytes_in_flight_(0) {
72 standard_packet_.bytes_sent = kDefaultTCPMSS; 70 standard_packet_.bytes_sent = kDefaultTCPMSS;
73 } 71 }
74 72
75 int SendAvailableSendWindow() { 73 int SendAvailableSendWindow() {
76 // Send as long as TimeUntilSend returns Zero. 74 // Send as long as TimeUntilSend returns Zero.
77 int packets_sent = 0; 75 int packets_sent = 0;
78 bool can_send = sender_->TimeUntilSend( 76 bool can_send = sender_->TimeUntilSend(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 lost_packets.push_back( 124 lost_packets.push_back(
127 make_pair(sequence_number, standard_packet_)); 125 make_pair(sequence_number, standard_packet_));
128 sender_->OnCongestionEvent( 126 sender_->OnCongestionEvent(
129 false, bytes_in_flight_, acked_packets, lost_packets); 127 false, bytes_in_flight_, acked_packets, lost_packets);
130 bytes_in_flight_ -= kDefaultTCPMSS; 128 bytes_in_flight_ -= kDefaultTCPMSS;
131 } 129 }
132 130
133 const QuicTime::Delta one_ms_; 131 const QuicTime::Delta one_ms_;
134 MockClock clock_; 132 MockClock clock_;
135 scoped_ptr<TcpCubicSenderPeer> sender_; 133 scoped_ptr<TcpCubicSenderPeer> sender_;
136 scoped_ptr<TcpReceiver> receiver_;
137 QuicPacketSequenceNumber sequence_number_; 134 QuicPacketSequenceNumber sequence_number_;
138 QuicPacketSequenceNumber acked_sequence_number_; 135 QuicPacketSequenceNumber acked_sequence_number_;
139 QuicByteCount bytes_in_flight_; 136 QuicByteCount bytes_in_flight_;
140 TransmissionInfo standard_packet_; 137 TransmissionInfo standard_packet_;
141 }; 138 };
142 139
143 TEST_F(TcpCubicSenderTest, SimpleSender) { 140 TEST_F(TcpCubicSenderTest, SimpleSender) {
144 // At startup make sure we are at the default. 141 // At startup make sure we are at the default.
145 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow()); 142 EXPECT_EQ(kDefaultWindowTCP, sender_->GetCongestionWindow());
146 // At startup make sure we can send. 143 // At startup make sure we can send.
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 753
757 cached_network_params.set_bandwidth_estimate_bytes_per_second( 754 cached_network_params.set_bandwidth_estimate_bytes_per_second(
758 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); 755 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize);
759 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); 756 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params));
760 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, 757 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption,
761 sender_->congestion_window()); 758 sender_->congestion_window());
762 } 759 }
763 760
764 } // namespace test 761 } // namespace test
765 } // namespace net 762 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/receive_algorithm_interface.cc ('k') | net/quic/congestion_control/tcp_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698