# IdlingPolicy

Artifact: [androidx.test.espresso:espresso-core](https://developer.android.com/jetpack/androidx/releases/test-espresso) [View Source](https://cs.android.com/search?q=file:androidx/test/espresso/IdlingPolicy.java+class:androidx.test.espresso.IdlingPolicy)

*** ** * ** ***


```
public final class IdlingPolicy
```

<br />

*** ** * ** ***

Allows users to control idling idleTimeouts in Espresso.

## Summary

| ### Public fields |
|---|---|
| `final boolean` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#disableOnTimeout()` |
| `final long` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#idleTimeout()` |
| `final boolean` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#timeoutIfDebuggerAttached()` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#getDisableOnTimeout()()` |
| `long` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#getIdleTimeout()()` The amount of time the policy allows a resource to be non-idle. |
| `https://developer.android.com/reference/java/util/concurrent/TimeUnit.html` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#getIdleTimeoutUnit()()` The unit for `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#getIdleTimeout()`. |
| `boolean` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#getTimeoutIfDebuggerAttached()()` When true, timeouts should occur even if a debugger is attached to the VM. |
| `void` | `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#handleTimeout(java.util.List<java.lang.String>,java.lang.String)(https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> busyResources, https://developer.android.com/reference/java/lang/String.html message)` Invoked when the idle idleTimeout has been exceeded. |

## Public fields

### disableOnTimeout

```
public final boolean disableOnTimeout
```

### idleTimeout

```
public final long idleTimeout
```

### timeoutIfDebuggerAttached

```
public final boolean timeoutIfDebuggerAttached
```

## Public methods

### getDisableOnTimeout

```
public boolean getDisableOnTimeout()
```

### getIdleTimeout

```
public long getIdleTimeout()
```

The amount of time the policy allows a resource to be non-idle.

### getIdleTimeoutUnit

```
public TimeUnit getIdleTimeoutUnit()
```

The unit for `https://developer.android.com/reference/androidx/test/espresso/IdlingPolicy#getIdleTimeout()`.

### getTimeoutIfDebuggerAttached

```
public boolean getTimeoutIfDebuggerAttached()
```

When true, timeouts should occur even if a debugger is attached to the VM. When false, they should be suppressed.

### handleTimeout

```
public void handleTimeout(List<String> busyResources, String message)
```

Invoked when the idle idleTimeout has been exceeded.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> busyResources` | the resources that are not idle. |
| `https://developer.android.com/reference/java/lang/String.html message` | an additional message to include in an exception. |