Files
frameworks_base/services/robotests
Annie Meng 53cf520817 [Multi-user] Convert various calls to use user id
Changes various transport, restore and general bookkeeping flows. Also
performs restorecon recursively to relabel child directories properly.

Bug: 121198605
Bug: 121197942
Bug: 121198606
Test: 1) atest RunBackupFrameworksServicesRoboTests
2) user unlocked -> transports registered successfully
3) adb shell bmgr backupnow [package]
4) Cloud restore backup set from 3) -> apps + widgets successful
5) atest BackupManagerTransportAttributesHostSideTest
6) Add secondary user -> check all directories/files relabelled
Change-Id: I26b23fd7bf10b792658fa7c44941be50aee65521
2019-01-16 12:51:12 +00:00
..
2018-11-13 11:26:43 -08:00
2018-08-10 12:41:19 +00:00

This folder is for Robolectric tests inside the platform.

To add a test class annotate it as follows:

@RunWith(FrameworkRobolectricTestRunner.class)
@Config(manifest = Config.NONE, sdk = 26)
@SystemLoaderClasses({ClassUnderTest.class, DependencyClasses.class})
@SystemLoaderPackages({"com.android.server.yourmodule"})

Robolectric loads some classes that it decides from versioned jars of the framework. Since we are
part of the framework some of our classes get loaded from these jars. This is NOT what we want, we
want to test against what we wrote in the tree. Because of this we use a custom test runner,
FrameworkRobolectricTestRunner, that bypasses these jars and loads certain classes from the system
class loader.

To specify which classes to load use either @SystemLoaderClasses or @SystemLoaderPackages. In
practice:
* You MUST put the class under test here.
* If you encounter any exceptions that might be caused by a different version of the class being
loaded, such as NoSuchMethodException, put the class involved in the exception in this annotation
and try again.

Check Android.mk file for more info.