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

Unified Diff: ui/wm/core/input_method_event_filter_unittest.cc

Issue 248773002: aura: A couple of API cleanups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 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/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | ui/wm/test/wm_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/input_method_event_filter_unittest.cc
diff --git a/ui/wm/core/input_method_event_filter_unittest.cc b/ui/wm/core/input_method_event_filter_unittest.cc
index 038ec00993e8e1ee0c713aeacab3c639803af3fa..6fc1b393fb5329b08cfb1c71f07bc833376c11d1 100644
--- a/ui/wm/core/input_method_event_filter_unittest.cc
+++ b/ui/wm/core/input_method_event_filter_unittest.cc
@@ -27,35 +27,36 @@ namespace wm {
typedef aura::test::AuraTestBase InputMethodEventFilterTest;
TEST_F(InputMethodEventFilterTest, TestInputMethodProperty) {
- CompoundEventFilter* root_filter = new CompoundEventFilter;
- root_window()->SetEventFilter(root_filter);
+ CompoundEventFilter root_filter;
+ root_window()->AddPreTargetHandler(&root_filter);
InputMethodEventFilter input_method_event_filter(
host()->GetAcceleratedWidget());
- root_filter->AddHandler(&input_method_event_filter);
+ root_filter.AddHandler(&input_method_event_filter);
// Tests if InputMethodEventFilter adds a window property on its
// construction.
EXPECT_TRUE(root_window()->GetProperty(
aura::client::kRootWindowInputMethodKey));
- root_filter->RemoveHandler(&input_method_event_filter);
+ root_filter.RemoveHandler(&input_method_event_filter);
+ root_window()->RemovePreTargetHandler(&root_filter);
}
// Tests if InputMethodEventFilter dispatches a ui::ET_TRANSLATED_KEY_* event to
// the root window.
TEST_F(InputMethodEventFilterTest, TestInputMethodKeyEventPropagation) {
- CompoundEventFilter* root_filter = new CompoundEventFilter;
- root_window()->SetEventFilter(root_filter);
+ CompoundEventFilter root_filter;
+ root_window()->AddPreTargetHandler(&root_filter);
// Add the InputMethodEventFilter before the TestEventFilter.
InputMethodEventFilter input_method_event_filter(
host()->GetAcceleratedWidget());
- root_filter->AddHandler(&input_method_event_filter);
+ root_filter.AddHandler(&input_method_event_filter);
// Add TestEventFilter to the RootWindow.
ui::test::TestEventHandler test_filter;
- root_filter->AddHandler(&test_filter);
+ root_filter.AddHandler(&test_filter);
// We need an active window. Otherwise, the root window will not forward a key
// event to event filters.
@@ -79,11 +80,12 @@ TEST_F(InputMethodEventFilterTest, TestInputMethodKeyEventPropagation) {
generator.ReleaseKey(ui::VKEY_SPACE, 0);
EXPECT_EQ(2, test_filter.num_key_events());
- root_filter->RemoveHandler(&input_method_event_filter);
- root_filter->RemoveHandler(&test_filter);
+ root_filter.RemoveHandler(&input_method_event_filter);
+ root_filter.RemoveHandler(&test_filter);
// Reset window before |test_delegate| gets deleted.
window.reset();
+ root_window()->RemovePreTargetHandler(&root_filter);
}
} // namespace wm
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | ui/wm/test/wm_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698