[glib] tests: fix GAction test for headless run
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] tests: fix GAction test for headless run
- Date: Wed, 7 Mar 2012 03:11:41 +0000 (UTC)
commit 7cf50ceb857968a99e141e8e2c75053761a12639
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Mar 6 22:10:53 2012 -0500
tests: fix GAction test for headless run
gio/tests/Makefile.am | 1 +
gio/tests/actions.c | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gio/tests/Makefile.am b/gio/tests/Makefile.am
index cf1f4e7..59592b1 100644
--- a/gio/tests/Makefile.am
+++ b/gio/tests/Makefile.am
@@ -140,6 +140,7 @@ endif
io_stream_SOURCES = io-stream.c
io_stream_LDADD = $(progs_ldadd)
+actions_SOURCES = actions.c gdbus-sessionbus.c gdbus-sessionbus.h
actions_LDADD = $(progs_ldadd)
memory_input_stream_SOURCES = memory-input-stream.c
diff --git a/gio/tests/actions.c b/gio/tests/actions.c
index 53a3a8d..148f656 100644
--- a/gio/tests/actions.c
+++ b/gio/tests/actions.c
@@ -1,6 +1,8 @@
#include <gio/gio.h>
#include <stdlib.h>
+#include "gdbus-sessionbus.h"
+
typedef struct
{
GVariant *params;
@@ -536,6 +538,7 @@ test_dbus_export (void)
loop = g_main_loop_new (NULL, FALSE);
+ session_bus_up ();
bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
group = g_simple_action_group_new ();
@@ -627,6 +630,8 @@ test_dbus_export (void)
g_object_unref (group);
g_main_loop_unref (loop);
g_object_unref (bus);
+
+ session_bus_down ();
}
static gpointer
@@ -683,6 +688,8 @@ test_dbus_threaded (void)
};
gint i;
+ session_bus_up ();
+
for (i = 0; i < 10; i++)
{
group[i] = g_simple_action_group_new ();
@@ -695,6 +702,8 @@ test_dbus_threaded (void)
for (i = 0; i < 10; i++)
g_object_unref (group[i]);
+
+ session_bus_down ();
}
int
@@ -703,6 +712,8 @@ main (int argc, char **argv)
g_type_init ();
g_test_init (&argc, &argv, NULL);
+ g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_bus_get_temporary_address (), TRUE);
+
g_test_add_func ("/actions/basic", test_basic);
g_test_add_func ("/actions/simplegroup", test_simple_group);
g_test_add_func ("/actions/stateful", test_stateful);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]