| 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/quic_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/quic_flags.h" | 8 #include "net/quic/quic_flags.h" |
| 9 #include "net/quic/test_tools/quic_config_peer.h" | 9 #include "net/quic/test_tools/quic_config_peer.h" |
| 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| (...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 .WillRepeatedly(Return(timeout)); | 1279 .WillRepeatedly(Return(timeout)); |
| 1280 EXPECT_EQ(timeout, manager_.GetRetransmissionTime()); | 1280 EXPECT_EQ(timeout, manager_.GetRetransmissionTime()); |
| 1281 | 1281 |
| 1282 // Fire the retransmission timeout and ensure the loss detection algorithm | 1282 // Fire the retransmission timeout and ensure the loss detection algorithm |
| 1283 // is invoked. | 1283 // is invoked. |
| 1284 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _)) | 1284 EXPECT_CALL(*loss_algorithm, DetectLostPackets(_, _, _, _)) |
| 1285 .WillOnce(Return(SequenceNumberSet())); | 1285 .WillOnce(Return(SequenceNumberSet())); |
| 1286 manager_.OnRetransmissionTimeout(); | 1286 manager_.OnRetransmissionTimeout(); |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetection) { | |
| 1290 EXPECT_EQ(kNack, | |
| 1291 QuicSentPacketManagerPeer::GetLossAlgorithm( | |
| 1292 &manager_)->GetLossDetectionType()); | |
| 1293 | |
| 1294 QuicConfig config; | |
| 1295 QuicConfigPeer::SetReceivedLossDetection(&config, kTIME); | |
| 1296 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | |
| 1297 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); | |
| 1298 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) | |
| 1299 .WillOnce(Return(100 * kDefaultTCPMSS)); | |
| 1300 manager_.SetFromConfig(config); | |
| 1301 | |
| 1302 EXPECT_EQ(kTime, | |
| 1303 QuicSentPacketManagerPeer::GetLossAlgorithm( | |
| 1304 &manager_)->GetLossDetectionType()); | |
| 1305 } | |
| 1306 | |
| 1307 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) { | 1289 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) { |
| 1308 EXPECT_EQ(kNack, | 1290 EXPECT_EQ(kNack, |
| 1309 QuicSentPacketManagerPeer::GetLossAlgorithm( | 1291 QuicSentPacketManagerPeer::GetLossAlgorithm( |
| 1310 &manager_)->GetLossDetectionType()); | 1292 &manager_)->GetLossDetectionType()); |
| 1311 | 1293 |
| 1312 QuicConfig config; | 1294 QuicConfig config; |
| 1313 QuicTagVector options; | 1295 QuicTagVector options; |
| 1314 options.push_back(kTIME); | 1296 options.push_back(kTIME); |
| 1315 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); | 1297 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); |
| 1316 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1298 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 .WillOnce(Return(100 * kDefaultTCPMSS)); | 1358 .WillOnce(Return(100 * kDefaultTCPMSS)); |
| 1377 manager_.SetFromConfig(config); | 1359 manager_.SetFromConfig(config); |
| 1378 | 1360 |
| 1379 EXPECT_EQ(initial_rtt_us, | 1361 EXPECT_EQ(initial_rtt_us, |
| 1380 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); | 1362 manager_.GetRttStats()->SmoothedRtt().ToMicroseconds()); |
| 1381 } | 1363 } |
| 1382 | 1364 |
| 1383 } // namespace | 1365 } // namespace |
| 1384 } // namespace test | 1366 } // namespace test |
| 1385 } // namespace net | 1367 } // namespace net |
| OLD | NEW |