| OLD | NEW |
| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 EXPECT_EQ(FEC_PROTECT_OPTIONAL, stream->fec_policy()); | 288 EXPECT_EQ(FEC_PROTECT_OPTIONAL, stream->fec_policy()); |
| 289 } | 289 } |
| 290 | 290 |
| 291 class MockQuicCryptoServerStream : public QuicCryptoServerStream { | 291 class MockQuicCryptoServerStream : public QuicCryptoServerStream { |
| 292 public: | 292 public: |
| 293 explicit MockQuicCryptoServerStream( | 293 explicit MockQuicCryptoServerStream( |
| 294 const QuicCryptoServerConfig& crypto_config, QuicSession* session) | 294 const QuicCryptoServerConfig& crypto_config, QuicSession* session) |
| 295 : QuicCryptoServerStream(crypto_config, session) {} | 295 : QuicCryptoServerStream(crypto_config, session) {} |
| 296 virtual ~MockQuicCryptoServerStream() {} | 296 virtual ~MockQuicCryptoServerStream() {} |
| 297 | 297 |
| 298 MOCK_METHOD1(SendServerConfigUpdate, | 298 MOCK_METHOD2(SendServerConfigUpdate, |
| 299 void(const CachedNetworkParameters* cached_network_parameters)); | 299 void(const CachedNetworkParameters* cached_network_parameters, |
| 300 bool on_handshake_complete)); |
| 301 |
| 300 private: | 302 private: |
| 301 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); | 303 DISALLOW_COPY_AND_ASSIGN(MockQuicCryptoServerStream); |
| 302 }; | 304 }; |
| 303 | 305 |
| 304 TEST_P(QuicServerSessionTest, BandwidthEstimates) { | 306 TEST_P(QuicServerSessionTest, BandwidthEstimates) { |
| 305 if (version() <= QUIC_VERSION_21) { | 307 if (version() <= QUIC_VERSION_21) { |
| 306 return; | 308 return; |
| 307 } | 309 } |
| 308 // Test that bandwidth estimate updates are sent to the client, only after the | 310 // Test that bandwidth estimate updates are sent to the client, only after the |
| 309 // bandwidth estimate has changes sufficiently, and enough time has passed. | 311 // bandwidth estimate has changes sufficiently, and enough time has passed. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 .GetRttStats() | 360 .GetRttStats() |
| 359 ->min_rtt() | 361 ->min_rtt() |
| 360 .ToMilliseconds()); | 362 .ToMilliseconds()); |
| 361 expected_network_params.set_previous_connection_state( | 363 expected_network_params.set_previous_connection_state( |
| 362 CachedNetworkParameters::CONGESTION_AVOIDANCE); | 364 CachedNetworkParameters::CONGESTION_AVOIDANCE); |
| 363 expected_network_params.set_timestamp( | 365 expected_network_params.set_timestamp( |
| 364 session_->connection()->clock()->WallNow().ToUNIXSeconds()); | 366 session_->connection()->clock()->WallNow().ToUNIXSeconds()); |
| 365 expected_network_params.set_serving_region(serving_region); | 367 expected_network_params.set_serving_region(serving_region); |
| 366 | 368 |
| 367 EXPECT_CALL(*crypto_stream, | 369 EXPECT_CALL(*crypto_stream, |
| 368 SendServerConfigUpdate(EqualsProto(expected_network_params))) | 370 SendServerConfigUpdate(EqualsProto(expected_network_params), _)) |
| 369 .Times(1); | 371 .Times(1); |
| 370 session_->OnCongestionWindowChange(now); | 372 session_->OnCongestionWindowChange(now); |
| 371 } | 373 } |
| 372 | 374 |
| 373 } // namespace | 375 } // namespace |
| 374 } // namespace test | 376 } // namespace test |
| 375 } // namespace tools | 377 } // namespace tools |
| 376 } // namespace net | 378 } // namespace net |
| OLD | NEW |