OLD | NEW |
| (Empty) |
1 // Copyright 2016 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_MUS_TEST_WM_TEST_HELPER_H_ | |
6 #define ASH_MUS_TEST_WM_TEST_HELPER_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "ash/mus/window_manager_application.h" | |
11 #include "base/macros.h" | |
12 #include "ui/aura/test/mus/test_window_tree_client_setup.h" | |
13 | |
14 namespace aura { | |
15 class WindowTreeClientPrivate; | |
16 } | |
17 | |
18 namespace base { | |
19 class MessageLoop; | |
20 class SequencedWorkerPoolOwner; | |
21 } | |
22 | |
23 namespace ui { | |
24 class InputDeviceClient; | |
25 } | |
26 | |
27 namespace views { | |
28 class ViewsDelegate; | |
29 } | |
30 | |
31 namespace ash { | |
32 | |
33 class RootWindowController; | |
34 | |
35 namespace mus { | |
36 | |
37 // WMTestHelper is responsible for configuring a WindowTreeClient that | |
38 // does not talk to mus. | |
39 class WmTestHelper { | |
40 public: | |
41 WmTestHelper(); | |
42 ~WmTestHelper(); | |
43 | |
44 void Init(); | |
45 | |
46 WindowManagerApplication* window_manager_app() { | |
47 return window_manager_app_.get(); | |
48 } | |
49 | |
50 // Returns the RootWindowControllers ordered by display id (which we assume | |
51 // correlates with creation order). | |
52 std::vector<RootWindowController*> GetRootsOrderedByDisplayId(); | |
53 | |
54 void UpdateDisplay(const std::string& display_spec); | |
55 | |
56 private: | |
57 // Creates a new RootWindowController given |display_spec|, which is the | |
58 // configuration of the display. On entry |next_x| is the x-coordinate to | |
59 // place the display at, on exit |next_x| is set to the x-coordinate to place | |
60 // the next display at. | |
61 RootWindowController* CreateRootWindowController( | |
62 const std::string& display_spec, | |
63 int* next_x); | |
64 | |
65 // Updates the display of an existing RootWindowController. See | |
66 // CreateRootWindowController() for details on |next_x|. | |
67 void UpdateDisplay(RootWindowController* root_window_controller, | |
68 const std::string& display_spec, | |
69 int* next_x); | |
70 | |
71 // Destroys a RootWindowController. | |
72 void DestroyRootWindowController( | |
73 RootWindowController* root_window_controller); | |
74 | |
75 std::unique_ptr<base::MessageLoop> message_loop_; | |
76 std::unique_ptr<views::ViewsDelegate> views_delegate_; | |
77 aura::TestWindowTreeClientSetup window_tree_client_setup_; | |
78 std::unique_ptr<WindowManagerApplication> window_manager_app_; | |
79 std::unique_ptr<aura::WindowTreeClientPrivate> window_tree_client_private_; | |
80 | |
81 // Id for the next Display created by CreateRootWindowController(). | |
82 int64_t next_display_id_ = 1; | |
83 | |
84 std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_; | |
85 | |
86 std::unique_ptr<ui::InputDeviceClient> input_device_client_; | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(WmTestHelper); | |
89 }; | |
90 | |
91 } // namespace mus | |
92 } // namespace ash | |
93 | |
94 #endif // ASH_MUS_TEST_WM_TEST_HELPER_H_ | |
OLD | NEW |