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/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 | 1067 |
1068 Shelf* shelf = GetShelf(); | 1068 Shelf* shelf = GetShelf(); |
1069 views::Widget* widget = new views::Widget; | 1069 views::Widget* widget = new views::Widget; |
1070 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); | 1070 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
1071 params.bounds = gfx::Rect(0, 0, 200, 200); | 1071 params.bounds = gfx::Rect(0, 0, 200, 200); |
1072 params.context = CurrentContext(); | 1072 params.context = CurrentContext(); |
1073 // Widget is now owned by the parent window. | 1073 // Widget is now owned by the parent window. |
1074 widget->Init(params); | 1074 widget->Init(params); |
1075 widget->Show(); | 1075 widget->Show(); |
1076 aura::Window* window = widget->GetNativeWindow(); | 1076 aura::Window* window = widget->GetNativeWindow(); |
1077 gfx::Rect display_bounds( | |
1078 display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); | |
1079 | 1077 |
1080 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1078 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1081 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1079 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1082 | 1080 |
1083 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1081 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
1084 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1082 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1085 | 1083 |
1086 widget->Maximize(); | 1084 widget->Maximize(); |
1087 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1085 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1088 EXPECT_EQ(display::Screen::GetScreen() | 1086 EXPECT_EQ(display::Screen::GetScreen() |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 params.context = CurrentContext(); | 1752 params.context = CurrentContext(); |
1755 widget->Init(params); | 1753 widget->Init(params); |
1756 widget->Show(); | 1754 widget->Show(); |
1757 widget->Maximize(); | 1755 widget->Maximize(); |
1758 | 1756 |
1759 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 1757 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
1760 | 1758 |
1761 aura::Window* window = widget->GetNativeWindow(); | 1759 aura::Window* window = widget->GetNativeWindow(); |
1762 layout_manager->LayoutShelf(); | 1760 layout_manager->LayoutShelf(); |
1763 | 1761 |
1764 gfx::Rect shelf_shown = GetShelfWidget()->GetWindowBoundsInScreen(); | |
1765 gfx::Rect bounds_shelf = window->bounds(); | |
1766 | |
1767 // Edge swipe when SHELF_VISIBLE should not change visibility state. | 1762 // Edge swipe when SHELF_VISIBLE should not change visibility state. |
1768 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1763 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1769 generator.GestureEdgeSwipe(); | 1764 generator.GestureEdgeSwipe(); |
1770 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); | 1765 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
1771 | 1766 |
1772 // Edge swipe when AUTO_HIDE_HIDDEN should change to AUTO_HIDE_SHOWN. | 1767 // Edge swipe when AUTO_HIDE_HIDDEN should change to AUTO_HIDE_SHOWN. |
1773 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1768 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1774 layout_manager->LayoutShelf(); | 1769 layout_manager->LayoutShelf(); |
1775 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1770 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
1776 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 1771 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2319 ->shelf_widget() | 2314 ->shelf_widget() |
2320 ->status_area_widget(); | 2315 ->status_area_widget(); |
2321 EXPECT_TRUE(status_area_widget->IsVisible()); | 2316 EXPECT_TRUE(status_area_widget->IsVisible()); |
2322 // Shelf should be in the first display's area. | 2317 // Shelf should be in the first display's area. |
2323 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 2318 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
2324 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 2319 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
2325 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 2320 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
2326 } | 2321 } |
2327 | 2322 |
2328 } // namespace ash | 2323 } // namespace ash |
OLD | NEW |