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_CONNECTION_SETUP_H_ | |
6 #define COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CONNECTION_SETUP_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/macros.h" | |
11 #include "components/mus/public/cpp/window_tree_connection_observer.h" | |
12 | |
13 namespace mus { | |
14 | |
15 class TestWindowTree; | |
16 class WindowManagerDelegate; | |
17 class WindowTreeClientImpl; | |
18 class WindowTreeConnection; | |
19 class WindowTreeDelegate; | |
20 | |
21 // TestWindowTreeConnectionSetup is used to create a WindowTreeConnection | |
22 // (really a WindowTreeClientImpl) that is not connected to mus. | |
23 class TestWindowTreeConnectionSetup : public mus::WindowTreeConnectionObserver { | |
24 public: | |
25 TestWindowTreeConnectionSetup(); | |
26 ~TestWindowTreeConnectionSetup() override; | |
27 | |
28 // Initializes the WindowTreeConnection. |window_manager_delegate| may be | |
29 // null. | |
30 void Init(WindowTreeDelegate* window_tree_delegate, | |
31 WindowManagerDelegate* window_manager_delegate); | |
32 | |
33 // The WindowTree that WindowTreeConnection talks to. | |
34 TestWindowTree* window_tree() { return window_tree_.get(); } | |
35 | |
36 WindowTreeConnection* window_tree_connection(); | |
37 | |
38 private: | |
39 // mus::WindowTreeConnectionObserver: | |
40 void OnWillDestroyConnection(mus::WindowTreeConnection* connection) override; | |
41 | |
42 std::unique_ptr<TestWindowTree> window_tree_; | |
43 | |
44 // See description of WindowTreeDelegate for details on ownership. The | |
45 // WindowTreeClientImpl may be deleted during shutdown by the test. If not, | |
46 // we own it and must delete it. | |
47 std::unique_ptr<WindowTreeClientImpl> window_tree_client_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(TestWindowTreeConnectionSetup); | |
50 }; | |
51 | |
52 } // namespace mus | |
53 | |
54 #endif // COMPONENTS_MUS_PUBLIC_CPP_TESTS_TEST_WINDOW_TREE_CONNECTION_SETUP_H_ | |
OLD | NEW |