Package org.robolectric.android.internal
Class RoboMonitoringInstrumentation
java.lang.Object
android.app.Instrumentation
org.robolectric.android.internal.RoboMonitoringInstrumentation
A Robolectric instrumentation that acts like a slimmed down
MonitoringInstrumentation with only the parts needed for Robolectric.-
Nested Class Summary
Nested classes/interfaces inherited from class android.app.Instrumentation
Instrumentation.ActivityMonitor, Instrumentation.ActivityResult, Instrumentation.UiAutomationFlags -
Field Summary
Fields inherited from class android.app.Instrumentation
REPORT_KEY_IDENTIFIER, REPORT_KEY_STREAMRESULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcallActivityOnCreate(Activity activity, Bundle bundle) voidcallActivityOnDestroy(Activity activity) voidcallActivityOnPause(Activity activity) voidcallActivityOnRestart(Activity activity) voidcallActivityOnResume(Activity activity) voidcallActivityOnStart(Activity activity) voidcallActivityOnStop(Activity activity) voidvoidexecStartActivities(Context who, IBinder contextThread, IBinder token, Activity target, Intent[] intents, Bundle options) execStartActivity(Context who, IBinder contextThread, IBinder token, Activity target, Intent intent, int requestCode, Bundle options) execStartActivity(Context who, IBinder contextThread, IBinder token, String target, Intent intent, int requestCode, Bundle options) This API was added in Android API 23 (M)execStartActivity(Context who, IBinder contextThread, IBinder token, String target, Intent intent, int requestCode, Bundle options, UserHandle user) This API was added in Android API 17 (JELLY_BEAN_MR1)voidprotected StringvoidSets up lifecycle monitoring, and argument registry.booleanonException(Object obj, Throwable e) voidrunOnMainSync(Runnable runnable) Executes a runnable on the main thread, blocking until it is complete.startActivitySync(Intent intent) ActivityController<? extends Activity>startActivitySyncInternal(Intent intent) ActivityController<? extends Activity>startActivitySyncInternal(Intent intent, Bundle activityOptions) voidMethods inherited from class android.app.Instrumentation
acquireLooperManager, addMonitor, addMonitor, addMonitor, addResults, callActivityOnCreate, callActivityOnNewIntent, callActivityOnNewIntent, callActivityOnPictureInPictureRequested, callActivityOnPostCreate, callActivityOnPostCreate, callActivityOnRestoreInstanceState, callActivityOnRestoreInstanceState, callActivityOnSaveInstanceState, callActivityOnSaveInstanceState, callActivityOnUserLeaving, checkMonitorHit, checkStartActivityResult, endPerformanceSnapshot, execStartActivitiesAsUser, execStartActivityAsCaller, execStartActivityFromAppTask, getAllocCounts, getBinderCounts, getComponentName, getProcessName, getUiAutomation, getUiAutomation, invokeContextMenuAction, invokeMenuActionSync, isInstrumenting, isProfiling, newActivity, newActivity, newApplication, newApplication, onDestroy, onEnterAnimationComplete, onStart, removeMonitor, resetInTouchMode, sendCharacterSync, sendKeyDownUpSync, sendKeySync, sendPointerSync, sendStatus, sendStringSync, sendTrackballEventSync, setAutomaticPerformanceSnapshots, setInTouchMode, start, startActivitySync, startAllocCounting, startPerformanceSnapshot, startProfiling, stopAllocCounting, stopProfiling, waitForIdle, waitForMonitor, waitForMonitorWithTimeout
-
Constructor Details
-
RoboMonitoringInstrumentation
public RoboMonitoringInstrumentation()
-
-
Method Details
-
onCreate
Sets up lifecycle monitoring, and argument registry.Subclasses must call up to onCreate(). This onCreate method does not call start() it is the subclasses responsibility to call start if it desires.
- Overrides:
onCreatein classInstrumentation
-
waitForIdleSync
public void waitForIdleSync()- Overrides:
waitForIdleSyncin classInstrumentation
-
startActivitySync
- Overrides:
startActivitySyncin classInstrumentation
-
startActivitySyncInternal
-
startActivitySyncInternal
public ActivityController<? extends Activity> startActivitySyncInternal(Intent intent, @Nullable Bundle activityOptions) -
callApplicationOnCreate
- Overrides:
callApplicationOnCreatein classInstrumentation
-
runOnMainSync
Executes a runnable on the main thread, blocking until it is complete.When in INSTUMENTATION_TEST Looper mode, the runnable is posted to the main handler and the caller's thread blocks until that runnable has finished. When a Throwable is thrown in the runnable, the exception is propagated back to the caller's thread. If it is an unchecked throwable, it will be rethrown as is. If it is a checked exception, it will be rethrown as a
RuntimeException.For other Looper modes, the main looper is idled and then the runnable is executed in the caller's thread.
- Overrides:
runOnMainSyncin classInstrumentation- Parameters:
runnable- a runnable to be executed on the main thread
-
execStartActivity
public Instrumentation.ActivityResult execStartActivity(Context who, IBinder contextThread, IBinder token, Activity target, Intent intent, int requestCode, Bundle options) - Overrides:
execStartActivityin classInstrumentation
-
execStartActivity
public Instrumentation.ActivityResult execStartActivity(Context who, IBinder contextThread, IBinder token, String target, Intent intent, int requestCode, Bundle options) This API was added in Android API 23 (M)- Overrides:
execStartActivityin classInstrumentation
-
execStartActivity
public Instrumentation.ActivityResult execStartActivity(Context who, IBinder contextThread, IBinder token, String target, Intent intent, int requestCode, Bundle options, UserHandle user) This API was added in Android API 17 (JELLY_BEAN_MR1)- Overrides:
execStartActivityin classInstrumentation
-
execStartActivities
public void execStartActivities(Context who, IBinder contextThread, IBinder token, Activity target, Intent[] intents, Bundle options) - Overrides:
execStartActivitiesin classInstrumentation
-
onException
- Overrides:
onExceptionin classInstrumentation
-
getThreadState
-
callActivityOnDestroy
- Overrides:
callActivityOnDestroyin classInstrumentation
-
callActivityOnRestart
- Overrides:
callActivityOnRestartin classInstrumentation
-
callActivityOnCreate
- Overrides:
callActivityOnCreatein classInstrumentation
-
callActivityOnStart
- Overrides:
callActivityOnStartin classInstrumentation
-
callActivityOnStop
- Overrides:
callActivityOnStopin classInstrumentation
-
callActivityOnResume
- Overrides:
callActivityOnResumein classInstrumentation
-
callActivityOnPause
- Overrides:
callActivityOnPausein classInstrumentation
-
finish
- Overrides:
finishin classInstrumentation
-
getTargetContext
- Overrides:
getTargetContextin classInstrumentation
-
getContext
- Overrides:
getContextin classInstrumentation
-