espresso: do extra memory clean up to keep StrictMode happy
There were some occasional StrictMode errors about multiple instances of
MainActivity. This cleanup idea comes from Google:
6f3a38f3af
This commit is contained in:
parent
7493118a92
commit
e450569a69
@ -17,6 +17,7 @@ import android.view.View;
|
||||
import org.fdroid.fdroid.views.BannerUpdatingRepos;
|
||||
import org.fdroid.fdroid.views.main.MainActivity;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
@ -101,6 +102,18 @@ public class MainActivityEspressoTest {
|
||||
|| "google_sdk".equals(Build.PRODUCT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Placate {@link android.os.StrictMode}
|
||||
*
|
||||
* @see <a href="https://github.com/aosp-mirror/platform_frameworks_base/commit/6f3a38f3afd79ed6dddcef5c83cb442d6749e2ff"> Run finalizers before counting for StrictMode</a>
|
||||
*/
|
||||
@After
|
||||
public void tearDown() {
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<MainActivity> activityTestRule =
|
||||
new ActivityTestRule<>(MainActivity.class);
|
||||
|
Loading…
x
Reference in New Issue
Block a user