android.support.test.espresso.UiController |
Provides base-level UI operations (such as injection of MotionEvent
s) that can be used to
build user actions such as clicks, scrolls, swipes, etc. This replaces parts of the android
Instrumentation class that provides similar functionality. However, it provides a more advanced
synchronization mechanism for test actions. The key differentiators are:
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Injects a key event into the application.
| |||||||||||
Injects a motion event into the application.
| |||||||||||
Types a string into the application using series of
KeyEvent s.
| |||||||||||
Loops the main thread for a specified period of time.
| |||||||||||
Loops the main thread until the application goes idle.
|
Injects a key event into the application.
event | the (non-null!) event to inject |
---|
InjectEventSecurityException | if the event couldn't be injected because it would interact with another application. |
---|
Injects a motion event into the application.
event | the (non-null!) event to inject |
---|
InjectEventSecurityException | if the event couldn't be injected because it would interact with another application. |
---|
Types a string into the application using series of KeyEvent
s. It is up to the
implementor to decide how to map the string to KeyEvent
objects. if you need specific
control over the key events generated use injectKeyEvent(KeyEvent)
.
str | the (non-null!) string to type |
---|
InjectEventSecurityException | if the events couldn't be injected because it would interact with another application. |
---|
Loops the main thread for a specified period of time. Control may not return immediately, instead it'll return after the time has passed and the queue is in an idle state again.
millisDelay | time to spend in looping the main thread |
---|
Loops the main thread until the application goes idle. An empty task is immediately inserted into the task queue to ensure that if we're idle at this moment we'll return instantly.