public final class

IdlingPolicies

extends Object
java.lang.Object
   ↳ androidx.test.espresso.IdlingPolicies

Class Overview

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 Methods
static IdlingPolicy getDynamicIdlingResourceErrorPolicy()
static IdlingPolicy getDynamicIdlingResourceWarningPolicy()
static IdlingPolicy getMasterIdlingPolicy()
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static IdlingPolicy getDynamicIdlingResourceErrorPolicy ()

Returns
IdlingPolicy

public static IdlingPolicy getDynamicIdlingResourceWarningPolicy ()

Returns
IdlingPolicy

public static IdlingPolicy getMasterIdlingPolicy ()

Returns
IdlingPolicy

public static void setIdlingResourceTimeout (long timeout, TimeUnit unit)

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

Parameters
timeout long: the timeout before an IdlingResourceTimeoutException is created.
unit TimeUnit: the unit of the timeout value.

public static void setMasterPolicyTimeout (long timeout, TimeUnit unit)

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

Parameters
timeout long: the timeout before an AppNotIdleException is created.
unit TimeUnit: the unit of the timeout value.

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.

The value set in this method is superceded if ERROR(/#unsafeMakeMasterPolicyWarning()) is also called.

Parameters
timeoutWhenDebuggerAttached boolean