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

Side by Side Diff: ash/mus/test/wm_test_helper.h

Issue 2322613002: Adds support for multiple displays to WmTestBase (Closed)
Patch Set: moar Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_MUS_TEST_WM_TEST_HELPER_H_ 5 #ifndef ASH_MUS_TEST_WM_TEST_HELPER_H_
6 #define ASH_MUS_TEST_WM_TEST_HELPER_H_ 6 #define ASH_MUS_TEST_WM_TEST_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/mus/window_manager_application.h" 10 #include "ash/mus/window_manager_application.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "services/ui/public/cpp/tests/test_window_tree_client_setup.h" 12 #include "services/ui/public/cpp/tests/test_window_tree_client_setup.h"
13 13
14 namespace base { 14 namespace base {
15 class MessageLoop; 15 class MessageLoop;
16 class SequencedWorkerPoolOwner; 16 class SequencedWorkerPoolOwner;
17 } 17 }
18 18
19 namespace gfx { 19 namespace gfx {
20 class Rect; 20 class Rect;
21 } 21 }
22 22
23 namespace ui { 23 namespace ui {
24 class Window; 24 class Window;
25 class WindowTreeClientPrivate;
25 } 26 }
26 27
27 namespace ash { 28 namespace ash {
28 namespace mus { 29 namespace mus {
29 30
31 class RootWindowController;
30 class WmTestScreen; 32 class WmTestScreen;
31 33
32 // WMTestHelper is responsible for configuring a WindowTreeClient that 34 // WMTestHelper is responsible for configuring a WindowTreeClient that
33 // does not talk to mus. Additionally a test Screen (WmTestScreen) is created. 35 // does not talk to mus. Additionally a test Screen (WmTestScreen) is created.
34 class WmTestHelper { 36 class WmTestHelper {
35 public: 37 public:
36 WmTestHelper(); 38 WmTestHelper();
37 ~WmTestHelper(); 39 ~WmTestHelper();
38 40
39 void Init(); 41 void Init();
40 42
41 WindowManagerApplication* window_manager_app() { 43 WindowManagerApplication* window_manager_app() {
42 return window_manager_app_.get(); 44 return window_manager_app_.get();
43 } 45 }
44 46
45 WmTestScreen* screen() { return screen_; } 47 WmTestScreen* screen() { return screen_; }
46 48
49 // Returns the RootWindowControllers ordered by display id (which we assume
50 // correlates with creation order).
51 std::vector<RootWindowController*> GetRootsOrderedByDisplayId();
52
53 void UpdateDisplay(const std::string& display_spec);
54
47 private: 55 private:
56 // Creates a new RootWindowController given |display_spec|, which is the
57 // configuration of the display.
58 RootWindowController* CreateRootWindowController(
59 const std::string& display_spec);
60
61 // Updates the display of an existing RootWindowController.
62 void UpdateDisplay(RootWindowController* root_window_controller,
63 const std::string& display_spec);
64
65 // Destroys a RootWindowController.
66 void DestroyRootWindowController(
67 RootWindowController* root_window_controller);
68
48 std::unique_ptr<base::MessageLoop> message_loop_; 69 std::unique_ptr<base::MessageLoop> message_loop_;
49 ui::TestWindowTreeClientSetup window_tree_client_setup_; 70 ui::TestWindowTreeClientSetup window_tree_client_setup_;
50 std::unique_ptr<WindowManagerApplication> window_manager_app_; 71 std::unique_ptr<WindowManagerApplication> window_manager_app_;
51 WmTestScreen* screen_ = nullptr; // Owned by |window_manager_app_|. 72 WmTestScreen* screen_ = nullptr; // Owned by |window_manager_app_|.
73 std::unique_ptr<ui::WindowTreeClientPrivate> window_tree_client_private_;
74
75 // Id for the next Display created by CreateRootWindowController().
76 int64_t next_display_id_ = 1;
77
52 std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_; 78 std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_;
53 79
54 DISALLOW_COPY_AND_ASSIGN(WmTestHelper); 80 DISALLOW_COPY_AND_ASSIGN(WmTestHelper);
55 }; 81 };
56 82
57 } // namespace mus 83 } // namespace mus
58 } // namespace ash 84 } // namespace ash
59 85
60 #endif // ASH_MUS_TEST_WM_TEST_HELPER_H_ 86 #endif // ASH_MUS_TEST_WM_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698