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

Unified Diff: ui/aura_shell/stacking_controller_unittest.cc

Issue 8536027: Add test to verify that the stacking controller picks the correct activatable window for menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 1 month 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 | « ui/aura/test/test_windows.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/stacking_controller_unittest.cc
diff --git a/ui/aura_shell/stacking_controller_unittest.cc b/ui/aura_shell/stacking_controller_unittest.cc
index cf4fdc7c3a4959180b38a8f865ea94bde78a4cc5..61e0efe0d1915ba1976038468f5469c6a03b3702 100644
--- a/ui/aura_shell/stacking_controller_unittest.cc
+++ b/ui/aura_shell/stacking_controller_unittest.cc
@@ -5,6 +5,7 @@
#include "ui/aura_shell/stacking_controller.h"
#include "ui/aura/desktop.h"
+#include "ui/aura/test/event_generator.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura_shell/test/aura_shell_test_base.h"
@@ -28,5 +29,31 @@ TEST_F(StackingControllerTest, GetTopmostWindowToActivate) {
GetTopmostWindowToActivate(NULL));
}
+// Test if the clicking on a menu picks the transient parent as activatable
+// window.
+TEST_F(StackingControllerTest, ClickOnMenu) {
+ aura::test::ActivateWindowDelegate activate;
+ aura::test::ActivateWindowDelegate non_activate(false);
+
+ scoped_ptr<aura::Window> w1(aura::test::CreateTestWindowWithDelegate(
+ &activate, 1, gfx::Rect(100, 100), NULL));
+ EXPECT_EQ(NULL, aura::Desktop::GetInstance()->active_window());
+
+ // Clicking on an activatable window activtes the window.
+ aura::test::EventGenerator generator(w1.get());
+ generator.ClickLeftButton();
+ EXPECT_EQ(w1.get(), aura::Desktop::GetInstance()->active_window());
+
+ // Creates a menu that covers the transient parent.
+ scoped_ptr<aura::Window> menu(aura::test::CreateTestWindowWithDelegateAndType(
+ &non_activate, aura::WINDOW_TYPE_MENU, 2, gfx::Rect(100, 100), NULL));
+ w1->AddTransientChild(menu.get());
+
+ // Clicking on a menu whose transient parent is active window shouldn't
+ // change the active window.
+ generator.ClickLeftButton();
+ EXPECT_EQ(w1.get(), aura::Desktop::GetInstance()->active_window());
+}
+
} // namespace test
} // namespace aura_shell
« no previous file with comments | « ui/aura/test/test_windows.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698