mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
add new test
This commit is contained in:
parent
dae216855c
commit
59b7e88d7d
3 changed files with 42 additions and 5 deletions
|
|
@ -54,8 +54,7 @@ static void presence_process_dialog_terminated(void *ctx, const belle_sip_dialog
|
|||
SalOp* op= (SalOp*)ctx;
|
||||
if (op->dialog) {
|
||||
if (belle_sip_dialog_is_server(op->dialog)){
|
||||
/*in an incoming SUBSCRIBE*/
|
||||
ms_message("Presence unsubscribe received from [%s]",sal_op_get_from(op));
|
||||
ms_message("Incoming subscribtion from [%s] terminated",sal_op_get_from(op));
|
||||
op->base.root->callbacks.subscribe_presence_closed(op, sal_op_get_from(op));
|
||||
}
|
||||
set_or_update_dialog(op, NULL);
|
||||
|
|
@ -142,9 +141,8 @@ static void presence_response_event(void *op_base, const belle_sip_response_even
|
|||
}
|
||||
/* no break */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void presence_process_timeout(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
ms_error("presence_process_timeout not implemented yet");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -247,8 +247,9 @@ void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, SalOp *op){
|
|||
void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op){
|
||||
if (ms_list_find(lf->insubs, op)){
|
||||
sal_op_release(op);
|
||||
lf->insubs = ms_list_remove(lf->insubs, op);
|
||||
}
|
||||
lf->insubs = ms_list_remove(lf->insubs, op);
|
||||
|
||||
}
|
||||
|
||||
static void linphone_friend_unsubscribe(LinphoneFriend *lf){
|
||||
|
|
|
|||
|
|
@ -390,6 +390,43 @@ static void subscribe_presence_forked(){
|
|||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
static void subscribe_presence_expired(){
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager* pauline1 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
LinphoneFriend *lf;
|
||||
MSList *lcs = NULL;
|
||||
|
||||
lcs = ms_list_append(lcs, marie->lc);
|
||||
lcs = ms_list_append(lcs, pauline1->lc);
|
||||
|
||||
lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 10);
|
||||
|
||||
lf = linphone_core_create_friend(marie->lc);
|
||||
linphone_friend_set_address(lf, pauline1->identity);
|
||||
linphone_friend_enable_subscribes(lf, TRUE);
|
||||
|
||||
linphone_core_add_friend(marie->lc, lf);
|
||||
linphone_friend_unref(lf);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_NewSubscriptionRequest,1, 5000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,1, 2000));
|
||||
|
||||
lf = linphone_core_find_friend(pauline1->lc, marie->identity);
|
||||
BC_ASSERT_PTR_NOT_NULL(lf->insubs);
|
||||
/*marie comes offline suddenly*/
|
||||
linphone_core_set_network_reachable(marie->lc, FALSE);
|
||||
/*after a certain time, pauline shall see the incoming SUBSCRIBE expired*/
|
||||
wait_for_list(lcs,NULL, 0, 11000);
|
||||
|
||||
BC_ASSERT_PTR_NULL(lf->insubs);
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline1);
|
||||
|
||||
ms_list_free(lcs);
|
||||
}
|
||||
|
||||
|
||||
#define USE_PRESENCE_SERVER 0
|
||||
|
||||
#if USE_PRESENCE_SERVER
|
||||
|
|
@ -521,6 +558,7 @@ test_t presence_tests[] = {
|
|||
{ "Presence information", presence_information },
|
||||
{ "App managed presence failure", subscribe_failure_handle_by_app },
|
||||
{ "Presence SUBSCRIBE forked", subscribe_presence_forked },
|
||||
{ "Presence SUBSCRIBE expired", subscribe_presence_expired },
|
||||
#if USE_PRESENCE_SERVER
|
||||
{ "Subscribe with late publish", test_subscribe_notify_publish },
|
||||
{ "Forked subscribe with late publish", test_forked_subscribe_notify_publish },
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue