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

Side by Side Diff: net/quic/quic_stream_factory_test.cc

Issue 804813010: QUIC - enabled FLAGS_allow_truncated_connection_ids_for_quic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Enable FLAGS_allow_truncated_connection_ids_for_quic by default Created 5 years, 11 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
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/quic_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "net/base/test_data_directory.h" 9 #include "net/base/test_data_directory.h"
10 #include "net/cert/cert_verifier.h" 10 #include "net/cert/cert_verifier.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 clock_, 158 clock_,
159 kDefaultMaxPacketSize, 159 kDefaultMaxPacketSize,
160 std::string(), 160 std::string(),
161 SupportedVersions(GetParam()), 161 SupportedVersions(GetParam()),
162 /*enable_port_selection=*/true, 162 /*enable_port_selection=*/true,
163 /*always_require_handshake_confirmation=*/false, 163 /*always_require_handshake_confirmation=*/false,
164 /*disable_connection_pooling=*/false, 164 /*disable_connection_pooling=*/false,
165 /*load_server_info_timeout=*/0u, 165 /*load_server_info_timeout=*/0u,
166 /*disable_loading_server_info_for_new_servers=*/false, 166 /*disable_loading_server_info_for_new_servers=*/false,
167 /*load_server_info_timeout_srtt_multiplier=*/0.0f, 167 /*load_server_info_timeout_srtt_multiplier=*/0.0f,
168 /*disable_truncated_connection_ids=*/false,
168 QuicTagVector()), 169 QuicTagVector()),
169 host_port_pair_(kDefaultServerHostName, kDefaultServerPort), 170 host_port_pair_(kDefaultServerHostName, kDefaultServerPort),
170 is_https_(false), 171 is_https_(false),
171 privacy_mode_(PRIVACY_MODE_DISABLED) { 172 privacy_mode_(PRIVACY_MODE_DISABLED) {
172 factory_.set_require_confirmation(false); 173 factory_.set_require_confirmation(false);
173 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); 174 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1));
174 } 175 }
175 176
176 scoped_ptr<QuicHttpStream> CreateIfSessionExists( 177 scoped_ptr<QuicHttpStream> CreateIfSessionExists(
177 const HostPortPair& host_port_pair, 178 const HostPortPair& host_port_pair,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 factory_.OnSessionClosed(session); 237 factory_.OnSessionClosed(session);
237 EXPECT_EQ(nullptr, CreateIfSessionExists(destination, net_log_).get()); 238 EXPECT_EQ(nullptr, CreateIfSessionExists(destination, net_log_).get());
238 EXPECT_TRUE(socket_data.at_read_eof()); 239 EXPECT_TRUE(socket_data.at_read_eof());
239 EXPECT_TRUE(socket_data.at_write_eof()); 240 EXPECT_TRUE(socket_data.at_write_eof());
240 return port; 241 return port;
241 } 242 }
242 243
243 scoped_ptr<QuicEncryptedPacket> ConstructRstPacket() { 244 scoped_ptr<QuicEncryptedPacket> ConstructRstPacket() {
244 QuicStreamId stream_id = kClientDataStreamId1; 245 QuicStreamId stream_id = kClientDataStreamId1;
245 return maker_.MakeRstPacket( 246 return maker_.MakeRstPacket(
246 1, true, stream_id, 247 1, PACKET_0BYTE_CONNECTION_ID, true, stream_id,
247 AdjustErrorForVersion(QUIC_RST_ACKNOWLEDGEMENT, GetParam())); 248 AdjustErrorForVersion(QUIC_RST_ACKNOWLEDGEMENT, GetParam()));
248 } 249 }
249 250
250 MockQuicServerInfoFactory quic_server_info_factory_; 251 MockQuicServerInfoFactory quic_server_info_factory_;
251 MockHostResolver host_resolver_; 252 MockHostResolver host_resolver_;
252 DeterministicMockClientSocketFactory socket_factory_; 253 DeterministicMockClientSocketFactory socket_factory_;
253 MockCryptoClientStreamFactory crypto_client_stream_factory_; 254 MockCryptoClientStreamFactory crypto_client_stream_factory_;
254 MockRandom random_generator_; 255 MockRandom random_generator_;
255 MockClock* clock_; // Owned by factory_. 256 MockClock* clock_; // Owned by factory_.
256 scoped_refptr<TestTaskRunner> runner_; 257 scoped_refptr<TestTaskRunner> runner_;
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 EXPECT_TRUE(socket_data.at_write_eof()); 1074 EXPECT_TRUE(socket_data.at_write_eof());
1074 EXPECT_TRUE(socket_data2.at_read_eof()); 1075 EXPECT_TRUE(socket_data2.at_read_eof());
1075 EXPECT_TRUE(socket_data2.at_write_eof()); 1076 EXPECT_TRUE(socket_data2.at_write_eof());
1076 } 1077 }
1077 1078
1078 TEST_P(QuicStreamFactoryTest, MaxOpenStream) { 1079 TEST_P(QuicStreamFactoryTest, MaxOpenStream) {
1079 MockRead reads[] = { 1080 MockRead reads[] = {
1080 MockRead(ASYNC, OK, 0) // EOF 1081 MockRead(ASYNC, OK, 0) // EOF
1081 }; 1082 };
1082 QuicStreamId stream_id = kClientDataStreamId1; 1083 QuicStreamId stream_id = kClientDataStreamId1;
1083 scoped_ptr<QuicEncryptedPacket> rst( 1084 scoped_ptr<QuicEncryptedPacket> rst(maker_.MakeRstPacket(
1084 maker_.MakeRstPacket(1, true, stream_id, QUIC_STREAM_CANCELLED)); 1085 1, PACKET_0BYTE_CONNECTION_ID, true, stream_id, QUIC_STREAM_CANCELLED));
1085 MockWrite writes[] = { 1086 MockWrite writes[] = {
1086 MockWrite(ASYNC, rst->data(), rst->length(), 1), 1087 MockWrite(ASYNC, rst->data(), rst->length(), 1),
1087 }; 1088 };
1088 DeterministicSocketData socket_data(reads, arraysize(reads), 1089 DeterministicSocketData socket_data(reads, arraysize(reads),
1089 writes, arraysize(writes)); 1090 writes, arraysize(writes));
1090 socket_factory_.AddSocketDataProvider(&socket_data); 1091 socket_factory_.AddSocketDataProvider(&socket_data);
1091 socket_data.StopAfter(1); 1092 socket_data.StopAfter(1);
1092 1093
1093 HttpRequestInfo request_info; 1094 HttpRequestInfo request_info;
1094 std::vector<QuicHttpStream*> streams; 1095 std::vector<QuicHttpStream*> streams;
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 ASSERT_EQ(0u, runner_->GetPostedTasks().size()); 1600 ASSERT_EQ(0u, runner_->GetPostedTasks().size());
1600 1601
1601 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream(); 1602 scoped_ptr<QuicHttpStream> stream = request.ReleaseStream();
1602 EXPECT_TRUE(stream.get()); 1603 EXPECT_TRUE(stream.get());
1603 EXPECT_TRUE(socket_data.at_read_eof()); 1604 EXPECT_TRUE(socket_data.at_read_eof());
1604 EXPECT_TRUE(socket_data.at_write_eof()); 1605 EXPECT_TRUE(socket_data.at_write_eof());
1605 } 1606 }
1606 1607
1607 } // namespace test 1608 } // namespace test
1608 } // namespace net 1609 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698