1 /* GLib testing framework examples and tests
3 * Copyright (C) 2008-2010 Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18 * Boston, MA 02111-1307, USA.
20 * Author: David Zeuthen <davidz@redhat.com>
27 #include "gdbus-tests.h"
29 /* all tests rely on a shared mainloop */
30 static GMainLoop *loop = NULL;
32 /* ---------------------------------------------------------------------------------------------------- */
33 /* Test that the method aspects of GDBusProxy works */
34 /* ---------------------------------------------------------------------------------------------------- */
37 test_methods (GDBusProxy *proxy)
42 gchar *dbus_error_name;
44 /* check that we can invoke a method */
46 result = g_dbus_proxy_call_sync (proxy,
48 g_variant_new ("(s)", "Hey"),
49 G_DBUS_CALL_FLAGS_NONE,
53 g_assert_no_error (error);
54 g_assert (result != NULL);
55 g_assert_cmpstr (g_variant_get_type_string (result), ==, "(s)");
56 g_variant_get (result, "(&s)", &str);
57 g_assert_cmpstr (str, ==, "You greeted me with 'Hey'. Thanks!");
58 g_variant_unref (result);
60 /* Check that we can completely recover the returned error */
61 result = g_dbus_proxy_call_sync (proxy,
63 g_variant_new ("(s)", "Yo"),
64 G_DBUS_CALL_FLAGS_NONE,
68 g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR);
69 g_assert (g_dbus_error_is_remote_error (error));
70 g_assert (g_dbus_error_is_remote_error (error));
71 g_assert (result == NULL);
72 dbus_error_name = g_dbus_error_get_remote_error (error);
73 g_assert_cmpstr (dbus_error_name, ==, "com.example.TestException");
74 g_free (dbus_error_name);
75 g_assert (g_dbus_error_strip_remote_error (error));
76 g_assert_cmpstr (error->message, ==, "Yo is not a proper greeting");
77 g_clear_error (&error);
79 /* Check that we get a timeout if the method handling is taking longer than timeout */
81 result = g_dbus_proxy_call_sync (proxy,
83 g_variant_new ("(i)", 500 /* msec */),
84 G_DBUS_CALL_FLAGS_NONE,
88 g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
89 g_assert (!g_dbus_error_is_remote_error (error));
90 g_assert (result == NULL);
91 g_clear_error (&error);
93 /* Check that proxy-default timeouts work. */
94 g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, -1);
96 /* the default timeout is 25000 msec so this should work */
97 result = g_dbus_proxy_call_sync (proxy,
99 g_variant_new ("(i)", 500 /* msec */),
100 G_DBUS_CALL_FLAGS_NONE,
101 -1, /* use proxy default (e.g. -1 -> e.g. 25000 msec) */
104 g_assert_no_error (error);
105 g_assert (result != NULL);
106 g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
107 g_variant_unref (result);
109 /* now set the proxy-default timeout to 250 msec and try the 500 msec call - this should FAIL */
110 g_dbus_proxy_set_default_timeout (proxy, 250);
111 g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250);
112 result = g_dbus_proxy_call_sync (proxy,
114 g_variant_new ("(i)", 500 /* msec */),
115 G_DBUS_CALL_FLAGS_NONE,
116 -1, /* use proxy default (e.g. 250 msec) */
119 g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT);
120 g_assert (!g_dbus_error_is_remote_error (error));
121 g_assert (result == NULL);
122 g_clear_error (&error);
124 /* clean up after ourselves */
125 g_dbus_proxy_set_default_timeout (proxy, -1);
129 strv_equal (gchar **strv, ...)
138 va_start (list, strv);
141 str = va_arg (list, const gchar *);
144 if (g_strcmp0 (str, strv[count]) != 0)
154 res = g_strv_length (strv) == count;
159 /* ---------------------------------------------------------------------------------------------------- */
160 /* Test that the property aspects of GDBusProxy works */
161 /* ---------------------------------------------------------------------------------------------------- */
164 test_properties (GDBusProxy *proxy)
174 if (g_dbus_proxy_get_flags (proxy) & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES)
176 g_assert (g_dbus_proxy_get_cached_property_names (proxy) == NULL);
181 * Check that we can list all cached properties.
183 names = g_dbus_proxy_get_cached_property_names (proxy);
185 g_assert (strv_equal (names,
186 "PropertyThatWillBeInvalidated",
215 * Check that we can read cached properties.
217 * No need to test all properties - GVariant has already been tested
219 variant = g_dbus_proxy_get_cached_property (proxy, "y");
220 g_assert (variant != NULL);
221 g_assert_cmpint (g_variant_get_byte (variant), ==, 1);
222 g_variant_unref (variant);
223 variant = g_dbus_proxy_get_cached_property (proxy, "o");
224 g_assert (variant != NULL);
225 g_assert_cmpstr (g_variant_get_string (variant, NULL), ==, "/some/path");
226 g_variant_unref (variant);
229 * Now ask the service to change a property and check that #GDBusProxy::g-property-changed
230 * is received. Also check that the cache is updated.
232 variant2 = g_variant_new_byte (42);
233 result = g_dbus_proxy_call_sync (proxy,
235 g_variant_new ("(sv)",
238 G_DBUS_CALL_FLAGS_NONE,
242 g_assert_no_error (error);
243 g_assert (result != NULL);
244 g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
245 g_variant_unref (result);
246 _g_assert_signal_received (proxy, "g-properties-changed");
247 variant = g_dbus_proxy_get_cached_property (proxy, "y");
248 g_assert (variant != NULL);
249 g_assert_cmpint (g_variant_get_byte (variant), ==, 42);
250 g_variant_unref (variant);
252 g_dbus_proxy_set_cached_property (proxy, "y", g_variant_new_byte (142));
253 variant = g_dbus_proxy_get_cached_property (proxy, "y");
254 g_assert (variant != NULL);
255 g_assert_cmpint (g_variant_get_byte (variant), ==, 142);
256 g_variant_unref (variant);
258 g_dbus_proxy_set_cached_property (proxy, "y", NULL);
259 variant = g_dbus_proxy_get_cached_property (proxy, "y");
260 g_assert (variant == NULL);
262 /* Check that the invalidation feature of the PropertiesChanged()
263 * signal works... First, check that we have a cached value of the
264 * property (from the initial GetAll() call)
266 variant = g_dbus_proxy_get_cached_property (proxy, "PropertyThatWillBeInvalidated");
267 g_assert (variant != NULL);
268 g_assert_cmpstr (g_variant_get_string (variant, NULL), ==, "InitialValue");
269 g_variant_unref (variant);
270 /* now ask to invalidate the property - this causes a
272 * PropertiesChanaged("com.example.Frob",
274 * ["PropertyThatWillBeInvalidated")
276 * signal to be emitted. This is received before the method reply
277 * for FrobInvalidateProperty *but* since the proxy was created in
278 * the same thread as we're doing this synchronous call, we'll get
279 * the method reply before...
281 result = g_dbus_proxy_call_sync (proxy,
282 "FrobInvalidateProperty",
284 G_DBUS_CALL_FLAGS_NONE,
288 g_assert_no_error (error);
289 g_assert (result != NULL);
290 g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
291 g_variant_unref (result);
292 /* ... hence we wait for the g-properties-changed signal to be delivered */
293 _g_assert_signal_received (proxy, "g-properties-changed");
294 /* ... and now we finally, check that the cached value has been invalidated */
295 variant = g_dbus_proxy_get_cached_property (proxy, "PropertyThatWillBeInvalidated");
296 g_assert (variant == NULL);
299 /* ---------------------------------------------------------------------------------------------------- */
300 /* Test that the signal aspects of GDBusProxy works */
301 /* ---------------------------------------------------------------------------------------------------- */
304 test_proxy_signals_on_signal (GDBusProxy *proxy,
305 const gchar *sender_name,
306 const gchar *signal_name,
307 GVariant *parameters,
310 GString *s = user_data;
312 g_assert_cmpstr (signal_name, ==, "TestSignal");
313 g_assert_cmpstr (g_variant_get_type_string (parameters), ==, "(sov)");
315 g_variant_print_string (parameters, s, TRUE);
320 GMainLoop *internal_loop;
325 test_proxy_signals_on_emit_signal_cb (GDBusProxy *proxy,
329 TestSignalData *data = user_data;
334 result = g_dbus_proxy_call_finish (proxy,
337 g_assert_no_error (error);
338 g_assert (result != NULL);
339 g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
340 g_variant_unref (result);
342 /* check that the signal was recieved before we got the method result */
343 g_assert (strlen (data->s->str) > 0);
345 /* break out of the loop */
346 g_main_loop_quit (data->internal_loop);
350 test_signals (GDBusProxy *proxy)
354 gulong signal_handler_id;
361 * Ask the service to emit a signal and check that we receive it.
363 * Note that blocking calls don't block in the mainloop so wait for the signal (which
364 * is dispatched before the method reply)
366 s = g_string_new (NULL);
367 signal_handler_id = g_signal_connect (proxy,
369 G_CALLBACK (test_proxy_signals_on_signal),
372 result = g_dbus_proxy_call_sync (proxy,
374 g_variant_new ("(so)",
375 "Accept the next proposition you hear",
377 G_DBUS_CALL_FLAGS_NONE,
381 g_assert_no_error (error);
382 g_assert (result != NULL);
383 g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
384 g_variant_unref (result);
385 /* check that we haven't received the signal just yet */
386 g_assert (strlen (s->str) == 0);
387 /* and now wait for the signal */
388 _g_assert_signal_received (proxy, "g-signal");
389 g_assert_cmpstr (s->str,
391 "('Accept the next proposition you hear .. in bed!', objectpath '/some/path/in/bed', <'a variant'>)");
392 g_signal_handler_disconnect (proxy, signal_handler_id);
393 g_string_free (s, TRUE);
396 * Now do this async to check the signal is received before the method returns.
398 s = g_string_new (NULL);
399 data.internal_loop = g_main_loop_new (NULL, FALSE);
401 signal_handler_id = g_signal_connect (proxy,
403 G_CALLBACK (test_proxy_signals_on_signal),
405 g_dbus_proxy_call (proxy,
407 g_variant_new ("(so)",
408 "You will make a great programmer",
410 G_DBUS_CALL_FLAGS_NONE,
413 (GAsyncReadyCallback) test_proxy_signals_on_emit_signal_cb,
415 g_main_loop_run (data.internal_loop);
416 g_main_loop_unref (data.internal_loop);
417 g_assert_cmpstr (s->str,
419 "('You will make a great programmer .. in bed!', objectpath '/some/other/path/in/bed', <'a variant'>)");
420 g_signal_handler_disconnect (proxy, signal_handler_id);
421 g_string_free (s, TRUE);
424 /* ---------------------------------------------------------------------------------------------------- */
427 test_bogus_method_return (GDBusProxy *proxy)
429 GError *error = NULL;
432 result = g_dbus_proxy_call_sync (proxy,
435 G_DBUS_CALL_FLAGS_NONE,
439 g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
440 g_error_free (error);
441 g_assert (result == NULL);
445 test_bogus_signal (GDBusProxy *proxy)
447 GError *error = NULL;
449 GDBusInterfaceInfo *old_iface_info;
451 result = g_dbus_proxy_call_sync (proxy,
454 G_DBUS_CALL_FLAGS_NONE,
458 g_assert_no_error (error);
459 g_assert (result != NULL);
460 g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
461 g_variant_unref (result);
463 if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
465 /* and now wait for the signal that will never arrive */
466 _g_assert_signal_received (proxy, "g-signal");
468 g_test_trap_assert_stderr ("*Dropping signal TestSignal2 of type (i) since the type from the expected interface is (u)*");
469 g_test_trap_assert_failed();
471 /* Our main branch will also do g_warning() when running the mainloop so
472 * temporarily remove the expected interface
474 old_iface_info = g_dbus_proxy_get_interface_info (proxy);
475 g_dbus_proxy_set_interface_info (proxy, NULL);
476 _g_assert_signal_received (proxy, "g-signal");
477 g_dbus_proxy_set_interface_info (proxy, old_iface_info);
481 test_bogus_property (GDBusProxy *proxy)
483 GError *error = NULL;
485 GDBusInterfaceInfo *old_iface_info;
487 /* Make the service emit a PropertiesChanged signal for property 'i' of type 'i' - since
488 * our introspection data has this as type 'u' we should get a warning on stderr.
490 result = g_dbus_proxy_call_sync (proxy,
492 g_variant_new ("(sv)",
493 "i", g_variant_new_int32 (42)),
494 G_DBUS_CALL_FLAGS_NONE,
498 g_assert_no_error (error);
499 g_assert (result != NULL);
500 g_assert_cmpstr (g_variant_get_type_string (result), ==, "()");
501 g_variant_unref (result);
503 if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
505 /* and now wait for the signal that will never arrive */
506 _g_assert_signal_received (proxy, "g-properties-changed");
508 g_test_trap_assert_stderr ("*Received property i with type i does not match expected type u in the expected interface*");
509 g_test_trap_assert_failed();
511 /* Our main branch will also do g_warning() when running the mainloop so
512 * temporarily remove the expected interface
514 old_iface_info = g_dbus_proxy_get_interface_info (proxy);
515 g_dbus_proxy_set_interface_info (proxy, NULL);
516 _g_assert_signal_received (proxy, "g-properties-changed");
517 g_dbus_proxy_set_interface_info (proxy, old_iface_info);
520 /* ---------------------------------------------------------------------------------------------------- */
522 static const gchar *frob_dbus_interface_xml =
524 " <interface name='com.example.Frob'>"
525 /* PairReturn() is deliberately different from gdbus-testserver.py's definition */
526 " <method name='PairReturn'>"
527 " <arg type='u' name='somenumber' direction='in'/>"
528 " <arg type='s' name='somestring' direction='out'/>"
530 " <method name='HelloWorld'>"
531 " <arg type='s' name='somestring' direction='in'/>"
532 " <arg type='s' name='somestring' direction='out'/>"
534 " <method name='Sleep'>"
535 " <arg type='i' name='timeout' direction='in'/>"
537 /* We deliberately only mention a single property here */
538 " <property name='y' type='y' access='readwrite'/>"
539 /* The 'i' property is deliberately different from gdbus-testserver.py's definition */
540 " <property name='i' type='u' access='readwrite'/>"
541 /* ::TestSignal2 is deliberately different from gdbus-testserver.py's definition */
542 " <signal name='TestSignal2'>"
543 " <arg type='u' name='somenumber'/>"
547 static GDBusInterfaceInfo *frob_dbus_interface_info;
550 test_expected_interface (GDBusProxy *proxy)
555 /* This is obviously wrong but expected interface is not set so we don't fail... */
556 g_dbus_proxy_set_cached_property (proxy, "y", g_variant_new_string ("error_me_out!"));
557 g_dbus_proxy_set_cached_property (proxy, "y", g_variant_new_byte (42));
558 g_dbus_proxy_set_cached_property (proxy, "does-not-exist", g_variant_new_string ("something"));
559 g_dbus_proxy_set_cached_property (proxy, "does-not-exist", NULL);
561 /* Now repeat the method tests, with an expected interface set */
562 g_dbus_proxy_set_interface_info (proxy, frob_dbus_interface_info);
563 test_methods (proxy);
564 test_signals (proxy);
566 /* And also where we deliberately set the expected interface definition incorrectly */
567 test_bogus_method_return (proxy);
568 test_bogus_signal (proxy);
569 test_bogus_property (proxy);
571 /* Also check that we complain if setting a cached property of the wrong type */
572 if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
574 g_dbus_proxy_set_cached_property (proxy, "y", g_variant_new_string ("error_me_out!"));
576 g_test_trap_assert_stderr ("*Trying to set property y of type s but according to the expected interface the type is y*");
577 g_test_trap_assert_failed();
579 /* this should work, however (since the type is correct) */
580 g_dbus_proxy_set_cached_property (proxy, "y", g_variant_new_byte (42));
582 /* Try to get the value of a property where the type we expect is different from
583 * what we have in our cache (e.g. what the service returned)
585 if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
587 value = g_dbus_proxy_get_cached_property (proxy, "i");
589 g_test_trap_assert_stderr ("*Trying to get property i with type i but according to the expected interface the type is u*");
590 g_test_trap_assert_failed();
592 /* Even if a property does not exist in expected_interface, looking it
593 * up, or setting it, should never fail. Because it could be that the
594 * property has been added to the service but the GDBusInterfaceInfo*
595 * passed to g_dbus_proxy_set_interface_info() just haven't been updated.
597 * See https://bugzilla.gnome.org/show_bug.cgi?id=660886
599 value = g_dbus_proxy_get_cached_property (proxy, "d");
600 g_assert (value != NULL);
601 g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE));
602 g_assert_cmpfloat (g_variant_get_double (value), ==, 7.5);
603 g_variant_unref (value);
604 /* update it via the cached property... */
605 g_dbus_proxy_set_cached_property (proxy, "d", g_variant_new_double (75.0));
606 /* ... and finally check that it has changed */
607 value = g_dbus_proxy_get_cached_property (proxy, "d");
608 g_assert (value != NULL);
609 g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE));
610 g_assert_cmpfloat (g_variant_get_double (value), ==, 75.0);
611 g_variant_unref (value);
612 /* now update it via the D-Bus interface... */
614 value = g_dbus_proxy_call_sync (proxy, "FrobSetProperty",
615 g_variant_new ("(sv)", "d", g_variant_new_double (85.0)),
616 G_DBUS_CALL_FLAGS_NONE,
618 g_assert_no_error (error);
619 g_assert (value != NULL);
620 g_assert_cmpstr (g_variant_get_type_string (value), ==, "()");
621 g_variant_unref (value);
622 /* ...ensure we receive the ::PropertiesChanged signal... */
623 _g_assert_signal_received (proxy, "g-properties-changed");
624 /* ... and finally check that it has changed */
625 value = g_dbus_proxy_get_cached_property (proxy, "d");
626 g_assert (value != NULL);
627 g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE_DOUBLE));
628 g_assert_cmpfloat (g_variant_get_double (value), ==, 85.0);
629 g_variant_unref (value);
633 test_basic (GDBusProxy *proxy)
635 GDBusConnection *connection;
636 GDBusConnection *conn;
637 GDBusProxyFlags flags;
638 GDBusInterfaceInfo *info;
644 connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL);
646 g_assert (g_dbus_proxy_get_connection (proxy) == connection);
647 g_assert (g_dbus_proxy_get_flags (proxy) == G_DBUS_PROXY_FLAGS_NONE);
648 g_assert (g_dbus_proxy_get_interface_info (proxy) == NULL);
649 g_assert_cmpstr (g_dbus_proxy_get_name (proxy), ==, "com.example.TestService");
650 g_assert_cmpstr (g_dbus_proxy_get_object_path (proxy), ==, "/com/example/TestObject");
651 g_assert_cmpstr (g_dbus_proxy_get_interface_name (proxy), ==, "com.example.Frob");
652 g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, -1);
655 "g-connection", &conn,
656 "g-interface-info", &info,
659 "g-object-path", &path,
660 "g-interface-name", &interface,
661 "g-default-timeout", &timeout,
664 g_assert (conn == connection);
665 g_assert (info == NULL);
666 g_assert_cmpint (flags, ==, G_DBUS_PROXY_FLAGS_NONE);
667 g_assert_cmpstr (name, ==, "com.example.TestService");
668 g_assert_cmpstr (path, ==, "/com/example/TestObject");
669 g_assert_cmpstr (interface, ==, "com.example.Frob");
670 g_assert_cmpint (timeout, ==, -1);
672 g_object_unref (conn);
677 g_object_unref (connection);
684 GDBusConnection *connection;
689 /* TODO: wait a bit for the bus to come up.. ideally session_bus_up() won't return
690 * until one can connect to the bus but that's not how things work right now
695 connection = g_bus_get_sync (G_BUS_TYPE_SESSION,
698 g_assert_no_error (error);
700 proxy = g_dbus_proxy_new_sync (connection,
701 G_DBUS_PROXY_FLAGS_NONE,
702 NULL, /* GDBusInterfaceInfo */
703 "com.example.TestService", /* name */
704 "/com/example/TestObject", /* object path */
705 "com.example.Frob", /* interface */
706 NULL, /* GCancellable */
708 g_assert_no_error (error);
710 /* this is safe; testserver will exit once the bus goes away */
711 g_assert (g_spawn_command_line_async (SRCDIR "/gdbus-testserver.py", NULL));
713 _g_assert_property_notify (proxy, "g-name-owner");
716 test_methods (proxy);
717 test_properties (proxy);
718 test_signals (proxy);
719 test_expected_interface (proxy);
721 g_object_unref (proxy);
722 g_object_unref (connection);
725 /* ---------------------------------------------------------------------------------------------------- */
728 proxy_ready (GObject *source,
729 GAsyncResult *result,
736 proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
737 g_assert_no_error (error);
740 test_methods (proxy);
741 test_properties (proxy);
742 test_signals (proxy);
743 test_expected_interface (proxy);
745 g_object_unref (proxy);
751 g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
752 G_DBUS_PROXY_FLAGS_NONE,
753 NULL, /* GDBusInterfaceInfo */
754 "com.example.TestService", /* name */
755 "/com/example/TestObject", /* object path */
756 "com.example.Frob", /* interface */
757 NULL, /* GCancellable */
763 test_no_properties (void)
769 proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
770 G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
771 NULL, /* GDBusInterfaceInfo */
772 "com.example.TestService", /* name */
773 "/com/example/TestObject", /* object path */
774 "com.example.Frob", /* interface */
775 NULL, /* GCancellable */
777 g_assert_no_error (error);
779 test_properties (proxy);
781 g_object_unref (proxy);
789 GDBusNodeInfo *introspection_data = NULL;
792 g_test_init (&argc, &argv, NULL);
794 introspection_data = g_dbus_node_info_new_for_xml (frob_dbus_interface_xml, NULL);
795 g_assert (introspection_data != NULL);
796 frob_dbus_interface_info = introspection_data->interfaces[0];
798 /* all the tests rely on a shared main loop */
799 loop = g_main_loop_new (NULL, FALSE);
801 /* all the tests use a session bus with a well-known address that we can bring up and down
802 * using session_bus_up() and session_bus_down().
804 g_unsetenv ("DISPLAY");
805 g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_bus_get_temporary_address (), TRUE);
807 g_test_add_func ("/gdbus/proxy", test_proxy);
808 g_test_add_func ("/gdbus/proxy/async", test_async);
809 g_test_add_func ("/gdbus/proxy/no-properties", test_no_properties);
813 g_dbus_node_info_unref (introspection_data);