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_client_stream.h" | 5 #include "net/quic/quic_crypto_client_stream.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 8 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
9 #include "net/quic/crypto/quic_decrypter.h" | 9 #include "net/quic/crypto/quic_decrypter.h" |
10 #include "net/quic/crypto/quic_encrypter.h" | 10 #include "net/quic/crypto/quic_encrypter.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 CryptoTestUtils::HandshakeWithFakeServer(&helper_, connection_, stream()); | 51 CryptoTestUtils::HandshakeWithFakeServer(&helper_, connection_, stream()); |
52 } | 52 } |
53 | 53 |
54 void ConstructHandshakeMessage() { | 54 void ConstructHandshakeMessage() { |
55 CryptoFramer framer; | 55 CryptoFramer framer; |
56 message_data_.reset(framer.ConstructHandshakeMessage(message_)); | 56 message_data_.reset(framer.ConstructHandshakeMessage(message_)); |
57 } | 57 } |
58 | 58 |
59 QuicCryptoClientStream* stream() { return session_->GetCryptoStream(); } | 59 QuicCryptoClientStream* stream() { return session_->GetCryptoStream(); } |
60 | 60 |
61 MockHelper helper_; | 61 MockConnectionHelper helper_; |
62 PacketSavingConnection* connection_; | 62 PacketSavingConnection* connection_; |
63 scoped_ptr<TestQuicSpdyClientSession> session_; | 63 scoped_ptr<TestQuicSpdyClientSession> session_; |
64 QuicServerId server_id_; | 64 QuicServerId server_id_; |
65 CryptoHandshakeMessage message_; | 65 CryptoHandshakeMessage message_; |
66 scoped_ptr<QuicData> message_data_; | 66 scoped_ptr<QuicData> message_data_; |
67 QuicCryptoClientConfig crypto_config_; | 67 QuicCryptoClientConfig crypto_config_; |
68 }; | 68 }; |
69 | 69 |
70 TEST_F(QuicCryptoClientStreamTest, NotInitiallyConected) { | 70 TEST_F(QuicCryptoClientStreamTest, NotInitiallyConected) { |
71 EXPECT_FALSE(stream()->encryption_established()); | 71 EXPECT_FALSE(stream()->encryption_established()); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 &helper_, &server_crypto_config_, | 233 &helper_, &server_crypto_config_, |
234 &server_connection_, &server_session); | 234 &server_connection_, &server_session); |
235 CHECK(server_session); | 235 CHECK(server_session); |
236 server_session_.reset(server_session); | 236 server_session_.reset(server_session); |
237 CryptoTestUtils::SetupCryptoServerConfigForTest( | 237 CryptoTestUtils::SetupCryptoServerConfigForTest( |
238 server_connection_->clock(), server_connection_->random_generator(), | 238 server_connection_->clock(), server_connection_->random_generator(), |
239 server_session_->config(), &server_crypto_config_); | 239 server_session_->config(), &server_crypto_config_); |
240 server_stream()->set_use_stateless_rejects_if_peer_supported(true); | 240 server_stream()->set_use_stateless_rejects_if_peer_supported(true); |
241 } | 241 } |
242 | 242 |
243 MockHelper helper_; | 243 MockConnectionHelper helper_; |
244 | 244 |
245 // Client crypto stream state | 245 // Client crypto stream state |
246 PacketSavingConnection* client_connection_; | 246 PacketSavingConnection* client_connection_; |
247 scoped_ptr<TestQuicSpdyClientSession> client_session_; | 247 scoped_ptr<TestQuicSpdyClientSession> client_session_; |
248 QuicCryptoClientConfig client_crypto_config_; | 248 QuicCryptoClientConfig client_crypto_config_; |
249 | 249 |
250 // Server crypto stream state | 250 // Server crypto stream state |
251 PacketSavingConnection* server_connection_; | 251 PacketSavingConnection* server_connection_; |
252 scoped_ptr<TestQuicSpdyServerSession> server_session_; | 252 scoped_ptr<TestQuicSpdyServerSession> server_session_; |
253 QuicCryptoServerConfig server_crypto_config_; | 253 QuicCryptoServerConfig server_crypto_config_; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 server_session_->connection()->random_generator()->RandUint64(); | 285 server_session_->connection()->random_generator()->RandUint64(); |
286 EXPECT_EQ(expected_id, server_designated_id); | 286 EXPECT_EQ(expected_id, server_designated_id); |
287 EXPECT_FALSE(client_state->has_server_designated_connection_id()); | 287 EXPECT_FALSE(client_state->has_server_designated_connection_id()); |
288 } | 288 } |
289 | 289 |
290 #endif | 290 #endif |
291 | 291 |
292 } // namespace | 292 } // namespace |
293 } // namespace test | 293 } // namespace test |
294 } // namespace net | 294 } // namespace net |
OLD | NEW |