| 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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 | 1097 |
| 1098 // Start out saying the least unacked is 2. | 1098 // Start out saying the least unacked is 2. |
| 1099 creator_.set_sequence_number(5); | 1099 creator_.set_sequence_number(5); |
| 1100 QuicAckFrame frame = InitAckFrame(0, 2); | 1100 QuicAckFrame frame = InitAckFrame(0, 2); |
| 1101 ProcessAckPacket(&frame); | 1101 ProcessAckPacket(&frame); |
| 1102 | 1102 |
| 1103 // Change it to 1, but lower the sequence number to fake out-of-order packets. | 1103 // Change it to 1, but lower the sequence number to fake out-of-order packets. |
| 1104 // This should be fine. | 1104 // This should be fine. |
| 1105 creator_.set_sequence_number(1); | 1105 creator_.set_sequence_number(1); |
| 1106 QuicAckFrame frame2 = InitAckFrame(0, 1); | 1106 QuicAckFrame frame2 = InitAckFrame(0, 1); |
| 1107 // The scheduler will not process out of order acks. | 1107 // The scheduler will not process out of order acks, but all packet processing |
| 1108 EXPECT_CALL(visitor_, OnCanWrite()).Times(0); | 1108 // causes the connection to try to write. |
| 1109 EXPECT_CALL(visitor_, OnCanWrite()).Times(1); |
| 1109 ProcessAckPacket(&frame2); | 1110 ProcessAckPacket(&frame2); |
| 1110 | 1111 |
| 1111 // Now claim it's one, but set the ordering so it was sent "after" the first | 1112 // Now claim it's one, but set the ordering so it was sent "after" the first |
| 1112 // one. This should cause a connection error. | 1113 // one. This should cause a connection error. |
| 1113 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_ACK_DATA, false)); | 1114 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_ACK_DATA, false)); |
| 1114 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); | 1115 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)); |
| 1115 creator_.set_sequence_number(7); | 1116 creator_.set_sequence_number(7); |
| 1116 ProcessAckPacket(&frame2); | 1117 ProcessAckPacket(&frame2); |
| 1117 } | 1118 } |
| 1118 | 1119 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 | 1251 |
| 1251 SendStreamDataToPeer(1, "foo", 12, !kFin, &last_packet); | 1252 SendStreamDataToPeer(1, "foo", 12, !kFin, &last_packet); |
| 1252 EXPECT_EQ(PACKET_6BYTE_SEQUENCE_NUMBER, | 1253 EXPECT_EQ(PACKET_6BYTE_SEQUENCE_NUMBER, |
| 1253 connection_.options()->send_sequence_number_length); | 1254 connection_.options()->send_sequence_number_length); |
| 1254 EXPECT_EQ(PACKET_4BYTE_SEQUENCE_NUMBER, | 1255 EXPECT_EQ(PACKET_4BYTE_SEQUENCE_NUMBER, |
| 1255 last_header()->public_header.sequence_number_length); | 1256 last_header()->public_header.sequence_number_length); |
| 1256 } | 1257 } |
| 1257 | 1258 |
| 1258 TEST_F(QuicConnectionTest, BasicSending) { | 1259 TEST_F(QuicConnectionTest, BasicSending) { |
| 1259 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1260 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
| 1260 // EXPECT_CALL(*send_algorithm_, UpdateRtt(_)); | |
| 1261 // EXPECT_CALL(*send_algorithm_, OnPacketAcked(_, _)).Times(6); | |
| 1262 QuicPacketSequenceNumber last_packet; | 1261 QuicPacketSequenceNumber last_packet; |
| 1263 SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1 | 1262 SendStreamDataToPeer(1, "foo", 0, !kFin, &last_packet); // Packet 1 |
| 1264 EXPECT_EQ(1u, last_packet); | 1263 EXPECT_EQ(1u, last_packet); |
| 1265 SendAckPacketToPeer(); // Packet 2 | 1264 SendAckPacketToPeer(); // Packet 2 |
| 1266 | 1265 |
| 1267 EXPECT_EQ(1u, last_ack()->sent_info.least_unacked); | 1266 EXPECT_EQ(1u, last_ack()->sent_info.least_unacked); |
| 1268 | 1267 |
| 1269 SendAckPacketToPeer(); // Packet 3 | 1268 SendAckPacketToPeer(); // Packet 3 |
| 1270 EXPECT_EQ(1u, last_ack()->sent_info.least_unacked); | 1269 EXPECT_EQ(1u, last_ack()->sent_info.least_unacked); |
| 1271 | 1270 |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3463 true); | 3462 true); |
| 3464 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), | 3463 TestConnection client(guid_, IPEndPoint(), helper_.get(), writer_.get(), |
| 3465 false); | 3464 false); |
| 3466 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); | 3465 EXPECT_TRUE(client.sent_packet_manager().using_pacing()); |
| 3467 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); | 3466 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); |
| 3468 } | 3467 } |
| 3469 | 3468 |
| 3470 } // namespace | 3469 } // namespace |
| 3471 } // namespace test | 3470 } // namespace test |
| 3472 } // namespace net | 3471 } // namespace net |
| OLD | NEW |