| 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" |
| 11 #include "net/quic/test_tools/crypto_test_utils.h" | 11 #include "net/quic/test_tools/crypto_test_utils.h" |
| 12 #include "net/quic/test_tools/quic_test_utils.h" | 12 #include "net/quic/test_tools/quic_test_utils.h" |
| 13 #include "net/tools/quic/quic_spdy_client_stream.h" | 13 #include "net/tools/quic/quic_spdy_client_stream.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 using net::test::CryptoTestUtils; | 16 using net::test::CryptoTestUtils; |
| 17 using net::test::DefaultQuicConfig; | 17 using net::test::DefaultQuicConfig; |
| 18 using net::test::kInitialFlowControlWindowForTest; |
| 18 using net::test::PacketSavingConnection; | 19 using net::test::PacketSavingConnection; |
| 19 using net::test::SupportedVersions; | 20 using net::test::SupportedVersions; |
| 20 using testing::_; | 21 using testing::_; |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 namespace tools { | 24 namespace tools { |
| 24 namespace test { | 25 namespace test { |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 const char kServerHostname[] = "www.example.com"; | 28 const char kServerHostname[] = "www.example.com"; |
| 28 const uint16 kPort = 80; | 29 const uint16 kPort = 80; |
| 29 | 30 |
| 30 class ToolsQuicClientSessionTest | 31 class ToolsQuicClientSessionTest |
| 31 : public ::testing::TestWithParam<QuicVersion> { | 32 : public ::testing::TestWithParam<QuicVersion> { |
| 32 protected: | 33 protected: |
| 33 ToolsQuicClientSessionTest() | 34 ToolsQuicClientSessionTest() |
| 34 : connection_(new PacketSavingConnection(false, | 35 : connection_(new PacketSavingConnection(false, |
| 35 SupportedVersions(GetParam()))) { | 36 SupportedVersions(GetParam()))) { |
| 36 crypto_config_.SetDefaults(); | 37 crypto_config_.SetDefaults(); |
| 37 session_.reset(new QuicClientSession( | 38 session_.reset(new QuicClientSession( |
| 38 QuicServerId(kServerHostname, kPort, false, PRIVACY_MODE_DISABLED), | 39 QuicServerId(kServerHostname, kPort, false, PRIVACY_MODE_DISABLED), |
| 39 DefaultQuicConfig(), | 40 DefaultQuicConfig(), |
| 40 connection_, | 41 connection_, |
| 42 kInitialFlowControlWindowForTest, |
| 41 &crypto_config_)); | 43 &crypto_config_)); |
| 42 session_->config()->SetDefaults(); | 44 session_->config()->SetDefaults(); |
| 43 } | 45 } |
| 44 | 46 |
| 45 void CompleteCryptoHandshake() { | 47 void CompleteCryptoHandshake() { |
| 46 ASSERT_TRUE(session_->CryptoConnect()); | 48 ASSERT_TRUE(session_->CryptoConnect()); |
| 47 CryptoTestUtils::HandshakeWithFakeServer( | 49 CryptoTestUtils::HandshakeWithFakeServer( |
| 48 connection_, session_->GetCryptoStream()); | 50 connection_, session_->GetCryptoStream()); |
| 49 } | 51 } |
| 50 | 52 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // After receiving a GoAway, I should no longer be able to create outgoing | 85 // After receiving a GoAway, I should no longer be able to create outgoing |
| 84 // streams. | 86 // streams. |
| 85 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); | 87 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); |
| 86 EXPECT_EQ(NULL, session_->CreateOutgoingDataStream()); | 88 EXPECT_EQ(NULL, session_->CreateOutgoingDataStream()); |
| 87 } | 89 } |
| 88 | 90 |
| 89 } // namespace | 91 } // namespace |
| 90 } // namespace test | 92 } // namespace test |
| 91 } // namespace tools | 93 } // namespace tools |
| 92 } // namespace net | 94 } // namespace net |
| OLD | NEW |