Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
| 9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
| 11 #include "ash/common/focus_cycler.h" | 11 #include "ash/common/focus_cycler.h" |
| 12 #include "ash/common/material_design/material_design_controller.h" | |
| 12 #include "ash/common/session/session_state_delegate.h" | 13 #include "ash/common/session/session_state_delegate.h" |
| 13 #include "ash/common/shelf/shelf_constants.h" | 14 #include "ash/common/shelf/shelf_constants.h" |
| 14 #include "ash/common/shell_window_ids.h" | 15 #include "ash/common/shell_window_ids.h" |
| 15 #include "ash/common/system/tray/system_tray_item.h" | 16 #include "ash/common/system/tray/system_tray_item.h" |
| 16 #include "ash/common/wm/window_state.h" | 17 #include "ash/common/wm/window_state.h" |
| 17 #include "ash/common/wm_shell.h" | 18 #include "ash/common/wm_shell.h" |
| 18 #include "ash/display/display_manager.h" | 19 #include "ash/display/display_manager.h" |
| 19 #include "ash/display/window_tree_host_manager.h" | 20 #include "ash/display/window_tree_host_manager.h" |
| 20 #include "ash/root_window_controller.h" | 21 #include "ash/root_window_controller.h" |
| 21 #include "ash/shelf/shelf.h" | 22 #include "ash/shelf/shelf.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 gfx::Rect target_bounds_; | 133 gfx::Rect target_bounds_; |
| 133 int animation_steps_; | 134 int animation_steps_; |
| 134 bool done_waiting_; | 135 bool done_waiting_; |
| 135 | 136 |
| 136 DISALLOW_COPY_AND_ASSIGN(ShelfAnimationWaiter); | 137 DISALLOW_COPY_AND_ASSIGN(ShelfAnimationWaiter); |
| 137 }; | 138 }; |
| 138 | 139 |
| 139 class ShelfDragCallback { | 140 class ShelfDragCallback { |
| 140 public: | 141 public: |
| 141 ShelfDragCallback(const gfx::Rect& not_visible, const gfx::Rect& visible) | 142 ShelfDragCallback(const gfx::Rect& not_visible, const gfx::Rect& visible) |
| 142 : not_visible_bounds_(not_visible), | 143 : auto_hidden_shelf_widget_bounds_(not_visible), |
|
James Cook
2016/07/14 22:59:13
These names are much clearer. Thanks for changing
| |
| 143 visible_bounds_(visible), | 144 shelf_widget_bounds_(visible), |
| 144 was_visible_on_drag_start_(false) { | 145 was_visible_on_drag_start_(false) { |
| 145 EXPECT_EQ(not_visible_bounds_.bottom(), visible_bounds_.bottom()); | 146 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.bottom(), |
| 147 shelf_widget_bounds_.bottom()); | |
| 146 } | 148 } |
| 147 | 149 |
| 148 virtual ~ShelfDragCallback() {} | 150 virtual ~ShelfDragCallback() {} |
| 149 | 151 |
| 150 void ProcessScroll(ui::EventType type, const gfx::Vector2dF& delta) { | 152 void ProcessScroll(ui::EventType type, const gfx::Vector2dF& delta) { |
| 151 if (GetShelfLayoutManager()->visibility_state() == SHELF_HIDDEN) | 153 if (GetShelfLayoutManager()->visibility_state() == SHELF_HIDDEN) |
| 152 return; | 154 return; |
| 153 | 155 |
| 154 if (type == ui::ET_GESTURE_SCROLL_BEGIN) { | 156 if (type == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 155 scroll_ = gfx::Vector2dF(); | 157 scroll_ = gfx::Vector2dF(); |
| 156 was_visible_on_drag_start_ = GetShelfLayoutManager()->IsVisible(); | 158 was_visible_on_drag_start_ = GetShelfLayoutManager()->IsVisible(); |
| 157 return; | 159 return; |
| 158 } | 160 } |
| 159 | 161 |
| 160 // The state of the shelf at the end of the gesture is tested separately. | 162 // The state of the shelf at the end of the gesture is tested separately. |
| 161 if (type == ui::ET_GESTURE_SCROLL_END) | 163 if (type == ui::ET_GESTURE_SCROLL_END) |
| 162 return; | 164 return; |
| 163 | 165 |
| 164 if (type == ui::ET_GESTURE_SCROLL_UPDATE) | 166 if (type == ui::ET_GESTURE_SCROLL_UPDATE) |
| 165 scroll_.Add(delta); | 167 scroll_.Add(delta); |
| 166 | 168 |
| 167 gfx::Rect shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); | 169 gfx::Rect shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); |
| 168 if (GetShelfLayoutManager()->IsHorizontalAlignment()) { | 170 if (GetShelfLayoutManager()->IsHorizontalAlignment()) { |
| 169 EXPECT_EQ(not_visible_bounds_.bottom(), shelf_bounds.bottom()); | 171 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.bottom(), |
| 170 EXPECT_EQ(visible_bounds_.bottom(), shelf_bounds.bottom()); | 172 shelf_bounds.bottom()); |
| 173 EXPECT_EQ(shelf_widget_bounds_.bottom(), shelf_bounds.bottom()); | |
| 171 } else if (SHELF_ALIGNMENT_RIGHT == | 174 } else if (SHELF_ALIGNMENT_RIGHT == |
| 172 GetShelfLayoutManager()->GetAlignment()) { | 175 GetShelfLayoutManager()->GetAlignment()) { |
| 173 EXPECT_EQ(not_visible_bounds_.right(), shelf_bounds.right()); | 176 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.right(), shelf_bounds.right()); |
| 174 EXPECT_EQ(visible_bounds_.right(), shelf_bounds.right()); | 177 EXPECT_EQ(shelf_widget_bounds_.right(), shelf_bounds.right()); |
| 175 } else if (SHELF_ALIGNMENT_LEFT == | 178 } else if (SHELF_ALIGNMENT_LEFT == |
| 176 GetShelfLayoutManager()->GetAlignment()) { | 179 GetShelfLayoutManager()->GetAlignment()) { |
| 177 EXPECT_EQ(not_visible_bounds_.x(), shelf_bounds.x()); | 180 EXPECT_EQ(auto_hidden_shelf_widget_bounds_.x(), shelf_bounds.x()); |
| 178 EXPECT_EQ(visible_bounds_.x(), shelf_bounds.x()); | 181 EXPECT_EQ(shelf_widget_bounds_.x(), shelf_bounds.x()); |
| 179 } | 182 } |
| 180 | 183 |
| 181 // if the shelf is being dimmed test dimmer bounds as well. | 184 // if the shelf is being dimmed test dimmer bounds as well. |
| 182 if (GetShelfWidget()->GetDimsShelf()) | 185 if (GetShelfWidget()->GetDimsShelf()) |
| 183 EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(), | 186 EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(), |
| 184 GetShelfWidget()->GetDimmerBoundsForTest()); | 187 GetShelfWidget()->GetDimmerBoundsForTest()); |
| 185 | 188 |
| 186 // The shelf should never be smaller than the hidden state when shelf is | 189 // Auto hidden shelf has a visible height of 0 in MD (where this inequality |
| 187 // visible; the shelf has a height of 0 when it is hidden. | 190 // does not apply); whereas auto hidden shelf has a visible height of 3 in |
| 188 if (was_visible_on_drag_start_) | 191 // non-MD. |
| 189 EXPECT_GE(shelf_bounds.height(), not_visible_bounds_.height()); | 192 if (!ash::MaterialDesignController::IsShelfMaterial() || |
| 193 GetShelf()->GetAutoHideState() != ash::SHELF_AUTO_HIDE_HIDDEN) { | |
| 194 EXPECT_GE(shelf_bounds.height(), | |
| 195 auto_hidden_shelf_widget_bounds_.height()); | |
| 196 } | |
| 197 | |
| 190 float scroll_delta = | 198 float scroll_delta = |
| 191 GetShelfLayoutManager()->PrimaryAxisValue(scroll_.y(), scroll_.x()); | 199 GetShelfLayoutManager()->PrimaryAxisValue(scroll_.y(), scroll_.x()); |
| 192 bool increasing_drag = | 200 bool increasing_drag = |
| 193 GetShelfWidget()->shelf()->SelectValueForShelfAlignment( | 201 GetShelfWidget()->shelf()->SelectValueForShelfAlignment( |
| 194 scroll_delta<0, scroll_delta> 0, scroll_delta < 0); | 202 scroll_delta<0, scroll_delta> 0, scroll_delta < 0); |
| 195 int shelf_size = GetShelfLayoutManager()->PrimaryAxisValue( | 203 int shelf_size = GetShelfLayoutManager()->PrimaryAxisValue( |
| 196 shelf_bounds.height(), shelf_bounds.width()); | 204 shelf_bounds.height(), shelf_bounds.width()); |
| 197 int visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( | 205 int visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( |
| 198 visible_bounds_.height(), visible_bounds_.width()); | 206 shelf_widget_bounds_.height(), shelf_widget_bounds_.width()); |
| 199 int not_visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( | 207 int not_visible_bounds_size = GetShelfLayoutManager()->PrimaryAxisValue( |
| 200 not_visible_bounds_.height(), not_visible_bounds_.width()); | 208 auto_hidden_shelf_widget_bounds_.height(), |
| 209 auto_hidden_shelf_widget_bounds_.width()); | |
| 201 if (was_visible_on_drag_start_) { | 210 if (was_visible_on_drag_start_) { |
| 202 if (increasing_drag) { | 211 if (increasing_drag) { |
| 203 // If dragging inwards from the visible state, then the shelf should | 212 // If dragging inwards from the visible state, then the shelf should |
| 204 // increase in size, but not more than the scroll delta. | 213 // increase in size, but not more than the scroll delta. |
| 205 EXPECT_LE(visible_bounds_size, shelf_size); | 214 EXPECT_LE(visible_bounds_size, shelf_size); |
| 206 EXPECT_LE(std::abs(shelf_size - visible_bounds_size), | 215 EXPECT_LE(std::abs(shelf_size - visible_bounds_size), |
| 207 std::abs(scroll_delta)); | 216 std::abs(scroll_delta)); |
| 208 } else { | 217 } else { |
| 209 if (shelf_size > not_visible_bounds_size) { | 218 if (shelf_size > not_visible_bounds_size) { |
| 210 // If dragging outwards from the visible state, then the shelf | 219 // If dragging outwards from the visible state, then the shelf |
| 211 // should decrease in size, until it reaches the minimum size. | 220 // should decrease in size, until it reaches the minimum size. |
| 212 EXPECT_EQ(shelf_size, visible_bounds_size - std::abs(scroll_delta)); | 221 EXPECT_EQ(shelf_size, visible_bounds_size - std::abs(scroll_delta)); |
| 213 } | 222 } |
| 214 } | 223 } |
| 215 } else { | 224 } else { |
| 216 if (std::abs(scroll_delta) < | 225 if (std::abs(scroll_delta) < |
| 217 visible_bounds_size - not_visible_bounds_size) { | 226 visible_bounds_size - not_visible_bounds_size) { |
| 218 // Tests that the shelf sticks with the touch point during the drag | 227 // Tests that the shelf sticks with the touch point during the drag |
| 219 // until the shelf is completely visible. | 228 // until the shelf is completely visible. |
| 220 EXPECT_EQ(shelf_size, not_visible_bounds_size + std::abs(scroll_delta)); | 229 EXPECT_EQ(shelf_size, not_visible_bounds_size + std::abs(scroll_delta)); |
| 221 } else { | 230 } else { |
| 222 // Tests that after the shelf is completely visible, the shelf starts | 231 // Tests that after the shelf is completely visible, the shelf starts |
| 223 // resisting the drag. | 232 // resisting the drag. |
| 224 EXPECT_LT(shelf_size, not_visible_bounds_size + std::abs(scroll_delta)); | 233 EXPECT_LT(shelf_size, not_visible_bounds_size + std::abs(scroll_delta)); |
| 225 } | 234 } |
| 226 } | 235 } |
| 227 } | 236 } |
| 228 | 237 |
| 229 private: | 238 private: |
| 230 const gfx::Rect not_visible_bounds_; | 239 const gfx::Rect auto_hidden_shelf_widget_bounds_; |
| 231 const gfx::Rect visible_bounds_; | 240 const gfx::Rect shelf_widget_bounds_; |
| 232 gfx::Vector2dF scroll_; | 241 gfx::Vector2dF scroll_; |
| 233 bool was_visible_on_drag_start_; | 242 bool was_visible_on_drag_start_; |
| 234 | 243 |
| 235 DISALLOW_COPY_AND_ASSIGN(ShelfDragCallback); | 244 DISALLOW_COPY_AND_ASSIGN(ShelfDragCallback); |
| 236 }; | 245 }; |
| 237 | 246 |
| 238 class ShelfLayoutObserverTest : public ShelfLayoutManagerObserver { | 247 class ShelfLayoutObserverTest : public ShelfLayoutManagerObserver { |
| 239 public: | 248 public: |
| 240 ShelfLayoutObserverTest() : changed_auto_hide_state_(false) {} | 249 ShelfLayoutObserverTest() : changed_auto_hide_state_(false) {} |
| 241 | 250 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 585 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 594 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
| 586 | 595 |
| 587 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget| | 596 // Put |widget| into fullscreen. Set the shelf to be auto hidden when |widget| |
| 588 // is fullscreen. (eg browser immersive fullscreen). | 597 // is fullscreen. (eg browser immersive fullscreen). |
| 589 widget->SetFullscreen(true); | 598 widget->SetFullscreen(true); |
| 590 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false); | 599 wm::GetWindowState(window)->set_hide_shelf_when_fullscreen(false); |
| 591 layout_manager->UpdateVisibilityState(); | 600 layout_manager->UpdateVisibilityState(); |
| 592 | 601 |
| 593 gfx::Rect bounds_fullscreen = window->bounds(); | 602 gfx::Rect bounds_fullscreen = window->bounds(); |
| 594 EXPECT_TRUE(widget->IsFullscreen()); | 603 EXPECT_TRUE(widget->IsFullscreen()); |
| 595 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | 604 |
| 605 // Shelf hints are removed in immersive full screen mode in MD; and some shelf | |
| 606 // hints are shown in non-MD mode. | |
| 607 if (ash::MaterialDesignController::IsShelfMaterial()) | |
| 608 EXPECT_EQ(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | |
| 609 else | |
| 610 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | |
| 596 | 611 |
| 597 // Swipe up. This should show the shelf. | 612 // Swipe up. This should show the shelf. |
| 598 end = below_start - delta; | 613 end = below_start - delta; |
| 599 generator.GestureScrollSequenceWithCallback( | 614 generator.GestureScrollSequenceWithCallback( |
| 600 below_start, end, kTimeDelta, kNumScrollSteps, | 615 below_start, end, kTimeDelta, kNumScrollSteps, |
| 601 base::Bind(&ShelfDragCallback::ProcessScroll, | 616 base::Bind(&ShelfDragCallback::ProcessScroll, |
| 602 base::Unretained(&handler))); | 617 base::Unretained(&handler))); |
| 603 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 618 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 604 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 619 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
| 605 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | 620 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 806 widget->Init(params); | 821 widget->Init(params); |
| 807 widget->Maximize(); | 822 widget->Maximize(); |
| 808 widget->Show(); | 823 widget->Show(); |
| 809 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 824 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 810 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 825 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 811 | 826 |
| 812 // LayoutShelf() forces the animation to completion, at which point the | 827 // LayoutShelf() forces the animation to completion, at which point the |
| 813 // shelf should go off the screen. | 828 // shelf should go off the screen. |
| 814 layout_manager->LayoutShelf(); | 829 layout_manager->LayoutShelf(); |
| 815 int shelf_insets = GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); | 830 int shelf_insets = GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE); |
| 816 EXPECT_EQ(root->bounds().bottom() - shelf_insets, | 831 |
| 832 EXPECT_EQ(root->bounds().bottom() - kShelfAutoHideSize, | |
| 817 GetShelfWidget()->GetWindowBoundsInScreen().y()); | 833 GetShelfWidget()->GetWindowBoundsInScreen().y()); |
| 818 EXPECT_EQ(root->bounds().bottom() - shelf_insets, | 834 EXPECT_EQ(root->bounds().bottom() - shelf_insets, |
| 819 display::Screen::GetScreen() | 835 display::Screen::GetScreen() |
| 820 ->GetDisplayNearestWindow(root) | 836 ->GetDisplayNearestWindow(root) |
| 821 .work_area() | 837 .work_area() |
| 822 .bottom()); | 838 .bottom()); |
| 823 | 839 |
| 824 // Move the mouse to the bottom of the screen. | 840 // Move the mouse to the bottom of the screen. |
| 825 generator.MoveMouseTo(0, root->bounds().bottom() - 1); | 841 generator.MoveMouseTo(0, root->bounds().bottom() - 1); |
| 826 | 842 |
| 827 // Shelf should be shown again (but it shouldn't have changed the work area). | 843 // Shelf should be shown again (but it shouldn't have changed the work area). |
| 828 SetState(layout_manager, SHELF_AUTO_HIDE); | 844 SetState(layout_manager, SHELF_AUTO_HIDE); |
| 829 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); | 845 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); |
| 830 layout_manager->LayoutShelf(); | 846 layout_manager->LayoutShelf(); |
| 831 EXPECT_EQ(root->bounds().bottom() - layout_manager->GetIdealBounds().height(), | 847 EXPECT_EQ(root->bounds().bottom() - layout_manager->GetIdealBounds().height(), |
| 832 GetShelfWidget()->GetWindowBoundsInScreen().y()); | 848 GetShelfWidget()->GetWindowBoundsInScreen().y()); |
| 833 EXPECT_EQ(root->bounds().bottom() - kShelfAutoHideSize, | 849 EXPECT_EQ(root->bounds().bottom() - shelf_insets, |
| 834 display::Screen::GetScreen() | 850 display::Screen::GetScreen() |
| 835 ->GetDisplayNearestWindow(root) | 851 ->GetDisplayNearestWindow(root) |
| 836 .work_area() | 852 .work_area() |
| 837 .bottom()); | 853 .bottom()); |
| 838 | 854 |
| 839 // Move mouse back up. | 855 // Move mouse back up. |
| 840 generator.MoveMouseTo(0, 0); | 856 generator.MoveMouseTo(0, 0); |
| 841 SetState(layout_manager, SHELF_AUTO_HIDE); | 857 SetState(layout_manager, SHELF_AUTO_HIDE); |
| 842 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 858 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 843 layout_manager->LayoutShelf(); | 859 layout_manager->LayoutShelf(); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1697 EXPECT_EQ(layout_manager->GetIdealBounds().width(), | 1713 EXPECT_EQ(layout_manager->GetIdealBounds().width(), |
| 1698 display.GetWorkAreaInsets().right()); | 1714 display.GetWorkAreaInsets().right()); |
| 1699 EXPECT_EQ(0, display.GetWorkAreaInsets().top()); | 1715 EXPECT_EQ(0, display.GetWorkAreaInsets().top()); |
| 1700 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); | 1716 EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); |
| 1701 EXPECT_EQ(0, display.GetWorkAreaInsets().left()); | 1717 EXPECT_EQ(0, display.GetWorkAreaInsets().left()); |
| 1702 EXPECT_EQ(display.work_area().right(), shelf_bounds.x()); | 1718 EXPECT_EQ(display.work_area().right(), shelf_bounds.x()); |
| 1703 EXPECT_EQ(display.bounds().y(), shelf_bounds.y()); | 1719 EXPECT_EQ(display.bounds().y(), shelf_bounds.y()); |
| 1704 EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); | 1720 EXPECT_EQ(display.bounds().height(), shelf_bounds.height()); |
| 1705 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1721 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1706 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); | 1722 display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); |
| 1707 EXPECT_EQ(kShelfAutoHideSize, display.GetWorkAreaInsets().right()); | 1723 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), |
| 1708 EXPECT_EQ(kShelfAutoHideSize, | 1724 display.GetWorkAreaInsets().right()); |
| 1725 EXPECT_EQ(GetShelfConstant(SHELF_INSETS_FOR_AUTO_HIDE), | |
| 1709 display.bounds().right() - display.work_area().right()); | 1726 display.bounds().right() - display.work_area().right()); |
| 1710 } | 1727 } |
| 1711 | 1728 |
| 1712 TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) { | 1729 TEST_F(ShelfLayoutManagerTest, GestureEdgeSwipe) { |
| 1713 Shelf* shelf = GetShelf(); | 1730 Shelf* shelf = GetShelf(); |
| 1714 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | 1731 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); |
| 1715 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1732 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1716 views::Widget* widget = new views::Widget; | 1733 views::Widget* widget = new views::Widget; |
| 1717 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 1734 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
| 1718 params.bounds = gfx::Rect(0, 0, 200, 200); | 1735 params.bounds = gfx::Rect(0, 0, 200, 200); |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2265 ->shelf_widget() | 2282 ->shelf_widget() |
| 2266 ->status_area_widget(); | 2283 ->status_area_widget(); |
| 2267 EXPECT_TRUE(status_area_widget->IsVisible()); | 2284 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 2268 // Shelf should be in the first display's area. | 2285 // Shelf should be in the first display's area. |
| 2269 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 2286 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
| 2270 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 2287 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
| 2271 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 2288 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
| 2272 } | 2289 } |
| 2273 | 2290 |
| 2274 } // namespace ash | 2291 } // namespace ash |
| OLD | NEW |