1 // Copyright 2019 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 
5 #ifndef ASH_WM_OVERVIEW_OVERVIEW_TEST_UTIL_H_
6 #define ASH_WM_OVERVIEW_OVERVIEW_TEST_UTIL_H_
7 
8 #include "ash/wm/overview/overview_session.h"
9 #include "base/macros.h"
10 #include "ui/events/keycodes/keyboard_codes_posix.h"
11 
12 namespace ash {
13 
14 void SendKey(ui::KeyboardCode key, int flags = ui::EF_NONE);
15 
16 // Highlights |window| in the active overview session by cycling through all
17 // windows in overview until it is found. Returns true if |window| was found,
18 // false otherwise.
19 bool HighlightOverviewWindow(const aura::Window* window);
20 
21 // Gets the current highlighted window. Returns nullptr if no window is
22 // highlighted.
23 const aura::Window* GetOverviewHighlightedWindow();
24 
25 void ToggleOverview(
26     OverviewEnterExitType type = OverviewEnterExitType::kNormal);
27 
28 // Waits for the overview enter/exit anmations to finish. No-op and immediately
29 // return if animations are disabled.
30 void WaitForOverviewEnterAnimation();
31 void WaitForOverviewExitAnimation();
32 
33 OverviewSession* GetOverviewSession();
34 
35 const std::vector<std::unique_ptr<OverviewItem>>& GetOverviewItemsForRoot(
36     int index);
37 
38 // Returns the OverviewItem associated with |window| if it exists.
39 OverviewItem* GetOverviewItemForWindow(aura::Window* window);
40 
41 // Returns a rect that accounts for the shelf hotseat. Used by tests which test
42 // the grids' bounds in relation to work area or snapped window bounds.
43 gfx::Rect ShrinkBoundsByHotseatInset(const gfx::Rect& rect);
44 
45 }  // namespace ash
46 
47 #endif  // ASH_WM_OVERVIEW_OVERVIEW_TEST_UTIL_H_
48