Commit a260f893 authored by Toni Barzic's avatar Toni Barzic Committed by Commit Bot

Mark hotseat manually extended only if gesture does not end in overview

When active window is drag from shelf to overview, the hotseat will get
into extended state, but we should not mark it as manually extended -
the hotseat is extended because that's the state expected in overview,
not because of the result of the gesture performed by the user.

BUG=1019440

Change-Id: I3724946a5b89a16a574551f23c447cf1d6509859
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1900349
Commit-Queue: Toni Baržić <tbarzic@chromium.org>
Reviewed-by: default avatarManu Cornet <manucornet@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712843}
parent 016b8002
......@@ -2288,8 +2288,12 @@ void ShelfLayoutManager::CancelDrag() {
UpdateVisibilityState();
}
if (hotseat_is_in_drag_) {
// If the gesture started the overview session, the hotseat will be
// extended, but should not be marked as manually extended, as
// extending the hotseat was not the primary goal of the gesture.
shelf_widget_->hotseat_widget()->set_manually_extended(
hotseat_state() == HotseatState::kExtended);
hotseat_state() == HotseatState::kExtended &&
!Shell::Get()->overview_controller()->InOverviewSession());
}
hotseat_is_in_drag_ = false;
drag_status_ = kDragNone;
......
......@@ -3661,6 +3661,56 @@ TEST_P(HotseatShelfLayoutManagerTest, DragActiveWindowInTabletMode) {
EXPECT_TRUE(window->layer()->transform().IsIdentity());
}
// Tests that when hotseat and drag-window-to-overview features are both
// enabled, hotseat is not extended after dragging a window to overview, and
// then activating the window.
TEST_P(HotseatShelfLayoutManagerTest, ExitingOvervieHidesHotseat) {
base::test::ScopedFeatureList scoped_features;
scoped_features.InitAndEnableFeature(
features::kDragFromShelfToHomeOrOverview);
const ShelfAutoHideBehavior auto_hide_behavior = GetParam();
GetPrimaryShelf()->SetAutoHideBehavior(auto_hide_behavior);
TabletModeControllerTestApi().EnterTabletMode();
std::unique_ptr<aura::Window> window =
AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
wm::ActivateWindow(window.get());
// If the shelf is auto-hidden, swipe up to bring up shelf and hotseat first
// (otherwise, the window drag to overview will not be handled).
if (auto_hide_behavior == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) {
SwipeUpOnShelf();
ASSERT_EQ(HotseatState::kExtended,
GetShelfLayoutManager()->hotseat_state());
}
// Swipe up to start dragging the active window.
const gfx::Rect bottom_shelf_bounds =
GetShelfWidget()->GetWindowBoundsInScreen();
StartScroll(bottom_shelf_bounds.CenterPoint());
// Drag upward, to the center of the screen, and release (this should enter
// the overview).
const gfx::Rect display_bounds =
display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
UpdateScroll(display_bounds.CenterPoint().y() -
bottom_shelf_bounds.CenterPoint().y());
// Small scroll update, to simulate the user holding the pointer.
UpdateScroll(2);
EndScroll(/*is_fling=*/false, 0.f);
OverviewController* overview_controller = Shell::Get()->overview_controller();
EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
EXPECT_TRUE(overview_controller->InOverviewSession());
// Activate the window - the overview session should exit, and hotseat should
// be hidden.
wm::ActivateWindow(window.get());
EXPECT_FALSE(overview_controller->InOverviewSession());
EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
}
// Tests that swiping downward, towards the bezel, from a variety of points
// results in hiding the hotseat.
TEST_F(HotseatShelfLayoutManagerTest, HotseatHidesWhenSwipedToBezel) {
......
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