| 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> |
| 11 | 11 |
| 12 #include "base/files/file_enumerator.h" | 12 #include "base/files/file_enumerator.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "net/quic/platform/api/quic_test.h" | 14 #include "net/quic/platform/api/quic_test.h" |
| 15 #include "net/quic/platform/api/quic_test_loopback.h" |
| 15 #include "net/quic/platform/api/quic_text_utils.h" | 16 #include "net/quic/platform/api/quic_text_utils.h" |
| 16 #include "net/quic/test_tools/crypto_test_utils.h" | 17 #include "net/quic/test_tools/crypto_test_utils.h" |
| 17 #include "net/quic/test_tools/quic_test_utils.h" | 18 #include "net/quic/test_tools/quic_test_utils.h" |
| 18 #include "net/tools/epoll_server/epoll_server.h" | 19 #include "net/tools/epoll_server/epoll_server.h" |
| 19 #include "net/tools/quic/test_tools/quic_client_peer.h" | 20 #include "net/tools/quic/test_tools/quic_client_peer.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 22 |
| 22 namespace net { | 23 namespace net { |
| 23 namespace test { | 24 namespace test { |
| 24 namespace { | 25 namespace { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 socket_count++; | 43 socket_count++; |
| 43 } | 44 } |
| 44 } | 45 } |
| 45 | 46 |
| 46 return socket_count; | 47 return socket_count; |
| 47 } | 48 } |
| 48 | 49 |
| 49 // Creates a new QuicClient and Initializes it. Caller is responsible for | 50 // Creates a new QuicClient and Initializes it. Caller is responsible for |
| 50 // deletion. | 51 // deletion. |
| 51 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16_t port) { | 52 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16_t port) { |
| 52 QuicSocketAddress server_address( | 53 QuicSocketAddress server_address(QuicSocketAddress(TestLoopback(), port)); |
| 53 QuicSocketAddress(QuicIpAddress::Loopback4(), port)); | |
| 54 QuicServerId server_id("hostname", server_address.port(), | 54 QuicServerId server_id("hostname", server_address.port(), |
| 55 PRIVACY_MODE_DISABLED); | 55 PRIVACY_MODE_DISABLED); |
| 56 QuicVersionVector versions = AllSupportedVersions(); | 56 QuicVersionVector versions = AllSupportedVersions(); |
| 57 QuicClient* client = | 57 QuicClient* client = |
| 58 new QuicClient(server_address, server_id, versions, eps, | 58 new QuicClient(server_address, server_id, versions, eps, |
| 59 crypto_test_utils::ProofVerifierForTesting()); | 59 crypto_test_utils::ProofVerifierForTesting()); |
| 60 EXPECT_TRUE(client->Initialize()); | 60 EXPECT_TRUE(client->Initialize()); |
| 61 return client; | 61 return client; |
| 62 } | 62 } |
| 63 | 63 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Clean up UDP sockets. | 110 // Clean up UDP sockets. |
| 111 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); | 111 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); |
| 112 EXPECT_EQ(number_of_open_fds + 2, NumOpenSocketFDs()); | 112 EXPECT_EQ(number_of_open_fds + 2, NumOpenSocketFDs()); |
| 113 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); | 113 QuicClientPeer::CleanUpUDPSocket(client.get(), client->GetLatestFD()); |
| 114 EXPECT_EQ(number_of_open_fds + 1, NumOpenSocketFDs()); | 114 EXPECT_EQ(number_of_open_fds + 1, NumOpenSocketFDs()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 } // namespace | 117 } // namespace |
| 118 } // namespace test | 118 } // namespace test |
| 119 } // namespace net | 119 } // namespace net |
| OLD | NEW |