| 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 import android.view.View; | 8 import android.view.View; |
| 9 | 9 |
| 10 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 10 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 @Override | 44 @Override |
| 45 public void startMainActivity() throws InterruptedException { | 45 public void startMainActivity() throws InterruptedException { |
| 46 startMainActivityOnBlankPage(); | 46 startMainActivityOnBlankPage(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 @SuppressFBWarnings("URF_UNREAD_FIELD") | 49 @SuppressFBWarnings("URF_UNREAD_FIELD") |
| 50 @Override | 50 @Override |
| 51 public void setUp() throws Exception { | 51 public void setUp() throws Exception { |
| 52 super.setUp(); | 52 super.setUp(); |
| 53 | 53 |
| 54 mMockAutofillCallback = new MockAutofillCallback(); |
| 54 final ChromeActivity activity = getActivity(); | 55 final ChromeActivity activity = getActivity(); |
| 55 mMockAutofillCallback = new MockAutofillCallback(); | |
| 56 final ViewAndroidDelegate viewDelegate = | 56 final ViewAndroidDelegate viewDelegate = |
| 57 activity.getCurrentContentViewCore().getViewAndroidDelegate(); | 57 ViewAndroidDelegate.createBasicDelegate( |
| 58 activity.getCurrentContentViewCore().getContainerView())
; |
| 58 | 59 |
| 59 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 60 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 60 @Override | 61 @Override |
| 61 public void run() { | 62 public void run() { |
| 62 View anchorView = viewDelegate.acquireView(); | 63 View anchorView = viewDelegate.acquireView(); |
| 63 viewDelegate.setViewPosition(anchorView, 50f, 500f, 500f, 500f,
1f, 10, 10); | 64 viewDelegate.setViewPosition(anchorView, 50f, 500f, 500f, 500f,
1f, 10, 10); |
| 64 | 65 |
| 65 mWindowAndroid = new ActivityWindowAndroid(activity); | 66 mWindowAndroid = new ActivityWindowAndroid(activity); |
| 66 mAutofillPopup = new AutofillPopup(activity, anchorView, mMockAu
tofillCallback); | 67 mAutofillPopup = new AutofillPopup(activity, anchorView, mMockAu
tofillCallback); |
| 67 mAutofillPopup.filterAndShow(new AutofillSuggestion[0], false); | 68 mAutofillPopup.filterAndShow(new AutofillSuggestion[0], false); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray(); | 155 AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray(); |
| 155 openAutofillPopupAndWaitUntilReady(suggestions); | 156 openAutofillPopupAndWaitUntilReady(suggestions); |
| 156 assertEquals(2, mAutofillPopup.getListView().getCount()); | 157 assertEquals(2, mAutofillPopup.getListView().getCount()); |
| 157 | 158 |
| 158 TouchCommon.singleClickView(mAutofillPopup.getListView().getChildAt(0)); | 159 TouchCommon.singleClickView(mAutofillPopup.getListView().getChildAt(0)); |
| 159 mMockAutofillCallback.waitForCallback(); | 160 mMockAutofillCallback.waitForCallback(); |
| 160 | 161 |
| 161 assertEquals(0, mMockAutofillCallback.mListIndex); | 162 assertEquals(0, mMockAutofillCallback.mListIndex); |
| 162 } | 163 } |
| 163 } | 164 } |
| OLD | NEW |