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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
callActivityOnCreate
(Activity activity, Bundle bundle) void
callActivityOnDestroy
(Activity activity) void
callActivityOnPause
(Activity activity) void
callActivityOnRestart
(Activity activity) void
callActivityOnResume
(Activity activity) void
callActivityOnStart
(Activity activity) void
callActivityOnStop
(Activity activity) void
void
execStartActivities
(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)void
protected String
void
Sets up lifecycle monitoring, and argument registry.boolean
onException
(Object obj, Throwable e) void
runOnMainSync
(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) void
Methods 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:
onCreate
in classInstrumentation
-
waitForIdleSync
public void waitForIdleSync()- Overrides:
waitForIdleSync
in classInstrumentation
-
startActivitySync
- Overrides:
startActivitySync
in classInstrumentation
-
startActivitySyncInternal
-
startActivitySyncInternal
public ActivityController<? extends Activity> startActivitySyncInternal(Intent intent, @Nullable Bundle activityOptions) -
callApplicationOnCreate
- Overrides:
callApplicationOnCreate
in 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:
runOnMainSync
in 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:
execStartActivity
in 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:
execStartActivity
in 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:
execStartActivity
in classInstrumentation
-
execStartActivities
public void execStartActivities(Context who, IBinder contextThread, IBinder token, Activity target, Intent[] intents, Bundle options) - Overrides:
execStartActivities
in classInstrumentation
-
onException
- Overrides:
onException
in classInstrumentation
-
getThreadState
-
callActivityOnDestroy
- Overrides:
callActivityOnDestroy
in classInstrumentation
-
callActivityOnRestart
- Overrides:
callActivityOnRestart
in classInstrumentation
-
callActivityOnCreate
- Overrides:
callActivityOnCreate
in classInstrumentation
-
callActivityOnStart
- Overrides:
callActivityOnStart
in classInstrumentation
-
callActivityOnStop
- Overrides:
callActivityOnStop
in classInstrumentation
-
callActivityOnResume
- Overrides:
callActivityOnResume
in classInstrumentation
-
callActivityOnPause
- Overrides:
callActivityOnPause
in classInstrumentation
-
finish
- Overrides:
finish
in classInstrumentation
-
getTargetContext
- Overrides:
getTargetContext
in classInstrumentation
-
getContext
- Overrides:
getContext
in classInstrumentation
-