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" |
11 #include "net/quic/quic_protocol.h" | 11 #include "net/quic/quic_protocol.h" |
12 #include "net/quic/quic_socket_address_coder.h" | |
13 #include "net/quic/test_tools/crypto_test_utils.h" | 12 #include "net/quic/test_tools/crypto_test_utils.h" |
14 #include "net/quic/test_tools/quic_test_utils.h" | 13 #include "net/quic/test_tools/quic_test_utils.h" |
15 #include "net/quic/test_tools/simple_quic_framer.h" | 14 #include "net/quic/test_tools/simple_quic_framer.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 | 17 |
19 namespace net { | 18 namespace net { |
20 namespace test { | 19 namespace test { |
21 namespace { | 20 namespace { |
22 | 21 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 EXPECT_EQ(kDefaultTimeoutSecs, | 91 EXPECT_EQ(kDefaultTimeoutSecs, |
93 config->idle_connection_state_lifetime().ToSeconds()); | 92 config->idle_connection_state_lifetime().ToSeconds()); |
94 EXPECT_EQ(kDefaultMaxStreamsPerConnection, | 93 EXPECT_EQ(kDefaultMaxStreamsPerConnection, |
95 config->max_streams_per_connection()); | 94 config->max_streams_per_connection()); |
96 EXPECT_EQ(0, config->keepalive_timeout().ToSeconds()); | 95 EXPECT_EQ(0, config->keepalive_timeout().ToSeconds()); |
97 | 96 |
98 const QuicCryptoNegotiatedParameters& crypto_params( | 97 const QuicCryptoNegotiatedParameters& crypto_params( |
99 stream_->crypto_negotiated_params()); | 98 stream_->crypto_negotiated_params()); |
100 EXPECT_EQ(kAESG, crypto_params.aead); | 99 EXPECT_EQ(kAESG, crypto_params.aead); |
101 EXPECT_EQ(kC255, crypto_params.key_exchange); | 100 EXPECT_EQ(kC255, crypto_params.key_exchange); |
102 QuicSocketAddressCoder address_coder(IPEndPoint(TestPeerIPAddress(), | |
103 kTestPort)); | |
104 EXPECT_EQ(address_coder.Encode(), crypto_params.client_address); | |
105 } | 101 } |
106 | 102 |
107 TEST_F(QuicCryptoClientStreamTest, InvalidHostname) { | 103 TEST_F(QuicCryptoClientStreamTest, InvalidHostname) { |
108 stream_.reset(new QuicCryptoClientStream("invalid", session_.get(), | 104 stream_.reset(new QuicCryptoClientStream("invalid", session_.get(), |
109 &crypto_config_)); | 105 &crypto_config_)); |
110 session_->SetCryptoStream(stream_.get()); | 106 session_->SetCryptoStream(stream_.get()); |
111 | 107 |
112 CompleteCryptoHandshake(); | 108 CompleteCryptoHandshake(); |
113 EXPECT_TRUE(stream_->encryption_established()); | 109 EXPECT_TRUE(stream_->encryption_established()); |
114 EXPECT_TRUE(stream_->handshake_confirmed()); | 110 EXPECT_TRUE(stream_->handshake_confirmed()); |
(...skipping 18 matching lines...) Expand all Loading... |
133 | 129 |
134 // Check that a client hello was sent and that CryptoConnect doesn't fail | 130 // Check that a client hello was sent and that CryptoConnect doesn't fail |
135 // with an error. | 131 // with an error. |
136 EXPECT_TRUE(stream_->CryptoConnect()); | 132 EXPECT_TRUE(stream_->CryptoConnect()); |
137 ASSERT_EQ(1u, connection_->packets_.size()); | 133 ASSERT_EQ(1u, connection_->packets_.size()); |
138 } | 134 } |
139 | 135 |
140 } // namespace | 136 } // namespace |
141 } // namespace test | 137 } // namespace test |
142 } // namespace net | 138 } // namespace net |
OLD | NEW |