Commit 0af9e092 authored by Matthew Mourgos's avatar Matthew Mourgos Committed by Commit Bot

cros: All mouse scroll directions should push peeking launcher to fullscreen launcher

Bug: 912198
Change-Id: I9011485d088c1c08c11597543cb36bcb66766ea9
Reviewed-on: https://chromium-review.googlesource.com/c/1364331Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Matthew Mourgos <mmourgos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615661}
parent 939fae00
......@@ -1312,15 +1312,34 @@ TEST_F(AppListPresenterDelegateHomeLauncherTest, GestureScrollToDismiss) {
}
// Tests that the mouse-scroll cannot dismiss the app list.
TEST_F(AppListPresenterDelegateHomeLauncherTest, MouseScrollToDismiss) {
TEST_F(AppListPresenterDelegateHomeLauncherTest,
MouseScrollDoesntDismissPeekingLauncher) {
// Show app list in non-tablet mode. Mouse-scroll up.
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
GetAppListTestHelper()->CheckVisibility(true);
ui::test::EventGenerator* generator = GetEventGenerator();
generator->MoveMouseTo(GetPointOutsideSearchbox());
// Scroll up to get fullscreen.
generator->MoveMouseWheel(0, 1);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(false);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
GetAppListTestHelper()->CheckVisibility(true);
// Reset and show app list in non-tablet mode. Mouse-scroll down.
GetAppListTestHelper()->DismissAndRunLoop();
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
GetAppListTestHelper()->CheckVisibility(true);
// Scroll down to get fullscreen.
generator->MoveMouseWheel(0, -1);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
GetAppListTestHelper()->CheckVisibility(true);
// Show app list in tablet mode. Mouse-scroll up.
EnableTabletMode(true);
......@@ -1331,6 +1350,30 @@ TEST_F(AppListPresenterDelegateHomeLauncherTest, MouseScrollToDismiss) {
GetAppListTestHelper()->CheckVisibility(true);
}
// Tests that mouse-scroll up at fullscreen will dismiss app list.
TEST_F(AppListPresenterDelegateHomeLauncherTest,
MouseScrollToDismissFromFullscreen) {
// Show app list in non-tablet mode. Mouse-scroll down.
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
ui::test::EventGenerator* generator = GetEventGenerator();
generator->MoveMouseTo(GetPointOutsideSearchbox());
// Scroll up with mouse wheel to fullscreen.
generator->MoveMouseWheel(0, 1);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
GetAppListTestHelper()->CheckVisibility(true);
generator->MoveMouseTo(GetPointOutsideSearchbox());
// Scroll up with mouse wheel to close app list.
generator->MoveMouseWheel(0, 1);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests the app list opacity in overview mode.
TEST_F(AppListPresenterDelegateHomeLauncherTest, OpacityInOverviewMode) {
// Show app list in tablet mode.
......
......@@ -1151,22 +1151,26 @@ bool AppListView::HandleScroll(const gfx::Vector2d& offset,
return true;
}
// The AppList should not be dismissed with scroll in tablet mode.
if (is_tablet_mode())
return true;
// If the event is a mousewheel event, the offset is always large enough,
// otherwise the offset must be larger than the scroll threshold.
if (type == ui::ET_MOUSEWHEEL ||
abs(offset.y()) > kAppListMinScrollToSwitchStates) {
if (offset.y() > 0 && !is_tablet_mode()) {
if (app_list_state_ == AppListViewState::FULLSCREEN_ALL_APPS) {
if (offset.y() > 0)
Dismiss();
} else {
if (app_list_state_ == AppListViewState::FULLSCREEN_ALL_APPS)
return true;
}
SetState(AppListViewState::FULLSCREEN_ALL_APPS);
const AppListPeekingToFullscreenSource source =
type == ui::ET_MOUSEWHEEL ? kMousewheelScroll : kMousepadScroll;
UMA_HISTOGRAM_ENUMERATION(kAppListPeekingToFullscreenHistogram, source,
kMaxPeekingToFullscreen);
}
}
return true;
}
......
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