| Index: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java
|
| diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java
|
| index ab3aa5fa93663297e81ed8a4bb2f867d94b48527..8a7d9e17b16aadd0f62dc569f55d4fcaf95a9cd0 100644
|
| --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java
|
| +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java
|
| @@ -4,18 +4,27 @@
|
|
|
| package org.chromium.chrome.browser.autofill;
|
|
|
| +import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
|
| +
|
| import android.graphics.Color;
|
| import android.support.test.filters.SmallTest;
|
| import android.view.View;
|
|
|
| -import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout;
|
| +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.annotations.SuppressFBWarnings;
|
| +import org.chromium.base.test.util.CommandLineFlags;
|
| import org.chromium.base.test.util.Feature;
|
| import org.chromium.base.test.util.RetryOnFailure;
|
| import org.chromium.chrome.browser.ChromeActivity;
|
| -import org.chromium.chrome.test.ChromeActivityTestCaseBase;
|
| +import org.chromium.chrome.browser.ChromeSwitches;
|
| +import org.chromium.chrome.test.ChromeActivityTestRule;
|
| +import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
|
| import org.chromium.components.autofill.AutofillDelegate;
|
| import org.chromium.components.autofill.AutofillPopup;
|
| import org.chromium.components.autofill.AutofillSuggestion;
|
| @@ -33,29 +42,26 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
| * Tests the Autofill's java code for creating the AutofillPopup object, opening and selecting
|
| * popups.
|
| */
|
| +@RunWith(ChromeJUnit4ClassRunner.class)
|
| @RetryOnFailure
|
| -public class AutofillTest extends ChromeActivityTestCaseBase<ChromeActivity> {
|
| +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE,
|
| + ChromeActivityTestRule.DISABLE_NETWORK_PREDICTION_FLAG})
|
| +public class AutofillTest {
|
| + @Rule
|
| + public ChromeActivityTestRule<ChromeActivity> mActivityTestRule =
|
| + new ChromeActivityTestRule<>(ChromeActivity.class);
|
|
|
| private AutofillPopup mAutofillPopup;
|
| private WindowAndroid mWindowAndroid;
|
| private MockAutofillCallback mMockAutofillCallback;
|
|
|
| - public AutofillTest() {
|
| - super(ChromeActivity.class);
|
| - }
|
| -
|
| - @Override
|
| - public void startMainActivity() throws InterruptedException {
|
| - startMainActivityOnBlankPage();
|
| - }
|
| -
|
| + @Before
|
| @SuppressFBWarnings("URF_UNREAD_FIELD")
|
| - @Override
|
| public void setUp() throws Exception {
|
| - super.setUp();
|
| + mActivityTestRule.startMainActivityOnBlankPage();
|
|
|
| mMockAutofillCallback = new MockAutofillCallback();
|
| - final ChromeActivity activity = getActivity();
|
| + final ChromeActivity activity = mActivityTestRule.getActivity();
|
| final ViewAndroidDelegate viewDelegate =
|
| ViewAndroidDelegate.createBasicDelegate(
|
| activity.getCurrentContentViewCore().getContainerView());
|
| @@ -154,26 +160,28 @@ public class AutofillTest extends ChromeActivityTestCaseBase<ChromeActivity> {
|
| });
|
| }
|
|
|
| + @Test
|
| @SmallTest
|
| @Feature({"autofill"})
|
| public void testAutofillWithDifferentNumberSuggestions() throws Exception {
|
| openAutofillPopupAndWaitUntilReady(createTwoAutofillSuggestionArray());
|
| - assertEquals(2, mAutofillPopup.getListView().getCount());
|
| + Assert.assertEquals(2, mAutofillPopup.getListView().getCount());
|
|
|
| openAutofillPopupAndWaitUntilReady(createFiveAutofillSuggestionArray());
|
| - assertEquals(5, mAutofillPopup.getListView().getCount());
|
| + Assert.assertEquals(5, mAutofillPopup.getListView().getCount());
|
| }
|
|
|
| + @Test
|
| @SmallTest
|
| @Feature({"autofill"})
|
| public void testAutofillClickFirstSuggestion() throws Exception {
|
| AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray();
|
| openAutofillPopupAndWaitUntilReady(suggestions);
|
| - assertEquals(2, mAutofillPopup.getListView().getCount());
|
| + Assert.assertEquals(2, mAutofillPopup.getListView().getCount());
|
|
|
| TouchCommon.singleClickView(mAutofillPopup.getListView().getChildAt(0));
|
| mMockAutofillCallback.waitForCallback();
|
|
|
| - assertEquals(0, mMockAutofillCallback.mListIndex);
|
| + Assert.assertEquals(0, mMockAutofillCallback.mListIndex);
|
| }
|
| }
|
|
|