| 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 "base/basictypes.h" |  | 
| 11 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" | 
| 12 #include "net/quic/test_tools/crypto_test_utils.h" | 11 #include "net/quic/test_tools/crypto_test_utils.h" | 
| 13 #include "net/quic/test_tools/quic_test_utils.h" | 12 #include "net/quic/test_tools/quic_test_utils.h" | 
| 14 #include "net/tools/epoll_server/epoll_server.h" | 13 #include "net/tools/epoll_server/epoll_server.h" | 
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" | 
| 16 | 15 | 
| 17 using net::EpollServer; | 16 using net::EpollServer; | 
| 18 using net::test::CryptoTestUtils; | 17 using net::test::CryptoTestUtils; | 
| 19 | 18 | 
| 20 namespace net { | 19 namespace net { | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 31   DIR* dir = opendir(buf); | 30   DIR* dir = opendir(buf); | 
| 32   while ((dp = readdir(dir)) != NULL) | 31   while ((dp = readdir(dir)) != NULL) | 
| 33     number_of_open_fds++; | 32     number_of_open_fds++; | 
| 34   closedir(dir); | 33   closedir(dir); | 
| 35 | 34 | 
| 36   return number_of_open_fds; | 35   return number_of_open_fds; | 
| 37 } | 36 } | 
| 38 | 37 | 
| 39 // Creates a new QuicClient and Initializes it. Caller is responsible for | 38 // Creates a new QuicClient and Initializes it. Caller is responsible for | 
| 40 // deletion. | 39 // deletion. | 
| 41 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16 port) { | 40 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16_t port) { | 
| 42   IPEndPoint server_address(IPEndPoint(net::test::Loopback4(), port)); | 41   IPEndPoint server_address(IPEndPoint(net::test::Loopback4(), port)); | 
| 43   QuicServerId server_id("hostname", server_address.port(), | 42   QuicServerId server_id("hostname", server_address.port(), | 
| 44                          PRIVACY_MODE_DISABLED); | 43                          PRIVACY_MODE_DISABLED); | 
| 45   QuicVersionVector versions = QuicSupportedVersions(); | 44   QuicVersionVector versions = QuicSupportedVersions(); | 
| 46   QuicClient* client = | 45   QuicClient* client = | 
| 47       new QuicClient(server_address, server_id, versions, eps, | 46       new QuicClient(server_address, server_id, versions, eps, | 
| 48                      CryptoTestUtils::ProofVerifierForTesting()); | 47                      CryptoTestUtils::ProofVerifierForTesting()); | 
| 49   EXPECT_TRUE(client->Initialize()); | 48   EXPECT_TRUE(client->Initialize()); | 
| 50   return client; | 49   return client; | 
| 51 } | 50 } | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 74   } | 73   } | 
| 75 | 74 | 
| 76   // The FDs created by the QuicClients should now be closed. | 75   // The FDs created by the QuicClients should now be closed. | 
| 77   EXPECT_EQ(number_of_open_fds, NumOpenFDs()); | 76   EXPECT_EQ(number_of_open_fds, NumOpenFDs()); | 
| 78 } | 77 } | 
| 79 | 78 | 
| 80 }  // namespace | 79 }  // namespace | 
| 81 }  // namespace test | 80 }  // namespace test | 
| 82 }  // namespace tools | 81 }  // namespace tools | 
| 83 }  // namespace net | 82 }  // namespace net | 
| OLD | NEW | 
|---|