Chromium Code Reviews| Index: chrome/test/chromedriver/chrome/adb_impl.cc |
| diff --git a/chrome/test/chromedriver/chrome/adb_impl.cc b/chrome/test/chromedriver/chrome/adb_impl.cc |
| index c59232873a2dbe3e17e4f1eff7355a6ff1b7b414..a736231a7bdad64930ea5e514fcd1bdb1d6e22f7 100644 |
| --- a/chrome/test/chromedriver/chrome/adb_impl.cc |
| +++ b/chrome/test/chromedriver/chrome/adb_impl.cc |
| @@ -72,6 +72,17 @@ void ExecuteCommandOnIOThread( |
| base::Bind(&ResponseBuffer::OnResponse, response_buffer)); |
| } |
| +void SendFileOnIOThread(const std::string& device_serial, |
| + const std::string& filename, |
| + const std::string& content, |
| + scoped_refptr<ResponseBuffer> response_buffer, |
| + int port) { |
| + CHECK(base::MessageLoopForIO::IsCurrent()); |
| + AdbClientSocket::SendFile( |
| + port, device_serial, filename, content, |
| + base::Bind(&ResponseBuffer::OnResponse, response_buffer)); |
| +} |
| + |
| } // namespace |
| AdbImpl::AdbImpl( |
| @@ -122,20 +133,19 @@ Status AdbImpl::SetCommandLineFile(const std::string& device_serial, |
| const std::string& exec_name, |
| const std::string& args) { |
| std::string response; |
| - std::string quoted_command = |
| - base::GetQuotedJSONString(exec_name + " " + args); |
| - Status status = ExecuteHostShellCommand( |
| - device_serial, |
| - base::StringPrintf("echo %s > %s; echo $?", |
| - quoted_command.c_str(), |
| - command_line_file.c_str()), |
| - &response); |
| + std::string command(exec_name + " " + args + "\n"); |
| + scoped_refptr<ResponseBuffer> response_buffer = new ResponseBuffer; |
| + VLOG(1) << "Sending command line file: " << command_line_file; |
| + io_task_runner_->PostTask( |
| + FROM_HERE, |
| + base::BindOnce(&SendFileOnIOThread, device_serial, command_line_file, |
| + command, response_buffer, port_)); |
| + Status status = |
| + response_buffer->GetResponse(&response, base::TimeDelta::FromSeconds(30)); |
| if (!status.IsOk()) |
| - return status; |
| - if (response.find("0") == std::string::npos) |
| return Status(kUnknownError, "Failed to set command line file " + |
|
jbudorick
2017/07/13 15:25:30
Should this just return status? Previously, this p
|
| command_line_file + " on device " + device_serial); |
| - return Status(kOk); |
| + return status; |
| } |
| Status AdbImpl::CheckAppInstalled( |