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/core/quic_crypto_client_stream.h" | 5 #include "net/quic/core/quic_crypto_client_stream.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" | 9 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" |
10 #include "net/quic/core/crypto/quic_decrypter.h" | 10 #include "net/quic/core/crypto/quic_decrypter.h" |
11 #include "net/quic/core/crypto/quic_encrypter.h" | 11 #include "net/quic/core/crypto/quic_encrypter.h" |
12 #include "net/quic/core/quic_flags.h" | 12 #include "net/quic/core/quic_flags.h" |
13 #include "net/quic/core/quic_protocol.h" | 13 #include "net/quic/core/quic_protocol.h" |
14 #include "net/quic/core/quic_server_id.h" | 14 #include "net/quic/core/quic_server_id.h" |
15 #include "net/quic/core/quic_utils.h" | 15 #include "net/quic/core/quic_utils.h" |
16 #include "net/quic/test_tools/crypto_test_utils.h" | 16 #include "net/quic/test_tools/crypto_test_utils.h" |
17 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" | 17 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" |
18 #include "net/quic/test_tools/quic_test_utils.h" | 18 #include "net/quic/test_tools/quic_test_utils.h" |
19 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 19 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
20 #include "net/quic/test_tools/simple_quic_framer.h" | 20 #include "net/quic/test_tools/simple_quic_framer.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 using std::string; | 24 using std::string; |
25 using std::vector; | |
26 | 25 |
27 using testing::_; | 26 using testing::_; |
28 | 27 |
29 namespace net { | 28 namespace net { |
30 namespace test { | 29 namespace test { |
31 namespace { | 30 namespace { |
32 | 31 |
33 const char kServerHostname[] = "test.example.com"; | 32 const char kServerHostname[] = "test.example.com"; |
34 const uint16_t kServerPort = 443; | 33 const uint16_t kServerPort = 443; |
35 | 34 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 TEST_F(QuicCryptoClientStreamTest, InvalidCachedServerConfig) { | 163 TEST_F(QuicCryptoClientStreamTest, InvalidCachedServerConfig) { |
165 // Seed the config with a cached server config. | 164 // Seed the config with a cached server config. |
166 CompleteCryptoHandshake(); | 165 CompleteCryptoHandshake(); |
167 | 166 |
168 // Recreate connection with the new config. | 167 // Recreate connection with the new config. |
169 CreateConnection(); | 168 CreateConnection(); |
170 | 169 |
171 QuicCryptoClientConfig::CachedState* state = | 170 QuicCryptoClientConfig::CachedState* state = |
172 crypto_config_.LookupOrCreate(server_id_); | 171 crypto_config_.LookupOrCreate(server_id_); |
173 | 172 |
174 vector<string> certs = state->certs(); | 173 std::vector<string> certs = state->certs(); |
175 string cert_sct = state->cert_sct(); | 174 string cert_sct = state->cert_sct(); |
176 string signature = state->signature(); | 175 string signature = state->signature(); |
177 string chlo_hash = state->chlo_hash(); | 176 string chlo_hash = state->chlo_hash(); |
178 state->SetProof(certs, cert_sct, chlo_hash, signature + signature); | 177 state->SetProof(certs, cert_sct, chlo_hash, signature + signature); |
179 | 178 |
180 stream()->CryptoConnect(); | 179 stream()->CryptoConnect(); |
181 // Check that a client hello was sent. | 180 // Check that a client hello was sent. |
182 ASSERT_EQ(1u, connection_->encrypted_packets_.size()); | 181 ASSERT_EQ(1u, connection_->encrypted_packets_.size()); |
183 } | 182 } |
184 | 183 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 client_state->GetNextServerDesignatedConnectionId(); | 390 client_state->GetNextServerDesignatedConnectionId(); |
392 QuicConnectionId expected_id = | 391 QuicConnectionId expected_id = |
393 server_session_->connection()->random_generator()->RandUint64(); | 392 server_session_->connection()->random_generator()->RandUint64(); |
394 EXPECT_EQ(expected_id, server_designated_id); | 393 EXPECT_EQ(expected_id, server_designated_id); |
395 EXPECT_FALSE(client_state->has_server_designated_connection_id()); | 394 EXPECT_FALSE(client_state->has_server_designated_connection_id()); |
396 } | 395 } |
397 | 396 |
398 } // namespace | 397 } // namespace |
399 } // namespace test | 398 } // namespace test |
400 } // namespace net | 399 } // namespace net |
OLD | NEW |