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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/ContentViewCoreFocusTest.java

Issue 2290133002: Make WebView keep keyboard when losing focus (Closed)
Patch Set: Created 4 years, 2 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.IBinder; 8 import android.os.IBinder;
9 import android.os.ResultReceiver; 9 import android.os.ResultReceiver;
10 import android.test.UiThreadTest; 10 import android.test.UiThreadTest;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 } 44 }
45 45
46 public boolean isHidden() { 46 public boolean isHidden() {
47 return mHidden; 47 return mHidden;
48 } 48 }
49 } 49 }
50 50
51 @UiThreadTest 51 @UiThreadTest
52 @RerunWithUpdatedContainerView 52 @RerunWithUpdatedContainerView
53 @SmallTest 53 @SmallTest
54 public void testHideImeOnLosingFocus() throws Throwable { 54 public void testDoNotHideImeOnLosingFocus() throws Throwable {
55 // Test the IME window is hidden from the content view when the content 55 // Tests that the IME window does not get hidden when the content view l oses its focus.
56 // view loses its focus
57 final ContentViewCore contentViewCore = getContentViewCore(); 56 final ContentViewCore contentViewCore = getContentViewCore();
58 final View view = contentViewCore.getContainerView(); 57 final View view = contentViewCore.getContainerView();
59 assertTrue(view.requestFocus()); 58 assertTrue(view.requestFocus());
60 59
61 final TestInputMethodManagerWrapper immw = new TestInputMethodManagerWra pper(getActivity()); 60 final TestInputMethodManagerWrapper immw = new TestInputMethodManagerWra pper(getActivity());
62 contentViewCore.getImeAdapterForTest().setInputMethodManagerWrapperForTe st(immw); 61 contentViewCore.getImeAdapterForTest().setInputMethodManagerWrapperForTe st(immw);
63 62
64 immw.showSoftInput(view, 0, null); 63 immw.showSoftInput(view, 0, null);
65 assertFalse(immw.isHidden()); 64 assertFalse(immw.isHidden());
66 65
67 final EditText urlBox = (EditText) getActivity().findViewById(R.id.url); 66 final EditText urlBox = (EditText) getActivity().findViewById(R.id.url);
68 67
69 assertTrue(urlBox.requestFocus()); 68 assertTrue(urlBox.requestFocus());
70 69
71 // Now another view has taken focus. The original view loses its focus 70 // When another view (URL box) takes focus, we do not hide the IME windo w.
72 // and the input method window should be hidden 71 assertFalse(immw.isHidden());
Changwan Ryu 2016/10/19 05:10:21 Hmm... This test depends on the real behavior of t
yabinh 2016/10/24 01:40:57 Done.
73 assertTrue(immw.isHidden());
74 } 72 }
75 } 73 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698