diff options
author | Kevin Jin <kjin@google.com> | 2015-02-26 15:06:13 -0800 |
---|---|---|
committer | Kevin Jin <kjin@google.com> | 2015-02-26 15:06:13 -0800 |
commit | a3f4df97a0002b931e0828b79d9df09814d68482 (patch) | |
tree | 5859ff3f208c21d8eaaad7f076804bea40063590 | |
parent | 20ed14a213a5fe6a59a60a445de361a720ce2532 (diff) | |
download | droiddriver-a3f4df97a0002b931e0828b79d9df09814d68482.tar.gz |
Add UiAutomationDrive.setIdleTimeoutMillis()
Change-Id: I4951fe35d7d3948e0c4e2f735ce973cce9e97c16
-rw-r--r-- | src/io/appium/droiddriver/uiautomation/UiAutomationDriver.java | 10 |
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); |