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/quic_flags.h" | 11 #include "net/quic/quic_flags.h" |
12 #include "net/quic/test_tools/crypto_test_utils.h" | 12 #include "net/quic/test_tools/crypto_test_utils.h" |
13 #include "net/quic/test_tools/quic_spdy_session_peer.h" | 13 #include "net/quic/test_tools/quic_spdy_session_peer.h" |
14 #include "net/quic/test_tools/quic_test_utils.h" | 14 #include "net/quic/test_tools/quic_test_utils.h" |
15 #include "net/tools/quic/quic_spdy_client_stream.h" | 15 #include "net/tools/quic/quic_spdy_client_stream.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 using net::test::ConstructEncryptedPacket; | 18 using net::test::ConstructEncryptedPacket; |
19 using net::test::ConstructMisFramedEncryptedPacket; | 19 using net::test::ConstructMisFramedEncryptedPacket; |
20 using net::test::CryptoTestUtils; | 20 using net::test::CryptoTestUtils; |
21 using net::test::DefaultQuicConfig; | 21 using net::test::DefaultQuicConfig; |
22 using net::test::MockConnection; | 22 using net::test::MockConnection; |
23 using net::test::MockHelper; | 23 using net::test::MockConnectionHelper; |
24 using net::test::PacketSavingConnection; | 24 using net::test::PacketSavingConnection; |
25 using net::test::QuicSpdySessionPeer; | 25 using net::test::QuicSpdySessionPeer; |
26 using net::test::SupportedVersions; | 26 using net::test::SupportedVersions; |
27 using net::test::TestPeerIPAddress; | 27 using net::test::TestPeerIPAddress; |
28 using net::test::ValueRestore; | 28 using net::test::ValueRestore; |
29 using net::test::kTestPort; | 29 using net::test::kTestPort; |
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::_; |
(...skipping 25 matching lines...) Expand all Loading... |
59 } | 59 } |
60 | 60 |
61 void CompleteCryptoHandshake() { | 61 void CompleteCryptoHandshake() { |
62 session_->CryptoConnect(); | 62 session_->CryptoConnect(); |
63 QuicCryptoClientStream* stream = | 63 QuicCryptoClientStream* stream = |
64 static_cast<QuicCryptoClientStream*>(session_->GetCryptoStream()); | 64 static_cast<QuicCryptoClientStream*>(session_->GetCryptoStream()); |
65 CryptoTestUtils::HandshakeWithFakeServer(&helper_, connection_, stream); | 65 CryptoTestUtils::HandshakeWithFakeServer(&helper_, connection_, stream); |
66 } | 66 } |
67 | 67 |
68 QuicCryptoClientConfig crypto_config_; | 68 QuicCryptoClientConfig crypto_config_; |
69 MockHelper helper_; | 69 MockConnectionHelper helper_; |
70 PacketSavingConnection* connection_; | 70 PacketSavingConnection* connection_; |
71 scoped_ptr<QuicClientSession> session_; | 71 scoped_ptr<QuicClientSession> session_; |
72 }; | 72 }; |
73 | 73 |
74 INSTANTIATE_TEST_CASE_P(Tests, ToolsQuicClientSessionTest, | 74 INSTANTIATE_TEST_CASE_P(Tests, ToolsQuicClientSessionTest, |
75 ::testing::ValuesIn(QuicSupportedVersions())); | 75 ::testing::ValuesIn(QuicSupportedVersions())); |
76 | 76 |
77 TEST_P(ToolsQuicClientSessionTest, CryptoConnect) { | 77 TEST_P(ToolsQuicClientSessionTest, CryptoConnect) { |
78 CompleteCryptoHandshake(); | 78 CompleteCryptoHandshake(); |
79 } | 79 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 PACKET_6BYTE_PACKET_NUMBER, nullptr)); | 217 PACKET_6BYTE_PACKET_NUMBER, nullptr)); |
218 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1); | 218 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails(_, _)).Times(1); |
219 session_->connection()->ProcessUdpPacket(client_address, server_address, | 219 session_->connection()->ProcessUdpPacket(client_address, server_address, |
220 *packet); | 220 *packet); |
221 } | 221 } |
222 | 222 |
223 } // namespace | 223 } // namespace |
224 } // namespace test | 224 } // namespace test |
225 } // namespace tools | 225 } // namespace tools |
226 } // namespace net | 226 } // namespace net |
OLD | NEW |