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 20 matching lines...) Expand all Loading... |
31 kInitialStreamFlowControlWindowForTest); | 31 kInitialStreamFlowControlWindowForTest); |
32 config_.SetInitialSessionFlowControlWindowToSend( | 32 config_.SetInitialSessionFlowControlWindowToSend( |
33 kInitialSessionFlowControlWindowForTest); | 33 kInitialSessionFlowControlWindowForTest); |
34 config_.SetIdleConnectionStateLifetime(QuicTime::Delta::FromSeconds(5), | 34 config_.SetIdleConnectionStateLifetime(QuicTime::Delta::FromSeconds(5), |
35 QuicTime::Delta::FromSeconds(2)); | 35 QuicTime::Delta::FromSeconds(2)); |
36 config_.SetMaxStreamsPerConnection(4, 2); | 36 config_.SetMaxStreamsPerConnection(4, 2); |
37 config_.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer); | 37 config_.SetSocketReceiveBufferToSend(kDefaultSocketReceiveBuffer); |
38 CryptoHandshakeMessage msg; | 38 CryptoHandshakeMessage msg; |
39 config_.ToHandshakeMessage(&msg); | 39 config_.ToHandshakeMessage(&msg); |
40 | 40 |
41 uint32 value; | 41 uint32_t value; |
42 QuicErrorCode error = msg.GetUint32(kICSL, &value); | 42 QuicErrorCode error = msg.GetUint32(kICSL, &value); |
43 EXPECT_EQ(QUIC_NO_ERROR, error); | 43 EXPECT_EQ(QUIC_NO_ERROR, error); |
44 EXPECT_EQ(5u, value); | 44 EXPECT_EQ(5u, value); |
45 | 45 |
46 error = msg.GetUint32(kMSPC, &value); | 46 error = msg.GetUint32(kMSPC, &value); |
47 EXPECT_EQ(QUIC_NO_ERROR, error); | 47 EXPECT_EQ(QUIC_NO_ERROR, error); |
48 EXPECT_EQ(4u, value); | 48 EXPECT_EQ(4u, value); |
49 | 49 |
50 error = msg.GetUint32(kSFCW, &value); | 50 error = msg.GetUint32(kSFCW, &value); |
51 EXPECT_EQ(QUIC_NO_ERROR, error); | 51 EXPECT_EQ(QUIC_NO_ERROR, error); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 string error_details; | 209 string error_details; |
210 const QuicErrorCode error = | 210 const QuicErrorCode error = |
211 config_.ProcessPeerHello(msg, SERVER, &error_details); | 211 config_.ProcessPeerHello(msg, SERVER, &error_details); |
212 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); | 212 EXPECT_EQ(QUIC_INVALID_NEGOTIATED_VALUE, error); |
213 } | 213 } |
214 | 214 |
215 TEST_F(QuicConfigTest, InvalidFlowControlWindow) { | 215 TEST_F(QuicConfigTest, InvalidFlowControlWindow) { |
216 // QuicConfig should not accept an invalid flow control window to send to the | 216 // QuicConfig should not accept an invalid flow control window to send to the |
217 // peer: the receive window must be at least the default of 16 Kb. | 217 // peer: the receive window must be at least the default of 16 Kb. |
218 QuicConfig config; | 218 QuicConfig config; |
219 const uint64 kInvalidWindow = kMinimumFlowControlSendWindow - 1; | 219 const uint64_t kInvalidWindow = kMinimumFlowControlSendWindow - 1; |
220 EXPECT_DFATAL(config.SetInitialStreamFlowControlWindowToSend(kInvalidWindow), | 220 EXPECT_DFATAL(config.SetInitialStreamFlowControlWindowToSend(kInvalidWindow), |
221 "Initial stream flow control receive window"); | 221 "Initial stream flow control receive window"); |
222 | 222 |
223 EXPECT_EQ(kMinimumFlowControlSendWindow, | 223 EXPECT_EQ(kMinimumFlowControlSendWindow, |
224 config.GetInitialStreamFlowControlWindowToSend()); | 224 config.GetInitialStreamFlowControlWindowToSend()); |
225 } | 225 } |
226 | 226 |
227 TEST_F(QuicConfigTest, HasClientSentConnectionOption) { | 227 TEST_F(QuicConfigTest, HasClientSentConnectionOption) { |
228 QuicConfig client_config; | 228 QuicConfig client_config; |
229 QuicTagVector copt; | 229 QuicTagVector copt; |
(...skipping 18 matching lines...) Expand all Loading... |
248 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size()); | 248 EXPECT_EQ(2u, config_.ReceivedConnectionOptions().size()); |
249 EXPECT_TRUE( | 249 EXPECT_TRUE( |
250 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER)); | 250 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER)); |
251 EXPECT_TRUE( | 251 EXPECT_TRUE( |
252 config_.HasClientSentConnectionOption(kFHDR, Perspective::IS_SERVER)); | 252 config_.HasClientSentConnectionOption(kFHDR, Perspective::IS_SERVER)); |
253 } | 253 } |
254 | 254 |
255 } // namespace | 255 } // namespace |
256 } // namespace test | 256 } // namespace test |
257 } // namespace net | 257 } // namespace net |
OLD | NEW |