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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 crypto_config_(QuicCryptoServerConfig::TESTING, | 60 crypto_config_(QuicCryptoServerConfig::TESTING, |
61 QuicRandom::GetInstance()), | 61 QuicRandom::GetInstance()), |
62 stream_(crypto_config_, &session_), | 62 stream_(crypto_config_, &session_), |
63 strike_register_client_(NULL) { | 63 strike_register_client_(NULL) { |
64 config_.SetDefaults(); | 64 config_.SetDefaults(); |
65 session_.config()->SetDefaults(); | 65 session_.config()->SetDefaults(); |
66 session_.SetCryptoStream(&stream_); | 66 session_.SetCryptoStream(&stream_); |
67 // We advance the clock initially because the default time is zero and the | 67 // We advance the clock initially because the default time is zero and the |
68 // strike register worries that we've just overflowed a uint32 time. | 68 // strike register worries that we've just overflowed a uint32 time. |
69 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); | 69 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); |
70 // TODO(rtenneti): Enable testing of ProofSource. | 70 // TODO(wtc): replace this with ProofSourceForTesting() when Chromium has |
71 // crypto_config_.SetProofSource(CryptoTestUtils::ProofSourceForTesting()); | 71 // a working ProofSourceForTesting(). |
| 72 crypto_config_.SetProofSource(CryptoTestUtils::MockProofSourceForTesting()); |
72 crypto_config_.set_strike_register_no_startup_period(); | 73 crypto_config_.set_strike_register_no_startup_period(); |
73 | 74 |
74 CryptoTestUtils::SetupCryptoServerConfigForTest( | 75 CryptoTestUtils::SetupCryptoServerConfigForTest( |
75 connection_->clock(), connection_->random_generator(), | 76 connection_->clock(), connection_->random_generator(), |
76 session_.config(), &crypto_config_); | 77 session_.config(), &crypto_config_); |
77 | 78 |
78 if (AsyncStrikeRegisterVerification()) { | 79 if (AsyncStrikeRegisterVerification()) { |
79 string orbit = | 80 string orbit = |
80 QuicCryptoServerConfigPeer::GetPrimaryOrbit(crypto_config_); | 81 QuicCryptoServerConfigPeer::GetPrimaryOrbit(crypto_config_); |
81 strike_register_client_ = new DelayedVerifyStrikeRegisterClient( | 82 strike_register_client_ = new DelayedVerifyStrikeRegisterClient( |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // CompleteCryptoHandshake verifies | 258 // CompleteCryptoHandshake verifies |
258 // stream_.crypto_negotiated_params().channel_id is correct. | 259 // stream_.crypto_negotiated_params().channel_id is correct. |
259 EXPECT_EQ(2, CompleteCryptoHandshake()); | 260 EXPECT_EQ(2, CompleteCryptoHandshake()); |
260 EXPECT_TRUE(stream_.encryption_established()); | 261 EXPECT_TRUE(stream_.encryption_established()); |
261 EXPECT_TRUE(stream_.handshake_confirmed()); | 262 EXPECT_TRUE(stream_.handshake_confirmed()); |
262 } | 263 } |
263 | 264 |
264 } // namespace | 265 } // namespace |
265 } // namespace test | 266 } // namespace test |
266 } // namespace net | 267 } // namespace net |
OLD | NEW |