Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: net/tools/quic/stateless_rejector_test.cc

Issue 2907743003: Change CryptoHandshakeMessage::GetTaglist to tag a QuicTagVector* (Closed)
Patch Set: fix QuicConfig Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "net/quic/core/crypto/crypto_handshake_message.h" 10 #include "net/quic/core/crypto/crypto_handshake_message.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 233
234 // The StatelessRejector is undecided - proceed with async processing 234 // The StatelessRejector is undecided - proceed with async processing
235 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); 235 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state());
236 StatelessRejector::Process(std::move(rejector_), 236 StatelessRejector::Process(std::move(rejector_),
237 QuicMakeUnique<ProcessDoneCallback>(this)); 237 QuicMakeUnique<ProcessDoneCallback>(this));
238 238
239 ASSERT_EQ(StatelessRejector::REJECTED, rejector_->state()); 239 ASSERT_EQ(StatelessRejector::REJECTED, rejector_->state());
240 const CryptoHandshakeMessage& reply = rejector_->reply(); 240 const CryptoHandshakeMessage& reply = rejector_->reply();
241 EXPECT_EQ(kSREJ, reply.tag()); 241 EXPECT_EQ(kSREJ, reply.tag());
242 const uint32_t* reject_reasons; 242 QuicTagVector reject_reasons;
243 size_t num_reject_reasons; 243 EXPECT_EQ(QUIC_NO_ERROR, reply.GetTaglist(kRREJ, &reject_reasons));
244 EXPECT_EQ(QUIC_NO_ERROR, 244 EXPECT_EQ(1u, reject_reasons.size());
245 reply.GetTaglist(kRREJ, &reject_reasons, &num_reject_reasons));
246 EXPECT_EQ(1u, num_reject_reasons);
247 EXPECT_EQ(INVALID_EXPECTED_LEAF_CERTIFICATE, 245 EXPECT_EQ(INVALID_EXPECTED_LEAF_CERTIFICATE,
248 static_cast<HandshakeFailureReason>(reject_reasons[0])); 246 static_cast<HandshakeFailureReason>(reject_reasons[0]));
249 } 247 }
250 248
251 TEST_P(StatelessRejectorTest, AcceptChlo) { 249 TEST_P(StatelessRejectorTest, AcceptChlo) {
252 const uint64_t xlct = crypto_test_utils::LeafCertHashForTesting(); 250 const uint64_t xlct = crypto_test_utils::LeafCertHashForTesting();
253 const string xlct_hex = 251 const string xlct_hex =
254 "#" + QuicTextUtils::HexEncode(reinterpret_cast<const char*>(&xlct), 252 "#" + QuicTextUtils::HexEncode(reinterpret_cast<const char*>(&xlct),
255 sizeof(xlct)); 253 sizeof(xlct));
256 // clang-format off 254 // clang-format off
(...skipping 22 matching lines...) Expand all
279 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state()); 277 ASSERT_EQ(StatelessRejector::UNKNOWN, rejector_->state());
280 StatelessRejector::Process(std::move(rejector_), 278 StatelessRejector::Process(std::move(rejector_),
281 QuicMakeUnique<ProcessDoneCallback>(this)); 279 QuicMakeUnique<ProcessDoneCallback>(this));
282 280
283 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state()); 281 EXPECT_EQ(StatelessRejector::ACCEPTED, rejector_->state());
284 } 282 }
285 283
286 } // namespace 284 } // namespace
287 } // namespace test 285 } // namespace test
288 } // namespace net 286 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698