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