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/quic/quic_crypto_server_stream.h" | 5 #include "net/quic/quic_crypto_server_stream.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 static bool DoesPeerSupportStatelessRejects( | 55 static bool DoesPeerSupportStatelessRejects( |
56 const CryptoHandshakeMessage& message) { | 56 const CryptoHandshakeMessage& message) { |
57 return net::QuicCryptoServerStream::DoesPeerSupportStatelessRejects( | 57 return net::QuicCryptoServerStream::DoesPeerSupportStatelessRejects( |
58 message); | 58 message); |
59 } | 59 } |
60 }; | 60 }; |
61 | 61 |
62 namespace { | 62 namespace { |
63 | 63 |
64 const char kServerHostname[] = "test.example.com"; | 64 const char kServerHostname[] = "test.example.com"; |
65 const uint16 kServerPort = 443; | 65 const uint16_t kServerPort = 443; |
66 | 66 |
67 class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> { | 67 class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> { |
68 public: | 68 public: |
69 QuicCryptoServerStreamTest() | 69 QuicCryptoServerStreamTest() |
70 : server_crypto_config_(QuicCryptoServerConfig::TESTING, | 70 : server_crypto_config_(QuicCryptoServerConfig::TESTING, |
71 QuicRandom::GetInstance(), | 71 QuicRandom::GetInstance(), |
72 CryptoTestUtils::ProofSourceForTesting()), | 72 CryptoTestUtils::ProofSourceForTesting()), |
73 server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED), | 73 server_id_(kServerHostname, kServerPort, PRIVACY_MODE_DISABLED), |
74 client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) { | 74 client_crypto_config_(CryptoTestUtils::ProofVerifierForTesting()) { |
75 FLAGS_enable_quic_stateless_reject_support = false; | 75 FLAGS_enable_quic_stateless_reject_support = false; |
76 server_crypto_config_.set_strike_register_no_startup_period(); | 76 server_crypto_config_.set_strike_register_no_startup_period(); |
77 } | 77 } |
78 | 78 |
79 void Initialize() { | 79 void Initialize() { |
80 InitializeServer(); | 80 InitializeServer(); |
81 | 81 |
82 if (AsyncStrikeRegisterVerification()) { | 82 if (AsyncStrikeRegisterVerification()) { |
83 string orbit = | 83 string orbit = |
84 QuicCryptoServerConfigPeer::GetPrimaryOrbit(server_crypto_config_); | 84 QuicCryptoServerConfigPeer::GetPrimaryOrbit(server_crypto_config_); |
85 strike_register_client_ = new DelayedVerifyStrikeRegisterClient( | 85 strike_register_client_ = new DelayedVerifyStrikeRegisterClient( |
86 10000, // strike_register_max_entries | 86 10000, // strike_register_max_entries |
87 static_cast<uint32>( | 87 static_cast<uint32_t>( |
88 server_connection_->clock()->WallNow().ToUNIXSeconds()), | 88 server_connection_->clock()->WallNow().ToUNIXSeconds()), |
89 60, // strike_register_window_secs | 89 60, // strike_register_window_secs |
90 reinterpret_cast<const uint8*>(orbit.data()), | 90 reinterpret_cast<const uint8_t*>(orbit.data()), |
91 StrikeRegister::NO_STARTUP_PERIOD_NEEDED); | 91 StrikeRegister::NO_STARTUP_PERIOD_NEEDED); |
92 strike_register_client_->StartDelayingVerification(); | 92 strike_register_client_->StartDelayingVerification(); |
93 server_crypto_config_.SetStrikeRegisterClient(strike_register_client_); | 93 server_crypto_config_.SetStrikeRegisterClient(strike_register_client_); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 ~QuicCryptoServerStreamTest() override { STLDeleteElements(&helpers_); } | 97 ~QuicCryptoServerStreamTest() override { STLDeleteElements(&helpers_); } |
98 | 98 |
99 // Initializes the crypto server stream state for testing. May be | 99 // Initializes the crypto server stream state for testing. May be |
100 // called multiple times. | 100 // called multiple times. |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 /*from_peer=*/true); | 511 /*from_peer=*/true); |
512 | 512 |
513 // The outstanding nonce verification RPC now completes. | 513 // The outstanding nonce verification RPC now completes. |
514 strike_register_client_->RunPendingVerifications(); | 514 strike_register_client_->RunPendingVerifications(); |
515 } | 515 } |
516 | 516 |
517 } // namespace | 517 } // namespace |
518 | 518 |
519 } // namespace test | 519 } // namespace test |
520 } // namespace net | 520 } // namespace net |
OLD | NEW |