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