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

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

Issue 2708243004: Auto convert content shell tests to JUnit4 (Closed)
Patch Set: Remove test that failed Created 3 years, 10 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/GestureDetectorResetTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java b/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java
index 497299d0e37ad378aed2caacbccea7050afcd81c..7c31e895be174beafcd0c4251d885b74d8a2150f 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/GestureDetectorResetTest.java
@@ -1,4 +1,4 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,15 +19,24 @@ import org.chromium.content.browser.test.util.DOMUtils;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPageFinishedHelper;
import org.chromium.content_public.browser.LoadUrlParams;
-import org.chromium.content_shell_apk.ContentShellTestBase;
import java.util.concurrent.TimeUnit;
+import org.junit.Rule;
+import org.junit.Test;
+import org.chromium.base.test.BaseJUnit4ClassRunner;
+import org.junit.runner.RunWith;
+import android.support.test.InstrumentationRegistry;
+import org.chromium.content_shell_apk.ContentShellActivityTestRule;
/**
* Provides test environment for Gesture Detector Reset for Content Shell.
* This is a helper class for Content Shell tests.
*/
-public class GestureDetectorResetTest extends ContentShellTestBase {
+@RunWith(BaseJUnit4ClassRunner.class)
+public class GestureDetectorResetTest {
+
+ @Rule
+ public ContentShellActivityTestRule mActivityTestRule = new ContentShellActivityTestRule();
private static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(2);
private static final String CLICK_TEST_URL = UrlUtils.encodeHtmlDataUri("<html><body>"
+ "<button id=\"button\" "
@@ -90,16 +99,17 @@ public class GestureDetectorResetTest extends ContentShellTestBase {
* Tests that showing a select popup and having the page reload while the popup is showing does
* not assert.
*/
+ @Test
@LargeTest
@Feature({"Browser"})
@RetryOnFailure
public void testSeparateClicksAreRegisteredOnReload()
throws InterruptedException, Exception, Throwable {
// Load the test page.
- launchContentShellWithUrl(CLICK_TEST_URL);
- waitForActiveShellToBeDoneLoading();
+ mActivityTestRule.launchContentShellWithUrl(CLICK_TEST_URL);
+ mActivityTestRule.waitForActiveShellToBeDoneLoading();
- final ContentViewCore viewCore = getContentViewCore();
+ final ContentViewCore viewCore = mActivityTestRule.getContentViewCore();
final TestCallbackHelperContainer viewClient =
new TestCallbackHelperContainer(viewCore);
final OnPageFinishedHelper onPageFinishedHelper =
@@ -110,10 +120,10 @@ public class GestureDetectorResetTest extends ContentShellTestBase {
// Reload the test page.
int currentCallCount = onPageFinishedHelper.getCallCount();
- getInstrumentation().runOnMainSync(new Runnable() {
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
- getActivity().getActiveShell().loadUrl(CLICK_TEST_URL);
+ mActivityTestRule.getActivity().getActiveShell().loadUrl(CLICK_TEST_URL);
}
});
onPageFinishedHelper.waitForCallback(currentCallCount, 1,
@@ -124,10 +134,10 @@ public class GestureDetectorResetTest extends ContentShellTestBase {
// Directly navigate to the test page.
currentCallCount = onPageFinishedHelper.getCallCount();
- getInstrumentation().runOnMainSync(new Runnable() {
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
- getActivity().getActiveShell().getContentViewCore().getWebContents()
+ mActivityTestRule.getActivity().getActiveShell().getContentViewCore().getWebContents()
.getNavigationController().loadUrl(
new LoadUrlParams(CLICK_TEST_URL));
}

Powered by Google App Engine
This is Rietveld 408576698