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

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

Issue 2933613002: Add quic_test_loopback used for tests only. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_server_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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
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
OLDNEW
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_server_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698