diff options
author | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-21 00:57:02 +0000 |
---|---|---|
committer | groby@chromium.org <groby@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-21 00:57:02 +0000 |
commit | 7eaa3c1037aeaf6ae34b916960d7ece124d5761c (patch) | |
tree | 743173b847827321e9c08402e24d6c6971a85117 /ash/wm/panel_layout_manager_unittest.cc | |
parent | 93ef2562762be7b8185211d4d59105b692cf34c9 (diff) | |
download | chromium_src-7eaa3c1037aeaf6ae34b916960d7ece124d5761c.zip chromium_src-7eaa3c1037aeaf6ae34b916960d7ece124d5761c.tar.gz chromium_src-7eaa3c1037aeaf6ae34b916960d7ece124d5761c.tar.bz2 |
Revert 133309 - Draw panels above their launcher icons.
(Caused test failures on Win and CrOS:PanelLayoutManagerTest.AddOnePanel)
Note that this patch doesn't handle dragging panels to rearrange them (if we want that at all) and panels with no launcher icon because they are in overflow.
BUG=124115
TEST=aura_shell_unittests --gtest_filter=*Panel* --aura-panels
Review URL: https://chromiumcodereview.appspot.com/10091017
TBR=dcheng@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10134018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133312 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/panel_layout_manager_unittest.cc')
-rw-r--r-- | ash/wm/panel_layout_manager_unittest.cc | 68 |
1 files changed, 22 insertions, 46 deletions
diff --git a/ash/wm/panel_layout_manager_unittest.cc b/ash/wm/panel_layout_manager_unittest.cc index 17c6035..4ee864c 100644 --- a/ash/wm/panel_layout_manager_unittest.cc +++ b/ash/wm/panel_layout_manager_unittest.cc @@ -5,11 +5,9 @@ #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" @@ -23,15 +21,9 @@ namespace { views::Widget* CreatePanelWindow(const gfx::Rect& rect) { views::Widget::InitParams params(views::Widget::InitParams::TYPE_PANEL); - params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.bounds = rect; - params.child = true; views::Widget* widget = new views::Widget(); widget->Init(params); - ash::test::TestLauncherDelegate* launcher_delegate = - ash::test::TestLauncherDelegate::instance(); - CHECK(launcher_delegate); - launcher_delegate->AddLauncherItem(widget->GetNativeWindow()); widget->Show(); return widget; } @@ -50,49 +42,29 @@ class PanelLayoutManagerTest : public ash::test::AshTestBase { DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerTest); }; -void IsPanelAboveLauncherIcon(views::Widget* panel) { - Launcher* launcher = Shell::GetInstance()->launcher(); - aura::Window* window = panel->GetNativeWindow(); - gfx::Rect icon_bounds = launcher->GetScreenBoundsOfItemIconForWindow(window); - ASSERT_FALSE(icon_bounds.IsEmpty()); - - gfx::Rect window_bounds = panel->GetWindowScreenBounds(); - - // 1-pixel tolerance--since we center panels over their icons, panels with odd - // pixel widths won't be perfectly lined up with even pixel width launcher - // icons. - EXPECT_NEAR( - window_bounds.CenterPoint().x(), icon_bounds.CenterPoint().x(), 1); - EXPECT_EQ(window_bounds.bottom(), icon_bounds.y()); -} - } // namespace // Tests that a created panel window is successfully added to the panel // layout manager. TEST_F(PanelLayoutManagerTest, AddOnePanel) { - gfx::Rect bounds(0, 0, 201, 201); - scoped_ptr<views::Widget> window(CreatePanelWindow(bounds)); - EXPECT_EQ(GetPanelContainer(), window->GetNativeWindow()->parent()); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(window.get())); + gfx::Rect bounds(1, 1, 200, 200); + views::Widget* w1 = CreatePanelWindow(bounds); + EXPECT_EQ(GetPanelContainer(), w1->GetNativeWindow()->parent()); } // Tests that panels are ordered right-to-left. -TEST_F(PanelLayoutManagerTest, PanelAboveLauncherIcons) { +TEST_F(PanelLayoutManagerTest, PanelOrderRightToLeft) { if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kAuraPanelManager)) return; - - gfx::Rect bounds(0, 0, 201, 201); - scoped_ptr<views::Widget> w1(CreatePanelWindow(bounds)); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w1.get())); - scoped_ptr<views::Widget> w2(CreatePanelWindow(bounds)); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w1.get())); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w2.get())); - scoped_ptr<views::Widget> w3(CreatePanelWindow(bounds)); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w1.get())); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w2.get())); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w3.get())); + gfx::Rect bounds(1, 1, 200, 200); + views::Widget* w1 = CreatePanelWindow(bounds); + views::Widget* w2 = CreatePanelWindow(bounds); + EXPECT_LT(w2->GetWindowScreenBounds().x(), w1->GetWindowScreenBounds().x()); + + views::Widget* w3 = CreatePanelWindow(bounds); + EXPECT_LT(w3->GetWindowScreenBounds().x(), w2->GetWindowScreenBounds().x()); + EXPECT_LT(w2->GetWindowScreenBounds().x(), w1->GetWindowScreenBounds().x()); } // Tests removing a panel. @@ -101,15 +73,19 @@ TEST_F(PanelLayoutManagerTest, RemovePanel) { switches::kAuraPanelManager)) return; - gfx::Rect bounds(0, 0, 201, 201); - scoped_ptr<views::Widget> w1(CreatePanelWindow(bounds)); - scoped_ptr<views::Widget> w2(CreatePanelWindow(bounds)); - scoped_ptr<views::Widget> w3(CreatePanelWindow(bounds)); + gfx::Rect bounds(1, 1, 200, 200); + views::Widget* w1 = CreatePanelWindow(bounds); + views::Widget* w2 = CreatePanelWindow(bounds); + views::Widget* w3 = CreatePanelWindow(bounds); + + gfx::Rect w3bounds = w3->GetWindowScreenBounds(); GetPanelContainer()->RemoveChild(w2->GetNativeWindow()); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w1.get())); - EXPECT_NO_FATAL_FAILURE(IsPanelAboveLauncherIcon(w3.get())); + // 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()); } } // namespace ash |