Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
360e6b9b
Commit
360e6b9b
authored
Apr 22, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt the tests to the new API
darcs-hash:20080422163406-4f0f6-f7918de91cf672838ed1b700ea2507d62e898b54.gz
parent
c92139c8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
29 deletions
+82
-29
agent/test-add-remove-stream.c
agent/test-add-remove-stream.c
+1
-1
agent/test-fallback.c
agent/test-fallback.c
+14
-5
agent/test-fullmode.c
agent/test-fullmode.c
+41
-11
agent/test-mainloop.c
agent/test-mainloop.c
+8
-4
agent/test-poll.c
agent/test-poll.c
+1
-1
agent/test-recv.c
agent/test-recv.c
+1
-1
agent/test-restart.c
agent/test-restart.c
+15
-5
agent/test.c
agent/test.c
+1
-1
No files found.
agent/test-add-remove-stream.c
View file @
360e6b9b
...
...
@@ -60,7 +60,7 @@ main (void)
if
(
!
nice_address_set_from_string
(
&
addr
,
"127.0.0.1"
))
g_assert_not_reached
();
agent
=
nice_agent_new
(
&
factory
);
agent
=
nice_agent_new
(
&
factory
,
NULL
,
NICE_COMPATIBILITY_ID19
);
nice_agent_add_local_address
(
agent
,
&
addr
);
g_assert
(
nice_agent_add_stream
(
agent
,
1
)
==
1
);
...
...
agent/test-fallback.c
View file @
360e6b9b
...
...
@@ -236,6 +236,16 @@ static int run_fallback_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress
g_assert
(
ls_id
>
0
);
g_assert
(
rs_id
>
0
);
/* 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
);
nice_agent_attach_recv
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
1
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: run mainloop until local candidates are ready
* (see timer_cb() above) */
if
(
global_lagent_gathering_done
!=
TRUE
||
...
...
@@ -343,12 +353,11 @@ int main (void)
nice_udp_bsd_socket_factory_init
(
&
udpfactory
);
/* step: create the agents L and R */
lagent
=
nice_agent_new
(
&
udpfactory
);
ragent
=
nice_agent_new
(
&
udpfactory
);
lagent
=
nice_agent_new
(
&
udpfactory
,
g_main_loop_get_context
(
global_mainloop
),
NICE_COMPATIBILITY_ID19
);
ragent
=
nice_agent_new
(
&
udpfactory
,
g_main_loop_get_context
(
global_mainloop
),
NICE_COMPATIBILITY_ID19
);
/* step: attach to mainloop (needed to register the fds) */
nice_agent_main_context_attach
(
lagent
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
1
);
nice_agent_main_context_attach
(
ragent
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: add a timer to catch state changes triggered by signals */
timer_id
=
g_timeout_add
(
30000
,
timer_cb
,
NULL
);
...
...
agent/test-fullmode.c
View file @
360e6b9b
...
...
@@ -237,6 +237,16 @@ static int run_full_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *bas
g_assert
(
ls_id
>
0
);
g_assert
(
rs_id
>
0
);
/* 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
);
nice_agent_attach_recv
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
1
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: run mainloop until local candidates are ready
* (see timer_cb() above) */
if
(
global_lagent_gathering_done
!=
TRUE
||
...
...
@@ -360,6 +370,16 @@ static int run_full_test_delayed_answer (NiceAgent *lagent, NiceAgent *ragent, N
g_assert
(
ls_id
>
0
);
g_assert
(
rs_id
>
0
);
/* 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
);
nice_agent_attach_recv
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
1
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: run mainloop until local candidates are ready
* (see timer_cb() above) */
if
(
global_lagent_gathering_done
!=
TRUE
||
...
...
@@ -494,6 +514,12 @@ static int run_full_test_wrong_password (NiceAgent *lagent, NiceAgent *ragent, N
g_assert
(
ls_id
>
0
);
g_assert
(
rs_id
>
0
);
/* 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
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: run mainloop until local candidates are ready
* (see timer_cb() above) */
if
(
global_lagent_gathering_done
!=
TRUE
||
...
...
@@ -603,6 +629,12 @@ static int run_full_test_control_conflict (NiceAgent *lagent, NiceAgent *ragent,
g_assert
(
ls_id
>
0
);
g_assert
(
rs_id
>
0
);
/* 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
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: run mainloop until local candidates are ready
* (see timer_cb() above) */
if
(
global_lagent_gathering_done
!=
TRUE
||
...
...
@@ -695,12 +727,10 @@ int main (void)
nice_udp_bsd_socket_factory_init
(
&
udpfactory
);
/* step: create the agents L and R */
lagent
=
nice_agent_new
(
&
udpfactory
);
ragent
=
nice_agent_new
(
&
udpfactory
);
/* step: attach to mainloop (needed to register the fds) */
nice_agent_main_context_attach
(
lagent
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
1
);
nice_agent_main_context_attach
(
ragent
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
lagent
=
nice_agent_new
(
&
udpfactory
,
g_main_loop_get_context
(
global_mainloop
),
NICE_COMPATIBILITY_ID19
);
ragent
=
nice_agent_new
(
&
udpfactory
,
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
);
...
...
agent/test-mainloop.c
View file @
360e6b9b
...
...
@@ -69,18 +69,23 @@ main (void)
NiceAgent
*
agent
;
NiceAddress
addr
;
NiceUDPSocketFactory
factory
;
guint
stream
;
nice_address_init
(
&
addr
);
g_type_init
();
g_thread_init
(
NULL
);
loop
=
g_main_loop_new
(
NULL
,
FALSE
);
nice_udp_fake_socket_factory_init
(
&
factory
);
agent
=
nice_agent_new
(
&
factory
);
agent
=
nice_agent_new
(
&
factory
,
g_main_loop_get_context
(
loop
),
NICE_COMPATIBILITY_ID19
);
nice_address_set_ipv4
(
&
addr
,
0x7f000001
);
nice_agent_add_local_address
(
agent
,
&
addr
);
nice_agent_add_stream
(
agent
,
1
);
stream
=
nice_agent_add_stream
(
agent
,
1
);
// attach to default main context
nice_agent_main_context_attach
(
agent
,
NULL
,
recv_cb
,
GUINT_TO_POINTER
(
42
));
nice_agent_attach_recv
(
agent
,
stream
,
NICE_COMPONENT_TYPE_RTP
,
g_main_loop_get_context
(
loop
),
recv_cb
,
GUINT_TO_POINTER
(
42
));
{
NiceUDPSocket
*
sock
;
...
...
@@ -95,7 +100,6 @@ main (void)
nice_udp_fake_socket_push_recv
(
sock
,
&
addr
,
6
,
"
\x80
hello"
);
}
loop
=
g_main_loop_new
(
NULL
,
FALSE
);
g_main_loop_run
(
loop
);
g_object_unref
(
agent
);
...
...
agent/test-poll.c
View file @
360e6b9b
...
...
@@ -88,7 +88,7 @@ main (void)
g_assert_not_reached
();
nice_udp_fake_socket_factory_init
(
&
factory
);
agent
=
nice_agent_new
(
&
factory
);
agent
=
nice_agent_new
(
&
factory
,
NULL
,
NICE_COMPATIBILITY_ID19
);
nice_agent_add_local_address
(
agent
,
&
addr
);
nice_agent_add_stream
(
agent
,
1
);
...
...
agent/test-recv.c
View file @
360e6b9b
...
...
@@ -58,7 +58,7 @@ main (void)
nice_udp_fake_socket_factory_init
(
&
factory
);
/* set up agent */
agent
=
nice_agent_new
(
&
factory
);
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
);
...
...
agent/test-restart.c
View file @
360e6b9b
...
...
@@ -233,6 +233,17 @@ static int run_restart_test (NiceAgent *lagent, NiceAgent *ragent, NiceAddress *
g_assert
(
ls_id
>
0
);
g_assert
(
rs_id
>
0
);
/* 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
);
nice_agent_attach_recv
(
lagent
,
ls_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
1
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
nice_agent_attach_recv
(
ragent
,
rs_id
,
NICE_COMPONENT_TYPE_RTCP
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: run mainloop until local candidates are ready
* (see timer_cb() above) */
if
(
global_lagent_gathering_done
!=
TRUE
||
...
...
@@ -386,12 +397,11 @@ int main (void)
nice_udp_bsd_socket_factory_init
(
&
udpfactory
);
/* step: create the agents L and R */
lagent
=
nice_agent_new
(
&
udpfactory
);
ragent
=
nice_agent_new
(
&
udpfactory
);
lagent
=
nice_agent_new
(
&
udpfactory
,
g_main_loop_get_context
(
global_mainloop
),
NICE_COMPATIBILITY_ID19
);
ragent
=
nice_agent_new
(
&
udpfactory
,
g_main_loop_get_context
(
global_mainloop
),
NICE_COMPATIBILITY_ID19
);
/* step: attach to mainloop (needed to register the fds) */
nice_agent_main_context_attach
(
lagent
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
1
);
nice_agent_main_context_attach
(
ragent
,
g_main_loop_get_context
(
global_mainloop
),
cb_nice_recv
,
(
gpointer
)
2
);
/* step: add a timer to catch state changes triggered by signals */
timer_id
=
g_timeout_add
(
30000
,
timer_cb
,
NULL
);
...
...
agent/test.c
View file @
360e6b9b
...
...
@@ -64,7 +64,7 @@ main (void)
g_assert
(
nice_address_set_from_string
(
&
addr_remote
,
"192.168.0.2"
));
nice_address_set_port
(
&
addr_remote
,
2345
);
agent
=
nice_agent_new
(
&
factory
);
agent
=
nice_agent_new
(
&
factory
,
NULL
,
NICE_COMPATIBILITY_ID19
);
g_assert
(
agent
->
local_addresses
==
NULL
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment