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

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

Issue 2537543005: Add QUIC client connection options. Only respected on the client side. No functional change. Prot… (Closed)
Patch Set: Rebase Created 4 years 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/core/quic_sent_packet_manager.cc ('k') | no next file » | 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/core/quic_sent_packet_manager.h" 5 #include "net/quic/core/quic_sent_packet_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "net/quic/core/quic_flags.h" 10 #include "net/quic/core/quic_flags.h"
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 options.clear(); 1423 options.clear();
1424 options.push_back(kRENO); 1424 options.push_back(kRENO);
1425 options.push_back(kBYTE); 1425 options.push_back(kBYTE);
1426 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1426 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1427 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1427 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1428 manager_.SetFromConfig(config); 1428 manager_.SetFromConfig(config);
1429 EXPECT_EQ(kRenoBytes, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_) 1429 EXPECT_EQ(kRenoBytes, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1430 ->GetCongestionControlType()); 1430 ->GetCongestionControlType());
1431 } 1431 }
1432 1432
1433 TEST_F(QuicSentPacketManagerTest, NegotiateClientCongestionControlFromOptions) {
1434 FLAGS_quic_allow_new_bbr = true;
1435 FLAGS_quic_client_connection_options = true;
1436 QuicConfig config;
1437 QuicTagVector options;
1438
1439 // No change if the server receives client options.
1440 const SendAlgorithmInterface* mock_sender =
1441 QuicSentPacketManagerPeer::GetSendAlgorithm(manager_);
1442 options.push_back(kRENO);
1443 config.SetClientConnectionOptions(options);
1444 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1445 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1446 manager_.SetFromConfig(config);
1447 EXPECT_EQ(mock_sender, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_));
1448
1449 // Change the congestion control on the client with client options.
1450 QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
1451 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1452 manager_.SetFromConfig(config);
1453 EXPECT_EQ(kReno, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1454 ->GetCongestionControlType());
1455
1456 options.clear();
1457 options.push_back(kTBBR);
1458 config.SetClientConnectionOptions(options);
1459 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1460 manager_.SetFromConfig(config);
1461 EXPECT_EQ(kBBR, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1462 ->GetCongestionControlType());
1463
1464 options.clear();
1465 options.push_back(kBYTE);
1466 config.SetClientConnectionOptions(options);
1467 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1468 manager_.SetFromConfig(config);
1469 if (FLAGS_quic_default_enable_cubic_bytes) {
1470 EXPECT_EQ(kCubic, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1471 ->GetCongestionControlType());
1472 } else {
1473 EXPECT_EQ(kCubicBytes, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1474 ->GetCongestionControlType());
1475 }
1476
1477 options.clear();
1478 options.push_back(kRENO);
1479 options.push_back(kBYTE);
1480 config.SetClientConnectionOptions(options);
1481 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1482 manager_.SetFromConfig(config);
1483 EXPECT_EQ(kRenoBytes, QuicSentPacketManagerPeer::GetSendAlgorithm(manager_)
1484 ->GetCongestionControlType());
1485 }
1486
1433 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) { 1487 TEST_F(QuicSentPacketManagerTest, NegotiateNumConnectionsFromOptions) {
1434 QuicConfig config; 1488 QuicConfig config;
1435 QuicTagVector options; 1489 QuicTagVector options;
1436 1490
1437 options.push_back(k1CON); 1491 options.push_back(k1CON);
1438 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1492 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1439 EXPECT_CALL(*network_change_visitor_, OnCongestionChange()); 1493 EXPECT_CALL(*network_change_visitor_, OnCongestionChange());
1440 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1)); 1494 EXPECT_CALL(*send_algorithm_, SetNumEmulatedConnections(1));
1441 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 1495 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
1442 manager_.SetFromConfig(config); 1496 manager_.SetFromConfig(config);
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 ExpectAck(1); 1761 ExpectAck(1);
1708 EXPECT_CALL(*network_change_visitor_, 1762 EXPECT_CALL(*network_change_visitor_,
1709 OnPathMtuIncreased(kDefaultLength + 100)); 1763 OnPathMtuIncreased(kDefaultLength + 100));
1710 QuicAckFrame ack_frame = InitAckFrame(1); 1764 QuicAckFrame ack_frame = InitAckFrame(1);
1711 manager_.OnIncomingAck(ack_frame, clock_.Now()); 1765 manager_.OnIncomingAck(ack_frame, clock_.Now());
1712 } 1766 }
1713 1767
1714 } // namespace 1768 } // namespace
1715 } // namespace test 1769 } // namespace test
1716 } // namespace net 1770 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_sent_packet_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698