| 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/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
| 8 #include "ash/common/accelerators/accelerator_table.h" | 8 #include "ash/common/accelerators/accelerator_table.h" |
| 9 #include "ash/common/focus_cycler.h" | 9 #include "ash/common/focus_cycler.h" |
| 10 #include "ash/common/material_design/material_design_controller.h" | 10 #include "ash/common/material_design/material_design_controller.h" |
| (...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 StatusAreaWidget* status_area_widget = | 1532 StatusAreaWidget* status_area_widget = |
| 1533 shelf->shelf_widget()->status_area_widget(); | 1533 shelf->shelf_widget()->status_area_widget(); |
| 1534 SystemTray* tray = GetPrimarySystemTray(); | 1534 SystemTray* tray = GetPrimarySystemTray(); |
| 1535 | 1535 |
| 1536 // Create a visible window so auto-hide behavior is enforced. | 1536 // Create a visible window so auto-hide behavior is enforced. |
| 1537 CreateTestWidget(); | 1537 CreateTestWidget(); |
| 1538 | 1538 |
| 1539 layout_manager->LayoutShelf(); | 1539 layout_manager->LayoutShelf(); |
| 1540 ui::test::EventGenerator& generator(GetEventGenerator()); | 1540 ui::test::EventGenerator& generator(GetEventGenerator()); |
| 1541 | 1541 |
| 1542 // Make two iterations - first without a message bubble which should make | 1542 // Make sure the shelf is visible and position the mouse over it. Then |
| 1543 // the shelf disappear and then with a message bubble which should keep it | 1543 // allow auto hide. |
| 1544 // visible. | 1544 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1545 for (int i = 0; i < 2; i++) { | 1545 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
| 1546 // Make sure the shelf is visible and position the mouse over it. Then | 1546 gfx::Point center = |
| 1547 // allow auto hide. | 1547 status_area_widget->GetWindowBoundsInScreen().CenterPoint(); |
| 1548 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1548 generator.MoveMouseTo(center.x(), center.y()); |
| 1549 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1549 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1550 gfx::Point center = | 1550 EXPECT_TRUE(layout_manager->IsVisible()); |
| 1551 status_area_widget->GetWindowBoundsInScreen().CenterPoint(); | 1551 // Make sure there is no bubble. |
| 1552 generator.MoveMouseTo(center.x(), center.y()); | 1552 tray->CloseSystemBubble(); |
| 1553 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1553 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
| 1554 EXPECT_TRUE(layout_manager->IsVisible()); | 1554 // Move the pointer over the edge of the shelf. |
| 1555 if (!i) { | 1555 generator.MoveMouseTo(center.x(), |
| 1556 // In our first iteration we make sure there is no bubble. | 1556 status_area_widget->GetWindowBoundsInScreen().y() - 8); |
| 1557 tray->CloseSystemBubble(); | 1557 layout_manager->UpdateVisibilityState(); |
| 1558 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | 1558 EXPECT_FALSE(layout_manager->IsVisible()); |
| 1559 } else { | 1559 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); |
| 1560 // In our second iteration we show a bubble. | |
| 1561 test::TestSystemTrayItem* item = new test::TestSystemTrayItem(); | |
| 1562 tray->AddTrayItem(base::WrapUnique(item)); | |
| 1563 tray->ShowNotificationView(item); | |
| 1564 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | |
| 1565 } | |
| 1566 // Move the pointer over the edge of the shelf. | |
| 1567 generator.MoveMouseTo( | |
| 1568 center.x(), status_area_widget->GetWindowBoundsInScreen().y() - 8); | |
| 1569 layout_manager->UpdateVisibilityState(); | |
| 1570 if (i) { | |
| 1571 EXPECT_TRUE(layout_manager->IsVisible()); | |
| 1572 EXPECT_TRUE(status_area_widget->IsMessageBubbleShown()); | |
| 1573 } else { | |
| 1574 EXPECT_FALSE(layout_manager->IsVisible()); | |
| 1575 EXPECT_FALSE(status_area_widget->IsMessageBubbleShown()); | |
| 1576 } | |
| 1577 } | |
| 1578 } | 1560 } |
| 1579 | 1561 |
| 1580 TEST_F(ShelfLayoutManagerTest, BackgroundTypeWhenLockingScreen) { | 1562 TEST_F(ShelfLayoutManagerTest, BackgroundTypeWhenLockingScreen) { |
| 1581 EXPECT_NE(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1563 EXPECT_NE(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1582 | 1564 |
| 1583 Shell::GetInstance() | 1565 Shell::GetInstance() |
| 1584 ->lock_state_controller() | 1566 ->lock_state_controller() |
| 1585 ->StartLockAnimationAndLockImmediately(false); | 1567 ->StartLockAnimationAndLockImmediately(false); |
| 1586 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1568 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1587 } | 1569 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1836 // Open keyboard in sticky mode. | 1818 // Open keyboard in sticky mode. |
| 1837 kb_controller->ShowKeyboard(true); | 1819 kb_controller->ShowKeyboard(true); |
| 1838 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 1820 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 1839 | 1821 |
| 1840 // Work area should be changed. | 1822 // Work area should be changed. |
| 1841 EXPECT_NE(orig_work_area, | 1823 EXPECT_NE(orig_work_area, |
| 1842 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 1824 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 1843 } | 1825 } |
| 1844 | 1826 |
| 1845 } // namespace ash | 1827 } // namespace ash |
| OLD | NEW |