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

Side by Side Diff: net/quic/quic_crypto_server_stream_test.cc

Issue 647933002: Call SetDefaults from the QuicConfig constructor instead of requiring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Allow_number_of_undecryptable_packets_76707156
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_end_to_end_unittest.cc » ('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) 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> { 55 class QuicCryptoServerStreamTest : public ::testing::TestWithParam<bool> {
56 public: 56 public:
57 QuicCryptoServerStreamTest() 57 QuicCryptoServerStreamTest()
58 : connection_(new PacketSavingConnection(true)), 58 : connection_(new PacketSavingConnection(true)),
59 session_(connection_, DefaultQuicConfig()), 59 session_(connection_, DefaultQuicConfig()),
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_(nullptr) { 63 strike_register_client_(nullptr) {
64 config_.SetDefaults();
65 session_.config()->SetDefaults();
66 session_.SetCryptoStream(&stream_); 64 session_.SetCryptoStream(&stream_);
67 // We advance the clock initially because the default time is zero and the 65 // 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. 66 // strike register worries that we've just overflowed a uint32 time.
69 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); 67 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(100000));
70 // TODO(wtc): replace this with ProofSourceForTesting() when Chromium has 68 // TODO(wtc): replace this with ProofSourceForTesting() when Chromium has
71 // a working ProofSourceForTesting(). 69 // a working ProofSourceForTesting().
72 crypto_config_.SetProofSource(CryptoTestUtils::FakeProofSourceForTesting()); 70 crypto_config_.SetProofSource(CryptoTestUtils::FakeProofSourceForTesting());
73 crypto_config_.set_strike_register_no_startup_period(); 71 crypto_config_.set_strike_register_no_startup_period();
74 72
75 CryptoTestUtils::SetupCryptoServerConfigForTest( 73 CryptoTestUtils::SetupCryptoServerConfigForTest(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 EXPECT_EQ(1, stream_.num_server_config_update_messages_sent()); 132 EXPECT_EQ(1, stream_.num_server_config_update_messages_sent());
135 } 133 }
136 134
137 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { 135 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) {
138 PacketSavingConnection* client_conn = new PacketSavingConnection(false); 136 PacketSavingConnection* client_conn = new PacketSavingConnection(false);
139 PacketSavingConnection* server_conn = new PacketSavingConnection(false); 137 PacketSavingConnection* server_conn = new PacketSavingConnection(false);
140 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); 138 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000));
141 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); 139 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000));
142 140
143 QuicConfig client_config; 141 QuicConfig client_config;
144 client_config.SetDefaults();
145 scoped_ptr<TestClientSession> client_session( 142 scoped_ptr<TestClientSession> client_session(
146 new TestClientSession(client_conn, client_config)); 143 new TestClientSession(client_conn, client_config));
147 QuicCryptoClientConfig client_crypto_config; 144 QuicCryptoClientConfig client_crypto_config;
148 client_crypto_config.SetDefaults();
149 145
150 QuicServerId server_id(kServerHostname, kServerPort, false, 146 QuicServerId server_id(kServerHostname, kServerPort, false,
151 PRIVACY_MODE_DISABLED); 147 PRIVACY_MODE_DISABLED);
152 scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream( 148 scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream(
153 server_id, client_session.get(), nullptr, &client_crypto_config)); 149 server_id, client_session.get(), nullptr, &client_crypto_config));
154 client_session->SetCryptoStream(client.get()); 150 client_session->SetCryptoStream(client.get());
155 151
156 // Do a first handshake in order to prime the client config with the server's 152 // Do a first handshake in order to prime the client config with the server's
157 // information. 153 // information.
158 CHECK(client->CryptoConnect()); 154 CHECK(client->CryptoConnect());
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 273
278 TEST_P(QuicCryptoServerStreamTest, OnlySendSCUPAfterHandshakeComplete) { 274 TEST_P(QuicCryptoServerStreamTest, OnlySendSCUPAfterHandshakeComplete) {
279 // An attempt to send a SCUP before completing handshake should fail. 275 // An attempt to send a SCUP before completing handshake should fail.
280 stream_.SendServerConfigUpdate(nullptr, false); 276 stream_.SendServerConfigUpdate(nullptr, false);
281 EXPECT_EQ(0, stream_.num_server_config_update_messages_sent()); 277 EXPECT_EQ(0, stream_.num_server_config_update_messages_sent());
282 } 278 }
283 279
284 } // namespace 280 } // namespace
285 } // namespace test 281 } // namespace test
286 } // namespace net 282 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_crypto_client_stream_test.cc ('k') | net/quic/quic_end_to_end_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698