Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Side by Side Diff: net/quic/core/quic_connection_test.cc

Issue 2330033002: Merge internal change: 132864057 (Closed)
Patch Set: re-sync Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_flags_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), kSelfAddress, 1133 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), kSelfAddress,
1134 kPeerAddress); 1134 kPeerAddress);
1135 // Cause change in self_address. 1135 // Cause change in self_address.
1136 IPEndPoint self_address(IPAddress(1, 1, 1, 1), 123); 1136 IPEndPoint self_address(IPAddress(1, 1, 1, 1), 123);
1137 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_ERROR_MIGRATING_ADDRESS, _, _)); 1137 EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_ERROR_MIGRATING_ADDRESS, _, _));
1138 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address, 1138 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address,
1139 kPeerAddress); 1139 kPeerAddress);
1140 EXPECT_FALSE(connection_.connected()); 1140 EXPECT_FALSE(connection_.connected());
1141 } 1141 }
1142 1142
1143 TEST_P(QuicConnectionTest, AllowSelfAddressChangeToMappedIpv4AddressAtServer) {
1144 FLAGS_quic_allow_server_address_change_for_mapped_ipv4 = true;
1145 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1146
1147 set_perspective(Perspective::IS_SERVER);
1148 QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false);
1149
1150 EXPECT_EQ(Perspective::IS_SERVER, connection_.perspective());
1151 EXPECT_TRUE(connection_.connected());
1152
1153 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece());
1154 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(3);
1155 IPEndPoint self_address1(IPAddress(1, 1, 1, 1), 443);
1156 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address1,
1157 kPeerAddress);
1158 // Cause self_address change to mapped Ipv4 address.
1159 IPEndPoint self_address2(ConvertIPv4ToIPv4MappedIPv6(self_address1.address()),
1160 443);
1161 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address2,
1162 kPeerAddress);
1163 EXPECT_TRUE(connection_.connected());
1164 // self_address change back to Ipv4 address.
1165 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address1,
1166 kPeerAddress);
1167 EXPECT_TRUE(connection_.connected());
1168 }
1169
1143 TEST_P(QuicConnectionTest, ClientAddressChangeAndPacketReordered) { 1170 TEST_P(QuicConnectionTest, ClientAddressChangeAndPacketReordered) {
1144 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); 1171 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_));
1145 set_perspective(Perspective::IS_SERVER); 1172 set_perspective(Perspective::IS_SERVER);
1146 QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false); 1173 QuicPacketCreatorPeer::SetSendVersionInPacket(creator_, false);
1147 // Clear peer address. 1174 // Clear peer address.
1148 QuicConnectionPeer::SetPeerAddress(&connection_, IPEndPoint()); 1175 QuicConnectionPeer::SetPeerAddress(&connection_, IPEndPoint());
1149 1176
1150 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5); 1177 QuicPacketCreatorPeer::SetPacketNumber(&peer_creator_, 5);
1151 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); 1178 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece());
1152 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber()); 1179 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(AnyNumber());
(...skipping 4099 matching lines...) Expand 10 before | Expand all | Expand 10 after
5252 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr); 5279 connection_.SendStreamDataWithString(3, "foo", 0, !kFin, nullptr);
5253 EXPECT_EQ(1u, writer_->frame_count()); 5280 EXPECT_EQ(1u, writer_->frame_count());
5254 EXPECT_FALSE(writer_->connection_close_frames().empty()); 5281 EXPECT_FALSE(writer_->connection_close_frames().empty());
5255 // Ack frame is not bundled in connection close packet. 5282 // Ack frame is not bundled in connection close packet.
5256 EXPECT_TRUE(writer_->ack_frames().empty()); 5283 EXPECT_TRUE(writer_->ack_frames().empty());
5257 } 5284 }
5258 5285
5259 } // namespace 5286 } // namespace
5260 } // namespace test 5287 } // namespace test
5261 } // namespace net 5288 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_flags_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698