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

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

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: sync Created 3 years, 12 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_crypto_client_stream.cc » ('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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/quic/core/congestion_control/loss_detection_interface.h" 17 #include "net/quic/core/congestion_control/loss_detection_interface.h"
18 #include "net/quic/core/congestion_control/send_algorithm_interface.h" 18 #include "net/quic/core/congestion_control/send_algorithm_interface.h"
19 #include "net/quic/core/crypto/null_encrypter.h" 19 #include "net/quic/core/crypto/null_encrypter.h"
20 #include "net/quic/core/crypto/quic_decrypter.h" 20 #include "net/quic/core/crypto/quic_decrypter.h"
21 #include "net/quic/core/crypto/quic_encrypter.h" 21 #include "net/quic/core/crypto/quic_encrypter.h"
22 #include "net/quic/core/quic_flags.h" 22 #include "net/quic/core/quic_flags.h"
23 #include "net/quic/core/quic_packets.h" 23 #include "net/quic/core/quic_packets.h"
24 #include "net/quic/core/quic_simple_buffer_allocator.h" 24 #include "net/quic/core/quic_simple_buffer_allocator.h"
25 #include "net/quic/core/quic_utils.h" 25 #include "net/quic/core/quic_utils.h"
26 #include "net/quic/platform/api/quic_str_cat.h"
26 #include "net/quic/test_tools/mock_clock.h" 27 #include "net/quic/test_tools/mock_clock.h"
27 #include "net/quic/test_tools/mock_random.h" 28 #include "net/quic/test_tools/mock_random.h"
28 #include "net/quic/test_tools/quic_config_peer.h" 29 #include "net/quic/test_tools/quic_config_peer.h"
29 #include "net/quic/test_tools/quic_connection_peer.h" 30 #include "net/quic/test_tools/quic_connection_peer.h"
30 #include "net/quic/test_tools/quic_framer_peer.h" 31 #include "net/quic/test_tools/quic_framer_peer.h"
31 #include "net/quic/test_tools/quic_packet_creator_peer.h" 32 #include "net/quic/test_tools/quic_packet_creator_peer.h"
32 #include "net/quic/test_tools/quic_packet_generator_peer.h" 33 #include "net/quic/test_tools/quic_packet_generator_peer.h"
33 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 34 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
34 #include "net/quic/test_tools/quic_test_utils.h" 35 #include "net/quic/test_tools/quic_test_utils.h"
35 #include "net/quic/test_tools/simple_quic_framer.h" 36 #include "net/quic/test_tools/simple_quic_framer.h"
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 1144
1144 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece()); 1145 QuicStreamFrame stream_frame(1u, false, 0u, StringPiece());
1145 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(3); 1146 EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(3);
1146 QuicIpAddress host; 1147 QuicIpAddress host;
1147 host.FromString("1.1.1.1"); 1148 host.FromString("1.1.1.1");
1148 QuicSocketAddress self_address1(host, 443); 1149 QuicSocketAddress self_address1(host, 443);
1149 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address1, 1150 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address1,
1150 kPeerAddress); 1151 kPeerAddress);
1151 // Cause self_address change to mapped Ipv4 address. 1152 // Cause self_address change to mapped Ipv4 address.
1152 QuicIpAddress host2; 1153 QuicIpAddress host2;
1153 host2.FromString(base::StringPrintf( 1154 host2.FromString(
1154 "::ffff:%s", connection_.self_address().host().ToString().c_str())); 1155 QuicStrCat("::ffff:", connection_.self_address().host().ToString()));
1155 QuicSocketAddress self_address2(host2, connection_.self_address().port()); 1156 QuicSocketAddress self_address2(host2, connection_.self_address().port());
1156 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address2, 1157 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address2,
1157 kPeerAddress); 1158 kPeerAddress);
1158 EXPECT_TRUE(connection_.connected()); 1159 EXPECT_TRUE(connection_.connected());
1159 // self_address change back to Ipv4 address. 1160 // self_address change back to Ipv4 address.
1160 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address1, 1161 ProcessFramePacketWithAddresses(QuicFrame(&stream_frame), self_address1,
1161 kPeerAddress); 1162 kPeerAddress);
1162 EXPECT_TRUE(connection_.connected()); 1163 EXPECT_TRUE(connection_.connected());
1163 } 1164 }
1164 1165
(...skipping 3954 matching lines...) Expand 10 before | Expand all | Expand 10 after
5119 error_details, ConnectionCloseSource::FROM_PEER)); 5120 error_details, ConnectionCloseSource::FROM_PEER));
5120 connection_.set_perspective(Perspective::IS_CLIENT); 5121 connection_.set_perspective(Perspective::IS_CLIENT);
5121 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT, 5122 connection_.CloseConnection(QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT,
5122 error_details, 5123 error_details,
5123 ConnectionCloseBehavior::SILENT_CLOSE); 5124 ConnectionCloseBehavior::SILENT_CLOSE);
5124 } 5125 }
5125 5126
5126 } // namespace 5127 } // namespace
5127 } // namespace test 5128 } // namespace test
5128 } // namespace net 5129 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection.cc ('k') | net/quic/core/quic_crypto_client_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698