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_reliable_client_stream.h" | 13 #include "net/tools/quic/quic_reliable_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; |
| 17 using net::test::DefaultQuicConfig; |
| 18 using net::test::PacketSavingConnection; |
16 using testing::_; | 19 using testing::_; |
17 using net::test::CryptoTestUtils; | |
18 using net::test::PacketSavingConnection; | |
19 | 20 |
20 namespace net { | 21 namespace net { |
21 namespace tools { | 22 namespace tools { |
22 namespace test { | 23 namespace test { |
23 namespace { | 24 namespace { |
24 | 25 |
25 const char kServerHostname[] = "www.example.com"; | 26 const char kServerHostname[] = "www.example.com"; |
26 | 27 |
27 class ToolsQuicClientSessionTest : public ::testing::Test { | 28 class ToolsQuicClientSessionTest : public ::testing::Test { |
28 protected: | 29 protected: |
29 ToolsQuicClientSessionTest() | 30 ToolsQuicClientSessionTest() |
30 : guid_(1), | 31 : guid_(1), |
31 connection_(new PacketSavingConnection(guid_, IPEndPoint(), false)) { | 32 connection_(new PacketSavingConnection(guid_, IPEndPoint(), false)) { |
32 crypto_config_.SetDefaults(); | 33 crypto_config_.SetDefaults(); |
33 session_.reset(new QuicClientSession(kServerHostname, QuicConfig(), | 34 session_.reset(new QuicClientSession(kServerHostname, DefaultQuicConfig(), |
34 connection_, &crypto_config_)); | 35 connection_, &crypto_config_)); |
35 session_->config()->SetDefaults(); | 36 session_->config()->SetDefaults(); |
36 } | 37 } |
37 | 38 |
38 void CompleteCryptoHandshake() { | 39 void CompleteCryptoHandshake() { |
39 ASSERT_TRUE(session_->CryptoConnect()); | 40 ASSERT_TRUE(session_->CryptoConnect()); |
40 CryptoTestUtils::HandshakeWithFakeServer( | 41 CryptoTestUtils::HandshakeWithFakeServer( |
41 connection_, session_->GetCryptoStream()); | 42 connection_, session_->GetCryptoStream()); |
42 } | 43 } |
43 | 44 |
(...skipping 30 matching lines...) Expand all Loading... |
74 // After receiving a GoAway, I should no longer be able to create outgoing | 75 // After receiving a GoAway, I should no longer be able to create outgoing |
75 // streams. | 76 // streams. |
76 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); | 77 session_->OnGoAway(QuicGoAwayFrame(QUIC_PEER_GOING_AWAY, 1u, "Going away.")); |
77 EXPECT_EQ(NULL, session_->CreateOutgoingReliableStream()); | 78 EXPECT_EQ(NULL, session_->CreateOutgoingReliableStream()); |
78 } | 79 } |
79 | 80 |
80 } // namespace | 81 } // namespace |
81 } // namespace test | 82 } // namespace test |
82 } // namespace tools | 83 } // namespace tools |
83 } // namespace net | 84 } // namespace net |
OLD | NEW |