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

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

Issue 1277723003: Landing Recent QUIC changes until 8/4/2015 20:30 UTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dont enable FLAGS_quic_require_handshake_confirmation to fix crypto tests Created 5 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_connection.cc ('k') | net/quic/quic_flags.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 "net/quic/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 manager_(QuicConnectionPeer::GetSentPacketManager(&connection_)), 670 manager_(QuicConnectionPeer::GetSentPacketManager(&connection_)),
671 frame1_(1, false, 0, StringPiece(data1)), 671 frame1_(1, false, 0, StringPiece(data1)),
672 frame2_(1, false, 3, StringPiece(data2)), 672 frame2_(1, false, 3, StringPiece(data2)),
673 sequence_number_length_(PACKET_6BYTE_SEQUENCE_NUMBER), 673 sequence_number_length_(PACKET_6BYTE_SEQUENCE_NUMBER),
674 connection_id_length_(PACKET_8BYTE_CONNECTION_ID) { 674 connection_id_length_(PACKET_8BYTE_CONNECTION_ID) {
675 connection_.set_visitor(&visitor_); 675 connection_.set_visitor(&visitor_);
676 connection_.SetSendAlgorithm(send_algorithm_); 676 connection_.SetSendAlgorithm(send_algorithm_);
677 connection_.SetLossAlgorithm(loss_algorithm_); 677 connection_.SetLossAlgorithm(loss_algorithm_);
678 framer_.set_received_entropy_calculator(&entropy_calculator_); 678 framer_.set_received_entropy_calculator(&entropy_calculator_);
679 generator_->set_fec_send_policy(GetParam().fec_send_policy); 679 generator_->set_fec_send_policy(GetParam().fec_send_policy);
680 EXPECT_CALL( 680 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _))
681 *send_algorithm_, TimeUntilSend(_, _, _)).WillRepeatedly(Return( 681 .WillRepeatedly(Return(QuicTime::Delta::Zero()));
682 QuicTime::Delta::Zero()));
683 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) 682 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
684 .Times(AnyNumber()); 683 .Times(AnyNumber());
685 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()).WillRepeatedly( 684 EXPECT_CALL(*send_algorithm_, RetransmissionDelay())
686 Return(QuicTime::Delta::Zero())); 685 .WillRepeatedly(Return(QuicTime::Delta::Zero()));
687 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()).WillRepeatedly( 686 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
688 Return(kMaxPacketSize)); 687 .WillRepeatedly(Return(kDefaultTCPMSS));
688 EXPECT_CALL(*send_algorithm_, PacingRate())
689 .WillRepeatedly(Return(QuicBandwidth::Zero()));
689 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) 690 ON_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
690 .WillByDefault(Return(true)); 691 .WillByDefault(Return(true));
691 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate()) 692 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate())
692 .Times(AnyNumber()); 693 .Times(AnyNumber());
693 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) 694 EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
694 .Times(AnyNumber()) 695 .Times(AnyNumber())
695 .WillRepeatedly(Return(QuicBandwidth::Zero())); 696 .WillRepeatedly(Return(QuicBandwidth::Zero()));
696 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber()); 697 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber());
697 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber()); 698 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber());
698 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).Times(AnyNumber()); 699 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).Times(AnyNumber());
(...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after
3308 const QuicPacketCount probe_sequence_number = 3309 const QuicPacketCount probe_sequence_number =
3309 kPacketsBetweenMtuProbesBase + 1; 3310 kPacketsBetweenMtuProbesBase + 1;
3310 ASSERT_EQ(probe_sequence_number, creator_->sequence_number()); 3311 ASSERT_EQ(probe_sequence_number, creator_->sequence_number());
3311 3312
3312 // Acknowledge all packets sent so far. 3313 // Acknowledge all packets sent so far.
3313 QuicAckFrame probe_ack = InitAckFrame(probe_sequence_number); 3314 QuicAckFrame probe_ack = InitAckFrame(probe_sequence_number);
3314 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 3315 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
3315 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _)); 3316 EXPECT_CALL(*send_algorithm_, OnCongestionEvent(true, _, _, _));
3316 ProcessAckPacket(&probe_ack); 3317 ProcessAckPacket(&probe_ack);
3317 EXPECT_EQ(kMtuDiscoveryTargetPacketSizeHigh, connection_.max_packet_length()); 3318 EXPECT_EQ(kMtuDiscoveryTargetPacketSizeHigh, connection_.max_packet_length());
3319 EXPECT_EQ(0u, QuicSentPacketManagerPeer::GetBytesInFlight(manager_));
3318 3320
3319 // Send more packets, and ensure that none of them sets the alarm. 3321 // Send more packets, and ensure that none of them sets the alarm.
3320 for (QuicPacketCount i = 0; i < 4 * kPacketsBetweenMtuProbesBase; i++) { 3322 for (QuicPacketCount i = 0; i < 4 * kPacketsBetweenMtuProbesBase; i++) {
3321 SendStreamDataToPeer(3, ".", i, /*fin=*/false, nullptr); 3323 SendStreamDataToPeer(3, ".", i, /*fin=*/false, nullptr);
3322 ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet()); 3324 ASSERT_FALSE(connection_.GetMtuDiscoveryAlarm()->IsSet());
3323 } 3325 }
3324 3326
3325 EXPECT_EQ(1u, connection_.mtu_probe_count()); 3327 EXPECT_EQ(1u, connection_.mtu_probe_count());
3326 } 3328 }
3327 3329
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
4640 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), 4642 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()),
4641 "Attempt to send empty stream frame"); 4643 "Attempt to send empty stream frame");
4642 } 4644 }
4643 4645
4644 TEST_P(QuicConnectionTest, FecSendPolicyReceivedConnectionOption) { 4646 TEST_P(QuicConnectionTest, FecSendPolicyReceivedConnectionOption) {
4645 // Test sending SetReceivedConnectionOptions when FEC send policy is 4647 // Test sending SetReceivedConnectionOptions when FEC send policy is
4646 // FEC_ANY_TRIGGER. 4648 // FEC_ANY_TRIGGER.
4647 if (GetParam().fec_send_policy == FEC_ALARM_TRIGGER) { 4649 if (GetParam().fec_send_policy == FEC_ALARM_TRIGGER) {
4648 return; 4650 return;
4649 } 4651 }
4650 ValueRestore<bool> old_flag(&FLAGS_quic_send_fec_packet_only_on_fec_alarm,
4651 true);
4652 connection_.set_perspective(Perspective::IS_SERVER); 4652 connection_.set_perspective(Perspective::IS_SERVER);
4653 4653
4654 // Test ReceivedConnectionOptions. 4654 // Test ReceivedConnectionOptions.
4655 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)); 4655 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
4656 QuicConfig config; 4656 QuicConfig config;
4657 QuicTagVector copt; 4657 QuicTagVector copt;
4658 copt.push_back(kFSPA); 4658 copt.push_back(kFSPA);
4659 QuicConfigPeer::SetReceivedConnectionOptions(&config, copt); 4659 QuicConfigPeer::SetReceivedConnectionOptions(&config, copt);
4660 EXPECT_EQ(FEC_ANY_TRIGGER, generator_->fec_send_policy()); 4660 EXPECT_EQ(FEC_ANY_TRIGGER, generator_->fec_send_policy());
4661 connection_.SetFromConfig(config); 4661 connection_.SetFromConfig(config);
4662 EXPECT_EQ(FEC_ALARM_TRIGGER, generator_->fec_send_policy()); 4662 EXPECT_EQ(FEC_ALARM_TRIGGER, generator_->fec_send_policy());
4663 } 4663 }
4664 4664
4665 } // namespace 4665 } // namespace
4666 } // namespace test 4666 } // namespace test
4667 } // namespace net 4667 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_connection.cc ('k') | net/quic/quic_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698