Chromium Code Reviews| 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 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 private static final String DATA_URL = UrlUtils.encodeHtmlDataUri( | 41 private static final String DATA_URL = UrlUtils.encodeHtmlDataUri( |
| 42 "<html><head><meta name=\"viewport\"" | 42 "<html><head><meta name=\"viewport\"" |
| 43 + "content=\"width=device-width, initial-scale=2.0, maximum-scale=2. 0\" /></head>" | 43 + "content=\"width=device-width, initial-scale=2.0, maximum-scale=2. 0\" /></head>" |
| 44 + "<body><form action=\"about:blank\">" | 44 + "<body><form action=\"about:blank\">" |
| 45 + "<input id=\"input_text\" type=\"text\" /><br/>" | 45 + "<input id=\"input_text\" type=\"text\" /><br/>" |
| 46 + "<input id=\"input_radio\" type=\"radio\" style=\"width:50px;heigh t:50px\" />" | 46 + "<input id=\"input_radio\" type=\"radio\" style=\"width:50px;heigh t:50px\" />" |
| 47 + "<br/><textarea id=\"textarea\" rows=\"4\" cols=\"20\"></textarea> " | 47 + "<br/><textarea id=\"textarea\" rows=\"4\" cols=\"20\"></textarea> " |
| 48 + "<br/><p><span id=\"plain_text\">This is Plain Text One</span></p> " | 48 + "<br/><p><span id=\"plain_text\">This is Plain Text One</span></p> " |
| 49 + "</form></body></html>"); | 49 + "</form></body></html>"); |
| 50 private static final int COMPOSITION_KEY_CODE = 229; | |
| 50 | 51 |
| 51 private TestAdapterInputConnection mConnection; | 52 private TestAdapterInputConnection mConnection; |
| 52 private ImeAdapter mImeAdapter; | 53 private ImeAdapter mImeAdapter; |
| 53 | 54 |
| 54 private ContentViewCore mContentViewCore; | 55 private ContentViewCore mContentViewCore; |
| 55 private WebContents mWebContents; | 56 private WebContents mWebContents; |
| 56 private TestCallbackHelperContainer mCallbackContainer; | 57 private TestCallbackHelperContainer mCallbackContainer; |
| 57 private TestInputMethodManagerWrapper mInputMethodManagerWrapper; | 58 private TestInputMethodManagerWrapper mInputMethodManagerWrapper; |
| 58 | 59 |
| 59 @Override | 60 @Override |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 public void testTransitionsWhileComposingText() throws Throwable { | 703 public void testTransitionsWhileComposingText() throws Throwable { |
| 703 DOMUtils.focusNode(mWebContents, "textarea"); | 704 DOMUtils.focusNode(mWebContents, "textarea"); |
| 704 assertWaitForKeyboardStatus(true); | 705 assertWaitForKeyboardStatus(true); |
| 705 | 706 |
| 706 mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); | 707 mConnection = (TestAdapterInputConnection) getAdapterInputConnection(); |
| 707 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1); | 708 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1); |
| 708 | 709 |
| 709 // H | 710 // H |
| 710 expectUpdateStateCall(mConnection); | 711 expectUpdateStateCall(mConnection); |
| 711 setComposingText(mConnection, "h", 1); | 712 setComposingText(mConnection, "h", 1); |
| 712 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); | 713 assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode); |
|
bcwhite
2015/01/13 15:33:43
You should still test for KEYCODE_H but enable it
| |
| 713 | 714 |
| 714 // Simulate switch of input fields. | 715 // Simulate switch of input fields. |
| 715 finishComposingText(mConnection); | 716 finishComposingText(mConnection); |
| 716 | 717 |
| 717 // H | 718 // H |
| 718 expectUpdateStateCall(mConnection); | 719 expectUpdateStateCall(mConnection); |
| 719 setComposingText(mConnection, "h", 1); | 720 setComposingText(mConnection, "h", 1); |
| 720 assertEquals(KeyEvent.KEYCODE_H, mImeAdapter.mLastSyntheticKeyCode); | 721 assertEquals(COMPOSITION_KEY_CODE, mImeAdapter.mLastSyntheticKeyCode); |
| 721 } | 722 } |
| 722 | 723 |
| 723 @SmallTest | 724 @SmallTest |
| 724 @Feature({"TextInput"}) | 725 @Feature({"TextInput"}) |
| 725 public void testPastePopupShowOnLongPress() throws Throwable { | 726 public void testPastePopupShowOnLongPress() throws Throwable { |
| 726 commitText(mConnection, "hello", 1); | 727 commitText(mConnection, "hello", 1); |
| 727 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5 , 5, -1, -1); | 728 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 1, "hello", 5 , 5, -1, -1); |
| 728 | 729 |
| 729 selectAll(mImeAdapter); | 730 selectAll(mImeAdapter); |
| 730 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 0 , 5, -1, -1); | 731 waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 2, "hello", 0 , 5, -1, -1); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 public void assertEqualState(String text, int selectionStart, int select ionEnd, | 1012 public void assertEqualState(String text, int selectionStart, int select ionEnd, |
| 1012 int compositionStart, int compositionEnd) { | 1013 int compositionStart, int compositionEnd) { |
| 1013 assertEquals("Text did not match", text, mText); | 1014 assertEquals("Text did not match", text, mText); |
| 1014 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); | 1015 assertEquals("Selection start did not match", selectionStart, mSelec tionStart); |
| 1015 assertEquals("Selection end did not match", selectionEnd, mSelection End); | 1016 assertEquals("Selection end did not match", selectionEnd, mSelection End); |
| 1016 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); | 1017 assertEquals("Composition start did not match", compositionStart, mC ompositionStart); |
| 1017 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); | 1018 assertEquals("Composition end did not match", compositionEnd, mCompo sitionEnd); |
| 1018 } | 1019 } |
| 1019 } | 1020 } |
| 1020 } | 1021 } |
| OLD | NEW |