mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-19 12:08:11 +00:00
tester: update presence tests
This commit is contained in:
parent
943d2702e2
commit
b3ab985b0a
3 changed files with 17 additions and 17 deletions
|
|
@ -1,4 +1,4 @@
|
|||
liblinphone_tester@sip.example.org secret liblinphone_tester +331234567890
|
||||
liblinphone_tester@sip.example.org secret liblinphone_tester +33123456789
|
||||
liblinphone_tester@auth.example.org secret
|
||||
liblinphone_tester@auth1.example.org secret
|
||||
tester@sip.example.org secret
|
||||
|
|
|
|||
|
|
@ -689,7 +689,7 @@ static void long_term_presence_inexistent_friend(void) {
|
|||
}
|
||||
|
||||
static void long_term_presence_phone_alias(void) {
|
||||
long_term_presence_base("sip:+331234567890@sip.example.org", TRUE, "sip:liblinphone_tester@sip.example.org");
|
||||
long_term_presence_base("sip:+33123456789@sip.example.org", TRUE, "sip:liblinphone_tester@sip.example.org");
|
||||
}
|
||||
|
||||
static const char* random_phone_number(void) {
|
||||
|
|
@ -718,7 +718,7 @@ static void long_term_presence_list(void) {
|
|||
LinphoneFriend *f1, *f2;
|
||||
LinphoneFriendList* friends;
|
||||
const LinphonePresenceModel *presence;
|
||||
const char *phone_number = "+331234567890";
|
||||
const char *phone_number = "+33123456789";
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
|
||||
enable_publish(pauline, FALSE);
|
||||
enable_deflate_content_encoding(pauline, FALSE);
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) {
|
|||
} else {
|
||||
ms_error("Unexpected basic status [%i]",linphone_presence_model_get_basic_status(counters->last_received_presence));
|
||||
}
|
||||
for (i=0;i<linphone_presence_model_get_nb_activities(counters->last_received_presence); i++) {
|
||||
for (i=0;counters->last_received_presence&&i<linphone_presence_model_get_nb_activities(counters->last_received_presence); i++) {
|
||||
LinphonePresenceActivity *activity = linphone_presence_model_get_nth_activity(counters->last_received_presence, i);
|
||||
switch (linphone_presence_activity_get_type(activity)) {
|
||||
case LinphonePresenceActivityOffline:
|
||||
|
|
@ -287,49 +287,49 @@ static void simple_subscribe(void) {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
static void simple_subscribe_with_early_notify(void) {
|
||||
|
||||
|
||||
LinphoneCoreManager* marie = presence_linphone_core_manager_new("marie");
|
||||
LinphoneCoreManager* pauline = presence_linphone_core_manager_new("pauline");
|
||||
LinphoneAddress *marie_identity_addr = linphone_address_clone(marie->identity);
|
||||
LpConfig *pauline_lp;
|
||||
|
||||
|
||||
char* pauline_identity=linphone_address_as_string_uri_only(pauline->identity);
|
||||
char* marie_identity;
|
||||
|
||||
|
||||
LinphoneFriend* pauline_s_friend;
|
||||
LinphoneFriend* marie_s_friend=linphone_core_create_friend_with_address(marie->lc,pauline_identity);
|
||||
|
||||
|
||||
pauline_lp = linphone_core_get_config(pauline->lc);
|
||||
lp_config_set_int(pauline_lp,"sip","notify_pending_state",1);
|
||||
|
||||
|
||||
linphone_friend_edit(marie_s_friend);
|
||||
linphone_friend_enable_subscribes(marie_s_friend,TRUE);
|
||||
linphone_friend_done(marie_s_friend);
|
||||
linphone_core_add_friend(marie->lc,marie_s_friend);
|
||||
ms_free(pauline_identity);
|
||||
|
||||
|
||||
|
||||
|
||||
/*to simulate pending state.*/
|
||||
|
||||
linphone_address_set_port(marie_identity_addr,0);
|
||||
marie_identity=linphone_address_as_string_uri_only(marie_identity_addr);
|
||||
pauline_s_friend=linphone_core_create_friend_with_address(pauline->lc,marie_identity);
|
||||
linphone_core_add_friend(pauline->lc,pauline_s_friend);
|
||||
|
||||
|
||||
ms_free(marie_identity);
|
||||
|
||||
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_NotifyPresenceReceived,1));
|
||||
BC_ASSERT_EQUAL(linphone_friend_get_subscription_state(marie_s_friend), LinphoneSubscriptionPending,int, "%d");
|
||||
|
||||
|
||||
wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnline,marie->stat.number_of_LinphonePresenceActivityOnline+1);
|
||||
|
||||
|
||||
BC_ASSERT_EQUAL(marie->stat.number_of_NotifyPresenceReceived,2, int, "%d");
|
||||
|
||||
|
||||
linphone_friend_unref(marie_s_friend);
|
||||
linphone_friend_unref(pauline_s_friend);
|
||||
linphone_address_unref(marie_identity_addr);
|
||||
linphone_core_manager_destroy(marie);
|
||||
|
||||
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ static void subscribe_presence_forked(void){
|
|||
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_NewSubscriptionRequest,1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_NewSubscriptionRequest,1, 2000));
|
||||
|
||||
|
||||
/*we should get only one notify*/
|
||||
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,2, 2000));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue