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

Unified Diff: services/ui/ime/test_ime_driver/test_ime_driver.cc

Issue 2230393002: IME for Mus: Make InputMethodMus use the IME Mojo API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modify unittests to cover non-char events. Created 4 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
Index: services/ui/ime/test_ime_driver/test_ime_driver.cc
diff --git a/services/ui/ime/test_ime_driver/test_ime_driver.cc b/services/ui/ime/test_ime_driver/test_ime_driver.cc
index 370ea5f422c3395a6ec006276d976e40bcda466a..dbf01ef0f9f4b541fb03884df036637990429f4f 100644
--- a/services/ui/ime/test_ime_driver/test_ime_driver.cc
+++ b/services/ui/ime/test_ime_driver/test_ime_driver.cc
@@ -22,12 +22,16 @@ class TestInputMethod : public mojom::InputMethod {
void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override {}
void ProcessKeyEvent(std::unique_ptr<Event> key_event) override {
DCHECK(key_event->IsKeyEvent());
- mojom::CompositionEventPtr composition_event =
- mojom::CompositionEvent::New();
- composition_event->type = mojom::CompositionEventType::INSERT_CHAR;
- composition_event->key_event = std::move(key_event);
- client_->OnCompositionEvent(std::move(composition_event));
+ if (key_event->AsKeyEvent()->is_char()) {
+ mojom::CompositionEventPtr composition_event =
+ mojom::CompositionEvent::New();
+ composition_event->type = mojom::CompositionEventType::INSERT_CHAR;
+ composition_event->key_event = std::move(key_event);
+ client_->OnCompositionEvent(std::move(composition_event));
+ } else {
+ client_->OnUnhandledEvent(std::move(key_event));
+ }
};
void CancelComposition() override {}

Powered by Google App Engine
This is Rietveld 408576698