• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

backup/23-Mar-2024-14,88910,350

config/23-Mar-2024-11

src/com/android/server/23-Mar-2024-1,9071,270

Android.bpD23-Mar-20241.7 KiB5745

AndroidManifest.xmlD23-Mar-2024825 256

READMED23-Mar-20241.1 KiB2418

README

1This folder is for Robolectric tests inside the platform.
2
3To add a test class annotate it as follows:
4
5@RunWith(FrameworkRobolectricTestRunner.class)
6@Config(manifest = Config.NONE, sdk = 26)
7@SystemLoaderClasses({ClassUnderTest.class, DependencyClasses.class})
8@SystemLoaderPackages({"com.android.server.yourmodule"})
9
10Robolectric loads some classes that it decides from versioned jars of the framework. Since we are
11part of the framework some of our classes get loaded from these jars. This is NOT what we want, we
12want to test against what we wrote in the tree. Because of this we use a custom test runner,
13FrameworkRobolectricTestRunner, that bypasses these jars and loads certain classes from the system
14class loader.
15
16To specify which classes to load use either @SystemLoaderClasses or @SystemLoaderPackages. In
17practice:
18* You MUST put the class under test here.
19* If you encounter any exceptions that might be caused by a different version of the class being
20loaded, such as NoSuchMethodException, put the class involved in the exception in this annotation
21and try again.
22
23Check Android.mk file for more info.
24