Merge lp:~ted/ubuntu-app-launch/libertine-service into lp:ubuntu-app-launch

Proposed by Ted Gould
Status: Merged
Approved by: Ken VanDine
Approved revision: 296
Merged at revision: 293
Proposed branch: lp:~ted/ubuntu-app-launch/libertine-service
Merge into: lp:ubuntu-app-launch
Diff against target: 294 lines (+113/-9)
8 files modified
debian/control (+1/-0)
tests/CMakeLists.txt (+2/-1)
tests/exec-util-test.cc (+8/-0)
tests/libertine-home/libertine/ContainersConfig.json (+1/-1)
tests/libertine-service.h (+70/-0)
tests/libual-cpp-test.cc (+9/-0)
tests/libual-test.cc (+9/-0)
tests/list-apps.cpp (+13/-7)
To merge this branch: bzr merge lp:~ted/ubuntu-app-launch/libertine-service
Reviewer Review Type Date Requested Status
unity-api-1-bot continuous-integration Needs Fixing
Ken VanDine Approve
Review via email: mp+317154@code.launchpad.net

Commit message

Run the libertine-service in tests for new libertine >= 1.6

To post a comment you must log in.
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
293. By Ted Gould

Adding a wait for libertined to start in list apps

294. By Ted Gould

Add in more waits

Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)
295. By Ted Gould

Goin' 'mock'

296. By Ted Gould

Increase debug messages from libertine service

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good and works

