Merge lp:~charlesk/indicator-session/lp-1074065 into lp:indicator-session/13.04
- lp-1074065
- Merge into trunk.13.04
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Allan LeSage | ||||
Approved revision: | 377 | ||||
Merged at revision: | 376 | ||||
Proposed branch: | lp:~charlesk/indicator-session/lp-1074065 | ||||
Merge into: | lp:indicator-session/13.04 | ||||
Diff against target: |
1002 lines (+403/-472) 10 files modified
configure.ac (+7/-6) debian/changelog (+1/-5) debian/control (+0/-1) debian/rules (+0/-3) tests/Makefile.am (+33/-19) tests/gtest-dbus-helper.h (+0/-418) tests/indicator-session.service.in (+3/-0) tests/org.gnome.desktop.lockdown.gschema.xml (+45/-0) tests/org.gnome.settings-daemon.plugins.media-keys.gschema.xml (+203/-0) tests/test-service.cc (+111/-20) |
||||
To merge this branch: | bzr merge lp:~charlesk/indicator-session/lp-1074065 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Indicator Applet Developers | Pending | ||
Review via email: mp+133172@code.launchpad.net |
Commit message
Reimplement test-service s.t. we actually test activating the service via dbus. Drop unneeded Xorg baggage.
Description of the change
Reimplement test-service s.t. we actually test activating the service via dbus. Drop unneeded Xorg baggage.
This patch is based on the GTestDBus tests in indicator-sync. It adds into the tests/ directory a test version of the .service file, and tells GTestDBus about it via a call to g_test_
It also removes gtest-dbus-
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:371
http://
Executed test runs:
FAILURE: http://
Charles Kerr (charlesk) wrote : | # |
I'm not sure why this is failing. When I run the same code on a stock install in VirtualBox, service activation succeeds. Maybe there's some package needed for dbus activation that's not getting installed here?
Adding g_message() calls to confirm that the g_dbus_
Charles Kerr (charlesk) wrote : | # |
Looks like Jenkins won't kick off a CI build for a WIP. Switching to "Needs Review" to get its attention. Pardon the email noise :)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:372
http://
Executed test runs:
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:373
http://
Executed test runs:
FAILURE: http://
Charles Kerr (charlesk) wrote : | # |
Xref: bug #1078119
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:374
http://
Executed test runs:
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:375
http://
Executed test runs:
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:375
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:375
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Allan LeSage (allanlesage) wrote : | # |
> FAILED: Continuous integration, rev:375
> http://
> Executed test runs:
> FAILURE: http://
> ci/./build=
> FAILURE: http://
> ci/./build=
This last failed result was a mis-configuration error on my part.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:376
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
- 377. By Charles Kerr
-
re-enable the tests/ directory
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:377
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Preview Diff
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2012-11-14 20:20:13 +0000 | |||
3 | +++ configure.ac 2012-11-16 18:58:44 +0000 | |||
4 | @@ -25,6 +25,7 @@ | |||
5 | 25 | # Dependencies | 25 | # Dependencies |
6 | 26 | ########################### | 26 | ########################### |
7 | 27 | 27 | ||
8 | 28 | GIO_REQUIRED_VERSION=2.33 | ||
9 | 28 | GLIB_REQUIRED_VERSION=2.33 | 29 | GLIB_REQUIRED_VERSION=2.33 |
10 | 29 | GTK_REQUIRED_VERSION=3.0 | 30 | GTK_REQUIRED_VERSION=3.0 |
11 | 30 | INDICATOR_REQUIRED_VERSION=0.3.19 | 31 | INDICATOR_REQUIRED_VERSION=0.3.19 |
12 | @@ -135,16 +136,15 @@ | |||
13 | 135 | AC_MSG_ERROR([tests were requested but gtest is not installed.]) | 136 | AC_MSG_ERROR([tests were requested but gtest is not installed.]) |
14 | 136 | fi | 137 | fi |
15 | 137 | if test "x$enable_tests" = "xyes"; then | 138 | if test "x$enable_tests" = "xyes"; then |
21 | 138 | PKG_CHECK_MODULES([TEST_SERVICE],[indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION | 139 | PKG_CHECK_MODULES([TEST_SERVICE],[glib-2.0 >= $GLIB_REQUIRED_VERSION |
22 | 139 | dbustest-1 >= $DBUSTEST_REQUIRED_VERSION | 140 | gio-2.0 >= $GIO_REQUIRED_VERSION], |
23 | 140 | dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION], | 141 | [enable_tests="yes"], |
24 | 141 | [enable_tests="yes"], | 142 | [enable_tests="no"]) |
20 | 142 | [enable_tests="no"]) | ||
25 | 143 | fi | 143 | fi |
26 | 144 | fi | 144 | fi |
27 | 145 | AM_CONDITIONAL([BUILD_TESTS],[test "x$enable_tests" = "xyes"]) | 145 | AM_CONDITIONAL([BUILD_TESTS],[test "x$enable_tests" = "xyes"]) |
28 | 146 | AC_SUBST([TEST_SERVICE_CFLAGS]) | 146 | AC_SUBST([TEST_SERVICE_CFLAGS]) |
30 | 147 | AC_SUBST([TEST_SERVICE_LDFLAGS]) | 147 | AC_SUBST([TEST_SERVICE_LIBS]) |
31 | 148 | 148 | ||
32 | 149 | ############################## | 149 | ############################## |
33 | 150 | # Custom Junk | 150 | # Custom Junk |
34 | @@ -211,6 +211,7 @@ | |||
35 | 211 | data/icons/scalable/status/Makefile | 211 | data/icons/scalable/status/Makefile |
36 | 212 | data/extra-sessions/Makefile | 212 | data/extra-sessions/Makefile |
37 | 213 | tests/Makefile | 213 | tests/Makefile |
38 | 214 | tests/indicator-session.service | ||
39 | 214 | po/Makefile.in | 215 | po/Makefile.in |
40 | 215 | ]) | 216 | ]) |
41 | 216 | 217 | ||
42 | 217 | 218 | ||
43 | === modified file 'debian/changelog' | |||
44 | --- debian/changelog 2012-11-16 03:42:55 +0000 | |||
45 | +++ debian/changelog 2012-11-16 18:58:44 +0000 | |||
46 | @@ -4,14 +4,10 @@ | |||
47 | 4 | - Add DPKG_GENSYMBOLS_CHECK_LEVEL=4. | 4 | - Add DPKG_GENSYMBOLS_CHECK_LEVEL=4. |
48 | 5 | - Use the dh sequencer with autoreconf. | 5 | - Use the dh sequencer with autoreconf. |
49 | 6 | - Override dh_autoreconf to run autogen.sh. | 6 | - Override dh_autoreconf to run autogen.sh. |
50 | 7 | - Temporarily disable running tests due to an issue with getting the | ||
51 | 8 | gsettings schema for testing. | ||
52 | 9 | * debian/control: | 7 | * debian/control: |
53 | 10 | - Add dh-autoreconf to Build-Depends. | 8 | - Add dh-autoreconf to Build-Depends. |
54 | 11 | - Add gnome-common to Build-Depends. | 9 | - Add gnome-common to Build-Depends. |
58 | 12 | - Add libdbustest1-dev, dbus-test-runner to Build-Depends. | 10 | - Add libgtest-dev, libdbustest1-dev, dbus-test-runner to Build-Depends. |
56 | 13 | - Explicitly list libgtest-dev in Build-Depends, even though it does get | ||
57 | 14 | pulled in via libxorg-gtest-dev. | ||
59 | 15 | - Adjust style to be consistent and use trailing commas in lists. | 11 | - Adjust style to be consistent and use trailing commas in lists. |
60 | 16 | - Update Vcs-Bzr and Vcs-Browser fields and add notice for uploaders. | 12 | - Update Vcs-Bzr and Vcs-Browser fields and add notice for uploaders. |
61 | 17 | * Automatic snapshot from revision 373 (bootstrap): | 13 | * Automatic snapshot from revision 373 (bootstrap): |
62 | 18 | 14 | ||
63 | === modified file 'debian/control' | |||
64 | --- debian/control 2012-11-15 17:13:28 +0000 | |||
65 | +++ debian/control 2012-11-16 18:58:44 +0000 | |||
66 | @@ -7,7 +7,6 @@ | |||
67 | 7 | dh-translations, | 7 | dh-translations, |
68 | 8 | intltool, | 8 | intltool, |
69 | 9 | gnome-common, | 9 | gnome-common, |
70 | 10 | libxorg-gtest-dev, | ||
71 | 11 | libgtest-dev, | 10 | libgtest-dev, |
72 | 12 | libdbustest1-dev, | 11 | libdbustest1-dev, |
73 | 13 | dbus-test-runner, | 12 | dbus-test-runner, |
74 | 14 | 13 | ||
75 | === modified file 'debian/rules' | |||
76 | --- debian/rules 2012-11-15 17:08:26 +0000 | |||
77 | +++ debian/rules 2012-11-16 18:58:44 +0000 | |||
78 | @@ -5,9 +5,6 @@ | |||
79 | 5 | %: | 5 | %: |
80 | 6 | dh $@ --with translations,autoreconf | 6 | dh $@ --with translations,autoreconf |
81 | 7 | 7 | ||
82 | 8 | override_dh_auto_test: | ||
83 | 9 | # TESTS TEMPORARILY DISABLED: need fixing for gsettings schema. | ||
84 | 10 | |||
85 | 11 | override_dh_autoreconf: | 8 | override_dh_autoreconf: |
86 | 12 | NOCONFIGURE=1 dh_autoreconf ./autogen.sh | 9 | NOCONFIGURE=1 dh_autoreconf ./autogen.sh |
87 | 13 | 10 | ||
88 | 14 | 11 | ||
89 | === modified file 'tests/Makefile.am' | |||
90 | --- tests/Makefile.am 2012-08-31 16:59:27 +0000 | |||
91 | +++ tests/Makefile.am 2012-11-16 18:58:44 +0000 | |||
92 | @@ -1,31 +1,45 @@ | |||
93 | 1 | TESTS = | 1 | TESTS = |
94 | 2 | CLEANFILES = | 2 | CLEANFILES = |
95 | 3 | BUILT_SOURCES = | ||
96 | 4 | check_PROGRAMS = | ||
97 | 5 | |||
98 | 6 | ### | ||
99 | 7 | ### | ||
100 | 8 | ### | ||
101 | 3 | 9 | ||
102 | 4 | # stock UMB tests on user-visible strings | 10 | # stock UMB tests on user-visible strings |
103 | 5 | include $(srcdir)/Makefile.am.strings | 11 | include $(srcdir)/Makefile.am.strings |
104 | 6 | 12 | ||
111 | 7 | AM_CPPFLAGS = \ | 13 | check_LIBRARIES = libgtest.a |
112 | 8 | $(GTEST_CPPFLAGS) \ | 14 | nodist_libgtest_a_SOURCES = \ |
113 | 9 | $(XORG_GTEST_CPPFLAGS) \ | 15 | $(GTEST_SOURCE)/src/gtest-all.cc \ |
114 | 10 | $(INDICATOR_CFLAGS) \ | 16 | $(GTEST_SOURCE)/src/gtest_main.cc |
115 | 11 | -I${top_srcdir}/src \ | 17 | |
116 | 12 | -Wall -Werror | 18 | AM_CPPFLAGS = $(GTEST_CPPFLAGS) -I${top_srcdir}/src -Wall -Werror |
117 | 13 | AM_CXXFLAGS = $(GTEST_CXXFLAGS) | 19 | AM_CXXFLAGS = $(GTEST_CXXFLAGS) |
118 | 14 | 20 | ||
125 | 15 | TESTS = test-service | 21 | ### |
126 | 16 | check_PROGRAMS = test-service | 22 | ### |
127 | 17 | test_service_SOURCES = \ | 23 | ### |
128 | 18 | test-service.cc \ | 24 | |
129 | 19 | gtest-dbus-helper.h | 25 | BUILT_SOURCES += gschemas.compiled |
130 | 20 | test_service_LDADD = $(TEST_SERVICE_LIBS) libgtest.a $(XORG_GTEST_MAIN_LIBS) $(X11_LIBS) | 26 | CLEANFILES += gschemas.compiled |
131 | 27 | gschemas.compiled: Makefile | ||
132 | 28 | $(AM_V_at) cp -f $(top_builddir)/data/*gschema.xml . | ||
133 | 29 | $(AM_V_GEN) $(GLIB_COMPILE_SCHEMAS) --targetdir=. . | ||
134 | 30 | |||
135 | 31 | |||
136 | 32 | TESTS += test-service | ||
137 | 33 | check_PROGRAMS += test-service | ||
138 | 34 | test_service_SOURCES = test-service.cc | ||
139 | 35 | test_service_LDADD = \ | ||
140 | 36 | $(TEST_SERVICE_LIBS) \ | ||
141 | 37 | libgtest.a | ||
142 | 21 | test_service_CPPFLAGS = \ | 38 | test_service_CPPFLAGS = \ |
143 | 39 | -DSCHEMA_DIR="\"$(top_builddir)/tests/\"" \ | ||
144 | 40 | -DINDICATOR_SERVICE_DIR="\"$(abs_builddir)\"" \ | ||
145 | 41 | -DINDICATOR_SERVICE_PATH="\"$(top_builddir)/src/indicator-session-service\"" \ | ||
146 | 22 | $(TEST_SERVICE_CFLAGS) \ | 42 | $(TEST_SERVICE_CFLAGS) \ |
149 | 23 | $(AM_CPPFLAGS) \ | 43 | $(AM_CPPFLAGS) |
148 | 24 | -DINDICATOR_SERVICE_PATH="\"$(top_builddir)/src/indicator-session-service\"" | ||
150 | 25 | 44 | ||
151 | 26 | check_LIBRARIES = libgtest.a | ||
152 | 27 | nodist_libgtest_a_SOURCES = \ | ||
153 | 28 | $(XORG_GTEST_SOURCE)/src/xorg-gtest-all.cpp \ | ||
154 | 29 | $(GTEST_SOURCE)/src/gtest-all.cc \ | ||
155 | 30 | $(XORG_GTEST_SOURCE)/src/xorg-gtest_main.cpp | ||
156 | 31 | 45 | ||
157 | 32 | 46 | ||
158 | === removed file 'tests/gtest-dbus-helper.h' | |||
159 | --- tests/gtest-dbus-helper.h 2012-08-23 18:00:30 +0000 | |||
160 | +++ tests/gtest-dbus-helper.h 1970-01-01 00:00:00 +0000 | |||
161 | @@ -1,418 +0,0 @@ | |||
162 | 1 | /* | ||
163 | 2 | Copyright 2012 Canonical Ltd. | ||
164 | 3 | |||
165 | 4 | Authors: | ||
166 | 5 | Charles Kerr <charles.kerr@canonical.com> | ||
167 | 6 | |||
168 | 7 | This program is free software: you can redistribute it and/or modify it | ||
169 | 8 | under the terms of the GNU General Public License version 3, as published | ||
170 | 9 | by the Free Software Foundation. | ||
171 | 10 | |||
172 | 11 | This program is distributed in the hope that it will be useful, but | ||
173 | 12 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
174 | 13 | MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
175 | 14 | PURPOSE. See the GNU General Public License for more details. | ||
176 | 15 | |||
177 | 16 | You should have received a copy of the GNU General Public License along | ||
178 | 17 | with this program. If not, see <http://www.gnu.org/licenses/>. | ||
179 | 18 | */ | ||
180 | 19 | |||
181 | 20 | #ifndef INDICATOR_SERVICE_TEST_H | ||
182 | 21 | #define INDICATOR_SERVICE_TEST_H | ||
183 | 22 | |||
184 | 23 | #include <algorithm> | ||
185 | 24 | #include <functional> | ||
186 | 25 | #include <string> | ||
187 | 26 | #include <vector> | ||
188 | 27 | |||
189 | 28 | #include <gio/gio.h> | ||
190 | 29 | #include <gtest/gtest.h> | ||
191 | 30 | #include <libdbustest/dbus-test.h> | ||
192 | 31 | #include <libdbusmenu-glib/client.h> | ||
193 | 32 | |||
194 | 33 | /*** | ||
195 | 34 | **** | ||
196 | 35 | ***/ | ||
197 | 36 | |||
198 | 37 | /** | ||
199 | 38 | * Convenience class for looking at a DbusmenuClient's items for testing | ||
200 | 39 | * | ||
201 | 40 | * Examples: | ||
202 | 41 | * | ||
203 | 42 | * // confirm that there are N menuitems of type T | ||
204 | 43 | * TEST_EQ (helper.count_type(T), N); | ||
205 | 44 | * | ||
206 | 45 | * // confirm that there are N visible menuitems | ||
207 | 46 | * TEST_EQ (helper.count_property_bool(DBUSMENU_MENUITEM_PROP_VISIBLE,true), N); | ||
208 | 47 | * | ||
209 | 48 | * // get a sorted list of all the menuitems of type T | ||
210 | 49 | * std::vector<DbusmenuMenuitem*> items = helper.find_type(T); | ||
211 | 50 | */ | ||
212 | 51 | class DbusmenuClientHelper | ||
213 | 52 | { | ||
214 | 53 | public: | ||
215 | 54 | |||
216 | 55 | DbusmenuClientHelper (DbusmenuClient * client_): client(client_) { | ||
217 | 56 | g_object_ref (G_OBJECT(client)); | ||
218 | 57 | } | ||
219 | 58 | ~DbusmenuClientHelper() { | ||
220 | 59 | g_object_unref(G_OBJECT(client)); | ||
221 | 60 | client = NULL; | ||
222 | 61 | } | ||
223 | 62 | |||
224 | 63 | private: | ||
225 | 64 | |||
226 | 65 | static void foreach_accumulate_func (DbusmenuMenuitem * mi, gpointer gset) { | ||
227 | 66 | static_cast<std::vector<DbusmenuMenuitem*>*>(gset)->push_back (mi); | ||
228 | 67 | } | ||
229 | 68 | |||
230 | 69 | public: | ||
231 | 70 | |||
232 | 71 | std::vector<DbusmenuMenuitem*> | ||
233 | 72 | get_all_menuitems () const | ||
234 | 73 | { | ||
235 | 74 | std::vector<DbusmenuMenuitem*> items; | ||
236 | 75 | |||
237 | 76 | DbusmenuMenuitem * root = dbusmenu_client_get_root (client); | ||
238 | 77 | if (root != NULL) | ||
239 | 78 | dbusmenu_menuitem_foreach (root, foreach_accumulate_func, &items); | ||
240 | 79 | |||
241 | 80 | return items; | ||
242 | 81 | } | ||
243 | 82 | |||
244 | 83 | private: | ||
245 | 84 | |||
246 | 85 | template<typename value_type> class PropertyPredicate: | ||
247 | 86 | public std::unary_function<DbusmenuMenuitem*,bool> { | ||
248 | 87 | protected: | ||
249 | 88 | const std::string _key; | ||
250 | 89 | const value_type _value; | ||
251 | 90 | virtual value_type get_value(DbusmenuMenuitem * mi) const = 0; | ||
252 | 91 | public: | ||
253 | 92 | PropertyPredicate (const char * propertyName, value_type propertyValue): | ||
254 | 93 | _key(propertyName), _value(propertyValue) { } | ||
255 | 94 | bool operator()(const DbusmenuMenuitem* cmi) const { | ||
256 | 95 | // FIXME: remove const_cast after the dbusmenu_menuitem_propperty_get*() functions are constified | ||
257 | 96 | DbusmenuMenuitem * mi = const_cast<DbusmenuMenuitem*>(cmi); | ||
258 | 97 | return dbusmenu_menuitem_property_exist (mi, _key.c_str()) && (_value == get_value(mi)); | ||
259 | 98 | } | ||
260 | 99 | }; | ||
261 | 100 | |||
262 | 101 | class StringPropertyPredicate: public PropertyPredicate<std::string> { | ||
263 | 102 | protected: | ||
264 | 103 | virtual std::string get_value (DbusmenuMenuitem * mi) const { | ||
265 | 104 | return dbusmenu_menuitem_property_get(mi, _key.c_str()); | ||
266 | 105 | } | ||
267 | 106 | public: | ||
268 | 107 | StringPropertyPredicate (const char * propName, const char * propValue): | ||
269 | 108 | PropertyPredicate (propName, propValue) {} | ||
270 | 109 | }; | ||
271 | 110 | |||
272 | 111 | class IntPropertyPredicate: public PropertyPredicate<int> { | ||
273 | 112 | protected: | ||
274 | 113 | virtual int get_value (DbusmenuMenuitem * mi) const { | ||
275 | 114 | return dbusmenu_menuitem_property_get_int(mi, _key.c_str()); | ||
276 | 115 | } | ||
277 | 116 | public: | ||
278 | 117 | IntPropertyPredicate (const char * propName, int propValue): | ||
279 | 118 | PropertyPredicate (propName, propValue) {} | ||
280 | 119 | }; | ||
281 | 120 | |||
282 | 121 | class BoolPropertyPredicate: public PropertyPredicate<bool> { | ||
283 | 122 | protected: | ||
284 | 123 | virtual bool get_value (DbusmenuMenuitem * mi) const { | ||
285 | 124 | return dbusmenu_menuitem_property_get_bool(mi, _key.c_str()); | ||
286 | 125 | } | ||
287 | 126 | public: | ||
288 | 127 | BoolPropertyPredicate (const char * propName, bool propValue): | ||
289 | 128 | PropertyPredicate (propName, propValue) {} | ||
290 | 129 | }; | ||
291 | 130 | |||
292 | 131 | public: | ||
293 | 132 | |||
294 | 133 | typedef std::vector<DbusmenuMenuitem*> menuitems_t; | ||
295 | 134 | |||
296 | 135 | void | ||
297 | 136 | match_property (menuitems_t& items, const char * key, const char * value) const | ||
298 | 137 | { | ||
299 | 138 | const StringPropertyPredicate pred (key, value); | ||
300 | 139 | items.erase (std::remove_if (items.begin(), items.end(), std::not1(pred)), items.end()); | ||
301 | 140 | } | ||
302 | 141 | |||
303 | 142 | void | ||
304 | 143 | match_property_int (menuitems_t& items, const char * key, int value) const | ||
305 | 144 | { | ||
306 | 145 | const IntPropertyPredicate pred (key, value); | ||
307 | 146 | items.erase (std::remove_if (items.begin(), items.end(), std::not1(pred)), items.end()); | ||
308 | 147 | } | ||
309 | 148 | |||
310 | 149 | void | ||
311 | 150 | match_property_bool (menuitems_t& items, const char * key, bool value) const | ||
312 | 151 | { | ||
313 | 152 | const BoolPropertyPredicate pred (key, value); | ||
314 | 153 | items.erase (std::remove_if (items.begin(), items.end(), std::not1(pred)), items.end()); | ||
315 | 154 | } | ||
316 | 155 | |||
317 | 156 | menuitems_t find_property (const char * prop_name, const char * prop_value) const | ||
318 | 157 | { | ||
319 | 158 | menuitems_t items; | ||
320 | 159 | g_return_val_if_fail (prop_name!=NULL, items); | ||
321 | 160 | g_return_val_if_fail (prop_value!=NULL, items); | ||
322 | 161 | |||
323 | 162 | items = get_all_menuitems (); | ||
324 | 163 | match_property (items, prop_name, prop_value); | ||
325 | 164 | return items; | ||
326 | 165 | } | ||
327 | 166 | |||
328 | 167 | menuitems_t find_property_int (const char * prop_name, int prop_value) const | ||
329 | 168 | { | ||
330 | 169 | std::vector<DbusmenuMenuitem*> items; | ||
331 | 170 | g_return_val_if_fail (prop_name!=NULL, items); | ||
332 | 171 | |||
333 | 172 | items = get_all_menuitems (); | ||
334 | 173 | match_property_int (items, prop_name, prop_value); | ||
335 | 174 | return items; | ||
336 | 175 | } | ||
337 | 176 | |||
338 | 177 | menuitems_t find_property_bool (const char * prop_name, bool prop_value) const | ||
339 | 178 | { | ||
340 | 179 | std::vector<DbusmenuMenuitem*> items; | ||
341 | 180 | g_return_val_if_fail (prop_name!=NULL, items); | ||
342 | 181 | |||
343 | 182 | items = get_all_menuitems (); | ||
344 | 183 | match_property_bool (items, prop_name, prop_value); | ||
345 | 184 | return items; | ||
346 | 185 | } | ||
347 | 186 | |||
348 | 187 | menuitems_t find_type (const char * type) const | ||
349 | 188 | { | ||
350 | 189 | return find_property (DBUSMENU_MENUITEM_PROP_TYPE, type); | ||
351 | 190 | } | ||
352 | 191 | |||
353 | 192 | int count_property (const char * propName, const char * propValue) const | ||
354 | 193 | { | ||
355 | 194 | return find_property (propName, propValue).size(); | ||
356 | 195 | } | ||
357 | 196 | |||
358 | 197 | int count_type (const char * type) const | ||
359 | 198 | { | ||
360 | 199 | return count_property (DBUSMENU_MENUITEM_PROP_TYPE, type); | ||
361 | 200 | } | ||
362 | 201 | |||
363 | 202 | int count_property_int (const char * propName, int propValue) const | ||
364 | 203 | { | ||
365 | 204 | return find_property_int (propName, propValue).size(); | ||
366 | 205 | } | ||
367 | 206 | |||
368 | 207 | int count_property_bool (const char * propName, bool propValue) const | ||
369 | 208 | { | ||
370 | 209 | return find_property_bool (propName, propValue).size(); | ||
371 | 210 | } | ||
372 | 211 | |||
373 | 212 | private: | ||
374 | 213 | |||
375 | 214 | DbusmenuClient * client; | ||
376 | 215 | }; | ||
377 | 216 | |||
378 | 217 | /** | ||
379 | 218 | * Fixture class for using Google Test on an indicator-service's | ||
380 | 219 | * com.canonical.dbusmenu interface. | ||
381 | 220 | * | ||
382 | 221 | * The SetUp() function starts the service up, waits for it to | ||
383 | 222 | * be visible on the bus, then creates a DbusmenuClient and waits | ||
384 | 223 | * for its layout-changed signal. This way the test function | ||
385 | 224 | * is reached after the menu is available and populated. | ||
386 | 225 | * | ||
387 | 226 | * TearDown() cleans up the DBus scaffolding and stops the service. | ||
388 | 227 | */ | ||
389 | 228 | class IndicatorServiceTest : public ::testing::Test | ||
390 | 229 | { | ||
391 | 230 | public: | ||
392 | 231 | |||
393 | 232 | IndicatorServiceTest(const char * service_name_, | ||
394 | 233 | const char * menu_object_path_, | ||
395 | 234 | const char * executable_): | ||
396 | 235 | menu_client(0), | ||
397 | 236 | menu_helper(0), | ||
398 | 237 | test_service(0), | ||
399 | 238 | indicator_service_proxy(0), | ||
400 | 239 | handler_id(0), | ||
401 | 240 | executable(executable_), | ||
402 | 241 | service_name(service_name_), | ||
403 | 242 | menu_object_path(menu_object_path_) | ||
404 | 243 | { | ||
405 | 244 | // glib one-time init stuff | ||
406 | 245 | g_type_init(); | ||
407 | 246 | g_assert (g_thread_supported()); | ||
408 | 247 | mainloop = g_main_loop_new (NULL, FALSE); | ||
409 | 248 | } | ||
410 | 249 | |||
411 | 250 | private: | ||
412 | 251 | |||
413 | 252 | static void | ||
414 | 253 | on_layout_updated_static (DbusmenuClient * client, IndicatorServiceTest * self) | ||
415 | 254 | { | ||
416 | 255 | g_debug ("LAYOUT UPDATED"); | ||
417 | 256 | self->on_layout_updated (client); | ||
418 | 257 | } | ||
419 | 258 | void | ||
420 | 259 | on_layout_updated (DbusmenuClient * client) | ||
421 | 260 | { | ||
422 | 261 | ASSERT_EQ (client, menu_client); | ||
423 | 262 | ASSERT_NE (handler_id, 0); | ||
424 | 263 | ASSERT_TRUE (g_signal_handler_is_connected (client, handler_id)); | ||
425 | 264 | |||
426 | 265 | // stop listening for this event | ||
427 | 266 | g_signal_handler_disconnect (client, handler_id); | ||
428 | 267 | handler_id = 0; | ||
429 | 268 | |||
430 | 269 | ready(); | ||
431 | 270 | } | ||
432 | 271 | |||
433 | 272 | private: | ||
434 | 273 | |||
435 | 274 | static gboolean | ||
436 | 275 | on_timeout_static (gpointer self) | ||
437 | 276 | { | ||
438 | 277 | static_cast<IndicatorServiceTest*>(self)->on_timeout(); | ||
439 | 278 | return false; | ||
440 | 279 | } | ||
441 | 280 | void | ||
442 | 281 | on_timeout() | ||
443 | 282 | { | ||
444 | 283 | ASSERT_NE (handler_id, 0ul); | ||
445 | 284 | g_source_remove (handler_id); | ||
446 | 285 | handler_id = 0; | ||
447 | 286 | ready(); | ||
448 | 287 | } | ||
449 | 288 | |||
450 | 289 | protected: | ||
451 | 290 | |||
452 | 291 | virtual void | ||
453 | 292 | SetUp() | ||
454 | 293 | { | ||
455 | 294 | ASSERT_EQ (NULL, test_service); | ||
456 | 295 | ASSERT_EQ (NULL, menu_helper); | ||
457 | 296 | ASSERT_EQ (NULL, indicator_service_proxy); | ||
458 | 297 | |||
459 | 298 | test_service = dbus_test_service_new (NULL); | ||
460 | 299 | |||
461 | 300 | // Start the executable and wait until it shows up on the bus. | ||
462 | 301 | // Unset the NO_WATCHERS env var to ensure that the service | ||
463 | 302 | // will shut down when there are no watchers... otherwise | ||
464 | 303 | // this task will never finish | ||
465 | 304 | g_unsetenv("INDICATOR_ALLOW_NO_WATCHERS"); | ||
466 | 305 | DbusTestProcess * indicator_service_task = dbus_test_process_new (executable.c_str()); | ||
467 | 306 | dbus_test_service_add_task (test_service, DBUS_TEST_TASK(indicator_service_task)); | ||
468 | 307 | g_object_unref (G_OBJECT(indicator_service_task)); | ||
469 | 308 | |||
470 | 309 | // create a menu task that waits for our service before it runs | ||
471 | 310 | DbusTestTask * wait_task = dbus_test_task_new (); | ||
472 | 311 | dbus_test_task_set_wait_for (wait_task, service_name.c_str()); | ||
473 | 312 | dbus_test_service_add_task (test_service, wait_task); | ||
474 | 313 | g_object_unref (G_OBJECT(wait_task)); | ||
475 | 314 | |||
476 | 315 | g_debug ("starting tasks"); | ||
477 | 316 | dbus_test_service_start_tasks(test_service); | ||
478 | 317 | |||
479 | 318 | // at this point the indicator service is running, let's Watch it | ||
480 | 319 | // to ensure it stays alive for the duration of the test | ||
481 | 320 | GError * error = NULL; | ||
482 | 321 | GDBusConnection * bus_connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); | ||
483 | 322 | indicator_service_proxy = g_dbus_proxy_new_sync (bus_connection, | ||
484 | 323 | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, | ||
485 | 324 | NULL, | ||
486 | 325 | service_name.c_str(), | ||
487 | 326 | "/org/ayatana/indicator/service", | ||
488 | 327 | "org.ayatana.indicator.service", | ||
489 | 328 | NULL, | ||
490 | 329 | &error); | ||
491 | 330 | GVariant * result = g_dbus_proxy_call_sync (indicator_service_proxy, "Watch", | ||
492 | 331 | NULL, G_DBUS_CALL_FLAGS_NO_AUTO_START, | ||
493 | 332 | -1, NULL, &error); | ||
494 | 333 | guint a, b; | ||
495 | 334 | g_variant_get (result, "(uu)", &a, &b); | ||
496 | 335 | g_debug ("Sending 'Watch' to proxy %p yielded %u %u", indicator_service_proxy, a, b); | ||
497 | 336 | g_variant_unref (result); | ||
498 | 337 | EXPECT_EQ(NULL, error); | ||
499 | 338 | if (error != NULL) { | ||
500 | 339 | g_message ("%s Unable to Watch indicator-service : %s", G_STRFUNC, error->message); | ||
501 | 340 | g_clear_error (&error); | ||
502 | 341 | } | ||
503 | 342 | g_object_unref (G_OBJECT(bus_connection)); | ||
504 | 343 | |||
505 | 344 | menu_client = dbusmenu_client_new (service_name.c_str(), menu_object_path.c_str()); | ||
506 | 345 | menu_helper = new DbusmenuClientHelper (menu_client); | ||
507 | 346 | |||
508 | 347 | // wait for a "layout-updated" signal before we let SetUp finish | ||
509 | 348 | wait_for_layout_update(); | ||
510 | 349 | } | ||
511 | 350 | |||
512 | 351 | virtual void | ||
513 | 352 | TearDown() | ||
514 | 353 | { | ||
515 | 354 | ASSERT_EQ (handler_id, 0); | ||
516 | 355 | |||
517 | 356 | // tear down the mainloop | ||
518 | 357 | ASSERT_TRUE (mainloop != NULL); | ||
519 | 358 | g_main_loop_unref (mainloop); | ||
520 | 359 | mainloop = NULL; | ||
521 | 360 | |||
522 | 361 | // tear down the menu client | ||
523 | 362 | if (menu_helper != NULL) { | ||
524 | 363 | delete menu_helper; | ||
525 | 364 | menu_helper = NULL; | ||
526 | 365 | } | ||
527 | 366 | if (menu_client != NULL) { | ||
528 | 367 | g_object_unref(G_OBJECT(menu_client)); | ||
529 | 368 | menu_client = NULL; | ||
530 | 369 | } | ||
531 | 370 | |||
532 | 371 | // tear down the indicator proxy | ||
533 | 372 | EXPECT_TRUE (G_IS_DBUS_PROXY(indicator_service_proxy)); | ||
534 | 373 | g_object_unref (G_OBJECT(indicator_service_proxy)); | ||
535 | 374 | indicator_service_proxy = NULL; | ||
536 | 375 | } | ||
537 | 376 | |||
538 | 377 | void wait_for_layout_update() | ||
539 | 378 | { | ||
540 | 379 | ASSERT_EQ (handler_id, 0ul); | ||
541 | 380 | handler_id = g_signal_connect (menu_client, | ||
542 | 381 | DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED, | ||
543 | 382 | G_CALLBACK(on_layout_updated_static), | ||
544 | 383 | this); | ||
545 | 384 | g_debug ("waiting for layout update..."); | ||
546 | 385 | g_main_loop_run (mainloop); | ||
547 | 386 | } | ||
548 | 387 | |||
549 | 388 | void wait_seconds (int seconds) | ||
550 | 389 | { | ||
551 | 390 | ASSERT_EQ (handler_id, 0ul); | ||
552 | 391 | handler_id = g_timeout_add_seconds (seconds, on_timeout_static, this); | ||
553 | 392 | g_debug ("waiting %d seconds...", seconds); | ||
554 | 393 | g_main_loop_run (mainloop); | ||
555 | 394 | } | ||
556 | 395 | |||
557 | 396 | protected: | ||
558 | 397 | |||
559 | 398 | DbusmenuClient * menu_client; | ||
560 | 399 | DbusmenuClientHelper * menu_helper; | ||
561 | 400 | |||
562 | 401 | private: | ||
563 | 402 | |||
564 | 403 | void ready() | ||
565 | 404 | { | ||
566 | 405 | g_debug("done waiting"); | ||
567 | 406 | g_main_loop_quit (mainloop); | ||
568 | 407 | } | ||
569 | 408 | |||
570 | 409 | GMainLoop * mainloop; | ||
571 | 410 | DbusTestService * test_service; | ||
572 | 411 | GDBusProxy * indicator_service_proxy; | ||
573 | 412 | gulong handler_id; | ||
574 | 413 | const std::string executable; | ||
575 | 414 | const std::string service_name; | ||
576 | 415 | const std::string menu_object_path; | ||
577 | 416 | }; | ||
578 | 417 | |||
579 | 418 | #endif // #ifndef INDICATOR_SERVICE_TEST_H | ||
580 | 419 | 0 | ||
581 | === added file 'tests/indicator-session.service.in' | |||
582 | --- tests/indicator-session.service.in 1970-01-01 00:00:00 +0000 | |||
583 | +++ tests/indicator-session.service.in 2012-11-16 18:58:44 +0000 | |||
584 | @@ -0,0 +1,3 @@ | |||
585 | 1 | [D-BUS Service] | ||
586 | 2 | Name=com.canonical.indicator.session | ||
587 | 3 | Exec=@abs_top_builddir@/src/indicator-session-service | ||
588 | 0 | 4 | ||
589 | === added file 'tests/org.gnome.desktop.lockdown.gschema.xml' | |||
590 | --- tests/org.gnome.desktop.lockdown.gschema.xml 1970-01-01 00:00:00 +0000 | |||
591 | +++ tests/org.gnome.desktop.lockdown.gschema.xml 2012-11-16 18:58:44 +0000 | |||
592 | @@ -0,0 +1,45 @@ | |||
593 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
594 | 2 | <schemalist gettext-domain="gsettings-desktop-schemas"> | ||
595 | 3 | <schema path="/org/gnome/desktop/lockdown/" id="org.gnome.desktop.lockdown"> | ||
596 | 4 | <key type="b" name="disable-command-line"> | ||
597 | 5 | <default>false</default> | ||
598 | 6 | <summary>Disable command line</summary> | ||
599 | 7 | <description>Prevent the user from accessing the terminal or specifying a command line to be executed. For example, this would disable access to the panel's "Run Application" dialog.</description> | ||
600 | 8 | </key> | ||
601 | 9 | <key type="b" name="disable-save-to-disk"> | ||
602 | 10 | <default>false</default> | ||
603 | 11 | <summary>Disable saving files to disk</summary> | ||
604 | 12 | <description>Prevent the user from saving files to disk. For example, this would disable access to all applications' "Save as" dialogs.</description> | ||
605 | 13 | </key> | ||
606 | 14 | <key type="b" name="disable-printing"> | ||
607 | 15 | <default>false</default> | ||
608 | 16 | <summary>Disable printing</summary> | ||
609 | 17 | <description>Prevent the user from printing. For example, this would disable access to all applications' "Print" dialogs.</description> | ||
610 | 18 | </key> | ||
611 | 19 | <key type="b" name="disable-print-setup"> | ||
612 | 20 | <default>false</default> | ||
613 | 21 | <summary>Disable print setup</summary> | ||
614 | 22 | <description>Prevent the user from modifying print settings. For example, this would disable access to all applications' "Print Setup" dialogs.</description> | ||
615 | 23 | </key> | ||
616 | 24 | <key type="b" name="disable-user-switching"> | ||
617 | 25 | <default>false</default> | ||
618 | 26 | <summary>Disable user switching</summary> | ||
619 | 27 | <description>Prevent the user from switching to another account while his session is active.</description> | ||
620 | 28 | </key> | ||
621 | 29 | <key type="b" name="disable-lock-screen"> | ||
622 | 30 | <default>false</default> | ||
623 | 31 | <summary>Disable lock screen</summary> | ||
624 | 32 | <description>Prevent the user to lock his screen.</description> | ||
625 | 33 | </key> | ||
626 | 34 | <key type="b" name="disable-application-handlers"> | ||
627 | 35 | <default>false</default> | ||
628 | 36 | <summary>Disable URL and MIME type handlers</summary> | ||
629 | 37 | <description>Prevent running any URL or MIME type handler applications.</description> | ||
630 | 38 | </key> | ||
631 | 39 | <key type="b" name="disable-log-out"> | ||
632 | 40 | <default>false</default> | ||
633 | 41 | <summary>Disable log out</summary> | ||
634 | 42 | <description>Prevent the user from logging out.</description> | ||
635 | 43 | </key> | ||
636 | 44 | </schema> | ||
637 | 45 | </schemalist> | ||
638 | 0 | \ No newline at end of file | 46 | \ No newline at end of file |
639 | 1 | 47 | ||
640 | === added file 'tests/org.gnome.settings-daemon.plugins.media-keys.gschema.xml' | |||
641 | --- tests/org.gnome.settings-daemon.plugins.media-keys.gschema.xml 1970-01-01 00:00:00 +0000 | |||
642 | +++ tests/org.gnome.settings-daemon.plugins.media-keys.gschema.xml 2012-11-16 18:58:44 +0000 | |||
643 | @@ -0,0 +1,203 @@ | |||
644 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
645 | 2 | <schemalist> | ||
646 | 3 | <schema path="/org/gnome/settings-daemon/plugins/media-keys/" id="org.gnome.settings-daemon.plugins.media-keys" gettext-domain="gnome-settings-daemon"> | ||
647 | 4 | <key type="b" name="active"> | ||
648 | 5 | <default>true</default> | ||
649 | 6 | <summary>Activation of this plugin</summary> | ||
650 | 7 | <description>Whether this plugin would be activated by gnome-settings-daemon or not</description> | ||
651 | 8 | </key> | ||
652 | 9 | <key type="as" name="custom-keybindings"> | ||
653 | 10 | <default>[]</default> | ||
654 | 11 | <summary>Custom keybindings</summary> | ||
655 | 12 | <description>List of custom keybindings</description> | ||
656 | 13 | </key> | ||
657 | 14 | <key type="s" name="calculator"> | ||
658 | 15 | <default>'XF86Calculator'</default> | ||
659 | 16 | <summary>Launch calculator</summary> | ||
660 | 17 | <description>Binding to launch the calculator.</description> | ||
661 | 18 | </key> | ||
662 | 19 | <key type="s" name="email"> | ||
663 | 20 | <default>'XF86Mail'</default> | ||
664 | 21 | <summary>Launch email client</summary> | ||
665 | 22 | <description>Binding to launch the email client.</description> | ||
666 | 23 | </key> | ||
667 | 24 | <key type="s" name="eject"> | ||
668 | 25 | <default>'XF86Eject'</default> | ||
669 | 26 | <summary>Eject</summary> | ||
670 | 27 | <description>Binding to eject an optical disc.</description> | ||
671 | 28 | </key> | ||
672 | 29 | <key type="s" name="help"> | ||
673 | 30 | <default>''</default> | ||
674 | 31 | <summary>Launch help browser</summary> | ||
675 | 32 | <description>Binding to launch the help browser.</description> | ||
676 | 33 | </key> | ||
677 | 34 | <key type="s" name="home"> | ||
678 | 35 | <default>'XF86Explorer'</default> | ||
679 | 36 | <summary>Home folder</summary> | ||
680 | 37 | <description>Binding to open the Home folder.</description> | ||
681 | 38 | </key> | ||
682 | 39 | <key type="s" name="media"> | ||
683 | 40 | <default>'XF86AudioMedia'</default> | ||
684 | 41 | <summary>Launch media player</summary> | ||
685 | 42 | <description>Binding to launch the media player.</description> | ||
686 | 43 | </key> | ||
687 | 44 | <key type="s" name="next"> | ||
688 | 45 | <default>'XF86AudioNext'</default> | ||
689 | 46 | <summary>Next track</summary> | ||
690 | 47 | <description>Binding to skip to next track.</description> | ||
691 | 48 | </key> | ||
692 | 49 | <key type="s" name="pause"> | ||
693 | 50 | <default>'XF86AudioPause'</default> | ||
694 | 51 | <summary>Pause playback</summary> | ||
695 | 52 | <description>Binding to pause playback.</description> | ||
696 | 53 | </key> | ||
697 | 54 | <key type="s" name="play"> | ||
698 | 55 | <default>'XF86AudioPlay'</default> | ||
699 | 56 | <summary>Play (or play/pause)</summary> | ||
700 | 57 | <description>Binding to start playback (or toggle play/pause).</description> | ||
701 | 58 | </key> | ||
702 | 59 | <key type="s" name="logout"> | ||
703 | 60 | <default>'<Control><Alt>Delete'</default> | ||
704 | 61 | <summary>Log out</summary> | ||
705 | 62 | <description>Binding to log out.</description> | ||
706 | 63 | </key> | ||
707 | 64 | <key type="s" name="previous"> | ||
708 | 65 | <default>'XF86AudioPrev'</default> | ||
709 | 66 | <summary>Previous track</summary> | ||
710 | 67 | <description>Binding to skip to previous track.</description> | ||
711 | 68 | </key> | ||
712 | 69 | <key type="i" name="priority"> | ||
713 | 70 | <default>98</default> | ||
714 | 71 | <summary>Priority to use for this plugin</summary> | ||
715 | 72 | <description>Priority to use for this plugin in gnome-settings-daemon startup queue</description> | ||
716 | 73 | </key> | ||
717 | 74 | <key type="s" name="screensaver"> | ||
718 | 75 | <default>'<Control><Alt>l'</default> | ||
719 | 76 | <summary>Lock screen</summary> | ||
720 | 77 | <description>Binding to lock the screen.</description> | ||
721 | 78 | </key> | ||
722 | 79 | <key type="s" name="search"> | ||
723 | 80 | <default>'XF86Search'</default> | ||
724 | 81 | <summary>Search</summary> | ||
725 | 82 | <description>Binding to launch the search tool.</description> | ||
726 | 83 | </key> | ||
727 | 84 | <key type="s" name="stop"> | ||
728 | 85 | <default>'XF86AudioStop'</default> | ||
729 | 86 | <summary>Stop playback</summary> | ||
730 | 87 | <description>Binding to stop playback.</description> | ||
731 | 88 | </key> | ||
732 | 89 | <key type="s" name="volume-down"> | ||
733 | 90 | <default>'XF86AudioLowerVolume'</default> | ||
734 | 91 | <summary>Volume down</summary> | ||
735 | 92 | <description>Binding to lower the system volume.</description> | ||
736 | 93 | </key> | ||
737 | 94 | <key type="s" name="volume-mute"> | ||
738 | 95 | <default>'XF86AudioMute'</default> | ||
739 | 96 | <summary>Volume mute</summary> | ||
740 | 97 | <description>Binding to mute the system volume.</description> | ||
741 | 98 | </key> | ||
742 | 99 | <key type="s" name="volume-up"> | ||
743 | 100 | <default>'XF86AudioRaiseVolume'</default> | ||
744 | 101 | <summary>Volume up</summary> | ||
745 | 102 | <description>Binding to raise the system volume.</description> | ||
746 | 103 | </key> | ||
747 | 104 | <key type="s" name="screenshot"> | ||
748 | 105 | <default>'Print'</default> | ||
749 | 106 | <summary>Take a screenshot</summary> | ||
750 | 107 | <description>Binding to take a screenshot.</description> | ||
751 | 108 | </key> | ||
752 | 109 | <key type="s" name="window-screenshot"> | ||
753 | 110 | <default>'<Alt>Print'</default> | ||
754 | 111 | <summary>Take a screenshot of a window</summary> | ||
755 | 112 | <description>Binding to take a screenshot of a window.</description> | ||
756 | 113 | </key> | ||
757 | 114 | <key type="s" name="area-screenshot"> | ||
758 | 115 | <default>'<Shift>Print'</default> | ||
759 | 116 | <summary>Take a screenshot of an area</summary> | ||
760 | 117 | <description>Binding to take a screenshot of an area.</description> | ||
761 | 118 | </key> | ||
762 | 119 | <key type="s" name="screenshot-clip"> | ||
763 | 120 | <default>'<Ctrl>Print'</default> | ||
764 | 121 | <summary>Copy a screenshot to clipboard</summary> | ||
765 | 122 | <description>Binding to copy a screenshot to clipboard.</description> | ||
766 | 123 | </key> | ||
767 | 124 | <key type="s" name="window-screenshot-clip"> | ||
768 | 125 | <default>'<Ctrl><Alt>Print'</default> | ||
769 | 126 | <summary>Copy a screenshot of a window to clipboard</summary> | ||
770 | 127 | <description>Binding to copy a screenshot of a window to clipboard.</description> | ||
771 | 128 | </key> | ||
772 | 129 | <key type="s" name="area-screenshot-clip"> | ||
773 | 130 | <default>'<Ctrl><Shift>Print'</default> | ||
774 | 131 | <summary>Copy a screenshot of an area to clipboard</summary> | ||
775 | 132 | <description>Binding to copy a screenshot of an area to clipboard.</description> | ||
776 | 133 | </key> | ||
777 | 134 | <key type="s" name="terminal"> | ||
778 | 135 | <default>'<Primary><Alt>t'</default> | ||
779 | 136 | <summary>Launch terminal</summary> | ||
780 | 137 | <description>Binding to launch the terminal.</description> | ||
781 | 138 | </key> | ||
782 | 139 | <key type="s" name="www"> | ||
783 | 140 | <default>'XF86WWW'</default> | ||
784 | 141 | <summary>Launch web browser</summary> | ||
785 | 142 | <description>Binding to launch the web browser.</description> | ||
786 | 143 | </key> | ||
787 | 144 | <key type="s" name="magnifier"> | ||
788 | 145 | <default>''</default> | ||
789 | 146 | <summary>Toggle magnifier</summary> | ||
790 | 147 | <description>Binding to show the screen magnifier</description> | ||
791 | 148 | </key> | ||
792 | 149 | <key type="s" name="screenreader"> | ||
793 | 150 | <default>''</default> | ||
794 | 151 | <summary>Toggle screen reader</summary> | ||
795 | 152 | <description>Binding to start the screen reader</description> | ||
796 | 153 | </key> | ||
797 | 154 | <key type="s" name="on-screen-keyboard"> | ||
798 | 155 | <default>''</default> | ||
799 | 156 | <summary>Toggle on-screen keyboard</summary> | ||
800 | 157 | <description>Binding to show the on-screen keyboard</description> | ||
801 | 158 | </key> | ||
802 | 159 | <key type="s" name="increase-text-size"> | ||
803 | 160 | <default>''</default> | ||
804 | 161 | <summary>Increase text size</summary> | ||
805 | 162 | <description>Binding to increase the text size</description> | ||
806 | 163 | </key> | ||
807 | 164 | <key type="s" name="decrease-text-size"> | ||
808 | 165 | <default>''</default> | ||
809 | 166 | <summary>Decrease text size</summary> | ||
810 | 167 | <description>Binding to decrease the text size</description> | ||
811 | 168 | </key> | ||
812 | 169 | <key type="s" name="toggle-contrast"> | ||
813 | 170 | <default>''</default> | ||
814 | 171 | <summary>Toggle contrast</summary> | ||
815 | 172 | <description>Binding to toggle the interface contrast</description> | ||
816 | 173 | </key> | ||
817 | 174 | <key type="s" name="magnifier-zoom-in"> | ||
818 | 175 | <default>''</default> | ||
819 | 176 | <summary>Magnifier zoom in</summary> | ||
820 | 177 | <description>Binding for the magnifier to zoom in</description> | ||
821 | 178 | </key> | ||
822 | 179 | <key type="s" name="magnifier-zoom-out"> | ||
823 | 180 | <default>''</default> | ||
824 | 181 | <summary>Magnifier zoom out</summary> | ||
825 | 182 | <description>Binding for the magnifier to zoom out</description> | ||
826 | 183 | </key> | ||
827 | 184 | </schema> | ||
828 | 185 | |||
829 | 186 | <schema id="org.gnome.settings-daemon.plugins.media-keys.custom-keybinding" gettext-domain="gnome-settings-daemon"> | ||
830 | 187 | <key type="s" name="name"> | ||
831 | 188 | <default>''</default> | ||
832 | 189 | <summary>Name</summary> | ||
833 | 190 | <description>Name of the custom binding</description> | ||
834 | 191 | </key> | ||
835 | 192 | <key type="s" name="binding"> | ||
836 | 193 | <default>''</default> | ||
837 | 194 | <summary>Binding</summary> | ||
838 | 195 | <description>Binding for the custom binding</description> | ||
839 | 196 | </key> | ||
840 | 197 | <key type="s" name="command"> | ||
841 | 198 | <default>''</default> | ||
842 | 199 | <summary>Command</summary> | ||
843 | 200 | <description>Command to run when the binding is invoked</description> | ||
844 | 201 | </key> | ||
845 | 202 | </schema> | ||
846 | 203 | </schemalist> | ||
847 | 0 | \ No newline at end of file | 204 | \ No newline at end of file |
848 | 1 | 205 | ||
849 | === modified file 'tests/test-service.cc' | |||
850 | --- tests/test-service.cc 2012-08-23 18:00:30 +0000 | |||
851 | +++ tests/test-service.cc 2012-11-16 18:58:44 +0000 | |||
852 | @@ -17,39 +17,130 @@ | |||
853 | 17 | with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | with this program. If not, see <http://www.gnu.org/licenses/>. |
854 | 18 | */ | 18 | */ |
855 | 19 | 19 | ||
857 | 20 | #include "gtest-dbus-helper.h" | 20 | #include <glib-object.h> |
858 | 21 | #include <gio/gio.h> | ||
859 | 22 | #include <glib.h> | ||
860 | 23 | |||
861 | 24 | #include <gtest/gtest.h> | ||
862 | 25 | |||
863 | 21 | #include "shared-names.h" | 26 | #include "shared-names.h" |
864 | 22 | 27 | ||
865 | 23 | /*** | 28 | /*** |
866 | 24 | **** | 29 | **** |
867 | 25 | ***/ | 30 | ***/ |
868 | 26 | 31 | ||
873 | 27 | /** | 32 | #define INDICATOR_SERVICE_OBJECT_PATH "/org/ayatana/indicator/service" |
874 | 28 | * Fixture class for testing indicator-session-service with Google Test. | 33 | #define INDICATOR_SERVICE_INTERFACE_NAME "org.ayatana.indicator.service" |
875 | 29 | */ | 34 | |
876 | 30 | class SessionServiceTest: public IndicatorServiceTest | 35 | class ClientTest : public ::testing::Test |
877 | 31 | { | 36 | { |
887 | 32 | public: | 37 | protected: |
888 | 33 | virtual ~SessionServiceTest() {} | 38 | |
889 | 34 | SessionServiceTest(): IndicatorServiceTest(INDICATOR_SESSION_DBUS_NAME, | 39 | GTestDBus * test_dbus; |
890 | 35 | INDICATOR_SESSION_DBUS_OBJECT, | 40 | GDBusConnection * session_bus; |
891 | 36 | INDICATOR_SERVICE_PATH) { } | 41 | GMainLoop * main_loop; |
892 | 37 | public: | 42 | |
893 | 38 | virtual void SetUp() { | 43 | virtual void SetUp() |
894 | 39 | wait_seconds(1); | 44 | { |
895 | 40 | IndicatorServiceTest::SetUp(); | 45 | test_dbus = NULL; |
896 | 46 | session_bus = NULL; | ||
897 | 47 | main_loop = NULL; | ||
898 | 48 | |||
899 | 49 | static bool first_run = true; | ||
900 | 50 | if (first_run) | ||
901 | 51 | { | ||
902 | 52 | g_type_init(); | ||
903 | 53 | g_setenv ("INDICATOR_SERVICE_SHUTDOWN_TIMEOUT", "1000", TRUE); | ||
904 | 54 | g_unsetenv ("INDICATOR_ALLOW_NO_WATCHERS"); | ||
905 | 55 | g_unsetenv ("INDICATOR_SERVICE_REPLACE_MODE"); | ||
906 | 56 | g_setenv ("GSETTINGS_SCHEMA_DIR", SCHEMA_DIR, TRUE); | ||
907 | 57 | g_setenv ("GSETTINGS_BACKEND", "memory", TRUE); | ||
908 | 58 | first_run = false; | ||
909 | 59 | } | ||
910 | 60 | |||
911 | 61 | main_loop = g_main_loop_new (NULL, FALSE); | ||
912 | 62 | // pull up a test dbus that's pointed at our test .service file | ||
913 | 63 | test_dbus = g_test_dbus_new (G_TEST_DBUS_NONE); | ||
914 | 64 | g_debug (G_STRLOC" service dir path is \"%s\"", INDICATOR_SERVICE_DIR); | ||
915 | 65 | g_test_dbus_add_service_dir (test_dbus, INDICATOR_SERVICE_DIR); | ||
916 | 66 | |||
917 | 67 | // allow the service to exist w/o a sync indicator | ||
918 | 68 | g_setenv ("INDICATOR_ALLOW_NO_WATCHERS", "1", TRUE); | ||
919 | 69 | |||
920 | 70 | g_test_dbus_up (test_dbus); | ||
921 | 71 | g_debug (G_STRLOC" this test bus' address is \"%s\"", g_test_dbus_get_bus_address(test_dbus)); | ||
922 | 72 | session_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); | ||
923 | 73 | g_debug (G_STRLOC" the dbus connection %p unique name is \"%s\"", session_bus, g_dbus_connection_get_unique_name(session_bus)); | ||
924 | 74 | g_debug (G_STRLOC" the dbus connection %p refcount is %d", session_bus, G_OBJECT(session_bus)->ref_count); | ||
925 | 41 | } | 75 | } |
928 | 42 | virtual void TearDown() { | 76 | |
929 | 43 | IndicatorServiceTest::TearDown(); | 77 | // undo SetUp |
930 | 78 | virtual void TearDown() | ||
931 | 79 | { | ||
932 | 80 | g_clear_object (&session_bus); | ||
933 | 81 | g_debug (G_STRLOC" tearing down the bus"); | ||
934 | 82 | g_test_dbus_down (test_dbus); | ||
935 | 83 | g_clear_object (&test_dbus); | ||
936 | 84 | g_clear_pointer (&main_loop, g_main_loop_unref); | ||
937 | 44 | } | 85 | } |
938 | 45 | }; | 86 | }; |
939 | 46 | 87 | ||
940 | 88 | /*** | ||
941 | 89 | **** | ||
942 | 90 | ***/ | ||
943 | 47 | 91 | ||
944 | 48 | /** | 92 | /** |
946 | 49 | * Basic sanity test to see if we can account for all our menuitems. | 93 | * This is a basic test to see if we can launch indicator-session-service |
947 | 94 | * and call its "GetUserRealName" method. The test succeeds if we can launch | ||
948 | 95 | * the service, call the method, and get response that equals g_get_real_name(). | ||
949 | 96 | * | ||
950 | 97 | * (You may be wondering why GetUserRealName() exists at all, instead of clients | ||
951 | 98 | * using g_get_real_name(). It's because the former updates itslef when the user | ||
952 | 99 | * edits his real name, while the latter returns its cached copy of the old name.) | ||
953 | 50 | */ | 100 | */ |
955 | 51 | TEST_F(SessionServiceTest, HelloWorld) | 101 | TEST_F (ClientTest, TestCanStartService) |
956 | 52 | { | 102 | { |
958 | 53 | ASSERT_TRUE(true); | 103 | GError * error; |
959 | 104 | GVariant * result; | ||
960 | 105 | const gchar * name; | ||
961 | 106 | |||
962 | 107 | // call GetUserRealName(), which as a side effect should activate | ||
963 | 108 | // indicator-session-service via the .service file in the tests/ directory | ||
964 | 109 | error = NULL; | ||
965 | 110 | result = g_dbus_connection_call_sync (session_bus, | ||
966 | 111 | INDICATOR_SESSION_DBUS_NAME, | ||
967 | 112 | INDICATOR_SESSION_SERVICE_DBUS_OBJECT, | ||
968 | 113 | INDICATOR_SESSION_SERVICE_DBUS_IFACE, | ||
969 | 114 | "GetUserRealName", | ||
970 | 115 | NULL, | ||
971 | 116 | G_VARIANT_TYPE("(s)"), | ||
972 | 117 | G_DBUS_CALL_FLAGS_NONE, | ||
973 | 118 | -1, | ||
974 | 119 | NULL, | ||
975 | 120 | &error); | ||
976 | 121 | |||
977 | 122 | EXPECT_TRUE (error == NULL); | ||
978 | 123 | ASSERT_TRUE (result != NULL); | ||
979 | 124 | |||
980 | 125 | if (error != NULL) | ||
981 | 126 | { | ||
982 | 127 | g_warning ("GetUserRealName failed: %s", error->message); | ||
983 | 128 | g_clear_error (&error); | ||
984 | 129 | } | ||
985 | 130 | |||
986 | 131 | name = NULL; | ||
987 | 132 | g_variant_get (result, "(&s)", &name); | ||
988 | 133 | ASSERT_STREQ (g_get_real_name(), name); | ||
989 | 134 | g_clear_pointer (&result, g_variant_unref); | ||
990 | 135 | |||
991 | 136 | // call IndicatorService's Shutdown() method for a clean exit | ||
992 | 137 | result = g_dbus_connection_call_sync (session_bus, | ||
993 | 138 | INDICATOR_SESSION_DBUS_NAME, | ||
994 | 139 | "/org/ayatana/indicator/service", | ||
995 | 140 | "org.ayatana.indicator.service", | ||
996 | 141 | "Shutdown", NULL, | ||
997 | 142 | NULL, | ||
998 | 143 | G_DBUS_CALL_FLAGS_NONE, | ||
999 | 144 | -1, NULL, NULL); | ||
1000 | 145 | g_clear_pointer (&result, g_variant_unref); | ||
1001 | 54 | } | 146 | } |
1002 | 55 |
FAILED: Continuous integration, rev:370 jenkins. qa.ubuntu. com/job/ indicator- session- ci/22/ jenkins. qa.ubuntu. com/job/ indicator- session- ci/./label= quantal/ 22/console
http://
Executed test runs:
FAILURE: http://