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

Unified Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: comment 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/shelf/shelf_layout_manager_observer.h ('k') | ash/shelf/shelf_locking_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager_unittest.cc
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index b2a0aef0ba84ecf1d9e4027df0a07464473440ca..ce98cd500993a965392aa3c2a839f76ced36d226 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -162,12 +162,12 @@ class ShelfDragCallback {
if (GetShelfLayoutManager()->IsHorizontalAlignment()) {
EXPECT_EQ(not_visible_bounds_.bottom(), shelf_bounds.bottom());
EXPECT_EQ(visible_bounds_.bottom(), shelf_bounds.bottom());
- } else if (SHELF_ALIGNMENT_RIGHT ==
- GetShelfLayoutManager()->GetAlignment()){
+ } else if (wm::SHELF_ALIGNMENT_RIGHT ==
+ GetShelfLayoutManager()->GetAlignment()) {
EXPECT_EQ(not_visible_bounds_.right(), shelf_bounds.right());
EXPECT_EQ(visible_bounds_.right(), shelf_bounds.right());
- } else if (SHELF_ALIGNMENT_LEFT ==
- GetShelfLayoutManager()->GetAlignment()) {
+ } else if (wm::SHELF_ALIGNMENT_LEFT ==
+ GetShelfLayoutManager()->GetAlignment()) {
EXPECT_EQ(not_visible_bounds_.x(), shelf_bounds.x());
EXPECT_EQ(visible_bounds_.x(), shelf_bounds.x());
}
@@ -481,9 +481,9 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
// Swipe down very little. It shouldn't change any state.
if (GetShelfLayoutManager()->IsHorizontalAlignment())
end.set_y(start.y() + shelf_shown.height() * 3 / 10);
- else if (SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment())
+ else if (wm::SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment())
end.set_x(start.x() - shelf_shown.width() * 3 / 10);
- else if (SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment())
+ else if (wm::SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment())
end.set_x(start.x() + shelf_shown.width() * 3 / 10);
generator.GestureScrollSequence(start, end, kTimeDelta, 5);
EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
@@ -513,10 +513,10 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
gfx::Point extended_start = start;
if (GetShelfLayoutManager()->IsHorizontalAlignment())
extended_start.set_y(GetShelfWidget()->GetWindowBoundsInScreen().y() -1);
- else if (SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment())
+ else if (wm::SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment())
extended_start.set_x(
GetShelfWidget()->GetWindowBoundsInScreen().right() + 1);
- else if (SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment())
+ else if (wm::SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment())
extended_start.set_x(GetShelfWidget()->GetWindowBoundsInScreen().x() - 1);
end = extended_start - delta;
generator.GestureScrollSequenceWithCallback(
@@ -570,10 +570,10 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) {
gfx::Point below_start = start;
if (GetShelfLayoutManager()->IsHorizontalAlignment())
below_start.set_y(GetShelfWidget()->GetWindowBoundsInScreen().bottom() + 1);
- else if (SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment())
+ else if (wm::SHELF_ALIGNMENT_LEFT == GetShelfLayoutManager()->GetAlignment())
below_start.set_x(
GetShelfWidget()->GetWindowBoundsInScreen().x() - 1);
- else if (SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment())
+ else if (wm::SHELF_ALIGNMENT_RIGHT == GetShelfLayoutManager()->GetAlignment())
below_start.set_x(GetShelfWidget()->GetWindowBoundsInScreen().right() + 1);
end = below_start - delta;
generator.GestureScrollSequence(
@@ -900,7 +900,7 @@ TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) {
test::CreateDisplayLayout(display::DisplayPlacement::RIGHT, 0));
// Put the primary monitor's shelf on the display boundary.
ShelfLayoutManager* shelf = GetShelfLayoutManager();
- shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
+ shelf->SetAlignment(wm::SHELF_ALIGNMENT_RIGHT);
// Create a window because the shelf is always shown when no windows are
// visible.
@@ -1656,7 +1656,7 @@ TEST_F(ShelfLayoutManagerTest, FullscreenWindowOnSecondDisplay) {
#define MAYBE_SetAlignment SetAlignment
#endif
-// Tests SHELF_ALIGNMENT_(LEFT, RIGHT).
+// Tests wm::SHELF_ALIGNMENT_(LEFT, RIGHT).
TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
ShelfLayoutManager* shelf = GetShelfLayoutManager();
// Force an initial layout.
@@ -1664,7 +1664,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
shelf->LayoutShelf();
EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state());
- shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
+ shelf->SetAlignment(wm::SHELF_ALIGNMENT_LEFT);
gfx::Rect shelf_bounds(
GetShelfWidget()->GetWindowBoundsInScreen());
const gfx::Screen* screen = gfx::Screen::GetScreen();
@@ -1676,7 +1676,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_GE(
shelf_bounds.width(),
GetShelfWidget()->GetContentsView()->GetPreferredSize().width());
- EXPECT_EQ(SHELF_ALIGNMENT_LEFT, GetSystemTray()->shelf_alignment());
+ EXPECT_EQ(wm::SHELF_ALIGNMENT_LEFT, GetSystemTray()->shelf_alignment());
StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget();
gfx::Rect status_bounds(status_area_widget->GetWindowBoundsInScreen());
EXPECT_GE(status_bounds.width(),
@@ -1696,7 +1696,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
EXPECT_EQ(ShelfLayoutManager::kAutoHideSize, display.work_area().x());
shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
- shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
+ shelf->SetAlignment(wm::SHELF_ALIGNMENT_RIGHT);
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen();
display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow());
@@ -1705,7 +1705,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) {
display.GetWorkAreaInsets().right());
EXPECT_GE(shelf_bounds.width(),
GetShelfWidget()->GetContentsView()->GetPreferredSize().width());
- EXPECT_EQ(SHELF_ALIGNMENT_RIGHT, GetSystemTray()->shelf_alignment());
+ EXPECT_EQ(wm::SHELF_ALIGNMENT_RIGHT, GetSystemTray()->shelf_alignment());
status_bounds = gfx::Rect(status_area_widget->GetWindowBoundsInScreen());
EXPECT_GE(status_bounds.width(),
status_area_widget->GetContentsView()->GetPreferredSize().width());
@@ -1860,13 +1860,13 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_GestureDrag) {
{
SCOPED_TRACE("LEFT");
- shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
+ shelf->SetAlignment(wm::SHELF_ALIGNMENT_LEFT);
RunGestureDragTests(gfx::Vector2d(-120, 0));
}
{
SCOPED_TRACE("RIGHT");
- shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
+ shelf->SetAlignment(wm::SHELF_ALIGNMENT_RIGHT);
RunGestureDragTests(gfx::Vector2d(120, 0));
}
}
@@ -2142,14 +2142,17 @@ TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) {
}
TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColor) {
- EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_DEFAULT,
+ GetShelfWidget()->GetBackgroundType());
std::unique_ptr<aura::Window> w1(CreateTestWindow());
w1->Show();
wm::ActivateWindow(w1.get());
- EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_DEFAULT,
+ GetShelfWidget()->GetBackgroundType());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_MAXIMIZED,
+ GetShelfWidget()->GetBackgroundType());
std::unique_ptr<aura::Window> w2(CreateTestWindow());
w2->Show();
@@ -2158,31 +2161,39 @@ TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColor) {
w2->SetBounds(GetShelfLayoutManager()->GetIdealBounds());
// Still background is 'maximized'.
- EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_MAXIMIZED,
+ GetShelfWidget()->GetBackgroundType());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_OVERLAP,
+ GetShelfWidget()->GetBackgroundType());
w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
- EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_DEFAULT,
+ GetShelfWidget()->GetBackgroundType());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_MAXIMIZED,
+ GetShelfWidget()->GetBackgroundType());
w1.reset();
- EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_DEFAULT,
+ GetShelfWidget()->GetBackgroundType());
}
// Verify that the shelf doesn't have the opaque background if it's auto-hide
// status.
TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) {
- EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget ()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_DEFAULT,
+ GetShelfWidget()->GetBackgroundType());
GetShelfLayoutManager()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
std::unique_ptr<aura::Window> w1(CreateTestWindow());
w1->Show();
wm::ActivateWindow(w1.get());
- EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_OVERLAP,
+ GetShelfWidget()->GetBackgroundType());
w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
- EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType());
+ EXPECT_EQ(wm::SHELF_BACKGROUND_OVERLAP,
+ GetShelfWidget()->GetBackgroundType());
}
#if defined(OS_CHROMEOS)
@@ -2208,7 +2219,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_StatusAreaHitBoxCoversEdge) {
EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
// Test bottom right pixel for right alignment.
- shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT);
+ shelf->SetAlignment(wm::SHELF_ALIGNMENT_RIGHT);
EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
generator.ClickLeftButton();
EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
@@ -2217,7 +2228,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_StatusAreaHitBoxCoversEdge) {
// Test bottom left pixel for left alignment.
generator.MoveMouseTo(0, 399);
- shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
+ shelf->SetAlignment(wm::SHELF_ALIGNMENT_LEFT);
EXPECT_FALSE(status_area_widget->IsMessageBubbleShown());
generator.ClickLeftButton();
EXPECT_TRUE(status_area_widget->IsMessageBubbleShown());
« no previous file with comments | « ash/shelf/shelf_layout_manager_observer.h ('k') | ash/shelf/shelf_locking_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698