| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/quic/quic_config.h" | 5 #include "net/quic/quic_config.h" |
| 6 | 6 |
| 7 #include "net/quic/crypto/crypto_handshake_message.h" | 7 #include "net/quic/crypto/crypto_handshake_message.h" |
| 8 #include "net/quic/crypto/crypto_protocol.h" | 8 #include "net/quic/crypto/crypto_protocol.h" |
| 9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
| 10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| 11 #include "net/quic/quic_sent_packet_manager.h" | 11 #include "net/quic/quic_sent_packet_manager.h" |
| 12 #include "net/quic/quic_time.h" | 12 #include "net/quic/quic_time.h" |
| 13 #include "net/quic/quic_utils.h" | 13 #include "net/quic/quic_utils.h" |
| 14 #include "net/quic/test_tools/quic_test_utils.h" | 14 #include "net/quic/test_tools/quic_test_utils.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 using std::string; | 17 using std::string; |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 namespace test { | 20 namespace test { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class QuicConfigTest : public ::testing::Test { | 23 class QuicConfigTest : public ::testing::Test { |
| 24 protected: | 24 protected: |
| 25 QuicConfigTest() { | 25 QuicConfigTest() { config_.SetDefaults(); } |
| 26 config_.SetDefaults(); | |
| 27 } | |
| 28 | 26 |
| 29 QuicConfig config_; | 27 QuicConfig config_; |
| 30 }; | 28 }; |
| 31 | 29 |
| 32 TEST_F(QuicConfigTest, ToHandshakeMessage) { | 30 TEST_F(QuicConfigTest, ToHandshakeMessage) { |
| 33 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, false); | 31 ValueRestore<bool> old_flag(&FLAGS_enable_quic_pacing, false); |
| 34 config_.SetDefaults(); | 32 config_.SetDefaults(); |
| 35 config_.set_idle_connection_state_lifetime(QuicTime::Delta::FromSeconds(5), | 33 config_.set_idle_connection_state_lifetime(QuicTime::Delta::FromSeconds(5), |
| 36 QuicTime::Delta::FromSeconds(2)); | 34 QuicTime::Delta::FromSeconds(2)); |
| 37 config_.set_max_streams_per_connection(4, 2); | 35 config_.set_max_streams_per_connection(4, 2); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 100 |
| 103 TEST_F(QuicConfigTest, ProcessServerHello) { | 101 TEST_F(QuicConfigTest, ProcessServerHello) { |
| 104 QuicConfig server_config; | 102 QuicConfig server_config; |
| 105 QuicTagVector cgst; | 103 QuicTagVector cgst; |
| 106 cgst.push_back(kQBIC); | 104 cgst.push_back(kQBIC); |
| 107 server_config.set_congestion_control(cgst, kQBIC); | 105 server_config.set_congestion_control(cgst, kQBIC); |
| 108 server_config.set_idle_connection_state_lifetime( | 106 server_config.set_idle_connection_state_lifetime( |
| 109 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2), | 107 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2), |
| 110 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2)); | 108 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs / 2)); |
| 111 server_config.set_max_streams_per_connection( | 109 server_config.set_max_streams_per_connection( |
| 112 kDefaultMaxStreamsPerConnection / 2, | 110 kDefaultMaxStreamsPerConnection / 2, kDefaultMaxStreamsPerConnection / 2); |
| 113 kDefaultMaxStreamsPerConnection / 2); | |
| 114 server_config.SetInitialCongestionWindowToSend(kDefaultInitialWindow / 2); | 111 server_config.SetInitialCongestionWindowToSend(kDefaultInitialWindow / 2); |
| 115 server_config.SetInitialRoundTripTimeUsToSend( | 112 server_config.SetInitialRoundTripTimeUsToSend( |
| 116 10 * base::Time::kMicrosecondsPerMillisecond); | 113 10 * base::Time::kMicrosecondsPerMillisecond); |
| 117 CryptoHandshakeMessage msg; | 114 CryptoHandshakeMessage msg; |
| 118 server_config.ToHandshakeMessage(&msg); | 115 server_config.ToHandshakeMessage(&msg); |
| 119 string error_details; | 116 string error_details; |
| 120 const QuicErrorCode error = | 117 const QuicErrorCode error = |
| 121 config_.ProcessPeerHello(msg, SERVER, &error_details); | 118 config_.ProcessPeerHello(msg, SERVER, &error_details); |
| 122 EXPECT_EQ(QUIC_NO_ERROR, error); | 119 EXPECT_EQ(QUIC_NO_ERROR, error); |
| 123 EXPECT_TRUE(config_.negotiated()); | 120 EXPECT_TRUE(config_.negotiated()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 server_config.ToHandshakeMessage(&msg); | 230 server_config.ToHandshakeMessage(&msg); |
| 234 const QuicErrorCode error = | 231 const QuicErrorCode error = |
| 235 config_.ProcessPeerHello(msg, CLIENT, &error_details); | 232 config_.ProcessPeerHello(msg, CLIENT, &error_details); |
| 236 DVLOG(1) << QuicUtils::ErrorToString(error); | 233 DVLOG(1) << QuicUtils::ErrorToString(error); |
| 237 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, error); | 234 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, error); |
| 238 } | 235 } |
| 239 | 236 |
| 240 } // namespace | 237 } // namespace |
| 241 } // namespace test | 238 } // namespace test |
| 242 } // namespace net | 239 } // namespace net |
| OLD | NEW |