TestScreenManager
public
class
TestScreenManager
extends ScreenManager
java.lang.Object | ||
↳ | com.google.android.libraries.car.app.ScreenManager | |
↳ | com.google.android.libraries.car.app.testing.TestScreenManager |
The ScreenManager
that is used for testing.
This class will track the following usages of the ScreenManager
throughout your test:
- All the
Screen
s pushed viaScreenManager.push(Screen)
, orScreenManager.pushForResult(Screen, OnScreenResultCallback)
. - All the
Screen
s removed via,ScreenManager.pop()
,ScreenManager.popTo(String)
, orScreenManager.remove(Screen)
.
Summary
Public methods | |
---|---|
List<Screen>
|
getScreensPushed()
Retrieves all the |
List<Screen>
|
getScreensRemoved()
Retrieves all the |
boolean
|
hasScreens()
Returns |
void
|
pop()
Pops the top |
void
|
popTo(String marker)
Removes screens from the top of the stack until a |
void
|
push(Screen screen)
Pushes the |
void
|
pushForResult(Screen screen, OnScreenResultCallback onScreenResultCallback)
Pushes a |
void
|
remove(Screen screen)
Removes the |
void
|
reset()
Resets the values tracked by this |
Inherited methods | |
---|---|
Public methods
getScreensPushed
public List<Screen> getScreensPushed ()
Retrieves all the Screen
s pushed via ScreenManager.push(Screen)
, and ScreenManager.pushForResult(Screen, OnScreenResultCallback)
.
The screens are stored in order of calls.
The screens will be stored until reset()
is called.
Returns | |
---|---|
List<Screen> |
getScreensRemoved
public List<Screen> getScreensRemoved ()
Retrieves all the Screen
s removed via ScreenManager.pop()
, ScreenManager.popTo(String)
, and ScreenManager.remove(Screen)
.
The screens are stored in order of calls.
The screens will be stored until reset()
is called.
Returns | |
---|---|
List<Screen> |
hasScreens
public boolean hasScreens ()
Returns true
if the Screen
stack has any screens in it.
Returns | |
---|---|
boolean |
pop
public void pop ()
Pops the top Screen
from the stack.
If the top Screen
is the only Screen
in the stack, it will not be removed.
popTo
public void popTo (String marker)
Removes screens from the top of the stack until a Screen
which has the given marker
is found, or the root has been reached.
To pop to root use Screen.ROOT
as the marker
.
The root Screen
will not be popped.
Parameters | |
---|---|
marker |
String |
push
public void push (Screen screen)
Pushes the screen
to the stack.
If the screen
pushed is already in the stack it will be moved to the top of the
stack.
Parameters | |
---|---|
screen |
Screen |
pushForResult
public void pushForResult (Screen screen, OnScreenResultCallback onScreenResultCallback)
Pushes a Screen
, for which you would like a result from, onto the stack.
When the given screen
finishes, the onScreenResultCallback
will receive a
callback to OnScreenResultCallback.onScreenResult(Object)
with the result that the pushed
screen
set via Screen.setResult(Object)
.
Parameters | |
---|---|
screen |
Screen |
onScreenResultCallback |
OnScreenResultCallback |
remove
public void remove (Screen screen)
Removes the screen
from the stack.
If the screen
is the only Screen
in the stack, it will not be removed.
Parameters | |
---|---|
screen |
Screen |
reset
public void reset ()
Resets the values tracked by this TestScreenManager
, and the Screen
stack.