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/curvecp/test_client.h" | 5 #include "net/curvecp/test_client.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 DCHECK(!finished_callback_); | 50 DCHECK(!finished_callback_); |
51 | 51 |
52 finished_callback_ = callback; | 52 finished_callback_ = callback; |
53 bytes_to_read_ = bytes_to_send_ = bytes_to_send; | 53 bytes_to_read_ = bytes_to_send_ = bytes_to_send; |
54 | 54 |
55 scoped_ptr<HostResolver> system_host_resolver( | 55 scoped_ptr<HostResolver> system_host_resolver( |
56 CreateSystemHostResolver(1, 0, NULL)); | 56 CreateSystemHostResolver(1, 0, NULL)); |
57 SingleRequestHostResolver host_resolver(system_host_resolver.get()); | 57 SingleRequestHostResolver host_resolver(system_host_resolver.get()); |
58 HostResolver::RequestInfo request(server_host_port_pair); | 58 HostResolver::RequestInfo request(server_host_port_pair); |
59 AddressList addresses; | 59 AddressList addresses; |
60 int rv = host_resolver.Resolve(request, &addresses, NULL, BoundNetLog()); | 60 int rv = host_resolver.Resolve(request, &addresses, CompletionCallback(), |
| 61 BoundNetLog()); |
61 if (rv != OK) { | 62 if (rv != OK) { |
62 LOG(ERROR) << "Could not resolve host"; | 63 LOG(ERROR) << "Could not resolve host"; |
63 return false; | 64 return false; |
64 } | 65 } |
65 | 66 |
66 socket_ = new CurveCPClientSocket(addresses, NULL, NetLog::Source()); | 67 socket_ = new CurveCPClientSocket(addresses, NULL, NetLog::Source()); |
67 rv = socket_->Connect(&connect_callback_); | 68 rv = socket_->Connect(&connect_callback_); |
68 if (rv == ERR_IO_PENDING) | 69 if (rv == ERR_IO_PENDING) |
69 return true; | 70 return true; |
70 OnConnectComplete(rv); | 71 OnConnectComplete(rv); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 void TestClient::Finish(int result) { | 171 void TestClient::Finish(int result) { |
171 DCHECK(finished_callback_); | 172 DCHECK(finished_callback_); |
172 | 173 |
173 LOG(ERROR) << "TestClient Done!"; | 174 LOG(ERROR) << "TestClient Done!"; |
174 OldCompletionCallback* callback = finished_callback_; | 175 OldCompletionCallback* callback = finished_callback_; |
175 finished_callback_ = NULL; | 176 finished_callback_ = NULL; |
176 callback->Run(result); | 177 callback->Run(result); |
177 } | 178 } |
178 | 179 |
179 } // namespace net | 180 } // namespace net |
OLD | NEW |