Chromium Code Reviews| 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 47a0b375003de3461a3fc538004b0627216891fc..ea0539c33db82ca03e0be9ef1006abd094624aa5 100644 |
| --- a/ash/shelf/shelf_layout_manager_unittest.cc |
| +++ b/ash/shelf/shelf_layout_manager_unittest.cc |
| @@ -9,6 +9,7 @@ |
| #include "ash/aura/wm_window_aura.h" |
| #include "ash/common/ash_switches.h" |
| #include "ash/common/focus_cycler.h" |
| +#include "ash/common/material_design/material_design_controller.h" |
| #include "ash/common/session/session_state_delegate.h" |
| #include "ash/common/shelf/shelf_constants.h" |
| #include "ash/common/shell_window_ids.h" |
| @@ -183,10 +184,18 @@ class ShelfDragCallback { |
| EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(), |
| GetShelfWidget()->GetDimmerBoundsForTest()); |
| - // The shelf should never be smaller than the hidden state when shelf is |
| - // visible; the shelf has a height of 0 when it is hidden. |
| - if (was_visible_on_drag_start_) |
| + // For non-MD, the shelf should never be smaller than the hidden state. |
| + if (!ash::MaterialDesignController::IsShelfMaterial()) { |
| EXPECT_GE(shelf_bounds.height(), not_visible_bounds_.height()); |
| + |
| + // For MD, when shelf is at the auto hidden state, it has visible height |
| + // of 0 and not_visible_bounds height is non zero and it is used to detect |
| + // movements. |
| + } else { |
| + if (GetShelf()->GetAutoHideState() != ash::SHELF_AUTO_HIDE_HIDDEN) { |
|
bruthig
2016/07/13 19:36:51
Can you collapse this 'if'/'else if' into a single
yiyix
2016/07/14 18:24:49
Done.
|
| + EXPECT_GE(shelf_bounds.height(), not_visible_bounds_.height()); |
| + } |
| + } |
| float scroll_delta = |
| GetShelfLayoutManager()->PrimaryAxisValue(scroll_.y(), scroll_.x()); |
| bool increasing_drag = |
| @@ -592,7 +601,14 @@ void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) { |
| gfx::Rect bounds_fullscreen = window->bounds(); |
| EXPECT_TRUE(widget->IsFullscreen()); |
| - EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
| + |
| + // For non-MD, some immersive hints are shown on both top and bottom in |
| + // immersive mode; and for MD, the window has the same behavior in both |
| + // immersive mode and full screen mode. |
| + if (ash::MaterialDesignController::IsShelfMaterial()) |
| + EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
| + else |
| + EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
| // Swipe up. This should show the shelf. |
| end = below_start - delta; |
| @@ -813,7 +829,8 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) { |
| // shelf should go off the screen. |
| layout_manager->LayoutShelf(); |
| int shelf_insets = GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); |
| - EXPECT_EQ(root->bounds().bottom() - shelf_insets, |
| + |
| + EXPECT_EQ(root->bounds().bottom() - kShelfAutoHideSize, |
| GetShelfWidget()->GetWindowBoundsInScreen().y()); |
| EXPECT_EQ(root->bounds().bottom() - shelf_insets, |
| display::Screen::GetScreen() |
| @@ -830,7 +847,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) { |
| layout_manager->LayoutShelf(); |
| EXPECT_EQ(root->bounds().bottom() - layout_manager->GetIdealBounds().height(), |
| GetShelfWidget()->GetWindowBoundsInScreen().y()); |
| - EXPECT_EQ(root->bounds().bottom() - kShelfAutoHideSize, |
| + EXPECT_EQ(root->bounds().bottom() - shelf_insets, |
| display::Screen::GetScreen() |
| ->GetDisplayNearestWindow(root) |
| .work_area() |
| @@ -1704,8 +1721,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { |
| EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); |
| shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); |
| - EXPECT_EQ(kShelfAutoHideSize, display.GetWorkAreaInsets().right()); |
| - EXPECT_EQ(kShelfAutoHideSize, |
| + EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), |
| + display.GetWorkAreaInsets().right()); |
| + EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), |
| display.bounds().right() - display.work_area().right()); |
| } |