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 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 QuicConfig config; | 1458 QuicConfig config; |
1459 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us); | 1459 config.SetInitialRoundTripTimeUsToSend(initial_rtt_us); |
1460 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); | 1460 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); |
1461 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); | 1461 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); |
1462 manager_.SetFromConfig(config); | 1462 manager_.SetFromConfig(config); |
1463 | 1463 |
1464 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); | 1464 EXPECT_EQ(0, manager_.GetRttStats()->smoothed_rtt().ToMicroseconds()); |
1465 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); | 1465 EXPECT_EQ(initial_rtt_us, manager_.GetRttStats()->initial_rtt_us()); |
1466 } | 1466 } |
1467 | 1467 |
| 1468 TEST_F(QuicSentPacketManagerTest, ResumeConnectionState) { |
| 1469 // The sent packet manager should use the RTT from CachedNetworkParameters if |
| 1470 // it is provided. |
| 1471 const int kRttMs = 1234; |
| 1472 CachedNetworkParameters cached_network_params; |
| 1473 cached_network_params.set_min_rtt_ms(kRttMs); |
| 1474 |
| 1475 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); |
| 1476 manager_.ResumeConnectionState(cached_network_params); |
| 1477 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, |
| 1478 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); |
| 1479 } |
| 1480 |
1468 } // namespace | 1481 } // namespace |
1469 } // namespace test | 1482 } // namespace test |
1470 } // namespace net | 1483 } // namespace net |
OLD | NEW |