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/core/quic_connection.h" | 5 #include "net/quic/core/quic_connection.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <ostream> | 9 #include <ostream> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5); | 1148 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5); |
1149 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); | 1149 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); |
1150 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber()); | 1150 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber()); |
1151 const IPEndPoint kNewPeerAddress = IPEndPoint(Loopback6(), | 1151 const IPEndPoint kNewPeerAddress = IPEndPoint(Loopback6(), |
1152 /*port=*/23456); | 1152 /*port=*/23456); |
1153 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), kSelfAddress, | 1153 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), kSelfAddress, |
1154 kNewPeerAddress); | 1154 kNewPeerAddress); |
1155 | 1155 |
1156 // Decrease packet number to simulate out-of-order packets. | 1156 // Decrease packet number to simulate out-of-order packets. |
1157 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 4); | 1157 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 4); |
1158 if (FLAGS_quic_do_not_migrate_on_old_packet) { | 1158 // This is an old packet, do not migrate. |
1159 // This is an old packet, do not migrate. | 1159 EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0); |
1160 EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)).Times(0); | |
1161 } else { | |
1162 // A connection migration is observed. | |
1163 EXPECT_CALL(visitor_, OnConnectionMigration(PORT_CHANGE)); | |
1164 } | |
1165 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), kSelfAddress, | 1160 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), kSelfAddress, |
1166 kPeerAddress); | 1161 kPeerAddress); |
1167 } | 1162 } |
1168 | 1163 |
1169 TEST_P(QuicConnectionTest, MaxPacketSize) { | 1164 TEST_P(QuicConnectionTest, MaxPacketSize) { |
1170 EXPECT_EQ(Perspective::IS_CLIENT, connection_.perspective()); | 1165 EXPECT_EQ(Perspective::IS_CLIENT, connection_.perspective()); |
1171 EXPECT_EQ(1350u, connection_.max_packet_length()); | 1166 EXPECT_EQ(1350u, connection_.max_packet_length()); |
1172 } | 1167 } |
1173 | 1168 |
1174 TEST_P(QuicConnectionTest, SmallerServerMaxPacketSize) { | 1169 TEST_P(QuicConnectionTest, SmallerServerMaxPacketSize) { |
(...skipping 3811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4986 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); | 4981 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(2); |
4987 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, | 4982 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_PACKET_WRITE_ERROR, _, |
4988 ConnectionCloseSource::FROM_SELF)) | 4983 ConnectionCloseSource::FROM_SELF)) |
4989 .Times(1); | 4984 .Times(1); |
4990 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); | 4985 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); |
4991 } | 4986 } |
4992 | 4987 |
4993 } // namespace | 4988 } // namespace |
4994 } // namespace test | 4989 } // namespace test |
4995 } // namespace net | 4990 } // namespace net |
OLD | NEW |