Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3300)

Unified Diff: ash/app_list/app_list_presenter_delegate_unittest.cc

Issue 2982453002: New AppListView Scroll Behavior. (Closed)
Patch Set: Addressed comments. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..1f771792a2a9286e5a29df4187be333cefa28a23 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())
khmel 2017/07/14 18:10:00 nit: can you use test_with_fullscreen_ instead? I
newcomer 2017/07/17 21:38:10 Fixed by putting this test into FullscreenAppListP
+ EnableFullscreenAppList(); // TODO FOR THIS CL: on rebase, change this to
+ // class FullscreenAppListPresenterDelegateTest
+
+ bool test_mouse_event = GetParam();
khmel 2017/07/14 18:10:00 nit: const bool ... or discard it in regards to pr
newcomer 2017/07/17 21:38:10 Done.
+ 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.
+ gfx::Point start(0, 0);
+ generator.GestureScrollSequence(start, gfx::Point(0, 720),
khmel 2017/07/14 18:10:00 nit: please inline (gfx::Point(0, 0), gfx::Point(0
newcomer 2017/07/17 21:38:10 Done.
+ 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();
khmel 2017/07/14 18:10:01 nit: const gfx::...
newcomer 2017/07/17 21:38:10 Refactored test after rebase to use GetPointOutsid
+ 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
« no previous file with comments | « no previous file | testing/buildbot/filters/ash_unittests_mash.filter » ('j') | ui/app_list/pagination_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698