OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/net_log.h" | 8 #include "net/base/net_log.h" |
9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
10 #include "net/base/mock_host_resolver.h" | 10 #include "net/base/mock_host_resolver.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 // Implementation of HostResolver that never completes its resolve request. | 81 // Implementation of HostResolver that never completes its resolve request. |
82 // We use this in the test "DisconnectWhileHostResolveInProgress" to make | 82 // We use this in the test "DisconnectWhileHostResolveInProgress" to make |
83 // sure that the outstanding resolve request gets cancelled. | 83 // sure that the outstanding resolve request gets cancelled. |
84 class HangingHostResolverWithCancel : public HostResolver { | 84 class HangingHostResolverWithCancel : public HostResolver { |
85 public: | 85 public: |
86 HangingHostResolverWithCancel() : outstanding_request_(NULL) {} | 86 HangingHostResolverWithCancel() : outstanding_request_(NULL) {} |
87 | 87 |
88 virtual int Resolve(const RequestInfo& info, | 88 virtual int Resolve(const RequestInfo& info, |
89 AddressList* addresses, | 89 AddressList* addresses, |
90 OldCompletionCallback* callback, | 90 const CompletionCallback& callback, |
91 RequestHandle* out_req, | 91 RequestHandle* out_req, |
92 const BoundNetLog& net_log) OVERRIDE { | 92 const BoundNetLog& net_log) OVERRIDE { |
93 DCHECK(addresses); | 93 DCHECK(addresses); |
94 DCHECK(callback); | 94 DCHECK_EQ(false, callback.is_null()); |
95 EXPECT_FALSE(HasOutstandingRequest()); | 95 EXPECT_FALSE(HasOutstandingRequest()); |
96 outstanding_request_ = reinterpret_cast<RequestHandle>(1); | 96 outstanding_request_ = reinterpret_cast<RequestHandle>(1); |
97 *out_req = outstanding_request_; | 97 *out_req = outstanding_request_; |
98 return ERR_IO_PENDING; | 98 return ERR_IO_PENDING; |
99 } | 99 } |
100 | 100 |
101 virtual int ResolveFromCache(const RequestInfo& info, | 101 virtual int ResolveFromCache(const RequestInfo& info, |
102 AddressList* addresses, | 102 AddressList* addresses, |
103 const BoundNetLog& net_log) OVERRIDE { | 103 const BoundNetLog& net_log) OVERRIDE { |
104 NOTIMPLEMENTED(); | 104 NOTIMPLEMENTED(); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 // Disconnect the SOCKS socket -- this should cancel the outstanding resolve. | 394 // Disconnect the SOCKS socket -- this should cancel the outstanding resolve. |
395 user_sock_->Disconnect(); | 395 user_sock_->Disconnect(); |
396 | 396 |
397 EXPECT_FALSE(hanging_resolver->HasOutstandingRequest()); | 397 EXPECT_FALSE(hanging_resolver->HasOutstandingRequest()); |
398 | 398 |
399 EXPECT_FALSE(user_sock_->IsConnected()); | 399 EXPECT_FALSE(user_sock_->IsConnected()); |
400 EXPECT_FALSE(user_sock_->IsConnectedAndIdle()); | 400 EXPECT_FALSE(user_sock_->IsConnectedAndIdle()); |
401 } | 401 } |
402 | 402 |
403 } // namespace net | 403 } // namespace net |
OLD | NEW |