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/cached_network_parameters.h" | 7 #include "net/quic/crypto/cached_network_parameters.h" |
8 #include "net/quic/crypto/quic_crypto_server_config.h" | 8 #include "net/quic/crypto/quic_crypto_server_config.h" |
9 #include "net/quic/crypto/quic_random.h" | 9 #include "net/quic/crypto/quic_random.h" |
10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); | 392 QuicConfigPeer::SetReceivedConnectionOptions(session_->config(), copt); |
393 | 393 |
394 const string kTestServingRegion = "a serving region"; | 394 const string kTestServingRegion = "a serving region"; |
395 session_->set_serving_region(kTestServingRegion); | 395 session_->set_serving_region(kTestServingRegion); |
396 | 396 |
397 QuicCryptoServerStream* crypto_stream = | 397 QuicCryptoServerStream* crypto_stream = |
398 static_cast<QuicCryptoServerStream*>( | 398 static_cast<QuicCryptoServerStream*>( |
399 QuicSessionPeer::GetCryptoStream(session_.get())); | 399 QuicSessionPeer::GetCryptoStream(session_.get())); |
400 | 400 |
401 // No effect if no CachedNetworkParameters provided. | 401 // No effect if no CachedNetworkParameters provided. |
402 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(0); | 402 EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(0); |
403 session_->OnConfigNegotiated(); | 403 session_->OnConfigNegotiated(); |
404 | 404 |
405 // No effect if CachedNetworkParameters provided, but different serving | 405 // No effect if CachedNetworkParameters provided, but different serving |
406 // regions. | 406 // regions. |
407 CachedNetworkParameters cached_network_params; | 407 CachedNetworkParameters cached_network_params; |
408 cached_network_params.set_bandwidth_estimate_bytes_per_second(1); | 408 cached_network_params.set_bandwidth_estimate_bytes_per_second(1); |
409 cached_network_params.set_serving_region("different serving region"); | 409 cached_network_params.set_serving_region("different serving region"); |
410 crypto_stream->set_previous_cached_network_params(cached_network_params); | 410 crypto_stream->set_previous_cached_network_params(cached_network_params); |
411 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(0); | 411 EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(0); |
412 session_->OnConfigNegotiated(); | 412 session_->OnConfigNegotiated(); |
413 | 413 |
414 // Same serving region results in CachedNetworkParameters being stored. | 414 // Same serving region results in CachedNetworkParameters being stored. |
415 cached_network_params.set_serving_region(kTestServingRegion); | 415 cached_network_params.set_serving_region(kTestServingRegion); |
416 crypto_stream->set_previous_cached_network_params(cached_network_params); | 416 crypto_stream->set_previous_cached_network_params(cached_network_params); |
417 EXPECT_CALL(*connection_, ResumeConnectionState(_)).Times(1); | 417 EXPECT_CALL(*connection_, ResumeConnectionState(_, _)).Times(1); |
418 session_->OnConfigNegotiated(); | 418 session_->OnConfigNegotiated(); |
419 } | 419 } |
420 | 420 |
421 } // namespace | 421 } // namespace |
422 } // namespace test | 422 } // namespace test |
423 } // namespace tools | 423 } // namespace tools |
424 } // namespace net | 424 } // namespace net |
OLD | NEW |