Commit 82741a60 authored by min c's avatar min c Committed by Commit Bot

Revert "Revert "Dragging up on app list button to open the launcher.""

This reverts commit 865d42f4.

Reason for revert: The flakiness in interactive_ui_tests in AppListTest.PressAppListButtonToShowAndDismiss (which is a test about the mouse event) seems not related with the change. Try to reland it.

Original change's description:
> Revert "Dragging up on app list button to open the launcher."
> 
> This reverts commit 60ef03d4.
> 
> Reason for revert: Causes flakiness in interactive_ui_tests in
> AppListTest.PressAppListButtonToShowAndDismiss on
> ChromiumOS on Linux (dbg).
> 
> https://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%28dbg%29%281%29/builds/30578
> 
> Original change's description:
> > Dragging up on app list button to open the launcher.
> > 
> > Changes,
> > 1. Don't handle the scroll gesture events in AppListButton::OnGestureEvent, let
> >    the ShelfView handle it instead.
> > 2. Add a test for the swiping on applist button to open launcher.
> > 
> > Bug: 758071
> > Change-Id: I71557411e9de6cd21bdb76c52dfb545a1e621783
> > Reviewed-on: https://chromium-review.googlesource.com/685535
> > Commit-Queue: min c <minch@chromium.org>
> > Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#504492}
> 
> TBR=xiyuan@chromium.org,minch@chromium.org
> 
> Change-Id: I0a09a59593521f2049e9a782cd5029312c61098b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 758071
> Reviewed-on: https://chromium-review.googlesource.com/685899
> Reviewed-by: Michael Giuffrida <michaelpg@chromium.org>
> Commit-Queue: Michael Giuffrida <michaelpg@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#504520}

TBR=xiyuan@chromium.org,michaelpg@chromium.org,minch@chromium.org

Change-Id: I3ca0e004c69dae81ca6abdd46285d129e3e40f4c
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 758071
Reviewed-on: https://chromium-review.googlesource.com/687876Reviewed-by: default avatarmin c <minch@chromium.org>
Commit-Queue: min c <minch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504739}
parent 27c33249
......@@ -148,17 +148,7 @@ void AppListButton::OnGestureEvent(ui::GestureEvent* event) {
switch (event->type()) {
case ui::ET_GESTURE_SCROLL_BEGIN:
AnimateInkDrop(views::InkDropState::HIDDEN, event);
shelf_view_->PointerPressedOnButton(this, ShelfView::TOUCH, *event);
event->SetHandled();
return;
case ui::ET_GESTURE_SCROLL_UPDATE:
shelf_view_->PointerDraggedOnButton(this, ShelfView::TOUCH, *event);
event->SetHandled();
return;
case ui::ET_GESTURE_SCROLL_END:
case ui::ET_SCROLL_FLING_START:
shelf_view_->PointerReleasedOnButton(this, ShelfView::TOUCH, false);
event->SetHandled();
ImageButton::OnGestureEvent(event);
return;
case ui::ET_GESTURE_TAP:
case ui::ET_GESTURE_TAP_CANCEL:
......
......@@ -4,9 +4,11 @@
#include "ash/shelf/app_list_button.h"
#include "ash/public/cpp/config.h"
#include "ash/root_window_controller.h"
#include "ash/session/session_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shelf/shelf_view_test_api.h"
#include "ash/shell.h"
......@@ -19,6 +21,7 @@
#include "ui/app_list/presenter/app_list.h"
#include "ui/app_list/presenter/test/test_app_list_presenter.h"
#include "ui/events/event_constants.h"
#include "ui/events/test/event_generator.h"
namespace ash {
......@@ -91,6 +94,34 @@ TEST_F(AppListButtonTest, LongPressGestureWithoutVoiceInteractionFlag) {
EXPECT_EQ(0u, test_app_list_presenter.voice_session_count());
}
TEST_F(AppListButtonTest, SwipingupToOpenFullscreenAppList) {
// TODO: investigate failure in mash, http://crbug.com/695686.
if (Shell::GetAshConfig() == Config::MASH)
return;
Shelf* shelf = GetPrimaryShelf();
EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, shelf->alignment());
// Start the drag from the center of the applist button's bottom.
gfx::Point center_point = app_list_button()->GetAppListButtonCenterPoint();
gfx::Point start(center_point.x(),
center_point.y() + app_list_button()->height() / 2.f);
views::View::ConvertPointToScreen(app_list_button(), &start);
// Swiping up less than peeking threshold should keep the app list at PEEKING
// state.
gfx::Point end =
start -
gfx::Vector2d(
0, ShelfLayoutManager::kAppListDragSnapToPeekingThreshold - 10);
GetEventGenerator().GestureScrollSequence(
start, end, base::TimeDelta::FromMilliseconds(100), 4 /* steps */);
RunAllPendingInMessageLoop();
EXPECT_EQ(1u, test_app_list_presenter.show_count());
EXPECT_GE(test_app_list_presenter.set_y_position_count(), 1u);
EXPECT_EQ(app_list::mojom::AppListState::PEEKING,
test_app_list_presenter.app_list_state());
}
class VoiceInteractionAppListButtonTest : public AppListButtonTest {
public:
VoiceInteractionAppListButtonTest() {}
......
......@@ -1656,6 +1656,7 @@ TEST_F(ShelfLayoutManagerFullscreenAppListTest,
test_app_list_presenter.app_list_state());
// Swiping up more than the close threshold but less than peeking threshold
// should keep the app list at PEEKING state.
delta.set_y(ShelfLayoutManager::kAppListDragSnapToPeekingThreshold - 10);
end = start - delta;
generator.GestureScrollSequence(start, end, kTimeDelta, kNumScrollSteps);
......
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