TestAppManager

public class TestAppManager
extends AppManager

java.lang.Object
   ↳ com.google.android.libraries.car.app.AppManager
     ↳ com.google.android.libraries.car.app.testing.TestAppManager


The AppManager that is used for testing.

This class will track the following usages of the AppManager throughout your test:

Summary

Public methods

List<SurfaceListener> getSurfaceListeners()

Retrieves all the SurfaceListeners set via AppManager.setSurfaceListener(SurfaceListener).

List<Pair<ScreenTemplate>> getTemplatesReturned()

Retrieves all the Templates returned from Screen.getTemplate() due to a call to AppManager.invalidate(), and the respective Screen instance that returned it.

List<CharSequence> getToastsShown()

Retrieves all the toasts shown via AppManager.showToast(CharSequence, int).

void reset()

Resets the values tracked by this TestAppManager and all ScreenControllers.

void setSurfaceListener(SurfaceListener surfaceListener)

Sets the SurfaceListener to get changes and updates to the surface on which the app can draw custom content, or null to reset the listener.

void showToast(CharSequence text, int duration)

Shows a toast on the car screen.

Inherited methods

Public methods

getSurfaceListeners

public List<SurfaceListener> getSurfaceListeners ()

Retrieves all the SurfaceListeners set via AppManager.setSurfaceListener(SurfaceListener).

The listeners are stored in order of calls.

The listeners will be stored until reset() is called.

Returns
List<SurfaceListener>

getTemplatesReturned

public List<Pair<ScreenTemplate>> getTemplatesReturned ()

Retrieves all the Templates returned from Screen.getTemplate() due to a call to AppManager.invalidate(), and the respective Screen instance that returned it.

The results are stored in order of calls.

The results will be stored until reset() is called.

Returns
List<Pair<ScreenTemplate>>

getToastsShown

public List<CharSequence> getToastsShown ()

Retrieves all the toasts shown via AppManager.showToast(CharSequence, int).

The toasts are stored in order of calls.

The toasts will be stored until reset() is called.

Returns
List<CharSequence>

reset

public void reset ()

Resets the values tracked by this TestAppManager and all ScreenControllers.

setSurfaceListener

public void setSurfaceListener (SurfaceListener surfaceListener)

Sets the SurfaceListener to get changes and updates to the surface on which the app can draw custom content, or null to reset the listener.

This call requires the com.google.android.libraries.car.app.ACCESS_SURFACE permission to be declared.

The Surface can be used to draw custom content such as a navigation app's map.

Parameters
surfaceListener SurfaceListener

showToast

public void showToast (CharSequence text, 
                int duration)

Shows a toast on the car screen.

Parameters
text CharSequence: the text to show.

duration int: how long to display the message.