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_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 Loading... |
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 /*enable_truncated_connection_ids=*/true, |
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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; |
1095 // The MockCryptoClientStream sets max_open_streams to be | 1096 // The MockCryptoClientStream sets max_open_streams to be |
1096 // 2 * kDefaultMaxStreamsPerConnection. | 1097 // kDefaultMaxStreamsPerConnection / 2. |
1097 for (size_t i = 0; i < 2 * kDefaultMaxStreamsPerConnection; i++) { | 1098 for (size_t i = 0; i < kDefaultMaxStreamsPerConnection / 2; i++) { |
1098 QuicStreamRequest request(&factory_); | 1099 QuicStreamRequest request(&factory_); |
1099 int rv = request.Request(host_port_pair_, | 1100 int rv = request.Request(host_port_pair_, |
1100 is_https_, | 1101 is_https_, |
1101 privacy_mode_, | 1102 privacy_mode_, |
1102 "GET", | 1103 "GET", |
1103 net_log_, | 1104 net_log_, |
1104 callback_.callback()); | 1105 callback_.callback()); |
1105 if (i == 0) { | 1106 if (i == 0) { |
1106 EXPECT_EQ(ERR_IO_PENDING, rv); | 1107 EXPECT_EQ(ERR_IO_PENDING, rv); |
1107 EXPECT_EQ(OK, callback_.WaitForResult()); | 1108 EXPECT_EQ(OK, callback_.WaitForResult()); |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |