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 <string> |
| 8 |
7 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
8 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
9 #include "net/quic/crypto/quic_decrypter.h" | 11 #include "net/quic/crypto/quic_decrypter.h" |
10 #include "net/quic/crypto/quic_encrypter.h" | 12 #include "net/quic/crypto/quic_encrypter.h" |
11 #include "net/quic/quic_flags.h" | 13 #include "net/quic/quic_flags.h" |
12 #include "net/quic/quic_protocol.h" | 14 #include "net/quic/quic_protocol.h" |
13 #include "net/quic/quic_server_id.h" | 15 #include "net/quic/quic_server_id.h" |
14 #include "net/quic/quic_utils.h" | 16 #include "net/quic/quic_utils.h" |
15 #include "net/quic/test_tools/crypto_test_utils.h" | 17 #include "net/quic/test_tools/crypto_test_utils.h" |
16 #include "net/quic/test_tools/quic_test_utils.h" | 18 #include "net/quic/test_tools/quic_test_utils.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 server_config_update.SetValue(kSourceAddressTokenTag, stk); | 178 server_config_update.SetValue(kSourceAddressTokenTag, stk); |
177 server_config_update.SetValue(kSCFG, scfg); | 179 server_config_update.SetValue(kSCFG, scfg); |
178 | 180 |
179 scoped_ptr<QuicData> data( | 181 scoped_ptr<QuicData> data( |
180 CryptoFramer::ConstructHandshakeMessage(server_config_update)); | 182 CryptoFramer::ConstructHandshakeMessage(server_config_update)); |
181 stream_->ProcessRawData(data->data(), data->length()); | 183 stream_->ProcessRawData(data->data(), data->length()); |
182 | 184 |
183 // Make sure that the STK and SCFG are cached correctly. | 185 // Make sure that the STK and SCFG are cached correctly. |
184 EXPECT_EQ("xstk", state->source_address_token()); | 186 EXPECT_EQ("xstk", state->source_address_token()); |
185 | 187 |
186 string cached_scfg = state->server_config(); | 188 std::string cached_scfg = state->server_config(); |
187 test::CompareCharArraysWithHexError( | 189 test::CompareCharArraysWithHexError( |
188 "scfg", cached_scfg.data(), cached_scfg.length(), | 190 "scfg", cached_scfg.data(), cached_scfg.length(), |
189 QuicUtils::AsChars(scfg), arraysize(scfg)); | 191 QuicUtils::AsChars(scfg), arraysize(scfg)); |
190 } | 192 } |
191 | 193 |
192 TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateBeforeHandshake) { | 194 TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateBeforeHandshake) { |
193 EXPECT_CALL(*connection_, SendConnectionClose( | 195 EXPECT_CALL(*connection_, SendConnectionClose( |
194 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE)); | 196 QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE)); |
195 CryptoHandshakeMessage server_config_update; | 197 CryptoHandshakeMessage server_config_update; |
196 server_config_update.set_tag(kSCUP); | 198 server_config_update.set_tag(kSCUP); |
197 scoped_ptr<QuicData> data( | 199 scoped_ptr<QuicData> data( |
198 CryptoFramer::ConstructHandshakeMessage(server_config_update)); | 200 CryptoFramer::ConstructHandshakeMessage(server_config_update)); |
199 stream_->ProcessRawData(data->data(), data->length()); | 201 stream_->ProcessRawData(data->data(), data->length()); |
200 } | 202 } |
201 | 203 |
202 } // namespace | 204 } // namespace |
203 } // namespace test | 205 } // namespace test |
204 } // namespace net | 206 } // namespace net |
OLD | NEW |