[Telepathy-commits] [telepathy-glib/master] message-mixin test: wait for idle events to be delivered before asserting that we have received messages
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Dec 18 10:41:31 PST 2008
20080415184151-53eee-c9070b83d61942b4bf4305625a46d61bc1b7e525.gz
---
tests/dbus/message-mixin.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/tests/dbus/message-mixin.c b/tests/dbus/message-mixin.c
index 1a56f7a..9ca5c4f 100644
--- a/tests/dbus/message-mixin.c
+++ b/tests/dbus/message-mixin.c
@@ -278,6 +278,10 @@ main (int argc,
tp_cli_channel_type_text_run_send (chan, -1,
TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, "Hello, world!",
&error, NULL);
+ /* wait for pending events to be delivered */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
MYASSERT_NO_ERROR (error);
MYASSERT (sent_count == 1, ": %u != 1", sent_count);
MYASSERT (received_count == 1, ": %u != 1", received_count);
@@ -314,6 +318,10 @@ main (int argc,
tp_cli_channel_type_text_run_send (chan, -1,
TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION, "drinks coffee",
&error, NULL);
+ /* wait for pending events to be delivered */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
MYASSERT_NO_ERROR (error);
MYASSERT (sent_count == 1, ": %u != 1", sent_count);
MYASSERT (received_count == 1, ": %u != 1", received_count);
@@ -351,6 +359,10 @@ main (int argc,
tp_cli_channel_type_text_run_send (chan, -1,
TP_CHANNEL_TEXT_MESSAGE_TYPE_NOTICE, "Printer on fire",
&error, NULL);
+ /* wait for pending events to be delivered */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
MYASSERT_NO_ERROR (error);
MYASSERT (sent_count == 1, ": %u != 1", sent_count);
MYASSERT (received_count == 1, ": %u != 1", received_count);
@@ -439,6 +451,10 @@ main (int argc,
&token, &error, NULL);
MYASSERT_NO_ERROR (error);
+ /* wait for pending events to be delivered */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
g_print ("Sent message, got token '%s'\n", token);
g_free (token);
@@ -540,6 +556,10 @@ main (int argc,
&token, &error, NULL);
MYASSERT_NO_ERROR (error);
+ /* wait for pending events to be delivered */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
g_print ("Sent message, got token '%s'\n", token);
g_free (token);
@@ -626,6 +646,10 @@ main (int argc,
&token, &error, NULL);
MYASSERT_NO_ERROR (error);
+ /* wait for pending events to be delivered */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
g_print ("Sent message, got token '%s'\n", token);
g_free (token);
@@ -713,6 +737,10 @@ main (int argc,
&token, &error, NULL);
MYASSERT_NO_ERROR (error);
+ /* wait for pending events to be delivered */
+ while (g_main_context_pending (NULL))
+ g_main_context_iteration (NULL, FALSE);
+
g_print ("Sent message, got token '%s'\n", token);
g_free (token);
--
1.5.6.5
More information about the Telepathy-commits
mailing list