Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillPopupWithKeyboardTest.java

Issue 715733002: [Android] Show autofill popup after animation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add zoomed page click test. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.autofill;
6
7 import android.test.suitebuilder.annotation.MediumTest;
8 import android.view.View;
9 import android.view.ViewGroup;
10
11 import org.chromium.base.test.util.Feature;
12 import org.chromium.base.test.util.UrlUtils;
13 import org.chromium.chrome.R;
14 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
15 import org.chromium.chrome.shell.ChromeShellTestBase;
16 import org.chromium.content.browser.ContentViewCore;
17 import org.chromium.content.browser.test.util.Criteria;
18 import org.chromium.content.browser.test.util.CriteriaHelper;
19 import org.chromium.content.browser.test.util.DOMUtils;
20 import org.chromium.content_public.browser.WebContents;
21 import org.chromium.ui.UiUtils;
22 import org.chromium.ui.autofill.AutofillPopup;
23
24 import java.util.concurrent.ExecutionException;
25 import java.util.concurrent.TimeoutException;
26
27 /**
28 * Integration tests for interaction of the AutofillPopup and a keyboard.
29 */
30 public class AutofillPopupWithKeyboardTest extends ChromeShellTestBase {
31 /**
32 * Test that showing autofill popup and keyboard will not hide the autofill popup.
33 */
34 @MediumTest
35 @Feature({"autofill-keyboard"})
36 public void testShowAutofillPopupAndKeyboardimultaneously()
37 throws InterruptedException, ExecutionException, TimeoutException {
38 launchChromeShellWithUrl(UrlUtils.encodeHtmlDataUri("<html><head>"
39 + "<meta name=\"viewport\""
40 + "content=\"width=device-width, initial-scale=1.0, maximum-scal e=1.0\" /></head>"
41 + "<body><form method=\"POST\">"
42 + "<input type=\"text\" id=\"fn\" autocomplete=\"given-name\" /> <br>"
43 + "<input type=\"text\" id=\"ln\" autocomplete=\"family-name\" / ><br>"
44 + "<textarea id=\"sa\" autocomplete=\"street-address\"></textare a><br>"
45 + "<input type=\"text\" id=\"a1\" autocomplete=\"address-line1\" /><br>"
46 + "<input type=\"text\" id=\"a2\" autocomplete=\"address-line2\" /><br>"
47 + "<input type=\"text\" id=\"ct\" autocomplete=\"locality\" /><b r>"
48 + "<input type=\"text\" id=\"zc\" autocomplete=\"postal-code\" / ><br>"
49 + "<input type=\"text\" id=\"em\" autocomplete=\"email\" /><br>"
50 + "<input type=\"text\" id=\"ph\" autocomplete=\"tel\" /><br>"
51 + "<input type=\"text\" id=\"fx\" autocomplete=\"fax\" /><br>"
52 + "<select id=\"co\" autocomplete=\"country\"><br>"
53 + "<option value=\"BR\">Brazil</option>"
54 + "<option value=\"US\">United States</option>"
55 + "</select>"
56 + "<input type=\"submit\" />"
57 + "</form></body></html>"));
58 assertTrue(waitForActiveShellToBeDoneLoading());
59
60 new AutofillTestHelper().setProfile(new AutofillProfile("", "https://www .example.com",
newt (away) 2015/01/15 17:36:45 These objects all live on the UI thread. You shoul
please use gerrit instead 2015/01/20 19:38:02 AutofillTestHelper.setProfile() handles threading
61 "John Smith", "Acme Inc", "1 Main\nApt A", "CA", "San Francisco" , "", "94102", "",
62 "US", "(415) 888-9999", "john@acme.inc", "en"));
63 ContentViewCore viewCore = getActivity().getActiveContentViewCore();
64 WebContents webContents = viewCore.getWebContents();
65 assertTrue(DOMUtils.waitForNonZeroNodeBounds(webContents, "fn"));
66
67 DOMUtils.clickNode(this, viewCore, "fn");
68 waitForKeyboardShown();
69
70 final ViewGroup view = viewCore.getContainerView();
71 UiUtils.hideKeyboard(view);
72 waitForKeyboardHidden();
73
74 DOMUtils.clickNode(this, viewCore, "fn");
75 waitForKeyboardShown();
76
77 assertTrue("Autofill Popup anchor view was never added.",
78 CriteriaHelper.pollForCriteria(new Criteria() {
79 @Override
80 public boolean isSatisfied() {
newt (away) 2015/01/15 17:36:45 This should run on the UI thread, too. Also, lines
please use gerrit instead 2015/01/20 19:38:02 Done.
81 return view.findViewById(R.id.dropdown_popup_window) != null;
82 }
83 }));
84
85 View anchorView = view.findViewById(R.id.dropdown_popup_window);
86 assertTrue(anchorView.getTag() instanceof AutofillPopup);
87
88 final AutofillPopup popup = (AutofillPopup) anchorView.getTag();
89 assertTrue("Autofill Popup anchor view was never added.",
newt (away) 2015/01/15 17:36:45 this message doesn't seem quite right
please use gerrit instead 2015/01/20 19:38:02 Done.
90 CriteriaHelper.pollForCriteria(new Criteria() {
91 @Override
92 public boolean isSatisfied() {
93 return popup.isShowing();
94 }
95 }));
96 }
97
98 private void waitForKeyboardShown() throws InterruptedException {
99 final ContentViewCore viewCore = getActivity().getActiveContentViewCore( );
100 assertTrue("Keyboard was never shown",
101 CriteriaHelper.pollForCriteria(new Criteria() {
102 @Override
103 public boolean isSatisfied() {
104 return UiUtils.isKeyboardShowing(getActivity(),
105 viewCore.getContain erView());
106 }
107 }));
108 viewCore.onSizeChanged(viewCore.getViewportWidthPix(),
newt (away) 2015/01/15 17:36:45 UI thread, etc. You get the point :)
please use gerrit instead 2015/01/20 19:38:03 Done.
109 viewCore.getViewportHeightPix() - 100, viewCore.getViewportWidth Pix(),
110 viewCore.getViewportHeightPix());
111 }
112
113 private void waitForKeyboardHidden() throws InterruptedException {
114 final ContentViewCore viewCore = getActivity().getActiveContentViewCore( );
115 assertTrue("Keyboard was never hidden",
116 CriteriaHelper.pollForCriteria(new Criteria() {
117 @Override
118 public boolean isSatisfied() {
119 return !UiUtils.isKeyboardShowing(getActivity(),
120 viewCore.getContai nerView());
121 }
122 }));
123 viewCore.onSizeChanged(viewCore.getViewportWidthPix(),
124 viewCore.getViewportHeightPix() + 100, viewCore.getViewportWidth Pix(),
125 viewCore.getViewportHeightPix());
126 }
127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698