OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.input; | 5 package org.chromium.content.browser.input; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.content.ClipData; | 8 import android.content.ClipData; |
9 import android.content.ClipboardManager; | 9 import android.content.ClipboardManager; |
10 import android.content.Context; | 10 import android.content.Context; |
(...skipping 27 matching lines...) Expand all Loading... |
38 import java.util.concurrent.Callable; | 38 import java.util.concurrent.Callable; |
39 import java.util.concurrent.ExecutionException; | 39 import java.util.concurrent.ExecutionException; |
40 import java.util.concurrent.TimeoutException; | 40 import java.util.concurrent.TimeoutException; |
41 | 41 |
42 /** | 42 /** |
43 * Integration tests for text input using cases based on fixed regressions. | 43 * Integration tests for text input using cases based on fixed regressions. |
44 */ | 44 */ |
45 public class ImeTest extends ContentShellTestBase { | 45 public class ImeTest extends ContentShellTestBase { |
46 private static final String DATA_URL = UrlUtils.encodeHtmlDataUri( | 46 private static final String DATA_URL = UrlUtils.encodeHtmlDataUri( |
47 "<html><head><meta name=\"viewport\"" | 47 "<html><head><meta name=\"viewport\"" |
48 + "content=\"width=device-width, initial-scale=2.0, maximum-scale=2.
0\" /></head>" | 48 + "content=\"width=device-width\" /></head>" |
49 + "<body><form action=\"about:blank\">" | 49 + "<body><form action=\"about:blank\">" |
50 + "<input id=\"input_text\" type=\"text\" /><br/></form><form>" | 50 + "<input id=\"input_text\" type=\"text\" /><br/></form><form>" |
51 + "<input id=\"input_radio\" type=\"radio\" style=\"width:50px;heigh
t:50px\" />" | 51 + "<br/><input id=\"input_radio\" type=\"radio\" style=\"width:50px;
height:50px\" />" |
52 + "<br/><textarea id=\"textarea\" rows=\"4\" cols=\"20\"></textarea>
" | 52 + "<br/><textarea id=\"textarea\" rows=\"4\" cols=\"20\"></textarea>
" |
53 + "<br/><textarea id=\"textarea2\" rows=\"4\" cols=\"20\" autocomple
te=\"off\">" | 53 + "<br/><textarea id=\"textarea2\" rows=\"4\" cols=\"20\" autocomple
te=\"off\">" |
54 + "</textarea>" | 54 + "</textarea>" |
55 + "<br/><input id=\"input_number1\" type=\"number\" /><br/>" | 55 + "<br/><input id=\"input_number1\" type=\"number\" /><br/>" |
56 + "<br/><input id=\"input_number2\" type=\"number\" /><br/>" | 56 + "<br/><input id=\"input_number2\" type=\"number\" /><br/>" |
57 + "<br/><p><span id=\"plain_text\">This is Plain Text One</span></p>
" | 57 + "<br/><p><span id=\"plain_text\">This is Plain Text One</span></p>
" |
58 + "</form></body></html>"); | 58 + "</form></body></html>"); |
59 | 59 |
60 private TestAdapterInputConnection mConnection; | 60 private TestAdapterInputConnection mConnection; |
61 private TestAdapterInputConnectionFactory mConnectionFactory; | 61 private TestAdapterInputConnectionFactory mConnectionFactory; |
(...skipping 14 matching lines...) Expand all Loading... |
76 mWebContents = getWebContents(); | 76 mWebContents = getWebContents(); |
77 | 77 |
78 mInputMethodManagerWrapper = new TestInputMethodManagerWrapper(mContentV
iewCore); | 78 mInputMethodManagerWrapper = new TestInputMethodManagerWrapper(mContentV
iewCore); |
79 getImeAdapter().setInputMethodManagerWrapperForTest(mInputMethodManagerW
rapper); | 79 getImeAdapter().setInputMethodManagerWrapperForTest(mInputMethodManagerW
rapper); |
80 assertEquals(0, mInputMethodManagerWrapper.getShowSoftInputCounter()); | 80 assertEquals(0, mInputMethodManagerWrapper.getShowSoftInputCounter()); |
81 mConnectionFactory = new TestAdapterInputConnectionFactory(); | 81 mConnectionFactory = new TestAdapterInputConnectionFactory(); |
82 mContentViewCore.setAdapterInputConnectionFactory(mConnectionFactory); | 82 mContentViewCore.setAdapterInputConnectionFactory(mConnectionFactory); |
83 | 83 |
84 mCallbackContainer = new TestCallbackHelperContainer(mContentViewCore); | 84 mCallbackContainer = new TestCallbackHelperContainer(mContentViewCore); |
85 // TODO(aurimas) remove this wait once crbug.com/179511 is fixed. | 85 // TODO(aurimas) remove this wait once crbug.com/179511 is fixed. |
86 assertWaitForPageScaleFactorMatch(2); | 86 assertWaitForPageScaleFactorMatch(1); |
87 assertTrue(DOMUtils.waitForNonZeroNodeBounds( | 87 assertTrue(DOMUtils.waitForNonZeroNodeBounds( |
88 mWebContents, "input_text")); | 88 mWebContents, "input_text")); |
89 DOMUtils.clickNode(this, mContentViewCore, "input_text"); | 89 DOMUtils.clickNode(this, mContentViewCore, "input_text"); |
90 assertWaitForKeyboardStatus(true); | 90 assertWaitForKeyboardStatus(true); |
91 | 91 |
92 mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); | 92 mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |
93 mImeAdapter = getImeAdapter(); | 93 mImeAdapter = getImeAdapter(); |
94 | 94 |
95 waitAndVerifyStatesAndCalls(0, "", 0, 0, -1, -1); | 95 waitAndVerifyStatesAndCalls(0, "", 0, 0, -1, -1); |
96 waitForKeyboardStates(1, 0, 1, new Integer[] {TextInputType.TEXT}); | 96 waitForKeyboardStates(1, 0, 1, new Integer[] {TextInputType.TEXT}); |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1265 public void assertEqualState(String text, int selectionStart, int select
ionEnd, | 1265 public void assertEqualState(String text, int selectionStart, int select
ionEnd, |
1266 int compositionStart, int compositionEnd) { | 1266 int compositionStart, int compositionEnd) { |
1267 assertEquals("Text did not match", text, mText); | 1267 assertEquals("Text did not match", text, mText); |
1268 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); | 1268 assertEquals("Selection start did not match", selectionStart, mSelec
tionStart); |
1269 assertEquals("Selection end did not match", selectionEnd, mSelection
End); | 1269 assertEquals("Selection end did not match", selectionEnd, mSelection
End); |
1270 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); | 1270 assertEquals("Composition start did not match", compositionStart, mC
ompositionStart); |
1271 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); | 1271 assertEquals("Composition end did not match", compositionEnd, mCompo
sitionEnd); |
1272 } | 1272 } |
1273 } | 1273 } |
1274 } | 1274 } |
OLD | NEW |