Commit a83a8e04 authored by Nicolas Michon's avatar Nicolas Michon

Tests: use core manager for core creation

parent 145b8dae
......@@ -35,8 +35,8 @@ static int get_codec_position(const MSList *l, const char *mime_type, int rate){
/*check basic things about codecs at startup: order and enablement*/
static void start_with_no_config(void){
LinphoneCore *lc=linphone_factory_create_core_2(linphone_factory_get(), NULL, NULL, NULL, NULL, system_context);
const MSList *codecs=linphone_core_get_audio_codecs(lc);
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc", FALSE);
const MSList *codecs=linphone_core_get_audio_codecs(mgr->lc);
int opus_codec_pos;
int speex_codec_pos=get_codec_position(codecs, "speex", 8000);
int speex16_codec_pos=get_codec_position(codecs, "speex", 16000);
......@@ -45,12 +45,12 @@ static void start_with_no_config(void){
if (opus_codec_pos!=-1) BC_ASSERT_EQUAL(opus_codec_pos,0,int, "%d");
BC_ASSERT_LOWER(speex16_codec_pos,speex_codec_pos,int,"%d");
pt=linphone_core_find_payload_type(lc, "speex", 16000, 1);
pt=linphone_core_find_payload_type(mgr->lc, "speex", 16000, 1);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt) {
BC_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt));
BC_ASSERT_TRUE(linphone_core_payload_type_enabled(mgr->lc, pt));
}
linphone_core_unref(lc);
linphone_core_manager_destroy(mgr);
}
static void check_payload_type_numbers(LinphoneCall *call1, LinphoneCall *call2, int expected_number){
......
......@@ -124,13 +124,13 @@ static void linphone_version_test(void){
}
static void core_init_test(void) {
LinphoneCore* lc;
lc = linphone_factory_create_core_2(linphone_factory_get(),NULL,NULL,NULL, NULL, system_context);
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
/* until we have good certificates on our test server... */
linphone_core_verify_server_certificates(lc,FALSE);
if (BC_ASSERT_PTR_NOT_NULL(lc)) {
linphone_core_unref(lc);
linphone_core_verify_server_certificates(mgr->lc, FALSE);
if (BC_ASSERT_PTR_NOT_NULL(mgr->lc)) {
//linphone_core_unref(mgr->lc);
linphone_core_manager_destroy(mgr);
}
}
......@@ -150,11 +150,11 @@ static void linphone_address_test(void) {
}
static void core_sip_transport_test(void) {
LinphoneCore* lc;
LCSipTransports tr;
lc = linphone_factory_create_core_2(linphone_factory_get(),NULL,NULL,NULL, NULL, system_context);
LinphoneCoreManager* mgr = linphone_core_manager_new2(NULL, FALSE);
LinphoneCore* lc = mgr->lc;
if (!BC_ASSERT_PTR_NOT_NULL(lc)) return;
linphone_core_get_sip_transports(lc,&tr);
linphone_core_get_sip_transports(mgr->lc,&tr);
BC_ASSERT_EQUAL(tr.udp_port,5060, int, "%d"); /*default config*/
BC_ASSERT_EQUAL(tr.tcp_port,5060, int, "%d"); /*default config*/
......@@ -172,7 +172,7 @@ static void core_sip_transport_test(void) {
BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tcp_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d");
BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tls_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d");
linphone_core_unref(lc);
linphone_core_manager_destroy(mgr);
}
static void linphone_interpret_url_test(void) {
......@@ -181,7 +181,9 @@ static void linphone_interpret_url_test(void) {
LinphoneAddress* address;
LinphoneProxyConfig *proxy_config;
char *tmp;
lc = linphone_factory_create_core_2(linphone_factory_get(),NULL,NULL,NULL, NULL, system_context);
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
lc = mgr->lc;
if (!BC_ASSERT_PTR_NOT_NULL( lc )) return;
proxy_config =linphone_core_create_proxy_config(lc);
......@@ -222,7 +224,7 @@ static void linphone_interpret_url_test(void) {
linphone_address_unref(address);
ms_free(tmp);
linphone_core_unref(lc);
linphone_core_manager_destroy(mgr);
}
static void linphone_lpconfig_from_buffer(void){
......@@ -373,11 +375,10 @@ void linphone_proxy_config_is_server_config_changed_test(void) {
}
static void chat_room_test(void) {
LinphoneCore* lc;
lc = linphone_factory_create_core_2(linphone_factory_get(),NULL,NULL,NULL, NULL, system_context);
if (!BC_ASSERT_PTR_NOT_NULL(lc)) return;
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room_from_uri(lc,"sip:toto@titi.com"));
linphone_core_unref(lc);
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
if (!BC_ASSERT_PTR_NOT_NULL(mgr->lc)) return;
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room_from_uri(mgr->lc,"sip:toto@titi.com"));
linphone_core_manager_destroy(mgr);
}
static void devices_reload_test(void) {
......
......@@ -357,7 +357,9 @@ end:
}
static void friends_sqlite_store_lot_of_friends(void) {
LinphoneCore* lc = linphone_factory_create_core_2(linphone_factory_get(), NULL, NULL, NULL, NULL, system_context);
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
LinphoneCore* lc = mgr->lc;
sqlite3 *db;
int i;
char* errmsg = NULL;
......@@ -423,11 +425,12 @@ static void friends_sqlite_store_lot_of_friends(void) {
ret = sqlite3_exec(db,"END",0,0,&errmsg);
BC_ASSERT_TRUE(ret ==SQLITE_OK);
sqlite3_close(db);
linphone_core_unref(lc);
(void)lc;
linphone_core_manager_destroy(mgr);
}
static void friends_sqlite_find_friend_in_lot_of_friends(void) {
LinphoneCore* lc = linphone_factory_create_core_2(linphone_factory_get(), NULL, NULL, NULL, NULL, system_context);
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
sqlite3 *db;
int i;
char* errmsg = NULL;
......@@ -507,7 +510,7 @@ static void friends_sqlite_find_friend_in_lot_of_friends(void) {
ret = sqlite3_exec(db,"END",0,0,&errmsg);
BC_ASSERT_TRUE(ret ==SQLITE_OK);
sqlite3_close(db);
linphone_core_unref(lc);
linphone_core_manager_destroy(mgr);
}
typedef struct _LinphoneCardDAVStats {
......
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