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 methods | |
|---|---|
SessionController
|
create(Intent intent)
Creates the |
SessionController
|
destroy()
Destroys the |
Session
|
get()
Returns the |
static
SessionController
|
of(Session session, TestCarContext context)
Creates a |
SessionController
|
pause()
Pauses the |
SessionController
|
resume()
Resumes the |
SessionController
|
start()
Starts the |
SessionController
|
stop()
Stops the |
Inherited methods | |
|---|---|
Public methods
create
public SessionController create (Intent intent)
Creates the Session that is being controlled with the given intent.
If this is the first time this is called on the Session, this would trigger
Session.onCreateScreen(Intent) and transition the lifecycle to the
Lifecycle.State.CREATED state. Otherwise, this will trigger
Session.onNewIntent(Intent).
| Parameters | |
|---|---|
intent |
Intent |
| Returns | |
|---|---|
SessionController |
|
See also:
destroy
public SessionController destroy ()
Destroys the Session that is being controlled.
| Returns | |
|---|---|
SessionController |
|
See also:
of
public static SessionController of (Session session, TestCarContext context)
Creates a SessionController to control the provided Session.
| Parameters | |
|---|---|
session |
Session: the Session to control |
context |
TestCarContext: the TestCarContext that the session should use. |
| Returns | |
|---|---|
SessionController |
|
| Throws | |
|---|---|
NullPointerException |
if session or context is null
|
pause
public SessionController pause ()
Pauses the Session that is being controlled.
| Returns | |
|---|---|
SessionController |
|
See also:
resume
public SessionController resume ()
Resumes the Session that is being controlled.
| Returns | |
|---|---|
SessionController |
|
See also:
start
public SessionController start ()
Starts the Session that is being controlled.
| Returns | |
|---|---|
SessionController |
|
See also:
stop
public SessionController stop ()
Stops the Session that is being controlled.
| Returns | |
|---|---|
SessionController |
|
See also: