| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.autofill; | 5 package org.chromium.chrome.browser.autofill; |
| 6 | 6 |
| 7 import android.test.suitebuilder.annotation.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
| 8 | 8 |
| 9 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 9 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
| 10 | 10 |
| 11 import org.chromium.base.ThreadUtils; | 11 import org.chromium.base.ThreadUtils; |
| 12 import org.chromium.base.annotations.SuppressFBWarnings; |
| 12 import org.chromium.base.test.util.Feature; | 13 import org.chromium.base.test.util.Feature; |
| 13 import org.chromium.chrome.shell.ChromeShellActivity; | 14 import org.chromium.chrome.shell.ChromeShellActivity; |
| 14 import org.chromium.chrome.shell.ChromeShellTestBase; | 15 import org.chromium.chrome.shell.ChromeShellTestBase; |
| 15 import org.chromium.content.browser.test.util.Criteria; | 16 import org.chromium.content.browser.test.util.Criteria; |
| 16 import org.chromium.content.browser.test.util.CriteriaHelper; | 17 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 17 import org.chromium.content.browser.test.util.TouchCommon; | 18 import org.chromium.content.browser.test.util.TouchCommon; |
| 18 import org.chromium.ui.DropdownItem; | 19 import org.chromium.ui.DropdownItem; |
| 19 import org.chromium.ui.autofill.AutofillPopup; | 20 import org.chromium.ui.autofill.AutofillPopup; |
| 20 import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; | 21 import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; |
| 21 import org.chromium.ui.autofill.AutofillSuggestion; | 22 import org.chromium.ui.autofill.AutofillSuggestion; |
| 22 import org.chromium.ui.base.ActivityWindowAndroid; | 23 import org.chromium.ui.base.ActivityWindowAndroid; |
| 23 import org.chromium.ui.base.ViewAndroidDelegate; | 24 import org.chromium.ui.base.ViewAndroidDelegate; |
| 24 import org.chromium.ui.base.WindowAndroid; | 25 import org.chromium.ui.base.WindowAndroid; |
| 25 | 26 |
| 26 import java.util.concurrent.atomic.AtomicBoolean; | 27 import java.util.concurrent.atomic.AtomicBoolean; |
| 27 | 28 |
| 28 /** | 29 /** |
| 29 * Tests the Autofill's java code for creating the AutofillPopup object, opening
and selecting | 30 * Tests the Autofill's java code for creating the AutofillPopup object, opening
and selecting |
| 30 * popups. | 31 * popups. |
| 31 */ | 32 */ |
| 32 public class AutofillTest extends ChromeShellTestBase { | 33 public class AutofillTest extends ChromeShellTestBase { |
| 33 | 34 |
| 34 private AutofillPopup mAutofillPopup; | 35 private AutofillPopup mAutofillPopup; |
| 35 private WindowAndroid mWindowAndroid; | 36 private WindowAndroid mWindowAndroid; |
| 36 private MockAutofillCallback mMockAutofillCallback; | 37 private MockAutofillCallback mMockAutofillCallback; |
| 37 | 38 |
| 39 @SuppressFBWarnings("URF_UNREAD_FIELD") |
| 38 @Override | 40 @Override |
| 39 public void setUp() throws Exception { | 41 public void setUp() throws Exception { |
| 40 super.setUp(); | 42 super.setUp(); |
| 41 final ChromeShellActivity activity = launchChromeShellWithBlankPage(); | 43 final ChromeShellActivity activity = launchChromeShellWithBlankPage(); |
| 42 assertNotNull(activity); | 44 assertNotNull(activity); |
| 43 waitForActiveShellToBeDoneLoading(); | 45 waitForActiveShellToBeDoneLoading(); |
| 44 | 46 |
| 45 mMockAutofillCallback = new MockAutofillCallback(); | 47 mMockAutofillCallback = new MockAutofillCallback(); |
| 46 mWindowAndroid = new ActivityWindowAndroid(activity); | 48 mWindowAndroid = new ActivityWindowAndroid(activity); |
| 47 final ViewAndroidDelegate viewDelegate = | 49 final ViewAndroidDelegate viewDelegate = |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray(); | 138 AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray(); |
| 137 assertTrue(openAutofillPopupAndWaitUntilReady(suggestions)); | 139 assertTrue(openAutofillPopupAndWaitUntilReady(suggestions)); |
| 138 assertEquals(2, mAutofillPopup.getListView().getCount()); | 140 assertEquals(2, mAutofillPopup.getListView().getCount()); |
| 139 | 141 |
| 140 TouchCommon.singleClickViewRelative(mAutofillPopup.getListView(), 10, 10
); | 142 TouchCommon.singleClickViewRelative(mAutofillPopup.getListView(), 10, 10
); |
| 141 assertTrue(mMockAutofillCallback.waitForCallback()); | 143 assertTrue(mMockAutofillCallback.waitForCallback()); |
| 142 | 144 |
| 143 assertEquals(0, mMockAutofillCallback.mListIndex); | 145 assertEquals(0, mMockAutofillCallback.mListIndex); |
| 144 } | 146 } |
| 145 } | 147 } |
| OLD | NEW |