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

Side by Side Diff: net/proxy/proxy_resolver_js_bindings_unittest.cc

Issue 598071: Really connect to the same server in FTP network transaction. (Closed)
Patch Set: updates Created 10 years, 10 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/ftp/ftp_network_transaction_unittest.cc ('k') | net/socket/client_socket.h » ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "net/base/address_list.h" 6 #include "net/base/address_list.h"
7 #include "net/base/mock_host_resolver.h" 7 #include "net/base/mock_host_resolver.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "net/base/sys_addrinfo.h" 10 #include "net/base/sys_addrinfo.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // Build an addrinfo for |ip_literal|. 60 // Build an addrinfo for |ip_literal|.
61 AddressList result = ResolveIPLiteral(ip_literal); 61 AddressList result = ResolveIPLiteral(ip_literal);
62 62
63 struct addrinfo* result_head = const_cast<struct addrinfo*>(result.head()); 63 struct addrinfo* result_head = const_cast<struct addrinfo*>(result.head());
64 64
65 // Temporarily append |orig_list| to |result|. 65 // Temporarily append |orig_list| to |result|.
66 result_head->ai_next = const_cast<struct addrinfo*>(orig_list.head()); 66 result_head->ai_next = const_cast<struct addrinfo*>(orig_list.head());
67 67
68 // Make a copy of the concatenated list. 68 // Make a copy of the concatenated list.
69 AddressList concatenated; 69 AddressList concatenated;
70 concatenated.Copy(result.head()); 70 concatenated.Copy(result.head(), true);
71 71
72 // Restore |result| (so it is freed properly). 72 // Restore |result| (so it is freed properly).
73 result_head->ai_next = NULL; 73 result_head->ai_next = NULL;
74 74
75 return concatenated; 75 return concatenated;
76 } 76 }
77 }; 77 };
78 78
79 TEST(ProxyResolverJSBindingsTest, DnsResolve) { 79 TEST(ProxyResolverJSBindingsTest, DnsResolve) {
80 scoped_refptr<MockHostResolver> host_resolver(new MockHostResolver); 80 scoped_refptr<MockHostResolver> host_resolver(new MockHostResolver);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2", 180 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2",
181 bindings->MyIpAddressEx()); 181 bindings->MyIpAddressEx());
182 182
183 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2", 183 EXPECT_EQ("192.168.1.1;172.22.34.1;200.100.1.2",
184 bindings->DnsResolveEx("FOO")); 184 bindings->DnsResolveEx("FOO"));
185 } 185 }
186 186
187 } // namespace 187 } // namespace
188 } // namespace net 188 } // namespace net
OLDNEW
« no previous file with comments | « net/ftp/ftp_network_transaction_unittest.cc ('k') | net/socket/client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698