| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 EXPECT_TRUE(stream_->handshake_confirmed()); | 63 EXPECT_TRUE(stream_->handshake_confirmed()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 TEST_F(QuicCryptoClientStreamTest, MessageAfterHandshake) { | 66 TEST_F(QuicCryptoClientStreamTest, MessageAfterHandshake) { |
| 67 CompleteCryptoHandshake(); | 67 CompleteCryptoHandshake(); |
| 68 | 68 |
| 69 EXPECT_CALL(*connection_, SendConnectionClose( | 69 EXPECT_CALL(*connection_, SendConnectionClose( |
| 70 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE)); | 70 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE)); |
| 71 message_.set_tag(kCHLO); | 71 message_.set_tag(kCHLO); |
| 72 ConstructHandshakeMessage(); | 72 ConstructHandshakeMessage(); |
| 73 stream_->ProcessData(message_data_->data(), message_data_->length()); | 73 stream_->ProcessRawData(message_data_->data(), message_data_->length()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 TEST_F(QuicCryptoClientStreamTest, BadMessageType) { | 76 TEST_F(QuicCryptoClientStreamTest, BadMessageType) { |
| 77 EXPECT_TRUE(stream_->CryptoConnect()); | 77 EXPECT_TRUE(stream_->CryptoConnect()); |
| 78 | 78 |
| 79 message_.set_tag(kCHLO); | 79 message_.set_tag(kCHLO); |
| 80 ConstructHandshakeMessage(); | 80 ConstructHandshakeMessage(); |
| 81 | 81 |
| 82 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails( | 82 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails( |
| 83 QUIC_INVALID_CRYPTO_MESSAGE_TYPE, "Expected REJ")); | 83 QUIC_INVALID_CRYPTO_MESSAGE_TYPE, "Expected REJ")); |
| 84 stream_->ProcessData(message_data_->data(), message_data_->length()); | 84 stream_->ProcessRawData(message_data_->data(), message_data_->length()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 TEST_F(QuicCryptoClientStreamTest, NegotiatedParameters) { | 87 TEST_F(QuicCryptoClientStreamTest, NegotiatedParameters) { |
| 88 CompleteCryptoHandshake(); | 88 CompleteCryptoHandshake(); |
| 89 | 89 |
| 90 const QuicConfig* config = session_->config(); | 90 const QuicConfig* config = session_->config(); |
| 91 EXPECT_EQ(kQBIC, config->congestion_control()); | 91 EXPECT_EQ(kQBIC, config->congestion_control()); |
| 92 EXPECT_EQ(kDefaultTimeoutSecs, | 92 EXPECT_EQ(kDefaultTimeoutSecs, |
| 93 config->idle_connection_state_lifetime().ToSeconds()); | 93 config->idle_connection_state_lifetime().ToSeconds()); |
| 94 EXPECT_EQ(kDefaultMaxStreamsPerConnection, | 94 EXPECT_EQ(kDefaultMaxStreamsPerConnection, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 // Check that a client hello was sent and that CryptoConnect doesn't fail | 131 // Check that a client hello was sent and that CryptoConnect doesn't fail |
| 132 // with an error. | 132 // with an error. |
| 133 EXPECT_TRUE(stream_->CryptoConnect()); | 133 EXPECT_TRUE(stream_->CryptoConnect()); |
| 134 ASSERT_EQ(1u, connection_->packets_.size()); | 134 ASSERT_EQ(1u, connection_->packets_.size()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace | 137 } // namespace |
| 138 } // namespace test | 138 } // namespace test |
| 139 } // namespace net | 139 } // namespace net |
| OLD | NEW |