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

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

Issue 2290133002: Make WebView keep keyboard when losing focus (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/android/tabstest/tabs_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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; 5 package org.chromium.chrome.browser;
6 6
7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE; 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE;
8 8
9 import android.content.DialogInterface; 9 import android.content.DialogInterface;
10 import android.content.pm.ActivityInfo; 10 import android.content.pm.ActivityInfo;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 import org.chromium.chrome.test.ChromeTabbedActivityTestBase; 55 import org.chromium.chrome.test.ChromeTabbedActivityTestBase;
56 import org.chromium.chrome.test.util.ApplicationTestUtils; 56 import org.chromium.chrome.test.util.ApplicationTestUtils;
57 import org.chromium.chrome.test.util.ChromeRestriction; 57 import org.chromium.chrome.test.util.ChromeRestriction;
58 import org.chromium.chrome.test.util.ChromeTabUtils; 58 import org.chromium.chrome.test.util.ChromeTabUtils;
59 import org.chromium.chrome.test.util.MenuUtils; 59 import org.chromium.chrome.test.util.MenuUtils;
60 import org.chromium.chrome.test.util.NewTabPageTestUtils; 60 import org.chromium.chrome.test.util.NewTabPageTestUtils;
61 import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher; 61 import org.chromium.chrome.test.util.OverviewModeBehaviorWatcher;
62 import org.chromium.content.browser.ContentViewCore; 62 import org.chromium.content.browser.ContentViewCore;
63 import org.chromium.content.browser.test.util.Criteria; 63 import org.chromium.content.browser.test.util.Criteria;
64 import org.chromium.content.browser.test.util.CriteriaHelper; 64 import org.chromium.content.browser.test.util.CriteriaHelper;
65 import org.chromium.content.browser.test.util.DOMUtils;
65 import org.chromium.content.browser.test.util.JavaScriptUtils; 66 import org.chromium.content.browser.test.util.JavaScriptUtils;
66 import org.chromium.content.browser.test.util.UiUtils; 67 import org.chromium.content.browser.test.util.UiUtils;
67 import org.chromium.content.common.ContentSwitches; 68 import org.chromium.content.common.ContentSwitches;
68 import org.chromium.content_public.browser.WebContents; 69 import org.chromium.content_public.browser.WebContents;
69 import org.chromium.content_public.browser.WebContentsObserver; 70 import org.chromium.content_public.browser.WebContentsObserver;
70 import org.chromium.net.test.EmbeddedTestServer; 71 import org.chromium.net.test.EmbeddedTestServer;
71 72
72 import java.io.File; 73 import java.io.File;
73 import java.util.Locale; 74 import java.util.Locale;
74 import java.util.concurrent.Callable; 75 import java.util.concurrent.Callable;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 271
271 ChromeTabUtils.closeCurrentTab(getInstrumentation(), getActivity()); 272 ChromeTabUtils.closeCurrentTab(getInstrumentation(), getActivity());
272 getInstrumentation().runOnMainSync(new Runnable() { 273 getInstrumentation().runOnMainSync(new Runnable() {
273 @Override 274 @Override
274 public void run() { 275 public void run() {
275 assertEquals(tabCount, getActivity().getCurrentTabModel().getCou nt()); 276 assertEquals(tabCount, getActivity().getCurrentTabModel().getCou nt());
276 } 277 }
277 }); 278 });
278 } 279 }
279 280
281 private void assertWaitForKeyboardStatus(final boolean show) throws Interrup tedException {
282 CriteriaHelper.pollUiThread(new Criteria() {
283 @Override
284 public boolean isSatisfied() {
285 updateFailureReason("expected keyboard show: " + show);
286 return show
287 == org.chromium.ui.UiUtils.isKeyboardShowing(
Changwan Ryu 2016/11/01 03:49:31 no need for line separation here
yabinh 2016/11/01 05:31:01 It formats automatically after running "git cl for
288 getActivity(), getActivity().getTabsView());
289 }
290 });
291 }
292
293 /**
294 * Verify that opening a new tab, switching to an existing tab and closing c urrent tab hide
295 * keyboard.
296 */
297 @LargeTest
298 @Restriction(ChromeRestriction.RESTRICTION_TYPE_TABLET)
299 @Feature({"Android-TabSwitcher"})
300 @RetryOnFailure
301 public void testHideKeyboard() throws Exception {
302 mTestServer = EmbeddedTestServer.createAndStartServer(getInstrumentation ().getContext());
303
304 // Open a new tab(The 1st tab) and click node.
305 ChromeTabUtils.fullyLoadUrlInNewTab(
306 getInstrumentation(), getActivity(), mTestServer.getURL(TEST_FIL E_PATH), false);
307 assertEquals("Failed to click node.", true,
308 DOMUtils.clickNode(
309 this, getActivity().getActivityTab().getContentViewCore( ), "input_text"));
310 assertWaitForKeyboardStatus(true);
311
312 // Open a new tab(the 2nd tab).
313 ChromeTabUtils.fullyLoadUrlInNewTab(
314 getInstrumentation(), getActivity(), mTestServer.getURL(TEST_FIL E_PATH), false);
315 assertWaitForKeyboardStatus(false);
316
317 // Click node in the 2nd tab.
318 DOMUtils.clickNode(this, getActivity().getActivityTab().getContentViewCo re(), "input_text");
319 assertWaitForKeyboardStatus(true);
320
321 // Switch to the 1st tab.
322 ChromeTabUtils.switchTabInCurrentTabModel(getActivity(), 1);
323 assertWaitForKeyboardStatus(false);
324
325 // Click node in the 1st tab.
326 DOMUtils.clickNode(this, getActivity().getActivityTab().getContentViewCo re(), "input_text");
327 assertWaitForKeyboardStatus(true);
328
329 // Close current tab(the 1st tab).
330 ChromeTabUtils.closeCurrentTab(getInstrumentation(), getActivity());
331 assertWaitForKeyboardStatus(false);
332 }
333
280 /** 334 /**
281 * Verify that opening a new tab and navigating immediately sets a size on t he newly created 335 * Verify that opening a new tab and navigating immediately sets a size on t he newly created
282 * renderer. https://crbug.com/434477. 336 * renderer. https://crbug.com/434477.
283 * @throws InterruptedException 337 * @throws InterruptedException
284 * @throws TimeoutException 338 * @throws TimeoutException
285 */ 339 */
286 @SmallTest 340 @SmallTest
287 @RetryOnFailure 341 @RetryOnFailure
288 public void testNewTabSetsContentViewSize() throws InterruptedException, Tim eoutException { 342 public void testNewTabSetsContentViewSize() throws InterruptedException, Tim eoutException {
289 ChromeTabUtils.newTabFromMenu(getInstrumentation(), getActivity()); 343 ChromeTabUtils.newTabFromMenu(getInstrumentation(), getActivity());
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 throws InterruptedException { 1771 throws InterruptedException {
1718 CriteriaHelper.pollInstrumentationThread( 1772 CriteriaHelper.pollInstrumentationThread(
1719 Criteria.equals(expected, new Callable<Boolean>() { 1773 Criteria.equals(expected, new Callable<Boolean>() {
1720 @Override 1774 @Override
1721 public Boolean call() { 1775 public Boolean call() {
1722 return fileToCheck.exists(); 1776 return fileToCheck.exists();
1723 } 1777 }
1724 })); 1778 }));
1725 } 1779 }
1726 } 1780 }
OLDNEW
« 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