Mir

Merge lp:~alan-griffiths/mir/tidy-code into lp:mir

Proposed by Alan Griffiths
Status: Merged
Approved by: Daniel van Vugt
Approved revision: no longer in the source branch.
Merged at revision: 4094
Proposed branch: lp:~alan-griffiths/mir/tidy-code
Merge into: lp:mir
Diff against target: 489 lines (+0/-420)
6 files modified
src/client/CMakeLists.txt (+0/-1)
src/client/private.cpp (+0/-26)
src/include/client/mir/client/private.h (+0/-47)
tests/integration-tests/CMakeLists.txt (+0/-10)
tests/integration-tests/test_protobuf.cpp (+0/-316)
tests/integration-tests/test_protobuf.proto (+0/-20)
To merge this branch: bzr merge lp:~alan-griffiths/mir/tidy-code
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Andreas Pokorny (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+320227@code.launchpad.net

Commit message

Remove unused mechanism for exposing the protobuf RPC channel

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4094
https://mir-jenkins.ubuntu.com/job/mir-ci/3183/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4279
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4366
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4356
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4356
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4356
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4306
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4306/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4306
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4306/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4306
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4306/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4306
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4306/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4306
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4306/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4306
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4306/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3183/rebuild

review: Approve (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

FAILED: Continuous integration, rev:4095
https://mir-jenkins.ubuntu.com/job/mir-ci/3184/
Executed test runs:
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-mir/4280/console
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4367
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4357
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4357
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4357
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4307/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4307/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4307/artifact/output/*zip*/output.zip
    FAILURE: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4307/console
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4307/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4307/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4307
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4307/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3184/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:4095
https://mir-jenkins.ubuntu.com/job/mir-ci/3186/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-mir/4284
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/4371
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/4361
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/4361
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/4361
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4311
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=clang,platform=mesa,release=zesty/4311/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4311
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=xenial+overlay/4311/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4311
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=amd64,compiler=gcc,platform=mesa,release=zesty/4311/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4311
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=cross-armhf,compiler=gcc,platform=android,release=vivid+overlay/4311/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4311
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=android,release=vivid+overlay/4311/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4311
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-mir/arch=i386,compiler=gcc,platform=mesa,release=xenial+overlay/4311/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/mir-ci/3186/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andreas Pokorny (andreas-pokorny) wrote :

lots of red..

review: Approve
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Sure, if it really is unused.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/client/CMakeLists.txt'
2--- src/client/CMakeLists.txt 2017-01-24 13:43:12 +0000
3+++ src/client/CMakeLists.txt 2017-03-17 17:00:15 +0000
4@@ -66,7 +66,6 @@
5 logging/perf_report.cpp
6 default_connection_configuration.cpp
7 connection_surface_map.cpp
8- private.cpp
9 frame_clock.cpp
10 mir_screencast.cpp
11 mir_screencast_api.cpp
12
13=== removed file 'src/client/private.cpp'
14--- src/client/private.cpp 2017-01-18 02:29:37 +0000
15+++ src/client/private.cpp 1970-01-01 00:00:00 +0000
16@@ -1,26 +0,0 @@
17-/*
18- * Copyright © 2014 Canonical Ltd.
19- *
20- * This program is free software: you can redistribute it and/or modify
21- * it under the terms of the GNU Lesser General Public License version 3 as
22- * published by the Free Software Foundation.
23- *
24- * This program is distributed in the hope that it will be useful,
25- * but WITHOUT ANY WARRANTY; without even the implied warranty of
26- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27- * GNU Lesser General Public License for more details.
28- *
29- * You should have received a copy of the GNU Lesser General Public License
30- * along with this program. If not, see <http://www.gnu.org/licenses/>.
31- *
32- * Authored by: Alan Griffiths <alan@octopull.co.uk>
33- */
34-
35-#include "mir/client/private.h"
36-#include "mir_connection.h"
37-
38-auto mir::client::the_rpc_channel(MirConnection *connection)
39--> std::shared_ptr<mir::client::rpc::MirBasicRpcChannel>
40-{
41- return connection->rpc_channel();
42-}
43
44=== removed file 'src/include/client/mir/client/private.h'
45--- src/include/client/mir/client/private.h 2016-01-29 08:18:22 +0000
46+++ src/include/client/mir/client/private.h 1970-01-01 00:00:00 +0000
47@@ -1,47 +0,0 @@
48-/*
49- * Copyright © 2014 Canonical Ltd.
50- *
51- * This program is free software: you can redistribute it and/or modify
52- * it under the terms of the GNU Lesser General Public License version 3 as
53- * published by the Free Software Foundation.
54- *
55- * This program is distributed in the hope that it will be useful,
56- * but WITHOUT ANY WARRANTY; without even the implied warranty of
57- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58- * GNU Lesser General Public License for more details.
59- *
60- * You should have received a copy of the GNU Lesser General Public License
61- * along with this program. If not, see <http://www.gnu.org/licenses/>.
62- *
63- * Authored by: Alan Griffiths <alan@octopull.co.uk>
64- */
65-
66-#ifndef MIR_CLIENT_PRIVATE_H_
67-#define MIR_CLIENT_PRIVATE_H_
68-
69-#include <mir_toolkit/client_types.h>
70-
71-#include <memory>
72-
73-namespace mir
74-{
75-namespace client
76-{
77-namespace rpc
78-{
79-class MirBasicRpcChannel;
80-}
81-/**
82- * Get the the RpcChannel associated with the connection.
83- * This is a "private" function to support development of client-side protobuf RPC calls
84- * using the Mir infrastructure. This intended for internal prototyping and there is no
85- * commitment to long term support.
86- *
87- * @param connection - a connection to a Mir server
88- * @return the RpcChannel associated with the connection
89- */
90-std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> the_rpc_channel(MirConnection* connection);
91-}
92-}
93-
94-#endif /* MIR_CLIENT_PRIVATE_H_ */
95
96=== modified file 'tests/integration-tests/CMakeLists.txt'
97--- tests/integration-tests/CMakeLists.txt 2017-02-15 14:45:41 +0000
98+++ tests/integration-tests/CMakeLists.txt 2017-03-17 17:00:15 +0000
99@@ -2,7 +2,6 @@
100
101 include_directories(
102 ${CMAKE_SOURCE_DIR}
103- ${PROTOBUF_INCLUDE_DIRS}
104 ${CMAKE_CURRENT_BINARY_DIR}
105 ${PROJECT_SOURCE_DIR}/include/cookie
106 ${PROJECT_SOURCE_DIR}/src/include/platform
107@@ -14,11 +13,6 @@
108 ${PROJECT_SOURCE_DIR}/include/renderers/sw
109 )
110
111-protobuf_generate_cpp(
112- GENERATED_PROTOBUF_SRCS GENERATED_PROTOBUF_HDRS
113- test_protobuf.proto
114-)
115-
116 set(
117 INTEGRATION_TESTS_SRCS
118 test_focus_selection.cpp
119@@ -27,7 +21,6 @@
120 test_buffer_scheduling.cpp
121 test_client_screencast.cpp
122 test_large_messages.cpp
123- test_protobuf.cpp
124 test_surfaceloop.cpp
125 test_stale_frames.cpp
126 test_test_framework.cpp
127@@ -42,8 +35,6 @@
128 test_server_shutdown.cpp
129 test_session.cpp
130 session_management.cpp
131- ${GENERATED_PROTOBUF_SRCS}
132- ${GENERATED_PROTOBUF_HDRS}
133 )
134
135 add_subdirectory(client/)
136@@ -77,7 +68,6 @@
137
138 mircommon
139
140- ${PROTOBUF_LITE_LIBRARIES}
141 ${Boost_LIBRARIES}
142 ${GTEST_BOTH_LIBRARIES}
143 ${GMOCK_LIBRARY}
144
145=== removed file 'tests/integration-tests/test_protobuf.cpp'
146--- tests/integration-tests/test_protobuf.cpp 2017-01-18 02:29:37 +0000
147+++ tests/integration-tests/test_protobuf.cpp 1970-01-01 00:00:00 +0000
148@@ -1,316 +0,0 @@
149-/*
150- * Copyright © 2014 Canonical Ltd.
151- *
152- * This program is free software: you can redistribute it and/or modify it
153- * under the terms of the GNU General Public License version 3,
154- * as published by the Free Software Foundation.
155- *
156- * This program is distributed in the hope that it will be useful,
157- * but WITHOUT ANY WARRANTY; without even the implied warranty of
158- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
159- * GNU General Public License for more details.
160- *
161- * You should have received a copy of the GNU General Public License
162- * along with this program. If not, see <http://www.gnu.org/licenses/>.
163- *
164- * Authored by: Alan Griffiths <alan@octopull.co.uk>
165- */
166-
167-#include "test_protobuf.pb.h"
168-#include "src/client/rpc/mir_basic_rpc_channel.h"
169-
170-#include "mir_toolkit/mir_client_library.h"
171-#include "mir/client/private.h"
172-#include "mir/frontend/protobuf_message_sender.h"
173-#include "mir/frontend/protobuf_connection_creator.h"
174-#include "mir/frontend/template_protobuf_message_processor.h"
175-
176-#include "mir_test_framework/stubbed_server_configuration.h"
177-#include "mir_test_framework/in_process_server.h"
178-#include "mir/test/doubles/null_platform_ipc_operations.h"
179-
180-#include <gtest/gtest.h>
181-#include <gmock/gmock.h>
182-
183-#include <atomic>
184-
185-namespace mf = mir::frontend;
186-namespace mfd = mir::frontend::detail;
187-namespace mtf = mir_test_framework;
188-
189-/*************************************************************************/
190-/*************************************************************************/
191-/* Note that the functionality demonstrated here relies on "detail" and */
192-/* is not guaranteed to be supported in future. */
193-/*************************************************************************/
194-/*************************************************************************/
195-namespace
196-{
197-struct DemoMirServer
198-{
199- MOCK_CONST_METHOD1(on_call, std::string(std::string));
200-
201- DemoMirServer()
202- {
203- using namespace testing;
204- ON_CALL(*this, on_call(_)).WillByDefault(Return("ok"));
205- }
206-
207- void function(
208- mir::protobuf::test::Parameters const* parameters,
209- mir::protobuf::test::Result* response,
210- google::protobuf::Closure* done)
211- {
212- response->set_value(on_call(parameters->name()));
213- done->Run();
214- }
215-};
216-
217-struct AMirServer
218-{
219- AMirServer(std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> const& channel)
220- : channel{channel}
221- {
222- }
223-
224- void function(
225- mir::protobuf::test::Parameters const* parameters,
226- mir::protobuf::test::Result* response,
227- google::protobuf::Closure* done)
228- {
229- channel->call_method(std::string(__func__), parameters, response, done);
230- }
231- std::shared_ptr<mir::client::rpc::MirBasicRpcChannel> channel;
232-};
233-
234-// using a global for easy access from tests and DemoMessageProcessor::dispatch()
235-DemoMirServer* demo_mir_server;
236-
237-struct DemoMessageProcessor : mfd::MessageProcessor
238-{
239- DemoMessageProcessor(
240- std::shared_ptr<mfd::ProtobufMessageSender> const& sender,
241- std::shared_ptr<mfd::MessageProcessor> const& wrapped) :
242- sender(sender),
243- wrapped(wrapped) {}
244-
245- void client_pid(int /*pid*/) override {}
246-
247- bool dispatch(mfd::Invocation const& invocation, std::vector<mir::Fd> const& fds) override
248- {
249- if ("function" == invocation.method_name())
250- {
251- mfd::invoke(
252- this,
253- demo_mir_server,
254- &DemoMirServer::function,
255- invocation);
256- return true;
257- }
258-
259- return wrapped->dispatch(invocation, fds);
260- }
261-
262- void send_response(::google::protobuf::uint32 id, ::google::protobuf::MessageLite* response)
263- {
264- sender->send_response(id, response, {});
265- }
266-
267- std::shared_ptr<mfd::ProtobufMessageSender> const sender;
268- std::shared_ptr<mfd::MessageProcessor> const wrapped;
269-};
270-
271-struct DemoConnectionCreator : mf::ProtobufConnectionCreator
272-{
273- using ProtobufConnectionCreator::ProtobufConnectionCreator;
274-
275- MOCK_CONST_METHOD3(create_processor,
276- std::shared_ptr<mfd::MessageProcessor>(
277- std::shared_ptr<mfd::ProtobufMessageSender> const& sender,
278- std::shared_ptr<mfd::DisplayServer> const& display_server,
279- std::shared_ptr<mf::MessageProcessorReport> const& report));
280-
281- std::shared_ptr<mfd::MessageProcessor> create_wrapped_processor(
282- std::shared_ptr<mfd::ProtobufMessageSender> const& sender,
283- std::shared_ptr<mfd::DisplayServer> const& display_server,
284- std::shared_ptr<mf::MessageProcessorReport> const& report) const
285- {
286- auto const wrapped = mf::ProtobufConnectionCreator::create_processor(
287- sender,
288- display_server,
289- report);
290-
291- return std::make_shared<DemoMessageProcessor>(sender, wrapped);
292- }
293-
294- std::shared_ptr<mfd::MessageProcessor> create_unwrapped_processor(
295- std::shared_ptr<mfd::ProtobufMessageSender> const& sender,
296- std::shared_ptr<mfd::DisplayServer> const& display_server,
297- std::shared_ptr<mf::MessageProcessorReport> const& report) const
298- {
299- return mf::ProtobufConnectionCreator::create_processor(
300- sender,
301- display_server,
302- report);
303- }
304-};
305-
306-struct DemoServerConfiguration : mtf::StubbedServerConfiguration
307-{
308- std::shared_ptr<mf::ConnectionCreator> the_connection_creator() override
309- {
310- return connection_creator([this]
311- {
312- return std::make_shared<DemoConnectionCreator>(
313- new_ipc_factory(the_session_authorizer()),
314- the_session_authorizer(),
315- std::make_shared<mir::test::doubles::NullPlatformIpcOperations>(),
316- the_message_processor_report());
317- });
318- }
319-
320-};
321-
322-struct DemoPrivateProtobuf : mtf::InProcessServer
323-{
324- mir::DefaultServerConfiguration& server_config() override { return my_server_config; }
325-
326- DemoServerConfiguration my_server_config;
327-
328- std::shared_ptr<DemoConnectionCreator> demo_connection_creator;
329-
330- void SetUp() override
331- {
332- ::demo_mir_server = &demo_mir_server;
333-
334- mtf::InProcessServer::SetUp();
335- demo_connection_creator = std::dynamic_pointer_cast<DemoConnectionCreator>(my_server_config.the_connection_creator());
336-
337- using namespace testing;
338- ASSERT_THAT(demo_connection_creator, NotNull());
339-
340- ON_CALL(*demo_connection_creator, create_processor(_, _, _))
341- .WillByDefault(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_unwrapped_processor));
342- }
343-
344- testing::NiceMock<DemoMirServer> demo_mir_server;
345-};
346-
347-void callback(std::atomic<bool>* called_back) { called_back->store(true); }
348-char const* const nothing_returned = "Nothing returned";
349-}
350-
351-TEST_F(DemoPrivateProtobuf, client_calls_server)
352-{
353- using namespace testing;
354- EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _));
355-
356- auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
357- ASSERT_TRUE(mir_connection_is_valid(connection));
358-
359- auto const rpc_channel = mir::client::the_rpc_channel(connection);
360-
361- using namespace mir::protobuf::test;
362- using namespace google::protobuf;
363-
364- AMirServer server(rpc_channel);
365-
366- Parameters parameters;
367- parameters.set_name(__PRETTY_FUNCTION__);
368-
369- Result result;
370- result.set_error(nothing_returned);
371- std::atomic<bool> called_back{false};
372-
373- // After the call there's a race between the client releasing the connection
374- // and the server dropping the connection.
375- // If the latter wins we'll invoke the client's lifecycle_event_callback.
376- // As the default callback kills the process with SIGHUP, we need to
377- // replace it to ensure the test can continue.
378- mir_connection_set_lifecycle_event_callback(
379- connection,
380- [](MirConnection*, MirLifecycleState, void*){},
381- nullptr);
382-
383- // Note:
384- // As the default server won't recognise this call it drops the connection
385- // resulting in a callback when the connection drops (but result being unchanged)
386- server.function(
387- &parameters,
388- &result,
389- NewCallback(&callback, &called_back));
390-
391- mir_connection_release(connection);
392-
393- EXPECT_TRUE(called_back);
394- EXPECT_THAT(result.error(), Eq(nothing_returned));
395-}
396-
397-TEST_F(DemoPrivateProtobuf, wrapping_message_processor)
398-{
399- using namespace testing;
400- EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _))
401- .Times(1)
402- .WillOnce(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_wrapped_processor));
403-
404- auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
405-
406- mir_connection_release(connection);
407-}
408-
409-TEST_F(DemoPrivateProtobuf, server_receives_function_call)
410-{
411- using namespace testing;
412- EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _))
413- .WillRepeatedly(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_wrapped_processor));
414-
415- auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
416- ASSERT_TRUE(mir_connection_is_valid(connection));
417-
418- auto const rpc_channel = mir::client::the_rpc_channel(connection);
419-
420- using namespace mir::protobuf::test;
421- using namespace google::protobuf;
422-
423- AMirServer server(rpc_channel);
424-
425- Parameters parameters;
426- Result result;
427- parameters.set_name(__PRETTY_FUNCTION__);
428-
429- EXPECT_CALL(demo_mir_server, on_call(__PRETTY_FUNCTION__)).Times(1);
430-
431- server.function(&parameters, &result, NewCallback([]{}));
432-
433- mir_connection_release(connection);
434-}
435-
436-
437-TEST_F(DemoPrivateProtobuf, client_receives_result)
438-{
439- using namespace testing;
440- EXPECT_CALL(*demo_connection_creator, create_processor(_, _, _))
441- .WillRepeatedly(Invoke(demo_connection_creator.get(), &DemoConnectionCreator::create_wrapped_processor));
442- EXPECT_CALL(demo_mir_server, on_call(_)).WillRepeatedly(Return(__PRETTY_FUNCTION__));
443-
444- auto const connection = mir_connect_sync(new_connection().c_str(), __PRETTY_FUNCTION__);
445- ASSERT_TRUE(mir_connection_is_valid(connection));
446-
447- auto const rpc_channel = mir::client::the_rpc_channel(connection);
448-
449- using namespace mir::protobuf::test;
450- using namespace google::protobuf;
451-
452- AMirServer server(rpc_channel);
453-
454- Parameters parameters;
455- Result result;
456- parameters.set_name(__PRETTY_FUNCTION__);
457-
458- server.function(&parameters, &result, NewCallback([]{}));
459-
460- mir_connection_release(connection);
461-
462- EXPECT_THAT(result.has_error(), Eq(false));
463- EXPECT_THAT(result.value(), Eq(__PRETTY_FUNCTION__));
464-}
465
466=== removed file 'tests/integration-tests/test_protobuf.proto'
467--- tests/integration-tests/test_protobuf.proto 2017-01-18 02:29:37 +0000
468+++ tests/integration-tests/test_protobuf.proto 1970-01-01 00:00:00 +0000
469@@ -1,20 +0,0 @@
470-syntax = "proto2";
471-option optimize_for = LITE_RUNTIME;
472-
473-package mir.protobuf.test;
474-
475-message Parameters {
476- required string name = 1;
477-}
478-
479-message StructuredError {
480- optional uint32 domain = 1;
481- optional uint32 code = 2;
482-}
483-
484-message Result {
485- optional string error = 127;
486- optional StructuredError structured_error = 128;
487- optional string value = 1;
488-}
489-

Subscribers

People subscribed via source and target branches