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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 75 } |
76 | 76 |
77 // Set up platform before every test case | 77 // Set up platform before every test case |
78 void SOCKS5ClientSocketTest::SetUp() { | 78 void SOCKS5ClientSocketTest::SetUp() { |
79 PlatformTest::SetUp(); | 79 PlatformTest::SetUp(); |
80 | 80 |
81 // Resolve the "localhost" AddressList used by the TCP connection to connect. | 81 // Resolve the "localhost" AddressList used by the TCP connection to connect. |
82 HostResolver::RequestInfo info(HostPortPair("www.socks-proxy.com", 1080)); | 82 HostResolver::RequestInfo info(HostPortPair("www.socks-proxy.com", 1080)); |
83 TestCompletionCallback callback; | 83 TestCompletionCallback callback; |
84 std::unique_ptr<HostResolver::Request> request; | 84 std::unique_ptr<HostResolver::Request> request; |
85 int rv = | 85 int rv = host_resolver_->Resolve(info, DEFAULT_PRIORITY, &address_list_, |
86 host_resolver_->Resolve(info, DEFAULT_PRIORITY, &address_list_, | 86 callback.callback(), &request, |
87 callback.callback(), &request, BoundNetLog()); | 87 NetLogWithSource()); |
88 ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); | 88 ASSERT_THAT(rv, IsError(ERR_IO_PENDING)); |
89 rv = callback.WaitForResult(); | 89 rv = callback.WaitForResult(); |
90 ASSERT_THAT(rv, IsOk()); | 90 ASSERT_THAT(rv, IsOk()); |
91 } | 91 } |
92 | 92 |
93 std::unique_ptr<SOCKS5ClientSocket> SOCKS5ClientSocketTest::BuildMockSocket( | 93 std::unique_ptr<SOCKS5ClientSocket> SOCKS5ClientSocketTest::BuildMockSocket( |
94 MockRead reads[], | 94 MockRead reads[], |
95 size_t reads_count, | 95 size_t reads_count, |
96 MockWrite writes[], | 96 MockWrite writes[], |
97 size_t writes_count, | 97 size_t writes_count, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 EXPECT_TRUE(user_sock_->IsConnected()); | 379 EXPECT_TRUE(user_sock_->IsConnected()); |
380 net_log_.GetEntries(&net_log_entries); | 380 net_log_.GetEntries(&net_log_entries); |
381 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, | 381 EXPECT_TRUE(LogContainsEndEvent(net_log_entries, -1, |
382 NetLogEventType::SOCKS5_CONNECT)); | 382 NetLogEventType::SOCKS5_CONNECT)); |
383 } | 383 } |
384 } | 384 } |
385 | 385 |
386 } // namespace | 386 } // namespace |
387 | 387 |
388 } // namespace net | 388 } // namespace net |
OLD | NEW |