diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2010-01-12 22:00:17 -0500 |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2010-02-16 17:38:13 -0500 |
commit | 3348c78f2aff249ac6a44a45566f1d232c87a395 (patch) | |
tree | 2df539b63e21c44f93d5056037e0a246cb3a20de /tests | |
parent | 087c9130ef12a4419e1448724928c578281336ae (diff) | |
download | libnice-3348c78f2aff249ac6a44a45566f1d232c87a395.tar.gz |
Make test-fullmode do the test over the pseudotcp reliable transport
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-fullmode.c | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/tests/test-fullmode.c b/tests/test-fullmode.c index 1a9b5e8..afa1fb4 100644 --- a/tests/test-fullmode.c +++ b/tests/test-fullmode.c @@ -146,6 +146,11 @@ static gboolean timer_cb (gpointer pointer) g_error ("ERROR: test has got stuck, aborting..."); } +static void cb_writable (NiceAgent*agent, guint stream_id, guint component_id) +{ + g_main_loop_quit (global_mainloop); +} + static void cb_nice_recv (NiceAgent *agent, guint stream_id, guint component_id, guint len, gchar *buf, gpointer user_data) { g_debug ("test-fullmode:%s: %p", G_STRFUNC, user_data); @@ -296,8 +301,6 @@ static GSList *priv_get_local_candidate (NiceAgent *agent, guint stream_id, guin return result; } - - static void init_candidate (NiceCandidate *cand) { memset (cand, 0, sizeof(NiceCandidate)); @@ -314,6 +317,7 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas NiceCandidate cdes; GSList *cands, *i; guint ls_id, rs_id; + gint ret; init_candidate (&cdes); @@ -458,7 +462,22 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas /* note: test payload send and receive */ global_ragent_read = 0; - g_assert (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678") == 16); + ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); + if (ret == -1) + { + gboolean reliable = FALSE; + g_object_get (G_OBJECT (lagent), "reliable", &reliable, NULL); + if (reliable) { + gulong signal_handler; + signal_handler = g_signal_connect (G_OBJECT (lagent), + "reliable-transport-writable", G_CALLBACK (cb_writable), NULL); + g_main_loop_run (global_mainloop); + g_signal_handler_disconnect(G_OBJECT (lagent), signal_handler); + + ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); + } + } + g_assert (ret == 16); g_main_loop_run (global_mainloop); g_assert (global_ragent_read == 16); @@ -483,6 +502,7 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N NiceCandidate cdes; GSList *cands; guint ls_id, rs_id; + gint ret; init_candidate (&cdes); @@ -629,7 +649,22 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N /* note: test payload send and receive */ global_ragent_read = 0; - g_assert (nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678") == 16); + ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); + { + gboolean reliable = FALSE; + g_object_get (G_OBJECT (lagent), "reliable", &reliable, NULL); + if (reliable) { + gulong signal_handler; + signal_handler = g_signal_connect (G_OBJECT (lagent), + "reliable-transport-writable", G_CALLBACK (cb_writable), NULL); + g_main_loop_run (global_mainloop); + g_signal_handler_disconnect(G_OBJECT (lagent), signal_handler); + + ret = nice_agent_send (lagent, ls_id, 1, 16, "1234567812345678"); + } + } + global_ragent_read = 0; + g_assert (ret == 16); g_main_loop_run (global_mainloop); g_assert (global_ragent_read == 16); @@ -923,8 +958,8 @@ int main (void) */ /* step: create the agents L and R */ - lagent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY); - ragent = nice_agent_new (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY); + lagent = nice_agent_new_reliable (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY); + ragent = nice_agent_new_reliable (g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY); nice_agent_set_software (lagent, "Test-fullmode, Left Agent"); nice_agent_set_software (ragent, "Test-fullmode, Right Agent"); |