| 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 3160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3171 // Queue the first packet. | 3171 // Queue the first packet. |
| 3172 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(7); | 3172 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(7); |
| 3173 // The first stream frame will have 2 fewer overhead bytes than the other six. | 3173 // The first stream frame will have 2 fewer overhead bytes than the other six. |
| 3174 const string payload(payload_length * 7 + 2, 'a'); | 3174 const string payload(payload_length * 7 + 2, 'a'); |
| 3175 EXPECT_EQ(payload.size(), | 3175 EXPECT_EQ(payload.size(), |
| 3176 connection_.SendStreamDataWithString(1, payload, 0, !kFin, nullptr) | 3176 connection_.SendStreamDataWithString(1, payload, 0, !kFin, nullptr) |
| 3177 .bytes_consumed); | 3177 .bytes_consumed); |
| 3178 } | 3178 } |
| 3179 | 3179 |
| 3180 TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) { | 3180 TEST_P(QuicConnectionTest, LoopThroughSendingPacketsWithTruncation) { |
| 3181 ValueRestore<bool> old_flag(&FLAGS_allow_truncated_connection_ids_for_quic, | |
| 3182 true); | |
| 3183 | |
| 3184 // Set up a larger payload than will fit in one packet. | 3181 // Set up a larger payload than will fit in one packet. |
| 3185 const string payload(connection_.max_packet_length(), 'a'); | 3182 const string payload(connection_.max_packet_length(), 'a'); |
| 3186 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)).Times(AnyNumber()); | 3183 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)).Times(AnyNumber()); |
| 3187 | 3184 |
| 3188 // Now send some packets with no truncation. | 3185 // Now send some packets with no truncation. |
| 3189 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | 3186 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); |
| 3190 EXPECT_EQ(payload.size(), | 3187 EXPECT_EQ(payload.size(), |
| 3191 connection_.SendStreamDataWithString( | 3188 connection_.SendStreamDataWithString( |
| 3192 3, payload, 0, !kFin, nullptr).bytes_consumed); | 3189 3, payload, 0, !kFin, nullptr).bytes_consumed); |
| 3193 // Track the size of the second packet here. The overhead will be the largest | 3190 // Track the size of the second packet here. The overhead will be the largest |
| (...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4338 // Regression test for b/18594622 | 4335 // Regression test for b/18594622 |
| 4339 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); | 4336 scoped_refptr<MockAckNotifierDelegate> delegate(new MockAckNotifierDelegate); |
| 4340 EXPECT_DFATAL( | 4337 EXPECT_DFATAL( |
| 4341 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), | 4338 connection_.SendStreamDataWithString(3, "", 0, !kFin, delegate.get()), |
| 4342 "Attempt to send empty stream frame"); | 4339 "Attempt to send empty stream frame"); |
| 4343 } | 4340 } |
| 4344 | 4341 |
| 4345 } // namespace | 4342 } // namespace |
| 4346 } // namespace test | 4343 } // namespace test |
| 4347 } // namespace net | 4344 } // namespace net |
| OLD | NEW |