| 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/test_tools/quic_config_peer.h" | 9 #include "net/quic/test_tools/quic_config_peer.h" |
| 9 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" | 10 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" |
| 10 #include "net/quic/test_tools/quic_test_utils.h" | 11 #include "net/quic/test_tools/quic_test_utils.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 using std::vector; | 15 using std::vector; |
| 15 using testing::ElementsAre; | 16 using testing::ElementsAre; |
| 16 using testing::Pair; | 17 using testing::Pair; |
| 17 using testing::Pointwise; | 18 using testing::Pointwise; |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 QuicConfig config; | 1315 QuicConfig config; |
| 1315 QuicConfigPeer::SetReceivedLossDetection(&config, kTIME); | 1316 QuicConfigPeer::SetReceivedLossDetection(&config, kTIME); |
| 1316 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); | 1317 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1317 manager_.SetFromConfig(config); | 1318 manager_.SetFromConfig(config); |
| 1318 | 1319 |
| 1319 EXPECT_EQ(kTime, | 1320 EXPECT_EQ(kTime, |
| 1320 QuicSentPacketManagerPeer::GetLossAlgorithm( | 1321 QuicSentPacketManagerPeer::GetLossAlgorithm( |
| 1321 &manager_)->GetLossDetectionType()); | 1322 &manager_)->GetLossDetectionType()); |
| 1322 } | 1323 } |
| 1323 | 1324 |
| 1325 TEST_F(QuicSentPacketManagerTest, NegotiateTimeLossDetectionFromOptions) { |
| 1326 EXPECT_EQ(kNack, |
| 1327 QuicSentPacketManagerPeer::GetLossAlgorithm( |
| 1328 &manager_)->GetLossDetectionType()); |
| 1329 |
| 1330 QuicConfig config; |
| 1331 QuicTagVector options; |
| 1332 options.push_back(kTIME); |
| 1333 QuicConfigPeer::SetReceivedCongestionOptions(&config, options); |
| 1334 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1335 manager_.SetFromConfig(config); |
| 1336 |
| 1337 EXPECT_EQ(kTime, |
| 1338 QuicSentPacketManagerPeer::GetLossAlgorithm( |
| 1339 &manager_)->GetLossDetectionType()); |
| 1340 } |
| 1341 |
| 1342 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { |
| 1343 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true); |
| 1344 EXPECT_FALSE(manager_.using_pacing()); |
| 1345 |
| 1346 QuicConfig config; |
| 1347 QuicTagVector options; |
| 1348 options.push_back(kPACE); |
| 1349 QuicConfigPeer::SetReceivedCongestionOptions(&config, options); |
| 1350 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); |
| 1351 manager_.SetFromConfig(config); |
| 1352 |
| 1353 EXPECT_TRUE(manager_.using_pacing()); |
| 1354 } |
| 1324 | 1355 |
| 1325 } // namespace | 1356 } // namespace |
| 1326 } // namespace test | 1357 } // namespace test |
| 1327 } // namespace net | 1358 } // namespace net |
| OLD | NEW |