| 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/session/session_controller.h" | 10 #include "ash/common/session/session_controller.h" |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1542 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1542 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1543 | 1543 |
| 1544 // Again both windows should be of the same size. | 1544 // Again both windows should be of the same size. |
| 1545 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), | 1545 EXPECT_EQ(widget_one->GetNativeWindow()->bounds().ToString(), |
| 1546 widget_two->GetNativeWindow()->bounds().ToString()); | 1546 widget_two->GetNativeWindow()->bounds().ToString()); |
| 1547 EXPECT_EQ(area_when_shelf_shown, | 1547 EXPECT_EQ(area_when_shelf_shown, |
| 1548 widget_one->GetNativeWindow()->bounds().size().GetArea()); | 1548 widget_one->GetNativeWindow()->bounds().size().GetArea()); |
| 1549 } | 1549 } |
| 1550 | 1550 |
| 1551 TEST_F(ShelfLayoutManagerTest, BackgroundTypeWhenLockingScreen) { | 1551 TEST_F(ShelfLayoutManagerTest, BackgroundTypeWhenLockingScreen) { |
| 1552 EXPECT_NE(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1552 // Creates a maximized window to have a background type other than default. |
| 1553 std::unique_ptr<aura::Window> window(CreateTestWindow()); |
| 1554 window->Show(); |
| 1555 wm::ActivateWindow(window.get()); |
| 1556 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1557 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1558 EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType()); |
| 1553 | 1559 |
| 1554 Shell::GetInstance() | 1560 Shell::GetInstance() |
| 1555 ->lock_state_controller() | 1561 ->lock_state_controller() |
| 1556 ->StartLockAnimationAndLockImmediately(false); | 1562 ->StartLockAnimationAndLockImmediately(false); |
| 1557 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1563 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1558 } | 1564 } |
| 1559 | 1565 |
| 1560 TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColor) { | 1566 TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColor) { |
| 1561 // TODO(bruthig|xiyuan): Move SessionState setup into AshTestBase or | |
| 1562 // AshTestHelper. | |
| 1563 mojom::SessionInfoPtr info = mojom::SessionInfo::New(); | |
| 1564 info->state = session_manager::SessionState::ACTIVE; | |
| 1565 ash::WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); | |
| 1566 | |
| 1567 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1567 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1568 | 1568 |
| 1569 std::unique_ptr<aura::Window> w1(CreateTestWindow()); | 1569 std::unique_ptr<aura::Window> w1(CreateTestWindow()); |
| 1570 w1->Show(); | 1570 w1->Show(); |
| 1571 wm::ActivateWindow(w1.get()); | 1571 wm::ActivateWindow(w1.get()); |
| 1572 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1572 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1573 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 1573 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1574 EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType()); | 1574 EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType()); |
| 1575 | 1575 |
| 1576 std::unique_ptr<aura::Window> w2(CreateTestWindow()); | 1576 std::unique_ptr<aura::Window> w2(CreateTestWindow()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1589 | 1589 |
| 1590 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 1590 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1591 EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType()); | 1591 EXPECT_EQ(SHELF_BACKGROUND_MAXIMIZED, GetShelfWidget()->GetBackgroundType()); |
| 1592 w1.reset(); | 1592 w1.reset(); |
| 1593 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1593 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 // Verify that the shelf doesn't have the opaque background if it's auto-hide | 1596 // Verify that the shelf doesn't have the opaque background if it's auto-hide |
| 1597 // status. | 1597 // status. |
| 1598 TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) { | 1598 TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) { |
| 1599 // TODO(bruthig|xiyuan): Move SessionState setup into AshTestBase or | |
| 1600 // AshTestHelper. | |
| 1601 mojom::SessionInfoPtr info = mojom::SessionInfo::New(); | |
| 1602 info->state = session_manager::SessionState::ACTIVE; | |
| 1603 ash::WmShell::Get()->session_controller()->SetSessionInfo(std::move(info)); | |
| 1604 | |
| 1605 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); | 1599 EXPECT_EQ(SHELF_BACKGROUND_DEFAULT, GetShelfWidget()->GetBackgroundType()); |
| 1606 | 1600 |
| 1607 GetPrimaryShelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1601 GetPrimaryShelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1608 std::unique_ptr<aura::Window> w1(CreateTestWindow()); | 1602 std::unique_ptr<aura::Window> w1(CreateTestWindow()); |
| 1609 w1->Show(); | 1603 w1->Show(); |
| 1610 wm::ActivateWindow(w1.get()); | 1604 wm::ActivateWindow(w1.get()); |
| 1611 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType()); | 1605 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType()); |
| 1612 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 1606 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 1613 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType()); | 1607 EXPECT_EQ(SHELF_BACKGROUND_OVERLAP, GetShelfWidget()->GetBackgroundType()); |
| 1614 } | 1608 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 // Open keyboard in sticky mode. | 1805 // Open keyboard in sticky mode. |
| 1812 kb_controller->ShowKeyboard(true); | 1806 kb_controller->ShowKeyboard(true); |
| 1813 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 1807 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 1814 | 1808 |
| 1815 // Work area should be changed. | 1809 // Work area should be changed. |
| 1816 EXPECT_NE(orig_work_area, | 1810 EXPECT_NE(orig_work_area, |
| 1817 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 1811 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 1818 } | 1812 } |
| 1819 | 1813 |
| 1820 } // namespace ash | 1814 } // namespace ash |
| OLD | NEW |