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

Unified Diff: ash/root_window_controller_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 | « ash/first_run/first_run_helper_unittest.cc ('k') | ui/aura/window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/root_window_controller_unittest.cc
diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc
index 69aad6b7d4f9f9b1520813933fdf2611e598bb62..5531693fbe03090ad1c2e63bce9783e6aae8d9af 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -653,13 +653,13 @@ TEST_F(VirtualKeyboardRootWindowControllerTest,
keyboard_window->SetBounds(gfx::Rect());
keyboard_window->Show();
- ui::test::TestEventHandler* handler = new ui::test::TestEventHandler;
- root_window->SetEventFilter(handler);
+ ui::test::TestEventHandler handler;
+ root_window->AddPreTargetHandler(&handler);
aura::test::EventGenerator event_generator(root_window, keyboard_window);
event_generator.ClickLeftButton();
int expected_mouse_presses = 1;
- EXPECT_EQ(expected_mouse_presses, handler->num_mouse_events() / 2);
+ EXPECT_EQ(expected_mouse_presses, handler.num_mouse_events() / 2);
for (int block_reason = FIRST_BLOCK_REASON;
block_reason < NUMBER_OF_BLOCK_REASONS;
@@ -667,9 +667,10 @@ TEST_F(VirtualKeyboardRootWindowControllerTest,
BlockUserSession(static_cast<UserSessionBlockReason>(block_reason));
event_generator.ClickLeftButton();
expected_mouse_presses++;
- EXPECT_EQ(expected_mouse_presses, handler->num_mouse_events() / 2);
+ EXPECT_EQ(expected_mouse_presses, handler.num_mouse_events() / 2);
UnblockUserSession();
}
+ root_window->RemovePreTargetHandler(&handler);
}
// Test for http://crbug.com/299787. RootWindowController should delete
@@ -734,8 +735,8 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) {
keyboard_window->SetBounds(gfx::Rect());
keyboard_window->Show();
- ui::test::TestEventHandler* handler = new ui::test::TestEventHandler;
- root_window->SetEventFilter(handler);
+ ui::test::TestEventHandler handler;
+ root_window->AddPreTargetHandler(&handler);
aura::test::EventGenerator root_window_event_generator(root_window);
aura::test::EventGenerator keyboard_event_generator(root_window,
keyboard_window);
@@ -746,17 +747,18 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) {
// Verify that mouse events to the root window are block with a visble modal
// dialog.
root_window_event_generator.ClickLeftButton();
- EXPECT_EQ(0, handler->num_mouse_events());
+ EXPECT_EQ(0, handler.num_mouse_events());
// Verify that event dispatch to the virtual keyboard is unblocked.
keyboard_event_generator.ClickLeftButton();
- EXPECT_EQ(1, handler->num_mouse_events() / 2);
+ EXPECT_EQ(1, handler.num_mouse_events() / 2);
modal_widget->Close();
// Verify that mouse events are now unblocked to the root window.
root_window_event_generator.ClickLeftButton();
- EXPECT_EQ(2, handler->num_mouse_events() / 2);
+ EXPECT_EQ(2, handler.num_mouse_events() / 2);
+ root_window->RemovePreTargetHandler(&handler);
}
} // namespace test
« no previous file with comments | « ash/first_run/first_run_helper_unittest.cc ('k') | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698