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

Side by Side Diff: net/quic/congestion_control/tcp_cubic_sender_test.cc

Issue 1009543004: Create a Perspective enum to use instead of a bool is_server to improve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/crypto_utils.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "net/quic/congestion_control/rtt_stats.h" 9 #include "net/quic/congestion_control/rtt_stats.h"
10 #include "net/quic/congestion_control/tcp_cubic_sender.h" 10 #include "net/quic/congestion_control/tcp_cubic_sender.h"
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 HAS_RETRANSMITTABLE_DATA)); 494 HAS_RETRANSMITTABLE_DATA));
495 } 495 }
496 496
497 TEST_F(TcpCubicSenderTest, ConfigureMaxInitialWindow) { 497 TEST_F(TcpCubicSenderTest, ConfigureMaxInitialWindow) {
498 QuicConfig config; 498 QuicConfig config;
499 499
500 // Verify that kCOPT: kIW10 forces the congestion window to the default of 10. 500 // Verify that kCOPT: kIW10 forces the congestion window to the default of 10.
501 QuicTagVector options; 501 QuicTagVector options;
502 options.push_back(kIW10); 502 options.push_back(kIW10);
503 QuicConfigPeer::SetReceivedConnectionOptions(&config, options); 503 QuicConfigPeer::SetReceivedConnectionOptions(&config, options);
504 sender_->SetFromConfig(config, 504 sender_->SetFromConfig(config, Perspective::IS_SERVER,
505 /* is_server= */ true,
506 /* using_pacing= */ false); 505 /* using_pacing= */ false);
507 EXPECT_EQ(10u, sender_->congestion_window()); 506 EXPECT_EQ(10u, sender_->congestion_window());
508 } 507 }
509 508
510 TEST_F(TcpCubicSenderTest, DisableAckTrainDetectionWithPacing) { 509 TEST_F(TcpCubicSenderTest, DisableAckTrainDetectionWithPacing) {
511 EXPECT_TRUE(sender_->hybrid_slow_start().ack_train_detection()); 510 EXPECT_TRUE(sender_->hybrid_slow_start().ack_train_detection());
512 511
513 QuicConfig config; 512 QuicConfig config;
514 sender_->SetFromConfig(config, 513 sender_->SetFromConfig(config, Perspective::IS_SERVER,
515 /* is_server= */ true,
516 /* using_pacing= */ true); 514 /* using_pacing= */ true);
517 EXPECT_FALSE(sender_->hybrid_slow_start().ack_train_detection()); 515 EXPECT_FALSE(sender_->hybrid_slow_start().ack_train_detection());
518 } 516 }
519 517
520 TEST_F(TcpCubicSenderTest, 2ConnectionCongestionAvoidanceAtEndOfRecovery) { 518 TEST_F(TcpCubicSenderTest, 2ConnectionCongestionAvoidanceAtEndOfRecovery) {
521 sender_->SetNumEmulatedConnections(2); 519 sender_->SetNumEmulatedConnections(2);
522 // Ack 10 packets in 5 acks to raise the CWND to 20. 520 // Ack 10 packets in 5 acks to raise the CWND to 20.
523 const int kNumberOfAcks = 5; 521 const int kNumberOfAcks = 5;
524 for (int i = 0; i < kNumberOfAcks; ++i) { 522 for (int i = 0; i < kNumberOfAcks; ++i) {
525 // Send our full send window. 523 // Send our full send window.
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 652
655 cached_network_params.set_bandwidth_estimate_bytes_per_second( 653 cached_network_params.set_bandwidth_estimate_bytes_per_second(
656 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize); 654 (kMinCongestionWindowForBandwidthResumption - 1) * kMaxPacketSize);
657 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params)); 655 EXPECT_TRUE(sender_->ResumeConnectionState(cached_network_params));
658 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption, 656 EXPECT_EQ(kMinCongestionWindowForBandwidthResumption,
659 sender_->congestion_window()); 657 sender_->congestion_window());
660 } 658 }
661 659
662 } // namespace test 660 } // namespace test
663 } // namespace net 661 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | net/quic/crypto/crypto_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698