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

Unified Diff: ui/base/ime/input_method_chromeos_unittest.cc

Issue 1209913002: InputMethod should stop TextInputClient::InsertChar/InsertText calls when the event is stopped prop… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 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 | « ui/base/ime/input_method_chromeos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/ime/input_method_chromeos_unittest.cc
diff --git a/ui/base/ime/input_method_chromeos_unittest.cc b/ui/base/ime/input_method_chromeos_unittest.cc
index 8593924de338a442881be5f2b04b04045720cda0..e9d4b85035630e78b9ed87dbc4f8c94a0b105ac8 100644
--- a/ui/base/ime/input_method_chromeos_unittest.cc
+++ b/ui/base/ime/input_method_chromeos_unittest.cc
@@ -198,7 +198,8 @@ class InputMethodChromeOSTest : public internal::InputMethodDelegate,
public DummyTextInputClient {
public:
InputMethodChromeOSTest()
- : dispatched_key_event_(ui::ET_UNKNOWN, ui::VKEY_UNKNOWN, ui::EF_NONE) {
+ : dispatched_key_event_(ui::ET_UNKNOWN, ui::VKEY_UNKNOWN, ui::EF_NONE),
+ stop_propagation_post_ime(false) {
ResetFlags();
}
@@ -237,7 +238,7 @@ class InputMethodChromeOSTest : public internal::InputMethodDelegate,
// Overridden from ui::internal::InputMethodDelegate:
bool DispatchKeyEventPostIME(const ui::KeyEvent& event) override {
dispatched_key_event_ = event;
- return false;
+ return stop_propagation_post_ime;
}
// Overridden from ui::TextInputClient:
@@ -329,6 +330,8 @@ class InputMethodChromeOSTest : public internal::InputMethodDelegate,
scoped_ptr<chromeos::MockIMECandidateWindowHandler>
mock_ime_candidate_window_handler_;
+ bool stop_propagation_post_ime;
yukawa 2015/06/26 06:30:23 nit: bool stop_propagation_post_ime_;
Shu Chen 2015/06/26 06:37:41 Done.
+
DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOSTest);
};
@@ -981,6 +984,31 @@ TEST_F(InputMethodChromeOSKeyEventTest, MultiKeyEventDelayResponseTest) {
EXPECT_EQ(L'C', inserted_char_);
}
-// TODO(nona): Introduce ProcessKeyEventPostIME tests(crbug.com/156593).
+TEST_F(InputMethodChromeOSKeyEventTest, StopPropagationTest) {
+ // Preparation
+ input_type_ = TEXT_INPUT_TYPE_TEXT;
+ ime_->OnTextInputTypeChanged(this);
+
+ // Do key event with event being stopped propagation.
+ stop_propagation_post_ime = true;
+ ui::KeyEvent eventA(ui::ET_KEY_PRESSED, ui::VKEY_A, EF_NONE);
+ eventA.set_character(L'A');
+ ime_->DispatchKeyEvent(eventA);
+ mock_ime_engine_handler_->last_passed_callback().Run(false);
+
+ const ui::KeyEvent* key_event =
+ mock_ime_engine_handler_->last_processed_key_event();
+ EXPECT_EQ(ui::VKEY_A, key_event->key_code());
+ EXPECT_EQ(0, inserted_char_);
+
+ // Do key event with event not being stopped propagation.
+ stop_propagation_post_ime = false;
+ ime_->DispatchKeyEvent(eventA);
+ mock_ime_engine_handler_->last_passed_callback().Run(false);
+
+ key_event = mock_ime_engine_handler_->last_processed_key_event();
+ EXPECT_EQ(ui::VKEY_A, key_event->key_code());
+ EXPECT_EQ(L'A', inserted_char_);
+}
} // namespace ui
« no previous file with comments | « ui/base/ime/input_method_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698