blob: f2a366b5998f94fc0cb58984ce47f7b593575232 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#include "../engine/dconf-engine.h"
static void
test_engine_dbus_call (void)
{
GError *error = NULL;
GVariant *reply;
/* Force a call to the engine to make sure at least one GDBusConnection
* is cached.
*/
reply = dconf_engine_dbus_call_sync_func (G_BUS_TYPE_SESSION,
"org.freedesktop.DBus", "/", "org.freedesktop.DBus", "ListNames",
g_variant_new ("()"), G_VARIANT_TYPE ("(as)"), &error);
g_assert_no_error (error);
g_assert (reply != NULL);
g_assert (g_variant_is_of_type (reply, G_VARIANT_TYPE ("(as)")));
g_variant_unref (reply);
}
int
main (int argc, char **argv)
{
GTestDBus *test_bus;
int res;
g_test_init (&argc, &argv, NULL);
dconf_engine_dbus_init_for_testing ();
g_test_add_func (DBUS_BACKEND "/dbus/engine-dbus-call", test_engine_dbus_call);
test_bus = g_test_dbus_new (G_TEST_DBUS_NONE);
g_test_dbus_up (test_bus);
res = g_test_run ();
/* g_test_dbus_down will fail if GDBusConnection leaks */
g_test_dbus_down (test_bus);
g_object_unref (test_bus);
return res;
}
|