From: Cosimo Cecchi Date: Wed, 7 Mar 2012 03:10:53 +0000 (-0500) Subject: tests: fix GAction test for headless run X-Git-Tag: 2.31.22~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7cf50ceb857968a99e141e8e2c75053761a12639;p=platform%2Fupstream%2Fglib.git tests: fix GAction test for headless run --- 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 #include +#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);