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 <stddef.h> | 5 #include <stddef.h> |
6 #include <sys/epoll.h> | 6 #include <sys/epoll.h> |
7 | 7 |
8 #include <cstdint> | 8 #include <cstdint> |
9 #include <list> | 9 #include <list> |
10 #include <memory> | 10 #include <memory> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Run all tests with the cross products of all versions. | 79 // Run all tests with the cross products of all versions. |
80 struct TestParams { | 80 struct TestParams { |
81 TestParams(const QuicVersionVector& client_supported_versions, | 81 TestParams(const QuicVersionVector& client_supported_versions, |
82 const QuicVersionVector& server_supported_versions, | 82 const QuicVersionVector& server_supported_versions, |
83 QuicVersion negotiated_version, | 83 QuicVersion negotiated_version, |
84 bool client_supports_stateless_rejects, | 84 bool client_supports_stateless_rejects, |
85 bool server_uses_stateless_rejects_if_peer_supported, | 85 bool server_uses_stateless_rejects_if_peer_supported, |
86 QuicTag congestion_control_tag, | 86 QuicTag congestion_control_tag, |
87 bool disable_hpack_dynamic_table, | 87 bool disable_hpack_dynamic_table, |
88 bool force_hol_blocking, | 88 bool force_hol_blocking, |
89 bool use_cheap_stateless_reject) | 89 bool use_cheap_stateless_reject, |
| 90 bool connection_id_big_endian_client, |
| 91 bool connection_id_big_endian_server) |
90 : client_supported_versions(client_supported_versions), | 92 : client_supported_versions(client_supported_versions), |
91 server_supported_versions(server_supported_versions), | 93 server_supported_versions(server_supported_versions), |
92 negotiated_version(negotiated_version), | 94 negotiated_version(negotiated_version), |
93 client_supports_stateless_rejects(client_supports_stateless_rejects), | 95 client_supports_stateless_rejects(client_supports_stateless_rejects), |
94 server_uses_stateless_rejects_if_peer_supported( | 96 server_uses_stateless_rejects_if_peer_supported( |
95 server_uses_stateless_rejects_if_peer_supported), | 97 server_uses_stateless_rejects_if_peer_supported), |
96 congestion_control_tag(congestion_control_tag), | 98 congestion_control_tag(congestion_control_tag), |
97 disable_hpack_dynamic_table(disable_hpack_dynamic_table), | 99 disable_hpack_dynamic_table(disable_hpack_dynamic_table), |
98 force_hol_blocking(force_hol_blocking), | 100 force_hol_blocking(force_hol_blocking), |
99 use_cheap_stateless_reject(use_cheap_stateless_reject) {} | 101 use_cheap_stateless_reject(use_cheap_stateless_reject), |
| 102 connection_id_big_endian_client(connection_id_big_endian_client), |
| 103 connection_id_big_endian_server(connection_id_big_endian_server) {} |
100 | 104 |
101 friend std::ostream& operator<<(std::ostream& os, const TestParams& p) { | 105 friend std::ostream& operator<<(std::ostream& os, const TestParams& p) { |
102 os << "{ server_supported_versions: " | 106 os << "{ server_supported_versions: " |
103 << QuicVersionVectorToString(p.server_supported_versions); | 107 << QuicVersionVectorToString(p.server_supported_versions); |
104 os << " client_supported_versions: " | 108 os << " client_supported_versions: " |
105 << QuicVersionVectorToString(p.client_supported_versions); | 109 << QuicVersionVectorToString(p.client_supported_versions); |
106 os << " negotiated_version: " << QuicVersionToString(p.negotiated_version); | 110 os << " negotiated_version: " << QuicVersionToString(p.negotiated_version); |
107 os << " client_supports_stateless_rejects: " | 111 os << " client_supports_stateless_rejects: " |
108 << p.client_supports_stateless_rejects; | 112 << p.client_supports_stateless_rejects; |
109 os << " server_uses_stateless_rejects_if_peer_supported: " | 113 os << " server_uses_stateless_rejects_if_peer_supported: " |
110 << p.server_uses_stateless_rejects_if_peer_supported; | 114 << p.server_uses_stateless_rejects_if_peer_supported; |
111 os << " congestion_control_tag: " | 115 os << " congestion_control_tag: " |
112 << QuicTagToString(p.congestion_control_tag); | 116 << QuicTagToString(p.congestion_control_tag); |
113 os << " disable_hpack_dynamic_table: " << p.disable_hpack_dynamic_table; | 117 os << " disable_hpack_dynamic_table: " << p.disable_hpack_dynamic_table; |
114 os << " force_hol_blocking: " << p.force_hol_blocking; | 118 os << " force_hol_blocking: " << p.force_hol_blocking; |
115 os << " use_cheap_stateless_reject: " << p.use_cheap_stateless_reject | 119 os << " use_cheap_stateless_reject: " << p.use_cheap_stateless_reject; |
116 << " }"; | 120 os << " connection_id_big_endian_client: " |
| 121 << p.connection_id_big_endian_client; |
| 122 os << " connection_id_big_endian_server: " |
| 123 << p.connection_id_big_endian_server << " }"; |
117 return os; | 124 return os; |
118 } | 125 } |
119 | 126 |
120 QuicVersionVector client_supported_versions; | 127 QuicVersionVector client_supported_versions; |
121 QuicVersionVector server_supported_versions; | 128 QuicVersionVector server_supported_versions; |
122 QuicVersion negotiated_version; | 129 QuicVersion negotiated_version; |
123 bool client_supports_stateless_rejects; | 130 bool client_supports_stateless_rejects; |
124 bool server_uses_stateless_rejects_if_peer_supported; | 131 bool server_uses_stateless_rejects_if_peer_supported; |
125 QuicTag congestion_control_tag; | 132 QuicTag congestion_control_tag; |
126 bool disable_hpack_dynamic_table; | 133 bool disable_hpack_dynamic_table; |
127 bool force_hol_blocking; | 134 bool force_hol_blocking; |
128 bool use_cheap_stateless_reject; | 135 bool use_cheap_stateless_reject; |
| 136 bool connection_id_big_endian_client; |
| 137 bool connection_id_big_endian_server; |
129 }; | 138 }; |
130 | 139 |
131 // Constructs various test permutations. | 140 // Constructs various test permutations. |
132 std::vector<TestParams> GetTestParams() { | 141 std::vector<TestParams> GetTestParams() { |
133 // Divide the versions into buckets in which the intra-frame format | 142 // Divide the versions into buckets in which the intra-frame format |
134 // is compatible. When clients encounter QUIC version negotiation | 143 // is compatible. When clients encounter QUIC version negotiation |
135 // they simply retransmit all packets using the new version's | 144 // they simply retransmit all packets using the new version's |
136 // QUIC framing. However, they are unable to change the intra-frame | 145 // QUIC framing. However, they are unable to change the intra-frame |
137 // layout (for example to change HTTP/2 headers to SPDY/3). So | 146 // layout (for example to change HTTP/2 headers to SPDY/3). So |
138 // these tests need to ensure that clients are never attempting | 147 // these tests need to ensure that clients are never attempting |
139 // to do 0-RTT across incompatible versions. Chromium only supports | 148 // to do 0-RTT across incompatible versions. Chromium only supports |
140 // a single version at a time anyway. :) | 149 // a single version at a time anyway. :) |
141 QuicVersionVector all_supported_versions = AllSupportedVersions(); | 150 QuicVersionVector all_supported_versions = AllSupportedVersions(); |
142 // Even though this currently has one element, it may well get another | 151 // Even though this currently has one element, it may well get another |
143 // with future versions of QUIC, so don't remove it. | 152 // with future versions of QUIC, so don't remove it. |
144 QuicVersionVector version_buckets[1]; | 153 QuicVersionVector version_buckets[1]; |
145 | 154 |
146 for (const QuicVersion version : all_supported_versions) { | 155 for (const QuicVersion version : all_supported_versions) { |
147 // Versions: 34+ | 156 // Versions: 34+ |
148 // QUIC_VERSION_34 deprecates entropy and uses new ack and stop waiting | 157 // QUIC_VERSION_34 deprecates entropy and uses new ack and stop waiting |
149 // wire formats. | 158 // wire formats. |
150 version_buckets[0].push_back(version); | 159 version_buckets[0].push_back(version); |
151 } | 160 } |
152 | 161 |
153 // This must be kept in sync with the number of nested for-loops below as it | 162 // This must be kept in sync with the number of nested for-loops below as it |
154 // is used to prune the number of tests that are run. | 163 // is used to prune the number of tests that are run. |
155 const int kMaxEnabledOptions = 5; | 164 const int kMaxEnabledOptions = 7; |
156 int max_enabled_options = 0; | 165 int max_enabled_options = 0; |
157 std::vector<TestParams> params; | 166 std::vector<TestParams> params; |
158 for (bool server_uses_stateless_rejects_if_peer_supported : {true, false}) { | 167 for (bool server_uses_stateless_rejects_if_peer_supported : {true, false}) { |
159 for (bool client_supports_stateless_rejects : {true, false}) { | 168 for (bool client_supports_stateless_rejects : {true, false}) { |
160 for (const QuicTag congestion_control_tag : {kRENO, kTBBR, kQBIC}) { | 169 for (const QuicTag congestion_control_tag : {kRENO, kTBBR, kQBIC}) { |
161 for (bool disable_hpack_dynamic_table : {false}) { | 170 for (bool disable_hpack_dynamic_table : {false}) { |
162 for (bool force_hol_blocking : {true, false}) { | 171 for (bool force_hol_blocking : {true, false}) { |
163 for (bool use_cheap_stateless_reject : {true, false}) { | 172 for (bool use_cheap_stateless_reject : {true, false}) { |
164 int enabled_options = 0; | 173 for (bool connection_id_big_endian_client : {true, false}) { |
165 if (force_hol_blocking) { | 174 for (bool connection_id_big_endian_server : {true, false}) { |
166 ++enabled_options; | 175 int enabled_options = 0; |
167 } | 176 if (force_hol_blocking) { |
168 if (congestion_control_tag != kQBIC) { | 177 ++enabled_options; |
169 ++enabled_options; | 178 } |
170 } | 179 if (congestion_control_tag != kQBIC) { |
171 if (disable_hpack_dynamic_table) { | 180 ++enabled_options; |
172 ++enabled_options; | 181 } |
173 } | 182 if (disable_hpack_dynamic_table) { |
174 if (client_supports_stateless_rejects) { | 183 ++enabled_options; |
175 ++enabled_options; | 184 } |
176 } | 185 if (client_supports_stateless_rejects) { |
177 if (server_uses_stateless_rejects_if_peer_supported) { | 186 ++enabled_options; |
178 ++enabled_options; | 187 } |
179 } | 188 if (server_uses_stateless_rejects_if_peer_supported) { |
180 if (use_cheap_stateless_reject) { | 189 ++enabled_options; |
181 ++enabled_options; | 190 } |
182 } | 191 if (use_cheap_stateless_reject) { |
183 CHECK_GE(kMaxEnabledOptions, enabled_options); | 192 ++enabled_options; |
184 if (enabled_options > max_enabled_options) { | 193 } |
185 max_enabled_options = enabled_options; | 194 if (connection_id_big_endian_server) { |
186 } | 195 ++enabled_options; |
| 196 } |
| 197 if (connection_id_big_endian_client) { |
| 198 ++enabled_options; |
| 199 } |
| 200 CHECK_GE(kMaxEnabledOptions, enabled_options); |
| 201 if (enabled_options > max_enabled_options) { |
| 202 max_enabled_options = enabled_options; |
| 203 } |
187 | 204 |
188 // Run tests with no options, a single option, or all the | 205 // Run tests with no options, a single option, or all the |
189 // options enabled to avoid a combinatorial explosion. | 206 // options enabled to avoid a combinatorial explosion. |
190 if (enabled_options > 1 && enabled_options < kMaxEnabledOptions) { | 207 if (enabled_options > 1 && |
191 continue; | 208 enabled_options < kMaxEnabledOptions) { |
192 } | |
193 | |
194 for (const QuicVersionVector& client_versions : version_buckets) { | |
195 CHECK(!client_versions.empty()); | |
196 if (FilterSupportedVersions(client_versions).empty()) { | |
197 continue; | |
198 } | |
199 // Add an entry for server and client supporting all | |
200 // versions. | |
201 params.push_back(TestParams( | |
202 client_versions, all_supported_versions, | |
203 client_versions.front(), client_supports_stateless_rejects, | |
204 server_uses_stateless_rejects_if_peer_supported, | |
205 congestion_control_tag, disable_hpack_dynamic_table, | |
206 force_hol_blocking, use_cheap_stateless_reject)); | |
207 | |
208 // Run version negotiation tests tests with no options, or | |
209 // all the options enabled to avoid a combinatorial | |
210 // explosion. | |
211 if (enabled_options > 1 && | |
212 enabled_options < kMaxEnabledOptions) { | |
213 continue; | |
214 } | |
215 | |
216 // Test client supporting all versions and server supporting | |
217 // 1 version. Simulate an old server and exercise version | |
218 // downgrade in the client. Protocol negotiation should | |
219 // occur. Skip the i = 0 case because it is essentially the | |
220 // same as the default case. | |
221 for (size_t i = 1; i < client_versions.size(); ++i) { | |
222 QuicVersionVector server_supported_versions; | |
223 server_supported_versions.push_back(client_versions[i]); | |
224 if (FilterSupportedVersions(server_supported_versions) | |
225 .empty()) { | |
226 continue; | 209 continue; |
227 } | 210 } |
228 params.push_back(TestParams( | 211 |
229 client_versions, server_supported_versions, | 212 for (const QuicVersionVector& client_versions : |
230 server_supported_versions.front(), | 213 version_buckets) { |
231 client_supports_stateless_rejects, | 214 CHECK(!client_versions.empty()); |
232 server_uses_stateless_rejects_if_peer_supported, | 215 if (FilterSupportedVersions(client_versions).empty()) { |
233 congestion_control_tag, disable_hpack_dynamic_table, | 216 continue; |
234 force_hol_blocking, use_cheap_stateless_reject)); | 217 } |
235 } // End of version for loop. | 218 // Add an entry for server and client supporting all |
236 } // End of 2nd version for loop. | 219 // versions. |
| 220 params.push_back(TestParams( |
| 221 client_versions, all_supported_versions, |
| 222 client_versions.front(), |
| 223 client_supports_stateless_rejects, |
| 224 server_uses_stateless_rejects_if_peer_supported, |
| 225 congestion_control_tag, disable_hpack_dynamic_table, |
| 226 force_hol_blocking, use_cheap_stateless_reject, |
| 227 connection_id_big_endian_client, |
| 228 connection_id_big_endian_server)); |
| 229 |
| 230 // Run version negotiation tests tests with no options, or |
| 231 // all the options enabled to avoid a combinatorial |
| 232 // explosion. |
| 233 if (enabled_options > 1 && |
| 234 enabled_options < kMaxEnabledOptions) { |
| 235 continue; |
| 236 } |
| 237 |
| 238 // Test client supporting all versions and server supporting |
| 239 // 1 version. Simulate an old server and exercise version |
| 240 // downgrade in the client. Protocol negotiation should |
| 241 // occur. Skip the i = 0 case because it is essentially the |
| 242 // same as the default case. |
| 243 for (size_t i = 1; i < client_versions.size(); ++i) { |
| 244 QuicVersionVector server_supported_versions; |
| 245 server_supported_versions.push_back(client_versions[i]); |
| 246 if (FilterSupportedVersions(server_supported_versions) |
| 247 .empty()) { |
| 248 continue; |
| 249 } |
| 250 params.push_back(TestParams( |
| 251 client_versions, server_supported_versions, |
| 252 server_supported_versions.front(), |
| 253 client_supports_stateless_rejects, |
| 254 server_uses_stateless_rejects_if_peer_supported, |
| 255 congestion_control_tag, disable_hpack_dynamic_table, |
| 256 force_hol_blocking, use_cheap_stateless_reject, |
| 257 connection_id_big_endian_client, |
| 258 connection_id_big_endian_server)); |
| 259 } // End of version for loop. |
| 260 } // End of 2nd version for loop. |
| 261 } // End of connection_id_big_endian_server |
| 262 } // End of connection_id_big_endian_client |
237 } // End of use_cheap_stateless_reject for loop. | 263 } // End of use_cheap_stateless_reject for loop. |
238 } // End of force_hol_blocking loop. | 264 } // End of force_hol_blocking loop. |
239 } // End of disable_hpack_dynamic_table for loop. | 265 } // End of disable_hpack_dynamic_table for loop. |
240 } // End of congestion_control_tag for loop. | 266 } // End of congestion_control_tag for loop. |
241 } // End of client_supports_stateless_rejects for loop. | 267 } // End of client_supports_stateless_rejects for loop. |
242 CHECK_EQ(kMaxEnabledOptions, max_enabled_options); | 268 CHECK_EQ(kMaxEnabledOptions, max_enabled_options); |
243 } // End of server_uses_stateless_rejects_if_peer_supported for loop. | 269 } // End of server_uses_stateless_rejects_if_peer_supported for loop. |
244 return params; | 270 return params; |
245 } | 271 } |
246 | 272 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // The default idle timeouts can be too strict when running on a busy | 325 // The default idle timeouts can be too strict when running on a busy |
300 // machine. | 326 // machine. |
301 const QuicTime::Delta timeout = QuicTime::Delta::FromSeconds(30); | 327 const QuicTime::Delta timeout = QuicTime::Delta::FromSeconds(30); |
302 client_config_.set_max_time_before_crypto_handshake(timeout); | 328 client_config_.set_max_time_before_crypto_handshake(timeout); |
303 client_config_.set_max_idle_time_before_crypto_handshake(timeout); | 329 client_config_.set_max_idle_time_before_crypto_handshake(timeout); |
304 server_config_.set_max_time_before_crypto_handshake(timeout); | 330 server_config_.set_max_time_before_crypto_handshake(timeout); |
305 server_config_.set_max_idle_time_before_crypto_handshake(timeout); | 331 server_config_.set_max_idle_time_before_crypto_handshake(timeout); |
306 | 332 |
307 AddToCache("/foo", 200, kFooResponseBody); | 333 AddToCache("/foo", 200, kFooResponseBody); |
308 AddToCache("/bar", 200, kBarResponseBody); | 334 AddToCache("/bar", 200, kBarResponseBody); |
| 335 |
| 336 FLAGS_quic_restart_flag_quic_big_endian_connection_id_client = |
| 337 GetParam().connection_id_big_endian_client; |
| 338 FLAGS_quic_restart_flag_quic_big_endian_connection_id_server = |
| 339 GetParam().connection_id_big_endian_server; |
309 } | 340 } |
310 | 341 |
311 ~EndToEndTest() override { | 342 ~EndToEndTest() override { |
312 // TODO(rtenneti): port RecycleUnusedPort if needed. | 343 // TODO(rtenneti): port RecycleUnusedPort if needed. |
313 // RecycleUnusedPort(server_address_.port()); | 344 // RecycleUnusedPort(server_address_.port()); |
314 } | 345 } |
315 | 346 |
316 virtual void CreateClientWithWriter() { | 347 virtual void CreateClientWithWriter() { |
317 client_.reset(CreateQuicClient(client_writer_)); | 348 client_.reset(CreateQuicClient(client_writer_)); |
318 } | 349 } |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 } | 2054 } |
2024 | 2055 |
2025 // Send a public reset from the server. | 2056 // Send a public reset from the server. |
2026 TEST_P(EndToEndTest, ServerSendPublicReset) { | 2057 TEST_P(EndToEndTest, ServerSendPublicReset) { |
2027 ASSERT_TRUE(Initialize()); | 2058 ASSERT_TRUE(Initialize()); |
2028 | 2059 |
2029 // Send the public reset. | 2060 // Send the public reset. |
2030 QuicConnectionId connection_id = | 2061 QuicConnectionId connection_id = |
2031 client_->client()->session()->connection()->connection_id(); | 2062 client_->client()->session()->connection()->connection_id(); |
2032 QuicPublicResetPacket header; | 2063 QuicPublicResetPacket header; |
2033 header.public_header.connection_id = connection_id; | 2064 header.public_header.connection_id = |
| 2065 GetPeerInMemoryConnectionId(connection_id); |
2034 header.public_header.reset_flag = true; | 2066 header.public_header.reset_flag = true; |
2035 header.public_header.version_flag = false; | 2067 header.public_header.version_flag = false; |
2036 header.rejected_packet_number = 10101; | 2068 header.rejected_packet_number = 10101; |
2037 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), | 2069 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), |
2038 Perspective::IS_SERVER); | 2070 Perspective::IS_SERVER); |
2039 std::unique_ptr<QuicEncryptedPacket> packet( | 2071 std::unique_ptr<QuicEncryptedPacket> packet( |
2040 framer.BuildPublicResetPacket(header)); | 2072 framer.BuildPublicResetPacket(header)); |
2041 // We must pause the server's thread in order to call WritePacket without | 2073 // We must pause the server's thread in order to call WritePacket without |
2042 // race conditions. | 2074 // race conditions. |
2043 server_thread_->Pause(); | 2075 server_thread_->Pause(); |
(...skipping 12 matching lines...) Expand all Loading... |
2056 // It should be ignored. | 2088 // It should be ignored. |
2057 TEST_P(EndToEndTest, ServerSendPublicResetWithDifferentConnectionId) { | 2089 TEST_P(EndToEndTest, ServerSendPublicResetWithDifferentConnectionId) { |
2058 ASSERT_TRUE(Initialize()); | 2090 ASSERT_TRUE(Initialize()); |
2059 | 2091 |
2060 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 2092 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
2061 | 2093 |
2062 // Send the public reset. | 2094 // Send the public reset. |
2063 QuicConnectionId incorrect_connection_id = | 2095 QuicConnectionId incorrect_connection_id = |
2064 client_->client()->session()->connection()->connection_id() + 1; | 2096 client_->client()->session()->connection()->connection_id() + 1; |
2065 QuicPublicResetPacket header; | 2097 QuicPublicResetPacket header; |
2066 header.public_header.connection_id = incorrect_connection_id; | 2098 header.public_header.connection_id = |
| 2099 GetPeerInMemoryConnectionId(incorrect_connection_id); |
2067 header.public_header.reset_flag = true; | 2100 header.public_header.reset_flag = true; |
2068 header.public_header.version_flag = false; | 2101 header.public_header.version_flag = false; |
2069 header.rejected_packet_number = 10101; | 2102 header.rejected_packet_number = 10101; |
2070 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), | 2103 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), |
2071 Perspective::IS_SERVER); | 2104 Perspective::IS_SERVER); |
2072 std::unique_ptr<QuicEncryptedPacket> packet( | 2105 std::unique_ptr<QuicEncryptedPacket> packet( |
2073 framer.BuildPublicResetPacket(header)); | 2106 framer.BuildPublicResetPacket(header)); |
2074 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; | 2107 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; |
2075 client_->client()->session()->connection()->set_debug_visitor(&visitor); | 2108 client_->client()->session()->connection()->set_debug_visitor(&visitor); |
2076 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) | 2109 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2121 // connection ID. It should be ignored. | 2154 // connection ID. It should be ignored. |
2122 TEST_P(EndToEndTest, ServerSendVersionNegotiationWithDifferentConnectionId) { | 2155 TEST_P(EndToEndTest, ServerSendVersionNegotiationWithDifferentConnectionId) { |
2123 ASSERT_TRUE(Initialize()); | 2156 ASSERT_TRUE(Initialize()); |
2124 | 2157 |
2125 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 2158 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
2126 | 2159 |
2127 // Send the version negotiation packet. | 2160 // Send the version negotiation packet. |
2128 QuicConnectionId incorrect_connection_id = | 2161 QuicConnectionId incorrect_connection_id = |
2129 client_->client()->session()->connection()->connection_id() + 1; | 2162 client_->client()->session()->connection()->connection_id() + 1; |
2130 std::unique_ptr<QuicEncryptedPacket> packet( | 2163 std::unique_ptr<QuicEncryptedPacket> packet( |
2131 QuicFramer::BuildVersionNegotiationPacket(incorrect_connection_id, | 2164 QuicFramer::BuildVersionNegotiationPacket( |
2132 server_supported_versions_)); | 2165 GetPeerInMemoryConnectionId(incorrect_connection_id), |
| 2166 server_supported_versions_)); |
2133 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; | 2167 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; |
2134 client_->client()->session()->connection()->set_debug_visitor(&visitor); | 2168 client_->client()->session()->connection()->set_debug_visitor(&visitor); |
2135 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) | 2169 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) |
2136 .Times(1); | 2170 .Times(1); |
2137 // We must pause the server's thread in order to call WritePacket without | 2171 // We must pause the server's thread in order to call WritePacket without |
2138 // race conditions. | 2172 // race conditions. |
2139 server_thread_->Pause(); | 2173 server_thread_->Pause(); |
2140 server_writer_->WritePacket( | 2174 server_writer_->WritePacket( |
2141 packet->data(), packet->length(), server_address_.host(), | 2175 packet->data(), packet->length(), server_address_.host(), |
2142 client_->client()->GetLatestClientAddress(), nullptr); | 2176 client_->client()->GetLatestClientAddress(), nullptr); |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 client_->WaitForResponse(); | 3132 client_->WaitForResponse(); |
3099 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3133 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
3100 QuicConnectionStats client_stats = | 3134 QuicConnectionStats client_stats = |
3101 client_->client()->session()->connection()->GetStats(); | 3135 client_->client()->session()->connection()->GetStats(); |
3102 EXPECT_EQ(0u, client_stats.packets_lost); | 3136 EXPECT_EQ(0u, client_stats.packets_lost); |
3103 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3137 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
3104 } | 3138 } |
3105 } // namespace | 3139 } // namespace |
3106 } // namespace test | 3140 } // namespace test |
3107 } // namespace net | 3141 } // namespace net |
OLD | NEW |