review: Approve
Revision history for this message
unity-api-1-bot (unity-api-1-bot) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2017-01-19 18:39:44 +0000
3+++ debian/control 2017-02-15 15:03:59 +0000
4@@ -15,6 +15,7 @@
5 libcurl4-dev | libcurl4-gnutls-dev,
6 libdbus-1-dev,
7 libdbustest1-dev (>= 14.04.0),
8+ libertined (>= 1.6),
9 libgirepository1.0-dev,
10 libglib2.0-dev,
11 libgtest-dev,
12
13=== modified file 'tests/CMakeLists.txt'
14--- tests/CMakeLists.txt 2017-01-19 18:52:33 +0000
15+++ tests/CMakeLists.txt 2017-02-15 15:03:59 +0000
16@@ -89,7 +89,7 @@
17
18 add_executable (list-apps
19 list-apps.cpp)
20-target_link_libraries (list-apps gtest_main ${GTEST_MAIN_LIBRARIES} launcher-static)
21+target_link_libraries (list-apps gtest_main ${GTEST_MAIN_LIBRARIES} ${DBUSTEST_LIBRARIES} launcher-static)
22 add_test (NAME list-apps COMMAND ${CMAKE_CURRENT_BINARY_DIR}/list-apps)
23
24 # Application Info Desktop
25@@ -181,6 +181,7 @@
26 eventually-fixture.h
27 jobs-base-test.cpp
28 jobs-systemd.cpp
29+ libertine-service.h
30 registry-mock.h
31 snapd-info-test.cpp
32 snapd-mock.h
33
34=== modified file 'tests/exec-util-test.cc'
35--- tests/exec-util-test.cc 2017-01-19 18:52:33 +0000
36+++ tests/exec-util-test.cc 2017-02-15 15:03:59 +0000
37@@ -27,12 +27,14 @@
38 #include <libubuntu-app-launch/registry.h>
39
40 #include "eventually-fixture.h"
41+#include "libertine-service.h"
42
43 class ExecUtil : public EventuallyFixture
44 {
45 protected:
46 DbusTestService * service = NULL;
47 DbusTestDbusMock * mock = NULL;
48+ std::shared_ptr<LibertineService> libertine;
49 GDBusConnection * bus = NULL;
50 std::string laststarted;
51
52@@ -75,6 +77,11 @@
53 NULL);
54
55 dbus_test_service_add_task(service, DBUS_TEST_TASK(mock));
56+
57+ libertine = std::make_shared<LibertineService>();
58+ dbus_test_service_add_task(service, *libertine);
59+ dbus_test_service_add_task(service, libertine->waitTask());
60+
61 dbus_test_service_start_tasks(service);
62
63 bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
64@@ -89,6 +96,7 @@
65 ubuntu_app_launch_observer_delete_app_starting(starting_cb, this);
66 ubuntu::app_launch::Registry::clearDefault();
67
68+ libertine.reset();
69 g_clear_object(&mock);
70 g_clear_object(&service);
71
72
73=== modified file 'tests/libertine-home/libertine/ContainersConfig.json'
74--- tests/libertine-home/libertine/ContainersConfig.json 2016-07-28 19:11:32 +0000
75+++ tests/libertine-home/libertine/ContainersConfig.json 2017-02-15 15:03:59 +0000
76@@ -9,7 +9,7 @@
77 ],
78 "multiarch": "disabled",
79 "name": "Container Name",
80- "type": "lxc"
81+ "type": "mock"
82 }
83 ],
84 "defaultContainer": "container-name"
85
86=== added file 'tests/libertine-service.h'
87--- tests/libertine-service.h 1970-01-01 00:00:00 +0000
88+++ tests/libertine-service.h 2017-02-15 15:03:59 +0000
89@@ -0,0 +1,70 @@
90+/*
91+ * Copyright © 2017 Canonical Ltd.
92+ *
93+ * This program is free software; you can redistribute it and/or modify
94+ * it under the terms of the GNU General Public License as published by
95+ * the Free Software Foundation; version 3.
96+ *
97+ * This program is distributed in the hope that it will be useful,
98+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
99+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
100+ * GNU General Public License for more details.
101+ *
102+ * You should have received a copy of the GNU General Public License
103+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
104+ *
105+ * Authors:
106+ * Ted Gould <ted@canonical.com>
107+ */
108+
109+#include <gio/gio.h>
110+
111+#include <libdbustest/dbus-test.h>
112+
113+class LibertineService
114+{
115+private:
116+ DbusTestProcess* process = nullptr;
117+ DbusTestTask* wait = nullptr;
118+
119+public:
120+ LibertineService()
121+ {
122+ g_setenv("LIBERTINE_DEBUG", "2", TRUE);
123+
124+ process = dbus_test_process_new("/usr/bin/libertined");
125+ dbus_test_process_append_param(process, "--debug");
126+
127+ dbus_test_task_set_bus(DBUS_TEST_TASK(process), DBUS_TEST_SERVICE_BUS_SESSION);
128+ dbus_test_task_set_name(DBUS_TEST_TASK(process), "libertine");
129+ dbus_test_task_set_return(DBUS_TEST_TASK(process), DBUS_TEST_TASK_RETURN_IGNORE);
130+ dbus_test_task_set_wait_finished(DBUS_TEST_TASK(process), FALSE);
131+
132+ wait = dbus_test_task_new();
133+ dbus_test_task_set_wait_for(wait, "com.canonical.libertine.Service");
134+ }
135+
136+ ~LibertineService()
137+ {
138+ g_debug("Destroying the Libertined Task");
139+ g_clear_object(&process);
140+ g_clear_object(&wait);
141+ }
142+
143+ DbusTestTask* waitTask()
144+ {
145+ return wait;
146+ }
147+
148+ operator std::shared_ptr<DbusTestTask>()
149+ {
150+ std::shared_ptr<DbusTestTask> retval(DBUS_TEST_TASK(g_object_ref(process)),
151+ [](DbusTestTask* process) { g_clear_object(&process); });
152+ return retval;
153+ }
154+
155+ operator DbusTestTask*()
156+ {
157+ return DBUS_TEST_TASK(process);
158+ }
159+};
160
161=== modified file 'tests/libual-cpp-test.cc'
162--- tests/libual-cpp-test.cc 2017-01-19 19:12:46 +0000
163+++ tests/libual-cpp-test.cc 2017-02-15 15:03:59 +0000
164@@ -36,6 +36,7 @@
165 #include "ubuntu-app-launch.h"
166
167 #include "eventually-fixture.h"
168+#include "libertine-service.h"
169 #include "mir-mock.h"
170 #include "spew-master.h"
171
172@@ -51,6 +52,7 @@
173 DbusTestService* service = NULL;
174 DbusTestDbusMock* mock = NULL;
175 DbusTestDbusMock* cgmock = NULL;
176+ std::shared_ptr<LibertineService> libertine;
177 GDBusConnection* bus = NULL;
178 guint resume_timeout = 0;
179 std::shared_ptr<ubuntu::app_launch::Registry> registry;
180@@ -308,6 +310,12 @@
181 /* Put it together */
182 dbus_test_service_add_task(service, DBUS_TEST_TASK(mock));
183 dbus_test_service_add_task(service, DBUS_TEST_TASK(cgmock));
184+
185+ /* Add in Libertine */
186+ libertine = std::make_shared<LibertineService>();
187+ dbus_test_service_add_task(service, *libertine);
188+ dbus_test_service_add_task(service, libertine->waitTask());
189+
190 dbus_test_service_start_tasks(service);
191
192 bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
193@@ -335,6 +343,7 @@
194 //
195 // ubuntu::app_launch::Registry::clearDefault();
196
197+ libertine.reset();
198 g_clear_object(&mock);
199 g_clear_object(&cgmock);
200 g_clear_object(&service);
201
202=== modified file 'tests/libual-test.cc'
203--- tests/libual-test.cc 2017-01-11 23:48:12 +0000
204+++ tests/libual-test.cc 2017-02-15 15:03:59 +0000
205@@ -30,6 +30,7 @@
206 #include "registry.h"
207 #include "ubuntu-app-launch.h"
208
209+#include "libertine-service.h"
210 #include "eventually-fixture.h"
211 #include "mir-mock.h"
212
213@@ -39,6 +40,7 @@
214 DbusTestService * service = NULL;
215 DbusTestDbusMock * mock = NULL;
216 DbusTestDbusMock * cgmock = NULL;
217+ std::shared_ptr<LibertineService> libertine;
218 GDBusConnection * bus = NULL;
219 std::string last_focus_appid;
220 std::string last_resume_appid;
221@@ -280,6 +282,12 @@
222 /* Put it together */
223 dbus_test_service_add_task(service, DBUS_TEST_TASK(mock));
224 dbus_test_service_add_task(service, DBUS_TEST_TASK(cgmock));
225+
226+ /* Add in Libertine */
227+ libertine = std::make_shared<LibertineService>();
228+ dbus_test_service_add_task(service, *libertine);
229+ dbus_test_service_add_task(service, libertine->waitTask());
230+
231 dbus_test_service_start_tasks(service);
232
233 bus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
234@@ -299,6 +307,7 @@
235
236 ubuntu::app_launch::Registry::clearDefault();
237
238+ libertine.reset();
239 g_clear_object(&mock);
240 g_clear_object(&cgmock);
241 g_clear_object(&service);
242
243=== modified file 'tests/list-apps.cpp'
244--- tests/list-apps.cpp 2017-01-31 23:45:21 +0000
245+++ tests/list-apps.cpp 2017-02-15 15:03:59 +0000
246@@ -23,6 +23,7 @@
247 #include <numeric>
248
249 #include "eventually-fixture.h"
250+#include "libertine-service.h"
251
252 #include "application-impl-click.h"
253 #include "application-impl-legacy.h"
254@@ -39,8 +40,9 @@
255 class ListApps : public EventuallyFixture
256 {
257 protected:
258- GTestDBus* testbus = nullptr;
259+ DbusTestService* service = nullptr;
260 GDBusConnection* bus = nullptr;
261+ std::shared_ptr<LibertineService> libertine;
262
263 virtual void SetUp()
264 {
265@@ -67,8 +69,13 @@
266 g_setenv("UBUNTU_APP_LAUNCH_DISABLE_SNAPD_TIMEOUT", "You betcha!", TRUE);
267 #endif
268
269- testbus = g_test_dbus_new(G_TEST_DBUS_NONE);
270- g_test_dbus_up(testbus);
271+ service = dbus_test_service_new(nullptr);
272+
273+ libertine = std::make_shared<LibertineService>();
274+ dbus_test_service_add_task(service, *libertine);
275+ dbus_test_service_add_task(service, libertine->waitTask());
276+
277+ dbus_test_service_start_tasks(service);
278
279 bus = g_bus_get_sync(G_BUS_TYPE_SESSION, nullptr, nullptr);
280 g_dbus_connection_set_exit_on_close(bus, FALSE);
281@@ -81,11 +88,10 @@
282 g_unlink(SNAPD_LIST_APPS_SOCKET);
283 #endif
284
285+ libertine.reset();
286+ g_clear_object(&service);
287+
288 g_object_unref(bus);
289-
290- g_test_dbus_down(testbus);
291- g_clear_object(&testbus);
292-
293 ASSERT_EVENTUALLY_EQ(nullptr, bus);
294 }
295

Subscribers

People subscribed via source and target branches