| 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/common/shelf/shelf_layout_manager.h" | 5 #include "ash/common/shelf/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_shelf_aura.h" | 7 #include "ash/aura/wm_shelf_aura.h" |
| 8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/accelerators/accelerator_table.h" | 10 #include "ash/common/accelerators/accelerator_table.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 namespace ash { | 59 namespace ash { |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 void StepWidgetLayerAnimatorToEnd(views::Widget* widget) { | 62 void StepWidgetLayerAnimatorToEnd(views::Widget* widget) { |
| 63 widget->GetNativeView()->layer()->GetAnimator()->Step( | 63 widget->GetNativeView()->layer()->GetAnimator()->Step( |
| 64 base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); | 64 base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 ShelfWidget* GetShelfWidget() { | 67 ShelfWidget* GetShelfWidget() { |
| 68 return test::AshTestBase::GetPrimaryShelf()->GetShelfWidgetForTesting(); | 68 return test::AshTestBase::GetPrimaryShelf()->shelf_widget(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 ShelfLayoutManager* GetShelfLayoutManager() { | 71 ShelfLayoutManager* GetShelfLayoutManager() { |
| 72 return test::AshTestBase::GetPrimaryShelf()->shelf_layout_manager(); | 72 return test::AshTestBase::GetPrimaryShelf()->shelf_layout_manager(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // Class which waits till the shelf finishes animating to the target size and | 75 // Class which waits till the shelf finishes animating to the target size and |
| 76 // counts the number of animation steps. | 76 // counts the number of animation steps. |
| 77 class ShelfAnimationWaiter : views::WidgetObserver { | 77 class ShelfAnimationWaiter : views::WidgetObserver { |
| 78 public: | 78 public: |
| (...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1773 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1774 EXPECT_FALSE(shelf_widget->GetDimsShelf()); | 1774 EXPECT_FALSE(shelf_widget->GetDimsShelf()); |
| 1775 } | 1775 } |
| 1776 | 1776 |
| 1777 // Make sure that the shelf will not hide if the mouse is between a bubble and | 1777 // Make sure that the shelf will not hide if the mouse is between a bubble and |
| 1778 // the shelf. | 1778 // the shelf. |
| 1779 TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) { | 1779 TEST_F(ShelfLayoutManagerTest, BubbleEnlargesShelfMouseHitArea) { |
| 1780 WmShelf* shelf = GetPrimaryShelf(); | 1780 WmShelf* shelf = GetPrimaryShelf(); |
| 1781 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); | 1781 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); |
| 1782 StatusAreaWidget* status_area_widget = | 1782 StatusAreaWidget* status_area_widget = |
| 1783 shelf->GetShelfWidgetForTesting()->status_area_widget(); | 1783 shelf->shelf_widget()->status_area_widget(); |
| 1784 SystemTray* tray = GetPrimarySystemTray(); | 1784 SystemTray* tray = GetPrimarySystemTray(); |
| 1785 | 1785 |
| 1786 // Create a visible window so auto-hide behavior is enforced. | 1786 // Create a visible window so auto-hide behavior is enforced. |
| 1787 CreateTestWidget(); | 1787 CreateTestWidget(); |
| 1788 | 1788 |
| 1789 layout_manager->LayoutShelf(); | 1789 layout_manager->LayoutShelf(); |
| 1790 ui::test::EventGenerator& generator(GetEventGenerator()); | 1790 ui::test::EventGenerator& generator(GetEventGenerator()); |
| 1791 | 1791 |
| 1792 // Make two iterations - first without a message bubble which should make | 1792 // Make two iterations - first without a message bubble which should make |
| 1793 // the shelf disappear and then with a message bubble which should keep it | 1793 // the shelf disappear and then with a message bubble which should keep it |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2076 // Open keyboard in sticky mode. | 2076 // Open keyboard in sticky mode. |
| 2077 kb_controller->ShowKeyboard(true); | 2077 kb_controller->ShowKeyboard(true); |
| 2078 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 2078 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 2079 | 2079 |
| 2080 // Work area should be changed. | 2080 // Work area should be changed. |
| 2081 EXPECT_NE(orig_work_area, | 2081 EXPECT_NE(orig_work_area, |
| 2082 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 2082 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 2083 } | 2083 } |
| 2084 | 2084 |
| 2085 } // namespace ash | 2085 } // namespace ash |
| OLD | NEW |