Commit 7bf57266 authored by Min Chen's avatar Min Chen Committed by Commit Bot

Restore backdrop if dismissed app list.

Use GetTargetVisibility instead of IsVisible to determine whether we should
hide or show the backdrop according to visibility of the app list. Since we
can get the app list visibility change notification immediately through
GetTargetVisibility regardless of the animation.

Bug: 760359
Change-Id: I8b1494144e541b4a646026c285151f524f0cb91b
Reviewed-on: https://chromium-review.googlesource.com/1025215Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Commit-Queue: Min Chen <minch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553256}
parent 45696485
......@@ -37,6 +37,10 @@ void AppListTestHelper::ShowAndRunLoop(uint64_t display_id) {
ShowAndRunLoop(display_id, app_list::AppListShowSource::kSearchKey);
}
void AppListTestHelper::Show(uint64_t display_id) {
ShowAndRunLoop(display_id, app_list::AppListShowSource::kSearchKey);
}
void AppListTestHelper::ShowAndRunLoop(
uint64_t display_id,
app_list::AppListShowSource show_source) {
......@@ -49,6 +53,10 @@ void AppListTestHelper::DismissAndRunLoop() {
WaitUntilIdle();
}
void AppListTestHelper::Dismiss() {
app_list_controller_->DismissAppList();
}
void AppListTestHelper::ToggleAndRunLoop(uint64_t display_id) {
ToggleAndRunLoop(display_id, app_list::AppListShowSource::kSearchKey);
}
......
......@@ -29,6 +29,9 @@ class AppListTestHelper {
// Note: we usually don't care about the show source in tests.
void ShowAndRunLoop(uint64_t display_id);
// Show the app list in |display_id|.
void Show(uint64_t display_id);
// Show the app list in |display_id| triggered with |show_source|, and wait
// until animation and mojo calls finish.
void ShowAndRunLoop(uint64_t display_id,
......@@ -37,6 +40,9 @@ class AppListTestHelper {
// Dismiss the app list, and wait until animation and mojo calls finish.
void DismissAndRunLoop();
// Dismiss the app list.
void Dismiss();
// Toggle the app list in |display_id|, and wait until animation and mojo
// calls finish.
// Note: we usually don't care about the show source in tests.
......
......@@ -125,7 +125,7 @@ void BackdropController::UpdateBackdrop() {
AppListControllerImpl* app_list_controller =
Shell::Get()->app_list_controller();
// Only hide the backdrop of the display that launcher is opened at.
if (app_list_controller && app_list_controller->IsVisible() &&
if (app_list_controller && app_list_controller->GetTargetVisibility() &&
container_->GetRootWindow() == app_list_controller->presenter()
->GetView()
->GetWidget()
......
......@@ -1537,12 +1537,14 @@ TEST_F(WorkspaceLayoutManagerBackdropTest,
ShowTopWindowBackdropForContainer(default_container(), true);
EXPECT_TRUE(test_helper.GetBackdropWindow());
ui::ScopedAnimationDurationScaleMode test_duration_mode(
ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION);
EXPECT_TRUE(test_helper.GetBackdropWindow());
// Showing the fullscreen app list should hide the backdrop.
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplay().id());
GetAppListTestHelper()->Show(GetPrimaryDisplay().id());
EXPECT_FALSE(test_helper.GetBackdropWindow());
// Dismissing the app list should cause the backdrop to be shown again.
GetAppListTestHelper()->DismissAndRunLoop();
GetAppListTestHelper()->Dismiss();
EXPECT_TRUE(test_helper.GetBackdropWindow());
}
......
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