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

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

Issue 925423004: Fully qualify std::* names being exported internally by using (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ignore_goaways_86198166
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/crypto/crypto_protocol.h" 11 #include "net/quic/crypto/crypto_protocol.h"
12 #include "net/quic/quic_protocol.h" 12 #include "net/quic/quic_protocol.h"
13 #include "net/quic/quic_utils.h" 13 #include "net/quic/quic_utils.h"
14 #include "net/quic/test_tools/mock_clock.h" 14 #include "net/quic/test_tools/mock_clock.h"
15 #include "net/quic/test_tools/quic_config_peer.h" 15 #include "net/quic/test_tools/quic_config_peer.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 using std::make_pair;
19 using std::min; 18 using std::min;
20 19
21 namespace net { 20 namespace net {
22 namespace test { 21 namespace test {
23 22
24 // TODO(ianswett): A number of theses tests were written with the assumption of 23 // TODO(ianswett): A number of theses tests were written with the assumption of
25 // an initial CWND of 10. They have carefully calculated values which should be 24 // an initial CWND of 10. They have carefully calculated values which should be
26 // updated to be based on kInitialCongestionWindowInsecure. 25 // updated to be based on kInitialCongestionWindowInsecure.
27 const uint32 kInitialCongestionWindowPackets = 10; 26 const uint32 kInitialCongestionWindowPackets = 10;
28 const uint32 kDefaultWindowTCP = 27 const uint32 kDefaultWindowTCP =
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Normal is that TCP acks every other segment. 89 // Normal is that TCP acks every other segment.
91 void AckNPackets(int n) { 90 void AckNPackets(int n) {
92 sender_->rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(60), 91 sender_->rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(60),
93 QuicTime::Delta::Zero(), 92 QuicTime::Delta::Zero(),
94 clock_.Now()); 93 clock_.Now());
95 SendAlgorithmInterface::CongestionVector acked_packets; 94 SendAlgorithmInterface::CongestionVector acked_packets;
96 SendAlgorithmInterface::CongestionVector lost_packets; 95 SendAlgorithmInterface::CongestionVector lost_packets;
97 for (int i = 0; i < n; ++i) { 96 for (int i = 0; i < n; ++i) {
98 ++acked_sequence_number_; 97 ++acked_sequence_number_;
99 acked_packets.push_back( 98 acked_packets.push_back(
100 make_pair(acked_sequence_number_, standard_packet_)); 99 std::make_pair(acked_sequence_number_, standard_packet_));
101 } 100 }
102 sender_->OnCongestionEvent( 101 sender_->OnCongestionEvent(
103 true, bytes_in_flight_, acked_packets, lost_packets); 102 true, bytes_in_flight_, acked_packets, lost_packets);
104 bytes_in_flight_ -= n * kDefaultTCPMSS; 103 bytes_in_flight_ -= n * kDefaultTCPMSS;
105 clock_.AdvanceTime(one_ms_); 104 clock_.AdvanceTime(one_ms_);
106 } 105 }
107 106
108 void LoseNPackets(int n) { 107 void LoseNPackets(int n) {
109 SendAlgorithmInterface::CongestionVector acked_packets; 108 SendAlgorithmInterface::CongestionVector acked_packets;
110 SendAlgorithmInterface::CongestionVector lost_packets; 109 SendAlgorithmInterface::CongestionVector lost_packets;
111 for (int i = 0; i < n; ++i) { 110 for (int i = 0; i < n; ++i) {
112 ++acked_sequence_number_; 111 ++acked_sequence_number_;
113 lost_packets.push_back( 112 lost_packets.push_back(
114 make_pair(acked_sequence_number_, standard_packet_)); 113 std::make_pair(acked_sequence_number_, standard_packet_));
115 } 114 }
116 sender_->OnCongestionEvent( 115 sender_->OnCongestionEvent(
117 false, bytes_in_flight_, acked_packets, lost_packets); 116 false, bytes_in_flight_, acked_packets, lost_packets);
118 bytes_in_flight_ -= n * kDefaultTCPMSS; 117 bytes_in_flight_ -= n * kDefaultTCPMSS;
119 } 118 }
120 119
121 // Does not increment acked_sequence_number_. 120 // Does not increment acked_sequence_number_.
122 void LosePacket(QuicPacketSequenceNumber sequence_number) { 121 void LosePacket(QuicPacketSequenceNumber sequence_number) {
123 SendAlgorithmInterface::CongestionVector acked_packets; 122 SendAlgorithmInterface::CongestionVector acked_packets;
124 SendAlgorithmInterface::CongestionVector lost_packets; 123 SendAlgorithmInterface::CongestionVector lost_packets;
125 lost_packets.push_back( 124 lost_packets.push_back(std::make_pair(sequence_number, standard_packet_));
126 make_pair(sequence_number, standard_packet_));
127 sender_->OnCongestionEvent( 125 sender_->OnCongestionEvent(
128 false, bytes_in_flight_, acked_packets, lost_packets); 126 false, bytes_in_flight_, acked_packets, lost_packets);
129 bytes_in_flight_ -= kDefaultTCPMSS; 127 bytes_in_flight_ -= kDefaultTCPMSS;
130 } 128 }
131 129
132 const QuicTime::Delta one_ms_; 130 const QuicTime::Delta one_ms_;
133 MockClock clock_; 131 MockClock clock_;
134 scoped_ptr<TcpCubicSenderPeer> sender_; 132 scoped_ptr<TcpCubicSenderPeer> sender_;
135 QuicPacketSequenceNumber sequence_number_; 133 QuicPacketSequenceNumber sequence_number_;
136 QuicPacketSequenceNumber acked_sequence_number_; 134 QuicPacketSequenceNumber acked_sequence_number_;
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 752
755 cached_network_params.set_bandwidth_estimate_bytes_per_second( 753 cached_network_params.set_bandwidth_estimate_bytes_per_second(
756 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); 754 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize);
757 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); 755 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params));
758 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, 756 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption,
759 sender_->congestion_window()); 757 sender_->congestion_window());
760 } 758 }
761 759
762 } // namespace test 760 } // namespace test
763 } // namespace net 761 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/send_algorithm_simulator.cc ('k') | net/quic/crypto/crypto_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698