Commit 0c9ff20e authored by Ana Salazar's avatar Ana Salazar Committed by Commit Bot

Cros: Fix issue where hotseat activates with popup

Bug: 1018266
Change-Id: I4f8c301428a1f2009571a691b871eb1d760f0eb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888402
Commit-Queue: Ana Salazar <anasalazar@chromium.org>
Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711381}
parent d7aa4a59
...@@ -1092,6 +1092,11 @@ HotseatState ShelfLayoutManager::CalculateHotseatState( ...@@ -1092,6 +1092,11 @@ HotseatState ShelfLayoutManager::CalculateHotseatState(
!should_hide_hotseat_) { !should_hide_hotseat_) {
return HotseatState::kExtended; return HotseatState::kExtended;
} }
// If none of the conditions above were met means that the state
// changed because of an action other than a user intervention.
// We should hide the hotseat and reset the |is_manually extended|
// flag to false.
shelf_widget_->hotseat_widget()->set_manually_extended(false);
return HotseatState::kHidden; return HotseatState::kHidden;
} }
} }
......
...@@ -3958,6 +3958,32 @@ TEST_F(HotseatShelfLayoutManagerTest, ...@@ -3958,6 +3958,32 @@ TEST_F(HotseatShelfLayoutManagerTest,
GetShelfLayoutManager()->hotseat_state()); GetShelfLayoutManager()->hotseat_state());
} }
} }
// Tests that popups don't activate the hotseat. (crbug.com/1018266)
TEST_F(HotseatShelfLayoutManagerTest, HotseatRemainsHiddenIfPopupLaunched) {
// Go to in-app shelf and extend the hotseat.
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
SwipeUpOnShelf();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
// Hide hotseat by clicking outside its bounds.
gfx::Rect hotseat_bounds =
GetShelfWidget()->hotseat_widget()->GetWindowBoundsInScreen();
gfx::Point start = hotseat_bounds.top_center();
GetEventGenerator()->GestureTapAt(gfx::Point(start.x() + 1, start.y() - 1));
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
// Create a popup window and wait until all actions finish. The hotseat should
// remain hidden.
aura::Window* window_2 = CreateTestWindowInParent(window.get());
window_2->SetBounds(gfx::Rect(201, 0, 100, 100));
window_2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
window_2->Show();
GetAppListTestHelper()->WaitUntilIdle();
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
}
class ShelfLayoutManagerWindowDraggingTest : public ShelfLayoutManagerTestBase { class ShelfLayoutManagerWindowDraggingTest : public ShelfLayoutManagerTestBase {
public: public:
......
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