shelf_drag_handle_unittest.cc 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/app_list/test/app_list_test_helper.h"
  5. #include "ash/constants/ash_features.h"
  6. #include "ash/constants/ash_pref_names.h"
  7. #include "ash/controls/contextual_tooltip.h"
  8. #include "ash/public/cpp/shelf_types.h"
  9. #include "ash/session/session_controller_impl.h"
  10. #include "ash/shelf/drag_handle.h"
  11. #include "ash/shelf/drag_window_from_shelf_controller.h"
  12. #include "ash/shelf/drag_window_from_shelf_controller_test_api.h"
  13. #include "ash/shelf/shelf_layout_manager.h"
  14. #include "ash/shelf/test/shelf_layout_manager_test_base.h"
  15. #include "ash/shell.h"
  16. #include "ash/test/ash_test_base.h"
  17. #include "ash/wm/tablet_mode/tablet_mode_controller_test_api.h"
  18. #include "base/bind.h"
  19. #include "base/test/metrics/histogram_tester.h"
  20. #include "base/test/scoped_feature_list.h"
  21. #include "base/test/simple_test_clock.h"
  22. #include "ui/compositor/scoped_animation_duration_scale_mode.h"
  23. #include "ui/wm/core/window_util.h"
  24. namespace ash {
  25. namespace {
  26. ShelfWidget* GetShelfWidget() {
  27. return AshTestBase::GetPrimaryShelf()->shelf_widget();
  28. }
  29. ShelfLayoutManager* GetShelfLayoutManager() {
  30. return AshTestBase::GetPrimaryShelf()->shelf_layout_manager();
  31. }
  32. } // namespace
  33. // Test base for unit test related to drag handle contextual nudges.
  34. class DragHandleContextualNudgeTest : public ShelfLayoutManagerTestBase {
  35. public:
  36. DragHandleContextualNudgeTest() {
  37. scoped_feature_list_.InitWithFeatures(
  38. {ash::features::kContextualNudges,
  39. ash::features::kHideShelfControlsInTabletMode},
  40. {});
  41. }
  42. ~DragHandleContextualNudgeTest() override = default;
  43. DragHandleContextualNudgeTest(const DragHandleContextualNudgeTest& other) =
  44. delete;
  45. DragHandleContextualNudgeTest& operator=(
  46. const DragHandleContextualNudgeTest& other) = delete;
  47. // ShelfLayoutManagerTestBase:
  48. void SetUp() override {
  49. ShelfLayoutManagerTestBase::SetUp();
  50. test_clock_.Advance(base::Hours(2));
  51. contextual_tooltip::OverrideClockForTesting(&test_clock_);
  52. }
  53. void TearDown() override {
  54. contextual_tooltip::ClearClockOverrideForTesting();
  55. AshTestBase::TearDown();
  56. }
  57. base::SimpleTestClock test_clock_;
  58. private:
  59. base::test::ScopedFeatureList scoped_feature_list_;
  60. };
  61. class DragHandleContextualNudgeTestA11yPrefs
  62. : public DragHandleContextualNudgeTest,
  63. public ::testing::WithParamInterface<std::string> {};
  64. INSTANTIATE_TEST_SUITE_P(
  65. All,
  66. DragHandleContextualNudgeTestA11yPrefs,
  67. testing::Values(prefs::kAccessibilityAutoclickEnabled,
  68. prefs::kAccessibilitySpokenFeedbackEnabled,
  69. prefs::kAccessibilitySwitchAccessEnabled));
  70. TEST_F(DragHandleContextualNudgeTest, ShowDragHandleNudgeWithTimer) {
  71. // Creates a widget to put shelf into in-app state.
  72. views::Widget* widget = CreateTestWidget();
  73. widget->Maximize();
  74. TabletModeControllerTestApi().EnterTabletMode();
  75. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  76. // The drag handle should be showing but the nudge should not. A timer to show
  77. // the nudge should be initialized.
  78. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  79. EXPECT_FALSE(
  80. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  81. // Firing the timer should show the drag handle nudge.
  82. GetShelfWidget()->GetDragHandle()->fire_show_drag_handle_timer_for_testing();
  83. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  84. EXPECT_TRUE(
  85. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  86. }
  87. TEST_F(DragHandleContextualNudgeTest, HideDragHandleNudgeHiddenOnMinimize) {
  88. base::HistogramTester histogram_tester;
  89. // Creates a test window to put shelf into in-app state.
  90. views::Widget* widget = CreateTestWidget();
  91. widget->Maximize();
  92. TabletModeControllerTestApi().EnterTabletMode();
  93. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  94. // The drag handle and nudge should be showing after the timer fires.
  95. GetShelfWidget()->GetDragHandle()->fire_show_drag_handle_timer_for_testing();
  96. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  97. EXPECT_TRUE(
  98. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  99. // Minimizing the widget should hide the drag handle and nudge.
  100. widget->Minimize();
  101. EXPECT_FALSE(GetShelfWidget()->GetDragHandle()->GetVisible());
  102. EXPECT_FALSE(
  103. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  104. }
  105. // Tests that the drag handle nudge nudge is hidden when closing the widget and
  106. // setting the ShelfBackgroundType to kHomeLauncher.
  107. TEST_F(DragHandleContextualNudgeTest, DragHandleNudgeHiddenOnClose) {
  108. // Creates a widget to put shelf into in-app state.
  109. views::Widget* widget = CreateTestWidget();
  110. widget->Maximize();
  111. TabletModeControllerTestApi().EnterTabletMode();
  112. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  113. DragHandle* const drag_handle = GetShelfWidget()->GetDragHandle();
  114. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  115. drag_handle->fire_show_drag_handle_timer_for_testing();
  116. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  117. // Close the widget.
  118. widget->CloseWithReason(views::Widget::ClosedReason::kCloseButtonClicked);
  119. EXPECT_FALSE(drag_handle->GetVisible());
  120. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  121. }
  122. // Checks that the shelf cannot be auto hidden while animating shelf drag handle
  123. // nudge.
  124. TEST_F(DragHandleContextualNudgeTest,
  125. HideDragHandleDoesNotInteruptShowNudgeAnimation) {
  126. GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
  127. // Creates a widget to put shelf into in-app state.
  128. views::Widget* widget = CreateTestWidget();
  129. widget->Maximize();
  130. TabletModeControllerTestApi().EnterTabletMode();
  131. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  132. ui::ScopedAnimationDurationScaleMode normal_animation_duration(
  133. ui::ScopedAnimationDurationScaleMode::SLOW_DURATION);
  134. GetShelfWidget()->GetDragHandle()->MaybeShowDragHandleNudge();
  135. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  136. EXPECT_TRUE(
  137. GetShelfWidget()->GetDragHandle()->show_nudge_animation_in_progress());
  138. GetShelfLayoutManager()->UpdateAutoHideState();
  139. // Shelf auto hide should not interrupt animations to show drag handle nudge.
  140. // Showing the nudge while hiding the shelf is not intended behavior.
  141. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  142. EXPECT_TRUE(
  143. GetShelfWidget()->GetDragHandle()->show_nudge_animation_in_progress());
  144. }
  145. // Checks that the drag handle nudge is not shown when entering kInApp with
  146. // shelf autohide turned on.
  147. TEST_F(DragHandleContextualNudgeTest, DragHandleNotShownForAutoHideShelf) {
  148. GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
  149. // Creates a widget to put shelf into in-app state.
  150. views::Widget* widget = CreateTestWidget();
  151. widget->Maximize();
  152. TabletModeControllerTestApi().EnterTabletMode();
  153. EXPECT_FALSE(
  154. GetShelfWidget()->GetDragHandle()->show_nudge_animation_in_progress());
  155. EXPECT_FALSE(
  156. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  157. }
  158. TEST_F(DragHandleContextualNudgeTest, DoNotShowNudgeWithoutDragHandle) {
  159. // Creates a widget to put shelf into in-app state.
  160. views::Widget* widget = CreateTestWidget();
  161. widget->Maximize();
  162. TabletModeControllerTestApi().EnterTabletMode();
  163. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  164. // Minimizing the widget should hide the drag handle and nudge.
  165. widget->Minimize();
  166. EXPECT_FALSE(GetShelfWidget()->GetDragHandle()->GetVisible());
  167. EXPECT_FALSE(
  168. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  169. }
  170. TEST_F(DragHandleContextualNudgeTest,
  171. ContinueShowingDragHandleNudgeOnActiveWidgetChanged) {
  172. // Creates a widget to put shelf into in-app state.
  173. views::Widget* widget = CreateTestWidget();
  174. widget->Maximize();
  175. TabletModeControllerTestApi().EnterTabletMode();
  176. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  177. GetShelfWidget()->GetDragHandle()->fire_show_drag_handle_timer_for_testing();
  178. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  179. EXPECT_TRUE(
  180. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  181. // Maximizing and showing a different widget should not hide the drag handle
  182. // or nudge.
  183. views::Widget* new_widget = CreateTestWidget();
  184. new_widget->Maximize();
  185. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  186. EXPECT_TRUE(
  187. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  188. }
  189. TEST_F(DragHandleContextualNudgeTest, DragHandleNudgeShownInAppShelf) {
  190. base::HistogramTester histogram_tester;
  191. // Creates a widget to put shelf into in-app state.
  192. views::Widget* widget = CreateTestWidget();
  193. widget->Maximize();
  194. // Drag handle and nudge should not be shown in clamshell mode.
  195. EXPECT_FALSE(GetShelfWidget()->GetDragHandle()->GetVisible());
  196. EXPECT_FALSE(
  197. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  198. // Test that the first time a user transitions into tablet mode with a
  199. // maximized window will show the drag nudge immedietly. The drag handle nudge
  200. // should not be visible yet and the timer to show it should be set.
  201. TabletModeControllerTestApi().EnterTabletMode();
  202. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  203. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  204. EXPECT_FALSE(
  205. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  206. EXPECT_TRUE(GetShelfWidget()
  207. ->GetDragHandle()
  208. ->has_show_drag_handle_timer_for_testing());
  209. // Firing the timer should show the nudge for the first time. The nudge should
  210. // remain visible until the shelf state changes so the timer to hide it should
  211. // not be set.
  212. GetShelfWidget()->GetDragHandle()->fire_show_drag_handle_timer_for_testing();
  213. EXPECT_TRUE(
  214. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  215. EXPECT_FALSE(GetShelfWidget()
  216. ->GetDragHandle()
  217. ->has_hide_drag_handle_timer_for_testing());
  218. // Leaving tablet mode should hide the nudge.
  219. TabletModeControllerTestApi().LeaveTabletMode();
  220. EXPECT_FALSE(GetShelfWidget()->GetDragHandle()->GetVisible());
  221. EXPECT_FALSE(
  222. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  223. // Reentering tablet mode should show the drag handle but the nudge should
  224. // not. No timer should be set to show the nudge.
  225. TabletModeControllerTestApi().EnterTabletMode();
  226. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  227. EXPECT_FALSE(
  228. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  229. EXPECT_FALSE(GetShelfWidget()
  230. ->GetDragHandle()
  231. ->has_show_drag_handle_timer_for_testing());
  232. // Advance time for more than a day (which should enable the nudge again).
  233. test_clock_.Advance(base::Hours(25));
  234. // Reentering tablet mode with a maximized widget should immedietly show the
  235. // drag handle and set a timer to show the nudge.
  236. TabletModeControllerTestApi().LeaveTabletMode();
  237. TabletModeControllerTestApi().EnterTabletMode();
  238. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  239. EXPECT_FALSE(
  240. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  241. // Firing the timer should show the nudge.
  242. EXPECT_TRUE(GetShelfWidget()
  243. ->GetDragHandle()
  244. ->has_show_drag_handle_timer_for_testing());
  245. GetShelfWidget()->GetDragHandle()->fire_show_drag_handle_timer_for_testing();
  246. EXPECT_TRUE(
  247. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  248. EXPECT_FALSE(GetShelfWidget()
  249. ->GetDragHandle()
  250. ->has_show_drag_handle_timer_for_testing());
  251. // On subsequent shows, the nudge should be hidden after a timeout.
  252. EXPECT_TRUE(GetShelfWidget()
  253. ->GetDragHandle()
  254. ->has_hide_drag_handle_timer_for_testing());
  255. }
  256. TEST_F(DragHandleContextualNudgeTest, DragHandleNudgeShownOnTap) {
  257. // Creates a widget to put shelf into in-app state.
  258. views::Widget* widget = CreateTestWidget();
  259. widget->Maximize();
  260. TabletModeControllerTestApi().EnterTabletMode();
  261. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  262. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  263. EXPECT_FALSE(
  264. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  265. EXPECT_TRUE(GetShelfWidget()
  266. ->GetDragHandle()
  267. ->has_show_drag_handle_timer_for_testing());
  268. GetShelfWidget()->GetDragHandle()->fire_show_drag_handle_timer_for_testing();
  269. EXPECT_TRUE(
  270. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  271. // Exiting and re-entering tablet should hide the nudge and put the shelf into
  272. // the default kInApp shelf state.
  273. TabletModeControllerTestApi().LeaveTabletMode();
  274. TabletModeControllerTestApi().EnterTabletMode();
  275. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  276. EXPECT_FALSE(
  277. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  278. // Tapping the drag handle should show the drag handle nudge immedietly and
  279. // the show nudge timer should be set.
  280. GetEventGenerator()->GestureTapAt(
  281. GetShelfWidget()->GetDragHandle()->GetBoundsInScreen().CenterPoint());
  282. EXPECT_FALSE(GetShelfWidget()
  283. ->GetDragHandle()
  284. ->has_show_drag_handle_timer_for_testing());
  285. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  286. EXPECT_TRUE(
  287. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  288. EXPECT_TRUE(GetShelfWidget()
  289. ->GetDragHandle()
  290. ->has_hide_drag_handle_timer_for_testing());
  291. }
  292. TEST_F(DragHandleContextualNudgeTest, DragHandleNudgeNotShownForHiddenShelf) {
  293. GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
  294. TabletModeControllerTestApi().EnterTabletMode();
  295. // Creates a widget to put shelf into in-app state.
  296. views::Widget* widget = CreateTestWidget();
  297. widget->Maximize();
  298. ShelfWidget* const shelf_widget = GetShelfWidget();
  299. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  300. // The shelf is hidden, so the drag handle nudge should not be shown.
  301. EXPECT_TRUE(drag_handle->GetVisible());
  302. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  303. EXPECT_FALSE(drag_handle->has_show_drag_handle_timer_for_testing());
  304. PrefService* const prefs =
  305. Shell::Get()->session_controller()->GetLastActiveUserPrefService();
  306. // Back gesture nudge should be allowed if the shelf is hidden.
  307. EXPECT_TRUE(contextual_tooltip::ShouldShowNudge(
  308. prefs, contextual_tooltip::TooltipType::kBackGesture, nullptr));
  309. // Swipe up to show the shelf - this should schedule the drag handle nudge.
  310. SwipeUpOnShelf();
  311. // Back gesture nudge should be disallowed at this time, given that the drag
  312. // handle nudge can be shown.
  313. EXPECT_FALSE(contextual_tooltip::ShouldShowNudge(
  314. prefs, contextual_tooltip::TooltipType::kBackGesture, nullptr));
  315. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  316. drag_handle->fire_show_drag_handle_timer_for_testing();
  317. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  318. }
  319. // Tapping the drag handle nudge when auto hide shelf is enabled should hide the
  320. // drag handle nudge but should not hide the shelf or hotseat.
  321. TEST_F(DragHandleContextualNudgeTest,
  322. DragHandleNudgeTapDoesNotHideAutoHiddenShelf) {
  323. // Sets shelf auto hide behavior.
  324. GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
  325. TabletModeControllerTestApi().EnterTabletMode();
  326. // Creates a widget to put shelf into in-app state.
  327. views::Widget* widget = CreateTestWidget();
  328. widget->Maximize();
  329. ShelfWidget* const shelf_widget = GetShelfWidget();
  330. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  331. // The shelf and drag handle should be hidden and the nudge should not be
  332. // scheduled because shelf auto hide is set.
  333. EXPECT_TRUE(GetPrimaryShelf()->GetAutoHideState() ==
  334. ShelfAutoHideState::SHELF_AUTO_HIDE_HIDDEN);
  335. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  336. EXPECT_FALSE(drag_handle->has_show_drag_handle_timer_for_testing());
  337. // Swipe up to show the shelf. This should show the shelf, extend the hotseat,
  338. // and schedule the drag handle nudge.
  339. SwipeUpOnShelf();
  340. EXPECT_TRUE(GetPrimaryShelf()->GetAutoHideState() ==
  341. ShelfAutoHideState::SHELF_AUTO_HIDE_SHOWN);
  342. EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
  343. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  344. // Firing the show timer should create the nudge set the target visibility for
  345. // animations..
  346. drag_handle->fire_show_drag_handle_timer_for_testing();
  347. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  348. EXPECT_TRUE(drag_handle->drag_handle_nudge() != nullptr);
  349. // Tapping the drag handle nudge should hide the nudge but not affect the
  350. // visibility of the shelf or hotseat.
  351. GetEventGenerator()->GestureTapAt(
  352. drag_handle->drag_handle_nudge()->GetBoundsInScreen().CenterPoint());
  353. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  354. EXPECT_TRUE(GetPrimaryShelf()->GetAutoHideState() ==
  355. ShelfAutoHideState::SHELF_AUTO_HIDE_SHOWN);
  356. EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
  357. // Swiping down on shelf should hide the shelf and hotseat.
  358. SwipeDownOnShelf();
  359. EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state());
  360. EXPECT_TRUE(GetPrimaryShelf()->GetAutoHideState() ==
  361. ShelfAutoHideState::SHELF_AUTO_HIDE_HIDDEN);
  362. // Swiping up on shelf should show the shelf and drag handle but not the
  363. // nudge or hotseat.
  364. SwipeUpOnShelf();
  365. EXPECT_TRUE(GetPrimaryShelf()->GetAutoHideState() ==
  366. ShelfAutoHideState::SHELF_AUTO_HIDE_SHOWN);
  367. EXPECT_FALSE(drag_handle->has_show_drag_handle_timer_for_testing());
  368. EXPECT_TRUE(drag_handle->drag_handle_nudge() == nullptr);
  369. EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state());
  370. }
  371. // Tests that drag handle show is canceled when the shelf is hidden while the
  372. // drag handle is scheduled to be shown.
  373. TEST_F(DragHandleContextualNudgeTest, HidingShelfCancelsDragHandleShow) {
  374. GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways);
  375. TabletModeControllerTestApi().EnterTabletMode();
  376. // Creates a widget to put shelf into in-app state.
  377. views::Widget* widget = CreateTestWidget();
  378. widget->Maximize();
  379. ShelfWidget* const shelf_widget = GetShelfWidget();
  380. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  381. // The shelf is hidden, so the drag handle nudge should not be shown.
  382. EXPECT_TRUE(drag_handle->GetVisible());
  383. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  384. EXPECT_FALSE(drag_handle->has_show_drag_handle_timer_for_testing());
  385. // Swipe up to show the shelf - this should schedule the drag handle nudge.
  386. SwipeUpOnShelf();
  387. EXPECT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  388. // Hide the shelf, and verify the drag handle show is canceled.
  389. SwipeDownOnShelf();
  390. EXPECT_FALSE(drag_handle->has_show_drag_handle_timer_for_testing());
  391. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  392. PrefService* const prefs =
  393. Shell::Get()->session_controller()->GetLastActiveUserPrefService();
  394. // Back gesture nudge should be allowed if the shelf is hidden.
  395. EXPECT_TRUE(contextual_tooltip::ShouldShowNudge(
  396. prefs, contextual_tooltip::TooltipType::kBackGesture, nullptr));
  397. }
  398. // Tests that the drag handle nudge is not hidden when the user extends the
  399. // hotseat.
  400. TEST_F(DragHandleContextualNudgeTest,
  401. DragHandleNudgeNotHiddenByExtendingHotseat) {
  402. TabletModeControllerTestApi().EnterTabletMode();
  403. // Creates a widget to put shelf into in-app state.
  404. views::Widget* widget = CreateTestWidget();
  405. widget->Maximize();
  406. ShelfWidget* const shelf_widget = GetShelfWidget();
  407. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  408. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  409. drag_handle->fire_show_drag_handle_timer_for_testing();
  410. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  411. // Swipe up to extend the hotseat - verify that the drag handle remain
  412. // visible.
  413. SwipeUpOnShelf();
  414. EXPECT_TRUE(drag_handle->GetVisible());
  415. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  416. }
  417. // Tests that the drag handle nudge is horizontally centered in screen, and
  418. // drawn above the shelf drag handle, even after display bounds are updated.
  419. TEST_F(DragHandleContextualNudgeTest, DragHandleNudgeBoundsInScreen) {
  420. UpdateDisplay("675x1200");
  421. TabletModeControllerTestApi().EnterTabletMode();
  422. views::Widget* widget = CreateTestWidget();
  423. widget->Maximize();
  424. ShelfWidget* const shelf_widget = GetShelfWidget();
  425. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  426. EXPECT_TRUE(drag_handle->GetVisible());
  427. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  428. drag_handle->fire_show_drag_handle_timer_for_testing();
  429. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  430. // Calculates absolute difference between horizontal margins of |inner| rect
  431. // within |outer| rect.
  432. auto margin_diff = [](const gfx::Rect& inner, const gfx::Rect& outer) -> int {
  433. const int left = inner.x() - outer.x();
  434. EXPECT_GE(left, 0);
  435. const int right = outer.right() - inner.right();
  436. EXPECT_GE(right, 0);
  437. return std::abs(left - right);
  438. };
  439. // Verify that nudge widget is centered in shelf.
  440. gfx::Rect shelf_bounds = shelf_widget->GetWindowBoundsInScreen();
  441. gfx::Rect nudge_bounds =
  442. drag_handle->drag_handle_nudge()->label()->GetBoundsInScreen();
  443. EXPECT_LE(margin_diff(nudge_bounds, shelf_bounds), 1);
  444. // Verify that the nudge vertical bounds - within the shelf bounds, and above
  445. // the drag handle.
  446. gfx::Rect drag_handle_bounds = drag_handle->GetBoundsInScreen();
  447. EXPECT_LE(shelf_bounds.y(), nudge_bounds.y());
  448. EXPECT_LE(nudge_bounds.bottom(), drag_handle_bounds.y());
  449. // Change the display bounds, and verify the updated drag handle bounds.
  450. UpdateDisplay("1200x675");
  451. EXPECT_TRUE(
  452. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  453. // Verify that nudge widget is centered in shelf.
  454. shelf_bounds = shelf_widget->GetWindowBoundsInScreen();
  455. nudge_bounds = drag_handle->drag_handle_nudge()->label()->GetBoundsInScreen();
  456. EXPECT_LE(margin_diff(nudge_bounds, shelf_bounds), 1);
  457. // Verify that the nudge vertical bounds - within the shelf bounds, and above
  458. // the drag handle.
  459. drag_handle_bounds = drag_handle->GetBoundsInScreen();
  460. EXPECT_LE(shelf_bounds.y(), nudge_bounds.y());
  461. EXPECT_LE(nudge_bounds.bottom(), drag_handle_bounds.y());
  462. }
  463. // Tests that drag handle does not hide during the window drag from shelf
  464. // gesture.
  465. TEST_F(DragHandleContextualNudgeTest,
  466. DragHandleNudgeNotHiddenDuringWindowDragFromShelf) {
  467. TabletModeControllerTestApi().EnterTabletMode();
  468. // Creates a widget to put shelf into in-app state.
  469. views::Widget* widget = CreateTestWidget();
  470. widget->Maximize();
  471. ShelfWidget* const shelf_widget = GetShelfWidget();
  472. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  473. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  474. drag_handle->fire_show_drag_handle_timer_for_testing();
  475. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  476. TabletModeControllerTestApi().LeaveTabletMode();
  477. // Advance time for more than a day (which should enable the nudge again).
  478. test_clock_.Advance(base::Hours(25));
  479. TabletModeControllerTestApi().EnterTabletMode();
  480. EXPECT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  481. drag_handle->fire_show_drag_handle_timer_for_testing();
  482. EXPECT_TRUE(drag_handle->has_hide_drag_handle_timer_for_testing());
  483. const gfx::Point start = drag_handle->GetBoundsInScreen().CenterPoint();
  484. // Simulates window drag from shelf gesture, and verifies that the timer to
  485. // hide the drag handle nudge is canceled when the window drag from shelf
  486. // starts.
  487. GetEventGenerator()->GestureScrollSequenceWithCallback(
  488. start, start + gfx::Vector2d(0, -200), base::Milliseconds(50),
  489. /*num_steps = */ 6,
  490. base::BindRepeating(
  491. [](DragHandle* drag_handle, ui::EventType type,
  492. const gfx::Vector2dF& offset) {
  493. DragWindowFromShelfController* window_drag_controller =
  494. GetShelfLayoutManager()->window_drag_controller_for_testing();
  495. if (window_drag_controller &&
  496. window_drag_controller->dragged_window()) {
  497. EXPECT_FALSE(
  498. drag_handle->has_hide_drag_handle_timer_for_testing());
  499. }
  500. const bool scroll_end = type == ui::ET_GESTURE_SCROLL_END;
  501. EXPECT_EQ(!scroll_end,
  502. drag_handle->gesture_nudge_target_visibility());
  503. },
  504. drag_handle));
  505. // The nudge should be hidden when the gesture completes.
  506. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  507. }
  508. // Tests that window drag from shelf cancels drag handle contextual nudge from
  509. // showing.
  510. TEST_F(DragHandleContextualNudgeTest,
  511. DragHandleNudgeNotShownDuringWindowDragFromShelf) {
  512. TabletModeControllerTestApi().EnterTabletMode();
  513. // Creates a widget to put shelf into in-app state.
  514. views::Widget* widget = CreateTestWidget();
  515. widget->Maximize();
  516. ShelfWidget* const shelf_widget = GetShelfWidget();
  517. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  518. EXPECT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  519. const gfx::Point start =
  520. GetShelfWidget()->GetWindowBoundsInScreen().CenterPoint();
  521. // Simulates window drag from shelf gesture, and verifies that the timer to
  522. // show the drag handle nudge is canceled when the window drag from shelf
  523. // starts.
  524. GetEventGenerator()->GestureScrollSequenceWithCallback(
  525. start, start + gfx::Vector2d(0, -200), base::Milliseconds(50),
  526. /*num_steps = */ 6,
  527. base::BindRepeating(
  528. [](DragHandle* drag_handle, ui::EventType type,
  529. const gfx::Vector2dF& offset) {
  530. DragWindowFromShelfController* window_drag_controller =
  531. GetShelfLayoutManager()->window_drag_controller_for_testing();
  532. if (window_drag_controller &&
  533. window_drag_controller->dragged_window()) {
  534. EXPECT_FALSE(
  535. drag_handle->has_show_drag_handle_timer_for_testing());
  536. // Attempt to schedule the nudge should fail.
  537. if (type != ui::ET_GESTURE_SCROLL_END) {
  538. drag_handle->ScheduleShowDragHandleNudge();
  539. EXPECT_FALSE(
  540. drag_handle->has_show_drag_handle_timer_for_testing());
  541. }
  542. }
  543. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  544. },
  545. drag_handle));
  546. // The nudge should be hidden when the gesture completes.
  547. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  548. }
  549. TEST_F(DragHandleContextualNudgeTest, GestureSwipeHidesDragHandleNudge) {
  550. base::HistogramTester histogram_tester;
  551. TabletModeControllerTestApi().EnterTabletMode();
  552. // Creates a widget to put shelf into in-app state.
  553. views::Widget* widget = CreateTestWidget();
  554. widget->Maximize();
  555. ShelfWidget* const shelf_widget = GetShelfWidget();
  556. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  557. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  558. drag_handle->fire_show_drag_handle_timer_for_testing();
  559. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  560. const gfx::Point start = drag_handle->GetBoundsInScreen().CenterPoint();
  561. // Simulates a swipe up from the drag handle to perform the in app to home
  562. // gesture.
  563. GetEventGenerator()->GestureScrollSequence(
  564. start, start + gfx::Vector2d(0, -300), base::Milliseconds(10),
  565. /*num_steps = */ 5);
  566. // The nudge should be hidden when the gesture completes.
  567. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  568. GetAppListTestHelper()->CheckVisibility(true);
  569. }
  570. // Tests that drag handle nudge gets hidden when the user performs window drag
  571. // from shelf to home.
  572. TEST_F(DragHandleContextualNudgeTest, FlingFromShelfToHomeHidesTheNudge) {
  573. TabletModeControllerTestApi().EnterTabletMode();
  574. // Creates a widget to put shelf into in-app state.
  575. views::Widget* widget = CreateTestWidget();
  576. widget->Maximize();
  577. ShelfWidget* const shelf_widget = GetShelfWidget();
  578. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  579. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  580. drag_handle->fire_show_drag_handle_timer_for_testing();
  581. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  582. const gfx::Point start = drag_handle->GetBoundsInScreen().CenterPoint();
  583. // Simulates window drag from shelf gesture, and verifies that the timer to
  584. // hide the drag handle nudge is canceled when the window drag from shelf
  585. // starts.
  586. GetEventGenerator()->GestureScrollSequenceWithCallback(
  587. start, start + gfx::Vector2d(0, -300), base::Milliseconds(10),
  588. /*num_steps = */ 6,
  589. base::BindRepeating(
  590. [](DragHandle* drag_handle, ui::EventType type,
  591. const gfx::Vector2dF& offset) {
  592. const bool scroll_end = type == ui::ET_GESTURE_SCROLL_END;
  593. EXPECT_EQ(!scroll_end,
  594. drag_handle->gesture_nudge_target_visibility());
  595. },
  596. drag_handle));
  597. // The nudge should be hidden when the gesture completes.
  598. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  599. GetAppListTestHelper()->CheckVisibility(true);
  600. }
  601. // Tests that drag handle nudge gets hidden when the user performs window drag
  602. // from shelf, even if the gesture does not end up going home.
  603. TEST_F(DragHandleContextualNudgeTest, DragFromShelfToHomeHidesTheNudge) {
  604. TabletModeControllerTestApi().EnterTabletMode();
  605. // Creates a widget to put shelf into in-app state.
  606. views::Widget* widget = CreateTestWidget();
  607. widget->Maximize();
  608. ShelfWidget* const shelf_widget = GetShelfWidget();
  609. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  610. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  611. drag_handle->fire_show_drag_handle_timer_for_testing();
  612. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  613. const gfx::Point start = drag_handle->GetBoundsInScreen().CenterPoint();
  614. // Simulates window drag from shelf gesture, and verifies that the timer to
  615. // hide the drag handle nudge is canceled when the window drag from shelf
  616. // starts.
  617. GetEventGenerator()->GestureScrollSequenceWithCallback(
  618. start, start + gfx::Vector2d(0, -150), base::Milliseconds(500),
  619. /*num_steps = */ 20,
  620. base::BindRepeating(
  621. [](DragHandle* drag_handle, ui::EventType type,
  622. const gfx::Vector2dF& offset) {
  623. DragWindowFromShelfController* window_drag_controller =
  624. GetShelfLayoutManager()->window_drag_controller_for_testing();
  625. if (window_drag_controller &&
  626. window_drag_controller->dragged_window()) {
  627. DragWindowFromShelfControllerTestApi().WaitUntilOverviewIsShown(
  628. window_drag_controller);
  629. }
  630. const bool scroll_end = type == ui::ET_GESTURE_SCROLL_END;
  631. EXPECT_EQ(!scroll_end,
  632. drag_handle->gesture_nudge_target_visibility());
  633. },
  634. drag_handle));
  635. // The nudge should be hidden when the gesture completes.
  636. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  637. GetAppListTestHelper()->CheckVisibility(false);
  638. EXPECT_TRUE(Shell::Get()->overview_controller()->InOverviewSession());
  639. }
  640. // Tests that scheduled drag handle nudge show is canceled when overview starts.
  641. TEST_F(DragHandleContextualNudgeTest, OverviewCancelsNudgeShow) {
  642. TabletModeControllerTestApi().EnterTabletMode();
  643. // Creates a widget to put shelf into in-app state.
  644. views::Widget* widget = CreateTestWidget();
  645. widget->Maximize();
  646. ShelfWidget* const shelf_widget = GetShelfWidget();
  647. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  648. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  649. EnterOverview();
  650. ASSERT_FALSE(drag_handle->has_show_drag_handle_timer_for_testing());
  651. }
  652. // Tests that tapping the drag handle can shown drag handle nudge in overview.
  653. TEST_F(DragHandleContextualNudgeTest, DragHandleTapShowNudgeInOverview) {
  654. TabletModeControllerTestApi().EnterTabletMode();
  655. // Creates a widget to put shelf into in-app state.
  656. views::Widget* widget = CreateTestWidget();
  657. widget->Maximize();
  658. ShelfWidget* const shelf_widget = GetShelfWidget();
  659. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  660. ASSERT_TRUE(drag_handle->has_show_drag_handle_timer_for_testing());
  661. drag_handle->fire_show_drag_handle_timer_for_testing();
  662. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  663. TabletModeControllerTestApi().LeaveTabletMode();
  664. TabletModeControllerTestApi().EnterTabletMode();
  665. EnterOverview();
  666. ASSERT_FALSE(drag_handle->has_show_drag_handle_timer_for_testing());
  667. GetEventGenerator()->GestureTapAt(
  668. drag_handle->GetBoundsInScreen().CenterPoint());
  669. EXPECT_TRUE(drag_handle->GetVisible());
  670. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  671. EXPECT_TRUE(drag_handle->has_hide_drag_handle_timer_for_testing());
  672. drag_handle->fire_hide_drag_handle_timer_for_testing();
  673. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  674. // Tapping the drag handle again will show the nudge again.
  675. GetEventGenerator()->GestureTapAt(
  676. drag_handle->GetBoundsInScreen().CenterPoint());
  677. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  678. }
  679. // Tests that tapping the drag handle in split screen does not show nudge.
  680. TEST_F(DragHandleContextualNudgeTest,
  681. DragHandleTapDoesNotShowNudgeForSplitScreen) {
  682. TabletModeControllerTestApi().EnterTabletMode();
  683. std::unique_ptr<aura::Window> window =
  684. AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
  685. wm::ActivateWindow(window.get());
  686. ShelfWidget* const shelf_widget = GetShelfWidget();
  687. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  688. // Go into split view mode by first going into overview, and then snapping
  689. // the open window on one side.
  690. EnterOverview();
  691. SplitViewController* split_view_controller =
  692. SplitViewController::Get(shelf_widget->GetNativeWindow());
  693. split_view_controller->SnapWindow(window.get(), SplitViewController::LEFT);
  694. EXPECT_TRUE(split_view_controller->InSplitViewMode());
  695. // Tapping the drag handle will not show the drag handle.
  696. GetEventGenerator()->GestureTapAt(
  697. drag_handle->GetBoundsInScreen().CenterPoint());
  698. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  699. }
  700. // Tests that entering split screen hides the drag handle nudge.
  701. TEST_F(DragHandleContextualNudgeTest, DragHandleNudgeHiddenOnSplitScreen) {
  702. TabletModeControllerTestApi().EnterTabletMode();
  703. std::unique_ptr<aura::Window> window =
  704. AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400));
  705. wm::ActivateWindow(window.get());
  706. ShelfWidget* const shelf_widget = GetShelfWidget();
  707. DragHandle* const drag_handle = shelf_widget->GetDragHandle();
  708. // Tapping the drag handle should show the drag handle.
  709. GetEventGenerator()->GestureTapAt(
  710. drag_handle->GetBoundsInScreen().CenterPoint());
  711. EXPECT_TRUE(drag_handle->gesture_nudge_target_visibility());
  712. // Go into split view mode by first going into overview, and then snapping
  713. // the open window on one side.
  714. EnterOverview();
  715. SplitViewController* split_view_controller =
  716. SplitViewController::Get(shelf_widget->GetNativeWindow());
  717. split_view_controller->SnapWindow(window.get(), SplitViewController::LEFT);
  718. EXPECT_TRUE(split_view_controller->InSplitViewMode());
  719. // The drag handle nudge should no longer be visible.
  720. EXPECT_FALSE(drag_handle->gesture_nudge_target_visibility());
  721. }
  722. TEST_P(DragHandleContextualNudgeTestA11yPrefs, HideNudgesForShelfControls) {
  723. SCOPED_TRACE(testing::Message() << "Pref=" << GetParam());
  724. // Creates a widget to put shelf into in-app state.
  725. views::Widget* widget = CreateTestWidget();
  726. widget->Maximize();
  727. TabletModeControllerTestApi().EnterTabletMode();
  728. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  729. // The drag handle should be showing but the nudge should not. A timer to show
  730. // the nudge should be initialized.
  731. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  732. EXPECT_FALSE(
  733. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  734. // Firing the timer should show the drag handle nudge.
  735. GetShelfWidget()->GetDragHandle()->fire_show_drag_handle_timer_for_testing();
  736. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  737. EXPECT_TRUE(
  738. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  739. // Enabling accessibility auto click disables gestures and enables shelf
  740. // control buttons. In app to home nudge should be hidden.
  741. Shell::Get()
  742. ->session_controller()
  743. ->GetLastActiveUserPrefService()
  744. ->SetBoolean(GetParam(), true);
  745. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  746. EXPECT_FALSE(
  747. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  748. }
  749. TEST_P(DragHandleContextualNudgeTestA11yPrefs, DisableNudgesForShelfControls) {
  750. SCOPED_TRACE(testing::Message() << "Pref=" << GetParam());
  751. // Turn on accessibility settings to enable shelf controls.
  752. Shell::Get()
  753. ->session_controller()
  754. ->GetLastActiveUserPrefService()
  755. ->SetBoolean(GetParam(), true);
  756. // Creates a widget to put shelf into in-app state.
  757. views::Widget* widget = CreateTestWidget();
  758. widget->Maximize();
  759. TabletModeControllerTestApi().EnterTabletMode();
  760. EXPECT_EQ(ShelfBackgroundType::kInApp, GetShelfWidget()->GetBackgroundType());
  761. // The drag handle should be showing but the nudge should not. A timer to show
  762. // the nudge should not be initialized because shelf controls are on.
  763. EXPECT_TRUE(GetShelfWidget()->GetDragHandle()->GetVisible());
  764. EXPECT_FALSE(
  765. GetShelfWidget()->GetDragHandle()->gesture_nudge_target_visibility());
  766. EXPECT_FALSE(GetShelfWidget()
  767. ->GetDragHandle()
  768. ->has_show_drag_handle_timer_for_testing());
  769. }
  770. } // namespace ash