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

Side by Side Diff: net/quic/crypto/crypto_server_test.cc

Issue 330333006: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linus_tsan error - reverted the change to ConnectionMigrationClientPortChanged unitttest Created 6 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/channel_id.h ('k') | net/quic/crypto/quic_crypto_client_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "crypto/secure_hash.h" 7 #include "crypto/secure_hash.h"
8 #include "net/quic/crypto/crypto_utils.h" 8 #include "net/quic/crypto/crypto_utils.h"
9 #include "net/quic/crypto/quic_crypto_server_config.h" 9 #include "net/quic/crypto/quic_crypto_server_config.h"
10 #include "net/quic/crypto/quic_random.h" 10 #include "net/quic/crypto/quic_random.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 new ValidateCallback(this, false, error_substr, called)); 175 new ValidateCallback(this, false, error_substr, called));
176 } 176 }
177 177
178 void ProcessValidationResult(const CryptoHandshakeMessage& message, 178 void ProcessValidationResult(const CryptoHandshakeMessage& message,
179 const ValidateCallback::Result& result, 179 const ValidateCallback::Result& result,
180 bool should_succeed, 180 bool should_succeed,
181 const char* error_substr) { 181 const char* error_substr) {
182 string error_details; 182 string error_details;
183 QuicErrorCode error = config_.ProcessClientHello( 183 QuicErrorCode error = config_.ProcessClientHello(
184 result, 1 /* ConnectionId */, client_address_, 184 result, 1 /* ConnectionId */, client_address_,
185 supported_versions_.front(), supported_versions_, 185 supported_versions_.front(), supported_versions_, &clock_, rand_,
186 kInitialFlowControlWindowForTest, &clock_, rand_, &params_, &out_, 186 &params_, &out_, &error_details);
187 &error_details);
188 187
189 if (should_succeed) { 188 if (should_succeed) {
190 ASSERT_EQ(error, QUIC_NO_ERROR) 189 ASSERT_EQ(error, QUIC_NO_ERROR)
191 << "Message failed with error " << error_details << ": " 190 << "Message failed with error " << error_details << ": "
192 << message.DebugString(); 191 << message.DebugString();
193 } else { 192 } else {
194 ASSERT_NE(error, QUIC_NO_ERROR) 193 ASSERT_NE(error, QUIC_NO_ERROR)
195 << "Message didn't fail: " << message.DebugString(); 194 << "Message didn't fail: " << message.DebugString();
196 195
197 EXPECT_TRUE(error_details.find(error_substr) != string::npos) 196 EXPECT_TRUE(error_details.find(error_substr) != string::npos)
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 ASSERT_FALSE(called); 515 ASSERT_FALSE(called);
517 EXPECT_EQ(1, strike_register_client_->PendingVerifications()); 516 EXPECT_EQ(1, strike_register_client_->PendingVerifications());
518 517
519 strike_register_client_->RunPendingVerifications(); 518 strike_register_client_->RunPendingVerifications();
520 ASSERT_TRUE(called); 519 ASSERT_TRUE(called);
521 EXPECT_EQ(0, strike_register_client_->PendingVerifications()); 520 EXPECT_EQ(0, strike_register_client_->PendingVerifications());
522 // The message should be rejected now. 521 // The message should be rejected now.
523 EXPECT_EQ(kREJ, out_.tag()); 522 EXPECT_EQ(kREJ, out_.tag());
524 } 523 }
525 524
526 TEST_F(CryptoServerTest, InitialFlowControlWindow) {
527 // Test that the SHLO contains a value for initial flow control window.
528 CryptoHandshakeMessage msg = CryptoTestUtils::Message(
529 "CHLO",
530 "AEAD", "AESG",
531 "KEXS", "C255",
532 "SCID", scid_hex_.c_str(),
533 "#004b5453", srct_hex_.c_str(),
534 "PUBS", pub_hex_.c_str(),
535 "NONC", nonce_hex_.c_str(),
536 "VER\0", client_version_.data(),
537 "$padding", static_cast<int>(kClientHelloMinimumSize),
538 NULL);
539 ShouldSucceed(msg);
540 // The message should be rejected because the strike-register is still
541 // quiescent.
542 ASSERT_EQ(kREJ, out_.tag());
543 config_.set_replay_protection(false);
544
545 // The message should be accepted now.
546 ShouldSucceed(msg);
547 ASSERT_EQ(kSHLO, out_.tag());
548 CheckServerHello(out_);
549
550 // Ensure that the kIFCW tag is populated correctly.
551 QuicTag ifcw;
552 EXPECT_EQ(QUIC_NO_ERROR, out_.GetUint32(kIFCW, &ifcw));
553 EXPECT_EQ(kInitialFlowControlWindowForTest, ifcw);
554 }
555
556 } // namespace test 525 } // namespace test
557 } // namespace net 526 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/channel_id.h ('k') | net/quic/crypto/quic_crypto_client_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698