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

Side by Side Diff: net/quic/core/congestion_control/bbr_sender_test.cc

Issue 2566703002: Various formatting cleanups to net/quic/core/frames (Closed)
Patch Set: Fix Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/core/congestion_control/bbr_sender.h" 5 #include "net/quic/core/congestion_control/bbr_sender.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 kInitialCongestionWindowPackets, 88 kInitialCongestionWindowPackets,
89 kDefaultMaxCongestionWindowPackets, &random_); 89 kDefaultMaxCongestionWindowPackets, &random_);
90 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(), 90 QuicConnectionPeer::SetSendAlgorithm(bbr_sender_.connection(),
91 kDefaultPathId, sender_); 91 kDefaultPathId, sender_);
92 92
93 clock_ = simulator_.GetClock(); 93 clock_ = simulator_.GetClock();
94 simulator_.set_random_generator(&random_); 94 simulator_.set_random_generator(&random_);
95 95
96 uint64_t seed = QuicRandom::GetInstance()->RandUint64(); 96 uint64_t seed = QuicRandom::GetInstance()->RandUint64();
97 random_.set_seed(seed); 97 random_.set_seed(seed);
98 LOG(INFO) << "BbrSenderTest simulator set up. Seed: " << seed; 98 VLOG(1) << "BbrSenderTest simulator set up. Seed: " << seed;
99 } 99 }
100 100
101 simulator::Simulator simulator_; 101 simulator::Simulator simulator_;
102 simulator::QuicEndpoint bbr_sender_; 102 simulator::QuicEndpoint bbr_sender_;
103 simulator::QuicEndpoint receiver_; 103 simulator::QuicEndpoint receiver_;
104 std::unique_ptr<simulator::Switch> switch_; 104 std::unique_ptr<simulator::Switch> switch_;
105 std::unique_ptr<simulator::SymmetricLink> bbr_sender_link_; 105 std::unique_ptr<simulator::SymmetricLink> bbr_sender_link_;
106 std::unique_ptr<simulator::SymmetricLink> receiver_link_; 106 std::unique_ptr<simulator::SymmetricLink> receiver_link_;
107 107
108 SimpleRandom random_; 108 SimpleRandom random_;
(...skipping 30 matching lines...) Expand all
139 kTestPropagationDelay)); 139 kTestPropagationDelay));
140 } 140 }
141 141
142 void DoSimpleTransfer(QuicByteCount transfer_size, QuicTime::Delta deadline) { 142 void DoSimpleTransfer(QuicByteCount transfer_size, QuicTime::Delta deadline) {
143 bbr_sender_.AddBytesToTransfer(transfer_size); 143 bbr_sender_.AddBytesToTransfer(transfer_size);
144 bool simulator_result = simulator_.RunUntilOrTimeout( 144 bool simulator_result = simulator_.RunUntilOrTimeout(
145 [this]() { return bbr_sender_.bytes_to_transfer() == 0; }, deadline); 145 [this]() { return bbr_sender_.bytes_to_transfer() == 0; }, deadline);
146 EXPECT_TRUE(simulator_result) 146 EXPECT_TRUE(simulator_result)
147 << "Simple transfer failed. Bytes remaining: " 147 << "Simple transfer failed. Bytes remaining: "
148 << bbr_sender_.bytes_to_transfer(); 148 << bbr_sender_.bytes_to_transfer();
149 LOG(INFO) << "Simple transfer state: " << sender_->ExportDebugState(); 149 VLOG(1) << "Simple transfer state: " << sender_->ExportDebugState();
150 } 150 }
151 151
152 // Drive the simulator by sending enough data to enter PROBE_BW. 152 // Drive the simulator by sending enough data to enter PROBE_BW.
153 void DriveOutOfStartup() { 153 void DriveOutOfStartup() {
154 ASSERT_FALSE(sender_->ExportDebugState().is_at_full_bandwidth); 154 ASSERT_FALSE(sender_->ExportDebugState().is_at_full_bandwidth);
155 DoSimpleTransfer(1024 * 1024, QuicTime::Delta::FromSeconds(15)); 155 DoSimpleTransfer(1024 * 1024, QuicTime::Delta::FromSeconds(15));
156 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode); 156 EXPECT_EQ(BbrSender::PROBE_BW, sender_->ExportDebugState().mode);
157 ExpectApproxEq(kTestLinkBandwidth, 157 ExpectApproxEq(kTestLinkBandwidth,
158 sender_->ExportDebugState().max_bandwidth, 0.01f); 158 sender_->ExportDebugState().max_bandwidth, 0.01f);
159 } 159 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 // Send another packet. 459 // Send another packet.
460 bbr_sender_.AddBytesToTransfer(1000); 460 bbr_sender_.AddBytesToTransfer(1000);
461 simulator_result = simulator_.RunUntilOrTimeout( 461 simulator_result = simulator_.RunUntilOrTimeout(
462 [this]() { return receiver_.bytes_received() == 2000; }, timeout); 462 [this]() { return receiver_.bytes_received() == 2000; }, timeout);
463 ASSERT_TRUE(simulator_result); 463 ASSERT_TRUE(simulator_result);
464 EXPECT_GE(sender_->PacingRate(0), initial_rate); 464 EXPECT_GE(sender_->PacingRate(0), initial_rate);
465 } 465 }
466 466
467 } // namespace test 467 } // namespace test
468 } // namespace net 468 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/congestion_control/bbr_sender.cc ('k') | net/quic/core/congestion_control/cubic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698