aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Jin <kjin@google.com>2015-02-27 16:56:07 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-02-27 16:56:08 +0000
commit5c689d53cfcd28f3383e80391671dd076707ba28 (patch)
tree5859ff3f208c21d8eaaad7f076804bea40063590
parent20ed14a213a5fe6a59a60a445de361a720ce2532 (diff)
parenta3f4df97a0002b931e0828b79d9df09814d68482 (diff)
downloaddroiddriver-5c689d53cfcd28f3383e80391671dd076707ba28.tar.gz
Merge "Add UiAutomationDrive.setIdleTimeoutMillis()"
-rw-r--r--src/io/appium/droiddriver/uiautomation/UiAutomationDriver.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/io/appium/droiddriver/uiautomation/UiAutomationDriver.java b/src/io/appium/droiddriver/uiautomation/UiAutomationDriver.java
index 2e5d799..80b8867 100644
--- a/src/io/appium/droiddriver/uiautomation/UiAutomationDriver.java
+++ b/src/io/appium/droiddriver/uiautomation/UiAutomationDriver.java
@@ -37,13 +37,19 @@ import io.appium.droiddriver.util.Logs;
*/
@TargetApi(18)
public class UiAutomationDriver extends BaseDroidDriver<AccessibilityNodeInfo, UiAutomationElement> {
- // TODO: magic const from UiAutomator, but may not be useful
+ // This is a magic const copied from UiAutomator.
/**
* This value has the greatest bearing on the appearance of test execution
* speeds. This value is used as the minimum time to wait before considering
* the UI idle after each action.
*/
private static final long QUIET_TIME_TO_BE_CONSIDERD_IDLE_STATE = 500;// ms
+ private static long idleTimeoutMillis = QUIET_TIME_TO_BE_CONSIDERD_IDLE_STATE;
+
+ /** Sets the {@code idleTimeoutMillis} argument for calling {@link UiAutomation#waitForIdle} */
+ public static void setIdleTimeoutMillis(long idleTimeoutMillis) {
+ UiAutomationDriver.idleTimeoutMillis = idleTimeoutMillis;
+ }
private final UiAutomationContext context;
private final InputInjector injector;
@@ -79,7 +85,7 @@ public class UiAutomationDriver extends BaseDroidDriver<AccessibilityNodeInfo, U
@Override
public Void call(UiAutomation uiAutomation) {
try {
- uiAutomation.waitForIdle(QUIET_TIME_TO_BE_CONSIDERD_IDLE_STATE, timeoutMillis);
+ uiAutomation.waitForIdle(idleTimeoutMillis, timeoutMillis);
return null;
} catch (java.util.concurrent.TimeoutException e) {
throw new TimeoutException(e);