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

Side by Side Diff: net/quic/quic_sent_packet_manager_test.cc

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 for (size_t i = 0; i < num_packets; ++i) { 93 for (size_t i = 0; i < num_packets; ++i) {
94 EXPECT_TRUE(manager_.HasRetransmittableFrames(packets[i])) 94 EXPECT_TRUE(manager_.HasRetransmittableFrames(packets[i]))
95 << " packets[" << i << "]:" << packets[i]; 95 << " packets[" << i << "]:" << packets[i];
96 } 96 }
97 } 97 }
98 98
99 void ExpectAck(QuicPacketSequenceNumber largest_observed) { 99 void ExpectAck(QuicPacketSequenceNumber largest_observed) {
100 EXPECT_CALL(*send_algorithm_, OnCongestionEvent( 100 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(
101 true, _, ElementsAre(Pair(largest_observed, _)), IsEmpty())); 101 true, _, ElementsAre(Pair(largest_observed, _)), IsEmpty()));
102 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 102 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
103 EXPECT_CALL(*network_change_visitor_, OnRttChange());
103 } 104 }
104 105
105 void ExpectUpdatedRtt(QuicPacketSequenceNumber largest_observed) { 106 void ExpectUpdatedRtt(QuicPacketSequenceNumber largest_observed) {
106 EXPECT_CALL(*send_algorithm_, 107 EXPECT_CALL(*send_algorithm_,
107 OnCongestionEvent(true, _, IsEmpty(), IsEmpty())); 108 OnCongestionEvent(true, _, IsEmpty(), IsEmpty()));
108 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 109 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
110 EXPECT_CALL(*network_change_visitor_, OnRttChange());
109 } 111 }
110 112
111 void ExpectAckAndLoss(bool rtt_updated, 113 void ExpectAckAndLoss(bool rtt_updated,
112 QuicPacketSequenceNumber largest_observed, 114 QuicPacketSequenceNumber largest_observed,
113 QuicPacketSequenceNumber lost_packet) { 115 QuicPacketSequenceNumber lost_packet) {
114 EXPECT_CALL(*send_algorithm_, OnCongestionEvent( 116 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(
115 rtt_updated, _, ElementsAre(Pair(largest_observed, _)), 117 rtt_updated, _, ElementsAre(Pair(largest_observed, _)),
116 ElementsAre(Pair(lost_packet, _)))); 118 ElementsAre(Pair(lost_packet, _))));
117 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 119 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
120 EXPECT_CALL(*network_change_visitor_, OnRttChange());
118 } 121 }
119 122
120 // |packets_acked| and |packets_lost| should be in sequence number order. 123 // |packets_acked| and |packets_lost| should be in sequence number order.
121 void ExpectAcksAndLosses(bool rtt_updated, 124 void ExpectAcksAndLosses(bool rtt_updated,
122 QuicPacketSequenceNumber* packets_acked, 125 QuicPacketSequenceNumber* packets_acked,
123 size_t num_packets_acked, 126 size_t num_packets_acked,
124 QuicPacketSequenceNumber* packets_lost, 127 QuicPacketSequenceNumber* packets_lost,
125 size_t num_packets_lost) { 128 size_t num_packets_lost) {
126 vector<QuicPacketSequenceNumber> ack_vector; 129 vector<QuicPacketSequenceNumber> ack_vector;
127 for (size_t i = 0; i < num_packets_acked; ++i) { 130 for (size_t i = 0; i < num_packets_acked; ++i) {
128 ack_vector.push_back(packets_acked[i]); 131 ack_vector.push_back(packets_acked[i]);
129 } 132 }
130 vector<QuicPacketSequenceNumber> lost_vector; 133 vector<QuicPacketSequenceNumber> lost_vector;
131 for (size_t i = 0; i < num_packets_lost; ++i) { 134 for (size_t i = 0; i < num_packets_lost; ++i) {
132 lost_vector.push_back(packets_lost[i]); 135 lost_vector.push_back(packets_lost[i]);
133 } 136 }
134 EXPECT_CALL(*send_algorithm_, 137 EXPECT_CALL(*send_algorithm_,
135 OnCongestionEvent(rtt_updated, _, 138 OnCongestionEvent(rtt_updated, _,
136 Pointwise(KeyEq(), ack_vector), 139 Pointwise(KeyEq(), ack_vector),
137 Pointwise(KeyEq(), lost_vector))); 140 Pointwise(KeyEq(), lost_vector)));
138 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()). 141 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()).
139 Times(AnyNumber()); 142 Times(AnyNumber());
143 EXPECT_CALL(*network_change_visitor_, OnRttChange()).Times(AnyNumber());
140 } 144 }
141 145
142 void RetransmitAndSendPacket(QuicPacketSequenceNumber old_sequence_number, 146 void RetransmitAndSendPacket(QuicPacketSequenceNumber old_sequence_number,
143 QuicPacketSequenceNumber new_sequence_number) { 147 QuicPacketSequenceNumber new_sequence_number) {
144 QuicSentPacketManagerPeer::MarkForRetransmission( 148 QuicSentPacketManagerPeer::MarkForRetransmission(
145 &manager_, old_sequence_number, TLP_RETRANSMISSION); 149 &manager_, old_sequence_number, TLP_RETRANSMISSION);
146 EXPECT_TRUE(manager_.HasPendingRetransmissions()); 150 EXPECT_TRUE(manager_.HasPendingRetransmissions());
147 QuicSentPacketManager::PendingRetransmission next_retransmission = 151 QuicSentPacketManager::PendingRetransmission next_retransmission =
148 manager_.NextPendingRetransmission(); 152 manager_.NextPendingRetransmission();
149 EXPECT_EQ(old_sequence_number, next_retransmission.sequence_number); 153 EXPECT_EQ(old_sequence_number, next_retransmission.sequence_number);
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 EXPECT_EQ(kNack, 1274 EXPECT_EQ(kNack,
1271 QuicSentPacketManagerPeer::GetLossAlgorithm( 1275 QuicSentPacketManagerPeer::GetLossAlgorithm(
1272 &manager_)->GetLossDetectionType()); 1276 &manager_)->GetLossDetectionType());
1273 1277
1274 QuicConfig config; 1278 QuicConfig config;
1275 QuicTagVector options; 1279 QuicTagVector options;
1276 options.push_back(kTIME); 1280 options.push_back(kTIME);
1277 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1281 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1278 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1282 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1279 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1283 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1284 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1280 manager_.SetFromConfig(config); 1285 manager_.SetFromConfig(config);
1281 1286
1282 EXPECT_EQ(kTime, 1287 EXPECT_EQ(kTime,
1283 QuicSentPacketManagerPeer::GetLossAlgorithm( 1288 QuicSentPacketManagerPeer::GetLossAlgorithm(
1284 &manager_)->GetLossDetectionType()); 1289 &manager_)->GetLossDetectionType());
1285 } 1290 }
1286 1291
1287 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) { 1292 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
1288 ValueRestore<bool> old_flag(&FLAGS_quic_allow_bbr, true); 1293 ValueRestore<bool> old_flag(&FLAGS_quic_allow_bbr, true);
1289 QuicConfig config; 1294 QuicConfig config;
1290 QuicTagVector options; 1295 QuicTagVector options;
1291 1296
1292 options.push_back(kRENO); 1297 options.push_back(kRENO);
1293 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1298 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1294 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1299 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1300 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1295 manager_.SetFromConfig(config); 1301 manager_.SetFromConfig(config);
1296 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm( 1302 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(
1297 manager_)->GetCongestionControlType()); 1303 manager_)->GetCongestionControlType());
1298 1304
1299 // TODO(rtenneti): Enable the following code after BBR code is checked in. 1305 // TODO(rtenneti): Enable the following code after BBR code is checked in.
1300 #if 0 1306 #if 0
1301 options.clear(); 1307 options.clear();
1302 options.push_back(kTBBR); 1308 options.push_back(kTBBR);
1303 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1309 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1304 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1310 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1311 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1305 manager_.SetFromConfig(config); 1312 manager_.SetFromConfig(config);
1306 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetSendAlgorithm( 1313 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetSendAlgorithm(
1307 manager_)->GetCongestionControlType()); 1314 manager_)->GetCongestionControlType());
1308 #endif 1315 #endif
1309 } 1316 }
1310 1317
1311 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) { 1318 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) {
1312 QuicConfig config; 1319 QuicConfig config;
1313 QuicTagVector options; 1320 QuicTagVector options;
1314 1321
1315 options.push_back(k1CON); 1322 options.push_back(k1CON);
1316 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1323 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1317 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1324 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1325 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1318 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); 1326 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1));
1319 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1327 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1320 manager_.SetFromConfig(config); 1328 manager_.SetFromConfig(config);
1321 1329
1322 QuicSentPacketManagerPeer::SetIsServer(&manager_, false); 1330 QuicSentPacketManagerPeer::SetIsServer(&manager_, false);
1323 QuicConfig client_config; 1331 QuicConfig client_config;
1324 client_config.SetConnectionOptionsToSend(options); 1332 client_config.SetConnectionOptionsToSend(options);
1325 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1333 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1334 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1326 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); 1335 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1));
1327 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1336 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1328 manager_.SetFromConfig(client_config); 1337 manager_.SetFromConfig(client_config);
1329 } 1338 }
1330 1339
1331 TEST_F(QuicSentPacketManagerTest, NegotiateNConnectionFromOptions) { 1340 TEST_F(QuicSentPacketManagerTest, NegotiateNConnectionFromOptions) {
1332 // By default, changing the number of open streams does nothing. 1341 // By default, changing the number of open streams does nothing.
1333 manager_.SetNumOpenStreams(5); 1342 manager_.SetNumOpenStreams(5);
1334 1343
1335 QuicConfig config; 1344 QuicConfig config;
1336 QuicTagVector options; 1345 QuicTagVector options;
1337 1346
1338 options.push_back(kNCON); 1347 options.push_back(kNCON);
1339 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1348 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1340 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1349 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1350 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1341 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1351 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1342 manager_.SetFromConfig(config); 1352 manager_.SetFromConfig(config);
1343 1353
1344 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(5)); 1354 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(5));
1345 manager_.SetNumOpenStreams(5); 1355 manager_.SetNumOpenStreams(5);
1346 } 1356 }
1347 1357
1348 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) { 1358 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtServer) {
1349 QuicConfig config; 1359 QuicConfig config;
1350 QuicTagVector options; 1360 QuicTagVector options;
1351 1361
1352 options.push_back(kNTLP); 1362 options.push_back(kNTLP);
1353 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1363 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1354 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1364 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1365 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1355 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1366 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1356 manager_.SetFromConfig(config); 1367 manager_.SetFromConfig(config);
1357 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); 1368 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
1358 } 1369 }
1359 1370
1360 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) { 1371 TEST_F(QuicSentPacketManagerTest, NegotiateNoTLPFromOptionsAtClient) {
1361 QuicConfig client_config; 1372 QuicConfig client_config;
1362 QuicTagVector options; 1373 QuicTagVector options;
1363 1374
1364 options.push_back(kNTLP); 1375 options.push_back(kNTLP);
1365 QuicSentPacketManagerPeer::SetIsServer(&manager_, false); 1376 QuicSentPacketManagerPeer::SetIsServer(&manager_, false);
1366 client_config.SetConnectionOptionsToSend(options); 1377 client_config.SetConnectionOptionsToSend(options);
1367 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1378 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1379 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1368 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1380 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1369 manager_.SetFromConfig(client_config); 1381 manager_.SetFromConfig(client_config);
1370 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_)); 1382 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetMaxTailLossProbes(&manager_));
1371 } 1383 }
1372 1384
1373 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { 1385 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) {
1374 EXPECT_FALSE(manager_.using_pacing()); 1386 EXPECT_FALSE(manager_.using_pacing());
1375 1387
1376 QuicConfig config; 1388 QuicConfig config;
1377 QuicTagVector options; 1389 QuicTagVector options;
1378 options.push_back(kPACE); 1390 options.push_back(kPACE);
1379 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1391 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1380 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1392 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1381 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /* using_pacing= */ true)); 1393 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1394 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true));
1382 manager_.SetFromConfig(config); 1395 manager_.SetFromConfig(config);
1383 1396
1384 EXPECT_TRUE(manager_.using_pacing()); 1397 EXPECT_TRUE(manager_.using_pacing());
1385 } 1398 }
1386 1399
1387 TEST_F(QuicSentPacketManagerTest, EnablePacingViaFlag) { 1400 TEST_F(QuicSentPacketManagerTest, EnablePacingViaFlag) {
1388 EXPECT_FALSE(manager_.using_pacing()); 1401 EXPECT_FALSE(manager_.using_pacing());
1389 1402
1390 // If pacing is enabled via command-line flag, it will be turned on, 1403 // If pacing is enabled via command-line flag, it will be turned on,
1391 // regardless of the contents of the config. 1404 // regardless of the contents of the config.
1392 ValueRestore<bool> old_flag(&FLAGS_quic_enable_pacing, true); 1405 ValueRestore<bool> old_flag(&FLAGS_quic_enable_pacing, true);
1393 QuicConfig config; 1406 QuicConfig config;
1394 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1407 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1395 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /* using_pacing= */ true)); 1408 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1409 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true));
1396 manager_.SetFromConfig(config); 1410 manager_.SetFromConfig(config);
1397 1411
1398 EXPECT_TRUE(manager_.using_pacing()); 1412 EXPECT_TRUE(manager_.using_pacing());
1399 } 1413 }
1400 1414
1401 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { 1415 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) {
1402 EXPECT_EQ(kDefaultSocketReceiveBuffer, 1416 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1403 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1417 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1404 1418
1405 // Try to set a size below the minimum and ensure it gets set to the min. 1419 // Try to set a size below the minimum and ensure it gets set to the min.
1406 QuicConfig client_config; 1420 QuicConfig client_config;
1407 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); 1421 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1408 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1422 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1409 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1423 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1424 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1410 manager_.SetFromConfig(client_config); 1425 manager_.SetFromConfig(client_config);
1411 1426
1412 EXPECT_EQ(kMinSocketReceiveBuffer, 1427 EXPECT_EQ(kMinSocketReceiveBuffer,
1413 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1428 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1414 1429
1415 // Ensure the smaller send window only allows 16 packets to be sent. 1430 // Ensure the smaller send window only allows 16 packets to be sent.
1416 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) { 1431 for (QuicPacketSequenceNumber i = 1; i <= 16; ++i) {
1417 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return( 1432 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillOnce(Return(
1418 QuicTime::Delta::Zero())); 1433 QuicTime::Delta::Zero()));
1419 EXPECT_EQ(QuicTime::Delta::Zero(), 1434 EXPECT_EQ(QuicTime::Delta::Zero(),
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1452 1467
1453 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) { 1468 TEST_F(QuicSentPacketManagerTest, UseInitialRoundTripTimeToSend) {
1454 uint32 initial_rtt_us = 325000; 1469 uint32 initial_rtt_us = 325000;
1455 EXPECT_NE(initial_rtt_us, 1470 EXPECT_NE(initial_rtt_us,
1456 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1471 manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1457 1472
1458 QuicConfig config; 1473 QuicConfig config;
1459 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us); 1474 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us);
1460 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1475 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1461 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1476 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1477 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1462 manager_.SetFromConfig(config); 1478 manager_.SetFromConfig(config);
1463 1479
1464 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); 1480 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds());
1465 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); 1481 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us());
1466 } 1482 }
1467 1483
1468 TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) { 1484 TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) {
1469 // The sent packet manager should use the RTT from CachedNetworkParameters if 1485 // The sent packet manager should use the RTT from CachedNetworkParameters if
1470 // it is provided. 1486 // it is provided.
1471 const int kRttMs = 1234; 1487 const int kRttMs = 1234;
1472 CachedNetworkParameters cached_network_params; 1488 CachedNetworkParameters cached_network_params;
1473 cached_network_params.set_min_rtt_ms(kRttMs); 1489 cached_network_params.set_min_rtt_ms(kRttMs);
1474 1490
1475 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); 1491 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_));
1476 manager_.ResumeConnectionState(cached_network_params); 1492 manager_.ResumeConnectionState(cached_network_params);
1477 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1493 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1478 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); 1494 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us()));
1479 } 1495 }
1480 1496
1481 } // namespace 1497 } // namespace
1482 } // namespace test 1498 } // namespace test
1483 } // namespace net 1499 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698