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 0fa1478ab860bcfa853a9705f50e9efa3d35a174..4ef07fbdcdc5ea3806dd14a111ba0aa3770a9441 100644 |
--- a/chrome/test/chromedriver/chrome/adb_impl.cc |
+++ b/chrome/test/chromedriver/chrome/adb_impl.cc |
@@ -83,7 +83,7 @@ AdbImpl::~AdbImpl() {} |
Status AdbImpl::GetDevices(std::vector<std::string>* devices) { |
std::string response; |
Status status = ExecuteCommand("host:devices", &response); |
- if (!status.IsOk()) |
+ if (status.IsError()) |
return status; |
base::StringTokenizer lines(response, "\n"); |
while (lines.GetNext()) { |
@@ -105,12 +105,10 @@ Status AdbImpl::ForwardPort( |
"forward:tcp:" + base::IntToString(local_port) + ";localabstract:" + |
remote_abstract, |
&response); |
- if (!status.IsOk()) |
- return status; |
- if (response == "OKAY") |
craigdh
2014/01/08 20:56:33
I don't think we should remove these checks. Let's
frankf
2014/01/08 21:57:25
In general, parsing the output for success is very
|
- return Status(kOk); |
- return Status(kUnknownError, "Failed to forward ports to device " + |
- device_serial + ": " + response); |
+ if (status.IsError()) |
+ return Status(kUnknownError, "Failed to forward ports to device " + |
+ device_serial + ": " + response); |
+ return Status(kOk); |
} |
Status AdbImpl::SetCommandLineFile(const std::string& device_serial, |
@@ -126,7 +124,7 @@ Status AdbImpl::SetCommandLineFile(const std::string& device_serial, |
quoted_command.c_str(), |
command_line_file.c_str()), |
&response); |
- if (!status.IsOk()) |
+ if (status.IsError()) |
return status; |
if (response.find("0") == std::string::npos) |
return Status(kUnknownError, "Failed to set command line file " + |
@@ -139,7 +137,7 @@ Status AdbImpl::CheckAppInstalled( |
std::string response; |
std::string command = "pm path " + package; |
Status status = ExecuteHostShellCommand(device_serial, command, &response); |
- if (!status.IsOk()) |
+ if (status.IsError()) |
return status; |
if (response.find("package") == std::string::npos) |
return Status(kUnknownError, package + " is not installed on device " + |
@@ -152,9 +150,7 @@ Status AdbImpl::ClearAppData( |
std::string response; |
std::string command = "pm clear " + package; |
Status status = ExecuteHostShellCommand(device_serial, command, &response); |
- if (!status.IsOk()) |
- return status; |
- if (response.find("Success") == std::string::npos) |
+ if (status.IsError()) |
return Status(kUnknownError, "Failed to clear data for " + package + |
" on device " + device_serial + ": " + response); |
return Status(kOk); |
@@ -168,9 +164,7 @@ Status AdbImpl::Launch( |
device_serial, |
"am start -W -n " + package + "/" + activity + " -d data:,", |
&response); |
- if (!status.IsOk()) |
- return status; |
- if (response.find("Complete") == std::string::npos) |
+ if (status.IsError()) |
return Status(kUnknownError, |
"Failed to start " + package + " on device " + device_serial + |
": " + response); |