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

Unified Diff: chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java

Issue 2290133002: Make WebView keep keyboard when losing focus (Closed)
Patch Set: rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/android/tabstest/tabs_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
index 8c260329acd1ac3214de4e1d27626f55d2bf24eb..0147619bf2fb7c0f05616855a9241982bb235002 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/TabsTest.java
@@ -62,6 +62,7 @@ import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
+import org.chromium.content.browser.test.util.DOMUtils;
import org.chromium.content.browser.test.util.JavaScriptUtils;
import org.chromium.content.browser.test.util.UiUtils;
import org.chromium.content.common.ContentSwitches;
@@ -277,6 +278,59 @@ public class TabsTest extends ChromeTabbedActivityTestBase {
});
}
+ private void assertWaitForKeyboardStatus(final boolean show) throws InterruptedException {
+ CriteriaHelper.pollUiThread(new Criteria() {
+ @Override
+ public boolean isSatisfied() {
+ updateFailureReason("expected keyboard show: " + show);
+ return show
+ == org.chromium.ui.UiUtils.isKeyboardShowing(
+ getActivity(), getActivity().getTabsView());
+ }
+ });
+ }
+
+ /**
+ * Verify that opening a new tab, switching to an existing tab and closing current tab hide
+ * keyboard.
+ */
+ @LargeTest
+ @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
+ @Feature({"Android-TabSwitcher"})
+ @RetryOnFailure
+ public void testHideKeyboard() throws Exception {
+ mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation().getContext());
+
+ // Open a new tab(The 1st tab) and click node.
+ ChromeTabUtils.fullyLoadUrlInNewTab(
+ getInstrumentation(), getActivity(), mTestServer.getURL(TEST_FILE_PATH), false);
+ assertEquals("Failed to click node.", true,
+ DOMUtils.clickNode(
+ this, getActivity().getActivityTab().getContentViewCore(), "input_text"));
+ assertWaitForKeyboardStatus(true);
+
+ // Open a new tab(the 2nd tab).
+ ChromeTabUtils.fullyLoadUrlInNewTab(
+ getInstrumentation(), getActivity(), mTestServer.getURL(TEST_FILE_PATH), false);
+ assertWaitForKeyboardStatus(false);
+
+ // Click node in the 2nd tab.
+ DOMUtils.clickNode(this, getActivity().getActivityTab().getContentViewCore(), "input_text");
+ assertWaitForKeyboardStatus(true);
+
+ // Switch to the 1st tab.
+ ChromeTabUtils.switchTabInCurrentTabModel(getActivity(), 1);
+ assertWaitForKeyboardStatus(false);
+
+ // Click node in the 1st tab.
+ DOMUtils.clickNode(this, getActivity().getActivityTab().getContentViewCore(), "input_text");
+ assertWaitForKeyboardStatus(true);
+
+ // Close current tab(the 1st tab).
+ ChromeTabUtils.closeCurrentTab(getInstrumentation(), getActivity());
+ assertWaitForKeyboardStatus(false);
+ }
+
/**
* Verify that opening a new tab and navigating immediately sets a size on the newly created
* renderer. https://crbug.com/434477.
« no previous file with comments | « no previous file | chrome/test/data/android/tabstest/tabs_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698