| 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/tools/quic/quic_client_session.h" | 5 #include "net/tools/quic/quic_client_session.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
| 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" | 10 #include "net/quic/crypto/aes_128_gcm_12_encrypter.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 using testing::AnyNumber; | 30 using testing::AnyNumber; |
| 31 using testing::Invoke; | 31 using testing::Invoke; |
| 32 using testing::Truly; | 32 using testing::Truly; |
| 33 using testing::_; | 33 using testing::_; |
| 34 | 34 |
| 35 namespace net { | 35 namespace net { |
| 36 namespace tools { | 36 namespace tools { |
| 37 namespace test { | 37 namespace test { |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 const char kServerHostname[] = "www.example.org"; | 40 const char kServerHostname[] = "test.example.com"; |
| 41 const uint16 kPort = 80; | 41 const uint16 kPort = 80; |
| 42 | 42 |
| 43 class ToolsQuicClientSessionTest | 43 class ToolsQuicClientSessionTest |
| 44 : public ::testing::TestWithParam<QuicVersion> { | 44 : public ::testing::TestWithParam<QuicVersion> { |
| 45 protected: | 45 protected: |
| 46 ToolsQuicClientSessionTest() | 46 ToolsQuicClientSessionTest() |
| 47 : connection_(new PacketSavingConnection(&helper_, | 47 : crypto_config_(CryptoTestUtils::ProofVerifierForTesting()), |
| 48 connection_(new PacketSavingConnection(&helper_, |
| 48 Perspective::IS_CLIENT, | 49 Perspective::IS_CLIENT, |
| 49 SupportedVersions(GetParam()))) { | 50 SupportedVersions(GetParam()))), |
| 50 session_.reset(new QuicClientSession( | 51 session_(new QuicClientSession( |
| 51 DefaultQuicConfig(), connection_, | 52 DefaultQuicConfig(), |
| 52 QuicServerId(kServerHostname, kPort, false, PRIVACY_MODE_DISABLED), | 53 connection_, |
| 53 &crypto_config_)); | 54 QuicServerId(kServerHostname, kPort, PRIVACY_MODE_DISABLED), |
| 55 &crypto_config_)) { |
| 54 session_->Initialize(); | 56 session_->Initialize(); |
| 55 // Advance the time, because timers do not like uninitialized times. | 57 // Advance the time, because timers do not like uninitialized times. |
| 56 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); | 58 connection_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void CompleteCryptoHandshake() { | 61 void CompleteCryptoHandshake() { |
| 60 session_->CryptoConnect(); | 62 session_->CryptoConnect(); |
| 61 CryptoTestUtils::HandshakeWithFakeServer(&helper_, connection_, | 63 CryptoTestUtils::HandshakeWithFakeServer(&helper_, connection_, |
| 62 session_->GetCryptoStream()); | 64 session_->GetCryptoStream()); |
| 63 } | 65 } |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 PACKET_6BYTE_PACKET_NUMBER, nullptr)); | 183 PACKET_6BYTE_PACKET_NUMBER, nullptr)); |
| 182 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1); | 184 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1); |
| 183 session_->connection()->ProcessUdpPacket(client_address, server_address, | 185 session_->connection()->ProcessUdpPacket(client_address, server_address, |
| 184 *packet); | 186 *packet); |
| 185 } | 187 } |
| 186 | 188 |
| 187 } // namespace | 189 } // namespace |
| 188 } // namespace test | 190 } // namespace test |
| 189 } // namespace tools | 191 } // namespace tools |
| 190 } // namespace net | 192 } // namespace net |
| OLD | NEW |