SessionController
public
class
SessionController
extends Object
| java.lang.Object | |
| ↳ | androidx.car.app.testing.SessionController |
A controller that allows testing of a Session.
This controller allows:
- Injecting a
TestCarContextinto theSessioninstance, which provides access to the test managers and other testing functionalities.
Summary
Public constructors | |
|---|---|
SessionController(Session session, TestCarContext context, Intent intent)
Creates a |
|
Public methods | |
|---|---|
Session
|
getSession()
Returns the |
SessionController
|
moveToState(Lifecycle.State state)
Moves the |
Inherited methods | |
|---|---|
Public constructors
SessionController
public SessionController (Session session, TestCarContext context, Intent intent)
Creates a SessionController to control the provided Session.
| Parameters | |
|---|---|
session |
Session: the Session to control |
context |
TestCarContext: the TestCarContext that the session should use. |
intent |
Intent: the Intent that the session should start with during the
Lifecycle.State.CREATED state. |
| Throws | |
|---|---|
NullPointerException |
if session or context is null
|
Public methods
getSession
public Session getSession ()
Returns the Session that is being controlled.
| Returns | |
|---|---|
Session |
|
moveToState
public SessionController moveToState (Lifecycle.State state)
Moves the Session being controlled to the input state.
Note that Lifecycle.State.DESTROYED is a terminal state, and you cannot move to
any other state after the Session reaches that state.
| Parameters | |
|---|---|
state |
Lifecycle.State |
| Returns | |
|---|---|
SessionController |
|
See also: