| Index: content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
|
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java b/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
|
| index b89d1d2cfb1ea11b2861b357ec41034a5385a6f8..4a299bdac27f3617de27090db494a02eb1e2a5c2 100644
|
| --- a/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
|
| +++ b/content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java
|
| @@ -4,7 +4,16 @@
|
|
|
| package org.chromium.content.browser;
|
|
|
| +import android.support.test.InstrumentationRegistry;
|
| +
|
| +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.BaseJUnit4ClassRunner;
|
| import org.chromium.base.test.util.CallbackHelper;
|
| import org.chromium.base.test.util.DisabledTest;
|
| import org.chromium.base.test.util.UrlUtils;
|
| @@ -12,14 +21,18 @@ import org.chromium.content_public.browser.LoadUrlParams;
|
| import org.chromium.content_public.browser.WebContents;
|
| import org.chromium.content_public.browser.WebContentsObserver;
|
| import org.chromium.content_shell_apk.ContentShellActivity;
|
| -import org.chromium.content_shell_apk.ContentShellTestBase;
|
| +import org.chromium.content_shell_apk.ContentShellActivityTestRule;
|
|
|
| import java.util.concurrent.Callable;
|
|
|
| /**
|
| * Tests for the WebContentsObserver APIs.
|
| */
|
| -public class WebContentsObserverAndroidTest extends ContentShellTestBase {
|
| +@RunWith(BaseJUnit4ClassRunner.class)
|
| +public class WebContentsObserverAndroidTest {
|
| + @Rule
|
| + public ContentShellActivityTestRule mActivityTestRule = new ContentShellActivityTestRule();
|
| +
|
| private static final String URL = UrlUtils.encodeHtmlDataUri(
|
| "<html><head></head><body>didFirstVisuallyNonEmptyPaint test</body></html>");
|
|
|
| @@ -40,33 +53,36 @@ public class WebContentsObserverAndroidTest extends ContentShellTestBase {
|
| }
|
| }
|
|
|
| - @Override
|
| - protected void setUp() throws Exception {
|
| - super.setUp();
|
| - ContentShellActivity activity = launchContentShellWithUrl(null);
|
| - assertNotNull(activity);
|
| - waitForActiveShellToBeDoneLoading();
|
| + @Before
|
| + public void setUp() throws Exception {
|
| + ContentShellActivity activity = mActivityTestRule.launchContentShellWithUrl(null);
|
| + Assert.assertNotNull(activity);
|
| + mActivityTestRule.waitForActiveShellToBeDoneLoading();
|
| }
|
|
|
| /*
|
| @SmallTest
|
| @Feature({"Navigation"})
|
| */
|
| + @Test
|
| @DisabledTest(message = "crbug.com/411931")
|
| public void testDidFirstVisuallyNonEmptyPaint() throws Throwable {
|
| TestWebContentsObserver observer = ThreadUtils.runOnUiThreadBlocking(
|
| new Callable<TestWebContentsObserver>() {
|
| @Override
|
| public TestWebContentsObserver call() throws Exception {
|
| - return new TestWebContentsObserver(getContentViewCore().getWebContents());
|
| + return new TestWebContentsObserver(
|
| + mActivityTestRule.getContentViewCore().getWebContents());
|
| }
|
| });
|
|
|
| int callCount = observer.getDidFirstVisuallyNonEmptyPaintCallbackHelper().getCallCount();
|
| - getInstrumentation().runOnMainSync(new Runnable() {
|
| + InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
|
| @Override
|
| public void run() {
|
| - getContentViewCore().getWebContents().getNavigationController()
|
| + mActivityTestRule.getContentViewCore()
|
| + .getWebContents()
|
| + .getNavigationController()
|
| .loadUrl(new LoadUrlParams(URL));
|
| }
|
| });
|
|
|