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

Unified Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 2782223002: Add ability to have active window autohide shelf (Closed)
Patch Set: Add ability to have active window autohide shelf 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
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..3976cb6a7a60cfeade5a49f8de110118b5632142 100644
--- a/ash/shelf/shelf_layout_manager_unittest.cc
+++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -1485,6 +1485,36 @@ 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
+ // auto-hide when window two is made active.
+ widget_one->Activate();
+ EXPECT_EQ(SHELF_VISIBLE, shelf->GetVisibilityState());
+ wm::GetWindowState(window_two)->set_hide_shelf_when_active(true);
+ widget_two->Activate();
+ 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_hide_shelf_when_active(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())

Powered by Google App Engine
This is Rietveld 408576698