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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 EXPECT_EQ(1, client->num_sent_client_hellos()); | 232 EXPECT_EQ(1, client->num_sent_client_hellos()); |
233 } | 233 } |
234 | 234 |
235 TEST_P(QuicCryptoServerStreamTest, MessageAfterHandshake) { | 235 TEST_P(QuicCryptoServerStreamTest, MessageAfterHandshake) { |
236 CompleteCryptoHandshake(); | 236 CompleteCryptoHandshake(); |
237 EXPECT_CALL(*connection_, SendConnectionClose( | 237 EXPECT_CALL(*connection_, SendConnectionClose( |
238 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE)); | 238 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE)); |
239 message_.set_tag(kCHLO); | 239 message_.set_tag(kCHLO); |
240 ConstructHandshakeMessage(); | 240 ConstructHandshakeMessage(); |
241 stream_.ProcessData(message_data_->data(), message_data_->length()); | 241 stream_.ProcessRawData(message_data_->data(), message_data_->length()); |
242 } | 242 } |
243 | 243 |
244 TEST_P(QuicCryptoServerStreamTest, BadMessageType) { | 244 TEST_P(QuicCryptoServerStreamTest, BadMessageType) { |
245 message_.set_tag(kSHLO); | 245 message_.set_tag(kSHLO); |
246 ConstructHandshakeMessage(); | 246 ConstructHandshakeMessage(); |
247 EXPECT_CALL(*connection_, SendConnectionClose( | 247 EXPECT_CALL(*connection_, SendConnectionClose( |
248 QUIC_INVALID_CRYPTO_MESSAGE_TYPE)); | 248 QUIC_INVALID_CRYPTO_MESSAGE_TYPE)); |
249 stream_.ProcessData(message_data_->data(), message_data_->length()); | 249 stream_.ProcessRawData(message_data_->data(), message_data_->length()); |
250 } | 250 } |
251 | 251 |
252 TEST_P(QuicCryptoServerStreamTest, WithoutCertificates) { | 252 TEST_P(QuicCryptoServerStreamTest, WithoutCertificates) { |
253 crypto_config_.SetProofSource(NULL); | 253 crypto_config_.SetProofSource(NULL); |
254 client_options_.dont_verify_certs = true; | 254 client_options_.dont_verify_certs = true; |
255 | 255 |
256 // Only 2 client hellos need to be sent in the no-certs case: one to get the | 256 // Only 2 client hellos need to be sent in the no-certs case: one to get the |
257 // source-address token and the second to finish. | 257 // source-address token and the second to finish. |
258 EXPECT_EQ(2, CompleteCryptoHandshake()); | 258 EXPECT_EQ(2, CompleteCryptoHandshake()); |
259 EXPECT_TRUE(stream_.encryption_established()); | 259 EXPECT_TRUE(stream_.encryption_established()); |
260 EXPECT_TRUE(stream_.handshake_confirmed()); | 260 EXPECT_TRUE(stream_.handshake_confirmed()); |
261 } | 261 } |
262 | 262 |
263 TEST_P(QuicCryptoServerStreamTest, ChannelID) { | 263 TEST_P(QuicCryptoServerStreamTest, ChannelID) { |
264 client_options_.channel_id_enabled = true; | 264 client_options_.channel_id_enabled = true; |
265 // TODO(rtenneti): Enable testing of ProofVerifier. | 265 // TODO(rtenneti): Enable testing of ProofVerifier. |
266 // CompleteCryptoHandshake verifies | 266 // CompleteCryptoHandshake verifies |
267 // stream_.crypto_negotiated_params().channel_id is correct. | 267 // stream_.crypto_negotiated_params().channel_id is correct. |
268 EXPECT_EQ(2, CompleteCryptoHandshake()); | 268 EXPECT_EQ(2, CompleteCryptoHandshake()); |
269 EXPECT_TRUE(stream_.encryption_established()); | 269 EXPECT_TRUE(stream_.encryption_established()); |
270 EXPECT_TRUE(stream_.handshake_confirmed()); | 270 EXPECT_TRUE(stream_.handshake_confirmed()); |
271 } | 271 } |
272 | 272 |
273 } // namespace | 273 } // namespace |
274 } // namespace test | 274 } // namespace test |
275 } // namespace net | 275 } // namespace net |
OLD | NEW |