| 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
|
|
|