forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_list_presenter_delegate_unittest.cc
1646 lines (1432 loc) · 66.9 KB
/
app_list_presenter_delegate_unittest.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <algorithm>
#include <memory>
#include "ash/app_list/model/app_list_view_state.h"
#include "ash/app_list/presenter/app_list_presenter_impl.h"
#include "ash/app_list/test/app_list_test_helper.h"
#include "ash/app_list/views/app_list_main_view.h"
#include "ash/app_list/views/app_list_view.h"
#include "ash/app_list/views/search_box_view.h"
#include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/app_list/app_list_switches.h"
#include "ash/public/cpp/ash_switches.h"
#include "ash/public/cpp/shelf_item_delegate.h"
#include "ash/public/cpp/shelf_model.h"
#include "ash/public/cpp/shelf_types.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_controller.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shell.h"
#include "ash/shell_test_api.h"
#include "ash/test/ash_test_base.h"
#include "ash/wallpaper/wallpaper_controller_test_api.h"
#include "ash/wm/mru_window_tracker.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "ash/wm/root_window_finder.h"
#include "ash/wm/splitview/split_view_controller.h"
#include "ash/wm/tablet_mode/tablet_mode_controller.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "ash/wm/workspace_controller_test_api.h"
#include "base/command_line.h"
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/display/test/display_manager_test_api.h"
#include "ui/events/test/event_generator.h"
#include "ui/keyboard/keyboard_controller.h"
#include "ui/keyboard/keyboard_switches.h"
#include "ui/keyboard/test/keyboard_test_util.h"
#include "ui/views/controls/textfield/textfield.h"
namespace ash {
namespace {
constexpr int kAppListBezelMargin = 50;
int64_t GetPrimaryDisplayId() {
return display::Screen::GetScreen()->GetPrimaryDisplay().id();
}
void SetShelfAlignment(ShelfAlignment alignment) {
AshTestBase::GetPrimaryShelf()->SetAlignment(alignment);
}
void EnableTabletMode(bool enable) {
// Avoid |TabletModeController::OnGetSwitchStates| from disabling tablet mode
// again at the end of |TabletModeController::TabletModeController|.
base::RunLoop().RunUntilIdle();
Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(enable);
// The app list will be shown automatically when tablet mode is enabled (Home
// launcher flag is enabled). Wait here for the animation complete.
base::RunLoop().RunUntilIdle();
}
// Generates a fling.
void FlingUpOrDown(ui::test::EventGenerator* generator,
app_list::AppListView* view,
bool up) {
int offset = up ? -100 : 100;
gfx::Point start_point = view->GetBoundsInScreen().origin();
gfx::Point target_point = start_point;
target_point.Offset(0, offset);
generator->GestureScrollSequence(start_point, target_point,
base::TimeDelta::FromMilliseconds(10), 2);
}
} // namespace
class AppListPresenterDelegateTest : public AshTestBase,
public testing::WithParamInterface<bool> {
public:
AppListPresenterDelegateTest() = default;
~AppListPresenterDelegateTest() override = default;
// testing::Test:
void SetUp() override {
app_list::AppListView::SetShortAnimationForTesting(true);
base::CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kEnableVirtualKeyboard);
AshTestBase::SetUp();
// Make the display big enough to hold the app list.
UpdateDisplay("1024x768");
}
void TearDown() override {
AshTestBase::TearDown();
app_list::AppListView::SetShortAnimationForTesting(false);
}
// Whether to run the test with mouse or gesture events.
bool TestMouseEventParam() { return GetParam(); }
gfx::Point GetPointOutsideSearchbox() {
return GetAppListView()->GetBoundsInScreen().origin();
}
gfx::Point GetPointInsideSearchbox() {
return GetAppListView()
->search_box_view()
->GetBoundsInScreen()
.CenterPoint();
}
app_list::AppListView* GetAppListView() {
return GetAppListTestHelper()->GetAppListView();
}
private:
DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateTest);
};
// Instantiate the Boolean which is used to toggle mouse and touch events in
// the parameterized tests.
INSTANTIATE_TEST_CASE_P(, AppListPresenterDelegateTest, testing::Bool());
// Test a variety of behaviors in tablet mode when home launcher is not enabled.
class AppListPresenterDelegateNonHomeLauncherTest
: public AppListPresenterDelegateTest {
public:
AppListPresenterDelegateNonHomeLauncherTest() = default;
~AppListPresenterDelegateNonHomeLauncherTest() override = default;
// testing::Test:
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{}, {app_list_features::kEnableHomeLauncher});
AppListPresenterDelegateTest::SetUp();
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
DISALLOW_COPY_AND_ASSIGN(AppListPresenterDelegateNonHomeLauncherTest);
};
// Tests that app list hides when focus moves to a normal window.
TEST_F(AppListPresenterDelegateTest, HideOnFocusOut) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckVisibility(true);
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
wm::ActivateWindow(window.get());
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that app list remains visible when focus is moved to a different
// window in kShellWindowId_AppListContainer.
TEST_F(AppListPresenterDelegateTest,
RemainVisibleWhenFocusingToApplistContainer) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckVisibility(true);
aura::Window* applist_container = Shell::GetContainer(
Shell::GetPrimaryRootWindow(), kShellWindowId_AppListContainer);
std::unique_ptr<aura::Window> window(
aura::test::CreateTestWindowWithId(0, applist_container));
wm::ActivateWindow(window.get());
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(true);
}
// Tests opening the app list on a secondary display, then deleting the display.
TEST_F(AppListPresenterDelegateTest, NonPrimaryDisplay) {
// Set up a screen with two displays (horizontally adjacent).
UpdateDisplay("1024x768,1024x768");
aura::Window::Windows root_windows = Shell::GetAllRootWindows();
ASSERT_EQ(2u, root_windows.size());
ASSERT_EQ("1024,0 1024x768", root_windows[1]->GetBoundsInScreen().ToString());
GetAppListTestHelper()->ShowAndRunLoop(GetSecondaryDisplay().id());
GetAppListTestHelper()->CheckVisibility(true);
// Remove the secondary display. Shouldn't crash (http://crbug.com/368990).
UpdateDisplay("1024x768");
// Updating the displays should close the app list.
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the app list is not draggable in side shelf alignment.
TEST_F(AppListPresenterDelegateTest, SideShelfAlignmentDragDisabled) {
SetShelfAlignment(ShelfAlignment::SHELF_ALIGNMENT_RIGHT);
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
const app_list::AppListView* app_list = GetAppListView();
EXPECT_TRUE(app_list->is_fullscreen());
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Drag the widget across the screen over an arbitrary 100Ms, this would
// normally result in the app list transitioning to PEEKING but will now
// result in no state change.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->GestureScrollSequence(GetPointOutsideSearchbox(),
gfx::Point(10, 900),
base::TimeDelta::FromMilliseconds(100), 10);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Tap the app list body. This should still close the app list.
generator->GestureTapAt(GetPointOutsideSearchbox());
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the app list initializes in fullscreen with side shelf alignment
// and that the state transitions via text input act properly.
TEST_F(AppListPresenterDelegateTest, SideShelfAlignmentTextStateTransitions) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
SetShelfAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT);
// Open the app list with side shelf alignment, then check that it is in
// fullscreen mode.
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
app_list::AppListView* app_list = GetAppListView();
EXPECT_TRUE(app_list->is_fullscreen());
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Enter text in the searchbox, the app list should transition to fullscreen
// search.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
// Delete the text in the searchbox, the app list should transition to
// fullscreen all apps.
generator->PressKey(ui::KeyboardCode::VKEY_BACK, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
}
// Tests that the app list initializes in peeking with bottom shelf alignment
// and that the state transitions via text input act properly.
TEST_F(AppListPresenterDelegateTest, BottomShelfAlignmentTextStateTransitions) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
app_list::AppListView* app_list = GetAppListView();
EXPECT_FALSE(app_list->is_fullscreen());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Enter text in the searchbox, this should transition the app list to half
// state.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->CheckState(app_list::AppListViewState::HALF);
// Empty the searchbox, this should transition the app list to it's previous
// state.
generator->PressKey(ui::KeyboardCode::VKEY_BACK, 0);
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
}
// Tests that the app list initializes in fullscreen with tablet mode active
// and that the state transitions via text input act properly.
TEST_F(AppListPresenterDelegateTest, TabletModeTextStateTransitions) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
EnableTabletMode(true);
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Enter text in the searchbox, the app list should transition to fullscreen
// search.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
// Delete the text in the searchbox, the app list should transition to
// fullscreen all apps.
generator->PressKey(ui::KeyboardCode::VKEY_BACK, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
}
// Tests that the app list state responds correctly to tablet mode being
// enabled while the app list is being shown.
TEST_F(AppListPresenterDelegateNonHomeLauncherTest,
PeekingToFullscreenWhenTabletModeIsActive) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Enable tablet mode, this should force the app list to switch to the
// fullscreen equivalent of the current state.
EnableTabletMode(true);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Disable tablet mode, the state of the app list should not change.
EnableTabletMode(false);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Enter text in the searchbox, the app list should transition to fullscreen
// search.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
// Delete the text in the searchbox, the app list should transition to
// fullscreen all apps. generator->PressKey(ui::KeyboardCode::VKEY_BACK, 0);
generator->PressKey(ui::KeyboardCode::VKEY_BACK, 0);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
}
// Tests that the app list state responds correctly to tablet mode being
// enabled while the app list is being shown with half launcher.
TEST_F(AppListPresenterDelegateTest, HalfToFullscreenWhenTabletModeIsActive) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Enter text in the search box to transition to half app list.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->CheckState(app_list::AppListViewState::HALF);
// Enable tablet mode and force the app list to transition to the fullscreen
// equivalent of the current state.
EnableTabletMode(true);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
generator->PressKey(ui::KeyboardCode::VKEY_BACK, 0);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
}
// Tests that the app list view handles drag properly in laptop mode.
TEST_F(AppListPresenterDelegateTest, AppListViewDragHandler) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
ui::test::EventGenerator* generator = GetEventGenerator();
// Execute a slow short upwards drag this should fail to transition the app
// list.
int top_of_app_list =
GetAppListView()->GetWidget()->GetWindowBoundsInScreen().y();
generator->GestureScrollSequence(gfx::Point(0, top_of_app_list + 20),
gfx::Point(0, top_of_app_list - 20),
base::TimeDelta::FromMilliseconds(500), 50);
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Execute a long upwards drag, this should transition the app list.
generator->GestureScrollSequence(gfx::Point(10, top_of_app_list + 20),
gfx::Point(10, 10),
base::TimeDelta::FromMilliseconds(100), 10);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Execute a short downward drag, this should fail to transition the app list.
gfx::Point start(10, 10);
gfx::Point end(10, 100);
generator->GestureScrollSequence(
start, end,
generator->CalculateScrollDurationForFlingVelocity(start, end, 1, 100),
100);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Execute a long and slow downward drag to switch to peeking.
start = gfx::Point(10, 200);
end = gfx::Point(10, 650);
generator->GestureScrollSequence(
start, end,
generator->CalculateScrollDurationForFlingVelocity(start, end, 1, 100),
100);
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Transition to fullscreen.
generator->GestureScrollSequence(gfx::Point(10, top_of_app_list + 20),
gfx::Point(10, 10),
base::TimeDelta::FromMilliseconds(100), 10);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Enter text to transition to |FULLSCREEN_SEARCH|.
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
// Execute a short downward drag, this should fail to close the app list.
start = gfx::Point(10, 10);
end = gfx::Point(10, 100);
generator->GestureScrollSequence(
start, end,
generator->CalculateScrollDurationForFlingVelocity(start, end, 1, 100),
100);
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
// Execute a long downward drag, this should close the app list.
generator->GestureScrollSequence(gfx::Point(10, 10), gfx::Point(10, 900),
base::TimeDelta::FromMilliseconds(100), 10);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the app list view handles drag properly in tablet mode.
TEST_F(AppListPresenterDelegateNonHomeLauncherTest,
AppListViewDragHandlerTabletModeFromAllApps) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
EnableTabletMode(true);
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
ui::test::EventGenerator* generator = GetEventGenerator();
// Drag down.
generator->GestureScrollSequence(gfx::Point(0, 0), gfx::Point(0, 720),
base::TimeDelta::FromMilliseconds(100), 10);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the state of the app list changes properly with drag input from
// fullscreen search.
TEST_F(AppListPresenterDelegateNonHomeLauncherTest,
AppListViewDragHandlerTabletModeFromSearch) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
EnableTabletMode(true);
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Type in the search box to transition to |FULLSCREEN_SEARCH|.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
// Drag down, this should close the app list.
generator->GestureScrollSequence(gfx::Point(0, 0), gfx::Point(0, 720),
base::TimeDelta::FromMilliseconds(100), 10);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the bottom shelf background is hidden when the app list is shown
// in laptop mode.
TEST_F(AppListPresenterDelegateTest,
ShelfBackgroundIsHiddenWhenAppListIsShown) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
ShelfLayoutManager* shelf_layout_manager =
Shelf::ForWindow(Shell::GetRootWindowForDisplayId(GetPrimaryDisplayId()))
->shelf_layout_manager();
EXPECT_EQ(ShelfBackgroundType::SHELF_BACKGROUND_APP_LIST,
shelf_layout_manager->GetShelfBackgroundType());
}
// Tests the shelf background type is as expected when in tablet mode.
TEST_F(AppListPresenterDelegateTest, ShelfBackgroundWithHomeLauncher) {
// Enter tablet mode to display the home launcher.
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
EnableTabletMode(true);
ShelfLayoutManager* shelf_layout_manager =
Shelf::ForWindow(Shell::GetRootWindowForDisplayId(GetPrimaryDisplayId()))
->shelf_layout_manager();
EXPECT_EQ(ShelfBackgroundType::SHELF_BACKGROUND_DEFAULT,
shelf_layout_manager->GetShelfBackgroundType());
// Add a window. It should be maximized because it is in tablet mode.
auto window = CreateTestWindow();
EXPECT_EQ(ShelfBackgroundType::SHELF_BACKGROUND_MAXIMIZED,
shelf_layout_manager->GetShelfBackgroundType());
}
// Tests that the bottom shelf is auto hidden when a window is fullscreened in
// tablet mode (home launcher is shown behind).
TEST_F(AppListPresenterDelegateTest, ShelfAutoHiddenWhenFullscreen) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
EnableTabletMode(true);
Shelf* shelf =
Shelf::ForWindow(Shell::GetRootWindowForDisplayId(GetPrimaryDisplayId()));
EXPECT_EQ(ShelfVisibilityState::SHELF_VISIBLE, shelf->GetVisibilityState());
// Create and fullscreen a window. The shelf should be auto hidden.
auto window = CreateTestWindow();
window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
EXPECT_EQ(ShelfVisibilityState::SHELF_AUTO_HIDE, shelf->GetVisibilityState());
EXPECT_EQ(ShelfAutoHideState::SHELF_AUTO_HIDE_HIDDEN,
shelf->GetAutoHideState());
}
// Tests that the peeking app list closes if the user taps or clicks outside
// its bounds.
TEST_P(AppListPresenterDelegateTest, TapAndClickOutsideClosesPeekingAppList) {
const bool test_mouse_event = TestMouseEventParam();
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
ui::test::EventGenerator* generator = GetEventGenerator();
// Tapping outside the bounds closes the app list.
const gfx::Rect peeking_bounds = GetAppListView()->GetBoundsInScreen();
gfx::Point tap_point = peeking_bounds.origin();
tap_point.Offset(10, -10);
ASSERT_FALSE(peeking_bounds.Contains(tap_point));
if (test_mouse_event) {
generator->MoveMouseTo(tap_point);
generator->ClickLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(tap_point);
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(false);
}
TEST_P(AppListPresenterDelegateTest, LongPressOutsideCloseAppList) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckVisibility(true);
// |outside_point| is outside the bounds of app list.
gfx::Point outside_point = GetAppListView()->bounds().origin();
outside_point.Offset(0, -10);
// Dispatch LONG_PRESS to ash::AppListPresenterDelegate.
ui::TouchEvent long_press(
ui::ET_GESTURE_LONG_PRESS, outside_point, base::TimeTicks::Now(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH));
GetEventGenerator()->Dispatch(&long_press);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(false);
}
TEST_P(AppListPresenterDelegateTest, TwoFingerTapOutsideCloseAppList) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckVisibility(true);
// |outside_point| is outside the bounds of app list.
gfx::Point outside_point = GetAppListView()->bounds().origin();
outside_point.Offset(0, -10);
// Dispatch TWO_FINGER_TAP to ash::AppListPresenterDelegate.
ui::TouchEvent two_finger_tap(
ui::ET_GESTURE_TWO_FINGER_TAP, outside_point, base::TimeTicks::Now(),
ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH));
GetEventGenerator()->Dispatch(&two_finger_tap);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that a keypress activates the searchbox and that clearing the
// searchbox, the searchbox remains active.
TEST_F(AppListPresenterDelegateTest, KeyPressEnablesSearchBox) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
ui::test::EventGenerator* generator = GetEventGenerator();
app_list::SearchBoxView* search_box_view =
GetAppListView()->search_box_view();
EXPECT_FALSE(search_box_view->is_search_box_active());
// Press any key, the search box should be active.
generator->PressKey(ui::VKEY_0, 0);
EXPECT_TRUE(search_box_view->is_search_box_active());
// Delete the text, the search box should be inactive.
search_box_view->ClearSearch();
EXPECT_TRUE(search_box_view->is_search_box_active());
}
// Tests that a tap/click on the AppListView from half launcher returns the
// AppListView to Peeking, and that a tap/click on the AppListView from
// Peeking closes the app list.
TEST_P(AppListPresenterDelegateTest,
StateTransitionsByTapAndClickingAppListBodyFromHalf) {
const bool test_mouse_event = TestMouseEventParam();
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
app_list::AppListView* app_list_view = GetAppListView();
app_list::SearchBoxView* search_box_view = app_list_view->search_box_view();
ui::test::EventGenerator* generator = GetEventGenerator();
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Press a key, the AppListView should transition to half.
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::HALF);
EXPECT_TRUE(search_box_view->is_search_box_active());
// Tap outside the search box, the AppListView should transition to Peeking
// and the search box should be inactive.
if (test_mouse_event) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapDownAndUp(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
EXPECT_FALSE(search_box_view->is_search_box_active());
// Tap outside the search box again, the AppListView should hide.
if (test_mouse_event) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapDownAndUp(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that a tap/click on the AppListView from Fullscreen search returns
// the AppListView to fullscreen all apps, and that a tap/click on the
// AppListView from fullscreen all apps closes the app list.
TEST_P(AppListPresenterDelegateTest,
StateTransitionsByTappingAppListBodyFromFullscreen) {
const bool test_mouse_event = TestMouseEventParam();
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
app_list::AppListView* app_list_view = GetAppListView();
app_list::SearchBoxView* search_box_view = app_list_view->search_box_view();
ui::test::EventGenerator* generator = GetEventGenerator();
// Execute a long upwards drag, this should transition the app list to
// fullscreen.
const int top_of_app_list =
app_list_view->GetWidget()->GetWindowBoundsInScreen().y();
generator->GestureScrollSequence(gfx::Point(10, top_of_app_list + 20),
gfx::Point(10, 10),
base::TimeDelta::FromMilliseconds(100), 10);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
// Press a key, this should activate the searchbox and transition to
// fullscreen search.
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
EXPECT_TRUE(search_box_view->is_search_box_active());
// Tap outside the searchbox, this should deactivate the searchbox and the
// applistview should return to fullscreen all apps.
if (test_mouse_event) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
} else {
generator->GestureTapDownAndUp(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
EXPECT_FALSE(search_box_view->is_search_box_active());
// Tap outside the searchbox again, this should close the applistview.
if (test_mouse_event) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
} else {
generator->GestureTapDownAndUp(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the searchbox activates when it is tapped and that the widget is
// closed after tapping outside the searchbox.
TEST_P(AppListPresenterDelegateTest, TapAndClickEnablesSearchBox) {
const bool test_mouse_event = TestMouseEventParam();
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
app_list::SearchBoxView* search_box_view =
GetAppListView()->search_box_view();
// Tap/Click the search box, it should activate.
ui::test::EventGenerator* generator = GetEventGenerator();
if (test_mouse_event) {
generator->MoveMouseTo(GetPointInsideSearchbox());
generator->PressLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(GetPointInsideSearchbox());
}
EXPECT_TRUE(search_box_view->is_search_box_active());
// Tap on the body of the app list, the search box should deactivate.
if (test_mouse_event) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->PressLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
EXPECT_FALSE(search_box_view->is_search_box_active());
GetAppListTestHelper()->CheckVisibility(true);
// Tap on the body of the app list again, the app list should hide.
if (test_mouse_event) {
generator->PressLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that tapping or clicking the body of the applist with an active virtual
// keyboard results in the virtual keyboard closing with no side effects.
TEST_P(AppListPresenterDelegateTest,
TapAppListWithVirtualKeyboardDismissesVirtualKeyboard) {
const bool test_click = GetParam();
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
EnableTabletMode(true);
// Tap to activate the searchbox.
ui::test::EventGenerator* generator = GetEventGenerator();
generator->GestureTapAt(GetPointInsideSearchbox());
// Enter some text in the searchbox, the applist should transition to
// fullscreen search.
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
// Manually show the virtual keyboard.
auto* const keyboard_controller = keyboard::KeyboardController::Get();
keyboard_controller->ShowKeyboard(true);
keyboard_controller->GetKeyboardWindow()->SetBounds(
keyboard::KeyboardBoundsFromRootBounds(
Shell::GetPrimaryRootWindow()->bounds(), 100));
keyboard_controller->NotifyKeyboardWindowLoaded();
EXPECT_TRUE(keyboard_controller->IsKeyboardVisible());
// Tap or click outside the searchbox, the virtual keyboard should hide.
if (test_click) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(GetPointOutsideSearchbox());
}
EXPECT_FALSE(keyboard_controller->IsKeyboardVisible());
// The searchbox should still be active and the AppListView should still be in
// FULLSCREEN_SEARCH.
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_SEARCH);
EXPECT_TRUE(GetAppListView()->search_box_view()->is_search_box_active());
// Tap or click the body of the AppList again, the searchbox should deactivate
// and the applist should be in FULLSCREEN_ALL_APPS.
if (test_click) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
EXPECT_FALSE(GetAppListView()->search_box_view()->is_search_box_active());
}
// Tests that the shelf background displays/hides with bottom shelf
// alignment.
TEST_F(AppListPresenterDelegateTest,
ShelfBackgroundRespondsToAppListBeingShown) {
GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_BOTTOM);
// Show the app list, the shelf background should be transparent.
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
ShelfLayoutManager* shelf_layout_manager =
GetPrimaryShelf()->shelf_layout_manager();
EXPECT_EQ(SHELF_BACKGROUND_APP_LIST,
shelf_layout_manager->GetShelfBackgroundType());
GetAppListTestHelper()->DismissAndRunLoop();
// Set the alignment to the side and show the app list. The background
// should show.
GetPrimaryShelf()->SetAlignment(ShelfAlignment::SHELF_ALIGNMENT_LEFT);
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
EXPECT_FALSE(GetPrimaryShelf()->IsHorizontalAlignment());
EXPECT_EQ(
SHELF_BACKGROUND_APP_LIST,
GetPrimaryShelf()->shelf_layout_manager()->GetShelfBackgroundType());
}
// Tests that the app list in HALF with an active search transitions to PEEKING
// after the body is clicked/tapped.
TEST_P(AppListPresenterDelegateTest, HalfToPeekingByClickOrTap) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
ui::test::EventGenerator* generator = GetEventGenerator();
// Transition to half app list by entering text.
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::HALF);
// Click or Tap the app list view body.
if (TestMouseEventParam()) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Click or Tap the app list view body again.
if (TestMouseEventParam()) {
generator->MoveMouseTo(GetPointOutsideSearchbox());
generator->ClickLeftButton();
generator->ReleaseLeftButton();
} else {
generator->GestureTapAt(GetPointOutsideSearchbox());
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the half app list transitions to peeking state and then closes
// itself if the user taps outside its bounds.
TEST_P(AppListPresenterDelegateTest, TapAndClickOutsideClosesHalfAppList) {
// TODO(newcomer): Investigate mash failures crbug.com/726838
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
ui::test::EventGenerator* generator = GetEventGenerator();
// Transition to half app list by entering text.
generator->PressKey(ui::KeyboardCode::VKEY_0, 0);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::HALF);
// A point outside the bounds of launcher.
gfx::Point to_point(
0, GetAppListView()->GetWidget()->GetWindowBoundsInScreen().y() - 1);
// Clicking/tapping outside the bounds closes the search results page.
if (TestMouseEventParam()) {
generator->MoveMouseTo(to_point);
generator->ClickLeftButton();
} else {
generator->GestureTapAt(to_point);
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Clicking/tapping outside the bounds closes the app list.
if (TestMouseEventParam()) {
generator->MoveMouseTo(to_point);
generator->ClickLeftButton();
} else {
generator->GestureTapAt(to_point);
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that the search box is set active with a whitespace query and that the
// app list state doesn't transition with a whitespace query.
TEST_F(AppListPresenterDelegateTest, WhitespaceQuery) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
app_list::AppListView* view = GetAppListView();
ui::test::EventGenerator* generator = GetEventGenerator();
EXPECT_FALSE(view->search_box_view()->is_search_box_active());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Enter a whitespace query, the searchbox should activate but stay in peeking
// mode.
generator->PressKey(ui::VKEY_SPACE, 0);
EXPECT_TRUE(view->search_box_view()->is_search_box_active());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Enter a non-whitespace character, the Searchbox should stay active and go
// to HALF
generator->PressKey(ui::VKEY_0, 0);
EXPECT_TRUE(view->search_box_view()->is_search_box_active());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::HALF);
// Delete the non whitespace character, the Searchbox should not deactivate
// but go to PEEKING
generator->PressKey(ui::VKEY_BACK, 0);
EXPECT_TRUE(view->search_box_view()->is_search_box_active());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
}
// Tests that an unhandled two finger tap/right click does not close the app
// list, and an unhandled one finger tap/left click closes the app list in
// Peeking mode.
TEST_P(AppListPresenterDelegateTest, UnhandledEventOnPeeking) {
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
// Two finger tap or right click in the empty space below the searchbox. The
// app list should not close.
gfx::Point empty_space =
GetAppListView()->search_box_view()->GetBoundsInScreen().bottom_left();
empty_space.Offset(0, 10);
ui::test::EventGenerator* generator = GetEventGenerator();
if (TestMouseEventParam()) {
generator->MoveMouseTo(empty_space);
generator->PressRightButton();
generator->ReleaseRightButton();
} else {
ui::GestureEvent two_finger_tap(
empty_space.x(), empty_space.y(), 0, base::TimeTicks(),
ui::GestureEventDetails(ui::ET_GESTURE_TWO_FINGER_TAP));
generator->Dispatch(&two_finger_tap);
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
GetAppListTestHelper()->CheckVisibility(true);
// One finger tap or left click in the empty space below the searchbox. The
// app list should close.
if (TestMouseEventParam()) {
generator->MoveMouseTo(empty_space);
generator->ClickLeftButton();
} else {
generator->GestureTapAt(empty_space);
}
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);
}
// Tests that a drag to the bezel from Fullscreen/Peeking will close the app
// list.
TEST_P(AppListPresenterDelegateTest,
DragToBezelClosesAppListFromFullscreenAndPeeking) {
const bool test_fullscreen = GetParam();
GetAppListTestHelper()->ShowAndRunLoop(GetPrimaryDisplayId());
app_list::AppListView* view = GetAppListView();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::PEEKING);
if (test_fullscreen) {
FlingUpOrDown(GetEventGenerator(), view, true /* up */);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(
app_list::AppListViewState::FULLSCREEN_ALL_APPS);
}
// Drag the app list to 50 DIPs from the bottom bezel.
ui::test::EventGenerator* generator = GetEventGenerator();
const int bezel_y = display::Screen::GetScreen()
->GetDisplayNearestView(view->parent_window())
.bounds()
.bottom();
generator->GestureScrollSequence(
gfx::Point(0, bezel_y - (kAppListBezelMargin + 100)),
gfx::Point(0, bezel_y - (kAppListBezelMargin)),
base::TimeDelta::FromMilliseconds(1500), 100);
GetAppListTestHelper()->WaitUntilIdle();
GetAppListTestHelper()->CheckState(app_list::AppListViewState::CLOSED);
GetAppListTestHelper()->CheckVisibility(false);