public final class

EspressoRemote

extends Object
implements RemoteInteraction
java.lang.Object
   ↳ android.support.test.espresso.remote.EspressoRemote

Class Overview

A singleton class that facilitates communication between other Espresso instance that may be running in different processes.

This class depends on ERROR(/InstrumentationConnection) to notify about the discovery of other remote Espresso instances and provide their Messenger object to use for further IPC.

To get the instance of this object getInstance() should be called. The user of this class should then call init() prior to attempting to use any functionality of this class. Call terminate() after using EspressoRemote to release any resources. Failure to do so will lead to memory leaks and unexpected behavior.

Summary

[Expand]
Inherited Constants
From interface android.support.test.espresso.remote.RemoteInteraction
[Expand]
Inherited Fields
From interface android.support.test.espresso.remote.RemoteInteraction
Public Methods
static EspressoRemote getInstance()
Returns an instance of EspressoRemote object.
void init()
Must be called prior to using any functionality of this class.
boolean isRemoteProcess()
ListenableFuture<Void> runCheckRemotely(Matcher<Root> rootMatcher, Matcher<View> viewMatcher, Map<String, IBinder> iBinders, ViewAssertion viewAssertion)
Attempts to run Espresso check interaction on a remote process.
ListenableFuture<Void> runPerformRemotely(Matcher<Root> rootMatcher, Matcher<View> viewMatcher, Map<String, IBinder> iBinders, ViewAction... viewActions)
Attempts to run Espresso perform interaction on a remote process.
void terminate()
Must be called to disable further use of this class.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.support.test.espresso.remote.RemoteInteraction

Public Methods

public static EspressoRemote getInstance ()

Returns an instance of EspressoRemote object.

Returns
EspressoRemote

public void init ()

Must be called prior to using any functionality of this class.

During initialization the instance of this class will be registered with ERROR(/InstrumentationConnection).

public boolean isRemoteProcess ()

Returns
boolean

public ListenableFuture<Void> runCheckRemotely (Matcher<Root> rootMatcher, Matcher<View> viewMatcher, Map<String, IBinder> iBinders, ViewAssertion viewAssertion)

Attempts to run Espresso check interaction on a remote process.

If there are no remote Espressos currently running in a timely manner the interaction will not be executed and a NoRemoteEspressoInstanceException will be thrown.

Parameters
rootMatcher Matcher: the root matcher to use.
viewMatcher Matcher: the view matcher to use.
iBinders Map: a list of binders to pass along to the remote process instance
viewAssertion ViewAssertion: the assertion to check.
Returns
ListenableFuture<Void> a ListenableFuture representing pending completion of the task.

public ListenableFuture<Void> runPerformRemotely (Matcher<Root> rootMatcher, Matcher<View> viewMatcher, Map<String, IBinder> iBinders, ViewAction... viewActions)

Attempts to run Espresso perform interaction on a remote process.

If there no remote Espresso currently running in a timely manner the interaction will not be executed and a NoRemoteEspressoInstanceException will be thrown.

Parameters
rootMatcher Matcher: the root matcher to use.
viewMatcher Matcher: the view matcher to use.
iBinders Map: a list of binders to pass along to the remote process instance
viewActions ViewAction: one or more actions to execute.
Returns
ListenableFuture<Void> a ListenableFuture representing pending completion of the task.

public void terminate ()

Must be called to disable further use of this class.

During termination the instance of this class will be un-registered with ERROR(/InstrumentationConnection) and clear the list of known remote Espresso Messengers.