Index: chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java |
index 3c851794be73705d5c316edc56ac98e1bfb6ad81..7265b496cbabd13f01b0eaae20eaa7b590dd6b9d 100644 |
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasicTest.java |
@@ -11,23 +11,13 @@ |
import android.content.Context; |
import android.preference.CheckBoxPreference; |
import android.preference.PreferenceScreen; |
-import android.support.test.InstrumentationRegistry; |
import android.support.test.filters.SmallTest; |
-import org.junit.After; |
-import org.junit.Before; |
-import org.junit.Rule; |
-import org.junit.Test; |
-import org.junit.runner.RunWith; |
- |
import org.chromium.base.ThreadUtils; |
-import org.chromium.base.test.util.CommandLineFlags; |
import org.chromium.chrome.browser.ChromeActivity; |
-import org.chromium.chrome.browser.ChromeSwitches; |
import org.chromium.chrome.browser.preferences.Preferences; |
import org.chromium.chrome.browser.sync.ProfileSyncService; |
-import org.chromium.chrome.test.ChromeActivityTestRule; |
-import org.chromium.chrome.test.ChromeJUnit4ClassRunner; |
+import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
import org.chromium.chrome.test.util.browser.signin.SigninTestUtil; |
import org.chromium.components.sync.AndroidSyncSettings; |
import org.chromium.components.sync.test.util.MockSyncContentResolverDelegate; |
@@ -35,27 +25,26 @@ |
/** |
* Integration tests for ClearBrowsingDataPreferencesBasic. |
*/ |
-@RunWith(ChromeJUnit4ClassRunner.class) |
-@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, |
- ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG}) |
-public class ClearBrowsingDataPreferencesBasicTest { |
- @Rule |
- public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = |
- new ChromeActivityTestRule<>(ChromeActivity.class); |
- |
+public class ClearBrowsingDataPreferencesBasicTest |
+ extends ChromeActivityTestCaseBase<ChromeActivity> { |
private static final String GOOGLE_ACCOUNT = "Google Account"; |
private static final String OTHER_ACTIVITY = "other activity"; |
private static final String SIGNED_IN_DEVICES = "signed-in devices"; |
- @Before |
- public void setUp() throws InterruptedException { |
- SigninTestUtil.setUpAuthForTest(InstrumentationRegistry.getInstrumentation()); |
- mActivityTestRule.startMainActivityOnBlankPage(); |
+ public ClearBrowsingDataPreferencesBasicTest() { |
+ super(ChromeActivity.class); |
} |
- @After |
- public void tearDown() throws Exception { |
+ @Override |
+ public void startMainActivity() throws InterruptedException { |
+ SigninTestUtil.setUpAuthForTest(getInstrumentation()); |
+ startMainActivityOnBlankPage(); |
+ } |
+ |
+ @Override |
+ protected void tearDown() throws Exception { |
ProfileSyncService.overrideForTests(null); |
+ super.tearDown(); |
} |
private static class StubProfileSyncService extends ProfileSyncService { |
@@ -65,7 +54,7 @@ |
} |
private void setSyncable(boolean syncable) { |
- Context context = InstrumentationRegistry.getInstrumentation().getTargetContext(); |
+ Context context = getInstrumentation().getTargetContext(); |
MockSyncContentResolverDelegate delegate = new MockSyncContentResolverDelegate(); |
delegate.setMasterSyncAutomatically(syncable); |
AndroidSyncSettings.overrideForTests(context, delegate); |
@@ -91,13 +80,12 @@ |
/** |
* Tests that for users who are not signed in, only the general information is shown. |
*/ |
- @Test |
@SmallTest |
public void testCheckBoxTextNonsigned() throws Exception { |
SigninTestUtil.resetSigninState(); |
- final Preferences preferences = mActivityTestRule.startPreferences( |
- ClearBrowsingDataPreferencesBasic.class.getName()); |
+ final Preferences preferences = |
+ startPreferences(ClearBrowsingDataPreferencesBasic.class.getName()); |
ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
@Override |
@@ -122,14 +110,13 @@ |
* Tests that for users who are signed in but don't have sync activated, only information about |
* your "google account" which will stay signed in and "other activity" is shown. |
*/ |
- @Test |
@SmallTest |
public void testCheckBoxTextSigned() throws Exception { |
SigninTestUtil.addAndSignInTestAccount(); |
setSyncable(false); |
- final Preferences preferences = mActivityTestRule.startPreferences( |
- ClearBrowsingDataPreferencesBasic.class.getName()); |
+ final Preferences preferences = |
+ startPreferences(ClearBrowsingDataPreferencesBasic.class.getName()); |
ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
@Override |
@@ -154,14 +141,13 @@ |
* Tests that users who are signed in, and have sync enabled see information about their |
* "google account", "other activity" and history on "signed in devices". |
*/ |
- @Test |
@SmallTest |
public void testCheckBoxTextSignedAndSynced() throws Exception { |
SigninTestUtil.addAndSignInTestAccount(); |
setSyncable(true); |
- final Preferences preferences = mActivityTestRule.startPreferences( |
- ClearBrowsingDataPreferencesBasic.class.getName()); |
+ final Preferences preferences = |
+ startPreferences(ClearBrowsingDataPreferencesBasic.class.getName()); |
ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
@Override |