diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2014-02-16 18:20:37 +0000 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2014-02-16 20:38:31 +0000 |
commit | 8f88775dd35ef72c0d1f096f0e365a046baad4b3 (patch) | |
tree | bdd1767b7d5440640e2d0d67f0d70a56f387ba08 | |
parent | 7301078c0934d5d931460ba7109762536d6cd328 (diff) |
tests: Add a FOLKS_TEST_DBUS_SESSION_BUS flag
This mirrors the FOLKS_TEST_DBUS_SYSTEM_BUS flag, and can be used to clarify
which bus is expected to be created. The default behaviour (if
FOLKS_TEST_DBUS_SYSTEM_BUS isn’t specified) is to create a session bus,
however, so setting this flag isn’t at all required.
This is a tweaked version of the patch from
bug: https://bugzilla.gnome.org/show_bug.cgi?id=712148
-rw-r--r-- | tests/lib/gtestdbus.c | 5 | ||||
-rw-r--r-- | tests/lib/gtestdbus.h | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/lib/gtestdbus.c b/tests/lib/gtestdbus.c index fac2fa17..cca9435a 100644 --- a/tests/lib/gtestdbus.c +++ b/tests/lib/gtestdbus.c @@ -50,6 +50,7 @@ folks_test_dbus_flags_get_type (void) { static const GFlagsValue values[] = { { FOLKS_TEST_DBUS_NONE, "FOLKS_TEST_DBUS_NONE", "none" }, + { FOLKS_TEST_DBUS_SESSION_BUS, "FOLKS_TEST_DBUS_SESSION_BUS", "session-bus" }, { FOLKS_TEST_DBUS_SYSTEM_BUS, "FOLKS_TEST_DBUS_SYSTEM_BUS", "system-bus" }, { 0, NULL, NULL } }; @@ -379,6 +380,10 @@ _folks_test_watcher_remove_pid (GPid pid) * here: * [gdbus-test-fixture.c](https://git.gnome.org/browse/glib/tree/gio/tests/gdbus-test-fixture.c) * + * The default behaviour is to create a session bus. The + * %FOLKS_TEST_DBUS_SESSION_BUS flag may be specified to clarify this, but it + * isn’t required. + * * If your service needs to run on the system bus, rather than the session * bus, pass the %FOLKS_TEST_DBUS_SYSTEM_BUS flag to folks_test_dbus_new(). This * will create an isolated system bus. Using two #GTestDBus instances, one diff --git a/tests/lib/gtestdbus.h b/tests/lib/gtestdbus.h index 63dcc710..2c726db7 100644 --- a/tests/lib/gtestdbus.h +++ b/tests/lib/gtestdbus.h @@ -30,6 +30,7 @@ G_BEGIN_DECLS /** * FolksTestDBusFlags: * @FOLKS_TEST_DBUS_NONE: No flags. + * @FOLKS_TEST_DBUS_SESSION_BUS: Create a session bus (the default). * @FOLKS_TEST_DBUS_SYSTEM_BUS: Create a system bus instead of a session bus. * * Flags to define #FolksTestDBus behaviour. @@ -38,7 +39,8 @@ G_BEGIN_DECLS */ typedef enum /*< flags >*/ { FOLKS_TEST_DBUS_NONE = 0, - FOLKS_TEST_DBUS_SYSTEM_BUS, + FOLKS_TEST_DBUS_SESSION_BUS = 0, /* default; same as NONE */ + FOLKS_TEST_DBUS_SYSTEM_BUS = 1 << 0, } FolksTestDBusFlags; #define FOLKS_TYPE_TEST_DBUS_FLAGS (folks_test_dbus_flags_get_type ()) |