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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 void AdbClientSocket::Connect(const net::CompletionCallback& callback) { | 372 void AdbClientSocket::Connect(const net::CompletionCallback& callback) { |
373 net::IPAddressNumber ip_number; | 373 net::IPAddressNumber ip_number; |
374 if (!net::ParseIPLiteralToNumber(host_, &ip_number)) { | 374 if (!net::ParseIPLiteralToNumber(host_, &ip_number)) { |
375 callback.Run(net::ERR_FAILED); | 375 callback.Run(net::ERR_FAILED); |
376 return; | 376 return; |
377 } | 377 } |
378 | 378 |
379 net::AddressList address_list = | 379 net::AddressList address_list = |
380 net::AddressList::CreateFromIPAddress(ip_number, port_); | 380 net::AddressList::CreateFromIPAddress(ip_number, port_); |
381 socket_.reset(new net::TCPClientSocket(address_list, NULL, | 381 socket_.reset(new net::TCPClientSocket(address_list, NULL, NULL, |
382 net::NetLog::Source())); | 382 net::NetLog::Source())); |
383 int result = socket_->Connect(callback); | 383 int result = socket_->Connect(callback); |
384 if (result != net::ERR_IO_PENDING) | 384 if (result != net::ERR_IO_PENDING) |
385 callback.Run(result); | 385 callback.Run(result); |
386 } | 386 } |
387 | 387 |
388 void AdbClientSocket::SendCommand(const std::string& command, | 388 void AdbClientSocket::SendCommand(const std::string& command, |
389 bool is_void, | 389 bool is_void, |
390 bool has_length, | 390 bool has_length, |
391 const CommandCallback& callback) { | 391 const CommandCallback& callback) { |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 base::Unretained(this), | 537 base::Unretained(this), |
538 callback, | 538 callback, |
539 new_response, | 539 new_response, |
540 response_buffer, | 540 response_buffer, |
541 bytes_left)); | 541 bytes_left)); |
542 if (result > 0) | 542 if (result > 0) |
543 OnResponseData(callback, new_response, response_buffer, bytes_left, result); | 543 OnResponseData(callback, new_response, response_buffer, bytes_left, result); |
544 else if (result != net::ERR_IO_PENDING) | 544 else if (result != net::ERR_IO_PENDING) |
545 callback.Run(net::OK, new_response); | 545 callback.Run(net::OK, new_response); |
546 } | 546 } |
OLD | NEW |