| 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" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 size_t out_len; | 84 size_t out_len; |
| 85 EXPECT_EQ(QUIC_NO_ERROR, msg.GetTaglist(kCGST, &out, &out_len)); | 85 EXPECT_EQ(QUIC_NO_ERROR, msg.GetTaglist(kCGST, &out, &out_len)); |
| 86 EXPECT_EQ(2u, out_len); | 86 EXPECT_EQ(2u, out_len); |
| 87 EXPECT_EQ(kPACE, out[0]); | 87 EXPECT_EQ(kPACE, out[0]); |
| 88 EXPECT_EQ(kQBIC, out[1]); | 88 EXPECT_EQ(kQBIC, out[1]); |
| 89 } | 89 } |
| 90 | 90 |
| 91 TEST_F(QuicConfigTest, ProcessClientHello) { | 91 TEST_F(QuicConfigTest, ProcessClientHello) { |
| 92 QuicConfig client_config; | 92 QuicConfig client_config; |
| 93 QuicTagVector cgst; | 93 QuicTagVector cgst; |
| 94 cgst.push_back(kINAR); | 94 cgst.push_back(kTSTP); |
| 95 cgst.push_back(kQBIC); | 95 cgst.push_back(kQBIC); |
| 96 client_config.set_congestion_feedback(cgst, kQBIC); | 96 client_config.set_congestion_feedback(cgst, kQBIC); |
| 97 client_config.set_idle_connection_state_lifetime( | 97 client_config.set_idle_connection_state_lifetime( |
| 98 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), | 98 QuicTime::Delta::FromSeconds(2 * kDefaultTimeoutSecs), |
| 99 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); | 99 QuicTime::Delta::FromSeconds(kDefaultTimeoutSecs)); |
| 100 client_config.set_max_streams_per_connection( | 100 client_config.set_max_streams_per_connection( |
| 101 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); | 101 2 * kDefaultMaxStreamsPerConnection, kDefaultMaxStreamsPerConnection); |
| 102 client_config.SetInitialRoundTripTimeUsToSend( | 102 client_config.SetInitialRoundTripTimeUsToSend( |
| 103 10 * base::Time::kMicrosecondsPerMillisecond); | 103 10 * base::Time::kMicrosecondsPerMillisecond); |
| 104 client_config.SetInitialFlowControlWindowToSend( | 104 client_config.SetInitialFlowControlWindowToSend( |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 string error_details; | 254 string error_details; |
| 255 const QuicErrorCode error = | 255 const QuicErrorCode error = |
| 256 config_.ProcessPeerHello(msg, SERVER, &error_details); | 256 config_.ProcessPeerHello(msg, SERVER, &error_details); |
| 257 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); | 257 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); |
| 258 } | 258 } |
| 259 | 259 |
| 260 TEST_F(QuicConfigTest, MultipleNegotiatedValuesInVectorTag) { | 260 TEST_F(QuicConfigTest, MultipleNegotiatedValuesInVectorTag) { |
| 261 QuicConfig server_config; | 261 QuicConfig server_config; |
| 262 QuicTagVector cgst; | 262 QuicTagVector cgst; |
| 263 cgst.push_back(kQBIC); | 263 cgst.push_back(kQBIC); |
| 264 cgst.push_back(kINAR); | 264 cgst.push_back(kTSTP); |
| 265 server_config.set_congestion_feedback(cgst, kQBIC); | 265 server_config.set_congestion_feedback(cgst, kQBIC); |
| 266 | 266 |
| 267 CryptoHandshakeMessage msg; | 267 CryptoHandshakeMessage msg; |
| 268 server_config.ToHandshakeMessage(&msg); | 268 server_config.ToHandshakeMessage(&msg); |
| 269 string error_details; | 269 string error_details; |
| 270 const QuicErrorCode error = | 270 const QuicErrorCode error = |
| 271 config_.ProcessPeerHello(msg, SERVER, &error_details); | 271 config_.ProcessPeerHello(msg, SERVER, &error_details); |
| 272 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); | 272 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); |
| 273 } | 273 } |
| 274 | 274 |
| 275 TEST_F(QuicConfigTest, NoOverLapInCGST) { | 275 TEST_F(QuicConfigTest, NoOverLapInCGST) { |
| 276 QuicConfig server_config; | 276 QuicConfig server_config; |
| 277 server_config.SetDefaults(); | 277 server_config.SetDefaults(); |
| 278 QuicTagVector cgst; | 278 QuicTagVector cgst; |
| 279 cgst.push_back(kINAR); | 279 cgst.push_back(kTSTP); |
| 280 server_config.set_congestion_feedback(cgst, kINAR); | 280 server_config.set_congestion_feedback(cgst, kTSTP); |
| 281 | 281 |
| 282 CryptoHandshakeMessage msg; | 282 CryptoHandshakeMessage msg; |
| 283 string error_details; | 283 string error_details; |
| 284 server_config.ToHandshakeMessage(&msg); | 284 server_config.ToHandshakeMessage(&msg); |
| 285 const QuicErrorCode error = | 285 const QuicErrorCode error = |
| 286 config_.ProcessPeerHello(msg, CLIENT, &error_details); | 286 config_.ProcessPeerHello(msg, CLIENT, &error_details); |
| 287 DVLOG(1) << QuicUtils::ErrorToString(error); | 287 DVLOG(1) << QuicUtils::ErrorToString(error); |
| 288 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, error); | 288 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NO_OVERLAP, error); |
| 289 } | 289 } |
| 290 | 290 |
| 291 TEST_F(QuicConfigTest, InvalidFlowControlWindow) { | 291 TEST_F(QuicConfigTest, InvalidFlowControlWindow) { |
| 292 // QuicConfig should not accept an invalid flow control window to send to the | 292 // QuicConfig should not accept an invalid flow control window to send to the |
| 293 // peer: the receive window must be at least the default of 16 Kb. | 293 // peer: the receive window must be at least the default of 16 Kb. |
| 294 QuicConfig config; | 294 QuicConfig config; |
| 295 const uint64 kInvalidWindow = kDefaultFlowControlSendWindow - 1; | 295 const uint64 kInvalidWindow = kDefaultFlowControlSendWindow - 1; |
| 296 EXPECT_DFATAL(config.SetInitialFlowControlWindowToSend(kInvalidWindow), | 296 EXPECT_DFATAL(config.SetInitialFlowControlWindowToSend(kInvalidWindow), |
| 297 "Initial flow control receive window"); | 297 "Initial flow control receive window"); |
| 298 | 298 |
| 299 EXPECT_EQ(kDefaultFlowControlSendWindow, | 299 EXPECT_EQ(kDefaultFlowControlSendWindow, |
| 300 config.GetInitialFlowControlWindowToSend()); | 300 config.GetInitialFlowControlWindowToSend()); |
| 301 } | 301 } |
| 302 | 302 |
| 303 } // namespace | 303 } // namespace |
| 304 } // namespace test | 304 } // namespace test |
| 305 } // namespace net | 305 } // namespace net |
| OLD | NEW |