diff options
author | Olivier Crete <olivier.crete@collabora.co.uk> | 2008-04-26 01:02:00 +0000 |
---|---|---|
committer | Olivier Crete <olivier.crete@collabora.co.uk> | 2008-04-26 01:02:00 +0000 |
commit | 182b8526cf614d10147ee05a1163ed89c4417726 (patch) | |
tree | 526e6889021ae634a896d359a848e4d9adf114a9 | |
parent | 2a07eb44b89b50239f88efbad28cead2bcfb712f (diff) | |
download | libnice-182b8526cf614d10147ee05a1163ed89c4417726.tar.gz |
Make the tests use the gather_candidates() api and make them pass.
darcs-hash:20080426010239-3e2dc-2439c01282eb42a9c545d22bdda11220eac655fe.gz
-rw-r--r-- | agent/test-fallback.c | 4 | ||||
-rw-r--r-- | agent/test-fullmode.c | 12 | ||||
-rw-r--r-- | agent/test-mainloop.c | 1 | ||||
-rw-r--r-- | agent/test-poll.c | 6 | ||||
-rw-r--r-- | agent/test-recv.c | 8 | ||||
-rw-r--r-- | agent/test-restart.c | 2 | ||||
-rw-r--r-- | agent/test.c | 13 | ||||
-rw-r--r-- | nice/libnice.sym | 2 |
8 files changed, 37 insertions, 11 deletions
diff --git a/agent/test-fallback.c b/agent/test-fallback.c index da7e3df..023c4b8 100644 --- a/agent/test-fallback.c +++ b/agent/test-fallback.c @@ -232,6 +232,9 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress g_assert (ls_id > 0); g_assert (rs_id > 0); + nice_agent_gather_candidates (lagent, ls_id); + nice_agent_gather_candidates (ragent, rs_id); + /* step: attach to mainloop (needed to register the fds) */ nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, g_main_loop_get_context (global_mainloop), cb_nice_recv, (gpointer)1); @@ -355,6 +358,7 @@ int main (void) g_main_loop_get_context (global_mainloop), NICE_COMPATIBILITY_ID19); + /* step: add a timer to catch state changes triggered by signals */ timer_id = g_timeout_add (30000, timer_cb, NULL); diff --git a/agent/test-fullmode.c b/agent/test-fullmode.c index 672f278..bf009ee 100644 --- a/agent/test-fullmode.c +++ b/agent/test-fullmode.c @@ -243,6 +243,9 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas g_assert (ls_id > 0); g_assert (rs_id > 0); + nice_agent_gather_candidates (lagent, ls_id); + nice_agent_gather_candidates (ragent, rs_id); + /* step: attach to mainloop (needed to register the fds) */ nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, g_main_loop_get_context (global_mainloop), cb_nice_recv, (gpointer)1); @@ -370,6 +373,9 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N g_assert (ls_id > 0); g_assert (rs_id > 0); + nice_agent_gather_candidates (lagent, ls_id); + nice_agent_gather_candidates (ragent, rs_id); + /* step: attach to mainloop (needed to register the fds) */ nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, g_main_loop_get_context (global_mainloop), cb_nice_recv, (gpointer)1); @@ -508,6 +514,9 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N g_assert (ls_id > 0); g_assert (rs_id > 0); + nice_agent_gather_candidates (lagent, ls_id); + nice_agent_gather_candidates (ragent, rs_id); + /* step: attach to mainloop (needed to register the fds) */ nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, g_main_loop_get_context (global_mainloop), cb_nice_recv, (gpointer)1); @@ -617,6 +626,9 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent, g_assert (ls_id > 0); g_assert (rs_id > 0); + nice_agent_gather_candidates (lagent, ls_id); + nice_agent_gather_candidates (ragent, rs_id); + /* step: attach to mainloop (needed to register the fds) */ nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, g_main_loop_get_context (global_mainloop), cb_nice_recv, (gpointer)1); diff --git a/agent/test-mainloop.c b/agent/test-mainloop.c index 679958e..e224ffd 100644 --- a/agent/test-mainloop.c +++ b/agent/test-mainloop.c @@ -82,6 +82,7 @@ main (void) nice_address_set_ipv4 (&addr, 0x7f000001); nice_agent_add_local_address (agent, &addr); stream = nice_agent_add_stream (agent, 1); + nice_agent_gather_candidates (agent, stream); // attach to default main context nice_agent_attach_recv (agent, stream, NICE_COMPONENT_TYPE_RTP, diff --git a/agent/test-poll.c b/agent/test-poll.c index e791bcc..e255da0 100644 --- a/agent/test-poll.c +++ b/agent/test-poll.c @@ -77,6 +77,7 @@ main (void) GSList *fds = NULL; GSList *readable; ssize_t w; + guint stream_id; nice_address_init (&addr); g_type_init (); @@ -90,13 +91,14 @@ main (void) nice_udp_fake_socket_factory_init (&factory); agent = nice_agent_new (&factory, NULL, NICE_COMPATIBILITY_ID19); nice_agent_add_local_address (agent, &addr); - nice_agent_add_stream (agent, 1); + stream_id = nice_agent_add_stream (agent, 1); + nice_agent_gather_candidates (agent, stream_id); { GSList *candidates; NiceCandidate *candidate; - candidates = nice_agent_get_local_candidates (agent, 1, 1); + candidates = nice_agent_get_local_candidates (agent, stream_id, 1); candidate = candidates->data; sock = candidate->sockptr; g_slist_free (candidates); diff --git a/agent/test-recv.c b/agent/test-recv.c index f3ece08..6f76484 100644 --- a/agent/test-recv.c +++ b/agent/test-recv.c @@ -50,6 +50,7 @@ main (void) NiceAgent *agent; NiceAddress addr; NiceUDPSocketFactory factory; + guint stream_id; nice_address_init (&addr); g_type_init (); @@ -61,7 +62,8 @@ main (void) agent = nice_agent_new (&factory, NULL, NICE_COMPATIBILITY_ID19); g_assert (nice_address_set_from_string (&addr, "192.168.0.1")); nice_agent_add_local_address (agent, &addr); - nice_agent_add_stream (agent, 1); + stream_id = nice_agent_add_stream (agent, 1); + nice_agent_gather_candidates (agent, stream_id); /* recieve an RTP packet */ @@ -72,12 +74,12 @@ main (void) gchar buf[1024]; GSList *candidates; - candidates = nice_agent_get_local_candidates (agent, 1, 1); + candidates = nice_agent_get_local_candidates (agent, stream_id, 1); candidate = candidates->data; g_slist_free (candidates); sock = candidate->sockptr; nice_udp_fake_socket_push_recv (sock, &addr, 7, "\x80lalala"); - len = nice_agent_recv (agent, candidate->stream_id, + len = nice_agent_recv (agent, stream_id, candidate->component_id, 1024, buf); g_assert (len == 7); g_assert (0 == strncmp (buf, "\x80lalala", 7)); diff --git a/agent/test-restart.c b/agent/test-restart.c index 2d90fa4..3c9fcc8 100644 --- a/agent/test-restart.c +++ b/agent/test-restart.c @@ -231,6 +231,8 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress * g_assert (ls_id > 0); g_assert (rs_id > 0); + nice_agent_gather_candidates (lagent, ls_id); + nice_agent_gather_candidates (ragent, rs_id); /* step: attach to mainloop (needed to register the fds) */ nice_agent_attach_recv (lagent, ls_id, NICE_COMPONENT_TYPE_RTP, diff --git a/agent/test.c b/agent/test.c index 171faad..510945f 100644 --- a/agent/test.c +++ b/agent/test.c @@ -52,6 +52,7 @@ main (void) NiceCandidate *candidate; NiceUDPSocketFactory factory; GSList *candidates; + guint stream_id; nice_address_init (&addr_local); nice_address_init (&addr_remote); @@ -76,10 +77,11 @@ main (void) g_assert (nice_address_equal (agent->local_addresses->data, &addr_local)); /* add a stream */ - nice_agent_add_stream (agent, 1); + stream_id = nice_agent_add_stream (agent, 1); + nice_agent_gather_candidates (agent, stream_id); /* adding a stream should cause host candidates to be generated */ - candidates = nice_agent_get_local_candidates (agent, 1, 1); + candidates = nice_agent_get_local_candidates (agent, stream_id, 1); g_assert (g_slist_length (candidates) == 1); candidate = candidates->data; /* fake socket manager uses incremental port numbers starting at 1 */ @@ -89,14 +91,15 @@ main (void) g_slist_free (candidates); /* add remote candidate */ - nice_agent_add_remote_candidate (agent, 1, 1, NICE_CANDIDATE_TYPE_HOST, + nice_agent_add_remote_candidate (agent, stream_id, 1, + NICE_CANDIDATE_TYPE_HOST, &addr_remote, "username", "password"); - candidates = nice_agent_get_remote_candidates (agent, 1, 1); + candidates = nice_agent_get_remote_candidates (agent, stream_id, 1); g_assert (candidates != NULL); g_assert (g_slist_length (candidates) == 1); candidate = candidates->data; g_assert (nice_address_equal (&(candidate->addr), &addr_remote)); - g_assert (candidate->stream_id == 1); + g_assert (candidate->stream_id == stream_id); g_assert (candidate->component_id == 1); g_assert (candidate->type == NICE_CANDIDATE_TYPE_HOST); g_assert (0 == strcmp (candidate->username, "username")); diff --git a/nice/libnice.sym b/nice/libnice.sym index bd46ce0..8b92c68 100644 --- a/nice/libnice.sym +++ b/nice/libnice.sym @@ -14,8 +14,8 @@ nice_address_to_string nice_agent_add_local_address nice_agent_add_remote_candidate nice_agent_add_stream -nice_agent_gather_candidates nice_agent_attach_recv +nice_agent_gather_candidates nice_agent_get_local_candidates nice_agent_get_local_credentials nice_agent_get_remote_candidates |