Mir
server_runner.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 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 2 or 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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_TEST_FRAMEWORK_SERVER_RUNNER_H_
20 #define MIR_TEST_FRAMEWORK_SERVER_RUNNER_H_
21 
22 #include <gtest/gtest.h>
23 
24 #include <string>
25 #include <thread>
26 #include <memory>
27 #include <mutex>
28 
29 namespace mir
30 {
31 class MainLoop;
32 class DefaultServerConfiguration;
33 }
34 
35 namespace mir_test_framework
36 {
39 {
40  ServerRunner();
41  virtual ~ServerRunner();
42 
45  void start_server();
46 
49  void stop_server();
50 
52  std::string new_connection();
53 
55  std::string new_prompt_connection();
56 
57 private:
58  std::shared_ptr<mir::MainLoop> start_mir_server();
59  virtual mir::DefaultServerConfiguration& server_config() = 0;
60 
61  char const* const old_env;
62  std::thread server_thread;
63  std::mutex main_loop_mutex;
64  std::shared_ptr<mir::MainLoop> main_loop;
65 };
66 }
67 
68 #endif /* MIR_TEST_FRAMEWORK_SERVER_RUNNER_H_ */
AutoUnblockThread is a helper thread class that can gracefully shutdown at destruction time...
Definition: sw_splash.h:26
Definition: any_surface.h:25
Utility for running Mir server in test process.
Definition: server_runner.h:38

Copyright © 2012-2017 Canonical Ltd.
Generated on Wed Oct 11 15:14:10 UTC 2017