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

Unified Diff: ash/wm/window_manager_unittest.cc

Issue 2872343003: Remove InputMethodEventHandler. (Closed)
Patch Set: Add a unittest. Created 3 years, 7 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: ash/wm/window_manager_unittest.cc
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index 4183276bb7c56abf67489b93cdf366ca4967067e..86f06320cdd7c86db377366ff64c3292e383ceda 100644
--- a/ash/wm/window_manager_unittest.cc
+++ b/ash/wm/window_manager_unittest.cc
@@ -111,8 +111,8 @@ class HitTestWindowDelegate : public aura::test::TestWindowDelegate {
TEST_F(WindowManagerTest, Focus) {
// The IME event filter interferes with the basic key event propagation we
// attempt to do here, so we disable it.
- //
- DisableIME();
+ const bool kSkipIME = true;
+
aura::Window* root_window = Shell::GetPrimaryRootWindow();
root_window->SetBounds(gfx::Rect(0, 0, 510, 510));
@@ -156,6 +156,7 @@ TEST_F(WindowManagerTest, Focus) {
// The key press should be sent to the focused sub-window.
ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
+ keyev.set_skip_ime(kSkipIME);
ui::EventDispatchDetails details = sink->OnEventFromSource(&keyev);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code());
@@ -173,6 +174,7 @@ TEST_F(WindowManagerTest, Focus) {
// The key press should be sent to the focused sub-window.
keyev = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
+ keyev.set_skip_ime(kSkipIME);
details = sink->OnEventFromSource(&keyev);
ASSERT_FALSE(details.dispatcher_destroyed);
EXPECT_EQ(ui::VKEY_E, w122delegate->last_key_code());
@@ -212,6 +214,7 @@ TEST_F(WindowManagerTest, Focus) {
aura::client::GetFocusClient(w123.get()));
EXPECT_EQ(NULL, aura::client::GetFocusClient(w12.get())->GetFocusedWindow());
keyev = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
+ keyev.set_skip_ime(kSkipIME);
details = sink->OnEventFromSource(&keyev);
EXPECT_FALSE(keyev.handled() || details.dispatcher_destroyed);
@@ -228,6 +231,7 @@ TEST_F(WindowManagerTest, Focus) {
w12->RemoveChild(w123.get());
EXPECT_EQ(NULL, aura::client::GetFocusClient(w123.get()));
keyev = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_E, ui::EF_NONE);
+ keyev.set_skip_ime(kSkipIME);
details = sink->OnEventFromSource(&keyev);
EXPECT_FALSE(keyev.handled() || details.dispatcher_destroyed);
@@ -674,7 +678,8 @@ TEST_F(WindowManagerTest, TransformActivate) {
TEST_F(WindowManagerTest, AdditionalFilters) {
// The IME event filter interferes with the basic key event propagation we
// attempt to do here, so we disable it.
- DisableIME();
+ const bool kSkipIME = true;
+
aura::Window* root_window = Shell::GetPrimaryRootWindow();
// Creates a window and make it active
@@ -693,6 +698,7 @@ TEST_F(WindowManagerTest, AdditionalFilters) {
// Dispatches mouse and keyboard events.
ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
+ key_event.set_skip_ime(kSkipIME);
ui::EventSink* sink = root_window->GetHost()->event_sink();
ui::EventDispatchDetails details = sink->OnEventFromSource(&key_event);
ASSERT_FALSE(details.dispatcher_destroyed);

Powered by Google App Engine
This is Rietveld 408576698