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

Side by Side Diff: net/tools/quic/quic_server_session_test.cc

Issue 1138443003: Land Recent QUIC Changes until 05/13/2015 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile error fixes Created 5 years, 7 months 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/tools/quic/quic_server_session.cc ('k') | net/tools/quic/quic_time_wait_list_manager.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tools/quic/quic_server_session.h" 5 #include "net/tools/quic/quic_server_session.h"
6 6
7 #include "net/quic/crypto/quic_crypto_server_config.h" 7 #include "net/quic/crypto/quic_crypto_server_config.h"
8 #include "net/quic/crypto/quic_random.h" 8 #include "net/quic/crypto/quic_random.h"
9 #include "net/quic/proto/cached_network_parameters.pb.h" 9 #include "net/quic/proto/cached_network_parameters.pb.h"
10 #include "net/quic/quic_connection.h" 10 #include "net/quic/quic_connection.h"
11 #include "net/quic/quic_crypto_server_stream.h" 11 #include "net/quic/quic_crypto_server_stream.h"
12 #include "net/quic/quic_flags.h" 12 #include "net/quic/quic_flags.h"
13 #include "net/quic/quic_utils.h" 13 #include "net/quic/quic_utils.h"
14 #include "net/quic/test_tools/quic_config_peer.h" 14 #include "net/quic/test_tools/quic_config_peer.h"
15 #include "net/quic/test_tools/quic_connection_peer.h" 15 #include "net/quic/test_tools/quic_connection_peer.h"
16 #include "net/quic/test_tools/quic_data_stream_peer.h" 16 #include "net/quic/test_tools/quic_data_stream_peer.h"
17 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h" 17 #include "net/quic/test_tools/quic_sent_packet_manager_peer.h"
18 #include "net/quic/test_tools/quic_session_peer.h" 18 #include "net/quic/test_tools/quic_session_peer.h"
19 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h" 19 #include "net/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h"
20 #include "net/quic/test_tools/quic_test_utils.h" 20 #include "net/quic/test_tools/quic_test_utils.h"
21 #include "net/test/gtest_util.h"
21 #include "net/tools/quic/quic_spdy_server_stream.h" 22 #include "net/tools/quic/quic_spdy_server_stream.h"
22 #include "net/tools/quic/test_tools/quic_test_utils.h" 23 #include "net/tools/quic/test_tools/quic_test_utils.h"
23 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
24 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
25 26
26 using __gnu_cxx::vector; 27 using __gnu_cxx::vector;
27 using net::test::MockConnection; 28 using net::test::MockConnection;
28 using net::test::QuicConfigPeer; 29 using net::test::QuicConfigPeer;
29 using net::test::QuicConnectionPeer; 30 using net::test::QuicConnectionPeer;
30 using net::test::QuicDataStreamPeer; 31 using net::test::QuicDataStreamPeer;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 session_.get(), kMaxValidStreamId + 2)); 256 session_.get(), kMaxValidStreamId + 2));
256 } 257 }
257 258
258 TEST_P(QuicServerSessionTest, GetEvenIncomingError) { 259 TEST_P(QuicServerSessionTest, GetEvenIncomingError) {
259 // Incoming streams on the server session must be odd. 260 // Incoming streams on the server session must be odd.
260 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); 261 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID));
261 EXPECT_EQ(nullptr, 262 EXPECT_EQ(nullptr,
262 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), 4)); 263 QuicServerSessionPeer::GetIncomingDataStream(session_.get(), 4));
263 } 264 }
264 265
266 TEST_P(QuicServerSessionTest, GetStreamDisconnected) {
267 // Don't create new streams if the connection is disconnected.
268 QuicConnectionPeer::CloseConnection(connection_);
269 EXPECT_DFATAL(QuicServerSessionPeer::GetIncomingDataStream(session_.get(), 4),
270 "ShouldCreateIncomingDataStream called when disconnected");
271 }
272
265 TEST_P(QuicServerSessionTest, SetFecProtectionFromConfig) { 273 TEST_P(QuicServerSessionTest, SetFecProtectionFromConfig) {
266 ValueRestore<bool> old_flag(&FLAGS_enable_quic_fec, true); 274 ValueRestore<bool> old_flag(&FLAGS_enable_quic_fec, true);
267 275
268 // Set received config to have FEC connection option. 276 // Set received config to have FEC connection option.
269 QuicTagVector copt; 277 QuicTagVector copt;
270 copt.push_back(kFHDR); 278 copt.push_back(kFHDR);
271 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); 279 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt);
272 session_->OnConfigNegotiated(); 280 session_->OnConfigNegotiated();
273 281
274 // Verify that headers stream is always protected and data streams are 282 // Verify that headers stream is always protected and data streams are
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get())); 456 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get()));
449 session_->OnConfigNegotiated(); 457 session_->OnConfigNegotiated();
450 EXPECT_FALSE( 458 EXPECT_FALSE(
451 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get())); 459 QuicServerSessionPeer::IsBandwidthResumptionEnabled(session_.get()));
452 } 460 }
453 461
454 } // namespace 462 } // namespace
455 } // namespace test 463 } // namespace test
456 } // namespace tools 464 } // namespace tools
457 } // namespace net 465 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/quic_time_wait_list_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698