Commit 65ae5b21 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

shelf: Update shelf auto hide state for home launcher.

Test: added test
Bug: 850630
Change-Id: I50796ab56aa2888bd77d98389a7de876f42aa0d8
Reviewed-on: https://chromium-review.googlesource.com/1179303Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584078}
parent e95ea294
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/test_windows.h" #include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/display/display.h" #include "ui/display/display.h"
...@@ -502,6 +503,23 @@ TEST_F(AppListPresenterDelegateTest, ShelfBackgroundWithHomeLauncher) { ...@@ -502,6 +503,23 @@ TEST_F(AppListPresenterDelegateTest, ShelfBackgroundWithHomeLauncher) {
shelf_layout_manager->GetShelfBackgroundType()); shelf_layout_manager->GetShelfBackgroundType());
} }
// Tests that the bottom shelf is auto hidden when a window is fullscreened in
// tablet mode (home launcher is shown behind).
TEST_F(AppListPresenterDelegateTest, ShelfAutoHiddenWhenFullscreen) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
EnableTabletMode(true);
Shelf* shelf =
Shelf::ForWindow(Shell::GetRootWindowForDisplayId(GetPrimaryDisplayId()));
EXPECT_EQ(ShelfVisibilityState::SHELF_VISIBLE, shelf->GetVisibilityState());
// Create and fullscreen a window. The shelf should be auto hidden.
auto window = CreateTestWindow();
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
EXPECT_EQ(ShelfVisibilityState::SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(ShelfAutoHideState::SHELF_AUTO_HIDE_HIDDEN,
shelf->GetAutoHideState());
}
// Tests that the peeking app list closes if the user taps or clicks outside // Tests that the peeking app list closes if the user taps or clicks outside
// its bounds. // its bounds.
TEST_P(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) { TEST_P(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) {
......
...@@ -980,8 +980,12 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( ...@@ -980,8 +980,12 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
if (visibility_state != SHELF_AUTO_HIDE) if (visibility_state != SHELF_AUTO_HIDE)
return SHELF_AUTO_HIDE_HIDDEN; return SHELF_AUTO_HIDE_HIDDEN;
if (shelf_widget_->IsShowingAppList()) if (shelf_widget_->IsShowingAppList() &&
!Shell::Get()
->app_list_controller()
->IsHomeLauncherEnabledInTabletMode()) {
return SHELF_AUTO_HIDE_SHOWN; return SHELF_AUTO_HIDE_SHOWN;
}
if (shelf_widget_->status_area_widget() && if (shelf_widget_->status_area_widget() &&
shelf_widget_->status_area_widget()->ShouldShowShelf()) shelf_widget_->status_area_widget()->ShouldShowShelf())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment