diff options
author | Simon McVittie <smcv@debian.org> | 2017-11-01 16:22:44 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2017-11-01 16:34:07 +0000 |
commit | 290ec72b76bc91355a54ba562565959a50ed29a9 (patch) | |
tree | acf5567cc357f3998da9993e34b852ccf1efc4b3 | |
parent | 93f9fe7b9c009e89ca9a0c32e07176fb8ab9839d (diff) | |
download | dbus-glib-290ec72b76bc91355a54ba562565959a50ed29a9.tar.gz |
test_run_until_disconnected: Convert to pure libdbus
This will let us do a few tests with just dbus-gmain.
Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r-- | test/core/30574.c | 3 | ||||
-rw-r--r-- | test/core/peer-on-bus.c | 6 | ||||
-rw-r--r-- | test/core/registrations.c | 4 | ||||
-rw-r--r-- | test/core/test-dbus-glib.c | 5 | ||||
-rw-r--r-- | test/core/test-variant-recursion.c | 3 | ||||
-rw-r--r-- | test/interfaces/test-client.c | 2 | ||||
-rw-r--r-- | test/lib/util.c | 33 | ||||
-rw-r--r-- | test/lib/util.h | 6 |
8 files changed, 19 insertions, 43 deletions
diff --git a/test/core/30574.c b/test/core/30574.c index 2d0519f..89d54f4 100644 --- a/test/core/30574.c +++ b/test/core/30574.c @@ -104,8 +104,7 @@ main(int argc, const char *argv[]) send_test_message (FALSE); send_test_message (TRUE); - test_run_until_disconnected (dbus_connection_get_g_connection (bus), - NULL); + test_run_until_disconnected (bus, NULL); dbus_connection_unref (bus); dbus_shutdown (); diff --git a/test/core/peer-on-bus.c b/test/core/peer-on-bus.c index 7c5147d..50a15b5 100644 --- a/test/core/peer-on-bus.c +++ b/test/core/peer-on-bus.c @@ -66,13 +66,13 @@ teardown (Fixture *f, { if (f->bus != NULL) { - test_run_until_disconnected (f->bus, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (f->bus), NULL); dbus_g_connection_unref (f->bus); } if (f->bus2 != NULL) { - test_run_until_disconnected (f->bus2, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (f->bus2), NULL); dbus_g_connection_unref (f->bus2); } @@ -109,7 +109,7 @@ test_name_owner_changed (Fixture *f, &destroyed); /* Disconnect bus2, to provoke a NameOwnerChanged signal on bus */ - test_run_until_disconnected (f->bus2, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (f->bus2), NULL); dbus_g_connection_unref (f->bus2); f->bus2 = NULL; diff --git a/test/core/registrations.c b/test/core/registrations.c index 785c7cc..29afb30 100644 --- a/test/core/registrations.c +++ b/test/core/registrations.c @@ -91,13 +91,13 @@ teardown (Fixture *f, * in test_lookup() */ if (f->bus != NULL) { - test_run_until_disconnected (f->bus, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (f->bus), NULL); dbus_g_connection_unref (f->bus); } if (f->bus2 != NULL) { - test_run_until_disconnected (f->bus2, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (f->bus2), NULL); dbus_g_connection_unref (f->bus2); } diff --git a/test/core/test-dbus-glib.c b/test/core/test-dbus-glib.c index e549ba8..cd5506e 100644 --- a/test/core/test-dbus-glib.c +++ b/test/core/test-dbus-glib.c @@ -28,6 +28,7 @@ /* -*- mode: C; c-file-style: "gnu" -*- */ #include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -2396,13 +2397,13 @@ main (int argc, char **argv) g_object_unref (G_OBJECT (proxy)); - test_run_until_disconnected (privconn, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (privconn), NULL); dbus_g_connection_unref (privconn); } g_object_unref (G_OBJECT (driver)); - test_run_until_disconnected (connection, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (connection), NULL); dbus_g_connection_unref (connection); g_print ("Successfully completed %s\n", argv[0]); diff --git a/test/core/test-variant-recursion.c b/test/core/test-variant-recursion.c index 8a2d36f..dfb8e12 100644 --- a/test/core/test-variant-recursion.c +++ b/test/core/test-variant-recursion.c @@ -9,6 +9,7 @@ #include <glib-object.h> #include <dbus/dbus.h> #include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> #include "test/lib/util.h" @@ -98,7 +99,7 @@ main (int argc, char **argv) g_object_unref (G_OBJECT (proxy)); - test_run_until_disconnected (connection, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (connection), NULL); dbus_g_connection_unref (connection); g_main_loop_unref (loop); diff --git a/test/interfaces/test-client.c b/test/interfaces/test-client.c index 9ec30c7..dcd21a5 100644 --- a/test/interfaces/test-client.c +++ b/test/interfaces/test-client.c @@ -279,7 +279,7 @@ main (int argc, g_object_unref (dp_proxy); - test_run_until_disconnected (connection, NULL); + test_run_until_disconnected (dbus_g_connection_get_connection (connection), NULL); dbus_g_connection_unref (connection); dbus_shutdown (); diff --git a/test/lib/util.c b/test/lib/util.c index ec879b5..e819584 100644 --- a/test/lib/util.c +++ b/test/lib/util.c @@ -25,45 +25,20 @@ #include "util.h" -static void -destroy_cb (DBusGProxy *proxy G_GNUC_UNUSED, - gpointer user_data) -{ - gboolean *disconnected = user_data; - - *disconnected = TRUE; -} - void -test_run_until_disconnected (DBusGConnection *connection, +test_run_until_disconnected (DBusConnection *connection, GMainContext *context) { - gboolean disconnected = FALSE; - DBusGProxy *proxy; - g_printerr ("Disconnecting... "); - dbus_connection_set_exit_on_disconnect (dbus_g_connection_get_connection (connection), - FALSE); + dbus_connection_set_exit_on_disconnect (connection, FALSE); + dbus_connection_close (connection); - /* low-level tests might not have called this yet */ - g_type_init (); - - proxy = dbus_g_proxy_new_for_peer (connection, "/", - "org.freedesktop.DBus.Peer"); - g_signal_connect (G_OBJECT (proxy), "destroy", G_CALLBACK (destroy_cb), - &disconnected); - - dbus_connection_close (dbus_g_connection_get_connection (connection)); - - while (!disconnected) + while (dbus_connection_get_is_connected (connection)) { g_printerr ("."); g_main_context_iteration (context, TRUE); } - g_signal_handlers_disconnect_by_func (proxy, destroy_cb, &disconnected); - g_object_unref (proxy); - g_printerr (" disconnected\n"); } diff --git a/test/lib/util.h b/test/lib/util.h index bc6fa60..7f5cb07 100644 --- a/test/lib/util.h +++ b/test/lib/util.h @@ -23,10 +23,10 @@ #ifndef DBUS_GLIB_TEST_UTIL_H -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> +#include <dbus/dbus.h> +#include <glib.h> -void test_run_until_disconnected (DBusGConnection *connection, +void test_run_until_disconnected (DBusConnection *connection, GMainContext *context); #endif |