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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 | 125 |
126 TEST_P(QuicCryptoServerStreamTest, ConnectedAfterCHLO) { | 126 TEST_P(QuicCryptoServerStreamTest, ConnectedAfterCHLO) { |
127 // CompleteCryptoHandshake returns the number of client hellos sent. This | 127 // CompleteCryptoHandshake returns the number of client hellos sent. This |
128 // test should send: | 128 // test should send: |
129 // * One to get a source-address token and certificates. | 129 // * One to get a source-address token and certificates. |
130 // * One to complete the handshake. | 130 // * One to complete the handshake. |
131 EXPECT_EQ(2, CompleteCryptoHandshake()); | 131 EXPECT_EQ(2, CompleteCryptoHandshake()); |
132 EXPECT_TRUE(stream_.encryption_established()); | 132 EXPECT_TRUE(stream_.encryption_established()); |
133 EXPECT_TRUE(stream_.handshake_confirmed()); | 133 EXPECT_TRUE(stream_.handshake_confirmed()); |
| 134 EXPECT_EQ(1, stream_.num_server_config_update_messages_sent()); |
134 } | 135 } |
135 | 136 |
136 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { | 137 TEST_P(QuicCryptoServerStreamTest, ZeroRTT) { |
137 PacketSavingConnection* client_conn = new PacketSavingConnection(false); | 138 PacketSavingConnection* client_conn = new PacketSavingConnection(false); |
138 PacketSavingConnection* server_conn = new PacketSavingConnection(false); | 139 PacketSavingConnection* server_conn = new PacketSavingConnection(false); |
139 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); | 140 client_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); |
140 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); | 141 server_conn->AdvanceTime(QuicTime::Delta::FromSeconds(100000)); |
141 | 142 |
142 QuicConfig client_config; | 143 QuicConfig client_config; |
143 client_config.SetDefaults(); | 144 client_config.SetDefaults(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 EXPECT_EQ(1u, messages_moved.first); | 217 EXPECT_EQ(1u, messages_moved.first); |
217 EXPECT_EQ(1u, messages_moved.second); | 218 EXPECT_EQ(1u, messages_moved.second); |
218 EXPECT_TRUE(client->handshake_confirmed()); | 219 EXPECT_TRUE(client->handshake_confirmed()); |
219 EXPECT_TRUE(server->handshake_confirmed()); | 220 EXPECT_TRUE(server->handshake_confirmed()); |
220 } else { | 221 } else { |
221 CryptoTestUtils::CommunicateHandshakeMessages( | 222 CryptoTestUtils::CommunicateHandshakeMessages( |
222 client_conn, client.get(), server_conn, server.get()); | 223 client_conn, client.get(), server_conn, server.get()); |
223 } | 224 } |
224 | 225 |
225 EXPECT_EQ(1, client->num_sent_client_hellos()); | 226 EXPECT_EQ(1, client->num_sent_client_hellos()); |
| 227 EXPECT_EQ(1, server->num_server_config_update_messages_sent()); |
226 } | 228 } |
227 | 229 |
228 TEST_P(QuicCryptoServerStreamTest, MessageAfterHandshake) { | 230 TEST_P(QuicCryptoServerStreamTest, MessageAfterHandshake) { |
229 CompleteCryptoHandshake(); | 231 CompleteCryptoHandshake(); |
230 EXPECT_CALL(*connection_, SendConnectionClose( | 232 EXPECT_CALL(*connection_, SendConnectionClose( |
231 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE)); | 233 QUIC_CRYPTO_MESSAGE_AFTER_HANDSHAKE_COMPLETE)); |
232 message_.set_tag(kCHLO); | 234 message_.set_tag(kCHLO); |
233 ConstructHandshakeMessage(); | 235 ConstructHandshakeMessage(); |
234 stream_.ProcessRawData(message_data_->data(), message_data_->length()); | 236 stream_.ProcessRawData(message_data_->data(), message_data_->length()); |
235 } | 237 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // CompleteCryptoHandshake verifies | 271 // CompleteCryptoHandshake verifies |
270 // stream_.crypto_negotiated_params().channel_id is correct. | 272 // stream_.crypto_negotiated_params().channel_id is correct. |
271 EXPECT_EQ(2, CompleteCryptoHandshake()); | 273 EXPECT_EQ(2, CompleteCryptoHandshake()); |
272 EXPECT_TRUE(stream_.encryption_established()); | 274 EXPECT_TRUE(stream_.encryption_established()); |
273 EXPECT_TRUE(stream_.handshake_confirmed()); | 275 EXPECT_TRUE(stream_.handshake_confirmed()); |
274 } | 276 } |
275 | 277 |
276 } // namespace | 278 } // namespace |
277 } // namespace test | 279 } // namespace test |
278 } // namespace net | 280 } // namespace net |
OLD | NEW |