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

Unified Diff: ash/wm/panel_layout_manager_unittest.cc

Issue 9808026: Layout panels on top of their launcher icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pre-patch with tests Created 8 years, 8 months 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 | « ash/wm/panel_layout_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « ash/wm/panel_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698