OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/crypto/quic_crypto_client_config.h" | 5 #include "net/quic/crypto/quic_crypto_client_config.h" |
6 | 6 |
7 #include "net/quic/crypto/proof_verifier.h" | 7 #include "net/quic/crypto/proof_verifier.h" |
8 #include "net/quic/quic_server_id.h" | 8 #include "net/quic/quic_server_id.h" |
9 #include "net/quic/test_tools/mock_random.h" | 9 #include "net/quic/test_tools/mock_random.h" |
10 #include "net/quic/test_tools/quic_test_utils.h" | 10 #include "net/quic/test_tools/quic_test_utils.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 config.LookupOrCreate(server_id); | 248 config.LookupOrCreate(server_id); |
249 | 249 |
250 EXPECT_EQ(state, cleared_cache); | 250 EXPECT_EQ(state, cleared_cache); |
251 EXPECT_FALSE(cleared_cache->proof_valid()); | 251 EXPECT_FALSE(cleared_cache->proof_valid()); |
252 EXPECT_TRUE(cleared_cache->server_config().empty()); | 252 EXPECT_TRUE(cleared_cache->server_config().empty()); |
253 EXPECT_TRUE(cleared_cache->certs().empty()); | 253 EXPECT_TRUE(cleared_cache->certs().empty()); |
254 EXPECT_TRUE(cleared_cache->signature().empty()); | 254 EXPECT_TRUE(cleared_cache->signature().empty()); |
255 EXPECT_EQ(2u, cleared_cache->generation_counter()); | 255 EXPECT_EQ(2u, cleared_cache->generation_counter()); |
256 } | 256 } |
257 | 257 |
258 TEST(QuicCryptoClientConfigTest, RejectReasonToPackedError) { | |
259 QuicCryptoClientConfig config; | |
260 EXPECT_EQ(0u, config.RejectReasonToPackedError( | |
261 static_cast<HandshakeFailureReason>(0))); | |
262 EXPECT_EQ(1u << 5, config.RejectReasonToPackedError( | |
263 static_cast<HandshakeFailureReason>(100))); | |
264 EXPECT_EQ(2u << 5, config.RejectReasonToPackedError( | |
265 static_cast<HandshakeFailureReason>(101))); | |
266 EXPECT_EQ(1u << 10, config.RejectReasonToPackedError( | |
267 static_cast<HandshakeFailureReason>(200))); | |
268 EXPECT_EQ(2u << 10, config.RejectReasonToPackedError( | |
269 static_cast<HandshakeFailureReason>(201))); | |
270 EXPECT_EQ(3u << 10, config.RejectReasonToPackedError( | |
271 static_cast<HandshakeFailureReason>(202))); | |
272 EXPECT_EQ(1u << 15, config.RejectReasonToPackedError( | |
273 static_cast<HandshakeFailureReason>(300))); | |
274 EXPECT_EQ(2u << 15, config.RejectReasonToPackedError( | |
275 static_cast<HandshakeFailureReason>(301))); | |
276 EXPECT_EQ(1u << 20, config.RejectReasonToPackedError( | |
277 static_cast<HandshakeFailureReason>(400))); | |
278 EXPECT_EQ(2u << 20, config.RejectReasonToPackedError( | |
279 static_cast<HandshakeFailureReason>(401))); | |
280 EXPECT_EQ(3u << 20, config.RejectReasonToPackedError( | |
281 static_cast<HandshakeFailureReason>(402))); | |
282 EXPECT_EQ(4u << 20, config.RejectReasonToPackedError( | |
283 static_cast<HandshakeFailureReason>(403))); | |
284 EXPECT_EQ(5u << 20, config.RejectReasonToPackedError( | |
285 static_cast<HandshakeFailureReason>(404))); | |
286 EXPECT_EQ(6u << 20, config.RejectReasonToPackedError( | |
287 static_cast<HandshakeFailureReason>(405))); | |
288 } | |
289 | |
290 } // namespace test | 258 } // namespace test |
291 } // namespace net | 259 } // namespace net |
OLD | NEW |