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

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

Issue 218923002: Merge internal change: 63891842 - QuicServerId changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); 138 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000));
139 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); 139 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000));
140 140
141 QuicConfig client_config; 141 QuicConfig client_config;
142 client_config.SetDefaults(); 142 client_config.SetDefaults();
143 scoped_ptr<TestClientSession> client_session( 143 scoped_ptr<TestClientSession> client_session(
144 new TestClientSession(client_conn, client_config)); 144 new TestClientSession(client_conn, client_config));
145 QuicCryptoClientConfig client_crypto_config; 145 QuicCryptoClientConfig client_crypto_config;
146 client_crypto_config.SetDefaults(); 146 client_crypto_config.SetDefaults();
147 147
148 QuicSessionKey server_key(kServerHostname, kServerPort, false, 148 QuicServerId server_id(kServerHostname, kServerPort, false,
149 kPrivacyModeDisabled); 149 kPrivacyModeDisabled);
150 scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream( 150 scoped_ptr<QuicCryptoClientStream> client(new QuicCryptoClientStream(
151 server_key, client_session.get(), NULL, &client_crypto_config)); 151 server_id, client_session.get(), NULL, &client_crypto_config));
152 client_session->SetCryptoStream(client.get()); 152 client_session->SetCryptoStream(client.get());
153 153
154 // Do a first handshake in order to prime the client config with the server's 154 // Do a first handshake in order to prime the client config with the server's
155 // information. 155 // information.
156 CHECK(client->CryptoConnect()); 156 CHECK(client->CryptoConnect());
157 CHECK_EQ(1u, client_conn->packets_.size()); 157 CHECK_EQ(1u, client_conn->packets_.size());
158 158
159 scoped_ptr<TestClientSession> server_session( 159 scoped_ptr<TestClientSession> server_session(
160 new TestClientSession(server_conn, config_)); 160 new TestClientSession(server_conn, config_));
161 scoped_ptr<QuicCryptoServerStream> server( 161 scoped_ptr<QuicCryptoServerStream> server(
(...skipping 13 matching lines...) Expand all
175 // authoritative in this time span. 175 // authoritative in this time span.
176 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000)); 176 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000));
177 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000)); 177 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(102000));
178 178
179 // This causes the client's nonce to be different and thus stops the 179 // This causes the client's nonce to be different and thus stops the
180 // strike-register from rejecting the repeated nonce. 180 // strike-register from rejecting the repeated nonce.
181 reinterpret_cast<MockRandom*>(client_conn->random_generator())->ChangeValue(); 181 reinterpret_cast<MockRandom*>(client_conn->random_generator())->ChangeValue();
182 client_session.reset(new TestClientSession(client_conn, client_config)); 182 client_session.reset(new TestClientSession(client_conn, client_config));
183 server_session.reset(new TestClientSession(server_conn, config_)); 183 server_session.reset(new TestClientSession(server_conn, config_));
184 client.reset(new QuicCryptoClientStream( 184 client.reset(new QuicCryptoClientStream(
185 server_key, client_session.get(), NULL, &client_crypto_config)); 185 server_id, client_session.get(), NULL, &client_crypto_config));
186 client_session->SetCryptoStream(client.get()); 186 client_session->SetCryptoStream(client.get());
187 187
188 server.reset(new QuicCryptoServerStream(crypto_config_, 188 server.reset(new QuicCryptoServerStream(crypto_config_,
189 server_session.get())); 189 server_session.get()));
190 server_session->SetCryptoStream(server.get()); 190 server_session->SetCryptoStream(server.get());
191 191
192 CHECK(client->CryptoConnect()); 192 CHECK(client->CryptoConnect());
193 193
194 if (AsyncStrikeRegisterVerification()) { 194 if (AsyncStrikeRegisterVerification()) {
195 EXPECT_FALSE(client->handshake_confirmed()); 195 EXPECT_FALSE(client->handshake_confirmed());
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 // CompleteCryptoHandshake verifies 259 // CompleteCryptoHandshake verifies
260 // stream_.crypto_negotiated_params().channel_id is correct. 260 // stream_.crypto_negotiated_params().channel_id is correct.
261 EXPECT_EQ(2, CompleteCryptoHandshake()); 261 EXPECT_EQ(2, CompleteCryptoHandshake());
262 EXPECT_TRUE(stream_.encryption_established()); 262 EXPECT_TRUE(stream_.encryption_established());
263 EXPECT_TRUE(stream_.handshake_confirmed()); 263 EXPECT_TRUE(stream_.handshake_confirmed());
264 } 264 }
265 265
266 } // namespace 266 } // namespace
267 } // namespace test 267 } // namespace test
268 } // namespace net 268 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698