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

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

Issue 411823002: Land Recent QUIC Changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase TOT Created 6 years, 4 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_stream_factory.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 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); 1385 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
1386 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 1386 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1387 .WillOnce(Return(100 * kDefaultTCPMSS)); 1387 .WillOnce(Return(100 * kDefaultTCPMSS));
1388 manager_.SetFromConfig(config); 1388 manager_.SetFromConfig(config);
1389 1389
1390 EXPECT_EQ(kTime, 1390 EXPECT_EQ(kTime,
1391 QuicSentPacketManagerPeer::GetLossAlgorithm( 1391 QuicSentPacketManagerPeer::GetLossAlgorithm(
1392 &manager_)->GetLossDetectionType()); 1392 &manager_)->GetLossDetectionType());
1393 } 1393 }
1394 1394
1395 TEST_F(QuicSentPacketManagerTest, NegotiateCongestionControlFromOptions) {
1396 QuicConfig config;
1397 QuicTagVector options;
1398
1399 options.push_back(kRENO);
1400 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1401 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
1402 manager_.SetFromConfig(config);
1403 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm(
1404 manager_)->GetCongestionControlType());
1405
1406 // TODO(rtenneti): Enable the following code after BBR code is checked in.
1407 #if 0
1408 options.clear();
1409 options.push_back(kTBBR);
1410 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1411 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
1412 manager_.SetFromConfig(config);
1413 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetCongestionControlAlgorithm(
1414 manager_)->GetCongestionControlType());
1415 #endif
1416 }
1417
1395 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) { 1418 TEST_F(QuicSentPacketManagerTest, NegotiatePacingFromOptions) {
1396 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true); 1419 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, true);
1397 EXPECT_FALSE(manager_.using_pacing()); 1420 EXPECT_FALSE(manager_.using_pacing());
1398 1421
1399 QuicConfig config; 1422 QuicConfig config;
1400 QuicTagVector options; 1423 QuicTagVector options;
1401 options.push_back(kPACE); 1424 options.push_back(kPACE);
1402 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1425 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1403 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_)); 1426 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange(_));
1404 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 1427 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
1405 .WillOnce(Return(100 * kDefaultTCPMSS)); 1428 .WillOnce(Return(100 * kDefaultTCPMSS));
1406 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1429 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1407 manager_.SetFromConfig(config); 1430 manager_.SetFromConfig(config);
1408 1431
1409 EXPECT_TRUE(manager_.using_pacing()); 1432 EXPECT_TRUE(manager_.using_pacing());
1410 } 1433 }
1411 1434
1412 } // namespace 1435 } // namespace
1413 } // namespace test 1436 } // namespace test
1414 } // namespace net 1437 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698