Commit 236d3a7e authored by Alex Newcomer's avatar Alex Newcomer Committed by Commit Bot

cros: Launcher: Fixed OnMousePressed

OnMousePressed now properly returns true if the event is consumed. This
fixes the bug where unhandled mouse events were not propogating to the
AppListView.

Bug: 744778
Change-Id: I46cf1eb64994221b37ef186754d5409c5ddbd466
Reviewed-on: https://chromium-review.googlesource.com/589819Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Reviewed-by: default avatarDan Erat <derat@chromium.org>
Commit-Queue: Alex Newcomer <newcomer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491064}
parent e0d86cf9
...@@ -819,4 +819,27 @@ TEST_F(FullscreenAppListPresenterDelegateTest, WhitespaceQuery) { ...@@ -819,4 +819,27 @@ TEST_F(FullscreenAppListPresenterDelegateTest, WhitespaceQuery) {
EXPECT_EQ(view->app_list_state(), app_list::AppListView::PEEKING); EXPECT_EQ(view->app_list_state(), app_list::AppListView::PEEKING);
} }
// Tests that an unhandled tap/click in Peeking mode closes the app
// list.
TEST_P(FullscreenAppListPresenterDelegateTest, UnhandledEventOnPeeking) {
app_list_presenter_impl()->Show(GetPrimaryDisplayId());
app_list::AppListView* view = app_list_presenter_impl()->GetView();
ASSERT_EQ(view->app_list_state(), app_list::AppListView::PEEKING);
// Tap or click in the empty space below the searchbox. The app list should
// close.
gfx::Point empty_space =
view->search_box_view()->GetBoundsInScreen().bottom_left();
empty_space.Offset(0, 10);
ui::test::EventGenerator& generator = GetEventGenerator();
if (TestMouseEventParam()) {
generator.MoveMouseTo(empty_space);
generator.ClickLeftButton();
generator.ReleaseLeftButton();
} else {
generator.GestureTapAt(empty_space);
}
EXPECT_EQ(view->app_list_state(), app_list::AppListView::CLOSED);
}
} // namespace ash } // namespace ash
...@@ -436,7 +436,7 @@ bool StartPageView::OnMousePressed(const ui::MouseEvent& event) { ...@@ -436,7 +436,7 @@ bool StartPageView::OnMousePressed(const ui::MouseEvent& event) {
} }
MaybeOpenCustomLauncherPage(); MaybeOpenCustomLauncherPage();
return true; return IsCustomLauncherPageActive();
} }
bool StartPageView::OnMouseWheel(const ui::MouseWheelEvent& event) { bool StartPageView::OnMouseWheel(const ui::MouseWheelEvent& event) {
......
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