| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4658 copt.push_back(kFSPA); | 4660 copt.push_back(kFSPA); |
| 4659 QuicConfigPeer::SetReceivedConnectionOptions(&config, copt); | 4661 QuicConfigPeer::SetReceivedConnectionOptions(&config, copt); |
| 4660 EXPECT_EQ(FEC_ANY_TRIGGER, generator_->fec_send_policy()); | 4662 EXPECT_EQ(FEC_ANY_TRIGGER, generator_->fec_send_policy()); |
| 4661 connection_.SetFromConfig(config); | 4663 connection_.SetFromConfig(config); |
| 4662 EXPECT_EQ(FEC_ALARM_TRIGGER, generator_->fec_send_policy()); | 4664 EXPECT_EQ(FEC_ALARM_TRIGGER, generator_->fec_send_policy()); |
| 4663 } | 4665 } |
| 4664 | 4666 |
| 4665 } // namespace | 4667 } // namespace |
| 4666 } // namespace test | 4668 } // namespace test |
| 4667 } // namespace net | 4669 } // namespace net |
| OLD | NEW |