| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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.h" | 5 #include "net/tools/quic/quic_client.h" |
| 6 | 6 |
| 7 #include <dirent.h> | 7 #include <dirent.h> |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 return number_of_open_fds; | 37 return number_of_open_fds; |
| 38 } | 38 } |
| 39 | 39 |
| 40 // Creates a new QuicClient and Initializes it. Caller is responsible for | 40 // Creates a new QuicClient and Initializes it. Caller is responsible for |
| 41 // deletion. | 41 // deletion. |
| 42 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16_t port) { | 42 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16_t port) { |
| 43 IPEndPoint server_address(IPEndPoint(net::test::Loopback4(), port)); | 43 IPEndPoint server_address(IPEndPoint(net::test::Loopback4(), port)); |
| 44 QuicServerId server_id("hostname", server_address.port(), | 44 QuicServerId server_id("hostname", server_address.port(), |
| 45 PRIVACY_MODE_DISABLED); | 45 PRIVACY_MODE_DISABLED); |
| 46 QuicVersionVector versions = QuicSupportedVersions(); | 46 QuicVersionVector versions = AllSupportedVersions(); |
| 47 QuicClient* client = | 47 QuicClient* client = |
| 48 new QuicClient(server_address, server_id, versions, eps, | 48 new QuicClient(server_address, server_id, versions, eps, |
| 49 CryptoTestUtils::ProofVerifierForTesting()); | 49 CryptoTestUtils::ProofVerifierForTesting()); |
| 50 EXPECT_TRUE(client->Initialize()); | 50 EXPECT_TRUE(client->Initialize()); |
| 51 return client; | 51 return client; |
| 52 } | 52 } |
| 53 | 53 |
| 54 TEST(QuicClientTest, DoNotLeakFDs) { | 54 TEST(QuicClientTest, DoNotLeakFDs) { |
| 55 // Create a ProofVerifier before counting the number of open FDs to work | 55 // Create a ProofVerifier before counting the number of open FDs to work |
| 56 // around some ASAN weirdness. | 56 // around some ASAN weirdness. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Clean up UDP sockets. | 98 // Clean up UDP sockets. |
| 99 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); | 99 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); |
| 100 EXPECT_EQ(number_of_open_fds + 2, NumOpenFDs()); | 100 EXPECT_EQ(number_of_open_fds + 2, NumOpenFDs()); |
| 101 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); | 101 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); |
| 102 EXPECT_EQ(number_of_open_fds + 1, NumOpenFDs()); | 102 EXPECT_EQ(number_of_open_fds + 1, NumOpenFDs()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 } // namespace test | 106 } // namespace test |
| 107 } // namespace net | 107 } // namespace net |
| OLD | NEW |