| 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 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 generator.GestureScrollSequence(start, end, | 1478 generator.GestureScrollSequence(start, end, |
| 1479 base::TimeDelta::FromMilliseconds(10), 1); | 1479 base::TimeDelta::FromMilliseconds(10), 1); |
| 1480 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); | 1480 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1481 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); | 1481 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); |
| 1482 ShelfAnimationWaiter waiter2(auto_hidden_bounds); | 1482 ShelfAnimationWaiter waiter2(auto_hidden_bounds); |
| 1483 waiter2.WaitTillDoneAnimating(); | 1483 waiter2.WaitTillDoneAnimating(); |
| 1484 EXPECT_TRUE(waiter2.WasValidAnimation()); | 1484 EXPECT_TRUE(waiter2.WasValidAnimation()); |
| 1485 } | 1485 } |
| 1486 } | 1486 } |
| 1487 | 1487 |
| 1488 TEST_F(ShelfLayoutManagerTest, AutohideShelfForAutohideWhenActiveWindow) { |
| 1489 WmShelf* shelf = GetPrimaryShelf(); |
| 1490 |
| 1491 views::Widget* widget_one = CreateTestWidget(); |
| 1492 views::Widget* widget_two = CreateTestWidget(); |
| 1493 aura::Window* window_two = widget_two->GetNativeWindow(); |
| 1494 |
| 1495 // Turn on hide_shelf_when_active behavior for window two - shelf should |
| 1496 // auto-hide when window two is made active. |
| 1497 widget_one->Activate(); |
| 1498 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1499 wm::GetWindowState(window_two)->set_hide_shelf_when_active(true); |
| 1500 widget_two->Activate(); |
| 1501 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1502 |
| 1503 // The hide_shelf_when_active flag should override the behavior of the |
| 1504 // hide_shelf_when_fullscreen flag even if the window is currently fullscreen. |
| 1505 wm::GetWindowState(window_two)->set_hide_shelf_when_fullscreen(false); |
| 1506 widget_two->SetFullscreen(true); |
| 1507 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); |
| 1508 wm::GetWindowState(window_two)->Restore(); |
| 1509 |
| 1510 // With the flag off, shelf no longer auto-hides. |
| 1511 widget_one->Activate(); |
| 1512 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1513 wm::GetWindowState(window_two)->set_hide_shelf_when_active(false); |
| 1514 widget_two->Activate(); |
| 1515 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState()); |
| 1516 } |
| 1517 |
| 1488 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { | 1518 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { |
| 1489 // TODO: investigate failure in mash, http://crbug.com/695686. | 1519 // TODO: investigate failure in mash, http://crbug.com/695686. |
| 1490 if (WmShell::Get()->IsRunningInMash()) | 1520 if (WmShell::Get()->IsRunningInMash()) |
| 1491 return; | 1521 return; |
| 1492 | 1522 |
| 1493 WmShelf* shelf = GetPrimaryShelf(); | 1523 WmShelf* shelf = GetPrimaryShelf(); |
| 1494 | 1524 |
| 1495 // Create a visible window so auto-hide behavior is enforced. | 1525 // Create a visible window so auto-hide behavior is enforced. |
| 1496 CreateTestWidget(); | 1526 CreateTestWidget(); |
| 1497 | 1527 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 // Open keyboard in sticky mode. | 1835 // Open keyboard in sticky mode. |
| 1806 kb_controller->ShowKeyboard(true); | 1836 kb_controller->ShowKeyboard(true); |
| 1807 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); | 1837 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); |
| 1808 | 1838 |
| 1809 // Work area should be changed. | 1839 // Work area should be changed. |
| 1810 EXPECT_NE(orig_work_area, | 1840 EXPECT_NE(orig_work_area, |
| 1811 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); | 1841 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); |
| 1812 } | 1842 } |
| 1813 | 1843 |
| 1814 } // namespace ash | 1844 } // namespace ash |
| OLD | NEW |