OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic_sent_packet_manager.h" | 5 #include "net/quic/core/quic_sent_packet_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "net/quic/core/quic_flags.h" | 10 #include "net/quic/core/quic_flags.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 explicit TestParams(bool missing) : missing(missing) {} | 61 explicit TestParams(bool missing) : missing(missing) {} |
62 | 62 |
63 friend std::ostream& operator<<(std::ostream& os, const TestParams& p) { | 63 friend std::ostream& operator<<(std::ostream& os, const TestParams& p) { |
64 os << "{ ack frame packets set mode: " << p.missing << " }"; | 64 os << "{ ack frame packets set mode: " << p.missing << " }"; |
65 return os; | 65 return os; |
66 } | 66 } |
67 | 67 |
68 bool missing; | 68 bool missing; |
69 }; | 69 }; |
70 | 70 |
71 vector<TestParams> GetTestParams() { | 71 std::vector<TestParams> GetTestParams() { |
72 vector<TestParams> params; | 72 std::vector<TestParams> params; |
73 for (bool missing : {true, false}) { | 73 for (bool missing : {true, false}) { |
74 params.push_back(TestParams(missing)); | 74 params.push_back(TestParams(missing)); |
75 } | 75 } |
76 return params; | 76 return params; |
77 } | 77 } |
78 | 78 |
79 class QuicSentPacketManagerTest : public ::testing::TestWithParam<TestParams> { | 79 class QuicSentPacketManagerTest : public ::testing::TestWithParam<TestParams> { |
80 protected: | 80 protected: |
81 QuicSentPacketManagerTest() | 81 QuicSentPacketManagerTest() |
82 : manager_(Perspective::IS_SERVER, | 82 : manager_(Perspective::IS_SERVER, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 ElementsAre(Pair(lost_packet, _)))); | 162 ElementsAre(Pair(lost_packet, _)))); |
163 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); | 163 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); |
164 } | 164 } |
165 | 165 |
166 // |packets_acked| and |packets_lost| should be in packet number order. | 166 // |packets_acked| and |packets_lost| should be in packet number order. |
167 void ExpectAcksAndLosses(bool rtt_updated, | 167 void ExpectAcksAndLosses(bool rtt_updated, |
168 QuicPacketNumber* packets_acked, | 168 QuicPacketNumber* packets_acked, |
169 size_t num_packets_acked, | 169 size_t num_packets_acked, |
170 QuicPacketNumber* packets_lost, | 170 QuicPacketNumber* packets_lost, |
171 size_t num_packets_lost) { | 171 size_t num_packets_lost) { |
172 vector<QuicPacketNumber> ack_vector; | 172 std::vector<QuicPacketNumber> ack_vector; |
173 for (size_t i = 0; i < num_packets_acked; ++i) { | 173 for (size_t i = 0; i < num_packets_acked; ++i) { |
174 ack_vector.push_back(packets_acked[i]); | 174 ack_vector.push_back(packets_acked[i]); |
175 } | 175 } |
176 vector<QuicPacketNumber> lost_vector; | 176 std::vector<QuicPacketNumber> lost_vector; |
177 for (size_t i = 0; i < num_packets_lost; ++i) { | 177 for (size_t i = 0; i < num_packets_lost; ++i) { |
178 lost_vector.push_back(packets_lost[i]); | 178 lost_vector.push_back(packets_lost[i]); |
179 } | 179 } |
180 EXPECT_CALL( | 180 EXPECT_CALL( |
181 *send_algorithm_, | 181 *send_algorithm_, |
182 OnCongestionEvent(rtt_updated, _, _, Pointwise(KeyEq(), ack_vector), | 182 OnCongestionEvent(rtt_updated, _, _, Pointwise(KeyEq(), ack_vector), |
183 Pointwise(KeyEq(), lost_vector))); | 183 Pointwise(KeyEq(), lost_vector))); |
184 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()) | 184 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()) |
185 .Times(AnyNumber()); | 185 .Times(AnyNumber()); |
186 } | 186 } |
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 ExpectAck(1); | 1738 ExpectAck(1); |
1739 EXPECT_CALL(*network_change_visitor_, | 1739 EXPECT_CALL(*network_change_visitor_, |
1740 OnPathMtuIncreased(kDefaultLength + 100)); | 1740 OnPathMtuIncreased(kDefaultLength + 100)); |
1741 QuicAckFrame ack_frame = InitAckFrame(1); | 1741 QuicAckFrame ack_frame = InitAckFrame(1); |
1742 manager_.OnIncomingAck(ack_frame, clock_.Now()); | 1742 manager_.OnIncomingAck(ack_frame, clock_.Now()); |
1743 } | 1743 } |
1744 | 1744 |
1745 } // namespace | 1745 } // namespace |
1746 } // namespace test | 1746 } // namespace test |
1747 } // namespace net | 1747 } // namespace net |
OLD | NEW |