diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-01-31 19:42:36 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-02-01 12:06:49 +0000 |
commit | dbfd20b0d78e5cdd1ef7ab005d3894c62748b671 (patch) | |
tree | a2316a4deaf3918557fb6860b3dbe3ef9452dea2 | |
parent | 2615205676777cea11a6f2cd3bdf88ccc049b504 (diff) | |
download | telepathy-glib-dbfd20b0d78e5cdd1ef7ab005d3894c62748b671.tar.gz |
tp_tests_connection_assert_disconnect_succeeds: add
This calls Disconnect(), runs the main loop and asserts that it worked.
This can be used to supersede most calls to
tp_cli_connection_run_disconnect(), which is going away in Telepathy 1.0.
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45459
-rw-r--r-- | tests/lib/util.c | 18 | ||||
-rw-r--r-- | tests/lib/util.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/lib/util.c b/tests/lib/util.c index 648be0293..978b199c7 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -12,6 +12,8 @@ #include "tests/lib/util.h" +#include <telepathy-glib/connection.h> + #include <glib/gstdio.h> #include <string.h> @@ -453,3 +455,19 @@ _tp_create_local_socket (TpSocketAddressType address_type, g_object_unref (effective_address); return address_gvalue; } + +void +tp_tests_connection_assert_disconnect_succeeds (TpConnection *connection) +{ + GAsyncResult *result = NULL; + GError *error = NULL; + gboolean ok; + + tp_connection_disconnect_async (connection, tp_tests_result_ready_cb, + &result); + tp_tests_run_until_result (&result); + ok = tp_connection_disconnect_finish (connection, result, error); + g_assert_no_error (error); + g_assert (ok); + g_object_unref (result); +} diff --git a/tests/lib/util.h b/tests/lib/util.h index af033b844..d0428ac87 100644 --- a/tests/lib/util.h +++ b/tests/lib/util.h @@ -71,4 +71,6 @@ GValue *_tp_create_local_socket (TpSocketAddressType address_type, void _tp_destroy_socket_control_list (gpointer data); +void tp_tests_connection_assert_disconnect_succeeds (TpConnection *connection); + #endif /* #ifndef __TP_TESTS_LIB_UTIL_H__ */ |