Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3675)

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/test/ChromeBrowserTestRule.java

Issue 2954393003: Fix test crashes related to AccountManagerHelper. (Closed)
Patch Set: . Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/javatests/src/org/chromium/chrome/browser/test/ChromeBrowserTestRule.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/test/ChromeBrowserTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/test/ChromeBrowserTestRule.java
index 020ac6734e7f99c5f626a561d11db98b4128b71b..40a8c2f3986b84e470d6746365b2fa449cabef9e 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/test/ChromeBrowserTestRule.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/test/ChromeBrowserTestRule.java
@@ -10,6 +10,7 @@ import android.support.test.InstrumentationRegistry;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
+import org.chromium.chrome.test.util.ApplicationData;
import org.chromium.chrome.test.util.browser.signin.SigninTestUtil;
import org.chromium.content.browser.test.NativeLibraryTestRule;
@@ -18,24 +19,16 @@ import org.chromium.content.browser.test.NativeLibraryTestRule;
* initializing the AccountManagerHelper.
*/
public class ChromeBrowserTestRule extends NativeLibraryTestRule {
- private final boolean mInitBrowserProcess;
-
- public ChromeBrowserTestRule(boolean initBrowserProcess) {
- mInitBrowserProcess = initBrowserProcess;
- }
-
- void initialize(final boolean initBrowserProcess, Instrumentation instrumentation) {
+ private void setUp(Instrumentation instrumentation) {
+ ApplicationData.clearAppData(
+ InstrumentationRegistry.getInstrumentation().getTargetContext());
SigninTestUtil.setUpAuthForTest(instrumentation);
- if (initBrowserProcess) {
- loadNativeLibraryAndInitBrowserProcess();
- } else {
- loadNativeLibraryNoBrowserProcess();
- }
+ loadNativeLibraryAndInitBrowserProcess();
}
@Override
public Statement apply(final Statement base, Description description) {
- return new Statement() {
+ return super.apply(new Statement() {
@Override
public void evaluate() throws Throwable {
/**
@@ -43,17 +36,17 @@ public class ChromeBrowserTestRule extends NativeLibraryTestRule {
* UI thread). After loading the library, this will initialize the browser process
* if necessary.
*/
- initialize(mInitBrowserProcess, InstrumentationRegistry.getInstrumentation());
+ setUp(InstrumentationRegistry.getInstrumentation());
try {
base.evaluate();
} finally {
tearDown();
}
}
- };
+ }, description);
}
- public void tearDown() {
+ private void tearDown() {
SigninTestUtil.resetSigninState();
SigninTestUtil.tearDownAuthForTest();
}

Powered by Google App Engine
This is Rietveld 408576698