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/tools/quic/quic_dispatcher.h" | 5 #include "net/tools/quic/quic_dispatcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 private: | 156 private: |
157 QuicDispatcher* dispatcher_; | 157 QuicDispatcher* dispatcher_; |
158 }; | 158 }; |
159 | 159 |
160 class QuicDispatcherTest : public ::testing::Test { | 160 class QuicDispatcherTest : public ::testing::Test { |
161 public: | 161 public: |
162 QuicDispatcherTest() | 162 QuicDispatcherTest() |
163 : helper_(&eps_, QuicAllocator::BUFFER_POOL), | 163 : helper_(&eps_, QuicAllocator::BUFFER_POOL), |
164 alarm_factory_(&eps_), | 164 alarm_factory_(&eps_), |
165 version_manager_(QuicSupportedVersions()), | 165 version_manager_(AllSupportedVersions()), |
166 crypto_config_(QuicCryptoServerConfig::TESTING, | 166 crypto_config_(QuicCryptoServerConfig::TESTING, |
167 QuicRandom::GetInstance(), | 167 QuicRandom::GetInstance(), |
168 CryptoTestUtils::ProofSourceForTesting()), | 168 CryptoTestUtils::ProofSourceForTesting()), |
169 dispatcher_(new TestDispatcher(config_, | 169 dispatcher_(new TestDispatcher(config_, |
170 &crypto_config_, | 170 &crypto_config_, |
171 &version_manager_, | 171 &version_manager_, |
172 &eps_)), | 172 &eps_)), |
173 time_wait_list_manager_(nullptr), | 173 time_wait_list_manager_(nullptr), |
174 session1_(nullptr), | 174 session1_(nullptr), |
175 session2_(nullptr), | 175 session2_(nullptr), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void ProcessPacket(IPEndPoint client_address, | 220 void ProcessPacket(IPEndPoint client_address, |
221 QuicConnectionId connection_id, | 221 QuicConnectionId connection_id, |
222 bool has_version_flag, | 222 bool has_version_flag, |
223 bool has_multipath_flag, | 223 bool has_multipath_flag, |
224 const string& data, | 224 const string& data, |
225 QuicConnectionIdLength connection_id_length, | 225 QuicConnectionIdLength connection_id_length, |
226 QuicPacketNumberLength packet_number_length, | 226 QuicPacketNumberLength packet_number_length, |
227 QuicPathId path_id, | 227 QuicPathId path_id, |
228 QuicPacketNumber packet_number) { | 228 QuicPacketNumber packet_number) { |
229 ProcessPacket(client_address, connection_id, has_version_flag, | 229 ProcessPacket(client_address, connection_id, has_version_flag, |
230 QuicSupportedVersions().front(), data, connection_id_length, | 230 CurrentSupportedVersions().front(), data, |
231 packet_number_length, packet_number); | 231 connection_id_length, packet_number_length, packet_number); |
232 } | 232 } |
233 | 233 |
234 // Processes a packet. | 234 // Processes a packet. |
235 void ProcessPacket(IPEndPoint client_address, | 235 void ProcessPacket(IPEndPoint client_address, |
236 QuicConnectionId connection_id, | 236 QuicConnectionId connection_id, |
237 bool has_version_flag, | 237 bool has_version_flag, |
238 QuicVersion version, | 238 QuicVersion version, |
239 const string& data, | 239 const string& data, |
240 QuicConnectionIdLength connection_id_length, | 240 QuicConnectionIdLength connection_id_length, |
241 QuicPacketNumberLength packet_number_length, | 241 QuicPacketNumberLength packet_number_length, |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 FLAGS_quic_use_cheap_stateless_rejects = | 1083 FLAGS_quic_use_cheap_stateless_rejects = |
1084 GetParam().support_cheap_stateless_reject; | 1084 GetParam().support_cheap_stateless_reject; |
1085 FLAGS_enable_quic_stateless_reject_support = | 1085 FLAGS_enable_quic_stateless_reject_support = |
1086 GetParam().enable_stateless_rejects_via_flag; | 1086 GetParam().enable_stateless_rejects_via_flag; |
1087 } | 1087 } |
1088 | 1088 |
1089 void SetUp() override { | 1089 void SetUp() override { |
1090 QuicDispatcherTest::SetUp(); | 1090 QuicDispatcherTest::SetUp(); |
1091 clock_ = QuicDispatcherPeer::GetHelper(dispatcher_.get())->GetClock(); | 1091 clock_ = QuicDispatcherPeer::GetHelper(dispatcher_.get())->GetClock(); |
1092 | 1092 |
1093 QuicVersion version = QuicSupportedVersions().front(); | 1093 QuicVersion version = AllSupportedVersions().front(); |
1094 CryptoHandshakeMessage chlo = CryptoTestUtils::GenerateDefaultInchoateCHLO( | 1094 CryptoHandshakeMessage chlo = CryptoTestUtils::GenerateDefaultInchoateCHLO( |
1095 clock_, version, &crypto_config_); | 1095 clock_, version, &crypto_config_); |
1096 chlo.SetVector(net::kCOPT, net::QuicTagVector{net::kSREJ}); | 1096 chlo.SetVector(net::kCOPT, net::QuicTagVector{net::kSREJ}); |
1097 // Pass an inchoate CHLO. | 1097 // Pass an inchoate CHLO. |
1098 CryptoTestUtils::GenerateFullCHLO( | 1098 CryptoTestUtils::GenerateFullCHLO( |
1099 chlo, &crypto_config_, server_ip_, client_addr_, version, clock_, | 1099 chlo, &crypto_config_, server_ip_, client_addr_, version, clock_, |
1100 &proof_, QuicDispatcherPeer::GetCache(dispatcher_.get()), &full_chlo_); | 1100 &proof_, QuicDispatcherPeer::GetCache(dispatcher_.get()), &full_chlo_); |
1101 } | 1101 } |
1102 | 1102 |
1103 string SerializeFullCHLO() { | 1103 string SerializeFullCHLO() { |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 // New arrived CHLO will be dropped because this connection is in time wait | 1278 // New arrived CHLO will be dropped because this connection is in time wait |
1279 // list. | 1279 // list. |
1280 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); | 1280 ASSERT_TRUE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); |
1281 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id, _, _)); | 1281 EXPECT_CALL(*time_wait_list_manager_, ProcessPacket(_, _, conn_id, _, _)); |
1282 ProcessPacket(client_address, conn_id, true, false, SerializeFullCHLO()); | 1282 ProcessPacket(client_address, conn_id, true, false, SerializeFullCHLO()); |
1283 } | 1283 } |
1284 | 1284 |
1285 } // namespace | 1285 } // namespace |
1286 } // namespace test | 1286 } // namespace test |
1287 } // namespace net | 1287 } // namespace net |
OLD | NEW |