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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java

Issue 518123002: Always guard against IME events for all KeyPress. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | content/renderer/render_widget.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
index c6e54ba4483752467c153bbec2880e064ccc95e3..82d59130451a8812a51b52c8efbe5b8252ffd553 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java
@@ -462,11 +462,50 @@ public class ImeTest extends ContentShellTestBase {
@SmallTest
@Feature({"TextInput", "Main"})
+ public void testKeyCodesWhileSwipingText() throws Throwable {
+ DOMUtils.focusNode(mContentViewCore, "textarea");
+ assertWaitForKeyboardStatus(true);
+
+ // The calls below are a reflection of what the stock Google Keyboard (Android 4.4) sends
+ // when the word is swiped on the soft keyboard. Exercise care when altering to make sure
+ // that the test reflects reality. If this test breaks, it's possible that code has
+ // changed and different calls need to be made instead.
+ mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
+ waitAndVerifyEditableCallback(mConnection.mImeUpdateQueue, 0, "", 0, 0, -1, -1);
+
+ // three
+ expectUpdateStateCall(mConnection);
+ setComposingText(mConnection, "three", 1);
+ assertEquals(KeyEvent.KEYCODE_UNKNOWN, mImeAdapter.mLastSyntheticKeyCode);
+ assertUpdateStateCall(mConnection, 1000);
+ assertEquals("three", mConnection.getTextBeforeCursor(99, 0));
+
+ // word
+ commitText(mConnection, "three", 1);
+ commitText(mConnection, " ", 1);
+ expectUpdateStateCall(mConnection);
+ setComposingText(mConnection, "word", 1);
+ assertEquals(KeyEvent.KEYCODE_UNKNOWN, mImeAdapter.mLastSyntheticKeyCode);
+ assertUpdateStateCall(mConnection, 1000);
+ assertEquals("three word", mConnection.getTextBeforeCursor(99, 0));
+
+ // test
+ commitText(mConnection, "word", 1);
+ commitText(mConnection, " ", 1);
+ expectUpdateStateCall(mConnection);
+ setComposingText(mConnection, "test", 1);
+ assertEquals(KeyEvent.KEYCODE_UNKNOWN, mImeAdapter.mLastSyntheticKeyCode);
+ assertUpdateStateCall(mConnection, 1000);
+ assertEquals("three word test", mConnection.getTextBeforeCursor(99, 0));
+ }
+
+ @SmallTest
+ @Feature({"TextInput", "Main"})
public void testKeyCodesWhileTypingText() throws Throwable {
DOMUtils.focusNode(mContentViewCore, "textarea");
assertWaitForKeyboardStatus(true);
- // The calls below are a reflection of what the Hacker's Keyboard sends when the noted
+ // The calls below are a reflection of what the Hacker's Keyboard sends when the noted
// key is touched on screen. Exercise care when altering to make sure that the test
// reflects reality.
mConnection = (TestAdapterInputConnection) getAdapterInputConnection();
« no previous file with comments | « no previous file | content/renderer/render_widget.cc » ('j') | content/renderer/render_widget.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698