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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 // No error, as rest are optional. | 175 // No error, as rest are optional. |
176 string error_details; | 176 string error_details; |
177 const QuicErrorCode error = | 177 const QuicErrorCode error = |
178 config_.ProcessPeerHello(msg, SERVER, &error_details); | 178 config_.ProcessPeerHello(msg, SERVER, &error_details); |
179 EXPECT_EQ(QUIC_NO_ERROR, error); | 179 EXPECT_EQ(QUIC_NO_ERROR, error); |
180 EXPECT_TRUE(config_.negotiated()); | 180 EXPECT_TRUE(config_.negotiated()); |
181 } | 181 } |
182 | 182 |
183 TEST_F(QuicConfigTest, MissingValueInCHLO) { | 183 TEST_F(QuicConfigTest, MissingValueInCHLO) { |
| 184 // Server receives CHLO with missing kICSL. |
184 CryptoHandshakeMessage msg; | 185 CryptoHandshakeMessage msg; |
185 msg.SetValue(kICSL, 1); | |
186 // Missing kMSPC. KATO is optional. | |
187 string error_details; | 186 string error_details; |
188 const QuicErrorCode error = | 187 const QuicErrorCode error = |
189 config_.ProcessPeerHello(msg, CLIENT, &error_details); | 188 config_.ProcessPeerHello(msg, CLIENT, &error_details); |
190 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error); | 189 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error); |
191 } | 190 } |
192 | 191 |
193 TEST_F(QuicConfigTest, MissingValueInSHLO) { | 192 TEST_F(QuicConfigTest, MissingValueInSHLO) { |
| 193 // Client receives SHLO with missing kICSL. |
194 CryptoHandshakeMessage msg; | 194 CryptoHandshakeMessage msg; |
195 msg.SetValue(kMSPC, 3); | |
196 // Missing ICSL. KATO is optional. | |
197 string error_details; | 195 string error_details; |
198 const QuicErrorCode error = | 196 const QuicErrorCode error = |
199 config_.ProcessPeerHello(msg, SERVER, &error_details); | 197 config_.ProcessPeerHello(msg, SERVER, &error_details); |
200 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error); | 198 EXPECT_EQ(QUIC_CRYPTO_MESSAGE_PARAMETER_NOT_FOUND, error); |
201 } | 199 } |
202 | 200 |
203 TEST_F(QuicConfigTest, OutOfBoundSHLO) { | 201 TEST_F(QuicConfigTest, OutOfBoundSHLO) { |
204 QuicConfig server_config; | 202 QuicConfig server_config; |
205 server_config.SetIdleConnectionStateLifetime( | 203 server_config.SetIdleConnectionStateLifetime( |
206 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs), | 204 QuicTime::Delta::FromSeconds(2 * kMaximumIdleTimeoutSecs), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 | 243 |
246 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); | 244 EXPECT_TRUE(config_.HasReceivedConnectionOptions()); |
247 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size()); | 245 EXPECT_EQ(1u, config_.ReceivedConnectionOptions().size()); |
248 EXPECT_TRUE( | 246 EXPECT_TRUE( |
249 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER)); | 247 config_.HasClientSentConnectionOption(kTBBR, Perspective::IS_SERVER)); |
250 } | 248 } |
251 | 249 |
252 } // namespace | 250 } // namespace |
253 } // namespace test | 251 } // namespace test |
254 } // namespace net | 252 } // namespace net |
OLD | NEW |