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

Unified 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, 9 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager_unittest.cc
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc
index 0f67f728e08f88ee6553968b3090ea88b9bea88a..5ea85267c1638689e81250911db8d869e1092fb7 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -1485,6 +1485,43 @@ TEST_F(ShelfLayoutManagerTest, ShelfAnimatesWhenGestureComplete) {
}
}
+TEST_F(ShelfLayoutManagerTest, AutohideShelfForAutohideWhenActiveWindow) {
+ WmShelf* shelf = GetPrimaryShelf();
+
+ views::Widget* widget_one = CreateTestWidget();
+ views::Widget* widget_two = CreateTestWidget();
+ aura::Window* window_two = widget_two->GetNativeWindow();
+
+ // Turn on hide_shelf_when_active behavior for window two - shelf should
+ // still be visible when window two is made active since it is not yet
+ // maximized.
+ widget_one->Activate();
+ EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
+ wm::GetWindowState(window_two)
+ ->set_autohide_shelf_when_maximized_or_fullscreen(true);
+ widget_two->Activate();
+ EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
+
+ // Now the flag takes effect once window two is maximized.
+ widget_two->Maximize();
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
+
+ // The hide_shelf_when_active flag should override the behavior of the
+ // hide_shelf_when_fullscreen flag even if the window is currently fullscreen.
+ wm::GetWindowState(window_two)->set_hide_shelf_when_fullscreen(false);
+ widget_two->SetFullscreen(true);
+ EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
+ wm::GetWindowState(window_two)->Restore();
+
+ // With the flag off, shelf no longer auto-hides.
+ widget_one->Activate();
+ EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
+ wm::GetWindowState(window_two)
+ ->set_autohide_shelf_when_maximized_or_fullscreen(false);
+ widget_two->Activate();
+ EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
+}
+
TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) {
// TODO: investigate failure in mash, http://crbug.com/695686.
if (WmShell::Get()->IsRunningInMash())
« 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