| OLD | NEW |
| 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 |
| 30 class WmTestScreen; | 31 class RootWindowController; |
| 31 | 32 |
| 32 // WMTestHelper is responsible for configuring a WindowTreeClient that | 33 // WMTestHelper is responsible for configuring a WindowTreeClient that |
| 33 // does not talk to mus. Additionally a test Screen (WmTestScreen) is created. | 34 // does not talk to mus. |
| 34 class WmTestHelper { | 35 class WmTestHelper { |
| 35 public: | 36 public: |
| 36 WmTestHelper(); | 37 WmTestHelper(); |
| 37 ~WmTestHelper(); | 38 ~WmTestHelper(); |
| 38 | 39 |
| 39 void Init(); | 40 void Init(); |
| 40 | 41 |
| 41 WindowManagerApplication* window_manager_app() { | 42 WindowManagerApplication* window_manager_app() { |
| 42 return window_manager_app_.get(); | 43 return window_manager_app_.get(); |
| 43 } | 44 } |
| 44 | 45 |
| 45 WmTestScreen* screen() { return screen_; } | 46 // Returns the RootWindowControllers ordered by display id (which we assume |
| 47 // correlates with creation order). |
| 48 std::vector<RootWindowController*> GetRootsOrderedByDisplayId(); |
| 49 |
| 50 void UpdateDisplay(const std::string& display_spec); |
| 46 | 51 |
| 47 private: | 52 private: |
| 53 // Creates a new RootWindowController given |display_spec|, which is the |
| 54 // configuration of the display. |
| 55 RootWindowController* CreateRootWindowController( |
| 56 const std::string& display_spec); |
| 57 |
| 58 // Updates the display of an existing RootWindowController. |
| 59 void UpdateDisplay(RootWindowController* root_window_controller, |
| 60 const std::string& display_spec); |
| 61 |
| 62 // Destroys a RootWindowController. |
| 63 void DestroyRootWindowController( |
| 64 RootWindowController* root_window_controller); |
| 65 |
| 48 std::unique_ptr<base::MessageLoop> message_loop_; | 66 std::unique_ptr<base::MessageLoop> message_loop_; |
| 49 ui::TestWindowTreeClientSetup window_tree_client_setup_; | 67 ui::TestWindowTreeClientSetup window_tree_client_setup_; |
| 50 std::unique_ptr<WindowManagerApplication> window_manager_app_; | 68 std::unique_ptr<WindowManagerApplication> window_manager_app_; |
| 51 WmTestScreen* screen_ = nullptr; // Owned by |window_manager_app_|. | 69 std::unique_ptr<ui::WindowTreeClientPrivate> window_tree_client_private_; |
| 70 |
| 71 // Id for the next Display created by CreateRootWindowController(). |
| 72 int64_t next_display_id_ = 1; |
| 73 |
| 52 std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_; | 74 std::unique_ptr<base::SequencedWorkerPoolOwner> blocking_pool_owner_; |
| 53 | 75 |
| 54 DISALLOW_COPY_AND_ASSIGN(WmTestHelper); | 76 DISALLOW_COPY_AND_ASSIGN(WmTestHelper); |
| 55 }; | 77 }; |
| 56 | 78 |
| 57 } // namespace mus | 79 } // namespace mus |
| 58 } // namespace ash | 80 } // namespace ash |
| 59 | 81 |
| 60 #endif // ASH_MUS_TEST_WM_TEST_HELPER_H_ | 82 #endif // ASH_MUS_TEST_WM_TEST_HELPER_H_ |
| OLD | NEW |