| 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 COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "components/mus/public/cpp/window_tree_client_observer.h" | 11 #include "components/mus/public/cpp/window_tree_client_observer.h" |
| 12 | 12 |
| 13 namespace display { |
| 14 class Display; |
| 15 } |
| 16 |
| 13 namespace mus { | 17 namespace mus { |
| 14 | 18 |
| 15 class TestWindowTree; | 19 class TestWindowTree; |
| 16 class WindowManagerDelegate; | 20 class WindowManagerDelegate; |
| 17 class WindowTreeClient; | 21 class WindowTreeClient; |
| 18 class WindowTreeClientDelegate; | 22 class WindowTreeClientDelegate; |
| 19 | 23 |
| 20 // TestWindowTreeClientSetup is used to create a WindowTreeClient that is not | 24 // TestWindowTreeClientSetup is used to create a WindowTreeClient that is not |
| 21 // connected to mus. | 25 // connected to mus. |
| 22 class TestWindowTreeClientSetup : public mus::WindowTreeClientObserver { | 26 class TestWindowTreeClientSetup : public mus::WindowTreeClientObserver { |
| 23 public: | 27 public: |
| 24 TestWindowTreeClientSetup(); | 28 TestWindowTreeClientSetup(); |
| 25 ~TestWindowTreeClientSetup() override; | 29 ~TestWindowTreeClientSetup() override; |
| 26 | 30 |
| 27 // Initializes the WindowTreeClient. |window_manager_delegate| may be | 31 // Initializes the WindowTreeClient. |
| 28 // null. | 32 void Init(WindowTreeClientDelegate* window_tree_delegate); |
| 29 void Init(WindowTreeClientDelegate* window_tree_delegate, | 33 void InitForWindowManager(WindowTreeClientDelegate* window_tree_delegate, |
| 30 WindowManagerDelegate* window_manager_delegate); | 34 WindowManagerDelegate* window_manager_delegate, |
| 35 const display::Display& display); |
| 31 | 36 |
| 32 // The WindowTree that WindowTreeClient talks to. | 37 // The WindowTree that WindowTreeClient talks to. |
| 33 TestWindowTree* window_tree() { return window_tree_.get(); } | 38 TestWindowTree* window_tree() { return window_tree_.get(); } |
| 34 | 39 |
| 35 WindowTreeClient* window_tree_client(); | 40 WindowTreeClient* window_tree_client(); |
| 36 | 41 |
| 37 private: | 42 private: |
| 43 // Called by both implementations of init to perform common initialization. |
| 44 void CommonInit(WindowTreeClientDelegate* window_tree_delegate, |
| 45 WindowManagerDelegate* window_manager_delegate); |
| 46 |
| 38 // mus::WindowTreeClientObserver: | 47 // mus::WindowTreeClientObserver: |
| 39 void OnWillDestroyClient(mus::WindowTreeClient* client) override; | 48 void OnWillDestroyClient(mus::WindowTreeClient* client) override; |
| 40 | 49 |
| 41 std::unique_ptr<TestWindowTree> window_tree_; | 50 std::unique_ptr<TestWindowTree> window_tree_; |
| 42 | 51 |
| 43 // See description of WindowTreeClientDelegate for details on ownership. The | 52 // See description of WindowTreeClientDelegate for details on ownership. The |
| 44 // WindowTreeClient may be deleted during shutdown by the test. If not, | 53 // WindowTreeClient may be deleted during shutdown by the test. If not, |
| 45 // we own it and must delete it. | 54 // we own it and must delete it. |
| 46 std::unique_ptr<WindowTreeClient> window_tree_client_; | 55 std::unique_ptr<WindowTreeClient> window_tree_client_; |
| 47 | 56 |
| 48 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClientSetup); | 57 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClientSetup); |
| 49 }; | 58 }; |
| 50 | 59 |
| 51 } // namespace mus | 60 } // namespace mus |
| 52 | 61 |
| 53 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ | 62 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ |
| OLD | NEW |