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

Unified Diff: ash/wm/panels/panel_layout_manager_unittest.cc

Issue 1877543002: Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update and cleanup tests. Created 4 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/panels/panel_layout_manager.cc ('k') | ash/wm/panels/panel_window_resizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/panels/panel_layout_manager_unittest.cc
diff --git a/ash/wm/panels/panel_layout_manager_unittest.cc b/ash/wm/panels/panel_layout_manager_unittest.cc
index 66b2ff93c32558ce78666a1e9ce0ff6e2c29df7d..1e742b607e7318a48b9c755ae5705dd29e25e051 100644
--- a/ash/wm/panels/panel_layout_manager_unittest.cc
+++ b/ash/wm/panels/panel_layout_manager_unittest.cc
@@ -141,17 +141,12 @@ class PanelLayoutManagerTest : public test::AshTestBase {
EXPECT_GE(window_bounds.bottom(), icon_bounds.bottom());
}
- switch (alignment) {
- case SHELF_ALIGNMENT_BOTTOM:
- EXPECT_EQ(shelf_bounds.y(), window_bounds.bottom());
- break;
- case SHELF_ALIGNMENT_LEFT:
- EXPECT_EQ(shelf_bounds.right(), window_bounds.x());
- break;
- case SHELF_ALIGNMENT_RIGHT:
- EXPECT_EQ(shelf_bounds.x(), window_bounds.right());
- break;
- }
+ if (alignment == SHELF_ALIGNMENT_LEFT)
+ EXPECT_EQ(shelf_bounds.right(), window_bounds.x());
+ else if (alignment == SHELF_ALIGNMENT_RIGHT)
+ EXPECT_EQ(shelf_bounds.x(), window_bounds.right());
+ else
+ EXPECT_EQ(shelf_bounds.y(), window_bounds.bottom());
}
void IsCalloutAboveLauncherIcon(aura::Window* panel) {
@@ -170,17 +165,12 @@ class PanelLayoutManagerTest : public test::AshTestBase {
EXPECT_TRUE(widget->IsVisible());
ShelfAlignment alignment = GetAlignment(panel->GetRootWindow());
- switch (alignment) {
- case SHELF_ALIGNMENT_BOTTOM:
- EXPECT_EQ(panel_bounds.bottom(), callout_bounds.y());
- break;
- case SHELF_ALIGNMENT_LEFT:
- EXPECT_EQ(panel_bounds.x(), callout_bounds.right());
- break;
- case SHELF_ALIGNMENT_RIGHT:
- EXPECT_EQ(panel_bounds.right(), callout_bounds.x());
- break;
- }
+ if (alignment == SHELF_ALIGNMENT_LEFT)
+ EXPECT_EQ(panel_bounds.x(), callout_bounds.right());
+ else if (alignment == SHELF_ALIGNMENT_RIGHT)
+ EXPECT_EQ(panel_bounds.right(), callout_bounds.x());
+ else
+ EXPECT_EQ(panel_bounds.bottom(), callout_bounds.y());
if (IsHorizontal(alignment)) {
EXPECT_NEAR(icon_bounds.CenterPoint().x(),
@@ -220,13 +210,11 @@ class PanelLayoutManagerTest : public test::AshTestBase {
}
void SetAlignment(aura::Window* root_window, ShelfAlignment alignment) {
- ash::Shell* shell = ash::Shell::GetInstance();
- shell->SetShelfAlignment(alignment, root_window);
+ Shelf::ForWindow(root_window)->SetAlignment(alignment);
}
ShelfAlignment GetAlignment(const aura::Window* root_window) {
- ash::Shell* shell = ash::Shell::GetInstance();
- return shell->GetShelfAlignment(root_window);
+ return Shelf::ForWindow(root_window)->alignment();
}
void SetShelfAutoHideBehavior(aura::Window* window,
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/panels/panel_window_resizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698