[folks] tests: Add a FOLKS_TEST_DBUS_SESSION_BUS flag



commit 8f88775dd35ef72c0d1f096f0e365a046baad4b3
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Feb 16 18:20:37 2014 +0000

    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

 tests/lib/gtestdbus.c |    5 +++++
 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 fac2fa1..cca9435 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 63dcc71..2c726db 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 ())


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]