Commit adf5debb authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

Cros: Fix launcher disappearing after screen rotates.

AppListControllerImpl::OnDisplayConfigurationChanged is called when the
screen rotates.

We recently refactored some visibility functions, this caused the bug.
We should check presenters visibility, not the target visibility.

Bug: 1012432
Change-Id: I2033484115de22f72fac997258c4013872e2d784
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1861154
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706229}
parent 96ee5aba
...@@ -655,7 +655,7 @@ void AppListControllerImpl::OnDisplayConfigurationChanged() { ...@@ -655,7 +655,7 @@ void AppListControllerImpl::OnDisplayConfigurationChanged() {
// expected if it's enabled and we're still in tablet mode. // expected if it's enabled and we're still in tablet mode.
// https://crbug.com/900956. // https://crbug.com/900956.
const bool should_be_shown = IsTabletMode(); const bool should_be_shown = IsTabletMode();
if (should_be_shown == GetTargetVisibility()) if (should_be_shown == presenter_.GetTargetVisibility())
return; return;
if (should_be_shown) if (should_be_shown)
......
...@@ -6,11 +6,16 @@ ...@@ -6,11 +6,16 @@
#include <memory> #include <memory>
#include "ash/app_list/app_list_controller_impl.h"
#include "ash/home_screen/home_screen_delegate.h"
#include "ash/public/cpp/test/shell_test_api.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
#include "ash/wm/overview/overview_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h" #include "ash/wm/window_state.h"
#include "base/macros.h" #include "base/macros.h"
#include "ui/aura/window.h"
namespace ash { namespace ash {
namespace { namespace {
...@@ -49,5 +54,25 @@ TEST_F(HomeScreenControllerTest, OnlyMinimizeCycleListWindows) { ...@@ -49,5 +54,25 @@ TEST_F(HomeScreenControllerTest, OnlyMinimizeCycleListWindows) {
ASSERT_FALSE(WindowState::Get(w2.get())->IsMinimized()); ASSERT_FALSE(WindowState::Get(w2.get())->IsMinimized());
} }
// Tests that the home screen is visible after rotating the screen in overview
// mode.
TEST_F(HomeScreenControllerTest,
HomeScreenVisibleAfterDisplayUpdateInOverview) {
Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true);
OverviewController* overview_controller = Shell::Get()->overview_controller();
overview_controller->StartOverview();
// Trigger a display configuration change, this simulates screen rotation.
Shell::Get()->app_list_controller()->OnDisplayConfigurationChanged();
// End overview mode, the home launcher should be visible.
overview_controller->EndOverview();
ShellTestApi().WaitForOverviewAnimationState(
OverviewAnimationState::kExitAnimationComplete);
EXPECT_TRUE(
home_screen_controller()->delegate()->GetHomeScreenWindow()->IsVisible());
}
} // namespace } // namespace
} // namespace ash } // namespace ash
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