| 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/quic_crypto_client_stream.h" | 5 #include "net/quic/quic_crypto_client_stream.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 8 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
| 9 #include "net/quic/crypto/quic_decrypter.h" | 9 #include "net/quic/crypto/quic_decrypter.h" |
| 10 #include "net/quic/crypto/quic_encrypter.h" | 10 #include "net/quic/crypto/quic_encrypter.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 CompleteCryptoHandshake(); | 109 CompleteCryptoHandshake(); |
| 110 EXPECT_TRUE(stream_->encryption_established()); | 110 EXPECT_TRUE(stream_->encryption_established()); |
| 111 EXPECT_TRUE(stream_->handshake_confirmed()); | 111 EXPECT_TRUE(stream_->handshake_confirmed()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TEST_F(QuicCryptoClientStreamTest, ExpiredServerConfig) { | 114 TEST_F(QuicCryptoClientStreamTest, ExpiredServerConfig) { |
| 115 // Seed the config with a cached server config. | 115 // Seed the config with a cached server config. |
| 116 CompleteCryptoHandshake(); | 116 CompleteCryptoHandshake(); |
| 117 | 117 |
| 118 connection_ = new PacketSavingConnection(1, addr_, true); | 118 connection_ = new PacketSavingConnection(1, addr_, true); |
| 119 session_.reset(new TestSession(connection_, QuicConfig(), true)); | 119 session_.reset(new TestSession(connection_, DefaultQuicConfig(), true)); |
| 120 stream_.reset(new QuicCryptoClientStream(kServerHostname, session_.get(), | 120 stream_.reset(new QuicCryptoClientStream(kServerHostname, session_.get(), |
| 121 &crypto_config_)); | 121 &crypto_config_)); |
| 122 | 122 |
| 123 session_->SetCryptoStream(stream_.get()); | 123 session_->SetCryptoStream(stream_.get()); |
| 124 session_->config()->SetDefaults(); | 124 session_->config()->SetDefaults(); |
| 125 | 125 |
| 126 // Advance time 5 years to ensure that we pass the expiry time of the cached | 126 // Advance time 5 years to ensure that we pass the expiry time of the cached |
| 127 // server config. | 127 // server config. |
| 128 reinterpret_cast<MockClock*>(const_cast<QuicClock*>(connection_->clock())) | 128 reinterpret_cast<MockClock*>(const_cast<QuicClock*>(connection_->clock())) |
| 129 ->AdvanceTime(QuicTime::Delta::FromSeconds(60 * 60 * 24 * 365 * 5)); | 129 ->AdvanceTime(QuicTime::Delta::FromSeconds(60 * 60 * 24 * 365 * 5)); |
| 130 | 130 |
| 131 // Check that a client hello was sent and that CryptoConnect doesn't fail | 131 // Check that a client hello was sent and that CryptoConnect doesn't fail |
| 132 // with an error. | 132 // with an error. |
| 133 EXPECT_TRUE(stream_->CryptoConnect()); | 133 EXPECT_TRUE(stream_->CryptoConnect()); |
| 134 ASSERT_EQ(1u, connection_->packets_.size()); | 134 ASSERT_EQ(1u, connection_->packets_.size()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace | 137 } // namespace |
| 138 } // namespace test | 138 } // namespace test |
| 139 } // namespace net | 139 } // namespace net |
| OLD | NEW |