Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: net/tools/quic/quic_client_test.cc

Issue 847813005: Updates quic_client_bin.cc to be more user friendly, and support more (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Refactoring_code_for_readability_83493327
Patch Set: Added DumpHeadersToString to dump response headers Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <dirent.h> 5 #include <dirent.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "net/quic/test_tools/quic_test_utils.h" 10 #include "net/quic/test_tools/quic_test_utils.h"
(...skipping 22 matching lines...) Expand all
33 return number_of_open_fds; 33 return number_of_open_fds;
34 } 34 }
35 35
36 // Creates a new QuicClient and Initializes it. Caller is responsible for 36 // Creates a new QuicClient and Initializes it. Caller is responsible for
37 // deletion. 37 // deletion.
38 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16 port) { 38 QuicClient* CreateAndInitializeQuicClient(EpollServer* eps, uint16 port) {
39 IPEndPoint server_address(IPEndPoint(net::test::Loopback4(), port)); 39 IPEndPoint server_address(IPEndPoint(net::test::Loopback4(), port));
40 QuicServerId server_id("hostname", server_address.port(), false, 40 QuicServerId server_id("hostname", server_address.port(), false,
41 PRIVACY_MODE_DISABLED); 41 PRIVACY_MODE_DISABLED);
42 QuicVersionVector versions = QuicSupportedVersions(); 42 QuicVersionVector versions = QuicSupportedVersions();
43 QuicClient* client = 43 QuicClient* client = new QuicClient(server_address, server_id, versions, eps);
44 new QuicClient(server_address, server_id, versions, false, eps);
45 EXPECT_TRUE(client->Initialize()); 44 EXPECT_TRUE(client->Initialize());
46 return client; 45 return client;
47 } 46 }
48 47
49 TEST(QuicClientTest, DoNotLeakFDs) { 48 TEST(QuicClientTest, DoNotLeakFDs) {
50 // Make sure that the QuicClient doesn't leak FDs. Doing so could cause port 49 // Make sure that the QuicClient doesn't leak FDs. Doing so could cause port
51 // exhaustion in long running processes which repeatedly create clients. 50 // exhaustion in long running processes which repeatedly create clients.
52 51
53 // Record initial number of FDs, after creation of EpollServer. 52 // Record initial number of FDs, after creation of EpollServer.
54 EpollServer eps; 53 EpollServer eps;
(...skipping 11 matching lines...) Expand all
66 } 65 }
67 66
68 // The FDs created by the QuicClients should now be closed. 67 // The FDs created by the QuicClients should now be closed.
69 EXPECT_EQ(number_of_open_fds, NumOpenFDs()); 68 EXPECT_EQ(number_of_open_fds, NumOpenFDs());
70 } 69 }
71 70
72 } // namespace 71 } // namespace
73 } // namespace test 72 } // namespace test
74 } // namespace tools 73 } // namespace tools
75 } // namespace net 74 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698