| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 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 = 5; |
| 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 CHECK_GE(kMaxEnabledOptions, enabled_options); |
| 186 } | 195 if (enabled_options > max_enabled_options) { |
| 196 max_enabled_options = enabled_options; |
| 197 } |
| 187 | 198 |
| 188 // Run tests with no options, a single option, or all the | 199 // Run tests with no options, a single option, or all the |
| 189 // options enabled to avoid a combinatorial explosion. | 200 // options enabled to avoid a combinatorial explosion. |
| 190 if (enabled_options > 1 && enabled_options < kMaxEnabledOptions) { | 201 if (enabled_options > 1 && |
| 191 continue; | 202 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; | 203 continue; |
| 227 } | 204 } |
| 228 params.push_back(TestParams( | 205 |
| 229 client_versions, server_supported_versions, | 206 for (const QuicVersionVector& client_versions : |
| 230 server_supported_versions.front(), | 207 version_buckets) { |
| 231 client_supports_stateless_rejects, | 208 CHECK(!client_versions.empty()); |
| 232 server_uses_stateless_rejects_if_peer_supported, | 209 if (FilterSupportedVersions(client_versions).empty()) { |
| 233 congestion_control_tag, disable_hpack_dynamic_table, | 210 continue; |
| 234 force_hol_blocking, use_cheap_stateless_reject)); | 211 } |
| 235 } // End of version for loop. | 212 // Add an entry for server and client supporting all |
| 236 } // End of 2nd version for loop. | 213 // versions. |
| 214 params.push_back(TestParams( |
| 215 client_versions, all_supported_versions, |
| 216 client_versions.front(), |
| 217 client_supports_stateless_rejects, |
| 218 server_uses_stateless_rejects_if_peer_supported, |
| 219 congestion_control_tag, disable_hpack_dynamic_table, |
| 220 force_hol_blocking, use_cheap_stateless_reject, |
| 221 connection_id_big_endian_client, |
| 222 connection_id_big_endian_server)); |
| 223 |
| 224 // Run version negotiation tests tests with no options, or |
| 225 // all the options enabled to avoid a combinatorial |
| 226 // explosion. |
| 227 if (enabled_options > 1 && |
| 228 enabled_options < kMaxEnabledOptions) { |
| 229 continue; |
| 230 } |
| 231 |
| 232 // Test client supporting all versions and server supporting |
| 233 // 1 version. Simulate an old server and exercise version |
| 234 // downgrade in the client. Protocol negotiation should |
| 235 // occur. Skip the i = 0 case because it is essentially the |
| 236 // same as the default case. |
| 237 for (size_t i = 1; i < client_versions.size(); ++i) { |
| 238 QuicVersionVector server_supported_versions; |
| 239 server_supported_versions.push_back(client_versions[i]); |
| 240 if (FilterSupportedVersions(server_supported_versions) |
| 241 .empty()) { |
| 242 continue; |
| 243 } |
| 244 params.push_back(TestParams( |
| 245 client_versions, server_supported_versions, |
| 246 server_supported_versions.front(), |
| 247 client_supports_stateless_rejects, |
| 248 server_uses_stateless_rejects_if_peer_supported, |
| 249 congestion_control_tag, disable_hpack_dynamic_table, |
| 250 force_hol_blocking, use_cheap_stateless_reject, |
| 251 connection_id_big_endian_client, |
| 252 connection_id_big_endian_server)); |
| 253 } // End of version for loop. |
| 254 } // End of 2nd version for loop. |
| 255 } // End of connection_id_big_endian_server |
| 256 } // End of connection_id_big_endian_client |
| 237 } // End of use_cheap_stateless_reject for loop. | 257 } // End of use_cheap_stateless_reject for loop. |
| 238 } // End of force_hol_blocking loop. | 258 } // End of force_hol_blocking loop. |
| 239 } // End of disable_hpack_dynamic_table for loop. | 259 } // End of disable_hpack_dynamic_table for loop. |
| 240 } // End of congestion_control_tag for loop. | 260 } // End of congestion_control_tag for loop. |
| 241 } // End of client_supports_stateless_rejects for loop. | 261 } // End of client_supports_stateless_rejects for loop. |
| 242 CHECK_EQ(kMaxEnabledOptions, max_enabled_options); | 262 CHECK_EQ(kMaxEnabledOptions, max_enabled_options); |
| 243 } // End of server_uses_stateless_rejects_if_peer_supported for loop. | 263 } // End of server_uses_stateless_rejects_if_peer_supported for loop. |
| 244 return params; | 264 return params; |
| 245 } | 265 } |
| 246 | 266 |
| (...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 | 319 // The default idle timeouts can be too strict when running on a busy |
| 300 // machine. | 320 // machine. |
| 301 const QuicTime::Delta timeout = QuicTime::Delta::FromSeconds(30); | 321 const QuicTime::Delta timeout = QuicTime::Delta::FromSeconds(30); |
| 302 client_config_.set_max_time_before_crypto_handshake(timeout); | 322 client_config_.set_max_time_before_crypto_handshake(timeout); |
| 303 client_config_.set_max_idle_time_before_crypto_handshake(timeout); | 323 client_config_.set_max_idle_time_before_crypto_handshake(timeout); |
| 304 server_config_.set_max_time_before_crypto_handshake(timeout); | 324 server_config_.set_max_time_before_crypto_handshake(timeout); |
| 305 server_config_.set_max_idle_time_before_crypto_handshake(timeout); | 325 server_config_.set_max_idle_time_before_crypto_handshake(timeout); |
| 306 | 326 |
| 307 AddToCache("/foo", 200, kFooResponseBody); | 327 AddToCache("/foo", 200, kFooResponseBody); |
| 308 AddToCache("/bar", 200, kBarResponseBody); | 328 AddToCache("/bar", 200, kBarResponseBody); |
| 329 |
| 330 FLAGS_quic_restart_flag_quic_big_endian_connection_id_client = |
| 331 GetParam().connection_id_big_endian_client; |
| 332 FLAGS_quic_restart_flag_quic_big_endian_connection_id_server = |
| 333 GetParam().connection_id_big_endian_server; |
| 309 } | 334 } |
| 310 | 335 |
| 311 ~EndToEndTest() override { | 336 ~EndToEndTest() override { |
| 312 // TODO(rtenneti): port RecycleUnusedPort if needed. | 337 // TODO(rtenneti): port RecycleUnusedPort if needed. |
| 313 // RecycleUnusedPort(server_address_.port()); | 338 // RecycleUnusedPort(server_address_.port()); |
| 314 } | 339 } |
| 315 | 340 |
| 316 virtual void CreateClientWithWriter() { | 341 virtual void CreateClientWithWriter() { |
| 317 client_.reset(CreateQuicClient(client_writer_)); | 342 client_.reset(CreateQuicClient(client_writer_)); |
| 318 } | 343 } |
| (...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2023 } | 2048 } |
| 2024 | 2049 |
| 2025 // Send a public reset from the server. | 2050 // Send a public reset from the server. |
| 2026 TEST_P(EndToEndTest, ServerSendPublicReset) { | 2051 TEST_P(EndToEndTest, ServerSendPublicReset) { |
| 2027 ASSERT_TRUE(Initialize()); | 2052 ASSERT_TRUE(Initialize()); |
| 2028 | 2053 |
| 2029 // Send the public reset. | 2054 // Send the public reset. |
| 2030 QuicConnectionId connection_id = | 2055 QuicConnectionId connection_id = |
| 2031 client_->client()->session()->connection()->connection_id(); | 2056 client_->client()->session()->connection()->connection_id(); |
| 2032 QuicPublicResetPacket header; | 2057 QuicPublicResetPacket header; |
| 2033 header.public_header.connection_id = connection_id; | 2058 header.public_header.connection_id = |
| 2059 GetPeerInMemoryConnectionId(connection_id); |
| 2034 header.public_header.reset_flag = true; | 2060 header.public_header.reset_flag = true; |
| 2035 header.public_header.version_flag = false; | 2061 header.public_header.version_flag = false; |
| 2036 header.rejected_packet_number = 10101; | 2062 header.rejected_packet_number = 10101; |
| 2037 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), | 2063 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), |
| 2038 Perspective::IS_SERVER); | 2064 Perspective::IS_SERVER); |
| 2039 std::unique_ptr<QuicEncryptedPacket> packet( | 2065 std::unique_ptr<QuicEncryptedPacket> packet( |
| 2040 framer.BuildPublicResetPacket(header)); | 2066 framer.BuildPublicResetPacket(header)); |
| 2041 // We must pause the server's thread in order to call WritePacket without | 2067 // We must pause the server's thread in order to call WritePacket without |
| 2042 // race conditions. | 2068 // race conditions. |
| 2043 server_thread_->Pause(); | 2069 server_thread_->Pause(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2056 // It should be ignored. | 2082 // It should be ignored. |
| 2057 TEST_P(EndToEndTest, ServerSendPublicResetWithDifferentConnectionId) { | 2083 TEST_P(EndToEndTest, ServerSendPublicResetWithDifferentConnectionId) { |
| 2058 ASSERT_TRUE(Initialize()); | 2084 ASSERT_TRUE(Initialize()); |
| 2059 | 2085 |
| 2060 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 2086 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 2061 | 2087 |
| 2062 // Send the public reset. | 2088 // Send the public reset. |
| 2063 QuicConnectionId incorrect_connection_id = | 2089 QuicConnectionId incorrect_connection_id = |
| 2064 client_->client()->session()->connection()->connection_id() + 1; | 2090 client_->client()->session()->connection()->connection_id() + 1; |
| 2065 QuicPublicResetPacket header; | 2091 QuicPublicResetPacket header; |
| 2066 header.public_header.connection_id = incorrect_connection_id; | 2092 header.public_header.connection_id = |
| 2093 GetPeerInMemoryConnectionId(incorrect_connection_id); |
| 2067 header.public_header.reset_flag = true; | 2094 header.public_header.reset_flag = true; |
| 2068 header.public_header.version_flag = false; | 2095 header.public_header.version_flag = false; |
| 2069 header.rejected_packet_number = 10101; | 2096 header.rejected_packet_number = 10101; |
| 2070 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), | 2097 QuicFramer framer(server_supported_versions_, QuicTime::Zero(), |
| 2071 Perspective::IS_SERVER); | 2098 Perspective::IS_SERVER); |
| 2072 std::unique_ptr<QuicEncryptedPacket> packet( | 2099 std::unique_ptr<QuicEncryptedPacket> packet( |
| 2073 framer.BuildPublicResetPacket(header)); | 2100 framer.BuildPublicResetPacket(header)); |
| 2074 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; | 2101 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; |
| 2075 client_->client()->session()->connection()->set_debug_visitor(&visitor); | 2102 client_->client()->session()->connection()->set_debug_visitor(&visitor); |
| 2076 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) | 2103 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. | 2148 // connection ID. It should be ignored. |
| 2122 TEST_P(EndToEndTest, ServerSendVersionNegotiationWithDifferentConnectionId) { | 2149 TEST_P(EndToEndTest, ServerSendVersionNegotiationWithDifferentConnectionId) { |
| 2123 ASSERT_TRUE(Initialize()); | 2150 ASSERT_TRUE(Initialize()); |
| 2124 | 2151 |
| 2125 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); | 2152 EXPECT_TRUE(client_->client()->WaitForCryptoHandshakeConfirmed()); |
| 2126 | 2153 |
| 2127 // Send the version negotiation packet. | 2154 // Send the version negotiation packet. |
| 2128 QuicConnectionId incorrect_connection_id = | 2155 QuicConnectionId incorrect_connection_id = |
| 2129 client_->client()->session()->connection()->connection_id() + 1; | 2156 client_->client()->session()->connection()->connection_id() + 1; |
| 2130 std::unique_ptr<QuicEncryptedPacket> packet( | 2157 std::unique_ptr<QuicEncryptedPacket> packet( |
| 2131 QuicFramer::BuildVersionNegotiationPacket(incorrect_connection_id, | 2158 QuicFramer::BuildVersionNegotiationPacket( |
| 2132 server_supported_versions_)); | 2159 GetPeerInMemoryConnectionId(incorrect_connection_id), |
| 2160 server_supported_versions_)); |
| 2133 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; | 2161 testing::NiceMock<MockQuicConnectionDebugVisitor> visitor; |
| 2134 client_->client()->session()->connection()->set_debug_visitor(&visitor); | 2162 client_->client()->session()->connection()->set_debug_visitor(&visitor); |
| 2135 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) | 2163 EXPECT_CALL(visitor, OnIncorrectConnectionId(incorrect_connection_id)) |
| 2136 .Times(1); | 2164 .Times(1); |
| 2137 // We must pause the server's thread in order to call WritePacket without | 2165 // We must pause the server's thread in order to call WritePacket without |
| 2138 // race conditions. | 2166 // race conditions. |
| 2139 server_thread_->Pause(); | 2167 server_thread_->Pause(); |
| 2140 server_writer_->WritePacket( | 2168 server_writer_->WritePacket( |
| 2141 packet->data(), packet->length(), server_address_.host(), | 2169 packet->data(), packet->length(), server_address_.host(), |
| 2142 client_->client()->GetLatestClientAddress(), nullptr); | 2170 client_->client()->GetLatestClientAddress(), nullptr); |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3098 client_->WaitForResponse(); | 3126 client_->WaitForResponse(); |
| 3099 EXPECT_EQ(kBarResponseBody, client_->response_body()); | 3127 EXPECT_EQ(kBarResponseBody, client_->response_body()); |
| 3100 QuicConnectionStats client_stats = | 3128 QuicConnectionStats client_stats = |
| 3101 client_->client()->session()->connection()->GetStats(); | 3129 client_->client()->session()->connection()->GetStats(); |
| 3102 EXPECT_EQ(0u, client_stats.packets_lost); | 3130 EXPECT_EQ(0u, client_stats.packets_lost); |
| 3103 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); | 3131 EXPECT_EQ(1, client_->client()->GetNumSentClientHellos()); |
| 3104 } | 3132 } |
| 3105 } // namespace | 3133 } // namespace |
| 3106 } // namespace test | 3134 } // namespace test |
| 3107 } // namespace net | 3135 } // namespace net |
| OLD | NEW |