Index: content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java |
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java |
index 380b99ff7c37faf952f1fe37f918eea86005c86a..7e55478d50a2fd423cd91624b5e4f4a5c516cd99 100644 |
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.java |
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/SelectPopupTest.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. |
@@ -17,14 +17,25 @@ import org.chromium.content.browser.test.util.CriteriaHelper; |
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_shell_apk.ContentShellTestBase; |
import java.util.concurrent.TimeUnit; |
+import org.chromium.content_shell_apk.ContentShellActivityTestRule.RerunWithUpdatedContainerView; |
+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.junit.Before; |
+import org.chromium.content_shell_apk.ContentShellActivityTestRule; |
/** |
* Integration Tests for SelectPopup. |
*/ |
-public class SelectPopupTest extends ContentShellTestBase { |
+@RunWith(BaseJUnit4ClassRunner.class) |
+public class SelectPopupTest { |
+ |
+ @Rule |
+ public ContentShellActivityTestRule mActivityTestRule = new ContentShellActivityTestRule(); |
private static final long WAIT_TIMEOUT_SECONDS = scaleTimeout(2); |
private static final String SELECT_URL = UrlUtils.encodeHtmlDataUri( |
"<html><head><meta name=\"viewport\"" |
@@ -48,7 +59,7 @@ public class SelectPopupTest extends ContentShellTestBase { |
@Override |
public boolean isSatisfied() { |
- return getContentViewCore().getSelectPopupForTest() != null; |
+ return mActivityTestRule.getContentViewCore().getSelectPopupForTest() != null; |
} |
} |
@@ -59,21 +70,22 @@ public class SelectPopupTest extends ContentShellTestBase { |
@Override |
public boolean isSatisfied() { |
- return getContentViewCore().getSelectPopupForTest() == null; |
+ return mActivityTestRule.getContentViewCore().getSelectPopupForTest() == null; |
} |
} |
- @Override |
+ @Before |
+ |
public void setUp() throws Exception { |
- super.setUp(); |
- launchContentShellWithUrl(SELECT_URL); |
- waitForActiveShellToBeDoneLoading(); |
+ mActivityTestRule.launchContentShellWithUrl(SELECT_URL); |
+ mActivityTestRule.waitForActiveShellToBeDoneLoading(); |
} |
/** |
* Tests that showing a select popup and having the page reload while the popup is showing does |
* not assert. |
*/ |
+ @Test |
@LargeTest |
@Feature({"Browser"}) |
@RerunWithUpdatedContainerView |
@@ -82,7 +94,7 @@ public class SelectPopupTest extends ContentShellTestBase { |
// The popup should be hidden before the click. |
CriteriaHelper.pollInstrumentationThread(new PopupHiddenCriteria()); |
- final ContentViewCore viewCore = getContentViewCore(); |
+ final ContentViewCore viewCore = mActivityTestRule.getContentViewCore(); |
final TestCallbackHelperContainer viewClient = new TestCallbackHelperContainer(viewCore); |
final OnPageFinishedHelper onPageFinishedHelper = viewClient.getOnPageFinishedHelper(); |
@@ -92,11 +104,11 @@ public class SelectPopupTest extends ContentShellTestBase { |
// Reload the test page. |
int currentCallCount = onPageFinishedHelper.getCallCount(); |
- getInstrumentation().runOnMainSync(new Runnable() { |
+ InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() { |
@Override |
public void run() { |
// Now reload the page while the popup is showing, it gets hidden. |
- getContentViewCore().getWebContents().getNavigationController().reload(true); |
+ mActivityTestRule.getContentViewCore().getWebContents().getNavigationController().reload(true); |
} |
}); |
onPageFinishedHelper.waitForCallback(currentCallCount, 1, |