Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: net/quic/core/quic_crypto_client_stream_test.cc

Issue 2487613002: Landing Recent QUIC changes until 12:43 PM, Nov 5, 2016 UTC+8 (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_crypto_server_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_peer.h"
17 #include "net/quic/test_tools/quic_stream_sequencer_peer.h" 18 #include "net/quic/test_tools/quic_stream_sequencer_peer.h"
18 #include "net/quic/test_tools/quic_test_utils.h" 19 #include "net/quic/test_tools/quic_test_utils.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 25
26 using testing::_; 26 using testing::_;
27 27
28 namespace net { 28 namespace net {
29 namespace test { 29 namespace test {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 stream()->OnStreamFrame(QuicStreamFrame(kCryptoStreamId, /*fin=*/false, 221 stream()->OnStreamFrame(QuicStreamFrame(kCryptoStreamId, /*fin=*/false,
222 /*offset=*/0, data->AsStringPiece())); 222 /*offset=*/0, data->AsStringPiece()));
223 223
224 // Make sure that the STK and SCFG are cached correctly. 224 // Make sure that the STK and SCFG are cached correctly.
225 EXPECT_EQ("xstk", state->source_address_token()); 225 EXPECT_EQ("xstk", state->source_address_token());
226 226
227 const string& cached_scfg = state->server_config(); 227 const string& cached_scfg = state->server_config();
228 test::CompareCharArraysWithHexError( 228 test::CompareCharArraysWithHexError(
229 "scfg", cached_scfg.data(), cached_scfg.length(), 229 "scfg", cached_scfg.data(), cached_scfg.length(),
230 QuicUtils::AsChars(scfg), arraysize(scfg)); 230 QuicUtils::AsChars(scfg), arraysize(scfg));
231 QuicStreamSequencer* sequencer = ReliableQuicStreamPeer::sequencer(stream()); 231 QuicStreamSequencer* sequencer = QuicStreamPeer::sequencer(stream());
232 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer && 232 EXPECT_NE(FLAGS_quic_release_crypto_stream_buffer,
233 FLAGS_quic_reduce_sequencer_buffer_memory_life_time,
234 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer)); 233 QuicStreamSequencerPeer::IsUnderlyingBufferAllocated(sequencer));
235 } 234 }
236 235
237 TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateBeforeHandshake) { 236 TEST_F(QuicCryptoClientStreamTest, ServerConfigUpdateBeforeHandshake) {
238 EXPECT_CALL( 237 EXPECT_CALL(
239 *connection_, 238 *connection_,
240 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE, _, _)); 239 CloseConnection(QUIC_CRYPTO_UPDATE_BEFORE_HANDSHAKE_COMPLETE, _, _));
241 CryptoHandshakeMessage server_config_update; 240 CryptoHandshakeMessage server_config_update;
242 server_config_update.set_tag(kSCUP); 241 server_config_update.set_tag(kSCUP);
243 std::unique_ptr<QuicData> data( 242 std::unique_ptr<QuicData> data(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 client_state->GetNextServerDesignatedConnectionId(); 388 client_state->GetNextServerDesignatedConnectionId();
390 QuicConnectionId expected_id = 389 QuicConnectionId expected_id =
391 server_session_->connection()->random_generator()->RandUint64(); 390 server_session_->connection()->random_generator()->RandUint64();
392 EXPECT_EQ(expected_id, server_designated_id); 391 EXPECT_EQ(expected_id, server_designated_id);
393 EXPECT_FALSE(client_state->has_server_designated_connection_id()); 392 EXPECT_FALSE(client_state->has_server_designated_connection_id());
394 } 393 }
395 394
396 } // namespace 395 } // namespace
397 } // namespace test 396 } // namespace test
398 } // namespace net 397 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_crypto_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698