Commit 18d0c4ad authored by jehan's avatar jehan

improve message tester for file transfer

parent b6496cbf
......@@ -361,8 +361,8 @@ void FileTransferChatMessageModifier::processResponseFromPostFile (const belle_h
fileTransferContent->setContentType(ContentType::FileTransfer);
fileTransferContent->setFileContent(fileContent);
message->removeContent(*fileContent);
message->addContent(*fileTransferContent);
message->getPrivate()->removeContent(*fileContent);
message->getPrivate()->addContent(*fileTransferContent);
message->getPrivate()->setState(ChatMessage::State::FileTransferDone);
releaseHttpRequest();
......
......@@ -533,6 +533,7 @@ void transfer_message_base2(LinphoneCoreManager* marie, LinphoneCoreManager* pau
/* wait for a long time in case the DNS SRV resolution takes times - it should be immediate though */
if (BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1,55000))) {
compare_files(send_filepath, receive_filepath);
}
}
}
......@@ -1587,6 +1588,8 @@ void crash_during_file_transfer(void) {
/* Create a new core and check that the message stored in the saved database is in the not delivered state */
linphone_core_manager_restart(pauline, TRUE);
linphone_core_set_file_transfer_server(pauline->lc, "https://www.linphone.org:444/lft.php");
//BC_ASSERT_TRUE(wait_for(pauline->lc, pauline->lc, &pauline->stat.number_of_LinphoneRegistrationOk, 1));
chat_room = linphone_core_get_chat_room(pauline->lc, marie->identity);
......@@ -1596,9 +1599,36 @@ void crash_during_file_transfer(void) {
msg_list = linphone_chat_room_get_history(chat_room, 0);
LinphoneChatMessage *sent_msg = (LinphoneChatMessage *)bctbx_list_get_data(msg_list);
BC_ASSERT_EQUAL((int)linphone_chat_message_get_state(sent_msg), (int)LinphoneChatMessageStateNotDelivered, int, "%d");
//resend
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(sent_msg);
linphone_chat_message_cbs_set_file_transfer_send(cbs, tester_file_transfer_send);
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
linphone_chat_message_send(sent_msg);
if (BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1, 60000))) {
linphone_core_manager_stop(marie);
/* Create a new core and check that the message stored in the saved database is in the not delivered state */
linphone_core_manager_restart(marie, TRUE);
LinphoneChatRoom *marie_room = linphone_core_get_chat_room(marie->lc, pauline->identity);
bctbx_list_t *msg_list_2 = linphone_chat_room_get_history(marie_room,1);
BC_ASSERT_PTR_NOT_NULL(msg_list_2);
LinphoneChatMessage *recv_msg = (LinphoneChatMessage *)msg_list_2->data;
LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(recv_msg);
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_message_cbs_set_file_transfer_recv(cbs, file_transfer_received);
linphone_chat_message_cbs_set_file_transfer_progress_indication(cbs, file_transfer_progress_indication);
linphone_chat_message_download_file(recv_msg);
/* wait for a long time in case the DNS SRV resolution takes times - it should be immediate though */
if (BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1,55000))) {
BC_ASSERT_PTR_NULL(linphone_chat_message_get_external_body_url(recv_msg));
}
bctbx_list_free_with_data(msg_list_2, (bctbx_list_free_func)linphone_chat_message_unref);
}
}
bctbx_list_free_with_data(msg_list, (bctbx_list_free_func)linphone_chat_message_unref);
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
......
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