Files
frameworks_base/services/robotests
Bernardo Rufino e80f270e7f [KV] Cancellation and small refactors
* Refactored cancellation a bit.
* Added tests for cancellation, had to break down handleCancel() in 2 methods.
* Removed BackupRequest.
* Removed onPmFoundInQueue() report.
* Renamed a few methods.
* Moved PM package synthetization to backupPm().

Test: atest RunFrameworksServicesRoboTests
Test: adb shell bmgr backupnow <kv_package>
Test: 1. adb shell bmgr backup <kv_package>
      2. adb shell bmgr run
Test: 1. adb shell bmgr backupnow com.google.android.apps.backupapp
      2. Cancel while in-flight
      3. Verify data not backed-up
Test: 1. adb shell bmgr backupnow --non-incremental com.google.android.apps.backupapp
      2. While in-flight, check blank_state file exists.
      3. When it finishes, check blank_state file does not exist.
Test: atest BackupManagerHostTest
Change-Id: Ie74a19189dc700ef517417b54ecb8930c6aa41ce
2018-08-15 09:17:21 +01:00
..
2018-08-15 09:17:21 +01: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.