Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Side by Side Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 2790943003: Add ability to have active window autohide shelf (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/wm/window_state.cc ('k') | ash/wm/window_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 generator.GestureScrollSequence(start, end, 1476 generator.GestureScrollSequence(start, end,
1477 base::TimeDelta::FromMilliseconds(10), 1); 1477 base::TimeDelta::FromMilliseconds(10), 1);
1478 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); 1478 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
1479 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); 1479 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
1480 ShelfAnimationWaiter waiter2(auto_hidden_bounds); 1480 ShelfAnimationWaiter waiter2(auto_hidden_bounds);
1481 waiter2.WaitTillDoneAnimating(); 1481 waiter2.WaitTillDoneAnimating();
1482 EXPECT_TRUE(waiter2.WasValidAnimation()); 1482 EXPECT_TRUE(waiter2.WasValidAnimation());
1483 } 1483 }
1484 } 1484 }
1485 1485
1486 TEST_F(ShelfLayoutManagerTest, AutohideShelfForAutohideWhenActiveWindow) {
1487 WmShelf* shelf = GetPrimaryShelf();
1488
1489 views::Widget* widget_one = CreateTestWidget();
1490 views::Widget* widget_two = CreateTestWidget();
1491 aura::Window* window_two = widget_two->GetNativeWindow();
1492
1493 // Turn on hide_shelf_when_active behavior for window two - shelf should
1494 // still be visible when window two is made active since it is not yet
1495 // maximized.
1496 widget_one->Activate();
1497 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1498 wm::GetWindowState(window_two)
1499 ->set_autohide_shelf_when_maximized_or_fullscreen(true);
1500 widget_two->Activate();
1501 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1502
1503 // Now the flag takes effect once window two is maximized.
1504 widget_two->Maximize();
1505 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
1506
1507 // The hide_shelf_when_active flag should override the behavior of the
1508 // hide_shelf_when_fullscreen flag even if the window is currently fullscreen.
1509 wm::GetWindowState(window_two)->set_hide_shelf_when_fullscreen(false);
1510 widget_two->SetFullscreen(true);
1511 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
1512 wm::GetWindowState(window_two)->Restore();
1513
1514 // With the flag off, shelf no longer auto-hides.
1515 widget_one->Activate();
1516 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1517 wm::GetWindowState(window_two)
1518 ->set_autohide_shelf_when_maximized_or_fullscreen(false);
1519 widget_two->Activate();
1520 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1521 }
1522
1486 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { 1523 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) {
1487 // TODO: investigate failure in mash, http://crbug.com/695686. 1524 // TODO: investigate failure in mash, http://crbug.com/695686.
1488 if (WmShell::Get()->IsRunningInMash()) 1525 if (WmShell::Get()->IsRunningInMash())
1489 return; 1526 return;
1490 1527
1491 WmShelf* shelf = GetPrimaryShelf(); 1528 WmShelf* shelf = GetPrimaryShelf();
1492 1529
1493 // Create a visible window so auto-hide behavior is enforced. 1530 // Create a visible window so auto-hide behavior is enforced.
1494 CreateTestWidget(); 1531 CreateTestWidget();
1495 1532
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 // Open keyboard in sticky mode. 1846 // Open keyboard in sticky mode.
1810 kb_controller->ShowKeyboard(true); 1847 kb_controller->ShowKeyboard(true);
1811 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); 1848 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds());
1812 1849
1813 // Work area should be changed. 1850 // Work area should be changed.
1814 EXPECT_NE(orig_work_area, 1851 EXPECT_NE(orig_work_area,
1815 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1852 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1816 } 1853 }
1817 1854
1818 } // namespace ash 1855 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/window_state.cc ('k') | ash/wm/window_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698