OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/stateless_rejector.h" | 5 #include "net/tools/quic/stateless_rejector.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // clang-format off | 169 // clang-format off |
170 const CryptoHandshakeMessage client_hello = CryptoTestUtils::Message( | 170 const CryptoHandshakeMessage client_hello = CryptoTestUtils::Message( |
171 "CHLO", | 171 "CHLO", |
172 "PDMD", "X509", | 172 "PDMD", "X509", |
173 "COPT", "SREJ", | 173 "COPT", "SREJ", |
174 nullptr); | 174 nullptr); |
175 // clang-format on | 175 // clang-format on |
176 rejector_->OnChlo(GetParam().version, kConnectionId, | 176 rejector_->OnChlo(GetParam().version, kConnectionId, |
177 kServerDesignateConnectionId, client_hello); | 177 kServerDesignateConnectionId, client_hello); |
178 | 178 |
179 if (GetParam().flags != ENABLED || GetParam().version <= QUIC_VERSION_32) { | 179 if (GetParam().flags != ENABLED) { |
180 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_->state()); | 180 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_->state()); |
181 return; | 181 return; |
182 } | 182 } |
183 | 183 |
184 // The StatelessRejector is undecided - proceed with async processing | 184 // The StatelessRejector is undecided - proceed with async processing |
185 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); | 185 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); |
186 StatelessRejector::Process(std::move(rejector_), | 186 StatelessRejector::Process(std::move(rejector_), |
187 base::MakeUnique<ProcessDoneCallback>(this)); | 187 base::MakeUnique<ProcessDoneCallback>(this)); |
188 | 188 |
189 EXPECT_EQ(StatelessRejector::FAILED, rejector_->state()); | 189 EXPECT_EQ(StatelessRejector::FAILED, rejector_->state()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 "PUBS", pubs_hex_.c_str(), | 221 "PUBS", pubs_hex_.c_str(), |
222 "NONC", nonc_hex_.c_str(), | 222 "NONC", nonc_hex_.c_str(), |
223 "#004b5453", stk_hex_.c_str(), | 223 "#004b5453", stk_hex_.c_str(), |
224 "VER\0", ver_hex_.c_str(), | 224 "VER\0", ver_hex_.c_str(), |
225 "$padding", static_cast<int>(kClientHelloMinimumSize), | 225 "$padding", static_cast<int>(kClientHelloMinimumSize), |
226 nullptr); | 226 nullptr); |
227 // clang-format on | 227 // clang-format on |
228 | 228 |
229 rejector_->OnChlo(GetParam().version, kConnectionId, | 229 rejector_->OnChlo(GetParam().version, kConnectionId, |
230 kServerDesignateConnectionId, client_hello); | 230 kServerDesignateConnectionId, client_hello); |
231 if (GetParam().flags != ENABLED || GetParam().version <= QUIC_VERSION_32) { | 231 if (GetParam().flags != ENABLED) { |
232 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_->state()); | 232 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_->state()); |
233 return; | 233 return; |
234 } | 234 } |
235 | 235 |
236 // The StatelessRejector is undecided - proceed with async processing | 236 // The StatelessRejector is undecided - proceed with async processing |
237 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); | 237 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); |
238 StatelessRejector::Process(std::move(rejector_), | 238 StatelessRejector::Process(std::move(rejector_), |
239 base::MakeUnique<ProcessDoneCallback>(this)); | 239 base::MakeUnique<ProcessDoneCallback>(this)); |
240 | 240 |
241 ASSERT_EQ(StatelessRejector::REJECTED, rejector_->state()); | 241 ASSERT_EQ(StatelessRejector::REJECTED, rejector_->state()); |
(...skipping 25 matching lines...) Expand all Loading... |
267 "NONC", nonc_hex_.c_str(), | 267 "NONC", nonc_hex_.c_str(), |
268 "#004b5453", stk_hex_.c_str(), | 268 "#004b5453", stk_hex_.c_str(), |
269 "VER\0", ver_hex_.c_str(), | 269 "VER\0", ver_hex_.c_str(), |
270 "XLCT", xlct_hex.c_str(), | 270 "XLCT", xlct_hex.c_str(), |
271 "$padding", static_cast<int>(kClientHelloMinimumSize), | 271 "$padding", static_cast<int>(kClientHelloMinimumSize), |
272 nullptr); | 272 nullptr); |
273 // clang-format on | 273 // clang-format on |
274 | 274 |
275 rejector_->OnChlo(GetParam().version, kConnectionId, | 275 rejector_->OnChlo(GetParam().version, kConnectionId, |
276 kServerDesignateConnectionId, client_hello); | 276 kServerDesignateConnectionId, client_hello); |
277 if (GetParam().flags != ENABLED || GetParam().version <= QUIC_VERSION_32) { | 277 if (GetParam().flags != ENABLED) { |
278 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_->state()); | 278 EXPECT_EQ(StatelessRejector::UNSUPPORTED, rejector_->state()); |
279 return; | 279 return; |
280 } | 280 } |
281 | 281 |
282 // The StatelessRejector is undecided - proceed with async processing | 282 // The StatelessRejector is undecided - proceed with async processing |
283 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); | 283 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); |
284 StatelessRejector::Process(std::move(rejector_), | 284 StatelessRejector::Process(std::move(rejector_), |
285 base::MakeUnique<ProcessDoneCallback>(this)); | 285 base::MakeUnique<ProcessDoneCallback>(this)); |
286 | 286 |
287 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state()); | 287 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state()); |
288 } | 288 } |
289 | 289 |
290 } // namespace | 290 } // namespace |
291 } // namespace test | 291 } // namespace test |
292 } // namespace net | 292 } // namespace net |
OLD | NEW |