Chromium Code Reviews| 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..290e112186c19bb1f003a3e3e8cd4cc7a96e278a 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,9 @@ 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 +47,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()); |
|
Dmitry Lomov (no reviews)
2012/04/10 19:13:22
This test fails. The reason for the failure is tha
|
| +} |
| + |
| } // namespace |
| // Tests that a created panel window is successfully added to the panel |
| @@ -53,18 +65,19 @@ TEST_F(PanelLayoutManagerTest, AddOnePanel) { |
| } |
| // 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. |