diff options
author | yoshiki <yoshiki@chromium.org> | 2014-11-10 16:57:19 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-11-11 00:58:18 +0000 |
commit | e415404c3c07b8f58290e41902415c0bf8bd4d08 (patch) | |
tree | c0a2ec1bdb2977f387703326662c7a6f2290459c | |
parent | 400b26297782e70ed15e40d83b876e3abde7b9cc (diff) | |
download | chromium_src-e415404c3c07b8f58290e41902415c0bf8bd4d08.zip chromium_src-e415404c3c07b8f58290e41902415c0bf8bd4d08.tar.gz chromium_src-e415404c3c07b8f58290e41902415c0bf8bd4d08.tar.bz2 |
[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}
-rw-r--r-- | athena/screen/screen_manager_unittest.cc | 32 |
1 files changed, 32 insertions, 0 deletions
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<ScreenManagerImpl*>(ScreenManager::Get()); + + ScreenManager::ContainerParams params1("contaier1", kTestZOrderPriority + 1); + params1.can_activate_children = true; + scoped_ptr<aura::Window> + container1(ScreenManager::Get()->CreateContainer(params1)); + + scoped_ptr<aura::Window> 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<aura::Window> 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 |