Files
frameworks_base/services/robotests
nathch e0e4c82385 Unsubscribe listeners when stopping UserBackupManagerService and remove unused code
Unsubscribe listeners as otherwise they schedule work on a stopped handler thread
after the user backup manager service is stopped

Also cleanup by removing unused code:
a) mBackupThread from BackupManagerService
b) TAG from BackupAgentTimeoutParameters
c) getRunningFullBackupTask from UserBackupManagerService

Bug: 135261178
Bug: 135180752

Test: 1. atest -v RunBackupFrameworksServicesRoboTests
2. atest -v $(find frameworks/base/services/tests/servicestests/src/com/android/server/backup -name '\''*Test.java'\'')
3. atest -v CtsBackupTestCases
4. atest -v CtsBackupHostTestCases

Change-Id: Ie199dd49c336a2519c0f8e6c8dda12d8cba8350a
2019-06-17 18:02:10 +01: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.