From e415404c3c07b8f58290e41902415c0bf8bd4d08 Mon Sep 17 00:00:00 2001 From: yoshiki Date: Mon, 10 Nov 2014 16:57:19 -0800 Subject: [Athena] Add a test of focus transition from modal window BUG=431729 Review URL: https://codereview.chromium.org/716493002 Cr-Commit-Position: refs/heads/master@{#303554} --- athena/screen/screen_manager_unittest.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/athena/screen/screen_manager_unittest.cc b/athena/screen/screen_manager_unittest.cc index 15588d3..5fcbb3c 100644 --- a/athena/screen/screen_manager_unittest.cc +++ b/athena/screen/screen_manager_unittest.cc @@ -249,6 +249,38 @@ TEST_F(AthenaFocusRuleTest, FocusTravarsalFromEventBlockedContainer) { EXPECT_TRUE(wm::IsActiveWindow(w1.get())); } +TEST_F(AthenaFocusRuleTest, FocusTravarsalFromModalWindow) { + ScreenManagerImpl* screen_manager = + static_cast(ScreenManager::Get()); + + ScreenManager::ContainerParams params1("contaier1", kTestZOrderPriority + 1); + params1.can_activate_children = true; + scoped_ptr + container1(ScreenManager::Get()->CreateContainer(params1)); + + scoped_ptr normal(CreateWindow( + container1.get(), nullptr, gfx::Rect(0, 0, 100, 100))); + wm::ActivateWindow(normal.get()); + EXPECT_TRUE(wm::IsActiveWindow(normal.get())); + + aura::test::EventCountDelegate delegate; + scoped_ptr modal(test::CreateTransientWindow( + &delegate, nullptr, ui::MODAL_TYPE_SYSTEM, false)); + + aura::Window* modal_container = + screen_manager->FindContainerByPriority(CP_SYSTEM_MODAL); + EXPECT_TRUE(modal_container); + + modal->Show(); + wm::ActivateWindow(modal.get()); + EXPECT_TRUE(wm::IsActiveWindow(modal.get())); + EXPECT_FALSE(wm::IsActiveWindow(normal.get())); + + // Closes the modal window and confirms the normal window gets the focus. + modal.reset(); + EXPECT_TRUE(wm::IsActiveWindow(normal.get())); +} + namespace { class ScreenManagerTargeterTest -- cgit v1.1