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/socks_client_socket.h" | 5 #include "net/socket/socks_client_socket.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // sure that the outstanding resolve request gets cancelled. | 106 // sure that the outstanding resolve request gets cancelled. |
107 class HangingHostResolverWithCancel : public HostResolver { | 107 class HangingHostResolverWithCancel : public HostResolver { |
108 public: | 108 public: |
109 HangingHostResolverWithCancel() : outstanding_request_(NULL) {} | 109 HangingHostResolverWithCancel() : outstanding_request_(NULL) {} |
110 | 110 |
111 int Resolve(const RequestInfo& info, | 111 int Resolve(const RequestInfo& info, |
112 RequestPriority priority, | 112 RequestPriority priority, |
113 AddressList* addresses, | 113 AddressList* addresses, |
114 const CompletionCallback& callback, | 114 const CompletionCallback& callback, |
115 std::unique_ptr<Request>* out_req, | 115 std::unique_ptr<Request>* out_req, |
116 const BoundNetLog& net_log) override { | 116 const NetLogWithSource& net_log) override { |
117 DCHECK(addresses); | 117 DCHECK(addresses); |
118 DCHECK_EQ(false, callback.is_null()); | 118 DCHECK_EQ(false, callback.is_null()); |
119 EXPECT_FALSE(HasOutstandingRequest()); | 119 EXPECT_FALSE(HasOutstandingRequest()); |
120 outstanding_request_ = new RequestImpl(this); | 120 outstanding_request_ = new RequestImpl(this); |
121 out_req->reset(outstanding_request_); | 121 out_req->reset(outstanding_request_); |
122 return ERR_IO_PENDING; | 122 return ERR_IO_PENDING; |
123 } | 123 } |
124 | 124 |
125 int ResolveFromCache(const RequestInfo& info, | 125 int ResolveFromCache(const RequestInfo& info, |
126 AddressList* addresses, | 126 AddressList* addresses, |
127 const BoundNetLog& net_log) override { | 127 const NetLogWithSource& net_log) override { |
128 NOTIMPLEMENTED(); | 128 NOTIMPLEMENTED(); |
129 return ERR_UNEXPECTED; | 129 return ERR_UNEXPECTED; |
130 } | 130 } |
131 | 131 |
132 void RemoveRequest(Request* req) { | 132 void RemoveRequest(Request* req) { |
133 EXPECT_TRUE(HasOutstandingRequest()); | 133 EXPECT_TRUE(HasOutstandingRequest()); |
134 EXPECT_EQ(outstanding_request_, req); | 134 EXPECT_EQ(outstanding_request_, req); |
135 outstanding_request_ = nullptr; | 135 outstanding_request_ = nullptr; |
136 } | 136 } |
137 | 137 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 NULL, 0, | 461 NULL, 0, |
462 host_resolver.get(), | 462 host_resolver.get(), |
463 kHostName, 80, | 463 kHostName, 80, |
464 NULL); | 464 NULL); |
465 | 465 |
466 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, | 466 EXPECT_EQ(ERR_NAME_NOT_RESOLVED, |
467 callback_.GetResult(user_sock_->Connect(callback_.callback()))); | 467 callback_.GetResult(user_sock_->Connect(callback_.callback()))); |
468 } | 468 } |
469 | 469 |
470 } // namespace net | 470 } // namespace net |
OLD | NEW |