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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 use_tagging_decrypter_(false), | 259 use_tagging_decrypter_(false), |
260 packets_write_attempts_(0), | 260 packets_write_attempts_(0), |
261 clock_(clock), | 261 clock_(clock), |
262 write_pause_time_delta_(QuicTime::Delta::Zero()), | 262 write_pause_time_delta_(QuicTime::Delta::Zero()), |
263 max_packet_size_(kMaxPacketSize) {} | 263 max_packet_size_(kMaxPacketSize) {} |
264 | 264 |
265 // QuicPacketWriter interface | 265 // QuicPacketWriter interface |
266 WriteResult WritePacket(const char* buffer, | 266 WriteResult WritePacket(const char* buffer, |
267 size_t buf_len, | 267 size_t buf_len, |
268 const IPAddressNumber& self_address, | 268 const IPAddressNumber& self_address, |
269 const IPEndPoint& peer_address) override { | 269 const IPEndPoint& peer_address, |
| 270 PerPacketOptions* options) override { |
270 QuicEncryptedPacket packet(buffer, buf_len); | 271 QuicEncryptedPacket packet(buffer, buf_len); |
271 ++packets_write_attempts_; | 272 ++packets_write_attempts_; |
272 | 273 |
273 if (packet.length() >= sizeof(final_bytes_of_last_packet_)) { | 274 if (packet.length() >= sizeof(final_bytes_of_last_packet_)) { |
274 final_bytes_of_previous_packet_ = final_bytes_of_last_packet_; | 275 final_bytes_of_previous_packet_ = final_bytes_of_last_packet_; |
275 memcpy(&final_bytes_of_last_packet_, packet.data() + packet.length() - 4, | 276 memcpy(&final_bytes_of_last_packet_, packet.data() + packet.length() - 4, |
276 sizeof(final_bytes_of_last_packet_)); | 277 sizeof(final_bytes_of_last_packet_)); |
277 } | 278 } |
278 | 279 |
279 if (use_tagging_decrypter_) { | 280 if (use_tagging_decrypter_) { |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate()) | 715 EXPECT_CALL(*send_algorithm_, HasReliableBandwidthEstimate()) |
715 .Times(AnyNumber()); | 716 .Times(AnyNumber()); |
716 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) | 717 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) |
717 .Times(AnyNumber()) | 718 .Times(AnyNumber()) |
718 .WillRepeatedly(Return(QuicBandwidth::Zero())); | 719 .WillRepeatedly(Return(QuicBandwidth::Zero())); |
719 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber()); | 720 EXPECT_CALL(*send_algorithm_, InSlowStart()).Times(AnyNumber()); |
720 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber()); | 721 EXPECT_CALL(*send_algorithm_, InRecovery()).Times(AnyNumber()); |
721 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).Times(AnyNumber()); | 722 EXPECT_CALL(visitor_, WillingAndAbleToWrite()).Times(AnyNumber()); |
722 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber()); | 723 EXPECT_CALL(visitor_, HasPendingHandshake()).Times(AnyNumber()); |
723 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber()); | 724 EXPECT_CALL(visitor_, OnCanWrite()).Times(AnyNumber()); |
| 725 EXPECT_CALL(visitor_, PostProcessAfterData()).Times(AnyNumber()); |
724 EXPECT_CALL(visitor_, HasOpenDynamicStreams()) | 726 EXPECT_CALL(visitor_, HasOpenDynamicStreams()) |
725 .WillRepeatedly(Return(false)); | 727 .WillRepeatedly(Return(false)); |
726 EXPECT_CALL(visitor_, OnCongestionWindowChange(_)).Times(AnyNumber()); | 728 EXPECT_CALL(visitor_, OnCongestionWindowChange(_)).Times(AnyNumber()); |
727 | 729 |
728 EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) | 730 EXPECT_CALL(*loss_algorithm_, GetLossTimeout()) |
729 .WillRepeatedly(Return(QuicTime::Zero())); | 731 .WillRepeatedly(Return(QuicTime::Zero())); |
730 if (FLAGS_quic_general_loss_algorithm) { | 732 if (FLAGS_quic_general_loss_algorithm) { |
731 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) | 733 EXPECT_CALL(*loss_algorithm_, DetectLosses(_, _, _, _)) |
732 .Times(AnyNumber()); | 734 .Times(AnyNumber()); |
733 } else { | 735 } else { |
(...skipping 4948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5682 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); | 5684 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); |
5683 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), | 5685 EXPECT_DFATAL(ProcessFramePacket(QuicFrame(&stream_frame)), |
5684 "Received a packet with multipath flag on when multipath is " | 5686 "Received a packet with multipath flag on when multipath is " |
5685 "not enabled."); | 5687 "not enabled."); |
5686 EXPECT_FALSE(connection_.connected()); | 5688 EXPECT_FALSE(connection_.connected()); |
5687 } | 5689 } |
5688 | 5690 |
5689 } // namespace | 5691 } // namespace |
5690 } // namespace test | 5692 } // namespace test |
5691 } // namespace net | 5693 } // namespace net |
OLD | NEW |