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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 | 80 |
81 void ProcessScroll(ui::EventType type, const gfx::Vector2dF& delta) { | 81 void ProcessScroll(ui::EventType type, const gfx::Vector2dF& delta) { |
82 if (GetShelfLayoutManager()->visibility_state() == ash::SHELF_HIDDEN) | 82 if (GetShelfLayoutManager()->visibility_state() == ash::SHELF_HIDDEN) |
83 return; | 83 return; |
84 | 84 |
85 if (type == ui::ET_GESTURE_SCROLL_BEGIN) { | 85 if (type == ui::ET_GESTURE_SCROLL_BEGIN) { |
86 scroll_ = gfx::Vector2dF(); | 86 scroll_ = gfx::Vector2dF(); |
87 was_visible_on_drag_start_ = GetShelfLayoutManager()->IsVisible(); | 87 was_visible_on_drag_start_ = GetShelfLayoutManager()->IsVisible(); |
88 return; | 88 return; |
89 } | 89 } |
90 | 90 |
sadrul
2013/04/15 22:33:03
Let's add an expectation here too: if the dimmer i
Harry McCleave
2013/04/15 22:41:25
Done.
| |
91 // The state of the shelf at the end of the gesture is tested separately. | 91 // The state of the shelf at the end of the gesture is tested separately. |
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()); |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
989 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 989 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
990 | 990 |
991 // Swipe up to show the shelf. | 991 // Swipe up to show the shelf. |
992 generator.GestureScrollSequenceWithCallback(end, start, | 992 generator.GestureScrollSequenceWithCallback(end, start, |
993 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 993 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
994 base::Bind(&ShelfDragCallback::ProcessScroll, | 994 base::Bind(&ShelfDragCallback::ProcessScroll, |
995 base::Unretained(&handler))); | 995 base::Unretained(&handler))); |
996 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); | 996 EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); |
997 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); | 997 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_NEVER, shelf->auto_hide_behavior()); |
998 EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString()); | 998 EXPECT_EQ(bounds_shelf.ToString(), window->bounds().ToString()); |
999 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), | |
1000 GetShelfWidget()->GetWindowBoundsInScreen()); | |
999 EXPECT_EQ(shelf_shown.ToString(), | 1001 EXPECT_EQ(shelf_shown.ToString(), |
1000 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 1002 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
1001 | 1003 |
1002 // Swipe up again. The shelf should hide. | 1004 // Swipe up again. The shelf should hide. |
1003 end.set_y(start.y() - 100); | 1005 end.set_y(start.y() - 100); |
1004 generator.GestureScrollSequenceWithCallback(start, end, | 1006 generator.GestureScrollSequenceWithCallback(start, end, |
1005 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 1007 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
1006 base::Bind(&ShelfDragCallback::ProcessScroll, | 1008 base::Bind(&ShelfDragCallback::ProcessScroll, |
1007 base::Unretained(&handler))); | 1009 base::Unretained(&handler))); |
1008 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1010 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
(...skipping 23 matching lines...) Expand all Loading... | |
1032 | 1034 |
1033 // Swipe down again to hide. | 1035 // Swipe down again to hide. |
1034 end.set_y(start.y() + 100); | 1036 end.set_y(start.y() + 100); |
1035 generator.GestureScrollSequenceWithCallback(start, end, | 1037 generator.GestureScrollSequenceWithCallback(start, end, |
1036 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, | 1038 base::TimeDelta::FromMilliseconds(10), kNumScrollSteps, |
1037 base::Bind(&ShelfDragCallback::ProcessScroll, | 1039 base::Bind(&ShelfDragCallback::ProcessScroll, |
1038 base::Unretained(&handler))); | 1040 base::Unretained(&handler))); |
1039 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1041 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1040 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 1042 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
1041 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); | 1043 EXPECT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shelf->auto_hide_behavior()); |
1044 EXPECT_EQ(GetShelfWidget()->GetDimmerBoundsForTest(), gfx::Rect()); | |
1042 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); | 1045 EXPECT_EQ(bounds_noshelf.ToString(), window->bounds().ToString()); |
1043 EXPECT_EQ(shelf_hidden.ToString(), | 1046 EXPECT_EQ(shelf_hidden.ToString(), |
1044 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); | 1047 GetShelfWidget()->GetWindowBoundsInScreen().ToString()); |
1045 | 1048 |
1046 // Make the window fullscreen. | 1049 // Make the window fullscreen. |
1047 widget->SetFullscreen(true); | 1050 widget->SetFullscreen(true); |
1048 gfx::Rect bounds_fullscreen = window->bounds(); | 1051 gfx::Rect bounds_fullscreen = window->bounds(); |
1049 EXPECT_TRUE(widget->IsFullscreen()); | 1052 EXPECT_TRUE(widget->IsFullscreen()); |
1050 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); | 1053 EXPECT_NE(bounds_noshelf.ToString(), bounds_fullscreen.ToString()); |
1051 EXPECT_EQ(SHELF_HIDDEN, shelf->visibility_state()); | 1054 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()); | 1326 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); |
1324 } else { | 1327 } else { |
1325 EXPECT_FALSE(shelf->IsVisible()); | 1328 EXPECT_FALSE(shelf->IsVisible()); |
1326 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1329 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
1327 } | 1330 } |
1328 } | 1331 } |
1329 } | 1332 } |
1330 | 1333 |
1331 } // namespace internal | 1334 } // namespace internal |
1332 } // namespace ash | 1335 } // namespace ash |
OLD | NEW |