Chromium Code Reviews| Index: ash/app_list/app_list_presenter_delegate_unittest.cc |
| diff --git a/ash/app_list/app_list_presenter_delegate_unittest.cc b/ash/app_list/app_list_presenter_delegate_unittest.cc |
| index 9812cb8c4473adbbced84f145d265973eaabb184..deae37d9e55d7c0e8adb4dbbfc677b08a65a65d3 100644 |
| --- a/ash/app_list/app_list_presenter_delegate_unittest.cc |
| +++ b/ash/app_list/app_list_presenter_delegate_unittest.cc |
| @@ -23,6 +23,7 @@ |
| #include "ui/app_list/app_list_switches.h" |
| #include "ui/app_list/views/app_list_main_view.h" |
| #include "ui/app_list/views/app_list_view.h" |
| +#include "ui/app_list/views/search_box_view.h" |
| #include "ui/aura/test/test_windows.h" |
| #include "ui/aura/window.h" |
| #include "ui/display/display.h" |
| @@ -498,8 +499,8 @@ TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) { |
| TEST_F(AppListPresenterDelegateTest, |
| ShelfBackgroundRespondsToAppListBeingShown) { |
| // TODO(newcomer): Investigate mash failures crbug.com/726838 |
| - if (Shell::GetAshConfig() == Config::MASH) |
| - return; |
| + if (Shell::GetAshConfig() == Config::MASH) |
| + return; |
| EnableFullscreenAppList(); |
| GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| @@ -517,8 +518,7 @@ TEST_F(AppListPresenterDelegateTest, |
| app_list_presenter_impl()->Show(GetPrimaryDisplayId()); |
| EXPECT_TRUE(app_list::features::IsFullscreenAppListEnabled()); |
| EXPECT_FALSE(GetPrimaryShelf()->IsHorizontalAlignment()); |
| - EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()-> |
| - GetShelfBackgroundType(), |
| + EXPECT_EQ(GetPrimaryShelf()->shelf_layout_manager()->GetShelfBackgroundType(), |
| SHELF_BACKGROUND_DEFAULT); |
| } |
| @@ -569,4 +569,49 @@ TEST_F(AppListPresenterDelegateTest, TapAndClickOutsideClosesHalfAppList) { |
| EXPECT_FALSE(app_list_presenter_impl()->IsVisible()); |
| } |
| +// Tests that the app list transitions on mousewheel and gesture scroll events. |
| +TEST_P(AppListPresenterDelegateTest, MouseWheelAndGestureScrollTransition) { |
| + if (!GetParam()) |
| + EnableFullscreenAppList(); // TODO FOR THIS CL: on rebase, change this to |
| + // class FullscreenAppListPresenterDelegateTest |
| + |
| + bool test_mouse_event = GetParam(); |
| + app_list_presenter_impl()->Show(GetPrimaryDisplayId()); |
| + app_list::AppListView* view = app_list_presenter_impl()->GetView(); |
| + ui::test::EventGenerator& generator = GetEventGenerator(); |
| + gfx::Point inside_search_box = view->app_list_main_view() |
| + ->search_box_view() |
| + ->GetBoundsInScreen() |
| + .origin(); |
| + EXPECT_EQ(view->app_list_state(), app_list::AppListView::PEEKING); |
| + |
| + // Move mouse to over the searchbox, mousewheel scroll up. |
| + generator.MoveMouseTo(inside_search_box); |
| + if (test_mouse_event) { |
| + generator.MoveMouseWheel(0, -30); |
| + } else { |
| + generator.ScrollSequence( |
| + inside_search_box, base::TimeDelta::FromMilliseconds(5), 0, -300, 2, 2); |
| + } |
| + EXPECT_EQ(view->app_list_state(), app_list::AppListView::FULLSCREEN_ALL_APPS); |
| + |
| + // swipe down, the app list should return to peeking mode. |
|
oshima
2017/07/14 02:06:47
Swipe
newcomer
2017/07/14 17:49:33
Done.
|
| + gfx::Point start = gfx::Point(0, 0); |
|
oshima
2017/07/14 02:06:47
start(0, 0)
newcomer
2017/07/14 17:49:33
Done.
|
| + generator.GestureScrollSequence(start, gfx::Point(0, 720), |
| + base::TimeDelta::FromMilliseconds(100), 10); |
| + EXPECT_EQ(view->app_list_state(), app_list::AppListView::PEEKING); |
| + |
| + // Move mouse away from the searchbox, mousewheel scroll up. |
| + gfx::Point outside_search_box = view->GetBoundsInScreen().origin(); |
| + generator.MoveMouseTo(outside_search_box); |
| + if (test_mouse_event) { |
| + generator.MoveMouseWheel(0, -30); |
| + } else { |
| + generator.ScrollSequence(outside_search_box, |
| + base::TimeDelta::FromMilliseconds(5), 0, -300, 2, |
| + 2); |
| + } |
| + EXPECT_EQ(view->app_list_state(), app_list::AppListView::FULLSCREEN_ALL_APPS); |
| +} |
| + |
| } // namespace ash |