Fix some group chat testers.

This commit is contained in:
Ghislain MARY 2018-01-25 16:55:01 +01:00
parent b80aff9c55
commit 8f24505766
3 changed files with 15 additions and 22 deletions

View file

@ -46,6 +46,12 @@ public:
// Do not insert the client group chat room in database, the migration will do it
}
void onChatRoomDeleteRequested (const shared_ptr<AbstractChatRoom> &chatRoom) override {
L_Q();
q->getCore()->deleteChatRoom(q->getSharedFromThis());
setState(AbstractChatRoom::State::Deleted);
}
void sendChatMessage (const shared_ptr<ChatMessage> &chatMessage) override {
ProxyChatRoomPrivate::sendChatMessage(chatMessage);
const char *specs = linphone_core_get_linphone_specs(chatMessage->getCore()->getCCore());

View file

@ -59,16 +59,6 @@ static void chat_room_participant_removed (LinphoneChatRoom *cr, const LinphoneE
manager->stat.number_of_participants_removed++;
}
static void chat_room_message_received (LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
LinphoneCore *core = linphone_chat_room_get_core(cr);
LinphoneCoreManager *manager = (LinphoneCoreManager *)linphone_core_get_user_data(core);
if (linphone_chat_message_get_file_transfer_information(msg) || linphone_chat_message_get_external_body_url(msg)) {
manager->stat.number_of_LinphoneMessageReceivedWithFile++;
} else {
manager->stat.number_of_LinphoneMessageReceived++;
}
}
static void chat_room_state_changed (LinphoneChatRoom *cr, LinphoneChatRoomState newState) {
LinphoneCore *core = linphone_chat_room_get_core(cr);
LinphoneCoreManager *manager = (LinphoneCoreManager *)linphone_core_get_user_data(core);
@ -114,7 +104,6 @@ static void core_chat_room_state_changed (LinphoneCore *core, LinphoneChatRoom *
linphone_chat_room_cbs_set_participant_removed(cbs, chat_room_participant_removed);
linphone_chat_room_cbs_set_state_changed(cbs, chat_room_state_changed);
linphone_chat_room_cbs_set_subject_changed(cbs, chat_room_subject_changed);
linphone_chat_room_cbs_set_message_received(cbs, chat_room_message_received);
}
}
@ -1743,8 +1732,8 @@ static void group_chat_room_migrate_from_basic_to_client_fail (void) {
// Check that the group chat room creation fails and that a fallback to a basic chat room is done
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationPending, initialMarieStats.number_of_LinphoneChatRoomStateCreationPending + 1, 10000));
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreationFailed, initialMarieStats.number_of_LinphoneChatRoomStateCreationFailed + 1, 10000));
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_LinphoneChatRoomStateCreated, initialMarieStats.number_of_LinphoneChatRoomStateCreated + 1, 10000));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneChatRoomStateCreationFailed, initialMarieStats.number_of_LinphoneChatRoomStateCreationFailed, int, "%d");
BC_ASSERT_EQUAL(linphone_chat_room_get_nb_participants(marieCr), 1, int, "%d");
BC_ASSERT_TRUE(linphone_chat_room_get_capabilities(marieCr) & LinphoneChatRoomCapabilitiesBasic);
bctbx_list_free_with_data(participantsAddresses, (bctbx_list_free_func)linphone_address_unref);
@ -1909,8 +1898,8 @@ static void group_chat_donot_room_migrate_from_basic_chat_room (void) {
}
// Clean db from chat room
linphone_core_manager_delete_chat_room(marie, marieCr, coresList);
linphone_core_manager_delete_chat_room(pauline, paulineCr, coresList);
linphone_core_delete_chat_room(marie->lc, marieCr);
linphone_core_delete_chat_room(pauline->lc, paulineCr);
bctbx_list_free(coresList);
bctbx_list_free(coresManagerList);

View file

@ -339,19 +339,17 @@ void linphone_core_manager_configure (LinphoneCoreManager *mgr) {
linphone_core_set_user_certificates_path(mgr->lc,bc_tester_get_writable_dir_prefix());
/*for now, we need the periodical updates facility to compute bandwidth measurements correctly during tests*/
linphone_core_enable_send_call_stats_periodical_updates(mgr->lc, TRUE);
LinphoneConfig *config = linphone_core_get_config(mgr->lc);
linphone_config_set_string(config, "storage", "backend", "sqlite3");
linphone_config_set_string(config, "storage", "uri", mgr->database_path);
}
static void configure_random_database_path (LinphoneCoreManager *mgr) {
LinphoneConfig *config = linphone_core_get_config(mgr->lc);
static void generate_random_database_path (LinphoneCoreManager *mgr) {
char random_id[32];
belle_sip_random_token(random_id, sizeof random_id);
char *database_path_format = bctbx_strdup_printf("linphone_%s.db", random_id);
mgr->database_path = bc_tester_file(database_path_format);
linphone_config_set_string(config, "storage", "backend", "sqlite3");
linphone_config_set_string(config, "storage", "uri", mgr->database_path);
bctbx_free(database_path_format);
}
@ -393,8 +391,8 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file, c
manager_count++;
generate_random_database_path(mgr);
linphone_core_manager_configure(mgr);
configure_random_database_path(mgr);
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop