OLD | NEW |
---|---|
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 Loading... | |
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 testHideImeOnLosingFocus() throws Throwable { |
Changwan Ryu
2016/09/09 01:07:29
testDoNotHideImeOnLosingFocus
yabinh
2016/10/18 08:57:49
Done.
| |
55 // Test the IME window is hidden from the content view when the content | 55 // Test the IME window is hidden from the content view when the content |
56 // view loses its focus | 56 // view loses its focus |
Changwan Ryu
2016/09/09 01:07:29
Tests that the IME window does not get hidden when
yabinh
2016/10/18 08:57:49
Done.
| |
57 final ContentViewCore contentViewCore = getContentViewCore(); | 57 final ContentViewCore contentViewCore = getContentViewCore(); |
58 final View view = contentViewCore.getContainerView(); | 58 final View view = contentViewCore.getContainerView(); |
59 assertTrue(view.requestFocus()); | 59 assertTrue(view.requestFocus()); |
60 | 60 |
61 final TestInputMethodManagerWrapper immw = new TestInputMethodManagerWra pper(getActivity()); | 61 final TestInputMethodManagerWrapper immw = new TestInputMethodManagerWra pper(getActivity()); |
62 contentViewCore.getImeAdapterForTest().setInputMethodManagerWrapperForTe st(immw); | 62 contentViewCore.getImeAdapterForTest().setInputMethodManagerWrapperForTe st(immw); |
63 | 63 |
64 immw.showSoftInput(view, 0, null); | 64 immw.showSoftInput(view, 0, null); |
65 assertFalse(immw.isHidden()); | 65 assertFalse(immw.isHidden()); |
66 | 66 |
67 final EditText urlBox = (EditText) getActivity().findViewById(R.id.url); | 67 final EditText urlBox = (EditText) getActivity().findViewById(R.id.url); |
68 | 68 |
69 assertTrue(urlBox.requestFocus()); | 69 assertTrue(urlBox.requestFocus()); |
70 | 70 |
71 // Now another view has taken focus. The original view loses its focus | 71 // Now another view has taken focus. The original view loses its focus |
72 // and the input method window should be hidden | 72 // and the input method window should be hidden |
Changwan Ryu
2016/09/09 01:07:29
When another view (URL box) takes focus, we do not
yabinh
2016/10/18 08:57:49
Done.
| |
73 assertTrue(immw.isHidden()); | 73 assertFalse(immw.isHidden()); |
74 } | 74 } |
75 } | 75 } |
OLD | NEW |