| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 3927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3938 ack_header.fec_group = 1; | 3938 ack_header.fec_group = 1; |
| 3939 | 3939 |
| 3940 QuicPacket* packet = | 3940 QuicPacket* packet = |
| 3941 BuildUnsizedDataPacket(&framer_, ack_header, frames).packet; | 3941 BuildUnsizedDataPacket(&framer_, ack_header, frames).packet; |
| 3942 | 3942 |
| 3943 // Take the packet which contains the ACK frame, and construct and deliver an | 3943 // Take the packet which contains the ACK frame, and construct and deliver an |
| 3944 // FEC packet which allows the ACK packet to be recovered. | 3944 // FEC packet which allows the ACK packet to be recovered. |
| 3945 ProcessFecPacket(2, 1, true, !kEntropyFlag, packet); | 3945 ProcessFecPacket(2, 1, true, !kEntropyFlag, packet); |
| 3946 } | 3946 } |
| 3947 | 3947 |
| 3948 TEST_P(QuicConnectionTest, NetworkChangeVisitorCallbacksChangeFecState) { |
| 3949 QuicPacketCreator* creator = |
| 3950 QuicConnectionPeer::GetPacketCreator(&connection_); |
| 3951 size_t max_packets_per_fec_group = creator->max_packets_per_fec_group(); |
| 3952 |
| 3953 QuicSentPacketManager::NetworkChangeVisitor* visitor = |
| 3954 QuicSentPacketManagerPeer::GetNetworkChangeVisitor( |
| 3955 QuicConnectionPeer::GetSentPacketManager(&connection_)); |
| 3956 EXPECT_TRUE(visitor); |
| 3957 |
| 3958 // Increase FEC group size by increasing congestion window to a large number. |
| 3959 visitor->OnCongestionWindowChange(1000 * kDefaultTCPMSS); |
| 3960 EXPECT_LT(max_packets_per_fec_group, creator->max_packets_per_fec_group()); |
| 3961 } |
| 3962 |
| 3948 class MockQuicConnectionDebugVisitor | 3963 class MockQuicConnectionDebugVisitor |
| 3949 : public QuicConnectionDebugVisitor { | 3964 : public QuicConnectionDebugVisitor { |
| 3950 public: | 3965 public: |
| 3951 MOCK_METHOD1(OnFrameAddedToPacket, | 3966 MOCK_METHOD1(OnFrameAddedToPacket, |
| 3952 void(const QuicFrame&)); | 3967 void(const QuicFrame&)); |
| 3953 | 3968 |
| 3954 MOCK_METHOD5(OnPacketSent, | 3969 MOCK_METHOD5(OnPacketSent, |
| 3955 void(QuicPacketSequenceNumber, | 3970 void(QuicPacketSequenceNumber, |
| 3956 EncryptionLevel, | 3971 EncryptionLevel, |
| 3957 TransmissionType, | 3972 TransmissionType, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4041 QuicBlockedFrame blocked; | 4056 QuicBlockedFrame blocked; |
| 4042 blocked.stream_id = 3; | 4057 blocked.stream_id = 3; |
| 4043 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 4058 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
| 4044 ProcessFramePacket(QuicFrame(&blocked)); | 4059 ProcessFramePacket(QuicFrame(&blocked)); |
| 4045 EXPECT_TRUE(ack_alarm->IsSet()); | 4060 EXPECT_TRUE(ack_alarm->IsSet()); |
| 4046 } | 4061 } |
| 4047 | 4062 |
| 4048 } // namespace | 4063 } // namespace |
| 4049 } // namespace test | 4064 } // namespace test |
| 4050 } // namespace net | 4065 } // namespace net |
| OLD | NEW |