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 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1694 // Test the shelf animates back to its original visible bounds when it is | 1694 // Test the shelf animates back to its original visible bounds when it is |
1695 // dragged when there are no visible windows. | 1695 // dragged when there are no visible windows. |
1696 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 1696 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
1697 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1697 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1698 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1698 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1699 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); | 1699 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
1700 gfx::Rect visible_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); | 1700 gfx::Rect visible_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); |
1701 { | 1701 { |
1702 // Enable animations so that we can make sure that they occur. | 1702 // Enable animations so that we can make sure that they occur. |
1703 ui::ScopedAnimationDurationScaleMode regular_animations( | 1703 ui::ScopedAnimationDurationScaleMode regular_animations( |
1704 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); | 1704 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
1705 | 1705 |
1706 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 1706 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
1707 gfx::Rect shelf_bounds_in_screen = | 1707 gfx::Rect shelf_bounds_in_screen = |
1708 GetShelfWidget()->GetWindowBoundsInScreen(); | 1708 GetShelfWidget()->GetWindowBoundsInScreen(); |
1709 gfx::Point start(shelf_bounds_in_screen.CenterPoint()); | 1709 gfx::Point start(shelf_bounds_in_screen.CenterPoint()); |
1710 gfx::Point end(start.x(), shelf_bounds_in_screen.bottom()); | 1710 gfx::Point end(start.x(), shelf_bounds_in_screen.bottom()); |
1711 generator.GestureScrollSequence(start, end, | 1711 generator.GestureScrollSequence(start, end, |
1712 base::TimeDelta::FromMilliseconds(10), 5); | 1712 base::TimeDelta::FromMilliseconds(10), 5); |
1713 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1713 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1714 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); | 1714 EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); |
1715 | 1715 |
1716 ShelfAnimationWaiter waiter(visible_bounds); | 1716 ShelfAnimationWaiter waiter(visible_bounds); |
1717 // Wait till the animation completes and check that it occurred. | 1717 // Wait till the animation completes and check that it occurred. |
1718 waiter.WaitTillDoneAnimating(); | 1718 waiter.WaitTillDoneAnimating(); |
1719 EXPECT_TRUE(waiter.WasValidAnimation()); | 1719 EXPECT_TRUE(waiter.WasValidAnimation()); |
1720 } | 1720 } |
1721 | 1721 |
1722 // Create a visible window so auto-hide behavior is enforced. | 1722 // Create a visible window so auto-hide behavior is enforced. |
1723 CreateTestWidget(); | 1723 CreateTestWidget(); |
1724 | 1724 |
1725 // Get the bounds of the shelf when it is hidden. | 1725 // Get the bounds of the shelf when it is hidden. |
1726 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); | 1726 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); |
1727 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); | 1727 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); |
1728 gfx::Rect auto_hidden_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); | 1728 gfx::Rect auto_hidden_bounds = GetShelfWidget()->GetWindowBoundsInScreen(); |
1729 | 1729 |
1730 { | 1730 { |
1731 // Enable the animations so that we can make sure they do occur. | 1731 // Enable the animations so that we can make sure they do occur. |
1732 ui::ScopedAnimationDurationScaleMode regular_animations( | 1732 ui::ScopedAnimationDurationScaleMode regular_animations( |
1733 ui::ScopedAnimationDurationScaleMode::NORMAL_DURATION); | 1733 ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); |
1734 | 1734 |
1735 gfx::Point start = | 1735 gfx::Point start = |
1736 GetShelfWidget()->GetWindowBoundsInScreen().CenterPoint(); | 1736 GetShelfWidget()->GetWindowBoundsInScreen().CenterPoint(); |
1737 gfx::Point end(start.x(), start.y() - 100); | 1737 gfx::Point end(start.x(), start.y() - 100); |
1738 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); | 1738 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); |
1739 | 1739 |
1740 // Test that the shelf animates to the visible bounds after a swipe up on | 1740 // Test that the shelf animates to the visible bounds after a swipe up on |
1741 // the auto hidden shelf. | 1741 // the auto hidden shelf. |
1742 generator.GestureScrollSequence(start, end, | 1742 generator.GestureScrollSequence(start, end, |
1743 base::TimeDelta::FromMilliseconds(10), 1); | 1743 base::TimeDelta::FromMilliseconds(10), 1); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | 2071 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_ALWAYS_HIDDEN); |
2072 gfx::Rect hide_target_bounds = status_window->GetTargetBounds(); | 2072 gfx::Rect hide_target_bounds = status_window->GetTargetBounds(); |
2073 EXPECT_GT(hide_target_bounds.y(), initial_bounds.y()); | 2073 EXPECT_GT(hide_target_bounds.y(), initial_bounds.y()); |
2074 | 2074 |
2075 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 2075 shelf_manager->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
2076 gfx::Rect reshow_target_bounds = status_window->GetTargetBounds(); | 2076 gfx::Rect reshow_target_bounds = status_window->GetTargetBounds(); |
2077 EXPECT_EQ(initial_bounds, reshow_target_bounds); | 2077 EXPECT_EQ(initial_bounds, reshow_target_bounds); |
2078 } | 2078 } |
2079 | 2079 |
2080 } // namespace ash | 2080 } // namespace ash |
OLD | NEW |