Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
input_testing_server_configuration.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 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: Robert Carr <robert.carr@canonical.com>
17  */
18 
19 
20 #ifndef MIR_TEST_INPUT_TESTING_SERVER_CONFIGURATION_H_
21 #define MIR_TEST_INPUT_TESTING_SERVER_CONFIGURATION_H_
22 
24 
25 #include "mir/geometry/rectangle.h"
26 
27 #include <map>
28 #include <string>
29 #include <mutex>
30 #include <condition_variable>
31 #include <atomic>
32 #include <thread>
33 
34 namespace mir
35 {
36 namespace input
37 {
38 namespace android
39 {
40 class FakeEventHub;
41 }
42 }
43 namespace test
44 {
45 namespace doubles
46 {
47 class FakeEventHubInputConfiguration;
48 }
49 }
50 }
51 
52 namespace mir_test_framework
53 {
54 
56 
58 {
59 public:
61 
62  void exec();
63  void on_exit();
64 
65  std::shared_ptr<mir::input::InputConfiguration> the_input_configuration() override;
66  std::shared_ptr<mir::frontend::Shell> the_frontend_shell() override;
67 
68 protected:
69  virtual void inject_input() = 0;
70  mir::input::android::FakeEventHub* fake_event_hub;
71 
72  void wait_until_client_appears(std::string const& surface_name);
73 
74 private:
75  std::mutex lifecycle_lock;
76 
77  std::condition_variable lifecycle_condition;
78  std::map<std::string, ClientLifecycleState> client_lifecycles;
79 
80  std::thread input_injection_thread;
81 
82  std::shared_ptr<mir::test::doubles::FakeEventHubInputConfiguration> input_configuration;
83  std::shared_ptr<mir::frontend::Shell> frontend_shell;
84 };
85 
86 }
87 
88 #endif /* MIR_TEST_INPUT_TESTING_SERVER_CONFIGURATION_H_ */

Copyright © 2012,2013 Canonical Ltd.
Generated on Wed Oct 30 18:52:19 UTC 2013