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