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 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 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "components/mus/public/cpp/window_tree_client_observer.h" | |
12 | |
13 namespace display { | |
14 class Display; | |
15 } | |
16 | |
17 namespace mus { | |
18 | |
19 class TestWindowTree; | |
20 class WindowManagerDelegate; | |
21 class WindowTreeClient; | |
22 class WindowTreeClientDelegate; | |
23 | |
24 // TestWindowTreeClientSetup is used to create a WindowTreeClient that is not | |
25 // connected to mus. | |
26 class TestWindowTreeClientSetup : public mus::WindowTreeClientObserver { | |
27 public: | |
28 TestWindowTreeClientSetup(); | |
29 ~TestWindowTreeClientSetup() override; | |
30 | |
31 // Initializes the WindowTreeClient. | |
32 void Init(WindowTreeClientDelegate* window_tree_delegate); | |
33 void InitForWindowManager(WindowTreeClientDelegate* window_tree_delegate, | |
34 WindowManagerDelegate* window_manager_delegate, | |
35 const display::Display& display); | |
36 | |
37 // The WindowTree that WindowTreeClient talks to. | |
38 TestWindowTree* window_tree() { return window_tree_.get(); } | |
39 | |
40 WindowTreeClient* window_tree_client(); | |
41 | |
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 | |
47 // mus::WindowTreeClientObserver: | |
48 void OnDidDestroyClient(mus::WindowTreeClient* client) override; | |
49 | |
50 std::unique_ptr<TestWindowTree> window_tree_; | |
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_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClientSetup); | |
58 }; | |
59 | |
60 } // namespace mus | |
61 | |
62 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CLIENT_SETUP_H_ | |
OLD | NEW |