forked from mirrors/linphone-iphone
Improved tester and fixed flexisip file transfer message rewrite test
This commit is contained in:
parent
ecf0caa54f
commit
9fff00eef2
3 changed files with 58 additions and 34 deletions
|
|
@ -725,17 +725,18 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
char *send_filepath = ms_strdup_printf("%s/images/nowebcamCIF.jpg", bc_tester_read_dir_prefix);
|
||||
char *receive_filepath = ms_strdup_printf("%s/receive_file.dump", bc_tester_writable_dir_prefix);
|
||||
|
||||
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_init( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_init( "pauline_rc");
|
||||
|
||||
linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_core_manager_start(marie, "marie_rc", TRUE);
|
||||
|
||||
linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml");
|
||||
linphone_core_manager_start(pauline, "pauline_rc", TRUE);
|
||||
|
||||
reset_counters(&marie->stat);
|
||||
reset_counters(&pauline->stat);
|
||||
|
||||
linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_core_refresh_registers(marie->lc);
|
||||
//TODO: remove the next two lines once linphone core will send the header automatically
|
||||
linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml");
|
||||
linphone_core_refresh_registers(pauline->lc);
|
||||
|
||||
file_to_send = fopen(send_filepath, "rb");
|
||||
fseek(file_to_send, 0, SEEK_END);
|
||||
file_size = ftell(file_to_send);
|
||||
|
|
@ -766,7 +767,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
|
||||
linphone_chat_message_cbs_set_file_transfer_send(cbs, file_transfer_send);
|
||||
linphone_chat_room_send_chat_message(chat_room,message);
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1));
|
||||
fclose(file_to_send);
|
||||
if (marie->stat.last_received_chat_message ) {
|
||||
cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
|
||||
|
|
@ -774,7 +775,7 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
|
|||
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
|
||||
linphone_chat_message_download_file(marie->stat.last_received_chat_message);
|
||||
}
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageExtBodyReceived,1));
|
||||
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageFileTransferDone,1));
|
||||
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
|
||||
|
|
@ -817,13 +818,18 @@ static void send_file_transfer_message_using_external_body_url(LinphoneCoreManag
|
|||
}
|
||||
|
||||
static void file_transfer_message_external_body_to_external_body_client(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_init( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_init( "pauline_rc");
|
||||
|
||||
linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_core_manager_start(marie, "marie_rc", TRUE);
|
||||
|
||||
linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_core_manager_start(pauline, "pauline_rc", TRUE);
|
||||
|
||||
reset_counters(&marie->stat);
|
||||
reset_counters(&pauline->stat);
|
||||
|
||||
linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp");
|
||||
|
||||
linphone_core_refresh_registers(marie->lc);
|
||||
linphone_core_refresh_registers(pauline->lc);
|
||||
|
||||
|
|
@ -834,17 +840,18 @@ static void file_transfer_message_external_body_to_external_body_client(void) {
|
|||
}
|
||||
|
||||
static void file_transfer_message_external_body_to_rcs_client(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
|
||||
LinphoneCoreManager* marie = linphone_core_manager_init( "marie_rc");
|
||||
LinphoneCoreManager* pauline = linphone_core_manager_init( "pauline_rc");
|
||||
|
||||
linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_core_manager_start(marie, "marie_rc", TRUE);
|
||||
|
||||
linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml");
|
||||
linphone_core_manager_start(pauline, "pauline_rc", TRUE);
|
||||
|
||||
reset_counters(&marie->stat);
|
||||
reset_counters(&pauline->stat);
|
||||
|
||||
linphone_proxy_config_set_custom_header(marie->lc->default_proxy, "Accept", "application/sdp");
|
||||
linphone_core_refresh_registers(marie->lc);
|
||||
//TODO: remove the next two lines once linphone core will send the header automatically
|
||||
linphone_proxy_config_set_custom_header(pauline->lc->default_proxy, "Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml");
|
||||
linphone_core_refresh_registers(pauline->lc);
|
||||
|
||||
send_file_transfer_message_using_external_body_url(marie, pauline);
|
||||
|
||||
linphone_core_manager_destroy(marie);
|
||||
|
|
|
|||
|
|
@ -230,6 +230,9 @@ typedef struct _LinphoneCallTestParams {
|
|||
bool_t sdp_simulate_error;
|
||||
} LinphoneCallTestParams;
|
||||
|
||||
|
||||
LinphoneCoreManager* linphone_core_manager_init(const char* rc_file);
|
||||
void linphone_core_manager_start(LinphoneCoreManager *mgr, const char* rc_file, int check_for_proxies);
|
||||
LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_for_proxies);
|
||||
LinphoneCoreManager* linphone_core_manager_new(const char* rc_file);
|
||||
void linphone_core_manager_stop(LinphoneCoreManager *mgr);
|
||||
|
|
|
|||
|
|
@ -224,11 +224,9 @@ LinphoneCoreManager *get_manager(LinphoneCore *lc){
|
|||
return manager;
|
||||
}
|
||||
|
||||
LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_for_proxies) {
|
||||
LinphoneCoreManager* linphone_core_manager_init(const char* rc_file) {
|
||||
LinphoneCoreManager* mgr= ms_new0(LinphoneCoreManager,1);
|
||||
LinphoneProxyConfig* proxy;
|
||||
char *rc_path = NULL;
|
||||
int proxy_count;
|
||||
mgr->number_of_cunit_error_at_creation = CU_get_number_of_failures();
|
||||
mgr->v_table.registration_state_changed=registration_state_changed;
|
||||
mgr->v_table.auth_info_requested=auth_info_requested;
|
||||
|
|
@ -253,11 +251,6 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_f
|
|||
if (rc_file) rc_path = ms_strdup_printf("rcfiles/%s", rc_file);
|
||||
mgr->lc=configure_lc_from(&mgr->v_table, bc_tester_read_dir_prefix, rc_path, mgr);
|
||||
linphone_core_manager_check_accounts(mgr);
|
||||
/*CU_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count);*/
|
||||
if (check_for_proxies && rc_file) /**/
|
||||
proxy_count=ms_list_size(linphone_core_get_proxy_config_list(mgr->lc));
|
||||
else
|
||||
proxy_count=0;
|
||||
|
||||
manager_count++;
|
||||
|
||||
|
|
@ -276,7 +269,22 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_f
|
|||
linphone_core_set_record_file(mgr->lc,recordpath);
|
||||
ms_free(recordpath);
|
||||
}
|
||||
|
||||
if (rc_path) ms_free(rc_path);
|
||||
|
||||
return mgr;
|
||||
}
|
||||
|
||||
void linphone_core_manager_start(LinphoneCoreManager *mgr, const char* rc_file, int check_for_proxies) {
|
||||
LinphoneProxyConfig* proxy;
|
||||
int proxy_count;
|
||||
|
||||
/*CU_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count);*/
|
||||
if (check_for_proxies && rc_file) /**/
|
||||
proxy_count=ms_list_size(linphone_core_get_proxy_config_list(mgr->lc));
|
||||
else
|
||||
proxy_count=0;
|
||||
|
||||
if (proxy_count){
|
||||
#define REGISTER_TIMEOUT 20 /* seconds */
|
||||
int success = wait_for_until(mgr->lc,NULL,&mgr->stat.number_of_LinphoneRegistrationOk,
|
||||
|
|
@ -293,12 +301,18 @@ LinphoneCoreManager* linphone_core_manager_new2(const char* rc_file, int check_f
|
|||
mgr->identity = linphone_address_new(linphone_proxy_config_get_identity(proxy));
|
||||
linphone_address_clean(mgr->identity);
|
||||
}
|
||||
if (rc_path) ms_free(rc_path);
|
||||
return mgr;
|
||||
}
|
||||
|
||||
LinphoneCoreManager* linphone_core_manager_new( const char* rc_file) {
|
||||
return linphone_core_manager_new2(rc_file, TRUE);
|
||||
LinphoneCoreManager *manager = linphone_core_manager_init(rc_file);
|
||||
linphone_core_manager_start(manager, rc_file, TRUE);
|
||||
return manager;
|
||||
}
|
||||
|
||||
LinphoneCoreManager* linphone_core_manager_new2( const char* rc_file, int check_for_proxies) {
|
||||
LinphoneCoreManager *manager = linphone_core_manager_init(rc_file);
|
||||
linphone_core_manager_start(manager, rc_file, check_for_proxies);
|
||||
return manager;
|
||||
}
|
||||
|
||||
void linphone_core_manager_stop(LinphoneCoreManager *mgr){
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue