Stay organized with collections Save and categorize content based on your preferences.

IdlingPolicies

public final class IdlingPolicies


Allows users fine grain control over idling policies.

Espresso's default idling policies are suitable for most usecases - however certain execution environments (like the ARM emulator) might be very slow. This class allows users the ability to adjust defaults to sensible values for their environments.

Summary

Public constructors

Public methods

static IdlingPolicy
static IdlingPolicy
static IdlingPolicy
static void
setIdlingResourceTimeout(long timeout, TimeUnit unit)

Updates the IdlingPolicy used by IdlingResourceRegistry to determine when IdlingResources timeout.

static void
setMasterPolicyTimeout(long timeout, TimeUnit unit)

Updates the IdlingPolicy used in UiController.loopUntil to detect AppNotIdleExceptions.

static void
setMasterPolicyTimeoutWhenDebuggerAttached(
    boolean timeoutWhenDebuggerAttached
)

This method overrides Espresso's default behaviour of disabling timeouts when a step debugger is attached to the VM.

static void

This method disables Espresso's default behaviour of throwing an exception when the main thread doesn't go idle.

static void

This method disables Espresso's default behaviour of throwing an exception when the main thread doesn't go idle.

Public constructors

IdlingPolicies

public IdlingPolicies()

Public methods

getDynamicIdlingResourceErrorPolicy

public static IdlingPolicy getDynamicIdlingResourceErrorPolicy()

getDynamicIdlingResourceWarningPolicy

public static IdlingPolicy getDynamicIdlingResourceWarningPolicy()

getMasterIdlingPolicy

public static IdlingPolicy getMasterIdlingPolicy()

setIdlingResourceTimeout

public static void setIdlingResourceTimeout(long timeout, TimeUnit unit)

Updates the IdlingPolicy used by IdlingResourceRegistry to determine when IdlingResources timeout.

Parameters
long timeout

the timeout before an IdlingResourceTimeoutException is created.

TimeUnit unit

the unit of the timeout value.

setMasterPolicyTimeout

public static void setMasterPolicyTimeout(long timeout, TimeUnit unit)

Updates the IdlingPolicy used in UiController.loopUntil to detect AppNotIdleExceptions.

Parameters
long timeout

the timeout before an AppNotIdleException is created.

TimeUnit unit

the unit of the timeout value.

setMasterPolicyTimeoutWhenDebuggerAttached

public static void setMasterPolicyTimeoutWhenDebuggerAttached(
    boolean timeoutWhenDebuggerAttached
)

This method overrides Espresso's default behaviour of disabling timeouts when a step debugger is attached to the VM. Setting the timeout flag reenables the behaviour of throwing a timeout exception.

BEGIN-STRIP

The value set in this method is superceded if unsafeMakeMasterPolicyWarning is also called. END-STRIP

unsafeMakeIdlingResourceErrorPolicyWarning

public static void unsafeMakeIdlingResourceErrorPolicyWarning()

This method disables Espresso's default behaviour of throwing an exception when the main thread doesn't go idle. This is normally indicative of a bug in the application or a performance issue. Most users should never call this method. It is intended for crawling type applications.

unsafeMakeMasterPolicyWarning

public static void unsafeMakeMasterPolicyWarning()

This method disables Espresso's default behaviour of throwing an exception when the main thread doesn't go idle. This is normally indicative of a bug in the application or a performance issue. Most users should never call this method. It is intended for crawling type applications.