| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 @Override | 102 @Override |
| 103 public void dismissed() { | 103 public void dismissed() { |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 private AutofillSuggestion[] createTwoAutofillSuggestionArray() { | 107 private AutofillSuggestion[] createTwoAutofillSuggestionArray() { |
| 108 return new AutofillSuggestion[] { | 108 return new AutofillSuggestion[] { |
| 109 new AutofillSuggestion("Sherlock Holmes", "221B Baker Street", D
ropdownItem.NO_ICON, | 109 new AutofillSuggestion("Sherlock Holmes", "221B Baker Street", D
ropdownItem.NO_ICON, |
| 110 42, false, false), | 110 42, false, false, false), |
| 111 new AutofillSuggestion( | 111 new AutofillSuggestion("Arthur Dent", "West Country", DropdownIt
em.NO_ICON, |
| 112 "Arthur Dent", "West Country", DropdownItem.NO_ICON, 43,
false, false), | 112 43, false, false, false), |
| 113 }; | 113 }; |
| 114 } | 114 } |
| 115 | 115 |
| 116 private AutofillSuggestion[] createFiveAutofillSuggestionArray() { | 116 private AutofillSuggestion[] createFiveAutofillSuggestionArray() { |
| 117 return new AutofillSuggestion[] { | 117 return new AutofillSuggestion[] { |
| 118 new AutofillSuggestion("Sherlock Holmes", "221B Baker Street", D
ropdownItem.NO_ICON, | 118 new AutofillSuggestion("Sherlock Holmes", "221B Baker Street", D
ropdownItem.NO_ICON, |
| 119 42, false, false), | 119 42, false, false, false), |
| 120 new AutofillSuggestion( | 120 new AutofillSuggestion("Arthur Dent", "West Country", DropdownIt
em.NO_ICON, |
| 121 "Arthur Dent", "West Country", DropdownItem.NO_ICON, 43,
false, false), | 121 43, false, false, false), |
| 122 new AutofillSuggestion("Arthos", "France", DropdownItem.NO_ICON,
44, false, false), | 122 new AutofillSuggestion("Arthos", "France", DropdownItem.NO_ICON, |
| 123 new AutofillSuggestion("Porthos", "France", DropdownItem.NO_ICON
, 45, false, false), | 123 44, false, false, false), |
| 124 new AutofillSuggestion("Aramis", "France", DropdownItem.NO_ICON,
46, false, false), | 124 new AutofillSuggestion("Porthos", "France", DropdownItem.NO_ICON
, |
| 125 45, false, false, false), |
| 126 new AutofillSuggestion("Aramis", "France", DropdownItem.NO_ICON, |
| 127 46, false, false, false), |
| 125 }; | 128 }; |
| 126 } | 129 } |
| 127 | 130 |
| 128 public void openAutofillPopupAndWaitUntilReady(final AutofillSuggestion[] su
ggestions) | 131 public void openAutofillPopupAndWaitUntilReady(final AutofillSuggestion[] su
ggestions) |
| 129 throws InterruptedException { | 132 throws InterruptedException { |
| 130 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 133 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 131 @Override | 134 @Override |
| 132 public void run() { | 135 public void run() { |
| 133 mAutofillPopup.filterAndShow(suggestions, false); | 136 mAutofillPopup.filterAndShow(suggestions, false); |
| 134 } | 137 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 157 AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray(); | 160 AutofillSuggestion[] suggestions = createTwoAutofillSuggestionArray(); |
| 158 openAutofillPopupAndWaitUntilReady(suggestions); | 161 openAutofillPopupAndWaitUntilReady(suggestions); |
| 159 assertEquals(2, mAutofillPopup.getListView().getCount()); | 162 assertEquals(2, mAutofillPopup.getListView().getCount()); |
| 160 | 163 |
| 161 TouchCommon.singleClickView(mAutofillPopup.getListView().getChildAt(0)); | 164 TouchCommon.singleClickView(mAutofillPopup.getListView().getChildAt(0)); |
| 162 mMockAutofillCallback.waitForCallback(); | 165 mMockAutofillCallback.waitForCallback(); |
| 163 | 166 |
| 164 assertEquals(0, mMockAutofillCallback.mListIndex); | 167 assertEquals(0, mMockAutofillCallback.mListIndex); |
| 165 } | 168 } |
| 166 } | 169 } |
| OLD | NEW |