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

Side by Side Diff: net/socket/socks_client_socket_unittest.cc

Issue 155618: Use manually constructed IPv6 socket addresses for tests, rather than system ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 11 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | no next file » | 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 "net/socket/socks_client_socket.h" 5 #include "net/socket/socks_client_socket.h"
6 6
7 #include "net/base/address_list.h" 7 #include "net/base/address_list.h"
8 #include "net/base/listen_socket.h" 8 #include "net/base/listen_socket.h"
9 #include "net/base/mock_host_resolver.h" 9 #include "net/base/mock_host_resolver.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 EXPECT_EQ(OK, rv); 246 EXPECT_EQ(OK, rv);
247 EXPECT_TRUE(user_sock_->IsConnected()); 247 EXPECT_TRUE(user_sock_->IsConnected());
248 EXPECT_EQ(SOCKSClientSocket::kSOCKS4a, user_sock_->socks_version_); 248 EXPECT_EQ(SOCKSClientSocket::kSOCKS4a, user_sock_->socks_version_);
249 } 249 }
250 250
251 // Tries to connect to a domain that resolves to IPv6. 251 // Tries to connect to a domain that resolves to IPv6.
252 // Should revert to SOCKS4a. 252 // Should revert to SOCKS4a.
253 TEST_F(SOCKSClientSocketTest, SOCKS4AIfDomainInIPv6) { 253 TEST_F(SOCKSClientSocketTest, SOCKS4AIfDomainInIPv6) {
254 const char hostname[] = "an.ipv6.address"; 254 const char hostname[] = "an.ipv6.address";
255 255
256 host_resolver_->rules()->AddRule(hostname, "2001:db8:8714:3a90::12"); 256 host_resolver_->rules()->AddIPv6Rule(hostname, "2001:db8:8714:3a90::12");
257 257
258 std::string request(kSOCKS4aInitialRequest, 258 std::string request(kSOCKS4aInitialRequest,
259 arraysize(kSOCKS4aInitialRequest)); 259 arraysize(kSOCKS4aInitialRequest));
260 request.append(hostname, arraysize(hostname)); 260 request.append(hostname, arraysize(hostname));
261 261
262 MockWrite data_writes[] = { 262 MockWrite data_writes[] = {
263 MockWrite(false, request.data(), request.size()) }; 263 MockWrite(false, request.data(), request.size()) };
264 MockRead data_reads[] = { 264 MockRead data_reads[] = {
265 MockRead(false, kSOCKSOkReply, arraysize(kSOCKSOkReply)) }; 265 MockRead(false, kSOCKSOkReply, arraysize(kSOCKSOkReply)) };
266 266
267 user_sock_.reset(BuildMockSocket(data_reads, data_writes, hostname, 80)); 267 user_sock_.reset(BuildMockSocket(data_reads, data_writes, hostname, 80));
268 268
269 int rv = user_sock_->Connect(&callback_); 269 int rv = user_sock_->Connect(&callback_);
270 EXPECT_EQ(ERR_IO_PENDING, rv); 270 EXPECT_EQ(ERR_IO_PENDING, rv);
271 rv = callback_.WaitForResult(); 271 rv = callback_.WaitForResult();
272 EXPECT_EQ(OK, rv); 272 EXPECT_EQ(OK, rv);
273 EXPECT_TRUE(user_sock_->IsConnected()); 273 EXPECT_TRUE(user_sock_->IsConnected());
274 EXPECT_EQ(SOCKSClientSocket::kSOCKS4a, user_sock_->socks_version_); 274 EXPECT_EQ(SOCKSClientSocket::kSOCKS4a, user_sock_->socks_version_);
275 } 275 }
276 276
277 } // namespace net 277 } // namespace net
278 278
OLDNEW
« no previous file with comments | « net/socket/socks5_client_socket_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698