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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java

Issue 2860843002: Revert of Reland: Convert ChromeActivityTestCaseBase direct children to JUnit4 (Closed)
Patch Set: Created 3 years, 8 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/dom_distiller/DistillabilityServiceTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java
index 245cc44721b79cf0231a5e92f99b3158ee59a350..8a780b43b9239574c31ae5a61b8ad806d50b6d3a 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistillabilityServiceTest.java
@@ -4,24 +4,15 @@
package org.chromium.chrome.browser.dom_distiller;
-import android.support.test.InstrumentationRegistry;
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.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.ChromeActivity;
-import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.compositor.bottombar.readermode.ReaderModePanel;
-import org.chromium.chrome.test.ChromeActivityTestRule;
-import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
+import org.chromium.chrome.test.ChromeActivityTestCaseBase;
import org.chromium.chrome.test.util.ChromeRestriction;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
import org.chromium.content.browser.test.util.TestWebContentsObserver;
@@ -32,51 +23,49 @@
/**
* Tests for making sure the distillability service is communicating correctly.
*/
-@RunWith(ChromeJUnit4ClassRunner.class)
-@CommandLineFlags.Add({"enable-dom-distiller", "reader-mode-heuristics=alwaystrue",
- ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
- ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG})
-public class DistillabilityServiceTest {
- @Rule
- public ChromeActivityTestRule<ChromeActivity> mActivityTestRule =
- new ChromeActivityTestRule<>(ChromeActivity.class);
+@CommandLineFlags.Add({"enable-dom-distiller", "reader-mode-heuristics=alwaystrue"})
+public class DistillabilityServiceTest extends ChromeActivityTestCaseBase<ChromeActivity> {
private static final String TEST_PAGE = "/chrome/test/data/android/simple.html";
- @Before
- public void setUp() throws InterruptedException {
- mActivityTestRule.startMainActivityOnBlankPage();
+ public DistillabilityServiceTest() {
+ super(ChromeActivity.class);
+ }
+
+ @Override
+ public void startMainActivity() throws InterruptedException {
+ startMainActivityOnBlankPage();
}
/**
* Make sure that Reader Mode appears after navigating from a native page.
*/
- @Test
@Feature({"Distillability-Service"})
@MediumTest
@Restriction(ChromeRestriction.RESTRICTION_TYPE_PHONE)
@DisabledTest
- public void testServiceAliveAfterNativePage() throws InterruptedException, TimeoutException {
+ public void testServiceAliveAfterNativePage()
+ throws InterruptedException, TimeoutException {
+
EmbeddedTestServer testServer = EmbeddedTestServer.createAndStartServer(
- InstrumentationRegistry.getInstrumentation().getContext());
+ getInstrumentation().getContext());
- final ReaderModePanel panel =
- mActivityTestRule.getActivity().getReaderModeManager().getPanelForTesting();
+ final ReaderModePanel panel = getActivity().getReaderModeManager().getPanelForTesting();
- TestWebContentsObserver observer = new TestWebContentsObserver(
- mActivityTestRule.getActivity().getActivityTab().getWebContents());
+ TestWebContentsObserver observer =
+ new TestWebContentsObserver(getActivity().getActivityTab().getWebContents());
OnPageFinishedHelper finishHelper = observer.getOnPageFinishedHelper();
// Navigate to a native page.
int curCallCount = finishHelper.getCallCount();
- mActivityTestRule.loadUrl("chrome://history");
+ loadUrl("chrome://history");
finishHelper.waitForCallback(curCallCount, 1);
- Assert.assertFalse(panel.isShowing());
+ assertFalse(panel.isShowing());
// Navigate to a normal page.
curCallCount = finishHelper.getCallCount();
- mActivityTestRule.loadUrl(testServer.getURL(TEST_PAGE));
+ loadUrl(testServer.getURL(TEST_PAGE));
finishHelper.waitForCallback(curCallCount, 1);
- Assert.assertTrue(panel.isShowing());
+ assertTrue(panel.isShowing());
}
}

Powered by Google App Engine
This is Rietveld 408576698