Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
testing_process_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2012 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Guest <thomas.guest@canonical.com>
17  */
18 
19 #ifndef MIR_TESTING_PROCESS_MANAGER
20 #define MIR_TESTING_PROCESS_MANAGER
21 
23 
25 
28 
29 #include <memory>
30 #include <list>
31 #include <functional>
32 
33 namespace mir
34 {
35 class DisplayServer;
36 namespace options
37 {
38 class Option;
39 }
40 }
41 
42 namespace mir_test_framework
43 {
44 using namespace mir;
45 
46 
48 {
49 public:
52 
53  void launch_server_process(TestingServerConfiguration& config);
54  void launch_client_process(TestingClientConfiguration& config,
55  mir::options::Option const& test_options);
56 
57  void tear_down_clients();
58  void tear_down_server();
59  void tear_down_all();
60  Result shutdown_server_process();
61  void kill_client_processes();
62  void terminate_client_processes();
63  void run_in_test_process(std::function<void()> const& run_code);
64 
65 private:
66  std::shared_ptr<Process> server_process;
67  std::list<std::shared_ptr<Process>> clients;
68 
69  bool is_test_process;
70  bool server_process_was_started;
71 };
72 
73 std::string const& test_socket_file();
74 
75 }
76 
77 #endif // MIR_TESTING_PROCESS_MANAGER

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013