summaryrefslogtreecommitdiffstats
path: root/ash/wm/window_manager_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ash/wm/window_manager_unittest.cc')
-rw-r--r--ash/wm/window_manager_unittest.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index 2fd6e67..e12c9db 100644
--- a/ash/wm/window_manager_unittest.cc
+++ b/ash/wm/window_manager_unittest.cc
@@ -347,6 +347,44 @@ TEST_F(WindowManagerTest, ActivateOnMouse) {
}
}
+TEST_F(WindowManagerTest, PanelActivation) {
+ aura::test::TestWindowDelegate wd;
+ scoped_ptr<aura::Window> w1(CreateTestWindowInShellWithDelegate(
+ &wd, -1, gfx::Rect(10, 10, 50, 50)));
+ aura::test::TestWindowDelegate pd;
+ scoped_ptr<aura::Window> p1(CreateTestWindowInShellWithDelegateAndType(
+ &pd, aura::client::WINDOW_TYPE_PANEL, -1, gfx::Rect(10, 10, 50, 50)));
+ aura::client::FocusClient* focus_client =
+ aura::client::GetFocusClient(w1.get());
+
+ // Activate w1.
+ wm::ActivateWindow(w1.get());
+ EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
+
+ // Activate p1.
+ wm::ActivateWindow(p1.get());
+ EXPECT_TRUE(wm::IsActiveWindow(p1.get()));
+ EXPECT_EQ(p1.get(), focus_client->GetFocusedWindow());
+
+ // Activate w1.
+ wm::ActivateWindow(w1.get());
+ EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
+ EXPECT_EQ(w1.get(), focus_client->GetFocusedWindow());
+
+ // Clicking on a non-activatable window should not change the active window.
+ {
+ NonFocusableDelegate nfd;
+ scoped_ptr<aura::Window> w3(CreateTestWindowInShellWithDelegate(
+ &nfd, -1, gfx::Rect(70, 70, 50, 50)));
+ aura::test::EventGenerator generator3(Shell::GetPrimaryRootWindow(),
+ w3.get());
+ wm::ActivateWindow(p1.get());
+ EXPECT_TRUE(wm::IsActiveWindow(p1.get()));
+ generator3.ClickLeftButton();
+ EXPECT_TRUE(wm::IsActiveWindow(p1.get()));
+ }
+}
+
// Essentially the same as ActivateOnMouse, but for touch events.
TEST_F(WindowManagerTest, ActivateOnTouch) {
aura::RootWindow* root_window = Shell::GetPrimaryRootWindow();