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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/WebContentsObserverAndroidTest.java

Issue 2708243004: Auto convert content shell tests to JUnit4 (Closed)
Patch Set: rebase Created 3 years, 9 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: 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));
}
});

Powered by Google App Engine
This is Rietveld 408576698