| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/test/chromedriver/net/adb_client_socket.h" | 5 #include "chrome/test/chromedriver/net/adb_client_socket.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 | 360 |
| 361 AdbClientSocket::AdbClientSocket(int port) : port_(port) {} | 361 AdbClientSocket::AdbClientSocket(int port) : port_(port) {} |
| 362 | 362 |
| 363 AdbClientSocket::~AdbClientSocket() { | 363 AdbClientSocket::~AdbClientSocket() { |
| 364 } | 364 } |
| 365 | 365 |
| 366 void AdbClientSocket::Connect(const net::CompletionCallback& callback) { | 366 void AdbClientSocket::Connect(const net::CompletionCallback& callback) { |
| 367 net::AddressList address_list = net::AddressList::CreateFromIPAddress( | 367 net::AddressList address_list = net::AddressList::CreateFromIPAddress( |
| 368 net::IPAddress::IPv4Localhost(), port_); | 368 net::IPAddress::IPv4Localhost(), port_); |
| 369 socket_.reset(new net::TCPClientSocket(address_list, NULL, | 369 socket_.reset(new net::TCPClientSocket(address_list, NULL, NULL, |
| 370 net::NetLog::Source())); | 370 net::NetLog::Source())); |
| 371 int result = socket_->Connect(callback); | 371 int result = socket_->Connect(callback); |
| 372 if (result != net::ERR_IO_PENDING) | 372 if (result != net::ERR_IO_PENDING) |
| 373 callback.Run(result); | 373 callback.Run(result); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void AdbClientSocket::SendCommand(const std::string& command, | 376 void AdbClientSocket::SendCommand(const std::string& command, |
| 377 bool is_void, | 377 bool is_void, |
| 378 bool has_length, | 378 bool has_length, |
| 379 const CommandCallback& callback) { | 379 const CommandCallback& callback) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 base::Unretained(this), | 525 base::Unretained(this), |
| 526 callback, | 526 callback, |
| 527 new_response, | 527 new_response, |
| 528 response_buffer, | 528 response_buffer, |
| 529 bytes_left)); | 529 bytes_left)); |
| 530 if (result > 0) | 530 if (result > 0) |
| 531 OnResponseData(callback, new_response, response_buffer, bytes_left, result); | 531 OnResponseData(callback, new_response, response_buffer, bytes_left, result); |
| 532 else if (result != net::ERR_IO_PENDING) | 532 else if (result != net::ERR_IO_PENDING) |
| 533 callback.Run(net::OK, new_response); | 533 callback.Run(net::OK, new_response); |
| 534 } | 534 } |
| OLD | NEW |