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/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (type == ui::ET_GESTURE_SCROLL_END) | 92 if (type == ui::ET_GESTURE_SCROLL_END) |
93 return; | 93 return; |
94 | 94 |
95 if (type == ui::ET_GESTURE_SCROLL_UPDATE) | 95 if (type == ui::ET_GESTURE_SCROLL_UPDATE) |
96 scroll_.Add(delta); | 96 scroll_.Add(delta); |
97 | 97 |
98 gfx::Rect shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); | 98 gfx::Rect shelf_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); |
99 EXPECT_EQ(not_visible_bounds_.bottom(), shelf_bounds.bottom()); | 99 EXPECT_EQ(not_visible_bounds_.bottom(), shelf_bounds.bottom()); |
100 EXPECT_EQ(visible_bounds_.bottom(), shelf_bounds.bottom()); | 100 EXPECT_EQ(visible_bounds_.bottom(), shelf_bounds.bottom()); |
101 | 101 |
| 102 // if the shelf is being dimmed test dimmer bounds as well. |
| 103 if (GetShelfWidget()->GetDimsShelf()) |
| 104 EXPECT_EQ(GetShelfWidget()->GetWindowBoundsInScreen(), |
| 105 GetShelfWidget()->GetDimmerBoundsForTest()); |
| 106 |
102 // The shelf should never be smaller than the hidden state. | 107 // The shelf should never be smaller than the hidden state. |
103 EXPECT_GE(shelf_bounds.height(), not_visible_bounds_.height()); | 108 EXPECT_GE(shelf_bounds.height(), not_visible_bounds_.height()); |
104 | 109 |
105 if (was_visible_on_drag_start_) { | 110 if (was_visible_on_drag_start_) { |
106 if (scroll_.y() < 0) { | 111 if (scroll_.y() < 0) { |
107 // If dragging up from the visible state, then the shelf should increase | 112 // If dragging up from the visible state, then the shelf should increase |
108 // in height, but not as much as the scroll delta. | 113 // in height, but not as much as the scroll delta. |
109 EXPECT_LE(shelf_bounds.y(), visible_bounds_.y()); | 114 EXPECT_LE(shelf_bounds.y(), visible_bounds_.y()); |
110 EXPECT_LE(abs(shelf_bounds.y() - visible_bounds_.y()), | 115 EXPECT_LE(abs(shelf_bounds.y() - visible_bounds_.y()), |
111 abs(scroll_.y())); | 116 abs(scroll_.y())); |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 994 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
990 | 995 |
991 // Swipe up to show the shelf. | 996 // Swipe up to show the shelf. |
992 generator.GestureScrollSequenceWithCallback(end, start, | 997 generator.GestureScrollSequenceWithCallback(end, start, |
993 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 998 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
994 base::Bind(&ShelfDragCallback::ProcessScroll, | 999 base::Bind(&ShelfDragCallback::ProcessScroll, |
995 base::Unretained(&handler))); | 1000 base::Unretained(&handler))); |
996 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); | 1001 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); |
997 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | 1002 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
998 EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString()); | 1003 EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString()); |
| 1004 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), |
| 1005 GetShelfWidget()->GetWindowBoundsInScreen()); |
999 EXPECT_EQ(shelf_shown.ToString(), | 1006 EXPECT_EQ(shelf_shown.ToString(), |
1000 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 1007 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
1001 | 1008 |
1002 // Swipe up again. The shelf should hide. | 1009 // Swipe up again. The shelf should hide. |
1003 end.set_y(start.y() - 100); | 1010 end.set_y(start.y() - 100); |
1004 generator.GestureScrollSequenceWithCallback(start, end, | 1011 generator.GestureScrollSequenceWithCallback(start, end, |
1005 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 1012 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
1006 base::Bind(&ShelfDragCallback::ProcessScroll, | 1013 base::Bind(&ShelfDragCallback::ProcessScroll, |
1007 base::Unretained(&handler))); | 1014 base::Unretained(&handler))); |
1008 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1015 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
(...skipping 23 matching lines...) Expand all Loading... |
1032 | 1039 |
1033 // Swipe down again to hide. | 1040 // Swipe down again to hide. |
1034 end.set_y(start.y() + 100); | 1041 end.set_y(start.y() + 100); |
1035 generator.GestureScrollSequenceWithCallback(start, end, | 1042 generator.GestureScrollSequenceWithCallback(start, end, |
1036 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 1043 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
1037 base::Bind(&ShelfDragCallback::ProcessScroll, | 1044 base::Bind(&ShelfDragCallback::ProcessScroll, |
1038 base::Unretained(&handler))); | 1045 base::Unretained(&handler))); |
1039 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1046 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1040 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 1047 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
1041 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 1048 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
| 1049 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); |
1042 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); | 1050 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); |
1043 EXPECT_EQ(shelf_hidden.ToString(), | 1051 EXPECT_EQ(shelf_hidden.ToString(), |
1044 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 1052 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
1045 | 1053 |
1046 // Make the window fullscreen. | 1054 // Make the window fullscreen. |
1047 widget->SetFullscreen(true); | 1055 widget->SetFullscreen(true); |
1048 gfx::Rect bounds_fullscreen = window->bounds(); | 1056 gfx::Rect bounds_fullscreen = window->bounds(); |
1049 EXPECT_TRUE(widget->IsFullscreen()); | 1057 EXPECT_TRUE(widget->IsFullscreen()); |
1050 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | 1058 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
1051 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 1059 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | 1331 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
1324 } else { | 1332 } else { |
1325 EXPECT_FALSE(shelf->IsVisible()); | 1333 EXPECT_FALSE(shelf->IsVisible()); |
1326 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1334 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1327 } | 1335 } |
1328 } | 1336 } |
1329 } | 1337 } |
1330 | 1338 |
1331 } // namespace internal | 1339 } // namespace internal |
1332 } // namespace ash | 1340 } // namespace ash |
OLD | NEW |