aboutsummaryrefslogtreecommitdiffstats
path: root/chimpchat
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2013-02-21 20:53:48 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-02-21 20:53:48 +0000
commit61356903af3519f6cec928c139abc2df2027f7dd (patch)
tree8364aede8ef4d6b2209ba7c01a4e692da67e1f2f /chimpchat
parenta6700cafcda4193b5447068c05e639a131439c4b (diff)
parent8dd0bc70cb283db5d38bfaa15f9cbb3948f02324 (diff)
downloadsdk-61356903af3519f6cec928c139abc2df2027f7dd.tar.gz
sdk-61356903af3519f6cec928c139abc2df2027f7dd.tar.bz2
sdk-61356903af3519f6cec928c139abc2df2027f7dd.zip
Merge "Extended the MonkeyRunner shell method with timeout arg."
Diffstat (limited to 'chimpchat')
-rw-r--r--chimpchat/src/com/android/chimpchat/adb/AdbChimpDevice.java9
-rw-r--r--chimpchat/src/com/android/chimpchat/core/IChimpDevice.java11
2 files changed, 19 insertions, 1 deletions
diff --git a/chimpchat/src/com/android/chimpchat/adb/AdbChimpDevice.java b/chimpchat/src/com/android/chimpchat/adb/AdbChimpDevice.java
index 200c69e5a..af09efe42 100644
--- a/chimpchat/src/com/android/chimpchat/adb/AdbChimpDevice.java
+++ b/chimpchat/src/com/android/chimpchat/adb/AdbChimpDevice.java
@@ -264,9 +264,16 @@ public class AdbChimpDevice implements IChimpDevice {
@Override
public String shell(String cmd) {
+ // 5000 is the default timeout from the ddmlib.
+ // This timeout arg is needed to the backwards compatibility.
+ return shell(cmd, 5000);
+ }
+
+ @Override
+ public String shell(String cmd, int timeout) {
CommandOutputCapture capture = new CommandOutputCapture();
try {
- device.executeShellCommand(cmd, capture);
+ device.executeShellCommand(cmd, capture, timeout);
} catch (TimeoutException e) {
LOG.log(Level.SEVERE, "Error executing command: " + cmd, e);
return null;
diff --git a/chimpchat/src/com/android/chimpchat/core/IChimpDevice.java b/chimpchat/src/com/android/chimpchat/core/IChimpDevice.java
index 14b58a7d5..60cfa7645 100644
--- a/chimpchat/src/com/android/chimpchat/core/IChimpDevice.java
+++ b/chimpchat/src/com/android/chimpchat/core/IChimpDevice.java
@@ -131,12 +131,23 @@ public interface IChimpDevice {
/**
* Execute a shell command.
*
+ * Will timeout if there is no ouput for 5 secounds.
+ *
* @param cmd the command to execute
* @return the output of the command
*/
String shell(String cmd);
/**
+ * Execute a shell command.
+ *
+ * @param cmd the command to execute
+ * @param timeout maximum time to output response
+ * @return the output of the command
+ */
+ String shell(String cmd, int timeout);
+
+ /**
* Install a given package.
*
* @param path the path to the installation package