diff --git a/F-Droid/test/src/android/test/ProviderTestCase2MockContext.java b/F-Droid/test/src/android/test/ProviderTestCase2MockContext.java index 2a3f5a8d1..9b753ced3 100644 --- a/F-Droid/test/src/android/test/ProviderTestCase2MockContext.java +++ b/F-Droid/test/src/android/test/ProviderTestCase2MockContext.java @@ -16,11 +16,13 @@ package android.test; +import android.annotation.TargetApi; import android.content.ContentProvider; import android.content.ContentResolver; import android.content.Context; import android.content.res.Resources; import android.database.DatabaseUtils; +import android.os.Build; import android.test.mock.MockContentResolver; import android.test.mock.MockContext; @@ -154,10 +156,18 @@ public abstract class ProviderTestCase2MockContext ex */ @Override protected void tearDown() throws Exception { - mProvider.shutdown(); + shutdownProvider(); super.tearDown(); } + @TargetApi(Build.VERSION_CODES.HONEYCOMB) + private void shutdownProvider() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + mProvider.shutdown(); + } + } + + /** * Gets the {@link MockContentResolver} created by this class during initialization. You * must use the methods of this resolver to access the provider under test. diff --git a/README.md b/README.md index 22177329e..5b89a5023 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,18 @@ would like to contribute. Running the test suite ---------------------- +In order to run the F-Droid test suite, you will need to have either a real device +connected via `adb`, or an emulator running. Then, execute the following from the +command line: + +> `gradle connectedAndroidTest` + +This will build and install F-Droid and the test apk, then execute the entire +test suite on the device or emulator. + +See the [Android Gradle user guide](http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Testing) for more details, including how to use Android Studio to run tests (which provides +more useful feedback than the command line). + License -------