| 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 SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ | 6 #define SERVICES_UI_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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 // Initializes the WindowTreeClient. | 31 // Initializes the WindowTreeClient. |
| 32 void Init(WindowTreeClientDelegate* window_tree_delegate); | 32 void Init(WindowTreeClientDelegate* window_tree_delegate); |
| 33 void InitForWindowManager(WindowTreeClientDelegate* window_tree_delegate, | 33 void InitForWindowManager(WindowTreeClientDelegate* window_tree_delegate, |
| 34 WindowManagerDelegate* window_manager_delegate, | 34 WindowManagerDelegate* window_manager_delegate, |
| 35 const display::Display& display); | 35 const display::Display& display); |
| 36 | 36 |
| 37 // The WindowTree that WindowTreeClient talks to. | 37 // The WindowTree that WindowTreeClient talks to. |
| 38 TestWindowTree* window_tree() { return window_tree_.get(); } | 38 TestWindowTree* window_tree() { return window_tree_.get(); } |
| 39 | 39 |
| 40 // Returns ownership of WindowTreeClient to the caller. |
| 41 std::unique_ptr<WindowTreeClient> OwnWindowTreeClient(); |
| 42 |
| 40 WindowTreeClient* window_tree_client(); | 43 WindowTreeClient* window_tree_client(); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 // Called by both implementations of init to perform common initialization. | 46 // Called by both implementations of init to perform common initialization. |
| 44 void CommonInit(WindowTreeClientDelegate* window_tree_delegate, | 47 void CommonInit(WindowTreeClientDelegate* window_tree_delegate, |
| 45 WindowManagerDelegate* window_manager_delegate); | 48 WindowManagerDelegate* window_manager_delegate); |
| 46 | 49 |
| 47 // ui::WindowTreeClientObserver: | |
| 48 void OnDidDestroyClient(ui::WindowTreeClient* client) override; | |
| 49 | |
| 50 std::unique_ptr<TestWindowTree> window_tree_; | 50 std::unique_ptr<TestWindowTree> window_tree_; |
| 51 | 51 |
| 52 // See description of WindowTreeClientDelegate for details on ownership. The | |
| 53 // WindowTreeClient may be deleted during shutdown by the test. If not, | |
| 54 // we own it and must delete it. | |
| 55 std::unique_ptr<WindowTreeClient> window_tree_client_; | 52 std::unique_ptr<WindowTreeClient> window_tree_client_; |
| 56 | 53 |
| 57 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClientSetup); | 54 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClientSetup); |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 } // namespace ui | 57 } // namespace ui |
| 61 | 58 |
| 62 #endif // SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ | 59 #endif // SERVICES_UI_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ |
| OLD | NEW |