| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/core/quic_crypto_client_stream.h" | 5 #include "net/quic/core/quic_crypto_client_stream.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" | 9 #include "net/quic/core/crypto/aes_128_gcm_12_encrypter.h" |
| 10 #include "net/quic/core/crypto/quic_decrypter.h" | 10 #include "net/quic/core/crypto/quic_decrypter.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 connection_->AdvanceTime( | 141 connection_->AdvanceTime( |
| 142 QuicTime::Delta::FromSeconds(60 * 60 * 24 * 365 * 5)); | 142 QuicTime::Delta::FromSeconds(60 * 60 * 24 * 365 * 5)); |
| 143 | 143 |
| 144 stream()->CryptoConnect(); | 144 stream()->CryptoConnect(); |
| 145 // Check that a client hello was sent. | 145 // Check that a client hello was sent. |
| 146 ASSERT_EQ(1u, connection_->encrypted_packets_.size()); | 146 ASSERT_EQ(1u, connection_->encrypted_packets_.size()); |
| 147 EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); | 147 EXPECT_EQ(ENCRYPTION_NONE, connection_->encryption_level()); |
| 148 } | 148 } |
| 149 | 149 |
| 150 TEST_F(QuicCryptoClientStreamTest, ClockSkew) { | 150 TEST_F(QuicCryptoClientStreamTest, ClockSkew) { |
| 151 FLAGS_quic_send_scfg_ttl = true; | |
| 152 // Test that if the client's clock is skewed with respect to the server, | 151 // Test that if the client's clock is skewed with respect to the server, |
| 153 // the handshake succeeds. In the past, the client would get the server | 152 // the handshake succeeds. In the past, the client would get the server |
| 154 // config, notice that it had already expired and then close the connection. | 153 // config, notice that it had already expired and then close the connection. |
| 155 | 154 |
| 156 // Advance time 5 years to ensure that we pass the expiry time in the server | 155 // Advance time 5 years to ensure that we pass the expiry time in the server |
| 157 // config, but the TTL is used instead. | 156 // config, but the TTL is used instead. |
| 158 connection_->AdvanceTime( | 157 connection_->AdvanceTime( |
| 159 QuicTime::Delta::FromSeconds(60 * 60 * 24 * 365 * 5)); | 158 QuicTime::Delta::FromSeconds(60 * 60 * 24 * 365 * 5)); |
| 160 | 159 |
| 161 // The handshakes completes! | 160 // The handshakes completes! |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 client_state->GetNextServerDesignatedConnectionId(); | 379 client_state->GetNextServerDesignatedConnectionId(); |
| 381 QuicConnectionId expected_id = | 380 QuicConnectionId expected_id = |
| 382 server_session_->connection()->random_generator()->RandUint64(); | 381 server_session_->connection()->random_generator()->RandUint64(); |
| 383 EXPECT_EQ(expected_id, server_designated_id); | 382 EXPECT_EQ(expected_id, server_designated_id); |
| 384 EXPECT_FALSE(client_state->has_server_designated_connection_id()); | 383 EXPECT_FALSE(client_state->has_server_designated_connection_id()); |
| 385 } | 384 } |
| 386 | 385 |
| 387 } // namespace | 386 } // namespace |
| 388 } // namespace test | 387 } // namespace test |
| 389 } // namespace net | 388 } // namespace net |
| OLD | NEW |