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

Unified Diff: content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc

Issue 1811553002: [Android] Synthetic composition event should have DomKey 'Unidentified' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
Index: content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc
diff --git a/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc b/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc
index 586ea75589dd546770ce0bcba0879538280e5c13..32acccf5f5c46e2deadcd66f69ff8e68f9c2e15d 100644
--- a/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc
+++ b/content/browser/renderer_host/input/web_input_event_builders_android_unittest.cc
@@ -23,6 +23,7 @@ namespace {
const int kCombiningAccent = 0x80000000;
const int kCombiningAccentMask = 0x7fffffff;
+const int kCompositionKeyCode = 229;
WebKeyboardEvent CreateFakeWebKeyboardEvent(JNIEnv* env,
int key_code,
@@ -139,3 +140,14 @@ TEST(WebInputEventBuilderAndroidTest, DomKeyCtrlAlt) {
<< ui::KeycodeConverter::DomKeyToKeyString(web_event.domKey);
}
}
+
+TEST(WebInputEventBuilderAndroidTest, DomKeySyntheticKeyEvent) {
+ JNIEnv* env = AttachCurrentThread();
+
+ // Simulating ImeAdapter.java::sendCompositionToNative(), send
+ // COMPOSITION_KEY_CODE for synthetic key events.
+ WebKeyboardEvent web_event =
+ CreateFakeWebKeyboardEvent(env, kCompositionKeyCode, 0, 0);
+ EXPECT_EQ(kCompositionKeyCode, web_event.nativeKeyCode);
+ EXPECT_EQ(ui::DomKey::UNIDENTIFIED, web_event.domKey);
+}

Powered by Google App Engine
This is Rietveld 408576698