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

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

Issue 648933003: Land Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with TOT Created 6 years, 2 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_spdy_client_stream_test.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 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/crypto/source_address_token.h" 9 #include "net/quic/crypto/source_address_token.h"
10 #include "net/quic/quic_connection.h" 10 #include "net/quic/quic_connection.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 namespace { 62 namespace {
63 63
64 const size_t kMaxStreamsForTest = 10; 64 const size_t kMaxStreamsForTest = 10;
65 65
66 class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> { 66 class QuicServerSessionTest : public ::testing::TestWithParam<QuicVersion> {
67 protected: 67 protected:
68 QuicServerSessionTest() 68 QuicServerSessionTest()
69 : crypto_config_(QuicCryptoServerConfig::TESTING, 69 : crypto_config_(QuicCryptoServerConfig::TESTING,
70 QuicRandom::GetInstance()) { 70 QuicRandom::GetInstance()) {
71 config_.SetDefaults();
72 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest, 71 config_.SetMaxStreamsPerConnection(kMaxStreamsForTest,
73 kMaxStreamsForTest); 72 kMaxStreamsForTest);
74 config_.SetInitialFlowControlWindowToSend( 73 config_.SetInitialFlowControlWindowToSend(
75 kInitialSessionFlowControlWindowForTest); 74 kInitialSessionFlowControlWindowForTest);
76 config_.SetInitialStreamFlowControlWindowToSend( 75 config_.SetInitialStreamFlowControlWindowToSend(
77 kInitialStreamFlowControlWindowForTest); 76 kInitialStreamFlowControlWindowForTest);
78 config_.SetInitialSessionFlowControlWindowToSend( 77 config_.SetInitialSessionFlowControlWindowToSend(
79 kInitialSessionFlowControlWindowForTest); 78 kInitialSessionFlowControlWindowForTest);
80 79
81 connection_ = 80 connection_ =
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 EXPECT_EQ(FEC_PROTECT_OPTIONAL, stream->fec_policy()); 287 EXPECT_EQ(FEC_PROTECT_OPTIONAL, stream->fec_policy());
289 } 288 }
290 289
291 class MockQuicCryptoServerStream : public QuicCryptoServerStream { 290 class MockQuicCryptoServerStream : public QuicCryptoServerStream {
292 public: 291 public:
293 explicit MockQuicCryptoServerStream( 292 explicit MockQuicCryptoServerStream(
294 const QuicCryptoServerConfig& crypto_config, QuicSession* session) 293 const QuicCryptoServerConfig& crypto_config, QuicSession* session)
295 : QuicCryptoServerStream(crypto_config, session) {} 294 : QuicCryptoServerStream(crypto_config, session) {}
296 virtual ~MockQuicCryptoServerStream() {} 295 virtual ~MockQuicCryptoServerStream() {}
297 296
298 MOCK_METHOD1(SendServerConfigUpdate, 297 MOCK_METHOD2(SendServerConfigUpdate,
299 void(const CachedNetworkParameters* cached_network_parameters)); 298 void(const CachedNetworkParameters* cached_network_parameters,
299 bool on_handshake_complete));
300
300 private: 301 private:
301 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); 302 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream);
302 }; 303 };
303 304
304 TEST_P(QuicServerSessionTest, BandwidthEstimates) { 305 TEST_P(QuicServerSessionTest, BandwidthEstimates) {
305 if (version() <= QUIC_VERSION_21) { 306 if (version() <= QUIC_VERSION_21) {
306 return; 307 return;
307 } 308 }
308 // Test that bandwidth estimate updates are sent to the client, only after the 309 // Test that bandwidth estimate updates are sent to the client, only after the
309 // bandwidth estimate has changes sufficiently, and enough time has passed. 310 // bandwidth estimate has changes sufficiently, and enough time has passed.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 .GetRttStats() 359 .GetRttStats()
359 ->min_rtt() 360 ->min_rtt()
360 .ToMilliseconds()); 361 .ToMilliseconds());
361 expected_network_params.set_previous_connection_state( 362 expected_network_params.set_previous_connection_state(
362 CachedNetworkParameters::CONGESTION_AVOIDANCE); 363 CachedNetworkParameters::CONGESTION_AVOIDANCE);
363 expected_network_params.set_timestamp( 364 expected_network_params.set_timestamp(
364 session_->connection()->clock()->WallNow().ToUNIXSeconds()); 365 session_->connection()->clock()->WallNow().ToUNIXSeconds());
365 expected_network_params.set_serving_region(serving_region); 366 expected_network_params.set_serving_region(serving_region);
366 367
367 EXPECT_CALL(*crypto_stream, 368 EXPECT_CALL(*crypto_stream,
368 SendServerConfigUpdate(EqualsProto(expected_network_params))) 369 SendServerConfigUpdate(EqualsProto(expected_network_params), _))
369 .Times(1); 370 .Times(1);
370 session_->OnCongestionWindowChange(now); 371 session_->OnCongestionWindowChange(now);
371 } 372 }
372 373
373 } // namespace 374 } // namespace
374 } // namespace test 375 } // namespace test
375 } // namespace tools 376 } // namespace tools
376 } // namespace net 377 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_server_session.cc ('k') | net/tools/quic/quic_spdy_client_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698