| 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.ThreadUtils; | |
| 13 import org.chromium.base.test.util.Feature; | 12 import org.chromium.base.test.util.Feature; |
| 14 import org.chromium.base.test.util.UrlUtils; | 13 import org.chromium.base.test.util.UrlUtils; |
| 15 import org.chromium.chrome.R; | 14 import org.chromium.chrome.R; |
| 16 import org.chromium.chrome.browser.ChromeActivity; | 15 import org.chromium.chrome.browser.ChromeActivity; |
| 17 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 16 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| 18 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 17 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 19 import org.chromium.content.browser.ContentViewCore; | 18 import org.chromium.content.browser.ContentViewCore; |
| 19 import org.chromium.content.browser.input.ChromiumBaseInputConnection; |
| 20 import org.chromium.content.browser.test.util.Criteria; | 20 import org.chromium.content.browser.test.util.Criteria; |
| 21 import org.chromium.content.browser.test.util.CriteriaHelper; | 21 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 22 import org.chromium.content.browser.test.util.DOMUtils; | 22 import org.chromium.content.browser.test.util.DOMUtils; |
| 23 import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper; | 23 import org.chromium.content.browser.test.util.TestInputMethodManagerWrapper; |
| 24 import org.chromium.content.browser.test.util.TouchCommon; | 24 import org.chromium.content.browser.test.util.TouchCommon; |
| 25 import org.chromium.content_public.browser.WebContents; | 25 import org.chromium.content_public.browser.WebContents; |
| 26 import org.chromium.ui.autofill.AutofillPopup; | 26 import org.chromium.ui.autofill.AutofillPopup; |
| 27 | 27 |
| 28 import java.util.ArrayList; | 28 import java.util.ArrayList; |
| 29 import java.util.List; | 29 import java.util.List; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 LANGUAGE_CODE); | 166 LANGUAGE_CODE); |
| 167 mHelper.setProfile(profile); | 167 mHelper.setProfile(profile); |
| 168 assertEquals(1, mHelper.getNumberOfProfiles()); | 168 assertEquals(1, mHelper.getNumberOfProfiles()); |
| 169 | 169 |
| 170 // Click the input field for the first name. | 170 // Click the input field for the first name. |
| 171 DOMUtils.waitForNonZeroNodeBounds(webContents, "fn"); | 171 DOMUtils.waitForNonZeroNodeBounds(webContents, "fn"); |
| 172 DOMUtils.clickNode(this, viewCore, "fn"); | 172 DOMUtils.clickNode(this, viewCore, "fn"); |
| 173 | 173 |
| 174 waitForKeyboardShowRequest(immw, 1); | 174 waitForKeyboardShowRequest(immw, 1); |
| 175 | 175 |
| 176 ThreadUtils.runOnUiThreadBlocking(new Runnable() { | 176 final ChromiumBaseInputConnection inputConnection = |
| 177 viewCore.getImeAdapterForTest().getInputConnectionForTest(); |
| 178 inputConnection.getHandler().post(new Runnable() { |
| 177 @Override | 179 @Override |
| 178 public void run() { | 180 public void run() { |
| 179 viewCore.getImeAdapterForTest().getInputConnectionForTest().setC
omposingText( | 181 inputConnection.setComposingText(inputText, 1); |
| 180 inputText, 1); | |
| 181 } | 182 } |
| 182 }); | 183 }); |
| 183 | 184 |
| 184 waitForAnchorViewAdd(view); | 185 waitForAnchorViewAdd(view); |
| 185 View anchorView = view.findViewById(R.id.dropdown_popup_window); | 186 View anchorView = view.findViewById(R.id.dropdown_popup_window); |
| 186 | 187 |
| 187 assertTrue(anchorView.getTag() instanceof AutofillPopup); | 188 assertTrue(anchorView.getTag() instanceof AutofillPopup); |
| 188 final AutofillPopup popup = (AutofillPopup) anchorView.getTag(); | 189 final AutofillPopup popup = (AutofillPopup) anchorView.getTag(); |
| 189 | 190 |
| 190 waitForAutofillPopopShow(popup); | 191 waitForAutofillPopopShow(popup); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 private void assertLogged(String autofilledValue, String profileFullName) { | 354 private void assertLogged(String autofilledValue, String profileFullName) { |
| 354 for (AutofillLogger.LogEntry entry : mAutofillLoggedEntries) { | 355 for (AutofillLogger.LogEntry entry : mAutofillLoggedEntries) { |
| 355 if (entry.getAutofilledValue().equals(autofilledValue) | 356 if (entry.getAutofilledValue().equals(autofilledValue) |
| 356 && entry.getProfileFullName().equals(profileFullName)) { | 357 && entry.getProfileFullName().equals(profileFullName)) { |
| 357 return; | 358 return; |
| 358 } | 359 } |
| 359 } | 360 } |
| 360 fail("Logged entry not found [" + autofilledValue + "," + profileFullNam
e + "]"); | 361 fail("Logged entry not found [" + autofilledValue + "," + profileFullNam
e + "]"); |
| 361 } | 362 } |
| 362 } | 363 } |
| OLD | NEW |