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

Unified Diff: ash/wm/window_manager_unittest.cc

Issue 14298013: Check focusability in WindowFocusedFromInputEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update FocusController tests Created 7 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 | « no previous file | ui/views/corewm/focus_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_manager_unittest.cc
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index 2fd6e678730ef8fcf58047c2c1cdcd260eddb45d..e12c9db82e82c6be409c1dc29032bc686769de84 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();
« no previous file with comments | « no previous file | ui/views/corewm/focus_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698