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

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

Issue 667763003: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/stl_util.h" 8 #include "base/stl_util.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_loss_algorithm.h" 10 #include "net/quic/congestion_control/tcp_loss_algorithm.h"
11 #include "net/quic/quic_unacked_packet_map.h" 11 #include "net/quic/quic_unacked_packet_map.h"
12 #include "net/quic/test_tools/mock_clock.h" 12 #include "net/quic/test_tools/mock_clock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace net { 15 namespace net {
16 namespace test { 16 namespace test {
17 17
18 class TcpLossAlgorithmTest : public ::testing::Test { 18 class TcpLossAlgorithmTest : public ::testing::Test {
19 protected: 19 protected:
20 TcpLossAlgorithmTest() 20 TcpLossAlgorithmTest()
21 : unacked_packets_() { 21 : unacked_packets_() {
22 rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(100), 22 rtt_stats_.UpdateRtt(QuicTime::Delta::FromMilliseconds(100),
23 QuicTime::Delta::Zero(), 23 QuicTime::Delta::Zero(),
24 clock_.Now()); 24 clock_.Now());
25 } 25 }
26 26
27 void SendDataPacket(QuicPacketSequenceNumber sequence_number) { 27 void SendDataPacket(QuicPacketSequenceNumber sequence_number) {
28 SerializedPacket packet(sequence_number, PACKET_1BYTE_SEQUENCE_NUMBER, 28 SerializedPacket packet(sequence_number, PACKET_1BYTE_SEQUENCE_NUMBER,
29 nullptr, 0, new RetransmittableFrames()); 29 nullptr, 0, new RetransmittableFrames());
30 unacked_packets_.AddPacket(packet); 30 unacked_packets_.AddSentPacket(packet, 0, NOT_RETRANSMISSION, clock_.Now(),
31 unacked_packets_.SetSent(sequence_number, clock_.Now(), 1000, true); 31 1000, true);
32 } 32 }
33 33
34 void VerifyLosses(QuicPacketSequenceNumber largest_observed, 34 void VerifyLosses(QuicPacketSequenceNumber largest_observed,
35 QuicPacketSequenceNumber* losses_expected, 35 QuicPacketSequenceNumber* losses_expected,
36 size_t num_losses) { 36 size_t num_losses) {
37 SequenceNumberSet lost_packets = 37 SequenceNumberSet lost_packets =
38 loss_algorithm_.DetectLostPackets( 38 loss_algorithm_.DetectLostPackets(
39 unacked_packets_, clock_.Now(), largest_observed, rtt_stats_); 39 unacked_packets_, clock_.Now(), largest_observed, rtt_stats_);
40 EXPECT_EQ(num_losses, lost_packets.size()); 40 EXPECT_EQ(num_losses, lost_packets.size());
41 for (size_t i = 0; i < num_losses; ++i) { 41 for (size_t i = 0; i < num_losses; ++i) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Early retransmit when the final packet gets acked and the first is nacked. 174 // Early retransmit when the final packet gets acked and the first is nacked.
175 unacked_packets_.IncreaseLargestObserved(2); 175 unacked_packets_.IncreaseLargestObserved(2);
176 unacked_packets_.RemoveFromInFlight(2); 176 unacked_packets_.RemoveFromInFlight(2);
177 unacked_packets_.NackPacket(1, 1); 177 unacked_packets_.NackPacket(1, 1);
178 VerifyLosses(2, nullptr, 0); 178 VerifyLosses(2, nullptr, 0);
179 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout()); 179 EXPECT_EQ(QuicTime::Zero(), loss_algorithm_.GetLossTimeout());
180 } 180 }
181 181
182 } // namespace test 182 } // namespace test
183 } // namespace net 183 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/congestion_control/time_loss_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698