Merge lp:~alan-griffiths/mir/socket-connection into lp:mir
- socket-connection
- Merge into development-branch
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Robert Ancell | ||||||||||||
Approved revision: | no longer in the source branch. | ||||||||||||
Merged at revision: | 1087 | ||||||||||||
Proposed branch: | lp:~alan-griffiths/mir/socket-connection | ||||||||||||
Merge into: | lp:mir | ||||||||||||
Diff against target: |
1779 lines (+594/-283) 32 files modified
examples/basic_server.cpp (+39/-4) examples/render_surfaces.cpp (+5/-4) include/server/mir/default_server_configuration.h (+10/-3) include/server/mir/frontend/connector.h (+14/-14) include/server/mir/frontend/connector_report.h (+9/-9) include/server/mir/frontend/session_creator.h (+44/-0) include/server/mir/server_configuration.h (+2/-2) include/test/mir_test/test_protobuf_server.h (+4/-4) src/server/default_server_configuration.cpp (+2/-0) src/server/display_server.cpp (+9/-9) src/server/frontend/CMakeLists.txt (+6/-7) src/server/frontend/default_configuration.cpp (+49/-21) src/server/frontend/protobuf_session_creator.cpp (+73/-0) src/server/frontend/protobuf_session_creator.h (+60/-0) src/server/frontend/published_socket_connector.cpp (+79/-76) src/server/frontend/published_socket_connector.h (+37/-38) src/server/frontend/socket_messenger.cpp (+2/-1) tests/acceptance-tests/test_client_library.cpp (+1/-1) tests/acceptance-tests/test_server_shutdown.cpp (+3/-3) tests/acceptance-tests/test_test_framework.cpp (+1/-1) tests/integration-tests/client/test_client_render.cpp (+1/-1) tests/integration-tests/shell/test_session.cpp (+5/-4) tests/integration-tests/test_display_server_main_loop_events.cpp (+33/-32) tests/integration-tests/test_error_reporting.cpp (+1/-1) tests/mir_test_doubles/test_protobuf_socket_server.cpp (+10/-10) tests/unit-tests/client/test_client_mir_surface.cpp (+1/-1) tests/unit-tests/frontend/CMakeLists.txt (+1/-1) tests/unit-tests/frontend/stress_protobuf_communicator.cpp (+1/-1) tests/unit-tests/frontend/test_protobuf_reports_errors.cpp (+1/-1) tests/unit-tests/frontend/test_protobuf_sends_fds.cpp (+1/-1) tests/unit-tests/frontend/test_protobuf_surface_apis.cpp (+1/-1) tests/unit-tests/frontend/test_published_socket_connector.cpp (+89/-32) |
||||||||||||
To merge this branch: | bzr merge lp:~alan-griffiths/mir/socket-connection | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Kevin DuBois (community) | Approve | ||
Alexandros Frantzis (community) | Approve | ||
Review via email: mp+187326@code.launchpad.net |
Commit message
frontend, config: Mechanism for connecting via a socket pair.
Description of the change
frontend, config: Mechanism for connecting via a socket pair.
PS Jenkins bot (ps-jenkins) wrote : | # |
Kevin DuBois (kdub) wrote : | # |
read through once, looks okay to me. want to look it over again, abstain for now
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1099
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Not a thorough review yet, but I like the new design separating the connection and session creation concerns.
A couple of nits I noticed:
952 +// Makes provides a client-side socket fd for each connection
1734 + EXPECT_
1735 +
1736 + for (int i = 0; i != 8; ++i)
int const num_buffer_
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1100
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1101
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Alexandros Frantzis (afrantzis) wrote : | # |
Looks good.
Nits:
496 +char const* const no_server_
Not used.
504 + return std::make_
505 + the_ipc_
506 + the_buffer_
Current indentation makes the_buffer_
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1103
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Kevin DuBois (kdub) wrote : | # |
client_socket_fd()
the function looks like its making a new session, and creating an fd for a new client. The name could be create_
create_
are we creating a session for the socket? or creating a session with a socket? create_
those are pretty minor naming issues though, lgtm
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'examples/basic_server.cpp' | |||
2 | --- examples/basic_server.cpp 2013-08-29 03:48:16 +0000 | |||
3 | +++ examples/basic_server.cpp 2013-09-25 14:20:36 +0000 | |||
4 | @@ -16,18 +16,53 @@ | |||
5 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
6 | 17 | */ | 17 | */ |
7 | 18 | 18 | ||
8 | 19 | #include "server_configuration.h" | ||
9 | 20 | |||
10 | 21 | #include "mir/abnormal_exit.h" | ||
11 | 22 | #include "mir/frontend/connector.h" | ||
12 | 23 | #include "mir/options/option.h" | ||
13 | 24 | #include "mir/report_exception.h" | ||
14 | 19 | #include "mir/run_mir.h" | 25 | #include "mir/run_mir.h" |
15 | 20 | #include "mir/report_exception.h" | ||
16 | 21 | #include "server_configuration.h" | ||
17 | 22 | 26 | ||
18 | 23 | #include <iostream> | 27 | #include <iostream> |
19 | 24 | 28 | ||
20 | 29 | namespace | ||
21 | 30 | { | ||
22 | 31 | char const* const launch_child_opt = "launch-client"; | ||
23 | 32 | |||
24 | 33 | struct ServerConfiguration : mir::examples::ServerConfiguration | ||
25 | 34 | { | ||
26 | 35 | ServerConfiguration(int argc, char const** argv) : | ||
27 | 36 | mir::examples::ServerConfiguration(argc, argv) | ||
28 | 37 | { | ||
29 | 38 | namespace po = boost::program_options; | ||
30 | 39 | |||
31 | 40 | add_options() | ||
32 | 41 | (launch_child_opt, po::value<std::string>(), "system() command to launch client"); | ||
33 | 42 | } | ||
34 | 43 | |||
35 | 44 | void launch_client() | ||
36 | 45 | { | ||
37 | 46 | if (the_options()->is_set(launch_child_opt)) | ||
38 | 47 | { | ||
39 | 48 | char buffer[128] = {0}; | ||
40 | 49 | sprintf(buffer, "fd://%d", the_connector()->client_socket_fd()); | ||
41 | 50 | setenv("MIR_SOCKET", buffer, 1); | ||
42 | 51 | auto ignore = system((the_options()->get(launch_child_opt, "") + "&").c_str()); | ||
43 | 52 | (void)ignore; | ||
44 | 53 | } | ||
45 | 54 | } | ||
46 | 55 | |||
47 | 56 | using mir::examples::ServerConfiguration::the_options; | ||
48 | 57 | }; | ||
49 | 58 | } | ||
50 | 59 | |||
51 | 25 | int main(int argc, char const* argv[]) | 60 | int main(int argc, char const* argv[]) |
52 | 26 | try | 61 | try |
53 | 27 | { | 62 | { |
55 | 28 | mir::examples::ServerConfiguration config(argc, argv); | 63 | ServerConfiguration config(argc, argv); |
56 | 29 | 64 | ||
58 | 30 | run_mir(config, [](mir::DisplayServer&) {/* empty init */}); | 65 | run_mir(config, [&](mir::DisplayServer&){ config.launch_client(); }); |
59 | 31 | return 0; | 66 | return 0; |
60 | 32 | } | 67 | } |
61 | 33 | catch (...) | 68 | catch (...) |
62 | 34 | 69 | ||
63 | === modified file 'examples/render_surfaces.cpp' | |||
64 | --- examples/render_surfaces.cpp 2013-09-19 13:24:22 +0000 | |||
65 | +++ examples/render_surfaces.cpp 2013-09-25 14:20:36 +0000 | |||
66 | @@ -19,7 +19,7 @@ | |||
67 | 19 | #include "mir/compositor/default_display_buffer_compositor_factory.h" | 19 | #include "mir/compositor/default_display_buffer_compositor_factory.h" |
68 | 20 | #include "mir/compositor/display_buffer_compositor.h" | 20 | #include "mir/compositor/display_buffer_compositor.h" |
69 | 21 | #include "mir/graphics/graphic_buffer_allocator.h" | 21 | #include "mir/graphics/graphic_buffer_allocator.h" |
71 | 22 | #include "mir/frontend/communicator.h" | 22 | #include "mir/frontend/connector.h" |
72 | 23 | #include "mir/shell/surface_creation_parameters.h" | 23 | #include "mir/shell/surface_creation_parameters.h" |
73 | 24 | #include "mir/geometry/size.h" | 24 | #include "mir/geometry/size.h" |
74 | 25 | #include "mir/geometry/rectangles.h" | 25 | #include "mir/geometry/rectangles.h" |
75 | @@ -266,15 +266,16 @@ | |||
76 | 266 | 266 | ||
77 | 267 | ///\internal [RenderSurfacesServerConfiguration_stubs_tag] | 267 | ///\internal [RenderSurfacesServerConfiguration_stubs_tag] |
78 | 268 | // Stub out server connectivity. | 268 | // Stub out server connectivity. |
80 | 269 | std::shared_ptr<mf::Communicator> the_communicator() override | 269 | std::shared_ptr<mf::Connector> the_connector() override |
81 | 270 | { | 270 | { |
83 | 271 | struct NullCommunicator : public mf::Communicator | 271 | struct NullConnector : public mf::Connector |
84 | 272 | { | 272 | { |
85 | 273 | void start() {} | 273 | void start() {} |
86 | 274 | void stop() {} | 274 | void stop() {} |
87 | 275 | int client_socket_fd() const override { return 0; } | ||
88 | 275 | }; | 276 | }; |
89 | 276 | 277 | ||
91 | 277 | return std::make_shared<NullCommunicator>(); | 278 | return std::make_shared<NullConnector>(); |
92 | 278 | } | 279 | } |
93 | 279 | ///\internal [RenderSurfacesServerConfiguration_stubs_tag] | 280 | ///\internal [RenderSurfacesServerConfiguration_stubs_tag] |
94 | 280 | 281 | ||
95 | 281 | 282 | ||
96 | === modified file 'include/server/mir/default_server_configuration.h' | |||
97 | --- include/server/mir/default_server_configuration.h 2013-09-23 13:37:44 +0000 | |||
98 | +++ include/server/mir/default_server_configuration.h 2013-09-25 14:20:36 +0000 | |||
99 | @@ -41,8 +41,9 @@ | |||
100 | 41 | namespace frontend | 41 | namespace frontend |
101 | 42 | { | 42 | { |
102 | 43 | class Shell; | 43 | class Shell; |
104 | 44 | class Communicator; | 44 | class Connector; |
105 | 45 | class ProtobufIpcFactory; | 45 | class ProtobufIpcFactory; |
106 | 46 | class SessionCreator; | ||
107 | 46 | class SessionMediatorReport; | 47 | class SessionMediatorReport; |
108 | 47 | class MessageProcessorReport; | 48 | class MessageProcessorReport; |
109 | 48 | class SessionAuthorizer; | 49 | class SessionAuthorizer; |
110 | @@ -118,7 +119,7 @@ | |||
111 | 118 | /** @name DisplayServer dependencies | 119 | /** @name DisplayServer dependencies |
112 | 119 | * dependencies of DisplayServer on the rest of the Mir | 120 | * dependencies of DisplayServer on the rest of the Mir |
113 | 120 | * @{ */ | 121 | * @{ */ |
115 | 121 | virtual std::shared_ptr<frontend::Communicator> the_communicator(); | 122 | virtual std::shared_ptr<frontend::Connector> the_connector(); |
116 | 122 | virtual std::shared_ptr<graphics::Display> the_display(); | 123 | virtual std::shared_ptr<graphics::Display> the_display(); |
117 | 123 | virtual std::shared_ptr<compositor::Compositor> the_compositor(); | 124 | virtual std::shared_ptr<compositor::Compositor> the_compositor(); |
118 | 124 | virtual std::shared_ptr<input::InputManager> the_input_manager(); | 125 | virtual std::shared_ptr<input::InputManager> the_input_manager(); |
119 | @@ -168,6 +169,11 @@ | |||
120 | 168 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); | 169 | virtual std::shared_ptr<frontend::Shell> the_frontend_shell(); |
121 | 169 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); | 170 | virtual std::shared_ptr<frontend::EventSink> the_global_event_sink(); |
122 | 170 | virtual std::shared_ptr<frontend::DisplayChanger> the_frontend_display_changer(); | 171 | virtual std::shared_ptr<frontend::DisplayChanger> the_frontend_display_changer(); |
123 | 172 | /** @name frontend configuration - internal dependencies | ||
124 | 173 | * internal dependencies of frontend | ||
125 | 174 | * @{ */ | ||
126 | 175 | virtual std::shared_ptr<frontend::SessionCreator> the_session_creator(); | ||
127 | 176 | /** @} */ | ||
128 | 171 | /** @} */ | 177 | /** @} */ |
129 | 172 | 178 | ||
130 | 173 | virtual std::shared_ptr<shell::FocusController> the_focus_controller(); | 179 | virtual std::shared_ptr<shell::FocusController> the_focus_controller(); |
131 | @@ -243,7 +249,7 @@ | |||
132 | 243 | virtual std::shared_ptr<shell::MediatingDisplayChanger> the_mediating_display_changer(); | 249 | virtual std::shared_ptr<shell::MediatingDisplayChanger> the_mediating_display_changer(); |
133 | 244 | virtual std::shared_ptr<shell::BroadcastingSessionEventSink> the_broadcasting_session_event_sink(); | 250 | virtual std::shared_ptr<shell::BroadcastingSessionEventSink> the_broadcasting_session_event_sink(); |
134 | 245 | 251 | ||
136 | 246 | CachedPtr<frontend::Communicator> communicator; | 252 | CachedPtr<frontend::Connector> connector; |
137 | 247 | CachedPtr<shell::SessionManager> session_manager; | 253 | CachedPtr<shell::SessionManager> session_manager; |
138 | 248 | 254 | ||
139 | 249 | 255 | ||
140 | @@ -266,6 +272,7 @@ | |||
141 | 266 | CachedPtr<frontend::MessageProcessorReport> message_processor_report; | 272 | CachedPtr<frontend::MessageProcessorReport> message_processor_report; |
142 | 267 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; | 273 | CachedPtr<frontend::SessionAuthorizer> session_authorizer; |
143 | 268 | CachedPtr<frontend::EventSink> global_event_sink; | 274 | CachedPtr<frontend::EventSink> global_event_sink; |
144 | 275 | CachedPtr<frontend::SessionCreator> session_creator; | ||
145 | 269 | CachedPtr<compositor::RendererFactory> renderer_factory; | 276 | CachedPtr<compositor::RendererFactory> renderer_factory; |
146 | 270 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; | 277 | CachedPtr<compositor::BufferStreamFactory> buffer_stream_factory; |
147 | 271 | CachedPtr<surfaces::SurfaceStack> surface_stack; | 278 | CachedPtr<surfaces::SurfaceStack> surface_stack; |
148 | 272 | 279 | ||
149 | === renamed file 'include/server/mir/frontend/communicator.h' => 'include/server/mir/frontend/connector.h' | |||
150 | --- include/server/mir/frontend/communicator.h 2013-04-25 09:48:54 +0000 | |||
151 | +++ include/server/mir/frontend/connector.h 2013-09-25 14:20:36 +0000 | |||
152 | @@ -16,29 +16,29 @@ | |||
153 | 16 | * Authored by: Thomas Voss <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voss <thomas.voss@canonical.com> |
154 | 17 | */ | 17 | */ |
155 | 18 | 18 | ||
158 | 19 | #ifndef MIR_FRONTEND_COMMUNICATOR_H_ | 19 | #ifndef MIR_FRONTEND_CONNECTOR_H_ |
159 | 20 | #define MIR_FRONTEND_COMMUNICATOR_H_ | 20 | #define MIR_FRONTEND_CONNECTOR_H_ |
160 | 21 | 21 | ||
161 | 22 | namespace mir | 22 | namespace mir |
162 | 23 | { | 23 | { |
163 | 24 | namespace frontend | 24 | namespace frontend |
164 | 25 | { | 25 | { |
167 | 26 | 26 | /// Handle client process connections | |
168 | 27 | class Communicator | 27 | class Connector |
169 | 28 | { | 28 | { |
170 | 29 | public: | 29 | public: |
171 | 30 | virtual ~Communicator() {} | ||
172 | 31 | |||
173 | 32 | virtual void start() = 0; | 30 | virtual void start() = 0; |
174 | 33 | virtual void stop() = 0; | 31 | virtual void stop() = 0; |
175 | 34 | 32 | ||
176 | 33 | virtual int client_socket_fd() const = 0; | ||
177 | 34 | |||
178 | 35 | protected: | 35 | protected: |
182 | 36 | Communicator() = default; | 36 | Connector() = default; |
183 | 37 | Communicator(const Communicator&) = delete; | 37 | virtual ~Connector() = default; |
184 | 38 | Communicator& operator=(const Communicator&) = delete; | 38 | Connector(const Connector&) = delete; |
185 | 39 | Connector& operator=(const Connector&) = delete; | ||
186 | 39 | }; | 40 | }; |
192 | 40 | 41 | } | |
193 | 41 | } | 42 | } |
194 | 42 | } | 43 | |
195 | 43 | 44 | #endif // MIR_FRONTEND_CONNECTOR_H_ | |
191 | 44 | #endif // MIR_FRONTEND_COMMUNICATOR_H_ | ||
196 | 45 | 45 | ||
197 | === renamed file 'include/server/mir/frontend/communicator_report.h' => 'include/server/mir/frontend/connector_report.h' | |||
198 | --- include/server/mir/frontend/communicator_report.h 2013-06-19 16:14:40 +0000 | |||
199 | +++ include/server/mir/frontend/connector_report.h 2013-09-25 14:20:36 +0000 | |||
200 | @@ -16,8 +16,8 @@ | |||
201 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk |
202 | 17 | */ | 17 | */ |
203 | 18 | 18 | ||
206 | 19 | #ifndef MIR_FRONTEND_COMMUNICATOR_REPORT_H_ | 19 | #ifndef MIR_FRONTEND_CONNECTOR_REPORT_H_ |
207 | 20 | #define MIR_FRONTEND_COMMUNICATOR_REPORT_H_ | 20 | #define MIR_FRONTEND_CONNECTOR_REPORT_H_ |
208 | 21 | 21 | ||
209 | 22 | #include <stdexcept> | 22 | #include <stdexcept> |
210 | 23 | 23 | ||
211 | @@ -26,20 +26,20 @@ | |||
212 | 26 | namespace frontend | 26 | namespace frontend |
213 | 27 | { | 27 | { |
214 | 28 | 28 | ||
216 | 29 | class CommunicatorReport | 29 | class ConnectorReport |
217 | 30 | { | 30 | { |
218 | 31 | public: | 31 | public: |
219 | 32 | 32 | ||
220 | 33 | virtual void error(std::exception const& error) = 0; | 33 | virtual void error(std::exception const& error) = 0; |
221 | 34 | 34 | ||
222 | 35 | protected: | 35 | protected: |
227 | 36 | virtual ~CommunicatorReport() = default; | 36 | virtual ~ConnectorReport() = default; |
228 | 37 | CommunicatorReport() = default; | 37 | ConnectorReport() = default; |
229 | 38 | CommunicatorReport(const CommunicatorReport&) = delete; | 38 | ConnectorReport(const ConnectorReport&) = delete; |
230 | 39 | CommunicatorReport& operator=(const CommunicatorReport&) = delete; | 39 | ConnectorReport& operator=(const ConnectorReport&) = delete; |
231 | 40 | }; | 40 | }; |
232 | 41 | 41 | ||
234 | 42 | class NullCommunicatorReport : public CommunicatorReport | 42 | class NullConnectorReport : public ConnectorReport |
235 | 43 | { | 43 | { |
236 | 44 | public: | 44 | public: |
237 | 45 | 45 | ||
238 | @@ -48,4 +48,4 @@ | |||
239 | 48 | } | 48 | } |
240 | 49 | } | 49 | } |
241 | 50 | 50 | ||
243 | 51 | #endif // MIR_FRONTEND_COMMUNICATOR_REPORT_H_ | 51 | #endif // MIR_FRONTEND_CONNECTOR_REPORT_H_ |
244 | 52 | 52 | ||
245 | === added file 'include/server/mir/frontend/session_creator.h' | |||
246 | --- include/server/mir/frontend/session_creator.h 1970-01-01 00:00:00 +0000 | |||
247 | +++ include/server/mir/frontend/session_creator.h 2013-09-25 14:20:36 +0000 | |||
248 | @@ -0,0 +1,44 @@ | |||
249 | 1 | /* | ||
250 | 2 | * Copyright © 2013 Canonical Ltd. | ||
251 | 3 | * | ||
252 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
253 | 5 | * under the terms of the GNU General Public License version 3, | ||
254 | 6 | * as published by the Free Software Foundation. | ||
255 | 7 | * | ||
256 | 8 | * This program is distributed in the hope that it will be useful, | ||
257 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
258 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
259 | 11 | * GNU General Public License for more details. | ||
260 | 12 | * | ||
261 | 13 | * You should have received a copy of the GNU General Public License | ||
262 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
263 | 15 | * | ||
264 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
265 | 17 | */ | ||
266 | 18 | |||
267 | 19 | #ifndef MIR_FRONTEND_SESSION_CREATOR_H_ | ||
268 | 20 | #define MIR_FRONTEND_SESSION_CREATOR_H_ | ||
269 | 21 | |||
270 | 22 | #include <boost/asio.hpp> | ||
271 | 23 | |||
272 | 24 | #include <memory> | ||
273 | 25 | |||
274 | 26 | namespace mir | ||
275 | 27 | { | ||
276 | 28 | namespace frontend | ||
277 | 29 | { | ||
278 | 30 | class SessionCreator | ||
279 | 31 | { | ||
280 | 32 | public: | ||
281 | 33 | virtual void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket) = 0; | ||
282 | 34 | |||
283 | 35 | protected: | ||
284 | 36 | SessionCreator() = default; | ||
285 | 37 | virtual ~SessionCreator() noexcept = default; | ||
286 | 38 | SessionCreator(SessionCreator const&) = delete; | ||
287 | 39 | SessionCreator& operator=(SessionCreator const&) = delete; | ||
288 | 40 | }; | ||
289 | 41 | } | ||
290 | 42 | } | ||
291 | 43 | |||
292 | 44 | #endif /* MIR_FRONTEND_SESSION_CREATOR_H_ */ | ||
293 | 0 | 45 | ||
294 | === modified file 'include/server/mir/server_configuration.h' | |||
295 | --- include/server/mir/server_configuration.h 2013-09-18 21:09:29 +0000 | |||
296 | +++ include/server/mir/server_configuration.h 2013-09-25 14:20:36 +0000 | |||
297 | @@ -28,7 +28,7 @@ | |||
298 | 28 | } | 28 | } |
299 | 29 | namespace frontend | 29 | namespace frontend |
300 | 30 | { | 30 | { |
302 | 31 | class Communicator; | 31 | class Connector; |
303 | 32 | class Shell; | 32 | class Shell; |
304 | 33 | } | 33 | } |
305 | 34 | namespace shell | 34 | namespace shell |
306 | @@ -57,7 +57,7 @@ | |||
307 | 57 | public: | 57 | public: |
308 | 58 | // TODO most of these interfaces are wider DisplayServer needs... | 58 | // TODO most of these interfaces are wider DisplayServer needs... |
309 | 59 | // TODO ...some or all of them need narrowing | 59 | // TODO ...some or all of them need narrowing |
311 | 60 | virtual std::shared_ptr<frontend::Communicator> the_communicator() = 0; | 60 | virtual std::shared_ptr<frontend::Connector> the_connector() = 0; |
312 | 61 | virtual std::shared_ptr<graphics::Display> the_display() = 0; | 61 | virtual std::shared_ptr<graphics::Display> the_display() = 0; |
313 | 62 | virtual std::shared_ptr<compositor::Compositor> the_compositor() = 0; | 62 | virtual std::shared_ptr<compositor::Compositor> the_compositor() = 0; |
314 | 63 | virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; | 63 | virtual std::shared_ptr<input::InputManager> the_input_manager() = 0; |
315 | 64 | 64 | ||
316 | === modified file 'include/test/mir_test/test_protobuf_server.h' | |||
317 | --- include/test/mir_test/test_protobuf_server.h 2013-06-19 16:14:40 +0000 | |||
318 | +++ include/test/mir_test/test_protobuf_server.h 2013-09-25 14:20:36 +0000 | |||
319 | @@ -25,8 +25,8 @@ | |||
320 | 25 | { | 25 | { |
321 | 26 | namespace frontend | 26 | namespace frontend |
322 | 27 | { | 27 | { |
325 | 28 | class Communicator; | 28 | class Connector; |
326 | 29 | class CommunicatorReport; | 29 | class ConnectorReport; |
327 | 30 | } | 30 | } |
328 | 31 | 31 | ||
329 | 32 | namespace protobuf | 32 | namespace protobuf |
330 | @@ -45,10 +45,10 @@ | |||
331 | 45 | TestProtobufServer( | 45 | TestProtobufServer( |
332 | 46 | std::string const& socket_name, | 46 | std::string const& socket_name, |
333 | 47 | std::shared_ptr<protobuf::DisplayServer> const& tool, | 47 | std::shared_ptr<protobuf::DisplayServer> const& tool, |
335 | 48 | std::shared_ptr<frontend::CommunicatorReport> const& report); | 48 | std::shared_ptr<frontend::ConnectorReport> const& report); |
336 | 49 | 49 | ||
337 | 50 | // "Server" side | 50 | // "Server" side |
339 | 51 | std::shared_ptr<frontend::Communicator> const comm; | 51 | std::shared_ptr<frontend::Connector> const comm; |
340 | 52 | }; | 52 | }; |
341 | 53 | } | 53 | } |
342 | 54 | } | 54 | } |
343 | 55 | 55 | ||
344 | === modified file 'src/server/default_server_configuration.cpp' | |||
345 | --- src/server/default_server_configuration.cpp 2013-09-23 13:37:44 +0000 | |||
346 | +++ src/server/default_server_configuration.cpp 2013-09-25 14:20:36 +0000 | |||
347 | @@ -171,6 +171,7 @@ | |||
348 | 171 | }; | 171 | }; |
349 | 172 | 172 | ||
350 | 173 | char const* const server_socket_opt = "file"; | 173 | char const* const server_socket_opt = "file"; |
351 | 174 | char const* const no_server_socket_opt = "no-file"; | ||
352 | 174 | char const* const session_mediator_report_opt = "session-mediator-report"; | 175 | char const* const session_mediator_report_opt = "session-mediator-report"; |
353 | 175 | char const* const msg_processor_report_opt = "msg-processor-report"; | 176 | char const* const msg_processor_report_opt = "msg-processor-report"; |
354 | 176 | char const* const display_report_opt = "display-report"; | 177 | char const* const display_report_opt = "display-report"; |
355 | @@ -255,6 +256,7 @@ | |||
356 | 255 | "Host socket filename. [string:default={$MIR_SOCKET,/tmp/mir_socket}]") | 256 | "Host socket filename. [string:default={$MIR_SOCKET,/tmp/mir_socket}]") |
357 | 256 | ("file,f", po::value<std::string>(), | 257 | ("file,f", po::value<std::string>(), |
358 | 257 | "Socket filename. [string:default=/tmp/mir_socket]") | 258 | "Socket filename. [string:default=/tmp/mir_socket]") |
359 | 259 | (no_server_socket_opt, "Do not provide a socket filename for client connections") | ||
360 | 258 | (platform_graphics_lib, po::value<std::string>(), | 260 | (platform_graphics_lib, po::value<std::string>(), |
361 | 259 | "Library to use for platform graphics support [default=libmirplatformgraphics.so]") | 261 | "Library to use for platform graphics support [default=libmirplatformgraphics.so]") |
362 | 260 | ("enable-input,i", po::value<bool>(), | 262 | ("enable-input,i", po::value<bool>(), |
363 | 261 | 263 | ||
364 | === modified file 'src/server/display_server.cpp' | |||
365 | --- src/server/display_server.cpp 2013-09-18 21:09:29 +0000 | |||
366 | +++ src/server/display_server.cpp 2013-09-25 14:20:36 +0000 | |||
367 | @@ -25,7 +25,7 @@ | |||
368 | 25 | #include "mir/display_changer.h" | 25 | #include "mir/display_changer.h" |
369 | 26 | 26 | ||
370 | 27 | #include "mir/compositor/compositor.h" | 27 | #include "mir/compositor/compositor.h" |
372 | 28 | #include "mir/frontend/communicator.h" | 28 | #include "mir/frontend/connector.h" |
373 | 29 | #include "mir/graphics/display.h" | 29 | #include "mir/graphics/display.h" |
374 | 30 | #include "mir/input/input_manager.h" | 30 | #include "mir/input/input_manager.h" |
375 | 31 | 31 | ||
376 | @@ -72,7 +72,7 @@ | |||
377 | 72 | display{config.the_display()}, | 72 | display{config.the_display()}, |
378 | 73 | input_configuration{config.the_input_configuration()}, | 73 | input_configuration{config.the_input_configuration()}, |
379 | 74 | compositor{config.the_compositor()}, | 74 | compositor{config.the_compositor()}, |
381 | 75 | communicator{config.the_communicator()}, | 75 | connector{config.the_connector()}, |
382 | 76 | input_manager{config.the_input_manager()}, | 76 | input_manager{config.the_input_manager()}, |
383 | 77 | main_loop{config.the_main_loop()}, | 77 | main_loop{config.the_main_loop()}, |
384 | 78 | pause_resume_listener{config.the_pause_resume_listener()}, | 78 | pause_resume_listener{config.the_pause_resume_listener()}, |
385 | @@ -103,8 +103,8 @@ | |||
386 | 103 | [this] { compositor->start(); }}; | 103 | [this] { compositor->start(); }}; |
387 | 104 | 104 | ||
388 | 105 | TryButRevertIfUnwinding comm{ | 105 | TryButRevertIfUnwinding comm{ |
391 | 106 | [this] { communicator->stop(); }, | 106 | [this] { connector->stop(); }, |
392 | 107 | [this] { communicator->start(); }}; | 107 | [this] { connector->start(); }}; |
393 | 108 | 108 | ||
394 | 109 | display->pause(); | 109 | display->pause(); |
395 | 110 | 110 | ||
396 | @@ -129,8 +129,8 @@ | |||
397 | 129 | [this] { display->pause(); }}; | 129 | [this] { display->pause(); }}; |
398 | 130 | 130 | ||
399 | 131 | TryButRevertIfUnwinding comm{ | 131 | TryButRevertIfUnwinding comm{ |
402 | 132 | [this] { communicator->start(); }, | 132 | [this] { connector->start(); }, |
403 | 133 | [this] { communicator->stop(); }}; | 133 | [this] { connector->stop(); }}; |
404 | 134 | 134 | ||
405 | 135 | if (configure_display_on_resume) | 135 | if (configure_display_on_resume) |
406 | 136 | { | 136 | { |
407 | @@ -176,7 +176,7 @@ | |||
408 | 176 | std::shared_ptr<mg::Display> const display; | 176 | std::shared_ptr<mg::Display> const display; |
409 | 177 | std::shared_ptr<input::InputConfiguration> const input_configuration; | 177 | std::shared_ptr<input::InputConfiguration> const input_configuration; |
410 | 178 | std::shared_ptr<mc::Compositor> const compositor; | 178 | std::shared_ptr<mc::Compositor> const compositor; |
412 | 179 | std::shared_ptr<mf::Communicator> const communicator; | 179 | std::shared_ptr<mf::Connector> const connector; |
413 | 180 | std::shared_ptr<mi::InputManager> const input_manager; | 180 | std::shared_ptr<mi::InputManager> const input_manager; |
414 | 181 | std::shared_ptr<mir::MainLoop> const main_loop; | 181 | std::shared_ptr<mir::MainLoop> const main_loop; |
415 | 182 | std::shared_ptr<mir::PauseResumeListener> const pause_resume_listener; | 182 | std::shared_ptr<mir::PauseResumeListener> const pause_resume_listener; |
416 | @@ -201,7 +201,7 @@ | |||
417 | 201 | 201 | ||
418 | 202 | void mir::DisplayServer::run() | 202 | void mir::DisplayServer::run() |
419 | 203 | { | 203 | { |
421 | 204 | p->communicator->start(); | 204 | p->connector->start(); |
422 | 205 | p->compositor->start(); | 205 | p->compositor->start(); |
423 | 206 | p->input_manager->start(); | 206 | p->input_manager->start(); |
424 | 207 | 207 | ||
425 | @@ -209,7 +209,7 @@ | |||
426 | 209 | 209 | ||
427 | 210 | p->input_manager->stop(); | 210 | p->input_manager->stop(); |
428 | 211 | p->compositor->stop(); | 211 | p->compositor->stop(); |
430 | 212 | p->communicator->stop(); | 212 | p->connector->stop(); |
431 | 213 | } | 213 | } |
432 | 214 | 214 | ||
433 | 215 | void mir::DisplayServer::stop() | 215 | void mir::DisplayServer::stop() |
434 | 216 | 216 | ||
435 | === modified file 'src/server/frontend/CMakeLists.txt' | |||
436 | --- src/server/frontend/CMakeLists.txt 2013-08-28 03:41:48 +0000 | |||
437 | +++ src/server/frontend/CMakeLists.txt 2013-09-25 14:20:36 +0000 | |||
438 | @@ -9,20 +9,19 @@ | |||
439 | 9 | protobuf_buffer_packer.cpp | 9 | protobuf_buffer_packer.cpp |
440 | 10 | null_message_processor.cpp | 10 | null_message_processor.cpp |
441 | 11 | global_event_sender.cpp | 11 | global_event_sender.cpp |
443 | 12 | 12 | published_socket_connector.cpp | |
444 | 13 | protobuf_session_creator.cpp | ||
445 | 14 | socket_session.cpp | ||
446 | 13 | resource_cache.cpp | 15 | resource_cache.cpp |
447 | 14 | socket_messenger.cpp | 16 | socket_messenger.cpp |
448 | 15 | event_sender.cpp | 17 | event_sender.cpp |
449 | 16 | surface.cpp | 18 | surface.cpp |
450 | 19 | |||
451 | 20 | default_configuration.cpp | ||
452 | 21 | |||
453 | 17 | ${PROTO_HDRS} | 22 | ${PROTO_HDRS} |
454 | 18 | ) | 23 | ) |
455 | 19 | 24 | ||
456 | 20 | list(APPEND FRONTEND_SOURCES | ||
457 | 21 | protobuf_socket_communicator.cpp | ||
458 | 22 | make_protobuf_socket_communicator.cpp | ||
459 | 23 | socket_session.cpp | ||
460 | 24 | ) | ||
461 | 25 | |||
462 | 26 | if (MIR_PLATFORM STREQUAL "android") | 25 | if (MIR_PLATFORM STREQUAL "android") |
463 | 27 | list(APPEND FRONTEND_SOURCES session_mediator_android.cpp) | 26 | list(APPEND FRONTEND_SOURCES session_mediator_android.cpp) |
464 | 28 | elseif (MIR_PLATFORM STREQUAL "gbm") | 27 | elseif (MIR_PLATFORM STREQUAL "gbm") |
465 | 29 | 28 | ||
466 | === renamed file 'src/server/frontend/make_protobuf_socket_communicator.cpp' => 'src/server/frontend/default_configuration.cpp' | |||
467 | --- src/server/frontend/make_protobuf_socket_communicator.cpp 2013-08-28 03:41:48 +0000 | |||
468 | +++ src/server/frontend/default_configuration.cpp 2013-09-25 14:20:36 +0000 | |||
469 | @@ -17,39 +17,67 @@ | |||
470 | 17 | */ | 17 | */ |
471 | 18 | 18 | ||
472 | 19 | #include "mir/default_server_configuration.h" | 19 | #include "mir/default_server_configuration.h" |
473 | 20 | #include "protobuf_session_creator.h" | ||
474 | 21 | |||
475 | 20 | #include "mir/options/option.h" | 22 | #include "mir/options/option.h" |
476 | 21 | #include "mir/frontend/shell.h" | 23 | #include "mir/frontend/shell.h" |
477 | 22 | #include "mir/shell/session_container.h" | 24 | #include "mir/shell/session_container.h" |
478 | 23 | #include "mir/shell/session.h" | 25 | #include "mir/shell/session.h" |
481 | 24 | #include "protobuf_socket_communicator.h" | 26 | #include "published_socket_connector.h" |
482 | 25 | #include "mir/frontend/communicator_report.h" | 27 | #include "mir/frontend/connector_report.h" |
483 | 26 | 28 | ||
484 | 27 | namespace mf = mir::frontend; | 29 | namespace mf = mir::frontend; |
485 | 28 | namespace mg = mir::graphics; | ||
486 | 29 | namespace mc = mir::compositor; | ||
487 | 30 | namespace msh = mir::shell; | 30 | namespace msh = mir::shell; |
488 | 31 | 31 | ||
494 | 32 | std::shared_ptr<mf::Communicator> | 32 | namespace |
495 | 33 | mir::DefaultServerConfiguration::the_communicator() | 33 | { |
496 | 34 | { | 34 | char const* const no_server_socket_opt = "no-file"; |
497 | 35 | return communicator( | 35 | } |
498 | 36 | [&,this]() -> std::shared_ptr<mf::Communicator> | 36 | |
499 | 37 | std::shared_ptr<mf::SessionCreator> | ||
500 | 38 | mir::DefaultServerConfiguration::the_session_creator() | ||
501 | 39 | { | ||
502 | 40 | return session_creator([this] | ||
503 | 41 | { | ||
504 | 42 | return std::make_shared<mf::ProtobufSessionCreator>( | ||
505 | 43 | the_ipc_factory(the_frontend_shell(), the_buffer_allocator()), | ||
506 | 44 | the_session_authorizer()); | ||
507 | 45 | }); | ||
508 | 46 | } | ||
509 | 47 | |||
510 | 48 | std::shared_ptr<mf::Connector> | ||
511 | 49 | mir::DefaultServerConfiguration::the_connector() | ||
512 | 50 | { | ||
513 | 51 | return connector( | ||
514 | 52 | [&,this]() -> std::shared_ptr<mf::Connector> | ||
515 | 37 | { | 53 | { |
516 | 38 | auto const threads = the_options()->get("ipc-thread-pool", 10); | 54 | auto const threads = the_options()->get("ipc-thread-pool", 10); |
517 | 39 | auto shell_sessions = the_shell_session_container(); | 55 | auto shell_sessions = the_shell_session_container(); |
524 | 40 | return std::make_shared<mf::ProtobufSocketCommunicator>( | 56 | auto const& force_requests_to_complete = [shell_sessions] |
525 | 41 | the_socket_file(), | 57 | { |
526 | 42 | the_ipc_factory(the_frontend_shell(), the_buffer_allocator()), | 58 | shell_sessions->for_each([](std::shared_ptr<msh::Session> const& session) |
521 | 43 | the_session_authorizer(), | ||
522 | 44 | threads, | ||
523 | 45 | [shell_sessions] | ||
527 | 46 | { | 59 | { |
534 | 47 | shell_sessions->for_each([](std::shared_ptr<msh::Session> const& session) | 60 | session->force_requests_to_complete(); |
535 | 48 | { | 61 | }); |
536 | 49 | session->force_requests_to_complete(); | 62 | }; |
537 | 50 | }); | 63 | |
538 | 51 | }, | 64 | if (the_options()->is_set(no_server_socket_opt)) |
539 | 52 | std::make_shared<mf::NullCommunicatorReport>()); | 65 | { |
540 | 66 | return std::make_shared<mf::BasicConnector>( | ||
541 | 67 | the_session_creator(), | ||
542 | 68 | threads, | ||
543 | 69 | force_requests_to_complete, | ||
544 | 70 | std::make_shared<mf::NullConnectorReport>()); | ||
545 | 71 | } | ||
546 | 72 | else | ||
547 | 73 | { | ||
548 | 74 | return std::make_shared<mf::PublishedSocketConnector>( | ||
549 | 75 | the_socket_file(), | ||
550 | 76 | the_session_creator(), | ||
551 | 77 | threads, | ||
552 | 78 | force_requests_to_complete, | ||
553 | 79 | std::make_shared<mf::NullConnectorReport>()); | ||
554 | 80 | } | ||
555 | 53 | }); | 81 | }); |
556 | 54 | } | 82 | } |
557 | 55 | 83 | ||
558 | 56 | 84 | ||
559 | === added file 'src/server/frontend/protobuf_session_creator.cpp' | |||
560 | --- src/server/frontend/protobuf_session_creator.cpp 1970-01-01 00:00:00 +0000 | |||
561 | +++ src/server/frontend/protobuf_session_creator.cpp 2013-09-25 14:20:36 +0000 | |||
562 | @@ -0,0 +1,73 @@ | |||
563 | 1 | /* | ||
564 | 2 | * Copyright © 2013 Canonical Ltd. | ||
565 | 3 | * | ||
566 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
567 | 5 | * under the terms of the GNU General Public License version 3, | ||
568 | 6 | * as published by the Free Software Foundation. | ||
569 | 7 | * | ||
570 | 8 | * This program is distributed in the hope that it will be useful, | ||
571 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
572 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
573 | 11 | * GNU General Public License for more details. | ||
574 | 12 | * | ||
575 | 13 | * You should have received a copy of the GNU General Public License | ||
576 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
577 | 15 | * | ||
578 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
579 | 17 | */ | ||
580 | 18 | |||
581 | 19 | #include "protobuf_session_creator.h" | ||
582 | 20 | |||
583 | 21 | #include "event_sender.h" | ||
584 | 22 | #include "protobuf_message_processor.h" | ||
585 | 23 | #include "socket_messenger.h" | ||
586 | 24 | #include "socket_session.h" | ||
587 | 25 | |||
588 | 26 | #include "mir/frontend/protobuf_ipc_factory.h" | ||
589 | 27 | #include "mir/frontend/session_authorizer.h" | ||
590 | 28 | #include "mir/protobuf/google_protobuf_guard.h" | ||
591 | 29 | |||
592 | 30 | namespace mf = mir::frontend; | ||
593 | 31 | namespace mfd = mir::frontend::detail; | ||
594 | 32 | namespace ba = boost::asio; | ||
595 | 33 | |||
596 | 34 | mf::ProtobufSessionCreator::ProtobufSessionCreator( | ||
597 | 35 | std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, | ||
598 | 36 | std::shared_ptr<mf::SessionAuthorizer> const& session_authorizer) | ||
599 | 37 | : ipc_factory(ipc_factory), | ||
600 | 38 | session_authorizer(session_authorizer), | ||
601 | 39 | next_session_id(0), | ||
602 | 40 | connected_sessions(std::make_shared<mfd::ConnectedSessions<mfd::SocketSession>>()) | ||
603 | 41 | { | ||
604 | 42 | } | ||
605 | 43 | |||
606 | 44 | mf::ProtobufSessionCreator::~ProtobufSessionCreator() noexcept | ||
607 | 45 | { | ||
608 | 46 | connected_sessions->clear(); | ||
609 | 47 | } | ||
610 | 48 | |||
611 | 49 | int mf::ProtobufSessionCreator::next_id() | ||
612 | 50 | { | ||
613 | 51 | return next_session_id.fetch_add(1); | ||
614 | 52 | } | ||
615 | 53 | |||
616 | 54 | void mf::ProtobufSessionCreator::create_session_for(std::shared_ptr<ba::local::stream_protocol::socket> const& socket) | ||
617 | 55 | { | ||
618 | 56 | auto const messenger = std::make_shared<detail::SocketMessenger>(socket); | ||
619 | 57 | auto const client_pid = messenger->client_pid(); | ||
620 | 58 | |||
621 | 59 | if (session_authorizer->connection_is_allowed(client_pid)) | ||
622 | 60 | { | ||
623 | 61 | auto const authorized_to_resize_display = session_authorizer->configure_display_is_allowed(client_pid); | ||
624 | 62 | auto const event_sink = std::make_shared<detail::EventSender>(messenger); | ||
625 | 63 | auto const msg_processor = std::make_shared<detail::ProtobufMessageProcessor>( | ||
626 | 64 | messenger, | ||
627 | 65 | ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display), | ||
628 | 66 | ipc_factory->resource_cache(), | ||
629 | 67 | ipc_factory->report()); | ||
630 | 68 | |||
631 | 69 | const auto& session = std::make_shared<mfd::SocketSession>(messenger, next_id(), connected_sessions, msg_processor); | ||
632 | 70 | connected_sessions->add(session); | ||
633 | 71 | session->read_next_message(); | ||
634 | 72 | } | ||
635 | 73 | } | ||
636 | 0 | 74 | ||
637 | === added file 'src/server/frontend/protobuf_session_creator.h' | |||
638 | --- src/server/frontend/protobuf_session_creator.h 1970-01-01 00:00:00 +0000 | |||
639 | +++ src/server/frontend/protobuf_session_creator.h 2013-09-25 14:20:36 +0000 | |||
640 | @@ -0,0 +1,60 @@ | |||
641 | 1 | /* | ||
642 | 2 | * Copyright © 2013 Canonical Ltd. | ||
643 | 3 | * | ||
644 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
645 | 5 | * under the terms of the GNU General Public License version 3, | ||
646 | 6 | * as published by the Free Software Foundation. | ||
647 | 7 | * | ||
648 | 8 | * This program is distributed in the hope that it will be useful, | ||
649 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
650 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
651 | 11 | * GNU General Public License for more details. | ||
652 | 12 | * | ||
653 | 13 | * You should have received a copy of the GNU General Public License | ||
654 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
655 | 15 | * | ||
656 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | ||
657 | 17 | */ | ||
658 | 18 | |||
659 | 19 | #ifndef MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ | ||
660 | 20 | #define MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ | ||
661 | 21 | |||
662 | 22 | #include "mir/frontend/session_creator.h" | ||
663 | 23 | #include "connected_sessions.h" | ||
664 | 24 | |||
665 | 25 | #include <atomic> | ||
666 | 26 | |||
667 | 27 | namespace mir | ||
668 | 28 | { | ||
669 | 29 | namespace frontend | ||
670 | 30 | { | ||
671 | 31 | class ProtobufIpcFactory; | ||
672 | 32 | class SessionAuthorizer; | ||
673 | 33 | |||
674 | 34 | namespace detail | ||
675 | 35 | { | ||
676 | 36 | struct SocketSession; | ||
677 | 37 | } | ||
678 | 38 | |||
679 | 39 | class ProtobufSessionCreator : public SessionCreator | ||
680 | 40 | { | ||
681 | 41 | public: | ||
682 | 42 | ProtobufSessionCreator( | ||
683 | 43 | std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, | ||
684 | 44 | std::shared_ptr<SessionAuthorizer> const& session_authorizer); | ||
685 | 45 | ~ProtobufSessionCreator() noexcept; | ||
686 | 46 | |||
687 | 47 | void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket); | ||
688 | 48 | |||
689 | 49 | private: | ||
690 | 50 | int next_id(); | ||
691 | 51 | |||
692 | 52 | std::shared_ptr<ProtobufIpcFactory> const ipc_factory; | ||
693 | 53 | std::shared_ptr<SessionAuthorizer> const session_authorizer; | ||
694 | 54 | std::atomic<int> next_session_id; | ||
695 | 55 | std::shared_ptr<detail::ConnectedSessions<detail::SocketSession>> const connected_sessions; | ||
696 | 56 | }; | ||
697 | 57 | } | ||
698 | 58 | } | ||
699 | 59 | |||
700 | 60 | #endif /* MIR_FRONTEND_PROTOBUF_SESSION_CREATOR_H_ */ | ||
701 | 0 | 61 | ||
702 | === renamed file 'src/server/frontend/protobuf_socket_communicator.cpp' => 'src/server/frontend/published_socket_connector.cpp' | |||
703 | --- src/server/frontend/protobuf_socket_communicator.cpp 2013-08-28 03:41:48 +0000 | |||
704 | +++ src/server/frontend/published_socket_connector.cpp 2013-09-25 14:20:36 +0000 | |||
705 | @@ -16,67 +16,78 @@ | |||
706 | 16 | * Authored by: Thomas Guest <thomas.guest@canonical.com> | 16 | * Authored by: Thomas Guest <thomas.guest@canonical.com> |
707 | 17 | */ | 17 | */ |
708 | 18 | 18 | ||
712 | 19 | #include "protobuf_socket_communicator.h" | 19 | #include "published_socket_connector.h" |
713 | 20 | #include "protobuf_message_processor.h" | 20 | #include "protobuf_session_creator.h" |
711 | 21 | #include "socket_session.h" | ||
714 | 22 | 21 | ||
721 | 23 | #include "mir/frontend/communicator_report.h" | 22 | #include "mir/frontend/connector_report.h" |
716 | 24 | #include "mir/frontend/protobuf_ipc_factory.h" | ||
717 | 25 | #include "mir/frontend/session_authorizer.h" | ||
718 | 26 | #include "socket_messenger.h" | ||
719 | 27 | #include "event_sender.h" | ||
720 | 28 | #include "mir/protobuf/google_protobuf_guard.h" | ||
722 | 29 | 23 | ||
723 | 30 | #include <boost/signals2.hpp> | 24 | #include <boost/signals2.hpp> |
724 | 25 | #include <boost/exception/errinfo_errno.hpp> | ||
725 | 26 | #include <boost/throw_exception.hpp> | ||
726 | 27 | |||
727 | 28 | #include <sys/socket.h> | ||
728 | 31 | 29 | ||
729 | 32 | namespace mf = mir::frontend; | 30 | namespace mf = mir::frontend; |
730 | 33 | namespace mfd = mir::frontend::detail; | 31 | namespace mfd = mir::frontend::detail; |
731 | 34 | namespace ba = boost::asio; | 32 | namespace ba = boost::asio; |
732 | 35 | 33 | ||
737 | 36 | mf::ProtobufSocketCommunicator::ProtobufSocketCommunicator( | 34 | mf::PublishedSocketConnector::PublishedSocketConnector( |
738 | 37 | std::string const& socket_file, | 35 | const std::string& socket_file, |
739 | 38 | std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, | 36 | std::shared_ptr<SessionCreator> const& session_creator, |
736 | 39 | std::shared_ptr<mf::SessionAuthorizer> const& session_authorizer, | ||
740 | 40 | int threads, | 37 | int threads, |
741 | 41 | std::function<void()> const& force_requests_to_complete, | 38 | std::function<void()> const& force_requests_to_complete, |
752 | 42 | std::shared_ptr<CommunicatorReport> const& report) | 39 | std::shared_ptr<ConnectorReport> const& report) |
753 | 43 | : socket_file((std::remove(socket_file.c_str()), socket_file)), | 40 | : BasicConnector(session_creator, threads, force_requests_to_complete, report), |
754 | 44 | acceptor(io_service, socket_file), | 41 | socket_file(socket_file), |
755 | 45 | io_service_threads(threads), | 42 | acceptor(io_service, socket_file) |
746 | 46 | ipc_factory(ipc_factory), | ||
747 | 47 | session_authorizer(session_authorizer), | ||
748 | 48 | next_session_id(0), | ||
749 | 49 | connected_sessions(std::make_shared<mfd::ConnectedSessions<mfd::SocketSession>>()), | ||
750 | 50 | force_requests_to_complete(force_requests_to_complete), | ||
751 | 51 | report(report) | ||
756 | 52 | { | 43 | { |
757 | 53 | start_accept(); | 44 | start_accept(); |
758 | 54 | } | 45 | } |
759 | 55 | 46 | ||
761 | 56 | void mf::ProtobufSocketCommunicator::start_accept() | 47 | mf::PublishedSocketConnector::~PublishedSocketConnector() noexcept |
762 | 48 | { | ||
763 | 49 | std::remove(socket_file.c_str()); | ||
764 | 50 | } | ||
765 | 51 | |||
766 | 52 | void mf::PublishedSocketConnector::start_accept() | ||
767 | 57 | { | 53 | { |
768 | 58 | auto socket = std::make_shared<boost::asio::local::stream_protocol::socket>(io_service); | 54 | auto socket = std::make_shared<boost::asio::local::stream_protocol::socket>(io_service); |
769 | 59 | 55 | ||
770 | 60 | acceptor.async_accept( | 56 | acceptor.async_accept( |
771 | 61 | *socket, | 57 | *socket, |
772 | 62 | boost::bind( | 58 | boost::bind( |
774 | 63 | &ProtobufSocketCommunicator::on_new_connection, | 59 | &PublishedSocketConnector::on_new_connection, |
775 | 64 | this, | 60 | this, |
776 | 65 | socket, | 61 | socket, |
777 | 66 | ba::placeholders::error)); | 62 | ba::placeholders::error)); |
778 | 67 | } | 63 | } |
779 | 68 | 64 | ||
791 | 69 | int mf::ProtobufSocketCommunicator::next_id() | 65 | void mf::PublishedSocketConnector::on_new_connection( |
792 | 70 | { | 66 | std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
793 | 71 | int id = next_session_id.load(); | 67 | boost::system::error_code const& ec) |
794 | 72 | while (!next_session_id.compare_exchange_weak(id, id + 1)) std::this_thread::yield(); | 68 | { |
795 | 73 | return id; | 69 | if (!ec) |
796 | 74 | } | 70 | { |
797 | 75 | 71 | create_session_for(socket); | |
798 | 76 | 72 | } | |
799 | 77 | void mf::ProtobufSocketCommunicator::start() | 73 | start_accept(); |
800 | 78 | { | 74 | } |
801 | 79 | auto run_io_service = [&] | 75 | |
802 | 76 | mf::BasicConnector::BasicConnector( | ||
803 | 77 | std::shared_ptr<SessionCreator> const& session_creator, | ||
804 | 78 | int threads, | ||
805 | 79 | std::function<void()> const& force_requests_to_complete, | ||
806 | 80 | std::shared_ptr<ConnectorReport> const& report) | ||
807 | 81 | : io_service_threads(threads), | ||
808 | 82 | force_requests_to_complete(force_requests_to_complete), | ||
809 | 83 | report(report), | ||
810 | 84 | session_creator{session_creator} | ||
811 | 85 | { | ||
812 | 86 | } | ||
813 | 87 | |||
814 | 88 | void mf::BasicConnector::start() | ||
815 | 89 | { | ||
816 | 90 | auto run_io_service = [this] | ||
817 | 80 | { | 91 | { |
818 | 81 | while (true) | 92 | while (true) |
819 | 82 | try | 93 | try |
820 | @@ -92,16 +103,16 @@ | |||
821 | 92 | 103 | ||
822 | 93 | for (auto& thread : io_service_threads) | 104 | for (auto& thread : io_service_threads) |
823 | 94 | { | 105 | { |
825 | 95 | thread = std::move(std::thread(run_io_service)); | 106 | thread = std::thread(run_io_service); |
826 | 96 | } | 107 | } |
827 | 97 | } | 108 | } |
828 | 98 | 109 | ||
830 | 99 | void mf::ProtobufSocketCommunicator::stop() | 110 | void mf::BasicConnector::stop() |
831 | 100 | { | 111 | { |
832 | 101 | /* Stop processing new requests */ | 112 | /* Stop processing new requests */ |
833 | 102 | io_service.stop(); | 113 | io_service.stop(); |
834 | 103 | 114 | ||
836 | 104 | /* | 115 | /* |
837 | 105 | * Ensure that any pending requests will complete (i.e., that they | 116 | * Ensure that any pending requests will complete (i.e., that they |
838 | 106 | * will not block indefinitely waiting for a resource from the server) | 117 | * will not block indefinitely waiting for a resource from the server) |
839 | 107 | */ | 118 | */ |
840 | @@ -120,44 +131,36 @@ | |||
841 | 120 | io_service.reset(); | 131 | io_service.reset(); |
842 | 121 | } | 132 | } |
843 | 122 | 133 | ||
845 | 123 | mf::ProtobufSocketCommunicator::~ProtobufSocketCommunicator() | 134 | void mf::BasicConnector::create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& server_socket) const |
846 | 135 | { | ||
847 | 136 | session_creator->create_session_for(server_socket); | ||
848 | 137 | } | ||
849 | 138 | |||
850 | 139 | int mf::BasicConnector::client_socket_fd() const | ||
851 | 140 | { | ||
852 | 141 | enum { server, client, size }; | ||
853 | 142 | int socket_fd[size]; | ||
854 | 143 | |||
855 | 144 | if (socketpair(AF_LOCAL, SOCK_STREAM, 0, socket_fd)) | ||
856 | 145 | { | ||
857 | 146 | BOOST_THROW_EXCEPTION( | ||
858 | 147 | boost::enable_error_info( | ||
859 | 148 | std::runtime_error("Could not create socket pair")) << boost::errinfo_errno(errno)); | ||
860 | 149 | } | ||
861 | 150 | |||
862 | 151 | auto const server_socket = std::make_shared<boost::asio::local::stream_protocol::socket>( | ||
863 | 152 | io_service, boost::asio::local::stream_protocol(), socket_fd[server]); | ||
864 | 153 | |||
865 | 154 | create_session_for(server_socket); | ||
866 | 155 | |||
867 | 156 | return socket_fd[client]; | ||
868 | 157 | } | ||
869 | 158 | |||
870 | 159 | mf::BasicConnector::~BasicConnector() noexcept | ||
871 | 124 | { | 160 | { |
872 | 125 | stop(); | 161 | stop(); |
909 | 126 | 162 | } | |
910 | 127 | connected_sessions->clear(); | 163 | |
911 | 128 | 164 | void mf::NullConnectorReport::error(std::exception const& /*error*/) | |
876 | 129 | std::remove(socket_file.c_str()); | ||
877 | 130 | } | ||
878 | 131 | |||
879 | 132 | void mf::ProtobufSocketCommunicator::on_new_connection( | ||
880 | 133 | std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, | ||
881 | 134 | boost::system::error_code const& ec) | ||
882 | 135 | { | ||
883 | 136 | if (!ec) | ||
884 | 137 | { | ||
885 | 138 | auto messenger = std::make_shared<detail::SocketMessenger>(socket); | ||
886 | 139 | auto client_pid = messenger->client_pid(); | ||
887 | 140 | if (session_authorizer->connection_is_allowed(client_pid)) | ||
888 | 141 | { | ||
889 | 142 | auto authorized_to_resize_display = session_authorizer->configure_display_is_allowed(client_pid); | ||
890 | 143 | auto event_sink = std::make_shared<detail::EventSender>(messenger); | ||
891 | 144 | auto msg_processor = std::make_shared<detail::ProtobufMessageProcessor>( | ||
892 | 145 | messenger, | ||
893 | 146 | ipc_factory->make_ipc_server(event_sink, authorized_to_resize_display), | ||
894 | 147 | ipc_factory->resource_cache(), | ||
895 | 148 | ipc_factory->report()); | ||
896 | 149 | auto const& session = std::make_shared<mfd::SocketSession>( | ||
897 | 150 | messenger, | ||
898 | 151 | next_id(), | ||
899 | 152 | connected_sessions, | ||
900 | 153 | msg_processor); | ||
901 | 154 | connected_sessions->add(session); | ||
902 | 155 | session->read_next_message(); | ||
903 | 156 | } | ||
904 | 157 | } | ||
905 | 158 | start_accept(); | ||
906 | 159 | } | ||
907 | 160 | |||
908 | 161 | void mf::NullCommunicatorReport::error(std::exception const& /*error*/) | ||
912 | 162 | { | 165 | { |
913 | 163 | } | 166 | } |
914 | 164 | 167 | ||
915 | === renamed file 'src/server/frontend/protobuf_socket_communicator.h' => 'src/server/frontend/published_socket_connector.h' | |||
916 | --- src/server/frontend/protobuf_socket_communicator.h 2013-08-28 03:41:48 +0000 | |||
917 | +++ src/server/frontend/published_socket_connector.h 2013-09-25 14:20:36 +0000 | |||
918 | @@ -19,13 +19,10 @@ | |||
919 | 19 | #ifndef MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_ | 19 | #ifndef MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_ |
920 | 20 | #define MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_ | 20 | #define MIR_FRONTEND_PROTOBUF_ASIO_COMMUNICATOR_H_ |
921 | 21 | 21 | ||
925 | 22 | #include "connected_sessions.h" | 22 | #include "mir/frontend/connector.h" |
923 | 23 | |||
924 | 24 | #include "mir/frontend/communicator.h" | ||
926 | 25 | 23 | ||
927 | 26 | #include <boost/asio.hpp> | 24 | #include <boost/asio.hpp> |
928 | 27 | 25 | ||
929 | 28 | #include <atomic> | ||
930 | 29 | #include <thread> | 26 | #include <thread> |
931 | 30 | #include <string> | 27 | #include <string> |
932 | 31 | #include <vector> | 28 | #include <vector> |
933 | @@ -43,52 +40,54 @@ | |||
934 | 43 | { | 40 | { |
935 | 44 | namespace frontend | 41 | namespace frontend |
936 | 45 | { | 42 | { |
955 | 46 | class ResourceCache; | 43 | class SessionCreator; |
956 | 47 | class ProtobufIpcFactory; | 44 | class ConnectorReport; |
957 | 48 | class SessionAuthorizer; | 45 | |
958 | 49 | 46 | /// provides a client-side socket fd for each connection | |
959 | 50 | namespace detail | 47 | class BasicConnector : public Connector |
960 | 51 | { | 48 | { |
961 | 52 | struct SocketSession; | 49 | public: |
962 | 53 | class MessageSender; | 50 | explicit BasicConnector( |
963 | 54 | } | 51 | std::shared_ptr<SessionCreator> const& session_creator, |
964 | 55 | 52 | int threads, | |
965 | 56 | class CommunicatorReport; | 53 | std::function<void()> const& force_requests_to_complete, |
966 | 57 | 54 | std::shared_ptr<ConnectorReport> const& report); | |
967 | 58 | class ProtobufSocketCommunicator : public Communicator | 55 | ~BasicConnector() noexcept; |
968 | 59 | { | 56 | void start() override; |
969 | 60 | public: | 57 | void stop() override; |
970 | 61 | // Create communicator based on Boost asio and Google protobufs | 58 | int client_socket_fd() const override; |
971 | 62 | // using the supplied socket. | 59 | |
972 | 63 | explicit ProtobufSocketCommunicator( | 60 | protected: |
973 | 61 | void create_session_for(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& server_socket) const; | ||
974 | 62 | boost::asio::io_service mutable io_service; | ||
975 | 63 | |||
976 | 64 | private: | ||
977 | 65 | std::vector<std::thread> io_service_threads; | ||
978 | 66 | std::function<void()> const force_requests_to_complete; | ||
979 | 67 | std::shared_ptr<ConnectorReport> const report; | ||
980 | 68 | std::shared_ptr<SessionCreator> const session_creator; | ||
981 | 69 | }; | ||
982 | 70 | |||
983 | 71 | /// Accept connections over a published socket | ||
984 | 72 | class PublishedSocketConnector : public BasicConnector | ||
985 | 73 | { | ||
986 | 74 | public: | ||
987 | 75 | explicit PublishedSocketConnector( | ||
988 | 64 | const std::string& socket_file, | 76 | const std::string& socket_file, |
991 | 65 | std::shared_ptr<ProtobufIpcFactory> const& ipc_factory, | 77 | std::shared_ptr<SessionCreator> const& session_creator, |
990 | 66 | std::shared_ptr<SessionAuthorizer> const& session_authorizer, | ||
992 | 67 | int threads, | 78 | int threads, |
993 | 68 | std::function<void()> const& force_requests_to_complete, | 79 | std::function<void()> const& force_requests_to_complete, |
998 | 69 | std::shared_ptr<CommunicatorReport> const& report); | 80 | std::shared_ptr<ConnectorReport> const& report); |
999 | 70 | ~ProtobufSocketCommunicator(); | 81 | ~PublishedSocketConnector() noexcept; |
996 | 71 | void start(); | ||
997 | 72 | void stop(); | ||
1000 | 73 | 82 | ||
1001 | 74 | private: | 83 | private: |
1002 | 75 | void start_accept(); | 84 | void start_accept(); |
1003 | 76 | void on_new_connection(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, | 85 | void on_new_connection(std::shared_ptr<boost::asio::local::stream_protocol::socket> const& socket, |
1004 | 77 | boost::system::error_code const& ec); | 86 | boost::system::error_code const& ec); |
1005 | 78 | int next_id(); | ||
1006 | 79 | 87 | ||
1007 | 80 | const std::string socket_file; | 88 | const std::string socket_file; |
1008 | 81 | boost::asio::io_service io_service; | ||
1009 | 82 | boost::asio::local::stream_protocol::acceptor acceptor; | 89 | boost::asio::local::stream_protocol::acceptor acceptor; |
1010 | 83 | std::vector<std::thread> io_service_threads; | ||
1011 | 84 | std::shared_ptr<ProtobufIpcFactory> const ipc_factory; | ||
1012 | 85 | std::shared_ptr<SessionAuthorizer> const session_authorizer; | ||
1013 | 86 | std::atomic<int> next_session_id; | ||
1014 | 87 | std::shared_ptr<detail::ConnectedSessions<detail::SocketSession>> const connected_sessions; | ||
1015 | 88 | std::function<void()> const force_requests_to_complete; | ||
1016 | 89 | std::shared_ptr<CommunicatorReport> const report; | ||
1017 | 90 | }; | 90 | }; |
1018 | 91 | |||
1019 | 92 | } | 91 | } |
1020 | 93 | } | 92 | } |
1021 | 94 | 93 | ||
1022 | 95 | 94 | ||
1023 | === modified file 'src/server/frontend/socket_messenger.cpp' | |||
1024 | --- src/server/frontend/socket_messenger.cpp 2013-08-28 03:41:48 +0000 | |||
1025 | +++ src/server/frontend/socket_messenger.cpp 2013-09-25 14:20:36 +0000 | |||
1026 | @@ -59,7 +59,8 @@ | |||
1027 | 59 | // function has completed (if it would be executed asynchronously. | 59 | // function has completed (if it would be executed asynchronously. |
1028 | 60 | // NOTE: we rely on this synchronous behavior as per the comment in | 60 | // NOTE: we rely on this synchronous behavior as per the comment in |
1029 | 61 | // mf::SessionMediator::create_surface | 61 | // mf::SessionMediator::create_surface |
1031 | 62 | ba::write(*socket, ba::buffer(whole_message)); | 62 | boost::system::error_code err; |
1032 | 63 | ba::write(*socket, ba::buffer(whole_message), err); | ||
1033 | 63 | } | 64 | } |
1034 | 64 | 65 | ||
1035 | 65 | void mfd::SocketMessenger::send_fds(std::vector<int32_t> const& fds) | 66 | void mfd::SocketMessenger::send_fds(std::vector<int32_t> const& fds) |
1036 | 66 | 67 | ||
1037 | === modified file 'tests/acceptance-tests/test_client_library.cpp' | |||
1038 | --- tests/acceptance-tests/test_client_library.cpp 2013-09-17 14:31:42 +0000 | |||
1039 | +++ tests/acceptance-tests/test_client_library.cpp 2013-09-25 14:20:36 +0000 | |||
1040 | @@ -22,7 +22,7 @@ | |||
1041 | 22 | #include "mir_toolkit/mir_client_library_debug.h" | 22 | #include "mir_toolkit/mir_client_library_debug.h" |
1042 | 23 | #include "src/client/client_buffer.h" | 23 | #include "src/client/client_buffer.h" |
1043 | 24 | 24 | ||
1045 | 25 | #include "mir/frontend/communicator.h" | 25 | #include "mir/frontend/connector.h" |
1046 | 26 | 26 | ||
1047 | 27 | #include "mir_protobuf.pb.h" | 27 | #include "mir_protobuf.pb.h" |
1048 | 28 | 28 | ||
1049 | 29 | 29 | ||
1050 | === modified file 'tests/acceptance-tests/test_server_shutdown.cpp' | |||
1051 | --- tests/acceptance-tests/test_server_shutdown.cpp 2013-09-17 14:31:42 +0000 | |||
1052 | +++ tests/acceptance-tests/test_server_shutdown.cpp 2013-09-25 14:20:36 +0000 | |||
1053 | @@ -326,19 +326,19 @@ | |||
1054 | 326 | */ | 326 | */ |
1055 | 327 | std::weak_ptr<mir::graphics::Display> display = server_config->the_display(); | 327 | std::weak_ptr<mir::graphics::Display> display = server_config->the_display(); |
1056 | 328 | std::weak_ptr<mir::compositor::Compositor> compositor = server_config->the_compositor(); | 328 | std::weak_ptr<mir::compositor::Compositor> compositor = server_config->the_compositor(); |
1058 | 329 | std::weak_ptr<mir::frontend::Communicator> communicator = server_config->the_communicator(); | 329 | std::weak_ptr<mir::frontend::Connector> connector = server_config->the_connector(); |
1059 | 330 | std::weak_ptr<mir::input::InputManager> input_manager = server_config->the_input_manager(); | 330 | std::weak_ptr<mir::input::InputManager> input_manager = server_config->the_input_manager(); |
1060 | 331 | 331 | ||
1061 | 332 | server_config.reset(); | 332 | server_config.reset(); |
1062 | 333 | 333 | ||
1063 | 334 | EXPECT_EQ(0, display.use_count()); | 334 | EXPECT_EQ(0, display.use_count()); |
1064 | 335 | EXPECT_EQ(0, compositor.use_count()); | 335 | EXPECT_EQ(0, compositor.use_count()); |
1066 | 336 | EXPECT_EQ(0, communicator.use_count()); | 336 | EXPECT_EQ(0, connector.use_count()); |
1067 | 337 | EXPECT_EQ(0, input_manager.use_count()); | 337 | EXPECT_EQ(0, input_manager.use_count()); |
1068 | 338 | 338 | ||
1069 | 339 | if (display.use_count() != 0 || | 339 | if (display.use_count() != 0 || |
1070 | 340 | compositor.use_count() != 0 || | 340 | compositor.use_count() != 0 || |
1072 | 341 | communicator.use_count() != 0 || | 341 | connector.use_count() != 0 || |
1073 | 342 | input_manager.use_count() != 0) | 342 | input_manager.use_count() != 0) |
1074 | 343 | { | 343 | { |
1075 | 344 | resources_freed_failure.set(); | 344 | resources_freed_failure.set(); |
1076 | 345 | 345 | ||
1077 | === modified file 'tests/acceptance-tests/test_test_framework.cpp' | |||
1078 | --- tests/acceptance-tests/test_test_framework.cpp 2013-04-24 05:22:20 +0000 | |||
1079 | +++ tests/acceptance-tests/test_test_framework.cpp 2013-09-25 14:20:36 +0000 | |||
1080 | @@ -18,7 +18,7 @@ | |||
1081 | 18 | 18 | ||
1082 | 19 | #include "mir_test_framework/display_server_test_fixture.h" | 19 | #include "mir_test_framework/display_server_test_fixture.h" |
1083 | 20 | 20 | ||
1085 | 21 | #include "mir/frontend/communicator.h" | 21 | #include "mir/frontend/connector.h" |
1086 | 22 | 22 | ||
1087 | 23 | #include <gmock/gmock.h> | 23 | #include <gmock/gmock.h> |
1088 | 24 | #include <gtest/gtest.h> | 24 | #include <gtest/gtest.h> |
1089 | 25 | 25 | ||
1090 | === modified file 'tests/integration-tests/client/test_client_render.cpp' | |||
1091 | --- tests/integration-tests/client/test_client_render.cpp 2013-08-28 03:41:48 +0000 | |||
1092 | +++ tests/integration-tests/client/test_client_render.cpp 2013-09-25 14:20:36 +0000 | |||
1093 | @@ -27,7 +27,7 @@ | |||
1094 | 27 | #include "mir_test/stub_server_tool.h" | 27 | #include "mir_test/stub_server_tool.h" |
1095 | 28 | #include "mir_test/test_protobuf_server.h" | 28 | #include "mir_test/test_protobuf_server.h" |
1096 | 29 | 29 | ||
1098 | 30 | #include "mir/frontend/communicator.h" | 30 | #include "mir/frontend/connector.h" |
1099 | 31 | 31 | ||
1100 | 32 | #include <gmock/gmock.h> | 32 | #include <gmock/gmock.h> |
1101 | 33 | #include <thread> | 33 | #include <thread> |
1102 | 34 | 34 | ||
1103 | === modified file 'tests/integration-tests/shell/test_session.cpp' | |||
1104 | --- tests/integration-tests/shell/test_session.cpp 2013-08-28 03:41:48 +0000 | |||
1105 | +++ tests/integration-tests/shell/test_session.cpp 2013-09-25 14:20:36 +0000 | |||
1106 | @@ -29,7 +29,7 @@ | |||
1107 | 29 | #include "mir/surfaces/buffer_stream.h" | 29 | #include "mir/surfaces/buffer_stream.h" |
1108 | 30 | #include "mir/compositor/renderer.h" | 30 | #include "mir/compositor/renderer.h" |
1109 | 31 | #include "mir/compositor/renderer_factory.h" | 31 | #include "mir/compositor/renderer_factory.h" |
1111 | 32 | #include "mir/frontend/communicator.h" | 32 | #include "mir/frontend/connector.h" |
1112 | 33 | 33 | ||
1113 | 34 | #include "mir_test_doubles/stub_buffer.h" | 34 | #include "mir_test_doubles/stub_buffer.h" |
1114 | 35 | #include "mir_test_doubles/null_display.h" | 35 | #include "mir_test_doubles/null_display.h" |
1115 | @@ -61,15 +61,16 @@ | |||
1116 | 61 | return input_configuration; | 61 | return input_configuration; |
1117 | 62 | } | 62 | } |
1118 | 63 | 63 | ||
1120 | 64 | std::shared_ptr<mf::Communicator> the_communicator() override | 64 | std::shared_ptr<mf::Connector> the_connector() override |
1121 | 65 | { | 65 | { |
1123 | 66 | struct NullCommunicator : public mf::Communicator | 66 | struct NullConnector : public mf::Connector |
1124 | 67 | { | 67 | { |
1125 | 68 | void start() {} | 68 | void start() {} |
1126 | 69 | void stop() {} | 69 | void stop() {} |
1127 | 70 | int client_socket_fd() const override { return 0; } | ||
1128 | 70 | }; | 71 | }; |
1129 | 71 | 72 | ||
1131 | 72 | return std::make_shared<NullCommunicator>(); | 73 | return std::make_shared<NullConnector>(); |
1132 | 73 | } | 74 | } |
1133 | 74 | 75 | ||
1134 | 75 | std::shared_ptr<mg::GraphicBufferAllocator> the_buffer_allocator() override | 76 | std::shared_ptr<mg::GraphicBufferAllocator> the_buffer_allocator() override |
1135 | 76 | 77 | ||
1136 | === modified file 'tests/integration-tests/test_display_server_main_loop_events.cpp' | |||
1137 | --- tests/integration-tests/test_display_server_main_loop_events.cpp 2013-09-18 21:09:29 +0000 | |||
1138 | +++ tests/integration-tests/test_display_server_main_loop_events.cpp 2013-09-25 14:20:36 +0000 | |||
1139 | @@ -17,7 +17,7 @@ | |||
1140 | 17 | */ | 17 | */ |
1141 | 18 | 18 | ||
1142 | 19 | #include "mir/compositor/compositor.h" | 19 | #include "mir/compositor/compositor.h" |
1144 | 20 | #include "mir/frontend/communicator.h" | 20 | #include "mir/frontend/connector.h" |
1145 | 21 | #include "mir/graphics/display_configuration.h" | 21 | #include "mir/graphics/display_configuration.h" |
1146 | 22 | #include "mir/graphics/display_configuration_policy.h" | 22 | #include "mir/graphics/display_configuration_policy.h" |
1147 | 23 | #include "mir/main_loop.h" | 23 | #include "mir/main_loop.h" |
1148 | @@ -53,11 +53,12 @@ | |||
1149 | 53 | namespace | 53 | namespace |
1150 | 54 | { | 54 | { |
1151 | 55 | 55 | ||
1153 | 56 | class MockCommunicator : public mf::Communicator | 56 | class MockConnector : public mf::Connector |
1154 | 57 | { | 57 | { |
1155 | 58 | public: | 58 | public: |
1156 | 59 | MOCK_METHOD0(start, void()); | 59 | MOCK_METHOD0(start, void()); |
1157 | 60 | MOCK_METHOD0(stop, void()); | 60 | MOCK_METHOD0(stop, void()); |
1158 | 61 | MOCK_CONST_METHOD0(client_socket_fd, int()); | ||
1159 | 61 | }; | 62 | }; |
1160 | 62 | 63 | ||
1161 | 63 | class MockDisplayChanger : public mir::DisplayChanger | 64 | class MockDisplayChanger : public mir::DisplayChanger |
1162 | @@ -226,12 +227,12 @@ | |||
1163 | 226 | return mock_compositor; | 227 | return mock_compositor; |
1164 | 227 | } | 228 | } |
1165 | 228 | 229 | ||
1167 | 229 | std::shared_ptr<mf::Communicator> the_communicator() override | 230 | std::shared_ptr<mf::Connector> the_connector() override |
1168 | 230 | { | 231 | { |
1171 | 231 | if (!mock_communicator) | 232 | if (!mock_connector) |
1172 | 232 | mock_communicator = std::make_shared<MockCommunicator>(); | 233 | mock_connector = std::make_shared<MockConnector>(); |
1173 | 233 | 234 | ||
1175 | 234 | return mock_communicator; | 235 | return mock_connector; |
1176 | 235 | } | 236 | } |
1177 | 236 | 237 | ||
1178 | 237 | std::shared_ptr<mi::InputManager> the_input_manager() override | 238 | std::shared_ptr<mi::InputManager> the_input_manager() override |
1179 | @@ -262,10 +263,10 @@ | |||
1180 | 262 | return mock_compositor; | 263 | return mock_compositor; |
1181 | 263 | } | 264 | } |
1182 | 264 | 265 | ||
1184 | 265 | std::shared_ptr<MockCommunicator> the_mock_communicator() | 266 | std::shared_ptr<MockConnector> the_mock_connector() |
1185 | 266 | { | 267 | { |
1188 | 267 | the_communicator(); | 268 | the_connector(); |
1189 | 268 | return mock_communicator; | 269 | return mock_connector; |
1190 | 269 | } | 270 | } |
1191 | 270 | 271 | ||
1192 | 271 | std::shared_ptr<mtd::MockInputManager> the_mock_input_manager() | 272 | std::shared_ptr<mtd::MockInputManager> the_mock_input_manager() |
1193 | @@ -304,7 +305,7 @@ | |||
1194 | 304 | private: | 305 | private: |
1195 | 305 | std::shared_ptr<mtd::MockCompositor> mock_compositor; | 306 | std::shared_ptr<mtd::MockCompositor> mock_compositor; |
1196 | 306 | std::shared_ptr<MockDisplay> mock_display; | 307 | std::shared_ptr<MockDisplay> mock_display; |
1198 | 307 | std::shared_ptr<MockCommunicator> mock_communicator; | 308 | std::shared_ptr<MockConnector> mock_connector; |
1199 | 308 | std::shared_ptr<mtd::MockInputManager> mock_input_manager; | 309 | std::shared_ptr<mtd::MockInputManager> mock_input_manager; |
1200 | 309 | std::shared_ptr<MockDisplayChanger> mock_display_changer; | 310 | std::shared_ptr<MockDisplayChanger> mock_display_changer; |
1201 | 310 | 311 | ||
1202 | @@ -410,33 +411,33 @@ | |||
1203 | 410 | 411 | ||
1204 | 411 | auto mock_compositor = server_config.the_mock_compositor(); | 412 | auto mock_compositor = server_config.the_mock_compositor(); |
1205 | 412 | auto mock_display = server_config.the_mock_display(); | 413 | auto mock_display = server_config.the_mock_display(); |
1207 | 413 | auto mock_communicator = server_config.the_mock_communicator(); | 414 | auto mock_connector = server_config.the_mock_connector(); |
1208 | 414 | auto mock_input_manager = server_config.the_mock_input_manager(); | 415 | auto mock_input_manager = server_config.the_mock_input_manager(); |
1209 | 415 | 416 | ||
1210 | 416 | { | 417 | { |
1211 | 417 | InSequence s; | 418 | InSequence s; |
1212 | 418 | 419 | ||
1213 | 419 | /* Start */ | 420 | /* Start */ |
1215 | 420 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 421 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1216 | 421 | EXPECT_CALL(*mock_compositor, start()).Times(1); | 422 | EXPECT_CALL(*mock_compositor, start()).Times(1); |
1217 | 422 | EXPECT_CALL(*mock_input_manager, start()).Times(1); | 423 | EXPECT_CALL(*mock_input_manager, start()).Times(1); |
1218 | 423 | 424 | ||
1219 | 424 | /* Pause */ | 425 | /* Pause */ |
1220 | 425 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 426 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1221 | 426 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 427 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1223 | 427 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 428 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1224 | 428 | EXPECT_CALL(*mock_display, pause()).Times(1); | 429 | EXPECT_CALL(*mock_display, pause()).Times(1); |
1225 | 429 | 430 | ||
1226 | 430 | /* Resume */ | 431 | /* Resume */ |
1227 | 431 | EXPECT_CALL(*mock_display, resume()).Times(1); | 432 | EXPECT_CALL(*mock_display, resume()).Times(1); |
1229 | 432 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 433 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1230 | 433 | EXPECT_CALL(*mock_input_manager, start()).Times(1); | 434 | EXPECT_CALL(*mock_input_manager, start()).Times(1); |
1231 | 434 | EXPECT_CALL(*mock_compositor, start()).Times(1); | 435 | EXPECT_CALL(*mock_compositor, start()).Times(1); |
1232 | 435 | 436 | ||
1233 | 436 | /* Stop */ | 437 | /* Stop */ |
1234 | 437 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 438 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1235 | 438 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 439 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1237 | 439 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 440 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1238 | 440 | } | 441 | } |
1239 | 441 | 442 | ||
1240 | 442 | mir::run_mir(server_config, | 443 | mir::run_mir(server_config, |
1241 | @@ -461,27 +462,27 @@ | |||
1242 | 461 | 462 | ||
1243 | 462 | auto mock_compositor = server_config.the_mock_compositor(); | 463 | auto mock_compositor = server_config.the_mock_compositor(); |
1244 | 463 | auto mock_display = server_config.the_mock_display(); | 464 | auto mock_display = server_config.the_mock_display(); |
1246 | 464 | auto mock_communicator = server_config.the_mock_communicator(); | 465 | auto mock_connector = server_config.the_mock_connector(); |
1247 | 465 | auto mock_input_manager = server_config.the_mock_input_manager(); | 466 | auto mock_input_manager = server_config.the_mock_input_manager(); |
1248 | 466 | 467 | ||
1249 | 467 | { | 468 | { |
1250 | 468 | InSequence s; | 469 | InSequence s; |
1251 | 469 | 470 | ||
1252 | 470 | /* Start */ | 471 | /* Start */ |
1254 | 471 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 472 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1255 | 472 | EXPECT_CALL(*mock_compositor, start()).Times(1); | 473 | EXPECT_CALL(*mock_compositor, start()).Times(1); |
1256 | 473 | EXPECT_CALL(*mock_input_manager, start()).Times(1); | 474 | EXPECT_CALL(*mock_input_manager, start()).Times(1); |
1257 | 474 | 475 | ||
1258 | 475 | /* Pause */ | 476 | /* Pause */ |
1259 | 476 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 477 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1260 | 477 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 478 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1262 | 478 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 479 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1263 | 479 | EXPECT_CALL(*mock_display, pause()).Times(1); | 480 | EXPECT_CALL(*mock_display, pause()).Times(1); |
1264 | 480 | 481 | ||
1265 | 481 | /* Stop */ | 482 | /* Stop */ |
1266 | 482 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 483 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1267 | 483 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 484 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1269 | 484 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 485 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1270 | 485 | } | 486 | } |
1271 | 486 | 487 | ||
1272 | 487 | mir::run_mir(server_config, | 488 | mir::run_mir(server_config, |
1273 | @@ -505,33 +506,33 @@ | |||
1274 | 505 | 506 | ||
1275 | 506 | auto mock_compositor = server_config.the_mock_compositor(); | 507 | auto mock_compositor = server_config.the_mock_compositor(); |
1276 | 507 | auto mock_display = server_config.the_mock_display(); | 508 | auto mock_display = server_config.the_mock_display(); |
1278 | 508 | auto mock_communicator = server_config.the_mock_communicator(); | 509 | auto mock_connector = server_config.the_mock_connector(); |
1279 | 509 | auto mock_input_manager = server_config.the_mock_input_manager(); | 510 | auto mock_input_manager = server_config.the_mock_input_manager(); |
1280 | 510 | 511 | ||
1281 | 511 | { | 512 | { |
1282 | 512 | InSequence s; | 513 | InSequence s; |
1283 | 513 | 514 | ||
1284 | 514 | /* Start */ | 515 | /* Start */ |
1286 | 515 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 516 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1287 | 516 | EXPECT_CALL(*mock_compositor, start()).Times(1); | 517 | EXPECT_CALL(*mock_compositor, start()).Times(1); |
1288 | 517 | EXPECT_CALL(*mock_input_manager, start()).Times(1); | 518 | EXPECT_CALL(*mock_input_manager, start()).Times(1); |
1289 | 518 | 519 | ||
1290 | 519 | /* Pause failure */ | 520 | /* Pause failure */ |
1291 | 520 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 521 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1292 | 521 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 522 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1294 | 522 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 523 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1295 | 523 | EXPECT_CALL(*mock_display, pause()) | 524 | EXPECT_CALL(*mock_display, pause()) |
1296 | 524 | .WillOnce(Throw(std::runtime_error(""))); | 525 | .WillOnce(Throw(std::runtime_error(""))); |
1297 | 525 | 526 | ||
1298 | 526 | /* Attempt to continue */ | 527 | /* Attempt to continue */ |
1300 | 527 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 528 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1301 | 528 | EXPECT_CALL(*mock_compositor, start()).Times(1); | 529 | EXPECT_CALL(*mock_compositor, start()).Times(1); |
1302 | 529 | EXPECT_CALL(*mock_input_manager, start()).Times(1); | 530 | EXPECT_CALL(*mock_input_manager, start()).Times(1); |
1303 | 530 | 531 | ||
1304 | 531 | /* Stop */ | 532 | /* Stop */ |
1305 | 532 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 533 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1306 | 533 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 534 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1308 | 534 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 535 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1309 | 535 | } | 536 | } |
1310 | 536 | 537 | ||
1311 | 537 | mir::run_mir(server_config, | 538 | mir::run_mir(server_config, |
1312 | @@ -555,7 +556,7 @@ | |||
1313 | 555 | 556 | ||
1314 | 556 | auto mock_compositor = server_config.the_mock_compositor(); | 557 | auto mock_compositor = server_config.the_mock_compositor(); |
1315 | 557 | auto mock_display = server_config.the_mock_display(); | 558 | auto mock_display = server_config.the_mock_display(); |
1317 | 558 | auto mock_communicator = server_config.the_mock_communicator(); | 559 | auto mock_connector = server_config.the_mock_connector(); |
1318 | 559 | auto mock_input_manager = server_config.the_mock_input_manager(); | 560 | auto mock_input_manager = server_config.the_mock_input_manager(); |
1319 | 560 | auto mock_display_changer = server_config.the_mock_display_changer(); | 561 | auto mock_display_changer = server_config.the_mock_display_changer(); |
1320 | 561 | 562 | ||
1321 | @@ -563,7 +564,7 @@ | |||
1322 | 563 | InSequence s; | 564 | InSequence s; |
1323 | 564 | 565 | ||
1324 | 565 | /* Start */ | 566 | /* Start */ |
1326 | 566 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 567 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1327 | 567 | EXPECT_CALL(*mock_compositor, start()).Times(1); | 568 | EXPECT_CALL(*mock_compositor, start()).Times(1); |
1328 | 568 | EXPECT_CALL(*mock_input_manager, start()).Times(1); | 569 | EXPECT_CALL(*mock_input_manager, start()).Times(1); |
1329 | 569 | 570 | ||
1330 | @@ -575,7 +576,7 @@ | |||
1331 | 575 | /* Stop */ | 576 | /* Stop */ |
1332 | 576 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 577 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1333 | 577 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 578 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1335 | 578 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 579 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1336 | 579 | } | 580 | } |
1337 | 580 | 581 | ||
1338 | 581 | mir::run_mir(server_config, | 582 | mir::run_mir(server_config, |
1339 | @@ -599,7 +600,7 @@ | |||
1340 | 599 | 600 | ||
1341 | 600 | auto mock_compositor = server_config.the_mock_compositor(); | 601 | auto mock_compositor = server_config.the_mock_compositor(); |
1342 | 601 | auto mock_display = server_config.the_mock_display(); | 602 | auto mock_display = server_config.the_mock_display(); |
1344 | 602 | auto mock_communicator = server_config.the_mock_communicator(); | 603 | auto mock_connector = server_config.the_mock_connector(); |
1345 | 603 | auto mock_input_manager = server_config.the_mock_input_manager(); | 604 | auto mock_input_manager = server_config.the_mock_input_manager(); |
1346 | 604 | auto mock_display_changer = server_config.the_mock_display_changer(); | 605 | auto mock_display_changer = server_config.the_mock_display_changer(); |
1347 | 605 | 606 | ||
1348 | @@ -607,19 +608,19 @@ | |||
1349 | 607 | InSequence s; | 608 | InSequence s; |
1350 | 608 | 609 | ||
1351 | 609 | /* Start */ | 610 | /* Start */ |
1353 | 610 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 611 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1354 | 611 | EXPECT_CALL(*mock_compositor, start()).Times(1); | 612 | EXPECT_CALL(*mock_compositor, start()).Times(1); |
1355 | 612 | EXPECT_CALL(*mock_input_manager, start()).Times(1); | 613 | EXPECT_CALL(*mock_input_manager, start()).Times(1); |
1356 | 613 | 614 | ||
1357 | 614 | /* Pause event */ | 615 | /* Pause event */ |
1358 | 615 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 616 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1359 | 616 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 617 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1361 | 617 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 618 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1362 | 618 | EXPECT_CALL(*mock_display, pause()) .Times(1); | 619 | EXPECT_CALL(*mock_display, pause()) .Times(1); |
1363 | 619 | 620 | ||
1364 | 620 | /* Resume and reconfigure event */ | 621 | /* Resume and reconfigure event */ |
1365 | 621 | EXPECT_CALL(*mock_display, resume()).Times(1); | 622 | EXPECT_CALL(*mock_display, resume()).Times(1); |
1367 | 622 | EXPECT_CALL(*mock_communicator, start()).Times(1); | 623 | EXPECT_CALL(*mock_connector, start()).Times(1); |
1368 | 623 | 624 | ||
1369 | 624 | EXPECT_CALL(*mock_display_changer, | 625 | EXPECT_CALL(*mock_display_changer, |
1370 | 625 | configure_for_hardware_change(_, mir::DisplayChanger::RetainSystemState)) | 626 | configure_for_hardware_change(_, mir::DisplayChanger::RetainSystemState)) |
1371 | @@ -631,7 +632,7 @@ | |||
1372 | 631 | /* Stop */ | 632 | /* Stop */ |
1373 | 632 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); | 633 | EXPECT_CALL(*mock_input_manager, stop()).Times(1); |
1374 | 633 | EXPECT_CALL(*mock_compositor, stop()).Times(1); | 634 | EXPECT_CALL(*mock_compositor, stop()).Times(1); |
1376 | 634 | EXPECT_CALL(*mock_communicator, stop()).Times(1); | 635 | EXPECT_CALL(*mock_connector, stop()).Times(1); |
1377 | 635 | } | 636 | } |
1378 | 636 | 637 | ||
1379 | 637 | mir::run_mir(server_config, | 638 | mir::run_mir(server_config, |
1380 | 638 | 639 | ||
1381 | === modified file 'tests/integration-tests/test_error_reporting.cpp' | |||
1382 | --- tests/integration-tests/test_error_reporting.cpp 2013-08-28 03:41:48 +0000 | |||
1383 | +++ tests/integration-tests/test_error_reporting.cpp 2013-09-25 14:20:36 +0000 | |||
1384 | @@ -21,7 +21,7 @@ | |||
1385 | 21 | 21 | ||
1386 | 22 | #include "mir/frontend/protobuf_ipc_factory.h" | 22 | #include "mir/frontend/protobuf_ipc_factory.h" |
1387 | 23 | #include "mir/frontend/resource_cache.h" | 23 | #include "mir/frontend/resource_cache.h" |
1389 | 24 | #include "mir/frontend/communicator.h" | 24 | #include "mir/frontend/connector.h" |
1390 | 25 | 25 | ||
1391 | 26 | #include "mir_protobuf.pb.h" | 26 | #include "mir_protobuf.pb.h" |
1392 | 27 | 27 | ||
1393 | 28 | 28 | ||
1394 | === modified file 'tests/mir_test_doubles/test_protobuf_socket_server.cpp' | |||
1395 | --- tests/mir_test_doubles/test_protobuf_socket_server.cpp 2013-08-28 03:41:48 +0000 | |||
1396 | +++ tests/mir_test_doubles/test_protobuf_socket_server.cpp 2013-09-25 14:20:36 +0000 | |||
1397 | @@ -19,8 +19,9 @@ | |||
1398 | 19 | #include "mir_test/test_protobuf_server.h" | 19 | #include "mir_test/test_protobuf_server.h" |
1399 | 20 | #include "mir_test_doubles/stub_ipc_factory.h" | 20 | #include "mir_test_doubles/stub_ipc_factory.h" |
1400 | 21 | #include "mir_test_doubles/stub_session_authorizer.h" | 21 | #include "mir_test_doubles/stub_session_authorizer.h" |
1403 | 22 | #include "mir/frontend/communicator_report.h" | 22 | #include "mir/frontend/connector_report.h" |
1404 | 23 | #include "src/server/frontend/protobuf_socket_communicator.h" | 23 | #include "src/server/frontend/published_socket_connector.h" |
1405 | 24 | #include "src/server/frontend/protobuf_session_creator.h" | ||
1406 | 24 | 25 | ||
1407 | 25 | namespace mt = mir::test; | 26 | namespace mt = mir::test; |
1408 | 26 | namespace mtd = mir::test::doubles; | 27 | namespace mtd = mir::test::doubles; |
1409 | @@ -28,15 +29,14 @@ | |||
1410 | 28 | 29 | ||
1411 | 29 | namespace | 30 | namespace |
1412 | 30 | { | 31 | { |
1414 | 31 | std::shared_ptr<mf::Communicator> make_communicator( | 32 | std::shared_ptr<mf::Connector> make_connector( |
1415 | 32 | std::string const& socket_name, | 33 | std::string const& socket_name, |
1416 | 33 | std::shared_ptr<mf::ProtobufIpcFactory> const& factory, | 34 | std::shared_ptr<mf::ProtobufIpcFactory> const& factory, |
1418 | 34 | std::shared_ptr<mf::CommunicatorReport> const& report) | 35 | std::shared_ptr<mf::ConnectorReport> const& report) |
1419 | 35 | { | 36 | { |
1421 | 36 | return std::make_shared<mf::ProtobufSocketCommunicator>( | 37 | return std::make_shared<mf::PublishedSocketConnector>( |
1422 | 37 | socket_name, | 38 | socket_name, |
1425 | 38 | factory, | 39 | std::make_shared<mf::ProtobufSessionCreator>(factory, std::make_shared<mtd::StubSessionAuthorizer>()), |
1424 | 39 | std::make_shared<mtd::StubSessionAuthorizer>(), | ||
1426 | 40 | 10, | 40 | 10, |
1427 | 41 | []{}, | 41 | []{}, |
1428 | 42 | report); | 42 | report); |
1429 | @@ -46,14 +46,14 @@ | |||
1430 | 46 | mt::TestProtobufServer::TestProtobufServer( | 46 | mt::TestProtobufServer::TestProtobufServer( |
1431 | 47 | std::string const& socket_name, | 47 | std::string const& socket_name, |
1432 | 48 | const std::shared_ptr<protobuf::DisplayServer>& tool) : | 48 | const std::shared_ptr<protobuf::DisplayServer>& tool) : |
1434 | 49 | TestProtobufServer(socket_name, tool, std::make_shared<mf::NullCommunicatorReport>()) | 49 | TestProtobufServer(socket_name, tool, std::make_shared<mf::NullConnectorReport>()) |
1435 | 50 | { | 50 | { |
1436 | 51 | } | 51 | } |
1437 | 52 | 52 | ||
1438 | 53 | mt::TestProtobufServer::TestProtobufServer( | 53 | mt::TestProtobufServer::TestProtobufServer( |
1439 | 54 | std::string const& socket_name, | 54 | std::string const& socket_name, |
1440 | 55 | const std::shared_ptr<protobuf::DisplayServer>& tool, | 55 | const std::shared_ptr<protobuf::DisplayServer>& tool, |
1443 | 56 | std::shared_ptr<frontend::CommunicatorReport> const& report) : | 56 | std::shared_ptr<frontend::ConnectorReport> const& report) : |
1444 | 57 | comm(make_communicator(socket_name, std::make_shared<mtd::StubIpcFactory>(*tool), report)) | 57 | comm(make_connector(socket_name, std::make_shared<mtd::StubIpcFactory>(*tool), report)) |
1445 | 58 | { | 58 | { |
1446 | 59 | } | 59 | } |
1447 | 60 | 60 | ||
1448 | === modified file 'tests/unit-tests/client/test_client_mir_surface.cpp' | |||
1449 | --- tests/unit-tests/client/test_client_mir_surface.cpp 2013-08-28 03:41:48 +0000 | |||
1450 | +++ tests/unit-tests/client/test_client_mir_surface.cpp 2013-09-25 14:20:36 +0000 | |||
1451 | @@ -30,7 +30,7 @@ | |||
1452 | 30 | #include "src/client/rpc/mir_basic_rpc_channel.h" | 30 | #include "src/client/rpc/mir_basic_rpc_channel.h" |
1453 | 31 | 31 | ||
1454 | 32 | #include "mir/frontend/resource_cache.h" | 32 | #include "mir/frontend/resource_cache.h" |
1456 | 33 | #include "mir/frontend/communicator.h" | 33 | #include "mir/frontend/connector.h" |
1457 | 34 | #include "mir/input/input_platform.h" | 34 | #include "mir/input/input_platform.h" |
1458 | 35 | #include "mir/input/input_receiver_thread.h" | 35 | #include "mir/input/input_receiver_thread.h" |
1459 | 36 | 36 | ||
1460 | 37 | 37 | ||
1461 | === modified file 'tests/unit-tests/frontend/CMakeLists.txt' | |||
1462 | --- tests/unit-tests/frontend/CMakeLists.txt 2013-08-28 03:41:48 +0000 | |||
1463 | +++ tests/unit-tests/frontend/CMakeLists.txt 2013-09-25 14:20:36 +0000 | |||
1464 | @@ -1,7 +1,7 @@ | |||
1465 | 1 | list(APPEND UNIT_TEST_SOURCES | 1 | list(APPEND UNIT_TEST_SOURCES |
1466 | 2 | ${CMAKE_CURRENT_SOURCE_DIR}/test_client_buffer_tracker.cpp | 2 | ${CMAKE_CURRENT_SOURCE_DIR}/test_client_buffer_tracker.cpp |
1467 | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/stress_protobuf_communicator.cpp | 3 | ${CMAKE_CURRENT_SOURCE_DIR}/stress_protobuf_communicator.cpp |
1469 | 4 | ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_communicator.cpp | 4 | ${CMAKE_CURRENT_SOURCE_DIR}/test_published_socket_connector.cpp |
1470 | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_surface_apis.cpp | 5 | ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_surface_apis.cpp |
1471 | 6 | ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_reports_errors.cpp | 6 | ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_reports_errors.cpp |
1472 | 7 | ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_buffer_packer.cpp | 7 | ${CMAKE_CURRENT_SOURCE_DIR}/test_protobuf_buffer_packer.cpp |
1473 | 8 | 8 | ||
1474 | === modified file 'tests/unit-tests/frontend/stress_protobuf_communicator.cpp' | |||
1475 | --- tests/unit-tests/frontend/stress_protobuf_communicator.cpp 2013-08-28 03:41:48 +0000 | |||
1476 | +++ tests/unit-tests/frontend/stress_protobuf_communicator.cpp 2013-09-25 14:20:36 +0000 | |||
1477 | @@ -16,7 +16,7 @@ | |||
1478 | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> | 16 | * Authored by: Alan Griffiths <alan@octopull.co.uk> |
1479 | 17 | */ | 17 | */ |
1480 | 18 | 18 | ||
1482 | 19 | #include "mir/frontend/communicator.h" | 19 | #include "mir/frontend/connector.h" |
1483 | 20 | #include "mir/frontend/resource_cache.h" | 20 | #include "mir/frontend/resource_cache.h" |
1484 | 21 | 21 | ||
1485 | 22 | #include "mir_protobuf.pb.h" | 22 | #include "mir_protobuf.pb.h" |
1486 | 23 | 23 | ||
1487 | === modified file 'tests/unit-tests/frontend/test_protobuf_reports_errors.cpp' | |||
1488 | --- tests/unit-tests/frontend/test_protobuf_reports_errors.cpp 2013-06-19 16:14:40 +0000 | |||
1489 | +++ tests/unit-tests/frontend/test_protobuf_reports_errors.cpp 2013-09-25 14:20:36 +0000 | |||
1490 | @@ -17,7 +17,7 @@ | |||
1491 | 17 | * Alan Griffiths <alan@octopull.co.uk> | 17 | * Alan Griffiths <alan@octopull.co.uk> |
1492 | 18 | */ | 18 | */ |
1493 | 19 | 19 | ||
1495 | 20 | #include "mir/frontend/communicator.h" | 20 | #include "mir/frontend/connector.h" |
1496 | 21 | #include "mir/frontend/resource_cache.h" | 21 | #include "mir/frontend/resource_cache.h" |
1497 | 22 | 22 | ||
1498 | 23 | #include "mir_test/stub_server_tool.h" | 23 | #include "mir_test/stub_server_tool.h" |
1499 | 24 | 24 | ||
1500 | === modified file 'tests/unit-tests/frontend/test_protobuf_sends_fds.cpp' | |||
1501 | --- tests/unit-tests/frontend/test_protobuf_sends_fds.cpp 2013-06-03 08:14:01 +0000 | |||
1502 | +++ tests/unit-tests/frontend/test_protobuf_sends_fds.cpp 2013-09-25 14:20:36 +0000 | |||
1503 | @@ -17,7 +17,7 @@ | |||
1504 | 17 | * Alan Griffiths <alan@octopull.co.uk> | 17 | * Alan Griffiths <alan@octopull.co.uk> |
1505 | 18 | */ | 18 | */ |
1506 | 19 | 19 | ||
1508 | 20 | #include "mir/frontend/communicator.h" | 20 | #include "mir/frontend/connector.h" |
1509 | 21 | #include "mir/frontend/resource_cache.h" | 21 | #include "mir/frontend/resource_cache.h" |
1510 | 22 | 22 | ||
1511 | 23 | #include "mir_protobuf.pb.h" | 23 | #include "mir_protobuf.pb.h" |
1512 | 24 | 24 | ||
1513 | === modified file 'tests/unit-tests/frontend/test_protobuf_surface_apis.cpp' | |||
1514 | --- tests/unit-tests/frontend/test_protobuf_surface_apis.cpp 2013-06-03 08:14:01 +0000 | |||
1515 | +++ tests/unit-tests/frontend/test_protobuf_surface_apis.cpp 2013-09-25 14:20:36 +0000 | |||
1516 | @@ -17,7 +17,7 @@ | |||
1517 | 17 | * Alan Griffiths <alan@octopull.co.uk> | 17 | * Alan Griffiths <alan@octopull.co.uk> |
1518 | 18 | */ | 18 | */ |
1519 | 19 | 19 | ||
1521 | 20 | #include "mir/frontend/communicator.h" | 20 | #include "mir/frontend/connector.h" |
1522 | 21 | #include "mir/frontend/resource_cache.h" | 21 | #include "mir/frontend/resource_cache.h" |
1523 | 22 | 22 | ||
1524 | 23 | #include "mir_protobuf.pb.h" | 23 | #include "mir_protobuf.pb.h" |
1525 | 24 | 24 | ||
1526 | === renamed file 'tests/unit-tests/frontend/test_protobuf_communicator.cpp' => 'tests/unit-tests/frontend/test_published_socket_connector.cpp' | |||
1527 | --- tests/unit-tests/frontend/test_protobuf_communicator.cpp 2013-08-28 03:41:48 +0000 | |||
1528 | +++ tests/unit-tests/frontend/test_published_socket_connector.cpp 2013-09-25 14:20:36 +0000 | |||
1529 | @@ -17,10 +17,11 @@ | |||
1530 | 17 | * Alan Griffiths <alan@octopull.co.uk> | 17 | * Alan Griffiths <alan@octopull.co.uk> |
1531 | 18 | */ | 18 | */ |
1532 | 19 | 19 | ||
1535 | 20 | #include "mir/frontend/communicator.h" | 20 | #include "mir/frontend/connector.h" |
1536 | 21 | #include "mir/frontend/communicator_report.h" | 21 | #include "mir/frontend/connector_report.h" |
1537 | 22 | #include "mir/frontend/resource_cache.h" | 22 | #include "mir/frontend/resource_cache.h" |
1539 | 23 | #include "src/server/frontend/protobuf_socket_communicator.h" | 23 | #include "src/server/frontend/published_socket_connector.h" |
1540 | 24 | #include "src/server/frontend/protobuf_session_creator.h" | ||
1541 | 24 | 25 | ||
1542 | 25 | #include "mir_protobuf.pb.h" | 26 | #include "mir_protobuf.pb.h" |
1543 | 26 | 27 | ||
1544 | @@ -45,7 +46,7 @@ | |||
1545 | 45 | 46 | ||
1546 | 46 | namespace | 47 | namespace |
1547 | 47 | { | 48 | { |
1549 | 48 | class MockCommunicatorReport : public mf::CommunicatorReport | 49 | class MockCommunicatorReport : public mf::ConnectorReport |
1550 | 49 | { | 50 | { |
1551 | 50 | public: | 51 | public: |
1552 | 51 | 52 | ||
1553 | @@ -55,20 +56,21 @@ | |||
1554 | 55 | }; | 56 | }; |
1555 | 56 | } | 57 | } |
1556 | 57 | 58 | ||
1558 | 58 | struct ProtobufCommunicator : public ::testing::Test | 59 | struct PublishedSocketConnector : public ::testing::Test |
1559 | 59 | { | 60 | { |
1560 | 60 | static void SetUpTestCase() | 61 | static void SetUpTestCase() |
1561 | 61 | { | 62 | { |
1562 | 63 | } | ||
1563 | 64 | |||
1564 | 65 | void SetUp() | ||
1565 | 66 | { | ||
1566 | 62 | communicator_report = std::make_shared<MockCommunicatorReport>(); | 67 | communicator_report = std::make_shared<MockCommunicatorReport>(); |
1567 | 63 | stub_server_tool = std::make_shared<mt::StubServerTool>(); | 68 | stub_server_tool = std::make_shared<mt::StubServerTool>(); |
1568 | 64 | stub_server = std::make_shared<mt::TestProtobufServer>( | 69 | stub_server = std::make_shared<mt::TestProtobufServer>( |
1569 | 65 | "./test_socket", | 70 | "./test_socket", |
1570 | 66 | stub_server_tool, | 71 | stub_server_tool, |
1571 | 67 | communicator_report); | 72 | communicator_report); |
1572 | 68 | } | ||
1573 | 69 | 73 | ||
1574 | 70 | void SetUp() | ||
1575 | 71 | { | ||
1576 | 72 | using namespace testing; | 74 | using namespace testing; |
1577 | 73 | EXPECT_CALL(*communicator_report, error(_)).Times(AnyNumber()); | 75 | EXPECT_CALL(*communicator_report, error(_)).Times(AnyNumber()); |
1578 | 74 | stub_server->comm->start(); | 76 | stub_server->comm->start(); |
1579 | @@ -81,27 +83,27 @@ | |||
1580 | 81 | stub_server->comm->stop(); | 83 | stub_server->comm->stop(); |
1581 | 82 | testing::Mock::VerifyAndClearExpectations(communicator_report.get()); | 84 | testing::Mock::VerifyAndClearExpectations(communicator_report.get()); |
1582 | 83 | client.reset(); | 85 | client.reset(); |
1583 | 84 | } | ||
1584 | 85 | 86 | ||
1585 | 86 | static void TearDownTestCase() | ||
1586 | 87 | { | ||
1587 | 88 | stub_server.reset(); | 87 | stub_server.reset(); |
1588 | 89 | stub_server_tool.reset(); | 88 | stub_server_tool.reset(); |
1589 | 90 | communicator_report.reset(); | 89 | communicator_report.reset(); |
1590 | 91 | } | 90 | } |
1591 | 92 | 91 | ||
1592 | 92 | static void TearDownTestCase() | ||
1593 | 93 | { | ||
1594 | 94 | } | ||
1595 | 95 | |||
1596 | 93 | std::shared_ptr<mt::TestProtobufClient> client; | 96 | std::shared_ptr<mt::TestProtobufClient> client; |
1597 | 94 | static std::shared_ptr<MockCommunicatorReport> communicator_report; | 97 | static std::shared_ptr<MockCommunicatorReport> communicator_report; |
1598 | 95 | static std::shared_ptr<mt::StubServerTool> stub_server_tool; | 98 | static std::shared_ptr<mt::StubServerTool> stub_server_tool; |
1599 | 96 | private: | ||
1600 | 97 | static std::shared_ptr<mt::TestProtobufServer> stub_server; | 99 | static std::shared_ptr<mt::TestProtobufServer> stub_server; |
1601 | 98 | }; | 100 | }; |
1602 | 99 | 101 | ||
1606 | 100 | std::shared_ptr<mt::StubServerTool> ProtobufCommunicator::stub_server_tool; | 102 | std::shared_ptr<mt::StubServerTool> PublishedSocketConnector::stub_server_tool; |
1607 | 101 | std::shared_ptr<MockCommunicatorReport> ProtobufCommunicator::communicator_report; | 103 | std::shared_ptr<MockCommunicatorReport> PublishedSocketConnector::communicator_report; |
1608 | 102 | std::shared_ptr<mt::TestProtobufServer> ProtobufCommunicator::stub_server; | 104 | std::shared_ptr<mt::TestProtobufServer> PublishedSocketConnector::stub_server; |
1609 | 103 | 105 | ||
1611 | 104 | TEST_F(ProtobufCommunicator, create_surface_results_in_a_callback) | 106 | TEST_F(PublishedSocketConnector, create_surface_results_in_a_callback) |
1612 | 105 | { | 107 | { |
1613 | 106 | EXPECT_CALL(*client, create_surface_done()).Times(1); | 108 | EXPECT_CALL(*client, create_surface_done()).Times(1); |
1614 | 107 | 109 | ||
1615 | @@ -114,7 +116,7 @@ | |||
1616 | 114 | client->wait_for_create_surface(); | 116 | client->wait_for_create_surface(); |
1617 | 115 | } | 117 | } |
1618 | 116 | 118 | ||
1620 | 117 | TEST_F(ProtobufCommunicator, connection_sets_app_name) | 119 | TEST_F(PublishedSocketConnector, connection_sets_app_name) |
1621 | 118 | { | 120 | { |
1622 | 119 | EXPECT_CALL(*client, connect_done()).Times(1); | 121 | EXPECT_CALL(*client, connect_done()).Times(1); |
1623 | 120 | 122 | ||
1624 | @@ -131,7 +133,7 @@ | |||
1625 | 131 | EXPECT_EQ(__PRETTY_FUNCTION__, stub_server_tool->app_name); | 133 | EXPECT_EQ(__PRETTY_FUNCTION__, stub_server_tool->app_name); |
1626 | 132 | } | 134 | } |
1627 | 133 | 135 | ||
1629 | 134 | TEST_F(ProtobufCommunicator, create_surface_sets_surface_name) | 136 | TEST_F(PublishedSocketConnector, create_surface_sets_surface_name) |
1630 | 135 | { | 137 | { |
1631 | 136 | EXPECT_CALL(*client, connect_done()).Times(1); | 138 | EXPECT_CALL(*client, connect_done()).Times(1); |
1632 | 137 | EXPECT_CALL(*client, create_surface_done()).Times(1); | 139 | EXPECT_CALL(*client, create_surface_done()).Times(1); |
1633 | @@ -160,7 +162,7 @@ | |||
1634 | 160 | } | 162 | } |
1635 | 161 | 163 | ||
1636 | 162 | 164 | ||
1638 | 163 | TEST_F(ProtobufCommunicator, | 165 | TEST_F(PublishedSocketConnector, |
1639 | 164 | create_surface_results_in_a_surface_being_created) | 166 | create_surface_results_in_a_surface_being_created) |
1640 | 165 | { | 167 | { |
1641 | 166 | EXPECT_CALL(*client, create_surface_done()).Times(1); | 168 | EXPECT_CALL(*client, create_surface_done()).Times(1); |
1642 | @@ -184,7 +186,7 @@ | |||
1643 | 184 | 186 | ||
1644 | 185 | } | 187 | } |
1645 | 186 | 188 | ||
1647 | 187 | TEST_F(ProtobufCommunicator, double_disconnection_attempt_throws_exception) | 189 | TEST_F(PublishedSocketConnector, double_disconnection_attempt_throws_exception) |
1648 | 188 | { | 190 | { |
1649 | 189 | using namespace testing; | 191 | using namespace testing; |
1650 | 190 | 192 | ||
1651 | @@ -219,7 +221,7 @@ | |||
1652 | 219 | }, std::runtime_error); | 221 | }, std::runtime_error); |
1653 | 220 | } | 222 | } |
1654 | 221 | 223 | ||
1656 | 222 | TEST_F(ProtobufCommunicator, getting_and_advancing_buffers) | 224 | TEST_F(PublishedSocketConnector, getting_and_advancing_buffers) |
1657 | 223 | { | 225 | { |
1658 | 224 | EXPECT_CALL(*client, create_surface_done()).Times(testing::AtLeast(0)); | 226 | EXPECT_CALL(*client, create_surface_done()).Times(testing::AtLeast(0)); |
1659 | 225 | EXPECT_CALL(*client, disconnect_done()).Times(testing::AtLeast(0)); | 227 | EXPECT_CALL(*client, disconnect_done()).Times(testing::AtLeast(0)); |
1660 | @@ -256,7 +258,7 @@ | |||
1661 | 256 | client->wait_for_disconnect_done(); | 258 | client->wait_for_disconnect_done(); |
1662 | 257 | } | 259 | } |
1663 | 258 | 260 | ||
1665 | 259 | TEST_F(ProtobufCommunicator, | 261 | TEST_F(PublishedSocketConnector, |
1666 | 260 | connect_create_surface_then_disconnect_a_session) | 262 | connect_create_surface_then_disconnect_a_session) |
1667 | 261 | { | 263 | { |
1668 | 262 | EXPECT_CALL(*client, create_surface_done()).Times(1); | 264 | EXPECT_CALL(*client, create_surface_done()).Times(1); |
1669 | @@ -278,7 +280,7 @@ | |||
1670 | 278 | client->wait_for_disconnect_done(); | 280 | client->wait_for_disconnect_done(); |
1671 | 279 | } | 281 | } |
1672 | 280 | 282 | ||
1674 | 281 | TEST_F(ProtobufCommunicator, drm_auth_magic_is_processed_by_the_server) | 283 | TEST_F(PublishedSocketConnector, drm_auth_magic_is_processed_by_the_server) |
1675 | 282 | { | 284 | { |
1676 | 283 | mir::protobuf::DRMMagic magic; | 285 | mir::protobuf::DRMMagic magic; |
1677 | 284 | mir::protobuf::DRMAuthMagicStatus status; | 286 | mir::protobuf::DRMAuthMagicStatus status; |
1678 | @@ -308,7 +310,7 @@ | |||
1679 | 308 | 310 | ||
1680 | 309 | } | 311 | } |
1681 | 310 | 312 | ||
1683 | 311 | TEST_F(ProtobufCommunicator, forces_requests_to_complete_when_stopping) | 313 | TEST_F(PublishedSocketConnector, forces_requests_to_complete_when_stopping) |
1684 | 312 | { | 314 | { |
1685 | 313 | MockForceRequests mock_force_requests; | 315 | MockForceRequests mock_force_requests; |
1686 | 314 | auto stub_server_tool = std::make_shared<mt::StubServerTool>(); | 316 | auto stub_server_tool = std::make_shared<mt::StubServerTool>(); |
1687 | @@ -318,17 +320,18 @@ | |||
1688 | 318 | EXPECT_CALL(mock_force_requests, force_requests_to_complete()) | 320 | EXPECT_CALL(mock_force_requests, force_requests_to_complete()) |
1689 | 319 | .Times(2); | 321 | .Times(2); |
1690 | 320 | 322 | ||
1697 | 321 | auto comms = std::make_shared<mf::ProtobufSocketCommunicator>( | 323 | auto comms = std::make_shared<mf::PublishedSocketConnector>( |
1698 | 322 | "./test_socket1", ipc_factory, | 324 | "./test_socket1", |
1699 | 323 | std::make_shared<mtd::StubSessionAuthorizer>(), 10, | 325 | std::make_shared<mf::ProtobufSessionCreator>(ipc_factory, std::make_shared<mtd::StubSessionAuthorizer>()), |
1700 | 324 | std::bind(&MockForceRequests::force_requests_to_complete, | 326 | 10, |
1701 | 325 | &mock_force_requests), | 327 | std::bind(&MockForceRequests::force_requests_to_complete, &mock_force_requests), |
1702 | 326 | std::make_shared<mf::NullCommunicatorReport>()); | 328 | std::make_shared<mf::NullConnectorReport>()); |
1703 | 329 | |||
1704 | 327 | comms->start(); | 330 | comms->start(); |
1705 | 328 | comms->stop(); | 331 | comms->stop(); |
1706 | 329 | } | 332 | } |
1707 | 330 | 333 | ||
1709 | 331 | TEST_F(ProtobufCommunicator, disorderly_disconnection_handled) | 334 | TEST_F(PublishedSocketConnector, disorderly_disconnection_handled) |
1710 | 332 | { | 335 | { |
1711 | 333 | using namespace testing; | 336 | using namespace testing; |
1712 | 334 | 337 | ||
1713 | @@ -363,7 +366,7 @@ | |||
1714 | 363 | while (!done && cv.wait_until(lock, deadline) != std::cv_status::timeout); | 366 | while (!done && cv.wait_until(lock, deadline) != std::cv_status::timeout); |
1715 | 364 | } | 367 | } |
1716 | 365 | 368 | ||
1718 | 366 | TEST_F(ProtobufCommunicator, configure_display) | 369 | TEST_F(PublishedSocketConnector, configure_display) |
1719 | 367 | { | 370 | { |
1720 | 368 | EXPECT_CALL(*client, display_configure_done()) | 371 | EXPECT_CALL(*client, display_configure_done()) |
1721 | 369 | .Times(1); | 372 | .Times(1); |
1722 | @@ -376,3 +379,57 @@ | |||
1723 | 376 | 379 | ||
1724 | 377 | client->wait_for_configure_display_done(); | 380 | client->wait_for_configure_display_done(); |
1725 | 378 | } | 381 | } |
1726 | 382 | |||
1727 | 383 | TEST_F(PublishedSocketConnector, connection_using_socket_fd) | ||
1728 | 384 | { | ||
1729 | 385 | int const next_buffer_calls{8}; | ||
1730 | 386 | char buffer[128] = {0}; | ||
1731 | 387 | sprintf(buffer, "fd://%d", stub_server->comm->client_socket_fd()); | ||
1732 | 388 | auto client = std::make_shared<mt::TestProtobufClient>(buffer, 100); | ||
1733 | 389 | client->connect_parameters.set_application_name(__PRETTY_FUNCTION__); | ||
1734 | 390 | |||
1735 | 391 | EXPECT_CALL(*client, connect_done()).Times(1); | ||
1736 | 392 | |||
1737 | 393 | client->display_server.connect( | ||
1738 | 394 | 0, | ||
1739 | 395 | &client->connect_parameters, | ||
1740 | 396 | &client->connection, | ||
1741 | 397 | google::protobuf::NewCallback(client.get(), &mt::TestProtobufClient::connect_done)); | ||
1742 | 398 | |||
1743 | 399 | EXPECT_CALL(*client, create_surface_done()).Times(testing::AtLeast(0)); | ||
1744 | 400 | EXPECT_CALL(*client, disconnect_done()).Times(testing::AtLeast(0)); | ||
1745 | 401 | |||
1746 | 402 | client->display_server.create_surface( | ||
1747 | 403 | 0, | ||
1748 | 404 | &client->surface_parameters, | ||
1749 | 405 | &client->surface, | ||
1750 | 406 | google::protobuf::NewCallback(client.get(), &mt::TestProtobufClient::create_surface_done)); | ||
1751 | 407 | |||
1752 | 408 | client->wait_for_create_surface(); | ||
1753 | 409 | |||
1754 | 410 | EXPECT_TRUE(client->surface.has_buffer()); | ||
1755 | 411 | EXPECT_CALL(*client, next_buffer_done()).Times(next_buffer_calls); | ||
1756 | 412 | |||
1757 | 413 | for (int i = 0; i != next_buffer_calls; ++i) | ||
1758 | 414 | { | ||
1759 | 415 | client->display_server.next_buffer( | ||
1760 | 416 | 0, | ||
1761 | 417 | &client->surface.id(), | ||
1762 | 418 | client->surface.mutable_buffer(), | ||
1763 | 419 | google::protobuf::NewCallback(client.get(), &mt::TestProtobufClient::next_buffer_done)); | ||
1764 | 420 | |||
1765 | 421 | client->wait_for_next_buffer(); | ||
1766 | 422 | EXPECT_TRUE(client->surface.has_buffer()); | ||
1767 | 423 | } | ||
1768 | 424 | |||
1769 | 425 | client->display_server.disconnect( | ||
1770 | 426 | 0, | ||
1771 | 427 | &client->ignored, | ||
1772 | 428 | &client->ignored, | ||
1773 | 429 | google::protobuf::NewCallback(client.get(), &mt::TestProtobufClient::disconnect_done)); | ||
1774 | 430 | |||
1775 | 431 | client->wait_for_disconnect_done(); | ||
1776 | 432 | |||
1777 | 433 | EXPECT_EQ(__PRETTY_FUNCTION__, stub_server_tool->app_name); | ||
1778 | 434 | } | ||
1779 | 435 |
FAILED: Continuous integration, rev:1099 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- ci/3/ jenkins. qa.ubuntu. com/job/ mir-android- saucy-i386- build/2103 jenkins. qa.ubuntu. com/job/ mir-clang- saucy-amd64- build/1988 jenkins. qa.ubuntu. com/job/ mir-team- mir-development -branch- saucy-amd64- ci/3/console
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ mir-team- mir-development -branch- ci/3/rebuild
http://