| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/socks5_client_socket.h" | 5 #include "net/socket/socks5_client_socket.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 host_resolver_(new MockHostResolver) { | 73 host_resolver_(new MockHostResolver) { |
| 74 } | 74 } |
| 75 | 75 |
| 76 // Set up platform before every test case | 76 // Set up platform before every test case |
| 77 void SOCKS5ClientSocketTest::SetUp() { | 77 void SOCKS5ClientSocketTest::SetUp() { |
| 78 PlatformTest::SetUp(); | 78 PlatformTest::SetUp(); |
| 79 | 79 |
| 80 // Resolve the "localhost" AddressList used by the TCP connection to connect. | 80 // Resolve the "localhost" AddressList used by the TCP connection to connect. |
| 81 HostResolver::RequestInfo info(HostPortPair("www.socks-proxy.com", 1080)); | 81 HostResolver::RequestInfo info(HostPortPair("www.socks-proxy.com", 1080)); |
| 82 TestCompletionCallback callback; | 82 TestCompletionCallback callback; |
| 83 int rv = host_resolver_->Resolve(info, | 83 std::unique_ptr<HostResolver::Request> request; |
| 84 DEFAULT_PRIORITY, | 84 int rv = |
| 85 &address_list_, | 85 host_resolver_->Resolve(info, DEFAULT_PRIORITY, &address_list_, |
| 86 callback.callback(), | 86 callback.callback(), &request, BoundNetLog()); |
| 87 NULL, | |
| 88 BoundNetLog()); | |
| 89 ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); | 87 ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); |
| 90 rv = callback.WaitForResult(); | 88 rv = callback.WaitForResult(); |
| 91 ASSERT_THAT(rv, IsOk()); | 89 ASSERT_THAT(rv, IsOk()); |
| 92 } | 90 } |
| 93 | 91 |
| 94 std::unique_ptr<SOCKS5ClientSocket> SOCKS5ClientSocketTest::BuildMockSocket( | 92 std::unique_ptr<SOCKS5ClientSocket> SOCKS5ClientSocketTest::BuildMockSocket( |
| 95 MockRead reads[], | 93 MockRead reads[], |
| 96 size_t reads_count, | 94 size_t reads_count, |
| 97 MockWrite writes[], | 95 MockWrite writes[], |
| 98 size_t writes_count, | 96 size_t writes_count, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 EXPECT_TRUE(user_sock_->IsConnected()); | 378 EXPECT_TRUE(user_sock_->IsConnected()); |
| 381 net_log_.GetEntries(&net_log_entries); | 379 net_log_.GetEntries(&net_log_entries); |
| 382 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, | 380 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, |
| 383 NetLog::TYPE_SOCKS5_CONNECT)); | 381 NetLog::TYPE_SOCKS5_CONNECT)); |
| 384 } | 382 } |
| 385 } | 383 } |
| 386 | 384 |
| 387 } // namespace | 385 } // namespace |
| 388 | 386 |
| 389 } // namespace net | 387 } // namespace net |
| OLD | NEW |