| Index: chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java
|
| index 5564481e4611cfae899a6dc5c318496e9fac6e38..8b7ee07e88f2691dd31c6a2dd3d848b31f236486 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java
|
| @@ -8,15 +8,24 @@ import android.content.Intent;
|
| import android.os.AsyncTask;
|
| import android.support.test.filters.MediumTest;
|
|
|
| +import org.junit.Assert;
|
| +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.base.test.util.RetryOnFailure;
|
| import org.chromium.chrome.browser.ChromeActivity;
|
| +import org.chromium.chrome.browser.ChromeSwitches;
|
| import org.chromium.chrome.browser.ShortcutHelper;
|
| import org.chromium.chrome.browser.preferences.privacy.BrowsingDataBridge;
|
| import org.chromium.chrome.browser.preferences.privacy.BrowsingDataBridge.OnClearBrowsingDataListener;
|
| import org.chromium.chrome.browser.webapps.TestFetchStorageCallback;
|
| import org.chromium.chrome.browser.webapps.WebappRegistry;
|
| -import org.chromium.chrome.test.ChromeActivityTestCaseBase;
|
| +import org.chromium.chrome.test.ChromeActivityTestRule;
|
| +import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
|
| import org.chromium.content.browser.test.util.Criteria;
|
| import org.chromium.content.browser.test.util.CriteriaHelper;
|
|
|
| @@ -32,7 +41,14 @@ import java.util.Map;
|
| * those backends that live in the Java code, it is not possible to test whether deletions were
|
| * successful in its own unit tests. This test can do so.
|
| */
|
| -public class BrowsingDataRemoverIntegrationTest extends ChromeActivityTestCaseBase<ChromeActivity> {
|
| +@RunWith(ChromeJUnit4ClassRunner.class)
|
| +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
|
| + ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG})
|
| +public class BrowsingDataRemoverIntegrationTest {
|
| + @Rule
|
| + public ChromeActivityTestRule<ChromeActivity> mActivityTestRule =
|
| + new ChromeActivityTestRule<>(ChromeActivity.class);
|
| +
|
| private boolean mCallbackCalled;
|
|
|
| private class CallbackCriteria extends Criteria {
|
| @@ -50,13 +66,9 @@ public class BrowsingDataRemoverIntegrationTest extends ChromeActivityTestCaseBa
|
| }
|
| }
|
|
|
| - public BrowsingDataRemoverIntegrationTest() {
|
| - super(ChromeActivity.class);
|
| - }
|
| -
|
| - @Override
|
| - public void startMainActivity() throws InterruptedException {
|
| - startMainActivityOnBlankPage();
|
| + @Before
|
| + public void setUp() throws InterruptedException {
|
| + mActivityTestRule.startMainActivityOnBlankPage();
|
| }
|
|
|
| private void registerWebapp(final String webappId, final String webappUrl) throws Exception {
|
| @@ -79,6 +91,7 @@ public class BrowsingDataRemoverIntegrationTest extends ChromeActivityTestCaseBa
|
| * TODO(msramek): Expose more granular datatypes to the Java code, so we can directly test
|
| * BrowsingDataRemover::RemoveDataMask::REMOVE_WEBAPP_DATA instead of BrowsingDataType.COOKIES.
|
| */
|
| + @Test
|
| @MediumTest
|
| @RetryOnFailure
|
| public void testUnregisteringWebapps() throws Exception {
|
| @@ -91,7 +104,7 @@ public class BrowsingDataRemoverIntegrationTest extends ChromeActivityTestCaseBa
|
| for (final Map.Entry<String, String> app : apps.entrySet()) {
|
| registerWebapp(app.getKey(), app.getValue());
|
| }
|
| - assertEquals(apps.keySet(), WebappRegistry.getRegisteredWebappIdsForTesting());
|
| + Assert.assertEquals(apps.keySet(), WebappRegistry.getRegisteredWebappIdsForTesting());
|
|
|
| // Clear cookies and site data excluding the registrable domain "google.com".
|
| ThreadUtils.runOnUiThreadBlocking(new Runnable() {
|
| @@ -115,7 +128,7 @@ public class BrowsingDataRemoverIntegrationTest extends ChromeActivityTestCaseBa
|
| CriteriaHelper.pollUiThread(new CallbackCriteria());
|
|
|
| // The last two webapps should have been unregistered.
|
| - assertEquals(new HashSet<String>(Arrays.asList("webapp1")),
|
| + Assert.assertEquals(new HashSet<String>(Arrays.asList("webapp1")),
|
| WebappRegistry.getRegisteredWebappIdsForTesting());
|
|
|
| // Clear cookies and site data with no url filter.
|
| @@ -136,6 +149,6 @@ public class BrowsingDataRemoverIntegrationTest extends ChromeActivityTestCaseBa
|
| CriteriaHelper.pollUiThread(new CallbackCriteria());
|
|
|
| // All webapps should have been unregistered.
|
| - assertTrue(WebappRegistry.getRegisteredWebappIdsForTesting().isEmpty());
|
| + Assert.assertTrue(WebappRegistry.getRegisteredWebappIdsForTesting().isEmpty());
|
| }
|
| }
|
|
|