Index: ash/wm/panel_layout_manager_unittest.cc |
diff --git a/ash/wm/panel_layout_manager_unittest.cc b/ash/wm/panel_layout_manager_unittest.cc |
index 4ee864c816c23bbeb4fd884fae23a214bc8a8e33..e05e6624dc4b8199e06c94aa7c61f036f9a3650f 100644 |
--- a/ash/wm/panel_layout_manager_unittest.cc |
+++ b/ash/wm/panel_layout_manager_unittest.cc |
@@ -5,9 +5,11 @@ |
#include "ash/wm/panel_layout_manager.h" |
#include "ash/ash_switches.h" |
+#include "ash/launcher/launcher.h" |
#include "ash/shell.h" |
#include "ash/shell_window_ids.h" |
#include "ash/test/ash_test_base.h" |
+#include "ash/test/test_launcher_delegate.h" |
#include "base/basictypes.h" |
#include "base/command_line.h" |
#include "base/compiler_specific.h" |
@@ -24,6 +26,10 @@ views::Widget* CreatePanelWindow(const gfx::Rect& rect) { |
params.bounds = rect; |
views::Widget* widget = new views::Widget(); |
widget->Init(params); |
+ ash::test::TestLauncherDelegate* launcher_delegate = |
+ static_cast<ash::test::TestLauncherDelegate*>( |
+ Shell::GetInstance()->launcher()->delegate()); |
+ launcher_delegate->AddLauncherItem(widget->GetNativeWindow()); |
widget->Show(); |
return widget; |
} |
@@ -42,6 +48,13 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase { |
DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerTest); |
}; |
+void AssertPanelAboveLauncherIcon(views::Widget* panel) { |
+ Launcher* launcher = Shell::GetInstance()->launcher(); |
+ aura::Window* window = panel->GetNativeWindow(); |
+ gfx::Rect icon_rect = launcher->GetScreenBoundsOfItemIconForWindow(window); |
+ EXPECT_FALSE(icon_rect.IsEmpty()); |
+} |
+ |
} // namespace |
// Tests that a created panel window is successfully added to the panel |
@@ -50,21 +63,23 @@ TEST_F(PanelLayoutManagerTest, AddOnePanel) { |
gfx::Rect bounds(1, 1, 200, 200); |
views::Widget* w1 = CreatePanelWindow(bounds); |
EXPECT_EQ(GetPanelContainer(), w1->GetNativeWindow()->parent()); |
+ AssertPanelAboveLauncherIcon(w1); |
} |
// Tests that panels are ordered right-to-left. |
-TEST_F(PanelLayoutManagerTest, PanelOrderRightToLeft) { |
+TEST_F(PanelLayoutManagerTest, PanelAboveLauncherIcons) { |
if (!CommandLine::ForCurrentProcess()->HasSwitch( |
switches::kAuraPanelManager)) |
return; |
gfx::Rect bounds(1, 1, 200, 200); |
views::Widget* w1 = CreatePanelWindow(bounds); |
+ AssertPanelAboveLauncherIcon(w1); |
views::Widget* w2 = CreatePanelWindow(bounds); |
- EXPECT_LT(w2->GetWindowScreenBounds().x(), w1->GetWindowScreenBounds().x()); |
- |
+ AssertPanelAboveLauncherIcon(w2); |
views::Widget* w3 = CreatePanelWindow(bounds); |
- EXPECT_LT(w3->GetWindowScreenBounds().x(), w2->GetWindowScreenBounds().x()); |
- EXPECT_LT(w2->GetWindowScreenBounds().x(), w1->GetWindowScreenBounds().x()); |
+ AssertPanelAboveLauncherIcon(w3); |
+ AssertPanelAboveLauncherIcon(w1); |
+ AssertPanelAboveLauncherIcon(w2); |
} |
// Tests removing a panel. |
@@ -82,10 +97,8 @@ TEST_F(PanelLayoutManagerTest, RemovePanel) { |
GetPanelContainer()->RemoveChild(w2->GetNativeWindow()); |
- // Verify that w3 has moved. |
- EXPECT_NE(w3->GetWindowScreenBounds(), w3bounds); |
- // Verify that w3 is still left of w1. |
- EXPECT_LT(w3->GetWindowScreenBounds().x(), w1->GetWindowScreenBounds().x()); |
+ AssertPanelAboveLauncherIcon(w3); |
+ AssertPanelAboveLauncherIcon(w1); |
} |
} // namespace ash |