public class RuntimeEnvironment extends Object
| Modifier and Type | Field and Description |
|---|---|
static android.app.Application |
application |
| Constructor and Description |
|---|
RuntimeEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
getActivityThread() |
static int |
getApiLevel() |
static org.robolectric.res.ResourceLoader |
getAppResourceLoader() |
static Thread |
getMainThread()
Retrieves the main thread.
|
static Scheduler |
getMasterScheduler()
Retrieves the current master scheduler.
|
static android.content.pm.PackageManager |
getPackageManager() |
static String |
getQualifiers() |
static org.robolectric.res.builder.RobolectricPackageManager |
getRobolectricPackageManager() |
static org.robolectric.res.ResourceLoader |
getSystemResourceLoader() |
static boolean |
isMainThread()
Tests if the current thread is currently set as the main thread.
|
static boolean |
isMainThread(Thread thread)
Tests if the given thread is currently set as the main thread.
|
static void |
setActivityThread(Object newActivityThread) |
static void |
setApiLevel(int level) |
static void |
setAppResourceLoader(org.robolectric.res.ResourceLoader appResourceLoader) |
static void |
setMainThread(Thread newMainThread)
Sets the main thread.
|
static void |
setMasterScheduler(Scheduler masterScheduler)
Sets the current master scheduler.
|
static void |
setQualifiers(String newQualifiers) |
static void |
setRobolectricPackageManager(org.robolectric.res.builder.RobolectricPackageManager newPackageManager) |
static void |
setSystemResourceLoader(org.robolectric.res.ResourceLoader systemResourceLoader) |
public static boolean isMainThread(Thread thread)
thread - the thread to test.isMainThread()public static boolean isMainThread()
public static Thread getMainThread()
setMainThread(Thread),
isMainThread()public static void setMainThread(Thread newMainThread)
newMainThread - the new main thread.setMainThread(Thread),
isMainThread()public static Object getActivityThread()
public static void setActivityThread(Object newActivityThread)
public static android.content.pm.PackageManager getPackageManager()
public static org.robolectric.res.builder.RobolectricPackageManager getRobolectricPackageManager()
public static void setRobolectricPackageManager(org.robolectric.res.builder.RobolectricPackageManager newPackageManager)
public static String getQualifiers()
public static void setQualifiers(String newQualifiers)
public static void setApiLevel(int level)
public static int getApiLevel()
public static Scheduler getMasterScheduler()
Looper, and if the global scheduler option is set it is also used for
the background scheduler and for all other Looperssee org.robolectric.Robolectric#getForegroundThreadScheduler()
see org.robolectric.Robolectric#getBackgroundThreadScheduler()public static void setMasterScheduler(Scheduler masterScheduler)
getMasterScheduler() for details.
Note that this method is primarily intended to be called by the Robolectric core setup code.
Changing the master scheduler during a test will have unpredictable results.masterScheduler - the new master scheduler.see org.robolectric.Robolectric#getForegroundThreadScheduler()
see org.robolectric.Robolectric#getBackgroundThreadScheduler()public static void setSystemResourceLoader(org.robolectric.res.ResourceLoader systemResourceLoader)
public static void setAppResourceLoader(org.robolectric.res.ResourceLoader appResourceLoader)
public static org.robolectric.res.ResourceLoader getSystemResourceLoader()
public static org.robolectric.res.ResourceLoader getAppResourceLoader()
Copyright © 2016. All rights reserved.