Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.MediumTest; | 7 import android.test.suitebuilder.annotation.MediumTest; |
| 8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
| 9 import android.view.View; | 9 import android.view.View; |
| 10 import android.view.ViewGroup; | 10 import android.view.ViewGroup; |
| 11 | 11 |
| 12 import org.chromium.base.CommandLine; | |
| 12 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
| 13 import org.chromium.base.test.util.Feature; | 14 import org.chromium.base.test.util.Feature; |
| 14 import org.chromium.base.test.util.UrlUtils; | 15 import org.chromium.base.test.util.UrlUtils; |
| 15 import org.chromium.chrome.R; | 16 import org.chromium.chrome.R; |
| 16 import org.chromium.chrome.browser.ChromeActivity; | 17 import org.chromium.chrome.browser.ChromeActivity; |
| 17 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 18 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| 18 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 19 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 19 import org.chromium.content.browser.ContentViewCore; | 20 import org.chromium.content.browser.ContentViewCore; |
| 20 import org.chromium.content.browser.test.util.Criteria; | 21 import org.chromium.content.browser.test.util.Criteria; |
| 21 import org.chromium.content.browser.test.util.CriteriaHelper; | 22 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 22 import org.chromium.content.browser.test.util.DOMUtils; | 23 import org.chromium.content.browser.test.util.DOMUtils; |
| 23 import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper; | 24 import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper; |
| 24 import org.chromium.content.browser.test.util.TouchCommon; | 25 import org.chromium.content.browser.test.util.TouchCommon; |
| 26 import org.chromium.content.common.ContentSwitches; | |
| 25 import org.chromium.content_public.browser.WebContents; | 27 import org.chromium.content_public.browser.WebContents; |
| 26 import org.chromium.ui.autofill.AutofillPopup; | 28 import org.chromium.ui.autofill.AutofillPopup; |
| 27 | 29 |
| 28 import java.util.ArrayList; | 30 import java.util.ArrayList; |
| 29 import java.util.List; | 31 import java.util.List; |
| 30 import java.util.concurrent.ExecutionException; | 32 import java.util.concurrent.ExecutionException; |
| 31 import java.util.concurrent.TimeoutException; | 33 import java.util.concurrent.TimeoutException; |
| 32 | 34 |
| 33 /** | 35 /** |
| 34 * Integration tests for the AutofillPopup. | 36 * Integration tests for the AutofillPopup. |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 LANGUAGE_CODE); | 168 LANGUAGE_CODE); |
| 167 mHelper.setProfile(profile); | 169 mHelper.setProfile(profile); |
| 168 assertEquals(1, mHelper.getNumberOfProfiles()); | 170 assertEquals(1, mHelper.getNumberOfProfiles()); |
| 169 | 171 |
| 170 // Click the input field for the first name. | 172 // Click the input field for the first name. |
| 171 assertTrue(DOMUtils.waitForNonZeroNodeBounds(webContents, "fn")); | 173 assertTrue(DOMUtils.waitForNonZeroNodeBounds(webContents, "fn")); |
| 172 DOMUtils.clickNode(this, viewCore, "fn"); | 174 DOMUtils.clickNode(this, viewCore, "fn"); |
| 173 | 175 |
| 174 waitForKeyboardShowRequest(immw, 1); | 176 waitForKeyboardShowRequest(immw, 1); |
| 175 | 177 |
| 176 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 178 if (CommandLine.getInstance().hasSwitch(ContentSwitches.USE_IME_THREAD)) { |
|
aelias_OOO_until_Jul13
2015/09/30 00:10:03
We shouldn't be checking for a command-line switch
Changwan Ryu
2016/01/19 07:31:52
Done.
| |
| 177 @Override | 179 viewCore.getInputConnectionForTest().setComposingText(inputText, 1); |
| 178 public void run() { | 180 } else { |
| 179 viewCore.getInputConnectionForTest().setComposingText( | 181 ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
| 180 inputText, 1); | 182 @Override |
| 181 } | 183 public void run() { |
| 182 }); | 184 viewCore.getInputConnectionForTest().setComposingText(inputT ext, 1); |
| 185 } | |
| 186 }); | |
| 187 } | |
| 183 | 188 |
| 184 waitForAnchorViewAdd(view); | 189 waitForAnchorViewAdd(view); |
| 185 View anchorView = view.findViewById(R.id.dropdown_popup_window); | 190 View anchorView = view.findViewById(R.id.dropdown_popup_window); |
| 186 | 191 |
| 187 assertTrue(anchorView.getTag() instanceof AutofillPopup); | 192 assertTrue(anchorView.getTag() instanceof AutofillPopup); |
| 188 final AutofillPopup popup = (AutofillPopup) anchorView.getTag(); | 193 final AutofillPopup popup = (AutofillPopup) anchorView.getTag(); |
| 189 | 194 |
| 190 waitForAutofillPopopShow(popup); | 195 waitForAutofillPopopShow(popup); |
| 191 | 196 |
| 192 TouchCommon.singleClickViewRelative(popup.getListView(), 10, 10); | 197 TouchCommon.singleClickViewRelative(popup.getListView(), 10, 10); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 private void assertLogged(String autofilledValue, String profileFullName) { | 358 private void assertLogged(String autofilledValue, String profileFullName) { |
| 354 for (AutofillLogger.LogEntry entry : mAutofillLoggedEntries) { | 359 for (AutofillLogger.LogEntry entry : mAutofillLoggedEntries) { |
| 355 if (entry.getAutofilledValue().equals(autofilledValue) | 360 if (entry.getAutofilledValue().equals(autofilledValue) |
| 356 && entry.getProfileFullName().equals(profileFullName)) { | 361 && entry.getProfileFullName().equals(profileFullName)) { |
| 357 return; | 362 return; |
| 358 } | 363 } |
| 359 } | 364 } |
| 360 fail("Logged entry not found [" + autofilledValue + "," + profileFullNam e + "]"); | 365 fail("Logged entry not found [" + autofilledValue + "," + profileFullNam e + "]"); |
| 361 } | 366 } |
| 362 } | 367 } |
| OLD | NEW |