Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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  Result wait_for_shutdown_server_process();
62  void kill_client_processes();
63  void terminate_client_processes();
64  void run_in_test_process(std::function<void()> const& run_code);
65 
66 private:
67  std::shared_ptr<Process> server_process;
68  std::list<std::shared_ptr<Process>> clients;
69 
70  bool is_test_process;
71  bool server_process_was_started;
72 };
73 
74 std::string const& test_socket_file();
75 
76 }
77 
78 #endif // MIR_TESTING_PROCESS_MANAGER
Definition: testing_process_manager.h:47
Definition: testing_client_configuration.h:27
Definition: testing_server_configuration.h:30
Definition: process.h:47
std::string const & test_socket_file()
Definition: option.h:33

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014