Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: chrome/test/chromedriver/chrome/adb_impl.cc

Issue 127143003: [chromedriver] Reuse forwarded adb ports. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « no previous file | chrome/test/chromedriver/chrome_launcher.h » ('j') | chrome/test/chromedriver/chrome_launcher.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698