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

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

Issue 1014433002: Land Recent QUIC Changes until 03/09/2015. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replaces_Perspective_enun_88006458
Patch Set: Rebase - added NET_EXPORT_PRIVATE to fix compiler error Created 5 years, 9 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_session.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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
1578 options.push_back(kPACE); 1578 options.push_back(kPACE);
1579 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 1579 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
1580 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange()); 1580 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1581 EXPECT_CALL(*network_change_visitor_, OnRttChange()); 1581 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1582 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true)); 1582 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true));
1583 manager_.SetFromConfig(config); 1583 manager_.SetFromConfig(config);
1584 1584
1585 EXPECT_TRUE(manager_.using_pacing()); 1585 EXPECT_TRUE(manager_.using_pacing());
1586 } 1586 }
1587 1587
1588 TEST_F(QuicSentPacketManagerTest, EnablePacingViaFlag) {
1589 EXPECT_FALSE(manager_.using_pacing());
1590
1591 // If pacing is enabled via command-line flag, it will be turned on,
1592 // regardless of the contents of the config.
1593 ValueRestore<bool> old_flag(&FLAGS_quic_enable_pacing, true);
1594 QuicConfig config;
1595 EXPECT_CALL(*network_change_visitor_, OnCongestionWindowChange());
1596 EXPECT_CALL(*network_change_visitor_, OnRttChange());
1597 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, /*using_pacing=*/true));
1598 manager_.SetFromConfig(config);
1599
1600 EXPECT_TRUE(manager_.using_pacing());
1601 }
1602
1603 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) { 1588 TEST_F(QuicSentPacketManagerTest, NegotiateReceiveWindowFromOptions) {
1604 EXPECT_EQ(kDefaultSocketReceiveBuffer, 1589 EXPECT_EQ(kDefaultSocketReceiveBuffer,
1605 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_)); 1590 QuicSentPacketManagerPeer::GetReceiveWindow(&manager_));
1606 1591
1607 // Try to set a size below the minimum and ensure it gets set to the min. 1592 // Try to set a size below the minimum and ensure it gets set to the min.
1608 QuicConfig client_config; 1593 QuicConfig client_config;
1609 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024); 1594 QuicConfigPeer::SetReceivedSocketReceiveBuffer(&client_config, 1024);
1610 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)); 1595 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _));
1611 EXPECT_CALL(*send_algorithm_, PacingRate()) 1596 EXPECT_CALL(*send_algorithm_, PacingRate())
1612 .WillRepeatedly(Return(QuicBandwidth::Zero())); 1597 .WillRepeatedly(Return(QuicBandwidth::Zero()));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1680 1665
1681 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_)); 1666 EXPECT_CALL(*send_algorithm_, ResumeConnectionState(_));
1682 manager_.ResumeConnectionState(cached_network_params); 1667 manager_.ResumeConnectionState(cached_network_params);
1683 EXPECT_EQ(kRttMs * kNumMicrosPerMilli, 1668 EXPECT_EQ(kRttMs * kNumMicrosPerMilli,
1684 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us())); 1669 static_cast<uint64>(manager_.GetRttStats()->initial_rtt_us()));
1685 } 1670 }
1686 1671
1687 } // namespace 1672 } // namespace
1688 } // namespace test 1673 } // namespace test
1689 } // namespace net 1674 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.cc ('k') | net/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698