| 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 28 matching lines...) Expand all Loading... |
| 39 bool TestClient::Start(const HostPortPair& server_host_port_pair, | 39 bool TestClient::Start(const HostPortPair& server_host_port_pair, |
| 40 int bytes_to_send, | 40 int bytes_to_send, |
| 41 const CompletionCallback& callback) { | 41 const CompletionCallback& callback) { |
| 42 DCHECK(!socket_); | 42 DCHECK(!socket_); |
| 43 DCHECK(finished_callback_.is_null()); | 43 DCHECK(finished_callback_.is_null()); |
| 44 | 44 |
| 45 finished_callback_ = callback; | 45 finished_callback_ = callback; |
| 46 bytes_to_read_ = bytes_to_send_ = bytes_to_send; | 46 bytes_to_read_ = bytes_to_send_ = bytes_to_send; |
| 47 | 47 |
| 48 scoped_ptr<HostResolver> system_host_resolver( | 48 scoped_ptr<HostResolver> system_host_resolver( |
| 49 CreateSystemHostResolver(1, 0, NULL)); | 49 HostResolver::CreateDefaultResolver(NULL)); |
| 50 SingleRequestHostResolver host_resolver(system_host_resolver.get()); | 50 SingleRequestHostResolver host_resolver(system_host_resolver.get()); |
| 51 HostResolver::RequestInfo request(server_host_port_pair); | 51 HostResolver::RequestInfo request(server_host_port_pair); |
| 52 AddressList addresses; | 52 AddressList addresses; |
| 53 int rv = host_resolver.Resolve(request, &addresses, CompletionCallback(), | 53 int rv = host_resolver.Resolve(request, &addresses, CompletionCallback(), |
| 54 BoundNetLog()); | 54 BoundNetLog()); |
| 55 if (rv != OK) { | 55 if (rv != OK) { |
| 56 LOG(ERROR) << "Could not resolve host"; | 56 LOG(ERROR) << "Could not resolve host"; |
| 57 return false; | 57 return false; |
| 58 } | 58 } |
| 59 | 59 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 void TestClient::Finish(int result) { | 168 void TestClient::Finish(int result) { |
| 169 DCHECK(!finished_callback_.is_null()); | 169 DCHECK(!finished_callback_.is_null()); |
| 170 | 170 |
| 171 LOG(ERROR) << "TestClient Done!"; | 171 LOG(ERROR) << "TestClient Done!"; |
| 172 CompletionCallback callback = finished_callback_; | 172 CompletionCallback callback = finished_callback_; |
| 173 finished_callback_.Reset(); | 173 finished_callback_.Reset(); |
| 174 callback.Run(result); | 174 callback.Run(result); |
| 175 } | 175 } |
| 176 | 176 |
| 177 } // namespace net | 177 } // namespace net |
| OLD | NEW |