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

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

Issue 2782223002: Add ability to have active window autohide shelf (Closed)
Patch Set: Rebase 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 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // still be visible when window two is made active since it is not yet
1497 // maximized.
1498 widget_one->Activate();
1499 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1500 wm::GetWindowState(window_two)
1501 ->set_autohide_shelf_when_maximized_or_fullscreen(true);
1502 widget_two->Activate();
1503 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1504
1505 // Now the flag takes effect once window two is maximized.
1506 widget_two->Maximize();
1507 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
1508
1509 // The hide_shelf_when_active flag should override the behavior of the
1510 // hide_shelf_when_fullscreen flag even if the window is currently fullscreen.
1511 wm::GetWindowState(window_two)->set_hide_shelf_when_fullscreen(false);
1512 widget_two->SetFullscreen(true);
1513 EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
1514 wm::GetWindowState(window_two)->Restore();
1515
1516 // With the flag off, shelf no longer auto-hides.
1517 widget_one->Activate();
1518 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1519 wm::GetWindowState(window_two)
1520 ->set_autohide_shelf_when_maximized_or_fullscreen(false);
1521 widget_two->Activate();
1522 EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
1523 }
1524
1488 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { 1525 TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) {
1489 // TODO: investigate failure in mash, http://crbug.com/695686. 1526 // TODO: investigate failure in mash, http://crbug.com/695686.
1490 if (WmShell::Get()->IsRunningInMash()) 1527 if (WmShell::Get()->IsRunningInMash())
1491 return; 1528 return;
1492 1529
1493 WmShelf* shelf = GetPrimaryShelf(); 1530 WmShelf* shelf = GetPrimaryShelf();
1494 1531
1495 // Create a visible window so auto-hide behavior is enforced. 1532 // Create a visible window so auto-hide behavior is enforced.
1496 CreateTestWidget(); 1533 CreateTestWidget();
1497 1534
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 // Open keyboard in sticky mode. 1842 // Open keyboard in sticky mode.
1806 kb_controller->ShowKeyboard(true); 1843 kb_controller->ShowKeyboard(true);
1807 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); 1844 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds());
1808 1845
1809 // Work area should be changed. 1846 // Work area should be changed.
1810 EXPECT_NE(orig_work_area, 1847 EXPECT_NE(orig_work_area,
1811 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1848 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1812 } 1849 }
1813 1850
1814 } // namespace ash 1851 } // 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