Commit f2c052bb authored by Pekka Pessi's avatar Pekka Pessi
Browse files

Fixed soa_clone().

darcs-hash:20050911232707-65a35-d9c9b5646bfe871fee1607cf1ad8f3eee580b738.gz
parent 926be89d
......@@ -270,7 +270,7 @@ soa_session_t *soa_clone(soa_session_t *parent_ss,
{
soa_session_t *ss;
if (parent_ss == NULL || root == NULL);
if (parent_ss == NULL || root == NULL)
return (void)(errno = EFAULT), NULL;
ss = su_home_new(parent_ss->ss_actions->sizeof_soa_session);
......
......@@ -220,16 +220,18 @@ int test_static_offer_answer(struct context *ctx)
BEGIN();
int n;
soa_session_t *a, *b;
char const *caps = NONE, *offer = NONE, *answer = NONE;
int capslen = -1, offerlen = -1, answerlen = -1;
char const a[] =
char const a_caps[] =
"v=0\r\n"
"o=left 219498671 2 IN IP4 127.0.0.2\r\n"
"c=IN IP4 127.0.0.2\r\n"
"m=audio 5004 RTP/AVP 0 8\r\n";
char const b[] =
char const b_caps[] =
"v=0\n"
"o=right 93298573265 321974 IN IP4 127.0.0.3\n"
"c=IN IP4 127.0.0.3\n"
......@@ -239,55 +241,61 @@ int test_static_offer_answer(struct context *ctx)
n = soa_set_capability_sdp(ctx->synch.a, "m=audio 5004 RTP/AVP 0 8", -1);
TEST(n, 1);
n = soa_set_capability_sdp(ctx->synch.a, a, strlen(a)); TEST(n, 1);
n = soa_set_capability_sdp(ctx->synch.a, a_caps, strlen(a_caps)); TEST(n, 1);
n = soa_get_capability_sdp(ctx->synch.a, &caps, &capslen); TEST(n, 1);
TEST_1(caps != NULL && caps != NONE);
TEST_1(capslen > 0);
n = soa_set_capability_sdp(ctx->synch.b, b, strlen(b)); TEST(n, 1);
n = soa_set_capability_sdp(ctx->synch.b, b_caps, strlen(b_caps)); TEST(n, 1);
n = soa_get_local_sdp(ctx->synch.a, &offer, &offerlen); TEST(n, 0);
TEST_1(a = soa_clone(ctx->synch.a, ctx->root, ctx));
TEST_1(b = soa_clone(ctx->synch.b, ctx->root, ctx));
n = soa_generate_offer(ctx->synch.a, 1, test_completed); TEST(n, 0);
n = soa_get_local_sdp(a, &offer, &offerlen); TEST(n, 0);
n = soa_get_local_sdp(ctx->synch.a, &offer, &offerlen); TEST(n, 1);
n = soa_generate_offer(a, 1, test_completed); TEST(n, 0);
n = soa_get_local_sdp(a, &offer, &offerlen); TEST(n, 1);
TEST_1(offer != NULL && offer != NONE);
n = soa_set_remote_sdp(ctx->synch.b, offer, offerlen); TEST(n, 1);
n = soa_set_remote_sdp(b, offer, offerlen); TEST(n, 1);
n = soa_get_local_sdp(ctx->synch.b, &answer, &answerlen); TEST(n, 0);
n = soa_get_local_sdp(b, &answer, &answerlen); TEST(n, 0);
n = soa_generate_answer(ctx->synch.b, test_completed); TEST(n, 0);
n = soa_generate_answer(b, test_completed); TEST(n, 0);
TEST_VOID(soa_activate(ctx->synch.b, NULL));
TEST_VOID(soa_activate(b, NULL));
n = soa_get_local_sdp(ctx->synch.b, &answer, &answerlen); TEST(n, 1);
n = soa_get_local_sdp(b, &answer, &answerlen); TEST(n, 1);
TEST_1(answer != NULL && answer != NONE);
n = soa_set_remote_sdp(ctx->synch.a, answer, -1); TEST(n, 1);
n = soa_set_remote_sdp(a, answer, -1); TEST(n, 1);
n = soa_process_answer(ctx->synch.a, test_completed); TEST(n, 0);
n = soa_process_answer(a, test_completed); TEST(n, 0);
TEST_VOID(soa_activate(ctx->synch.a, NULL));
TEST_VOID(soa_activate(a, NULL));
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_audio_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_video_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_image_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_chat_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_audio_active(a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_video_active(a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_image_active(a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_chat_active(a));
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_remote_audio_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_video_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_image_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_chat_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_SENDRECV == soa_is_remote_audio_active(a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_video_active(a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_image_active(a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_chat_active(a));
TEST_VOID(soa_terminate(ctx->synch.a, NULL));
TEST_VOID(soa_terminate(a, NULL));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_audio_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_audio_active(ctx->synch.a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_audio_active(a));
TEST_1(SOA_ACTIVE_DISABLED == soa_is_remote_audio_active(a));
TEST_VOID(soa_terminate(ctx->synch.b, NULL));
TEST_VOID(soa_terminate(b, NULL));
TEST_VOID(soa_destroy(a));
TEST_VOID(soa_destroy(b));
END();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment