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

Unified Diff: ash/root_window_controller_unittest.cc

Issue 216743004: Prevent system modal dialog from blocking events to the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move VK window test to root window controller. Created 6 years, 9 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/root_window_controller.cc ('k') | ash/shell.cc » ('j') | ash/shell.cc » ('J')
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 67a70ee2c0cdad7a4d93aa628bfab2c4220b5fdd..31b68f9e92225c969fe556985744087863e686ca 100644
--- a/ash/root_window_controller_unittest.cc
+++ b/ash/root_window_controller_unittest.cc
@@ -606,7 +606,8 @@ TEST_F(NoSessionRootWindowControllerTest, Event) {
gfx::Point(size.width() - 1, size.height() - 1)));
}
-class VirtualKeyboardRootWindowControllerTest : public test::AshTestBase {
+class VirtualKeyboardRootWindowControllerTest : public RootWindowControllerTest
+{
public:
VirtualKeyboardRootWindowControllerTest() {};
virtual ~VirtualKeyboardRootWindowControllerTest() {};
@@ -728,5 +729,46 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) {
EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before);
}
+// Ensure that system modal dialogs do not block events targeted at the virtual
+// keyboard.
+TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) {
+ aura::Window* root_window = Shell::GetPrimaryRootWindow();
+ aura::Window* keyboard_container = Shell::GetContainer(root_window,
+ internal::kShellWindowId_VirtualKeyboardContainer);
+ ASSERT_TRUE(keyboard_container);
+ keyboard_container->Show();
+
+ aura::Window* keyboard_window = Shell::GetInstance()->keyboard_controller()->
+ proxy()->GetKeyboardWindow();
+ keyboard_container->AddChild(keyboard_window);
+ keyboard_window->set_owned_by_parent(false);
+ keyboard_window->SetBounds(gfx::Rect());
+ keyboard_window->Show();
+
+ ui::test::TestEventHandler* handler = new ui::test::TestEventHandler;
+ root_window->SetEventFilter(handler);
+ aura::test::EventGenerator root_window_event_generator(root_window);
+ aura::test::EventGenerator keyboard_event_generator(root_window,
+ keyboard_window);
+
+ views::Widget* modal_widget =
+ CreateModalWidget(gfx::Rect(300, 10, 100, 100));
+
+ // 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());
+
+ // Verify that event dispatch to the virtual keyboard is unblocked.
+ keyboard_event_generator.ClickLeftButton();
+ 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);
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shell.cc » ('j') | ash/shell.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698