tester: use new macros instead of CUnit ones to get better error logs

This commit is contained in:
Gautier Pelloux-Prayer 2015-05-13 17:38:14 +02:00
parent 5b3c46b0d5
commit 2fced27fe9
25 changed files with 1552 additions and 1556 deletions

3
.gitignore vendored
View file

@ -85,3 +85,6 @@ tester/linphone_log.gz.txt
tools/auto_answer
tools/lp-autoanswer
build/macos/pkg-distribution.xml
tester/record_for_lc_*.wav
tester/record-call_with_file_player.wav

View file

@ -33,6 +33,7 @@ liblinphonetester_la_SOURCES = \
upnp_tester.c \
video_tester.c \
common/bc_tester_utils.c
liblinphonetester_ladir = $(includedir)/linphone
liblinphonetester_la_HEADERS = common/bc_tester_utils.h

File diff suppressed because it is too large Load diff

View file

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdlib.h>
#include "CUnit/Basic.h"
#include "CUnit/Automated.h"
#if WINAPI_FAMILY_PHONE_APP

View file

@ -20,9 +20,10 @@
#ifndef TESTER_UTILS_H
#define TESTER_UTILS_H
#include "CUnit/Basic.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
extern const char *bc_tester_read_dir_prefix;
extern const char *bc_tester_writable_dir_prefix;
@ -31,6 +32,8 @@ extern int bc_printf_verbosity_info;
extern int bc_printf_verbosity_error;
typedef void (*test_function_t)(void);
typedef int (*init_function_t)(void);
typedef int (*cleanup_function_t)(void);
typedef int (*test_suite_function_t)(const char *name);
typedef struct {
@ -40,8 +43,8 @@ typedef struct {
typedef struct {
const char *name;
CU_InitializeFunc init_func;
CU_CleanupFunc cleanup_func;
init_function_t init_func;
cleanup_function_t cleanup_func;
int nb_tests;
test_t *tests;
} test_suite_t;
@ -85,63 +88,62 @@ int bc_tester_suite_index(const char *suite_name);
*/
char * bc_tester_res(const char *name);
/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions */
#define BC_ASSERT_EQUAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_PASS(msg) CU_assertImplementation(CU_TRUE, __LINE__, ("CU_PASS(" #msg ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE)
#define BC_ASSERT_FATAL(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE)
#define BC_TEST(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE)
#define BC_TEST_FATAL(value) CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE)
#define BC_ASSERT_TRUE(value) CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE(" #value ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_TRUE_FATAL(value) CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE_FATAL(" #value ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_FALSE(value) CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE(" #value ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_FALSE_FATAL(value) CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE_FATAL(" #value ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_EQUAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_NOT_EQUAL(actual, expected) CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_EQUAL(actual, expected) CU_assertImplementation(((const void*)(actual) == (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) CU_assertImplementation(((const void*)(actual) == (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) CU_assertImplementation(((const void*)(actual) != (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation(((const void*)(actual) != (const void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_NULL(value) CU_assertImplementation((NULL == (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL(" #value")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_NULL_FATAL(value) CU_assertImplementation((NULL == (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_PTR_NOT_NULL(value) CU_assertImplementation((NULL != (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL(" #value")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) CU_assertImplementation((NULL != (const void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_STRING_EQUAL(actual, expected) CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE)
#define BC_ASSERT_GREATER(actual, expected) CU_assertImplementation(((actual) >= (expected)), __LINE__, ("CU_ASSERT_GREATER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
#define BC_ASSERT_LOWER(actual, expected) CU_assertImplementation(((actual) <= (expected)), __LINE__, ("CU_ASSERT_LOWER(" #actual "," #expected ")"), __FILE__, "", CU_FALSE)
/*Add some custom defines with logs in case of fail*/
#define BC_ASSERT_EQUAL_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_EQUAL(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " = " #expected " but was " type_format " != " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
#define BC_ASSERT_GREATER_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_GREATER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " >= " #expected " but was " type_format " < " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
#define BC_ASSERT_LOWER_WITH_TYPE(actual, expected, type, type_format) { \
type cactual = (actual), cexpected = (expected); \
if (! BC_ASSERT_LOWER(cactual, cexpected)) { \
bc_tester_printf(bc_printf_verbosity_error, "%s:%d - Expected " #actual " <= " #expected " but was " type_format " > " type_format "\n", __FILE__, __LINE__, cactual, cexpected); \
} \
}
/*Redefine the CU_... macros WITHOUT final ';' semicolon, to allow IF conditions and with smarter error message */
extern int CU_assertImplementation(int bValue,
unsigned int uiLine,
const char *strCondition,
const char *strFile,
const char *strFunction,
int bFatal);
#define _BC_ASSERT(pred, format, fatal) CU_assertImplementation(pred, __LINE__, format, __FILE__, "", fatal)
#define _BC_ASSERT_PRED(name, pred, actual, expected, type, fatal, ...) \
do { \
char format[4096] = {0}; \
type cactual = (actual); \
type cexpected = (expected); \
snprintf(format, 4096, name "(" #actual ", " #expected ") - " __VA_ARGS__); \
_BC_ASSERT(pred, format, fatal); \
} while (0)
#define BC_PASS(msg) _BC_ASSERT(TRUE, "BC_PASS(" #msg ").", FALSE)
#define BC_FAIL(msg) _BC_ASSERT(FALSE, "BC_FAIL(" #msg ").", FALSE)
#define BC_ASSERT(value) _BC_ASSERT((value), #value, FALSE)
#define BC_ASSERT_FATAL(value) _BC_ASSERT((value), #value, TRUE)
#define BC_TEST(value) _BC_ASSERT((value), #value, FALSE)
#define BC_TEST_FATAL(value) _BC_ASSERT((value), #value, TRUE)
#define BC_ASSERT_TRUE(value) _BC_ASSERT((value), ("BC_ASSERT_TRUE(" #value ")"), FALSE)
#define BC_ASSERT_TRUE_FATAL(value) _BC_ASSERT((value), ("BC_ASSERT_TRUE_FATAL(" #value ")"), TRUE)
#define BC_ASSERT_FALSE(value) _BC_ASSERT(!(value), ("BC_ASSERT_FALSE(" #value ")"), FALSE)
#define BC_ASSERT_FALSE_FATAL(value) _BC_ASSERT(!(value), ("BC_ASSERT_FALSE_FATAL(" #value ")"), TRUE)
#define BC_ASSERT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL", ((cactual) == (cexpected)), actual, expected, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
#define BC_ASSERT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_EQUAL_FATAL", ((cactual) == (cexpected)), actual, expected, type, TRUE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
#define BC_ASSERT_NOT_EQUAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL", ((cactual) != (cexpected)), actual, expected, type, FALSE, "Expected NOT " type_format " but it was.", cexpected)
#define BC_ASSERT_NOT_EQUAL_FATAL(actual, expected, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), actual, expected, type, TRUE, "Expected NOT " type_format " but it was.", cexpected)
#define BC_ASSERT_PTR_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected %p but was %p.", cexpected, cactual)
#define BC_ASSERT_PTR_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_EQUAL_FATAL", ((cactual) == (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected %p but was %p.", cexpected, cactual)
#define BC_ASSERT_PTR_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, FALSE, "Expected NOT %p but it was.", cexpected)
#define BC_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_EQUAL_FATAL", ((cactual) != (cexpected)), (const void*)(actual), (const void*)(expected), const void*, TRUE, "Expected NOT %p but it was.", cexpected)
#define BC_ASSERT_PTR_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL", ((cactual) == (cexpected)), (const void*)(value), (const void*)NULL, const void*, FALSE, "Expected NULL but was %p.", cactual)
#define BC_ASSERT_PTR_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NULL_FATAL", ((cactual) == (cexpected)), (const void*)(value), (const void*)NULL, const void*, TRUE, "Expected NULL but was %p.", cactual)
#define BC_ASSERT_PTR_NOT_NULL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL", ((cactual) != (cexpected)), (const void*)(value), (const void*)NULL, const void*, FALSE, "Expected NOT NULL but it was.")
#define BC_ASSERT_PTR_NOT_NULL_FATAL(value) _BC_ASSERT_PRED("BC_ASSERT_PTR_NOT_NULL_FATAL", ((cactual) != (cexpected)), (const void*)(value), (const void*)NULL, const void*, TRUE, "Expected NOT NULL but it was.")
#define BC_ASSERT_STRING_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected %s but was %s.", cexpected, cactual)
#define BC_ASSERT_STRING_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_EQUAL_FATAL", !(strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected %s but was %s.", cexpected, cactual)
#define BC_ASSERT_STRING_NOT_EQUAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, FALSE, "Expected NOT %s but it was.", cexpected)
#define BC_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) _BC_ASSERT_PRED("BC_ASSERT_STRING_NOT_EQUAL_FATAL", (strcmp((const char*)(cactual), (const char*)(cexpected))), actual, expected, const char*, TRUE, "Expected NOT %s but it was.", cexpected)
#define BC_ASSERT_NSTRING_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but was %*s.", (int)(count), cexpected, (int)(count), cactual)
#define BC_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_EQUAL_FATAL", !(strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but was %*s.", (int)count, cexpected, (int)count, cactual)
#define BC_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, FALSE, "Expected %*s but it was.", (int)count, cexpected)
#define BC_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) _BC_ASSERT_PRED("BC_ASSERT_NSTRING_NOT_EQUAL_FATAL", (strncmp((const char*)(cactual), (const char*)(cexpected), (size_t)(count))), actual, expected, const char*, TRUE, "Expected %*s but it was.", (int)count, cexpected)
#define BC_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
#define BC_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) <= fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
#define BC_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, FALSE, "Expected %f but was %f.", cexpected, cactual)
#define BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) _BC_ASSERT_PRED("BC_ASSERT_DOUBLE_NOT_EQUAL_FATAL", ((fabs((double)(cactual) - (cexpected)) > fabs((double)(granularity)))), actual, expected, double, TRUE, "Expected %f but was %f.", cexpected, cactual)
/*Custom defines*/
#define BC_ASSERT_GREATER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_GREATER", ((cactual) >= (cexpected)), actual, lower, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
#define BC_ASSERT_LOWER(actual, lower, type, type_format) _BC_ASSERT_PRED("BC_ASSERT_LOWER", ((cactual) <= (cexpected)), actual, lower, type, FALSE, "Expected " type_format " but was " type_format ".", cexpected, cactual)
#ifdef __cplusplus
}

View file

@ -43,12 +43,12 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm
linphone_core_set_use_rfc2833_for_dtmf(pauline->lc, use_rfc2833);
linphone_core_set_use_info_for_dtmf(pauline->lc, use_sipinfo);
CU_ASSERT_TRUE(call(pauline,marie));
BC_ASSERT_TRUE(call(pauline,marie));
marie_call = linphone_core_get_current_call(marie->lc);
CU_ASSERT_PTR_NOT_NULL(marie_call);
BC_ASSERT_PTR_NOT_NULL(marie_call);
if (!marie_call) return;
if (dtmf != '\0') {
@ -56,7 +56,7 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm
linphone_call_send_dtmf(marie_call, dtmf);
/*wait for the DTMF to be received from pauline*/
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev+1, 10000));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev+1, 10000));
expected = ms_strdup_printf("%c", dtmf);
}
@ -66,29 +66,29 @@ void send_dtmf_base(bool_t use_rfc2833, bool_t use_sipinfo, char dtmf, char* dtm
linphone_call_send_dtmfs(marie_call, dtmf_seq);
/*wait for the DTMF sequence to be received from pauline*/
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev + strlen(dtmf_seq), 10000 + dtmf_delay_ms * strlen(dtmf_seq)));
BC_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &pauline->stat.dtmf_count, dtmf_count_prev + strlen(dtmf_seq), 10000 + dtmf_delay_ms * strlen(dtmf_seq)));
expected = (dtmf!='\0')?ms_strdup_printf("%c%s",dtmf,dtmf_seq):ms_strdup(dtmf_seq);
}
if (expected != NULL) {
CU_ASSERT_PTR_NOT_NULL(pauline->stat.dtmf_list_received);
BC_ASSERT_PTR_NOT_NULL(pauline->stat.dtmf_list_received);
if (pauline->stat.dtmf_list_received) {
CU_ASSERT_STRING_EQUAL(pauline->stat.dtmf_list_received, expected);
BC_ASSERT_STRING_EQUAL(pauline->stat.dtmf_list_received, expected);
}
ms_free(expected);
} else {
CU_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
BC_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
}
}
void send_dtmf_cleanup() {
CU_ASSERT_PTR_NULL(marie_call->dtmfs_timer);
CU_ASSERT_PTR_NULL(marie_call->dtmf_sequence);
BC_ASSERT_PTR_NULL(marie_call->dtmfs_timer);
BC_ASSERT_PTR_NULL(marie_call->dtmf_sequence);
/*just to sleep*/
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallEnd,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallEnd,1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -116,7 +116,7 @@ static void send_dtmfs_sequence_sip_info() {
static void send_dtmfs_sequence_not_ready() {
marie = linphone_core_manager_new( "marie_rc");
CU_ASSERT_EQUAL(linphone_call_send_dtmfs(linphone_core_get_current_call(marie->lc), "123"), -1);
BC_ASSERT_EQUAL(linphone_call_send_dtmfs(linphone_core_get_current_call(marie->lc), "123"), -1, int, "%d");
linphone_core_manager_destroy(marie);
}
@ -127,13 +127,13 @@ static void send_dtmfs_sequence_call_state_changed() {
linphone_call_send_dtmfs(marie_call, "123456789123456789");
/*just after, change call state, and expect DTMF to be canceled*/
linphone_core_pause_call(marie_call->core,marie_call);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPausing,1));
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPausing,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallPaused,1));
/*wait a few time to ensure that no DTMF are received*/
wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000);
CU_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
BC_ASSERT_PTR_NULL(pauline->stat.dtmf_list_received);
send_dtmf_cleanup();
}

View file

@ -17,8 +17,7 @@
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "lpconfig.h"
@ -39,8 +38,8 @@ const char *liblinphone_tester_get_notify_content(void){
void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content){
LinphoneCoreManager *mgr;
CU_ASSERT_PTR_NOT_NULL_FATAL(content);
CU_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_buffer(content))==0);
BC_ASSERT_PTR_NOT_NULL_FATAL(content);
BC_ASSERT_TRUE(strcmp(notify_content,(const char*)linphone_content_get_buffer(content))==0);
mgr=get_manager(lc);
mgr->stat.number_of_NotifyReceived++;
}
@ -55,7 +54,7 @@ void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *lev, Li
linphone_content_set_type(content,"application");
linphone_content_set_subtype(content,"somexml2");
linphone_content_set_buffer(content,notify_content,strlen(notify_content));
ms_message("Subscription state [%s] from [%s]",linphone_subscription_state_to_string(state),from);
ms_free(from);
@ -107,10 +106,10 @@ void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, Linphon
ms_free(from);
switch(state){
case LinphonePublishProgress: counters->number_of_LinphonePublishProgress++; break;
case LinphonePublishOk:
case LinphonePublishOk:
/*make sure custom header access API is working*/
CU_ASSERT_PTR_NOT_NULL(linphone_event_get_custom_header(ev,"From"));
counters->number_of_LinphonePublishOk++;
BC_ASSERT_PTR_NOT_NULL(linphone_event_get_custom_header(ev,"From"));
counters->number_of_LinphonePublishOk++;
break;
case LinphonePublishError: counters->number_of_LinphonePublishError++; break;
case LinphonePublishExpiring: counters->number_of_LinphonePublishExpiring++; break;
@ -118,7 +117,7 @@ void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, Linphon
default:
break;
}
}
static void subscribe_test_declined(void) {
@ -140,16 +139,16 @@ static void subscribe_test_declined(void) {
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,content);
linphone_event_ref(lev);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/
ei=linphone_event_get_error_info(lev);
CU_ASSERT_PTR_NOT_NULL(ei);
BC_ASSERT_PTR_NOT_NULL(ei);
if (ei){
CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603);
CU_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei));
BC_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603, int, "%d");
BC_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei));
}
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
linphone_content_unref(content);
linphone_event_unref(lev);
@ -183,33 +182,33 @@ static void subscribe_test_with_args(bool_t terminated_by_subscriber, RefreshTes
linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content));
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,content);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,1000));
/*make sure marie receives first notification before terminating*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
if (refresh_type==AutoRefresh){
wait_for_list(lcs,NULL,0,6000);
CU_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive);
BC_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive);
}else if (refresh_type==ManualRefresh){
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000));
linphone_event_update_subscribe(lev,NULL);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,2000));
}
if (terminated_by_subscriber){
linphone_event_terminate(lev);
}else{
CU_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev);
BC_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev);
linphone_event_terminate(pauline->lev);
}
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000));
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -223,7 +222,7 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe
LinphoneEvent *lev;
int expires= refresh_type!=NoRefresh ? 4 : 600;
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
if (refresh_type==ManualRefresh){
@ -240,37 +239,37 @@ static void subscribe_test_with_args2(bool_t terminated_by_subscriber, RefreshTe
linphone_event_add_custom_header(lev,"My-Header2","pimpon");
linphone_event_send_subscribe(lev,content);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
/*check good receipt of custom headers*/
CU_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header"),"pouet");
CU_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header2"),"pimpon");
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000));
BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header"),"pouet");
BC_ASSERT_STRING_EQUAL(linphone_event_get_custom_header(pauline->lev,"My-Header2"),"pimpon");
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionActive,1,5000));
/*make sure marie receives first notification before terminating*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,5000));
if (refresh_type==AutoRefresh){
wait_for_list(lcs,NULL,0,6000);
CU_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive);
BC_ASSERT_TRUE(linphone_event_get_subscription_state(pauline->lev)==LinphoneSubscriptionActive);
}else if (refresh_type==ManualRefresh){
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionExpiring,1,4000));
linphone_event_update_subscribe(lev,NULL);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,2,5000));
}
if (terminated_by_subscriber){
linphone_event_terminate(lev);
}else{
CU_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev);
BC_ASSERT_PTR_NOT_NULL_FATAL(pauline->lev);
linphone_event_terminate(pauline->lev);
}
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,5000));
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -285,7 +284,7 @@ static void subscribe_test_terminated_by_notifier(void){
subscribe_test_with_args(FALSE,NoRefresh);
}
/* Caution: this test does not really check that the subscribe are refreshed, because the core is not managing the expiration of
/* Caution: this test does not really check that the subscribe are refreshed, because the core is not managing the expiration of
* unrefreshed subscribe dialogs. So it is just checking that it is not crashing.
*/
static void subscribe_test_refreshed(void){
@ -320,21 +319,21 @@ static void publish_test_with_args(bool_t refresh, int expires){
linphone_event_send_publish(lev,content);
linphone_event_ref(lev);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
if (!refresh){
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishExpiring,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishExpiring,1,5000));
linphone_event_update_publish(lev,content);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishProgress,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishOk,1,3000));
}else{
}
linphone_event_terminate(lev);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishCleared,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePublishCleared,1,3000));
linphone_event_unref(lev);

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "lpconfig.h"
#include "private.h"
@ -42,13 +41,13 @@ static void subscribe_forking(void) {
lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",expires,content);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_LinphoneSubscriptionIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingInit,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_LinphoneSubscriptionIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionActive,1,1000));
/*make sure marie receives first notification before terminating*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_NotifyReceived,1,1000));
linphone_event_terminate(lev);
@ -72,10 +71,10 @@ static void message_forking(void) {
lcs=ms_list_append(lcs,marie2->lc);
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(pauline);
@ -102,21 +101,21 @@ static void message_forking_with_unreachable_recipients(void) {
linphone_core_set_network_reachable(marie3->lc,FALSE);
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
CU_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0);
CU_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,1000));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0);
BC_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0);
/*marie 2 goes online */
linphone_core_set_network_reachable(marie2->lc,TRUE);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000));
/*wait a long time so that all transactions are expired*/
wait_for_list(lcs,NULL,0,32000);
/*marie 3 goes online now*/
linphone_core_set_network_reachable(marie3->lc,TRUE);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
@ -146,27 +145,27 @@ static void message_forking_with_all_recipients_unreachable(void) {
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageInProgress,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageInProgress,1,5000));
/*flexisip will accept the message with 202 after 16 seconds*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,18000));
CU_ASSERT_TRUE( marie->stat.number_of_LinphoneMessageReceived==0);
CU_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0);
CU_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0);
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneMessageDelivered,1,18000));
BC_ASSERT_TRUE( marie->stat.number_of_LinphoneMessageReceived==0);
BC_ASSERT_TRUE( marie2->stat.number_of_LinphoneMessageReceived==0);
BC_ASSERT_TRUE( marie3->stat.number_of_LinphoneMessageReceived==0);
/*marie 1 goes online */
linphone_core_set_network_reachable(marie->lc,TRUE);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneMessageReceived,1,3000));
/*marie 2 goes online */
linphone_core_set_network_reachable(marie2->lc,TRUE);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneMessageReceived,1,3000));
/*wait a long time so that all transactions are expired*/
wait_for_list(lcs,NULL,0,32000);
/*marie 3 goes online now*/
linphone_core_set_network_reachable(marie3->lc,TRUE);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneMessageReceived,1,3000));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
@ -193,26 +192,26 @@ static void call_forking(void){
linphone_core_invite_address(pauline->lc,marie->identity);
/*pauline should hear ringback*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
/*all devices from Marie should be ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,3000));
/*marie accepts the call on its first device*/
linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
/*other devices should stop ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
@ -237,27 +236,27 @@ static void call_forking_with_urgent_reply(void){
linphone_core_set_user_agent(marie3->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
CU_ASSERT_TRUE(linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionSRTP));
BC_ASSERT_TRUE(linphone_core_media_encryption_supported(pauline->lc,LinphoneMediaEncryptionSRTP));
linphone_core_set_media_encryption(pauline->lc,LinphoneMediaEncryptionSRTP);
linphone_core_set_network_reachable(marie2->lc,FALSE);
linphone_core_set_network_reachable(marie3->lc,FALSE);
linphone_core_invite_address(pauline->lc,marie->identity);
/*pauline should hear ringback, after 5 seconds, when it will retry without SRTP*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,9000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,9000));
/*Marie should be ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
/*marie accepts the call on its first device*/
linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
@ -284,20 +283,20 @@ static void call_forking_cancelled(void){
linphone_core_invite_address(pauline->lc,marie->identity);
/*pauline should hear ringback*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
/*all devices from Marie should be ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
/*pauline finally cancels the call*/
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
/*all devices should stop ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
@ -324,11 +323,11 @@ static void call_forking_declined(bool_t declined_globaly){
linphone_core_invite_address(pauline->lc,marie->identity);
/*pauline should hear ringback*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
/*all devices from Marie should be ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
/*marie1 finally declines the call*/
linphone_core_decline_call(marie->lc,linphone_core_get_current_call(marie->lc),
@ -336,22 +335,22 @@ static void call_forking_declined(bool_t declined_globaly){
);
if (declined_globaly){
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
/*all devices should stop ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
}else{
/*pauline should continue ringing and be able to hear a call taken by marie2 */
linphone_core_accept_call(marie2->lc, linphone_core_get_current_call(marie2->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,2000));
liblinphone_tester_check_rtcp(pauline,marie2);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,3000));
linphone_core_terminate_call(marie2->lc,linphone_core_get_current_call(marie2->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,3000));
}
linphone_core_manager_destroy(pauline);
@ -390,22 +389,22 @@ static void call_forking_with_push_notification_single(void){
linphone_core_set_network_reachable(marie->lc,TRUE);
/*Marie shall receive the call immediately*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000));
/*pauline should hear ringback as well*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
/*marie accepts the call*/
linphone_core_accept_call(marie->lc,linphone_core_get_current_call(marie->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,5000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
liblinphone_tester_check_rtcp(pauline,marie);
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,5000));
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
@ -432,32 +431,32 @@ static void call_forking_with_push_notification_multiple(void){
linphone_core_invite_address(pauline->lc,marie->identity);
/*marie1 will ring*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,5000));
/*pauline should hear ringback as well*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
/*the server is expected to send a push notification to marie2, this will wake up linphone, that will reconnect:*/
linphone_core_set_network_reachable(marie2->lc,TRUE);
/*Marie shall receive the call immediately*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,5000));
/*marie2 accepts the call*/
linphone_core_accept_call(marie2->lc,linphone_core_get_current_call(marie2->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallStreamsRunning,1,1000));
/*call to marie1 should be cancelled*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
liblinphone_tester_check_rtcp(pauline,marie2);
linphone_core_terminate_call(pauline->lc,linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
@ -482,18 +481,18 @@ static void call_forking_not_responded(void){
linphone_core_invite_address(pauline->lc,marie->identity);
/*pauline should hear ringback*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
/*all devices from Marie should be ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallIncomingReceived,1,1000));
/*nobody answers, flexisip should close the call after XX seconds*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,22000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,22000));
/*all devices should stop ringing*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie3->stat.number_of_LinphoneCallEnd,1,1000));
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);
@ -541,10 +540,10 @@ static void early_media_call_forking(void) {
linphone_core_invite_address_with_params(pauline->lc,marie1->identity,params);
linphone_call_params_destroy(params);
CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1);
BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,3000));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia,1, int, "%d");
pauline_call=linphone_core_get_current_call(pauline->lc);
marie1_call=linphone_core_get_current_call(marie1->lc);
@ -552,30 +551,30 @@ static void early_media_call_forking(void) {
/*wait a bit that streams are established*/
wait_for_list(lcs,&dummy,1,6000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60
BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60
&& linphone_call_get_audio_stats(pauline_call)->download_bandwidth<99);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60
&& linphone_call_get_audio_stats(marie1_call)->download_bandwidth<99);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>60
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>60
&& linphone_call_get_audio_stats(marie2_call)->download_bandwidth<99);
linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,3000));
/*marie2 should get her call terminated*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie2->stat.number_of_LinphoneCallEnd,1,1000));
/*wait a bit that streams are established*/
wait_for_list(lcs,&dummy,1,3000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60
BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60
&& linphone_call_get_audio_stats(pauline_call)->download_bandwidth<99 );
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60
&& linphone_call_get_audio_stats(marie1_call)->download_bandwidth<99 );
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallEnd,1,5000));
ms_list_free(lcs);
linphone_core_manager_destroy(marie1);
@ -599,23 +598,23 @@ static void call_with_sips(void){
linphone_core_invite_address(marie->lc,pauline1->identity);
/*marie should hear ringback*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,3000));
/*Only the sips registered device from pauline should ring*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallIncomingReceived,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallIncomingReceived,1,1000));
/*pauline accepts the call */
linphone_core_accept_call(pauline1->lc,linphone_core_get_current_call(pauline1->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallStreamsRunning,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallStreamsRunning,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,1000));
/*pauline2 should not have ring*/
CU_ASSERT_TRUE(pauline2->stat.number_of_LinphoneCallIncomingReceived==0);
BC_ASSERT_TRUE(pauline2->stat.number_of_LinphoneCallIncomingReceived==0);
linphone_core_terminate_call(pauline1->lc,linphone_core_get_current_call(pauline1->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallEnd,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphoneCallEnd,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,3000));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline1);
@ -643,11 +642,11 @@ static void call_with_sips_not_achievable(void){
linphone_address_unref(dest);
/*Call should be rejected by server with 480*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallError,1,6000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallError,1,6000));
ei=linphone_call_get_error_info(call);
CU_ASSERT_PTR_NOT_NULL(ei);
BC_ASSERT_PTR_NOT_NULL(ei);
if (ei){
CU_ASSERT_EQUAL(linphone_error_info_get_reason(ei), LinphoneReasonTemporarilyUnavailable);
BC_ASSERT_EQUAL(linphone_error_info_get_reason(ei), LinphoneReasonTemporarilyUnavailable, int, "%d");
}
linphone_core_manager_destroy(marie);
@ -680,20 +679,20 @@ static void call_with_ipv6(void) {
linphone_core_set_user_agent(marie->lc,"Natted Linphone",NULL);
linphone_core_set_user_agent(pauline->lc,"Natted Linphone",NULL);
CU_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(call(marie,pauline));
pauline_call=linphone_core_get_current_call(pauline->lc);
CU_ASSERT_PTR_NOT_NULL(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if (pauline_call){
/*check that the remote contact is IPv6*/
const char *contact=linphone_call_get_remote_contact(pauline_call);
LinphoneAddress *ct_addr;
CU_ASSERT_PTR_NOT_NULL(contact);
BC_ASSERT_PTR_NOT_NULL(contact);
if (contact){
ct_addr=linphone_address_new(contact);
CU_ASSERT_PTR_NOT_NULL(ct_addr);
BC_ASSERT_PTR_NOT_NULL(ct_addr);
if (ct_addr){
CU_ASSERT_TRUE(strchr(linphone_address_get_domain(ct_addr),':')!=NULL);
BC_ASSERT_TRUE(strchr(linphone_address_get_domain(ct_addr),':')!=NULL);
}
linphone_address_destroy(ct_addr);
}
@ -707,7 +706,7 @@ static void call_with_ipv6(void) {
liblinphone_tester_enable_ipv6(FALSE);
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
@ -727,13 +726,13 @@ static void file_transfer_message_rcs_to_external_body_client(void) {
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);
@ -767,7 +766,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_LinphoneMessageExtBodyReceived,1));
BC_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);
@ -775,12 +774,12 @@ 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_LinphoneMessageFileTransferDone,1));
BC_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);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1);
CU_ASSERT_TRUE(compare_files(send_filepath, receive_filepath));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d");
BC_ASSERT_TRUE(compare_files(send_filepath, receive_filepath));
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -807,29 +806,29 @@ static void send_file_transfer_message_using_external_body_url(LinphoneCoreManag
linphone_chat_message_set_external_body_url(message, "https://www.linphone.org:444//tmp/54ec58280ace9_c30709218df8eaba61d1.jpg");
linphone_chat_room_send_chat_message(chat_room, message);
CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
if (marie->stat.last_received_chat_message) {
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));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageExtBodyReceived, 1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress, 1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived, 1);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress, 1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived, 1, int, "%d");
}
static void file_transfer_message_external_body_to_external_body_client(void) {
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_core_refresh_registers(marie->lc);
linphone_core_refresh_registers(pauline->lc);
@ -842,13 +841,13 @@ 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_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);
@ -865,13 +864,13 @@ static void dos_module_trigger(void) {
int number_of_messge_to_send = 100;
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_rc");
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
to = linphone_address_as_string(marie->identity);
chat_room = linphone_core_create_chat_room(pauline->lc,to);
do {
char msg[128];
sprintf(msg, "Flood message number %i", i);
@ -880,15 +879,15 @@ static void dos_module_trigger(void) {
i++;
} while (i < number_of_messge_to_send);
// At this point we should be banned for a minute
ms_usleep(90000000); // Wait 90 seconds to ensure we are not banned anymore
CU_ASSERT_TRUE(marie->stat.number_of_LinphoneMessageReceived < number_of_messge_to_send);
BC_ASSERT_TRUE(marie->stat.number_of_LinphoneMessageReceived < number_of_messge_to_send);
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
linphone_chat_room_send_message(chat_room, "This one should pass through");
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived, 1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived, 1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
@ -28,7 +27,6 @@
#include <gtk/gtk.h>
#endif
static FILE * log_file = NULL;
#ifdef ANDROID

View file

@ -136,7 +136,7 @@ static FILE* gzuncompress(const char* filepath) {
memset(buffer, 0, strlen(buffer));
}
fclose(output);
CU_ASSERT_EQUAL(gzclose(file), Z_OK);
BC_ASSERT_EQUAL(gzclose(file), Z_OK, int, "%d");
ret=fopen(newname, "rb");
ms_free(newname);
return ret;
@ -169,7 +169,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
uint32_t timediff = 0;
FILE *file = NULL;
CU_ASSERT_PTR_NOT_NULL(filepath);
BC_ASSERT_PTR_NOT_NULL(filepath);
if (filepath != NULL) {
int line_count = 0;
@ -186,10 +186,10 @@ static time_t check_file(LinphoneCoreManager* mgr) {
#else
file = fopen(filepath, "rb");
#endif
CU_ASSERT_PTR_NOT_NULL(file);
BC_ASSERT_PTR_NOT_NULL(file);
if (!file) return 0;
// 1) expect to find folder name in filename path
CU_ASSERT_PTR_NOT_NULL(strstr(filepath, bc_tester_writable_dir_prefix));
BC_ASSERT_PTR_NOT_NULL(strstr(filepath, bc_tester_writable_dir_prefix));
// 2) check file contents
while (getline(&line, &line_size, file) != -1) {
@ -205,13 +205,13 @@ static time_t check_file(LinphoneCoreManager* mgr) {
if (strptime(date, "%Y-%m-%d %H:%M:%S", &tm_curr) != NULL) {
tm_curr.tm_isdst = -1; // LOL
log_time = mktime(&tm_curr);
CU_ASSERT_TRUE(log_time >= time_prev);
BC_ASSERT_TRUE(log_time >= time_prev);
time_prev = log_time;
}
}
#endif
}
CU_ASSERT_TRUE(line_count > 25);
BC_ASSERT_TRUE(line_count > 25);
free(line);
fclose(file);
ms_free(filepath);
@ -220,7 +220,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
timediff = labs((long int)log_time - (long int)cur_time);
(void)timediff;
#ifndef WIN32
CU_ASSERT_TRUE( timediff <= 1 );
BC_ASSERT_TRUE( timediff <= 1 );
if( !(timediff <= 1) ){
char buffers[2][128] = {{0}};
strftime(buffers[0], sizeof(buffers[0]), "%Y-%m-%d %H:%M:%S", localtime(&log_time));
@ -242,7 +242,7 @@ static time_t check_file(LinphoneCoreManager* mgr) {
static void collect_files_disabled() {
LinphoneCoreManager* marie = setup(FALSE);
CU_ASSERT_PTR_NULL(linphone_core_compress_log_collection(marie->lc));
BC_ASSERT_PTR_NULL(linphone_core_compress_log_collection(marie->lc));
collect_cleanup(marie);
}
@ -282,7 +282,7 @@ static void logCollectionUploadStateChangedCb(LinphoneCore *lc, LinphoneCoreLogC
break;
case LinphoneCoreLogCollectionUploadStateDelivered:
counters->number_of_LinphoneCoreLogCollectionUploadStateDelivered++;
CU_ASSERT_TRUE(strlen(info)>0)
BC_ASSERT_GREATER(strlen(info), 0, int, "%d");
break;
case LinphoneCoreLogCollectionUploadStateNotDelivered:
counters->number_of_LinphoneCoreLogCollectionUploadStateNotDelivered++;
@ -302,7 +302,7 @@ static void upload_collected_traces() {
while (--waiting) ms_error("(test error)Waiting %d...", waiting);
linphone_core_compress_log_collection(marie->lc);
linphone_core_upload_log_collection(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1));
BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,1));
/*try 2 times*/
waiting=100;
@ -310,7 +310,7 @@ static void upload_collected_traces() {
while (--waiting) ms_error("(test error)Waiting %d...", waiting);
linphone_core_compress_log_collection(marie->lc);
linphone_core_upload_log_collection(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2));
BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneCoreLogCollectionUploadStateDelivered,2));
collect_cleanup(marie);
}

View file

@ -17,8 +17,7 @@
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
@ -54,7 +53,7 @@ void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMess
} else if (linphone_chat_message_get_external_body_url(message)) {
counters->number_of_LinphoneMessageExtBodyReceived++;
if (message_external_body_url) {
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_external_body_url(message),message_external_body_url);
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_external_body_url(message),message_external_body_url);
message_external_body_url=NULL;
}
}
@ -199,10 +198,10 @@ static void text_message(void) {
reset_counters(&pauline->stat);
}
linphone_chat_room_send_message(chat_room,"Bla bla bla bla");
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d");
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -225,12 +224,12 @@ static void text_message_within_dialog(void) {
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
}
CU_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(call(marie,pauline));
linphone_chat_room_send_message(chat_room,"Bla bla bla bla");
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -268,10 +267,10 @@ static void text_message_with_credential_from_auth_cb(void) {
reset_counters(&pauline->stat);
}
linphone_chat_room_send_message(chat_room,"Bla bla bla bla");
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d");
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -293,7 +292,7 @@ static void text_message_with_privacy(void) {
linphone_core_get_default_proxy(pauline->lc,&pauline_proxy);
linphone_proxy_config_set_privacy(pauline_proxy,LinphonePrivacyId);
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
{
int dummy=0;
wait_for_until(marie->lc,pauline->lc,&dummy,1,100); /*just to have time to purge message stored in the server*/
@ -301,8 +300,8 @@ static void text_message_with_privacy(void) {
reset_counters(&pauline->stat);
}
linphone_chat_room_send_message(chat_room,"Bla bla bla bla");
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -320,7 +319,7 @@ static void text_message_compatibility_mode(void) {
LinphoneChatRoom* chat_room;
linphone_core_get_default_proxy(marie->lc,&proxy);
CU_ASSERT_PTR_NOT_NULL (proxy);
BC_ASSERT_PTR_NOT_NULL (proxy);
proxy_address=linphone_address_new(linphone_proxy_config_get_addr(proxy));
linphone_address_clean(proxy_address);
tmp=linphone_address_as_string_uri_only(proxy_address);
@ -337,7 +336,7 @@ static void text_message_compatibility_mode(void) {
linphone_core_set_sip_transports(marie->lc,&transport);
marie->stat.number_of_LinphoneRegistrationOk=0;
CU_ASSERT_TRUE (wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE (wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphoneRegistrationOk,1));
chat_room = linphone_core_create_chat_room(marie->lc,to);
{
@ -347,8 +346,8 @@ static void text_message_compatibility_mode(void) {
reset_counters(&pauline->stat);
}
linphone_chat_room_send_message(chat_room,"Bla bla bla bla");
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceivedLegacy,1);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@ -376,15 +375,15 @@ static void text_message_with_ack(void) {
reset_counters(&pauline->stat);
linphone_chat_message_cbs_set_msg_state_changed(cbs, liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_room_send_chat_message(chat_room,message);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
ms_free(to);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
@ -410,16 +409,16 @@ static void text_message_with_external_body(void) {
linphone_chat_room_send_chat_message(chat_room,message);
/* check transient message list: the message should be in it, and should be the only one */
CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1);
CU_ASSERT_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message);
BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1, int, "%d");
BC_ASSERT_PTR_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageDelivered,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageExtBodyReceived,1, int, "%d");
CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0);
BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -487,7 +486,7 @@ static void file_transfer_message(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));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
fclose(file_to_send);
if (marie->stat.last_received_chat_message ) {
cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
@ -495,12 +494,12 @@ static void file_transfer_message(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_LinphoneFileTransferDownloadSuccessful,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1);
CU_ASSERT_TRUE(compare_files(send_filepath, receive_filepath));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1, int, "%d");
BC_ASSERT_TRUE(compare_files(send_filepath, receive_filepath));
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -554,18 +553,18 @@ static void small_file_transfer_message(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, memory_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));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
if (marie->stat.last_received_chat_message ) {
cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
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_download_file(marie->stat.last_received_chat_message);
}
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1, int, "%d");
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -641,18 +640,18 @@ static void lime_file_transfer_message(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, memory_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));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
if (marie->stat.last_received_chat_message ) {
cbs = linphone_chat_message_get_callbacks(marie->stat.last_received_chat_message);
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_download_file(marie->stat.last_received_chat_message);
}
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,1, int, "%d");
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -842,10 +841,10 @@ static void lime_text_message(void) {
ms_free(to);
linphone_chat_room_send_message(chat_room,"Bla bla bla bla");
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceived,1));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageReceivedLegacy,1, int, "%d");
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_chat_room(marie->lc,pauline->identity));
/* TODO : check the message arrived correctly deciphered */
linphone_core_manager_destroy(marie);
@ -901,18 +900,18 @@ static void file_transfer_message_io_error_upload(void) {
linphone_chat_room_send_chat_message(chat_room,message);
/*wait for file to be 25% uploaded and simultate a network error*/
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer,25));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer,25));
sal_set_send_error(pauline->lc->sal, -1);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d");
sal_set_send_error(pauline->lc->sal, 0);
linphone_core_refresh_registers(pauline->lc); /*to make sure registration is back in registered and so it can be later unregistered*/
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneRegistrationOk,pauline->stat.number_of_LinphoneRegistrationOk+1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneRegistrationOk,pauline->stat.number_of_LinphoneRegistrationOk+1));
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -965,21 +964,21 @@ static void file_transfer_message_io_error_download(void) {
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
/* wait for marie to receive pauline's message */
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
if (marie->stat.last_received_chat_message ) { /* get last message and use it to download file */
linphone_chat_message_start_file_download(marie->stat.last_received_chat_message, liblinphone_tester_chat_message_state_change, marie->lc);
/* wait for file to be 50% downloaded */
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50));
/* and simulate network error */
sal_set_recv_error(marie->lc->sal, -1);
}
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d");
sal_set_recv_error(marie->lc->sal, 0);
linphone_core_manager_destroy(marie);
@ -1035,13 +1034,13 @@ static void file_transfer_message_upload_cancelled(void) {
linphone_chat_room_send_chat_message(chat_room,message);
/*wait for file to be 50% uploaded and cancel the transfer */
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer, 50));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.progress_of_LinphoneFileTransfer, 50));
linphone_chat_message_cancel_file_transfer(message);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneMessageNotDelivered,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d");
linphone_content_unref(content);
linphone_core_manager_destroy(marie);
@ -1092,21 +1091,21 @@ static void file_transfer_message_download_cancelled(void) {
linphone_chat_room_send_message2(chat_room,message,liblinphone_tester_chat_message_state_change,pauline->lc);
/* wait for marie to receive pauline's message */
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageReceivedWithFile,1));
if (marie->stat.last_received_chat_message ) { /* get last message and use it to download file */
linphone_chat_message_start_file_download(marie->stat.last_received_chat_message, liblinphone_tester_chat_message_state_change, marie->lc);
/* wait for file to be 50% downloaded */
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.progress_of_LinphoneFileTransfer, 50));
/* and cancel the transfer */
linphone_chat_message_cancel_file_transfer(marie->stat.last_received_chat_message);
}
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1);
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1);
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageInProgress,1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageDelivered,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneFileTransferDownloadSuccessful,0, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageNotDelivered,1, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -1140,12 +1139,12 @@ static void file_transfer_using_external_body_url(void) {
linphone_chat_message_set_external_body_url(message, "https://www.linphone.org:444//tmp/54ec58280ace9_c30709218df8eaba61d1.jpg");
linphone_chat_room_send_chat_message(chat_room, message);
CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageReceived, 1));
if (marie->stat.last_received_chat_message) {
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, &pauline->stat.number_of_LinphoneMessageInProgress, 1));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneMessageExtBodyReceived, 1));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneMessageInProgress, 1));
ms_free(to);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -1174,16 +1173,16 @@ static void text_message_with_send_error(void) {
linphone_chat_room_send_chat_message(chat_room,message);
/* check transient message list: the message should be in it, and should be the only one */
CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1);
CU_ASSERT_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message);
BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 1, int, "%d");
BC_ASSERT_PTR_EQUAL(ms_list_nth_data(chat_room->transient_messages,0), message);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
/*CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageInProgress,1);*/
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
/*BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneMessageInProgress,1, int, "%d");*/
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0, int, "%d");
/* the message should have been discarded from transient list after an error */
CU_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0);
BC_ASSERT_EQUAL(ms_list_size(chat_room->transient_messages), 0, int, "%d");
sal_set_send_error(marie->lc->sal, 0);
ms_free(to);
@ -1211,8 +1210,8 @@ static void text_message_denied(void) {
linphone_chat_message_cbs_set_msg_state_changed(cbs,liblinphone_tester_chat_message_msg_state_changed);
linphone_chat_room_send_chat_message(chat_room,message);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0);
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneMessageNotDelivered,1));
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneMessageReceived,0, int, "%d");
ms_free(to);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -1240,7 +1239,7 @@ static void info_message_with_args(bool_t with_content) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc");
CU_ASSERT_TRUE(call(pauline,marie));
BC_ASSERT_TRUE(call(pauline,marie));
info=linphone_core_create_info_message(marie->lc);
linphone_info_message_add_header(info,"Weather","still bad");
@ -1261,26 +1260,26 @@ static void info_message_with_args(bool_t with_content) {
linphone_call_send_info_message(linphone_core_get_current_call(marie->lc),info);
linphone_info_message_destroy(info);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_inforeceived,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_inforeceived,1));
CU_ASSERT_PTR_NOT_NULL(pauline->stat.last_received_info_message);
BC_ASSERT_PTR_NOT_NULL(pauline->stat.last_received_info_message);
hvalue=linphone_info_message_get_header(pauline->stat.last_received_info_message, "Weather");
content=linphone_info_message_get_content(pauline->stat.last_received_info_message);
CU_ASSERT_PTR_NOT_NULL(hvalue);
BC_ASSERT_PTR_NOT_NULL(hvalue);
if (hvalue)
CU_ASSERT_TRUE(strcmp(hvalue,"still bad")==0);
BC_ASSERT_TRUE(strcmp(hvalue,"still bad")==0);
if (with_content){
CU_ASSERT_PTR_NOT_NULL(content);
BC_ASSERT_PTR_NOT_NULL(content);
if (content) {
CU_ASSERT_PTR_NOT_NULL(linphone_content_get_buffer(content));
CU_ASSERT_PTR_NOT_NULL(linphone_content_get_type(content));
CU_ASSERT_PTR_NOT_NULL(linphone_content_get_subtype(content));
if (linphone_content_get_type(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_type(content),"application")==0);
if (linphone_content_get_subtype(content)) CU_ASSERT_TRUE(strcmp(linphone_content_get_subtype(content),"somexml")==0);
if (linphone_content_get_buffer(content))CU_ASSERT_TRUE(strcmp((const char*)linphone_content_get_buffer(content),info_content)==0);
CU_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content));
BC_ASSERT_PTR_NOT_NULL(linphone_content_get_buffer(content));
BC_ASSERT_PTR_NOT_NULL(linphone_content_get_type(content));
BC_ASSERT_PTR_NOT_NULL(linphone_content_get_subtype(content));
if (linphone_content_get_type(content)) BC_ASSERT_TRUE(strcmp(linphone_content_get_type(content),"application")==0);
if (linphone_content_get_subtype(content)) BC_ASSERT_TRUE(strcmp(linphone_content_get_subtype(content),"somexml")==0);
if (linphone_content_get_buffer(content))BC_ASSERT_TRUE(strcmp((const char*)linphone_content_get_buffer(content),info_content)==0);
BC_ASSERT_EQUAL(linphone_content_get_size(content),strlen(info_content), int, "%d");
}
}
linphone_core_manager_destroy(marie);
@ -1316,8 +1315,8 @@ static void is_composing_notification(void) {
linphone_chat_room_compose(chat_room);
wait_for_until(pauline->lc, marie->lc, &dummy, 1, 1500); /*just to sleep while iterating*/
linphone_chat_room_send_message(chat_room, "Composing a message");
CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, 1));
CU_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingIdleReceived, 2));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, 1));
BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingIdleReceived, 2));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@ -1372,9 +1371,9 @@ message_tester_copy_file(const char *from, const char *to)
}
static int check_no_strange_time(void* data,int argc, char** argv,char** cNames) {
CU_ASSERT_EQUAL(argc, 1);
CU_ASSERT_STRING_EQUAL(cNames[0], "COUNT(*)"); // count of non updated messages should be 0
CU_ASSERT_STRING_EQUAL(argv[0], "0"); // count of non updated messages should be 0
BC_ASSERT_EQUAL(argc, 1, int, "%d");
BC_ASSERT_STRING_EQUAL(cNames[0], "COUNT(*)"); // count of non updated messages should be 0
BC_ASSERT_STRING_EQUAL(argv[0], "0"); // count of non updated messages should be 0
return 0;
}
@ -1386,7 +1385,7 @@ static void message_storage_migration() {
snprintf(src_db,sizeof(src_db), "%s/messages.db", bc_tester_read_dir_prefix);
snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", bc_tester_writable_dir_prefix);
CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0);
BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d");
// enable to test the performances of the migration step
//linphone_core_message_storage_set_debug(marie->lc, TRUE);
@ -1396,10 +1395,10 @@ static void message_storage_migration() {
linphone_core_set_chat_database_path(marie->lc, tmp_db);
chatrooms = linphone_core_get_chat_rooms(marie->lc);
CU_ASSERT(ms_list_size(chatrooms) > 0);
BC_ASSERT(ms_list_size(chatrooms) > 0);
// check that all messages have been migrated to the UTC time storage
CU_ASSERT(sqlite3_exec(marie->lc->db, "SELECT COUNT(*) FROM history WHERE time != '-1';", check_no_strange_time, NULL, NULL) == SQLITE_OK );
BC_ASSERT(sqlite3_exec(marie->lc->db, "SELECT COUNT(*) FROM history WHERE time != '-1';", check_no_strange_time, NULL, NULL) == SQLITE_OK );
linphone_core_manager_destroy(marie);
remove(tmp_db);
@ -1411,7 +1410,7 @@ static void history_message_count_helper(LinphoneChatRoom* chatroom, int x, int
if( expected != size ){
ms_warning("History retrieved from %d to %d returned %d records, but expected %d", x, y, size, expected);
}
CU_ASSERT_EQUAL(size, expected);
BC_ASSERT_EQUAL(size, expected, int, "%d");
ms_list_free_with_data(messages, (void (*)(void *))linphone_chat_message_unref);
@ -1426,12 +1425,12 @@ static void history_range_full_test(){
snprintf(src_db,sizeof(src_db), "%s/messages.db", bc_tester_read_dir_prefix);
snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", bc_tester_writable_dir_prefix);
CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0);
BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d");
linphone_core_set_chat_database_path(marie->lc, tmp_db);
chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr);
CU_ASSERT_PTR_NOT_NULL(chatroom);
BC_ASSERT_PTR_NOT_NULL(chatroom);
if (chatroom){
// We have 20 tests to perform to fully qualify the function, here they are:
history_message_count_helper(chatroom, 0, 0, 1);
@ -1468,47 +1467,47 @@ static void history_messages_count() {
snprintf(src_db,sizeof(src_db), "%s/messages.db", bc_tester_read_dir_prefix);
snprintf(tmp_db,sizeof(tmp_db), "%s/tmp.db", bc_tester_writable_dir_prefix);
CU_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0);
BC_ASSERT_EQUAL_FATAL(message_tester_copy_file(src_db, tmp_db), 0, int, "%d");
linphone_core_set_chat_database_path(marie->lc, tmp_db);
chatroom = linphone_core_get_chat_room(marie->lc, jehan_addr);
CU_ASSERT_PTR_NOT_NULL(chatroom);
BC_ASSERT_PTR_NOT_NULL(chatroom);
if (chatroom){
messages=linphone_chat_room_get_history(chatroom,10);
CU_ASSERT_EQUAL(ms_list_size(messages), 10);
BC_ASSERT_EQUAL(ms_list_size(messages), 10, int, "%d");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,1);
CU_ASSERT_EQUAL(ms_list_size(messages), 1);
BC_ASSERT_EQUAL(ms_list_size(messages), 1, int, "%d");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
messages=linphone_chat_room_get_history(chatroom,0);
CU_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270);
CU_ASSERT_EQUAL(ms_list_size(messages), 1270);
BC_ASSERT_EQUAL(linphone_chat_room_get_history_size(chatroom), 1270, int, "%d");
BC_ASSERT_EQUAL(ms_list_size(messages), 1270, int, "%d");
/*check the second most recent message*/
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other.");
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->next->data), "Fore and aft follow each other.");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test offset+limit: retrieve the 42th latest message only and check its content*/
messages=linphone_chat_room_get_history_range(chatroom, 42, 42);
CU_ASSERT_EQUAL(ms_list_size(messages), 1);
CU_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities.");
BC_ASSERT_EQUAL(ms_list_size(messages), 1, int, "%d");
BC_ASSERT_STRING_EQUAL(linphone_chat_message_get_text((LinphoneChatMessage *)messages->data), "If you open yourself to the Tao is intangible and evasive, yet prefers to keep us at the mercy of the kingdom, then all of the streams of hundreds of valleys because of its limitless possibilities.");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test offset without limit*/
messages = linphone_chat_room_get_history_range(chatroom, 1265, -1);
CU_ASSERT_EQUAL(ms_list_size(messages), 1270-1265);
BC_ASSERT_EQUAL(ms_list_size(messages), 1270-1265, int, "%d");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test limit without offset*/
messages = linphone_chat_room_get_history_range(chatroom, 0, 5);
CU_ASSERT_EQUAL(ms_list_size(messages), 6);
BC_ASSERT_EQUAL(ms_list_size(messages), 6, int, "%d");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
/*test invalid start*/
messages = linphone_chat_room_get_history_range(chatroom, 1265, 1260);
CU_ASSERT_EQUAL(ms_list_size(messages), 1270-1265);
BC_ASSERT_EQUAL(ms_list_size(messages), 1270-1265, int, "%d");
ms_list_free_with_data(messages, (void (*)(void*))linphone_chat_message_unref);
}
linphone_core_manager_destroy(marie);

View file

@ -51,23 +51,23 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
CU_ASSERT_TRUE(call_with_caller_params(marie,pauline,marie_params));
BC_ASSERT_TRUE(call_with_caller_params(marie,pauline,marie_params));
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
if (enable_caller_privacy)
linphone_call_params_set_privacy(laure_params,LinphonePrivacyId);
CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(laure->lc,pauline->identity,laure_params));
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(laure->lc,pauline->identity,laure_params));
CU_ASSERT_TRUE(wait_for(laure->lc
BC_ASSERT_TRUE(wait_for(laure->lc
,pauline->lc
,&pauline->stat.number_of_LinphoneCallIncomingReceived
,2));
CU_ASSERT_EQUAL(laure->stat.number_of_LinphoneCallOutgoingProgress,1);
BC_ASSERT_EQUAL(laure->stat.number_of_LinphoneCallOutgoingProgress,1, int, "%d");
CU_ASSERT_TRUE(wait_for(laure->lc
BC_ASSERT_TRUE(wait_for(laure->lc
,pauline->lc
,&laure->stat.number_of_LinphoneCallOutgoingRinging
,1));
@ -81,25 +81,25 @@ static void call_waiting_indication_with_param(bool_t enable_caller_privacy) {
}
}
CU_ASSERT_TRUE(wait_for(laure->lc
BC_ASSERT_TRUE(wait_for(laure->lc
,pauline->lc
,&laure->stat.number_of_LinphoneCallConnected
,1));
CU_ASSERT_TRUE(wait_for(pauline->lc
BC_ASSERT_TRUE(wait_for(pauline->lc
,marie->lc
,&marie->stat.number_of_LinphoneCallPausedByRemote
,1));
if (pauline_called_by_laure && enable_caller_privacy )
CU_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(pauline_called_by_laure)),LinphonePrivacyId);
BC_ASSERT_EQUAL(linphone_call_params_get_privacy(linphone_call_get_current_params(pauline_called_by_laure)),LinphonePrivacyId, int, "%d");
/*wait a bit for ACK to be sent*/
wait_for_list(lcs,NULL,0,1000);
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000));
linphone_core_manager_destroy(marie);
@ -129,9 +129,9 @@ static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState
if (state==LinphoneCallOutgoingRinging || state==LinphoneCallOutgoingEarlyMedia) {
CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(marie->lc,pauline->identity,marie_params));
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(marie->lc,pauline->identity,marie_params));
CU_ASSERT_TRUE(wait_for(marie->lc
BC_ASSERT_TRUE(wait_for(marie->lc
,pauline->lc
,&pauline->stat.number_of_LinphoneCallIncomingReceived
,1));
@ -139,29 +139,29 @@ static void incoming_call_accepted_when_outgoing_call_in_state(LinphoneCallState
if (state==LinphoneCallOutgoingEarlyMedia)
linphone_core_accept_early_media(pauline->lc,linphone_core_get_current_call(pauline->lc));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1);
CU_ASSERT_TRUE(wait_for(marie->lc
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallOutgoingProgress,1, int, "%d");
BC_ASSERT_TRUE(wait_for(marie->lc
,pauline->lc
,state==LinphoneCallOutgoingEarlyMedia?&marie->stat.number_of_LinphoneCallOutgoingEarlyMedia:&marie->stat.number_of_LinphoneCallOutgoingRinging
,1));
} else if (state==LinphoneCallOutgoingProgress) {
CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(marie->lc,pauline->identity));
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address(marie->lc,pauline->identity));
} else {
ms_error("Unsupported state");
return;
}
CU_ASSERT_TRUE(call_with_caller_params(laure,marie,laure_params));
BC_ASSERT_TRUE(call_with_caller_params(laure,marie,laure_params));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000));
linphone_core_manager_destroy(marie);
@ -193,32 +193,32 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
CU_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(call(marie,pauline));
marie_call_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
CU_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie));
BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie));
CU_ASSERT_TRUE(call(marie,laure));
BC_ASSERT_TRUE(call(marie,laure));
initial_marie_stat=marie->stat;
initial_pauline_stat=pauline->stat;
initial_laure_stat=laure->stat;
marie_call_laure=linphone_core_get_current_call(marie->lc);
CU_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure);
BC_ASSERT_PTR_NOT_NULL_FATAL(marie_call_laure);
linphone_core_add_to_conference(marie->lc,marie_call_laure);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1,5000));
linphone_core_add_to_conference(marie->lc,marie_call_pauline);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallResuming,initial_marie_stat.number_of_LinphoneCallResuming+1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallResuming,initial_marie_stat.number_of_LinphoneCallResuming+1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,initial_pauline_stat.number_of_LinphoneCallStreamsRunning+1,5000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,initial_laure_stat.number_of_LinphoneCallStreamsRunning+1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+2,3000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,initial_pauline_stat.number_of_LinphoneCallStreamsRunning+1,5000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,initial_laure_stat.number_of_LinphoneCallStreamsRunning+1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+2,3000));
CU_ASSERT_TRUE(linphone_core_is_in_conference(marie->lc));
CU_ASSERT_EQUAL(linphone_core_get_conference_size(marie->lc),3);
BC_ASSERT_TRUE(linphone_core_is_in_conference(marie->lc));
BC_ASSERT_EQUAL(linphone_core_get_conference_size(marie->lc),3, int, "%d");
/*
* FIXME: check_ice cannot work as it is today because there is no current call for the party that hosts the conference
@ -234,9 +234,9 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
linphone_core_terminate_conference(marie->lc);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,10000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,10000));
@ -285,7 +285,7 @@ static void simple_call_transfer(void) {
lcs=ms_list_append(lcs,laure->lc);
CU_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(call(marie,pauline));
marie_calling_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
@ -295,35 +295,35 @@ static void simple_call_transfer(void) {
linphone_core_transfer_call(pauline->lc,pauline_called_by_marie,laure_identity);
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallRefered,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallRefered,1,2000));
/*marie pausing pauline*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPausing,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausedByRemote,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPaused,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPausing,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausedByRemote,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallPaused,1,2000));
/*marie calling laure*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingProgress,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingProgress,1,2000));
CU_ASSERT_PTR_NOT_NULL(linphone_call_get_transfer_target_call(marie_calling_pauline));
BC_ASSERT_PTR_NOT_NULL(linphone_call_get_transfer_target_call(marie_calling_pauline));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallOutgoingRinging,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000));
linphone_core_accept_call(laure->lc,linphone_core_get_current_call(laure->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000));
marie_calling_laure=linphone_core_get_current_call(marie->lc);
CU_ASSERT_PTR_NOT_NULL_FATAL(marie_calling_laure);
CU_ASSERT_TRUE(linphone_call_get_transferer_call(marie_calling_laure)==marie_calling_pauline);
BC_ASSERT_PTR_NOT_NULL_FATAL(marie_calling_laure);
BC_ASSERT_TRUE(linphone_call_get_transferer_call(marie_calling_laure)==marie_calling_pauline);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneTransferCallConnected,1,2000));
/*terminate marie to pauline call*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,1,2000));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -343,7 +343,7 @@ static void unattended_call_transfer(void) {
lcs=ms_list_append(lcs,laure->lc);
CU_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(call(marie,pauline));
pauline_called_by_marie=linphone_core_get_current_call(marie->lc);
reset_counters(&marie->stat);
@ -351,25 +351,25 @@ static void unattended_call_transfer(void) {
reset_counters(&laure->stat);
linphone_core_transfer_call(marie->lc,pauline_called_by_marie,laure_identity);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000));
/*marie ends the call */
linphone_core_terminate_call(marie->lc,pauline_called_by_marie);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
/*Pauline starts the transfer*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000));
linphone_core_accept_call(laure->lc,linphone_core_get_current_call(laure->lc));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -383,10 +383,10 @@ static void unattended_call_transfer_with_error(void) {
LinphoneCall* pauline_called_by_marie;
bool_t call_ok=TRUE;
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
CU_ASSERT_TRUE((call_ok=call(marie,pauline)));
BC_ASSERT_TRUE((call_ok=call(marie,pauline)));
if (call_ok){
pauline_called_by_marie=linphone_core_get_current_call(marie->lc);
@ -394,21 +394,21 @@ static void unattended_call_transfer_with_error(void) {
reset_counters(&pauline->stat);
linphone_core_transfer_call(marie->lc,pauline_called_by_marie,"unknown_user");
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000));
/*Pauline starts the transfer*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingInit,1,2000));
/* and immediately get an error*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallError,1,2000));
/*the error must be reported back to marie*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallError,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallError,1,2000));
/*and pauline should resume the call automatically*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallResuming,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallResuming,1,2000));
/*and call should be resumed*/
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,1,2000));
}
linphone_core_manager_destroy(marie);
@ -429,24 +429,24 @@ static void call_transfer_existing_call_outgoing_call(void) {
bool_t call_ok=TRUE;
const MSList* calls;
MSList* lcs=ms_list_append(NULL,marie->lc);
lcs=ms_list_append(lcs,pauline->lc);
lcs=ms_list_append(lcs,laure->lc);
/*marie call pauline*/
CU_ASSERT_TRUE((call_ok=call(marie,pauline)));
BC_ASSERT_TRUE((call_ok=call(marie,pauline)));
if (call_ok){
marie_call_pauline=linphone_core_get_current_call(marie->lc);
pauline_called_by_marie=linphone_core_get_current_call(pauline->lc);
/*marie pause pauline*/
CU_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie));
BC_ASSERT_TRUE(pause_call_1(marie,marie_call_pauline,pauline,pauline_called_by_marie));
/*marie call laure*/
CU_ASSERT_TRUE(call(marie,laure));
BC_ASSERT_TRUE(call(marie,laure));
marie_call_laure=linphone_core_get_current_call(marie->lc);
laure_called_by_marie=linphone_core_get_current_call(laure->lc);
/*marie pause laure*/
CU_ASSERT_TRUE(pause_call_1(marie,marie_call_laure,laure,laure_called_by_marie));
BC_ASSERT_TRUE(pause_call_1(marie,marie_call_laure,laure,laure_called_by_marie));
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
@ -454,37 +454,37 @@ static void call_transfer_existing_call_outgoing_call(void) {
linphone_core_transfer_call_to_another(marie->lc,marie_call_pauline,marie_call_laure);
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallRefered,1,2000));
/*pauline pausing marie*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausing,1,4000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPaused,1,4000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPausing,1,4000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallPaused,1,4000));
/*pauline calling laure*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingProgress,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingInit,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallIncomingReceived,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallOutgoingRinging,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallOutgoingProgress,1,2000));
/*laure accept call*/
for(calls=linphone_core_get_calls(laure->lc);calls!=NULL;calls=calls->next) {
lcall = (LinphoneCall*)calls->data;
if (linphone_call_get_state(lcall) == LinphoneCallIncomingReceived) {
CU_ASSERT_EQUAL(linphone_call_get_replaced_call(lcall),laure_called_by_marie);
BC_ASSERT_PTR_EQUAL(linphone_call_get_replaced_call(lcall),laure_called_by_marie);
linphone_core_accept_call(laure->lc,lcall);
break;
}
}
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallConnected,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallStreamsRunning,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,1,2000));
/*terminate marie to pauline/laure call*/
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,2,2000));
CU_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,2,2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,1,2000));
}
linphone_core_manager_destroy(marie);

View file

@ -52,15 +52,15 @@ static void call_multicast_base(bool_t video) {
linphone_core_set_audio_multicast_addr(pauline->lc,"224.1.2.3");
linphone_core_enable_audio_multicast(pauline->lc,TRUE);
CU_ASSERT_TRUE(call(pauline,marie));
BC_ASSERT_TRUE(call(pauline,marie));
wait_for_until(marie->lc, pauline->lc, NULL, 1, 3000);
if (linphone_core_get_current_call(marie->lc)) {
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70);
if (video) {
/*check video path*/
linphone_call_set_next_video_frame_decoded_callback(linphone_core_get_current_call(marie->lc),linphone_call_cb,marie->lc);
linphone_call_send_vfu_request(linphone_core_get_current_call(marie->lc));
CU_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1));
BC_ASSERT_TRUE( wait_for(marie->lc,pauline->lc,&marie->stat.number_of_IframeDecoded,1));
}
end_call(marie,pauline);
@ -69,7 +69,7 @@ static void call_multicast_base(bool_t video) {
linphone_core_manager_destroy(pauline);
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
@ -139,8 +139,8 @@ static void early_media_with_multicast_base(bool_t video) {
linphone_core_invite_address(marie->lc, pauline->identity);
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingReceived,1,3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingRinging,1,1000));
if (linphone_core_inc_invite_pending(pauline->lc)) {
@ -151,8 +151,8 @@ static void early_media_with_multicast_base(bool_t video) {
}
linphone_core_accept_early_media(pauline->lc, linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
CU_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) );
BC_ASSERT_TRUE( wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
BC_ASSERT_TRUE( wait_for_list(lcs, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia,1,2000) );
if (linphone_core_inc_invite_pending(pauline2->lc)) {
/* send a 183 to initiate the early media */
@ -162,40 +162,40 @@ static void early_media_with_multicast_base(bool_t video) {
}
linphone_core_accept_early_media(pauline2->lc, linphone_core_get_current_call(pauline2->lc));
CU_ASSERT_TRUE( wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
BC_ASSERT_TRUE( wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallIncomingEarlyMedia,1,2000) );
}
wait_for_list(lcs, &dummy, 1, 3000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth<90);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth<90);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth>70);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth<90);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth>70);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline2->lc))->download_bandwidth<90);
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
if (video) {
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
}
if (video) {
CU_ASSERT_TRUE( wait_for_list(lcs,&pauline->stat.number_of_IframeDecoded,1,2000));
CU_ASSERT_TRUE( wait_for_list(lcs,&pauline2->stat.number_of_IframeDecoded,1,2000));
BC_ASSERT_TRUE( wait_for_list(lcs,&pauline->stat.number_of_IframeDecoded,1,2000));
BC_ASSERT_TRUE( wait_for_list(lcs,&pauline2->stat.number_of_IframeDecoded,1,2000));
}
linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000));
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallEnd, 1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallConnected, 1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallStreamsRunning, 1,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline2->stat.number_of_LinphoneCallEnd, 1,1000));
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
if (video) {
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_TRUE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
}
params=linphone_call_params_copy(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)));
@ -211,10 +211,10 @@ static void early_media_with_multicast_base(bool_t video) {
, params);
linphone_call_params_destroy(params);
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2,1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2,1000));
CU_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
CU_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_FALSE(linphone_call_params_audio_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
check_media_direction( pauline
, linphone_core_get_current_call(pauline->lc)
@ -228,8 +228,8 @@ static void early_media_with_multicast_base(bool_t video) {
, video?LinphoneMediaDirectionSendRecv:LinphoneMediaDirectionInactive);
if (video) {
CU_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
CU_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
BC_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc))));
BC_ASSERT_FALSE(linphone_call_params_video_multicast_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc))));
}
end_call(marie,pauline);
}
@ -239,7 +239,7 @@ static void early_media_with_multicast_base(bool_t video) {
linphone_core_manager_destroy(pauline2);
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_EQUAL(leaked_objects,0);
BC_ASSERT_EQUAL(leaked_objects,0, int, "%d");
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}

View file

@ -46,13 +46,13 @@ static void start_with_no_config(void){
int speex16_codec_pos=get_codec_position(codecs, "speex", 16000);
PayloadType *pt;
opus_codec_pos=get_codec_position(codecs, "opus", 48000);
if (opus_codec_pos!=-1) CU_ASSERT_TRUE(opus_codec_pos==0);
CU_ASSERT_TRUE(speex16_codec_pos<speex_codec_pos);
if (opus_codec_pos!=-1) BC_ASSERT_TRUE(opus_codec_pos==0);
BC_ASSERT_TRUE(speex16_codec_pos<speex_codec_pos);
pt=linphone_core_find_payload_type(lc, "speex", 16000, 1);
CU_ASSERT_PTR_NOT_NULL(pt);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt) {
CU_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt)==TRUE);
BC_ASSERT_TRUE(linphone_core_payload_type_enabled(lc, pt)==TRUE);
}
linphone_core_destroy(lc);
}
@ -60,15 +60,15 @@ static void start_with_no_config(void){
static void check_payload_type_numbers(LinphoneCall *call1, LinphoneCall *call2, int expected_number){
const LinphoneCallParams *params=linphone_call_get_current_params(call1);
const PayloadType *pt=linphone_call_params_get_used_audio_codec(params);
CU_ASSERT_PTR_NOT_NULL(pt);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt){
CU_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
BC_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
}
params=linphone_call_get_current_params(call2);
pt=linphone_call_params_get_used_audio_codec(params);
CU_ASSERT_PTR_NOT_NULL(pt);
BC_ASSERT_PTR_NOT_NULL(pt);
if (pt){
CU_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
BC_ASSERT_TRUE(linphone_core_get_payload_type_number(linphone_call_get_core(call1),pt)==expected_number);
}
}
@ -84,29 +84,29 @@ static void simple_call_with_different_codec_mappings(void) {
marie = linphone_core_manager_new( "marie_rc");
pauline = linphone_core_manager_new( "pauline_rc");
disable_all_audio_codecs_except_one(marie->lc,"pcmu",-1);
disable_all_audio_codecs_except_one(pauline->lc,"pcmu",-1);
/*marie set a fantasy number to PCMU*/
linphone_core_set_payload_type_number(marie->lc,
linphone_core_find_payload_type(marie->lc, "PCMU", 8000, -1),
104);
CU_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(call(marie,pauline));
pauline_call=linphone_core_get_current_call(pauline->lc);
CU_ASSERT_PTR_NOT_NULL(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if (pauline_call){
LinphoneCallParams *params;
check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104);
/*make a reinvite in the other direction*/
linphone_core_update_call(pauline->lc, pauline_call,
linphone_core_update_call(pauline->lc, pauline_call,
params=linphone_core_create_call_params(pauline->lc, pauline_call));
linphone_call_params_unref(params);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallUpdating,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallUpdatedByRemote,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
/*payload type numbers shall remain the same*/
check_payload_type_numbers(linphone_core_get_current_call(marie->lc), pauline_call, 104);
}
@ -116,7 +116,7 @@ static void simple_call_with_different_codec_mappings(void) {
linphone_core_manager_destroy(pauline);
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
@ -137,20 +137,20 @@ static void call_failed_because_of_codecs(void) {
disable_all_audio_codecs_except_one(pauline->lc,"pcma",-1);
out_call = linphone_core_invite_address(pauline->lc,marie->identity);
linphone_call_ref(out_call);
CU_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallOutgoingInit,1));
/*flexisip will retain the 488 until the "urgent reply" timeout (I.E 5s) arrives.*/
CU_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000));
CU_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0);
BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallError,1,7000));
BC_ASSERT_EQUAL(linphone_call_get_reason(out_call),LinphoneReasonNotAcceptable, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallIncomingReceived,0, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallReleased,0, int, "%d");
linphone_call_unref(out_call);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
leaked_objects=belle_sip_object_get_object_count()-begin;
CU_ASSERT_TRUE(leaked_objects==0);
BC_ASSERT_TRUE(leaked_objects==0);
if (leaked_objects>0){
belle_sip_object_dump_active_objects();
}
@ -194,23 +194,23 @@ static void profile_call_base(bool_t avpf1, LinphoneMediaEncryption srtp1,bool_t
}
CU_ASSERT_TRUE(call(marie, pauline));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(call(marie, pauline));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
if (linphone_core_get_current_call(marie->lc)) {
params = linphone_call_get_current_params(linphone_core_get_current_call(marie->lc));
CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
}
if (linphone_core_get_current_call(pauline->lc)) {
params = linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc));
CU_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
BC_ASSERT_STRING_EQUAL(linphone_call_params_get_rtp_profile(params), expected_profile);
}
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1);
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1);
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallConnected, 1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallConnected, 1, int, "%d");
end:
linphone_core_manager_destroy(pauline);
linphone_core_manager_destroy(marie);

View file

@ -39,11 +39,11 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha
bool_t eof = FALSE;
lc_manager = linphone_core_manager_new("marie_rc");
CU_ASSERT_PTR_NOT_NULL(lc_manager);
BC_ASSERT_PTR_NOT_NULL(lc_manager);
if(lc_manager == NULL) return;
player = linphone_core_create_local_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), video_stream_get_default_video_renderer(), 0);
CU_ASSERT_PTR_NOT_NULL(player);
BC_ASSERT_PTR_NOT_NULL(player);
if(player == NULL) goto fail;
res = linphone_player_open(player, filename, eof_callback, &eof);
@ -51,17 +51,17 @@ static void play_file(const char *filename, bool_t unsupported_format, const cha
|| (audio_mime == NULL && video_mime == NULL)
|| (video_mime == NULL && audio_mime && !ms_filter_codec_supported(audio_mime))
|| (audio_mime == NULL && video_mime && !ms_filter_codec_supported(video_mime))) {
CU_ASSERT_EQUAL(res, -1);
BC_ASSERT_EQUAL(res, -1, int, "%d");
} else {
CU_ASSERT_EQUAL(res, 0);
BC_ASSERT_EQUAL(res, 0, int, "%d");
}
if(res == -1) goto fail;
res = linphone_player_start(player);
CU_ASSERT_EQUAL(res, 0);
BC_ASSERT_EQUAL(res, 0, int, "%d");
if(res == -1) goto fail;
CU_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, 13000));
BC_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, 13000));
linphone_player_close(player);

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
@ -169,11 +168,11 @@ static bool_t subscribe_to_callee_presence(LinphoneCoreManager* caller_mgr,Linph
result&=wait_for(caller_mgr->lc,callee_mgr->lc,&callee_mgr->stat.number_of_LinphonePresenceActivityOnline,initial_callee.number_of_LinphonePresenceActivityOnline+1);
*/
CU_ASSERT_EQUAL(callee_mgr->stat.number_of_NewSubscriptionRequest,initial_callee.number_of_NewSubscriptionRequest+1);
BC_ASSERT_EQUAL(callee_mgr->stat.number_of_NewSubscriptionRequest,initial_callee.number_of_NewSubscriptionRequest+1, int, "%d");
/*without proxy, callee cannot subscribe to caller
CU_ASSERT_EQUAL(callee_mgr->stat.number_of_NotifyReceived,initial_callee.number_of_NotifyReceived+1);
BC_ASSERT_EQUAL(callee_mgr->stat.number_of_NotifyReceived,initial_callee.number_of_NotifyReceived+1, int, "%d");
*/
CU_ASSERT_EQUAL(caller_mgr->stat.number_of_NotifyReceived,initial_caller.number_of_NotifyReceived+1);
BC_ASSERT_EQUAL(caller_mgr->stat.number_of_NotifyReceived,initial_caller.number_of_NotifyReceived+1, int, "%d");
ms_free(identity);
return result;
@ -187,27 +186,27 @@ static void subscribe_failure_handle_by_app(void) {
char* lf_identity=linphone_address_as_string_uri_only(pauline->identity);
linphone_core_get_default_proxy(marie->lc,&config);
CU_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline));
BC_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline));
wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,1); /*just to wait for unsubscription even if not notified*/
sal_set_recv_error(marie->lc->sal, 0); /*simulate an error*/
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationProgress,2));
CU_ASSERT_EQUAL(linphone_proxy_config_get_error(config),LinphoneReasonIOError);
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationProgress,2));
BC_ASSERT_EQUAL(linphone_proxy_config_get_error(config),LinphoneReasonIOError, int, "%d");
sal_set_recv_error(marie->lc->sal, 1);
lf = linphone_core_get_friend_by_address(marie->lc,lf_identity);
linphone_friend_edit(lf);
linphone_friend_enable_subscribes(lf,FALSE); /*disable subscription*/
linphone_friend_done(lf);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationOk,2)); /*wait for register ok*/
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneRegistrationOk,2)); /*wait for register ok*/
linphone_friend_edit(lf);
linphone_friend_enable_subscribes(lf,TRUE);
linphone_friend_done(lf);
CU_ASSERT_FALSE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/
BC_ASSERT_FALSE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/
linphone_core_manager_destroy(marie);
CU_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,3)); /*just to wait for unsubscription even if not notified*/
BC_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,3)); /*just to wait for unsubscription even if not notified*/
linphone_core_manager_destroy(pauline);
}
@ -216,12 +215,12 @@ static void simple_subscribe(void) {
LinphoneCoreManager* marie = presence_linphone_core_manager_new("marie");
LinphoneCoreManager* pauline = presence_linphone_core_manager_new("pauline");
CU_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline));
BC_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline));
linphone_core_manager_destroy(marie);
/*unsubscribe is not reported ?*/
CU_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/
BC_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/
linphone_core_manager_destroy(pauline);
}
@ -244,18 +243,18 @@ static void call_with_presence(void) {
LinphoneCoreManager* pauline = presence_linphone_core_manager_new("pauline");
LinphoneVideoPolicy pol={0};
linphone_core_set_video_policy(marie->lc,&pol);
CU_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline));
CU_ASSERT_TRUE(subscribe_to_callee_presence(pauline,marie));
BC_ASSERT_TRUE(subscribe_to_callee_presence(marie,pauline));
BC_ASSERT_TRUE(subscribe_to_callee_presence(pauline,marie));
CU_ASSERT_TRUE(call(marie,pauline));
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnThePhone,1));
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnThePhone,1));
BC_ASSERT_TRUE(call(marie,pauline));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnThePhone,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnThePhone,1));
reset_counters(&marie->stat);
reset_counters(&pauline->stat);
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnline,1));
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnline,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphonePresenceActivityOnline,1));
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnline,1));
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@ -277,48 +276,48 @@ static void presence_information(void) {
char *contact2;
time_t current_timestamp, presence_timestamp;
CU_ASSERT_TRUE(subscribe_to_callee_presence(marie, pauline));
BC_ASSERT_TRUE(subscribe_to_callee_presence(marie, pauline));
/* Presence activity without description. */
presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityDinner, NULL);
linphone_core_set_presence_model(pauline->lc, presence);
wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityDinner,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityDinner, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityDinner, 1, int, "%d");
activity = linphone_presence_model_get_activity(marie->stat.last_received_presence);
CU_ASSERT_PTR_NOT_NULL(activity);
CU_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityDinner);
BC_ASSERT_PTR_NOT_NULL(activity);
BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityDinner, int, "%d");
description = linphone_presence_activity_get_description(activity);
CU_ASSERT_PTR_NULL(description);
BC_ASSERT_PTR_NULL(description);
/* Presence activity with description. */
presence = linphone_presence_model_new_with_activity(LinphonePresenceActivitySteering, bike_description);
linphone_core_set_presence_model(pauline->lc, presence);
wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivitySteering,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivitySteering, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivitySteering, 1, int, "%d");
activity = linphone_presence_model_get_activity(marie->stat.last_received_presence);
CU_ASSERT_PTR_NOT_NULL(activity);
CU_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivitySteering);
BC_ASSERT_PTR_NOT_NULL(activity);
BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivitySteering, int, "%d");
description = linphone_presence_activity_get_description(activity);
CU_ASSERT_PTR_NOT_NULL(description);
if (description != NULL) CU_ASSERT_EQUAL(strcmp(description, bike_description), 0);
BC_ASSERT_PTR_NOT_NULL(description);
if (description != NULL) BC_ASSERT_EQUAL(strcmp(description, bike_description), 0, int, "%d");
/* Presence activity with description and note. */
presence = linphone_presence_model_new_with_activity_and_note(LinphonePresenceActivityVacation, NULL, vacation_note, vacation_lang);
linphone_core_set_presence_model(pauline->lc, presence);
wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityVacation,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityVacation, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityVacation, 1, int, "%d");
activity = linphone_presence_model_get_activity(marie->stat.last_received_presence);
CU_ASSERT_PTR_NOT_NULL(activity);
CU_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityVacation);
BC_ASSERT_PTR_NOT_NULL(activity);
BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityVacation, int, "%d");
description = linphone_presence_activity_get_description(activity);
CU_ASSERT_PTR_NULL(description);
BC_ASSERT_PTR_NULL(description);
note = linphone_presence_model_get_note(marie->stat.last_received_presence, NULL);
CU_ASSERT_PTR_NOT_NULL(note);
BC_ASSERT_PTR_NOT_NULL(note);
if (note != NULL) {
note_content = linphone_presence_note_get_content(note);
CU_ASSERT_PTR_NOT_NULL(note_content);
BC_ASSERT_PTR_NOT_NULL(note_content);
if (note_content != NULL) {
CU_ASSERT_EQUAL(strcmp(note_content, vacation_note), 0);
BC_ASSERT_EQUAL(strcmp(note_content, vacation_note), 0, int, "%d");
}
}
@ -327,11 +326,11 @@ static void presence_information(void) {
linphone_presence_model_set_contact(presence, contact);
linphone_core_set_presence_model(pauline->lc, presence);
wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnThePhone,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityOnThePhone, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityOnThePhone, 1, int, "%d");
contact2 = linphone_presence_model_get_contact(presence);
CU_ASSERT_PTR_NOT_NULL(contact2);
BC_ASSERT_PTR_NOT_NULL(contact2);
if (contact2 != NULL) {
CU_ASSERT_EQUAL(strcmp(contact, contact2), 0);
BC_ASSERT_EQUAL(strcmp(contact, contact2), 0, int, "%d");
ms_free(contact2);
}
@ -340,9 +339,9 @@ static void presence_information(void) {
presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityShopping, NULL);
linphone_core_set_presence_model(pauline->lc, presence);
wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityShopping,1);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityShopping, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePresenceActivityShopping, 1, int, "%d");
presence_timestamp = linphone_presence_model_get_timestamp(presence);
CU_ASSERT_TRUE(presence_timestamp >= current_timestamp);
BC_ASSERT_TRUE(presence_timestamp >= current_timestamp);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -367,7 +366,7 @@ static void test_subscribe_notify_publish(void) {
/*wait for subscribe acknowledgment*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,1,2000);
CU_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d");
/*enable publish*/
@ -380,23 +379,23 @@ static void test_subscribe_notify_publish(void) {
/*wait for marie status*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,2,2000);
CU_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d");
presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityBusy,NULL);
linphone_core_set_presence_model(marie->lc,presence);
/*wait for new status*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,3,2000);
CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d");
/*wait for refresh*/
wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,4,5000);
CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d");
/*linphone_core_remove_friend(pauline->lc,lf);*/
/*wait for final notify*/
/*wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyReceived,4,5000);
CU_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf), int, "%d");
*/
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -426,7 +425,7 @@ static void test_forked_subscribe_notify_publish(void) {
/*wait for subscribe acknowledgment*/
wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,1,2000);
CU_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d");
/*enable publish*/
@ -445,21 +444,21 @@ static void test_forked_subscribe_notify_publish(void) {
/*wait for marie status*/
wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,3,2000);
CU_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d");
presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityBusy,NULL);
linphone_core_set_presence_model(marie->lc,presence);
/*wait for new status*/
wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,4,2000);
CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf));
BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d");
presence =linphone_presence_model_new_with_activity( LinphonePresenceActivityMeeting,NULL);
linphone_core_set_presence_model(marie2->lc,presence);
/*wait for new status*/
wait_for_list(lcs,&pauline->stat.number_of_NotifyReceived,5,2000);
CU_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf)); /*because liblinphone compositor is very simple for now (I.E only take first occurence)*/
BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d"); /*because liblinphone compositor is very simple for now (I.E only take first occurence)*/
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);

View file

@ -34,59 +34,59 @@ void on_report_send_mandatory(const LinphoneCall *call, int stream_type, const L
}else{
ms = (MediaStream*)call->videostream;
}
CU_ASSERT_TRUE(
BC_ASSERT_TRUE(
__strstr(body, "VQIntervalReport\r\n") == body ||
__strstr(body, "VQSessionReport\r\n") == body ||
__strstr(body, "VQSessionReport: CallTerm\r\n") == body
);
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "CallID:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalID:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteID:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "OrigID:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalGroup:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteGroup:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalAddr:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteAddr:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "START="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "STOP="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "CallID:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalID:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteID:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "OrigID:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalGroup:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteGroup:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalAddr:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteAddr:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "START="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "STOP="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PT="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PD="));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SR="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PT="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PD="));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SR="));
/* We should have not reached RemoteMetrics section yet */
CU_ASSERT_TRUE(!remote_metrics_start || body < remote_metrics_start);
BC_ASSERT_TRUE(!remote_metrics_start || body < remote_metrics_start);
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "DialogID:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "DialogID:"));
if (report->remote_metrics.rtcp_sr_count&&ms!=NULL&&ms->rc!=NULL){
/* Hack: reset rtcp_sr_count to 0 because in case of interval reports, we need one RTCP SR by interval */
report->remote_metrics.rtcp_sr_count=0;
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "AdaptiveAlg:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "AdaptiveAlg:"));
}
}
char * on_report_send_verify_metrics(const reporting_content_metrics_t *metrics, char * body){
if (metrics->rtcp_xr_count){
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "JitterBuffer:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PacketLoss:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "JitterBuffer:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PacketLoss:"));
}
if (metrics->rtcp_sr_count+metrics->rtcp_xr_count>0){
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Delay:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Delay:"));
}
if (metrics->rtcp_xr_count){
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "QualityEst:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "QualityEst:"));
}
return body;
@ -97,8 +97,8 @@ void on_report_send_with_rtcp_xr_local(const LinphoneCall *call, int stream_type
char * remote_metrics_start = __strstr(body, "RemoteMetrics:");
reporting_session_report_t * report = call->log->reporting.reports[stream_type];
on_report_send_mandatory(call,stream_type,content);
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:"));
CU_ASSERT_TRUE(!remote_metrics_start || on_report_send_verify_metrics(&report->local_metrics,body) < remote_metrics_start);
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:"));
BC_ASSERT_TRUE(!remote_metrics_start || on_report_send_verify_metrics(&report->local_metrics,body) < remote_metrics_start);
}
void on_report_send_with_rtcp_xr_remote(const LinphoneCall *call, int stream_type, const LinphoneContent *content){
char * body = (char*)linphone_content_get_buffer(content);
@ -106,8 +106,8 @@ void on_report_send_with_rtcp_xr_remote(const LinphoneCall *call, int stream_typ
on_report_send_mandatory(call,stream_type,content);
if (report->remote_metrics.rtcp_sr_count+report->remote_metrics.rtcp_xr_count>0){
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteMetrics:"));
CU_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteMetrics:"));
BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:"));
on_report_send_verify_metrics(&report->remote_metrics,body);
}
}
@ -127,15 +127,15 @@ bool_t create_call_for_quality_reporting_tests(
bool_t call_succeeded = call_with_params(marie,pauline,params_marie,params_pauline);
CU_ASSERT_TRUE(call_succeeded);
BC_ASSERT_TRUE(call_succeeded);
if (call_succeeded) {
if (call_marie) {
*call_marie = linphone_core_get_current_call(marie->lc);
CU_ASSERT_PTR_NOT_NULL(*call_marie);
BC_ASSERT_PTR_NOT_NULL(*call_marie);
}
if (call_pauline) {
*call_pauline = linphone_core_get_current_call(pauline->lc);
CU_ASSERT_PTR_NOT_NULL(*call_pauline);
BC_ASSERT_PTR_NOT_NULL(*call_pauline);
}
}
return call_succeeded;
@ -149,17 +149,17 @@ static void quality_reporting_not_used_without_config() {
if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL)) {
// marie has stats collection enabled but pauline has not
CU_ASSERT_TRUE(linphone_proxy_config_quality_reporting_enabled(call_marie->dest_proxy));
CU_ASSERT_FALSE(linphone_proxy_config_quality_reporting_enabled(call_pauline->dest_proxy));
BC_ASSERT_TRUE(linphone_proxy_config_quality_reporting_enabled(call_marie->dest_proxy));
BC_ASSERT_FALSE(linphone_proxy_config_quality_reporting_enabled(call_pauline->dest_proxy));
CU_ASSERT_EQUAL(strcmp("sip:collector@sip.example.org",
linphone_proxy_config_get_quality_reporting_collector(call_marie->dest_proxy)), 0);
BC_ASSERT_STRING_EQUAL(linphone_proxy_config_get_quality_reporting_collector(call_marie->dest_proxy),
"sip:collector@sip.example.org");
// this field should be already filled
CU_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->info.local_addr.ip);
BC_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->info.local_addr.ip);
// but not this one since it is updated at the end of call
CU_ASSERT_PTR_NULL(call_marie->log->reporting.reports[0]->dialog_id);
BC_ASSERT_PTR_NULL(call_marie->log->reporting.reports[0]->dialog_id);
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -175,13 +175,13 @@ static void quality_reporting_not_sent_if_call_not_started() {
out_call = linphone_core_invite(marie->lc,"pauline");
linphone_call_ref(out_call);
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallError,1, 10000));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1);
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallError,1, 10000));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1, int, "%d");
if (ms_list_size(linphone_core_get_call_logs(marie->lc))>0) {
out_call_log=(LinphoneCallLog*)(linphone_core_get_call_logs(marie->lc)->data);
CU_ASSERT_PTR_NOT_NULL(out_call_log);
CU_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted);
BC_ASSERT_PTR_NOT_NULL(out_call_log);
BC_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted, int, "%d");
}
linphone_call_unref(out_call);
@ -189,8 +189,8 @@ static void quality_reporting_not_sent_if_call_not_started() {
wait_for_until(marie->lc,NULL,NULL,0,1000);
// since the callee was busy, there should be no publish to do
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -207,8 +207,8 @@ static void quality_reporting_not_sent_if_low_bandwidth() {
if (create_call_for_quality_reporting_tests(marie, pauline, NULL, NULL, marie_params, NULL)) {
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
}
linphone_call_params_destroy(marie_params);
linphone_core_manager_destroy(marie);
@ -232,9 +232,9 @@ static void quality_reporting_invalid_report() {
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1));
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishError,1,3000));
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0);
BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishError,1,3000));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -252,17 +252,17 @@ static void quality_reporting_at_call_termination() {
linphone_core_terminate_all_calls(marie->lc);
// now dialog id should be filled
CU_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->dialog_id);
BC_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->dialog_id);
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallReleased,1, 10000));
CU_ASSERT_TRUE(wait_for_until(pauline->lc,NULL,&pauline->stat.number_of_LinphoneCallReleased,1, 10000));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallReleased,1, 10000));
BC_ASSERT_TRUE(wait_for_until(pauline->lc,NULL,&pauline->stat.number_of_LinphoneCallReleased,1, 10000));
CU_ASSERT_PTR_NULL(linphone_core_get_current_call(marie->lc));
CU_ASSERT_PTR_NULL(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_PTR_NULL(linphone_core_get_current_call(marie->lc));
BC_ASSERT_PTR_NULL(linphone_core_get_current_call(pauline->lc));
// PUBLISH submission to the collector should be ok
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishProgress,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishOk,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishProgress,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishOk,1));
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -278,12 +278,12 @@ static void quality_reporting_interval_report() {
linphone_reporting_set_on_report_send(call_marie, on_report_send_mandatory);
linphone_proxy_config_set_quality_reporting_interval(call_marie->dest_proxy, 10);
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc));
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));
// PUBLISH submission to the collector should be ok
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,3,60000));
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,3,60000));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,3,60000));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,3,60000));
}
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
@ -309,25 +309,25 @@ static void quality_reporting_session_report_if_video_stopped() {
if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, marie_params, pauline_params)) {
linphone_reporting_set_on_report_send(call_marie, on_report_send_with_rtcp_xr_local);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0);
CU_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0);
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,NULL,0,3000));
CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,NULL,0,3000));
BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
/*remove video*/
linphone_call_params_enable_video(pauline_params,FALSE);
linphone_core_update_call(pauline->lc,call_pauline,pauline_params);
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,5000));
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,5000));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,5000));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,5000));
CU_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,2,5000));
CU_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,2,5000));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,2,5000));
BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,2,5000));
}
linphone_call_params_destroy(marie_params);
linphone_call_params_destroy(pauline_params);

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
@ -64,7 +63,7 @@ void registration_state_changed(struct _LinphoneCore *lc, LinphoneProxyConfig *c
case LinphoneRegistrationCleared:counters->number_of_LinphoneRegistrationCleared++;break;
case LinphoneRegistrationFailed:counters->number_of_LinphoneRegistrationFailed++;break;
default:
CU_FAIL("unexpected event");break;
BC_FAIL("unexpected event");break;
}
}
@ -84,7 +83,7 @@ static void register_with_refresh_base_3(LinphoneCore* lc
const char* server_addr;
LinphoneAuthInfo *info;
CU_ASSERT_PTR_NOT_NULL(lc);
BC_ASSERT_PTR_NOT_NULL(lc);
if (!lc) return;
counters = get_stats(lc);
reset_counters(counters);
@ -116,7 +115,7 @@ static void register_with_refresh_base_3(LinphoneCore* lc
linphone_core_iterate(lc);
if (counters->number_of_auth_info_requested>0 && linphone_proxy_config_get_state(proxy_cfg) == LinphoneRegistrationFailed && late_auth_info) {
if (!linphone_core_get_auth_info_list(lc)) {
CU_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized);
BC_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized, int, "%d");
info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
}
@ -126,15 +125,15 @@ static void register_with_refresh_base_3(LinphoneCore* lc
break; /*no need to continue*/
ms_usleep(100000);
}
CU_ASSERT_EQUAL(linphone_proxy_config_is_registered(proxy_cfg),(expected_final_state == LinphoneRegistrationOk));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationNone,0);
CU_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress>=1);
BC_ASSERT_EQUAL(linphone_proxy_config_is_registered(proxy_cfg),(expected_final_state == LinphoneRegistrationOk), int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationNone,0, int, "%d");
BC_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress>=1);
if (expected_final_state == LinphoneRegistrationOk) {
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1+(refresh!=0));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,late_auth_info?1:0);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1+(refresh!=0), int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,late_auth_info?1:0, int, "%d");
} else
/*checking to be done outside this functions*/
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d");
}
@ -155,7 +154,7 @@ static void register_with_refresh(LinphoneCoreManager* lcm, bool_t refresh,const
stats* counters = &lcm->stat;
register_with_refresh_base(lcm->lc,refresh,domain,route);
linphone_core_manager_stop(lcm);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,1);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,1, int, "%d");
}
static void register_with_refresh_with_send_error() {
@ -174,10 +173,10 @@ static void register_with_refresh_with_send_error() {
linphone_core_iterate(lcm->lc);
ms_usleep(100000);
}
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2, int, "%d");
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d");
linphone_core_manager_destroy(lcm);
}
@ -186,7 +185,7 @@ static void simple_register(){
LinphoneCoreManager* lcm = create_lcm();
stats* counters = &lcm->stat;
register_with_refresh(lcm,FALSE,NULL,NULL);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
linphone_core_manager_destroy(lcm);
}
@ -204,8 +203,8 @@ static void register_with_custom_headers(void){
linphone_core_set_network_reachable(marie->lc, TRUE);
wait_for(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk,initial_register_ok+1);
value=linphone_proxy_config_get_custom_header(cfg, "Server");
CU_ASSERT_PTR_NOT_NULL(value);
if (value) CU_ASSERT_TRUE(strstr(value, "Flexisip")!=NULL);
BC_ASSERT_PTR_NOT_NULL(value);
if (value) BC_ASSERT_TRUE(strstr(value, "Flexisip")!=NULL);
linphone_core_manager_destroy(marie);
}
@ -221,10 +220,10 @@ static void simple_unregister(){
reset_counters(counters); /*clear stats*/
/*nothing is supposed to arrive until done*/
CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
linphone_proxy_config_enable_register(proxy_config,FALSE);
linphone_proxy_config_done(proxy_config);
CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1));
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1));
linphone_core_manager_destroy(lcm);
}
@ -240,16 +239,16 @@ static void change_expires(){
reset_counters(counters); /*clear stats*/
/*nothing is supposed to arrive until done*/
CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
linphone_proxy_config_set_expires(proxy_config,3);
linphone_proxy_config_done(proxy_config);
CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
/*wait 2s without receive refresh*/
CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2,2000));
BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2,2000));
/* now, it should be ok*/
CU_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2));
BC_ASSERT_TRUE(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,2));
linphone_core_manager_destroy(lcm);
@ -260,7 +259,7 @@ static void simple_register_with_refresh() {
LinphoneCoreManager* lcm = create_lcm();
stats* counters = &lcm->stat;
register_with_refresh(lcm,TRUE,NULL,NULL);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
linphone_core_manager_destroy(lcm);
}
@ -270,7 +269,7 @@ static void simple_auth_register_with_refresh() {
char route[256];
sprintf(route,"sip:%s",test_route);
register_with_refresh(lcm,TRUE,auth_domain,route);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,1, int, "%d");
linphone_core_manager_destroy(lcm);
}
@ -313,7 +312,7 @@ static void simple_authenticated_register(){
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
counters = &lcm->stat;
register_with_refresh(lcm,FALSE,auth_domain,route);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
}
static void ha1_authenticated_register(){
@ -328,7 +327,7 @@ static void ha1_authenticated_register(){
linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/
counters = &lcm->stat;
register_with_refresh(lcm,FALSE,auth_domain,route);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,0);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,0, int, "%d");
}
static void authenticated_register_with_no_initial_credentials(){
@ -347,7 +346,7 @@ static void authenticated_register_with_no_initial_credentials(){
counters= get_stats(mgr->lc);
counters->number_of_auth_info_requested=0;
register_with_refresh(mgr,FALSE,auth_domain,route);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,1, int, "%d");
linphone_core_manager_destroy(mgr);
}
@ -364,7 +363,7 @@ static void authenticated_register_with_late_credentials(){
counters = get_stats(mgr->lc);
register_with_refresh_base_2(mgr->lc,FALSE,auth_domain,route,TRUE,transport);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,1, int, "%d");
linphone_core_manager_destroy(mgr);
}
@ -384,9 +383,9 @@ static void authenticated_register_with_wrong_late_credentials(){
counters = get_stats(mgr->lc);
register_with_refresh_base_3(mgr->lc,FALSE,auth_domain,route,TRUE,transport,LinphoneRegistrationFailed);
CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,2);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,2);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2);
BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,2, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,2, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2, int, "%d");
test_password=saved_test_passwd;
linphone_core_manager_destroy(mgr);
@ -407,23 +406,23 @@ static void authenticated_register_with_wrong_credentials_with_params_base(const
linphone_core_add_auth_info(mgr->lc,info); /*add wrong authentication info to LinphoneCore*/
counters = get_stats(mgr->lc);
register_with_refresh_base_3(mgr->lc,TRUE,auth_domain,route,FALSE,transport,LinphoneRegistrationFailed);
//CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,3); register_with_refresh_base_3 does not alow to precisely check number of number_of_auth_info_requested
//BC_ASSERT_EQUAL(counters->number_of_auth_info_requested,3, int, "%d"); register_with_refresh_base_3 does not alow to precisely check number of number_of_auth_info_requested
/*wait for retry*/
CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_auth_info_requested,4));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,1);
BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_auth_info_requested,4));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,1, int, "%d");
/*check the detailed error info */
if (!user_agent || strcmp(user_agent,"tester-no-403")!=0){
LinphoneProxyConfig *cfg=NULL;
linphone_core_get_default_proxy(mgr->lc,&cfg);
CU_ASSERT_PTR_NOT_NULL(cfg);
BC_ASSERT_PTR_NOT_NULL(cfg);
if (cfg){
const LinphoneErrorInfo *ei=linphone_proxy_config_get_error_info(cfg);
const char *phrase=linphone_error_info_get_phrase(ei);
CU_ASSERT_PTR_NOT_NULL(phrase);
if (phrase) CU_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0);
CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403);
CU_ASSERT_PTR_NULL(linphone_error_info_get_details(ei));
BC_ASSERT_PTR_NOT_NULL(phrase);
if (phrase) BC_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0);
BC_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403, int, "%d");
BC_ASSERT_PTR_NULL(linphone_error_info_get_details(ei));
}
}
@ -450,7 +449,7 @@ static void authenticated_register_with_wrong_credentials_2() {
linphone_proxy_config_enable_register(proxy,FALSE);
linphone_proxy_config_done(proxy);
current_in_progress=counters->number_of_LinphoneRegistrationProgress;
CU_ASSERT_FALSE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationProgress,current_in_progress+1));
BC_ASSERT_FALSE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationProgress,current_in_progress+1));
linphone_core_manager_destroy(mgr);
}
@ -460,8 +459,8 @@ static void authenticated_register_with_wrong_credentials_without_403() {
static LinphoneCoreManager* configure_lcm(void) {
LinphoneCoreManager *mgr=linphone_core_manager_new( "multi_account_rc");
stats *counters=&mgr->stat;
CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc))));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);
BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc))));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d");
return mgr;
}
@ -479,10 +478,10 @@ static void network_state_change(){
counters = get_stats(lc);
register_ok=counters->number_of_LinphoneRegistrationOk;
linphone_core_set_network_reachable(lc,FALSE);
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableFalse,1));
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationNone,register_ok));
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableFalse,1));
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationNone,register_ok));
linphone_core_set_network_reachable(lc,TRUE);
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableTrue,1));
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_NetworkReachableTrue,1));
wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,2*register_ok);
linphone_core_manager_destroy(mgr);
@ -522,9 +521,9 @@ static void transport_change(){
/*keep only udp*/
linphone_core_set_sip_transports(lc,&sip_tr);
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok+number_of_udp_proxy));
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok+number_of_udp_proxy));
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationFailed,total_number_of_proxies-number_of_udp_proxy));
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationFailed,total_number_of_proxies-number_of_udp_proxy));
linphone_core_manager_destroy(mgr);
}
@ -544,7 +543,7 @@ static void proxy_transport_change(){
reset_counters(counters); /*clear stats*/
linphone_proxy_config_edit(proxy_config);
CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
addr = linphone_address_new(linphone_proxy_config_get_addr(proxy_config));
if (LinphoneTransportTcp == linphone_address_get_transport(addr)) {
@ -556,9 +555,9 @@ static void proxy_transport_change(){
linphone_proxy_config_done(proxy_config);
CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
BC_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
/*as we change p[roxy server destination, we should'nt be notified about the clear*/
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d");
ms_free(addr_as_string);
linphone_address_destroy(addr);
linphone_core_manager_destroy(lcm);
@ -580,16 +579,16 @@ static void proxy_transport_change_with_wrong_port() {
linphone_core_get_default_proxy(lcm->lc,&proxy_config);
linphone_proxy_config_edit(proxy_config);
CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
linphone_proxy_config_set_server_addr(proxy_config,route);
linphone_proxy_config_done(proxy_config);
CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
BC_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationOk,1));
/*as we change proxy server destination, we should'nt be notified about the clear*/
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d");
linphone_core_manager_destroy(lcm);
@ -611,14 +610,14 @@ static void proxy_transport_change_with_wrong_port_givin_up() {
linphone_core_get_default_proxy(lcm->lc,&proxy_config);
linphone_proxy_config_edit(proxy_config);
CU_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
BC_ASSERT_FALSE(wait_for_until(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1,3000));
linphone_proxy_config_enableregister(proxy_config,FALSE);
linphone_proxy_config_done(proxy_config);
CU_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,0);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1);
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);
BC_ASSERT(wait_for(lcm->lc,lcm->lc,&counters->number_of_LinphoneRegistrationCleared,1));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,0, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,1, int, "%d");
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0, int, "%d");
linphone_core_manager_destroy(lcm);
@ -639,8 +638,8 @@ static void io_recv_error(){
number_of_udp_proxy=get_number_of_udp_proxy(lc);
sal_set_recv_error(lc->sal, 0);
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationProgress,2*(register_ok-number_of_udp_proxy) /*because 1 udp*/));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationProgress,2*(register_ok-number_of_udp_proxy) /*because 1 udp*/));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d");
sal_set_recv_error(lc->sal, 1); /*reset*/
@ -662,11 +661,11 @@ static void io_recv_error_retry_immediatly(){
number_of_udp_proxy=get_number_of_udp_proxy(lc);
sal_set_recv_error(lc->sal, 0);
CU_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)
BC_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d");
sal_set_recv_error(lc->sal, 1); /*reset*/
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy+register_ok));
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy+register_ok));
linphone_core_manager_destroy(mgr);
}
@ -683,7 +682,7 @@ static void io_recv_error_late_recovery(){
lc=mgr->lc;
sal_set_refresher_retry_after(lc->sal,1000);
counters=&mgr->stat;
CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc))));
BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_LinphoneRegistrationOk,ms_list_size(linphone_core_get_proxy_config_list(mgr->lc))));
counters = get_stats(lc);
@ -693,15 +692,15 @@ static void io_recv_error_late_recovery(){
sal_set_recv_error(lc->sal, 0);
sal_set_send_error(lc->sal, -1);
CU_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)
BC_ASSERT_TRUE(wait_for(lc,NULL,&counters->number_of_LinphoneRegistrationProgress,(register_ok-number_of_udp_proxy)+register_ok /*because 1 udp*/));
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d");
CU_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationFailed,(register_ok-number_of_udp_proxy),sal_get_refresher_retry_after(lc->sal)+3000));
BC_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationFailed,(register_ok-number_of_udp_proxy),sal_get_refresher_retry_after(lc->sal)+3000));
sal_set_recv_error(lc->sal, 1); /*reset*/
sal_set_send_error(lc->sal, 0);
CU_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy +register_ok,sal_get_refresher_retry_after(lc->sal)+3000));
BC_ASSERT_TRUE(wait_for_list(lcs=ms_list_append(NULL,lc),&counters->number_of_LinphoneRegistrationOk,register_ok-number_of_udp_proxy +register_ok,sal_get_refresher_retry_after(lc->sal)+3000));
linphone_core_manager_destroy(mgr);
}
@ -728,15 +727,15 @@ static void io_recv_error_without_active_register(){
}
ms_list_free(proxys);
/*wait for unregistrations*/
CU_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/));
BC_ASSERT_TRUE(wait_for(lc,lc,&counters->number_of_LinphoneRegistrationCleared,register_ok /*because 1 udp*/));
sal_set_recv_error(lc->sal, 0);
/*nothing should happen because no active registration*/
wait_for_until(lc,lc, &dummy, 1, 3000);
CU_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress == ms_list_size(linphone_core_get_proxy_config_list(lc)));
BC_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress == ms_list_size(linphone_core_get_proxy_config_list(lc)));
CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0)
BC_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0,int,"%d");
sal_set_recv_error(lc->sal, 1); /*reset*/
@ -754,15 +753,15 @@ static void tls_certificate_failure(){
snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/agent.pem", bc_tester_read_dir_prefix); /*bad root ca*/
linphone_core_set_root_ca(mgr->lc,rootcapath);
linphone_core_set_network_reachable(lc,TRUE);
CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1));
BC_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1));
linphone_core_set_root_ca(mgr->lc,NULL); /*no root ca*/
linphone_core_refresh_registers(mgr->lc);
CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,2));
BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,2));
snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix); /*goot root ca*/
linphone_core_set_root_ca(mgr->lc,rootcapath);
linphone_core_refresh_registers(mgr->lc);
CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1));
CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,2);
BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,2, int, "%d");
linphone_core_destroy(mgr->lc);
}
@ -785,7 +784,7 @@ static void tls_with_non_tls_server(){
linphone_proxy_config_set_server_addr(proxy_cfg,tmp);
linphone_proxy_config_done(proxy_cfg);
linphone_address_destroy(addr);
CU_ASSERT_TRUE(wait_for_until(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1,5000));
BC_ASSERT_TRUE(wait_for_until(lc,lc,&mgr->stat.number_of_LinphoneRegistrationFailed,1,5000));
linphone_core_manager_destroy(mgr);
}
@ -799,8 +798,8 @@ static void tls_alt_name_register(){
snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix);
linphone_core_set_root_ca(mgr->lc,rootcapath);
linphone_core_refresh_registers(mgr->lc);
CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1));
CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0);
BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0, int, "%d");
linphone_core_manager_destroy(mgr);
}
@ -814,8 +813,8 @@ static void tls_wildcard_register(){
snprintf(rootcapath,sizeof(rootcapath), "%s/certificates/cn/cafile.pem", bc_tester_read_dir_prefix);
linphone_core_set_root_ca(mgr->lc,rootcapath);
linphone_core_refresh_registers(mgr->lc);
CU_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,2));
CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0);
BC_ASSERT_TRUE(wait_for(lc,lc,&mgr->stat.number_of_LinphoneRegistrationOk,2));
BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationFailed,0, int, "%d");
linphone_core_destroy(mgr->lc);
}

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
@ -38,64 +37,64 @@ void linphone_configuration_status(LinphoneCore *lc, LinphoneConfiguringState st
static void remote_provisioning_skipped(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSkipped,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSkipped,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_http(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_transient(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_transient_remote_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
CU_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc) == TRUE);
CU_ASSERT_TRUE(linphone_core_get_provisioning_uri(marie->lc) == NULL);
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(linphone_core_is_provisioning_transient(marie->lc) == TRUE);
BC_ASSERT_TRUE(linphone_core_get_provisioning_uri(marie->lc) == NULL);
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_https(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_https_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneRegistrationOk,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_not_found(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_404_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_invalid(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_invalid_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_invalid_uri(void) {
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_invalid_uri_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringFailed,1));
linphone_core_manager_destroy(marie);
}
static void remote_provisioning_default_values(void) {
LinphoneProxyConfig *lpc;
LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_default_values_rc", FALSE);
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
lpc = linphone_core_create_proxy_config(marie->lc);
CU_ASSERT_TRUE(lpc->reg_sendregister == TRUE);
CU_ASSERT_TRUE(lpc->expires == 604800);
CU_ASSERT_STRING_EQUAL(lpc->reg_proxy, "<sip:sip.linphone.org:5223;transport=tls>");
CU_ASSERT_STRING_EQUAL(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>");
CU_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org");
BC_ASSERT_TRUE(lpc->reg_sendregister == TRUE);
BC_ASSERT_TRUE(lpc->expires == 604800);
BC_ASSERT_STRING_EQUAL(lpc->reg_proxy, "<sip:sip.linphone.org:5223;transport=tls>");
BC_ASSERT_STRING_EQUAL(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>");
BC_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:?@sip.linphone.org");
{
LpConfig* lp = linphone_core_get_config(marie->lc);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi");
}
linphone_core_manager_destroy(marie);
@ -112,10 +111,10 @@ static void remote_provisioning_file(void) {
#else
marie = linphone_core_manager_new2("marie_remote_localfile_rc", FALSE);
#endif
CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1));
conf = linphone_core_get_config( marie->lc );
CU_ASSERT_EQUAL( lp_config_get_int(conf,"misc","tester_file_ok", 0), 1 );
BC_ASSERT_EQUAL( lp_config_get_int(conf,"misc","tester_file_ok", 0), 1 , int, "%d");
linphone_core_manager_destroy(marie);
}

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "liblinphone_tester.h"
#include "lpconfig.h"
@ -26,7 +25,7 @@
static void linphone_version_test(void){
const char *version=linphone_core_get_version();
/*make sure the git version is always included in the version number*/
CU_ASSERT_TRUE(strstr(version,"unknown")==NULL);
BC_ASSERT_TRUE(strstr(version,"unknown")==NULL);
}
static void core_init_test(void) {
@ -36,7 +35,7 @@ static void core_init_test(void) {
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
/* until we have good certificates on our test server... */
linphone_core_verify_server_certificates(lc,FALSE);
CU_ASSERT_PTR_NOT_NULL_FATAL(lc);
BC_ASSERT_PTR_NOT_NULL_FATAL(lc);
linphone_core_destroy(lc);
}
@ -50,10 +49,10 @@ static void core_sip_transport_test(void) {
LCSipTransports tr;
memset (&v_table,0,sizeof(v_table));
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
CU_ASSERT_PTR_NOT_NULL_FATAL(lc);
BC_ASSERT_PTR_NOT_NULL_FATAL(lc);
linphone_core_get_sip_transports(lc,&tr);
CU_ASSERT_EQUAL(tr.udp_port,5060); /*default config*/
CU_ASSERT_EQUAL(tr.tcp_port,5060); /*default config*/
BC_ASSERT_EQUAL(tr.udp_port,5060, int, "%d"); /*default config*/
BC_ASSERT_EQUAL(tr.tcp_port,5060, int, "%d"); /*default config*/
tr.udp_port=LC_SIP_TRANSPORT_RANDOM;
tr.tcp_port=LC_SIP_TRANSPORT_RANDOM;
@ -62,12 +61,12 @@ static void core_sip_transport_test(void) {
linphone_core_set_sip_transports(lc,&tr);
linphone_core_get_sip_transports(lc,&tr);
CU_ASSERT_NOT_EQUAL(tr.udp_port,5060); /*default config*/
CU_ASSERT_NOT_EQUAL(tr.tcp_port,5060); /*default config*/
BC_ASSERT_NOT_EQUAL(tr.udp_port,5060,int,"%d"); /*default config*/
BC_ASSERT_NOT_EQUAL(tr.tcp_port,5060,int,"%d"); /*default config*/
CU_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_port",-2),LC_SIP_TRANSPORT_RANDOM);
CU_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tcp_port",-2),LC_SIP_TRANSPORT_RANDOM);
CU_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_tls_port",-2),LC_SIP_TRANSPORT_RANDOM);
BC_ASSERT_EQUAL(lp_config_get_int(linphone_core_get_config(lc),"sip","sip_port",-2),LC_SIP_TRANSPORT_RANDOM, int, "%d");
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_destroy(lc);
}
@ -81,14 +80,14 @@ static void linphone_interpret_url_test()
memset ( &v_table,0,sizeof ( v_table ) );
lc = linphone_core_new ( &v_table,NULL,NULL,NULL );
CU_ASSERT_PTR_NOT_NULL_FATAL ( lc );
BC_ASSERT_PTR_NOT_NULL_FATAL ( lc );
address = linphone_core_interpret_url(lc, sips_address);
CU_ASSERT_PTR_NOT_NULL_FATAL(address);
CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips");
CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux");
CU_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org");
BC_ASSERT_PTR_NOT_NULL_FATAL(address);
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_scheme(address), "sips");
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_username(address), "margaux");
BC_ASSERT_STRING_EQUAL_FATAL(linphone_address_get_domain(address), "sip.linphone.org");
linphone_address_destroy(address);
@ -101,11 +100,11 @@ static void linphone_lpconfig_from_buffer(){
LpConfig* conf;
conf = lp_config_new_from_buffer(buffer);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer","test",""),"ok");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer","test",""),"ok");
lp_config_destroy(conf);
conf = lp_config_new_from_buffer(buffer_linebreaks);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer_linebreaks","test",""),"ok");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer_linebreaks","test",""),"ok");
lp_config_destroy(conf);
}
@ -116,11 +115,11 @@ static void linphone_lpconfig_from_buffer_zerolen_value(){
conf = lp_config_new_from_buffer(zerolen);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL");
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test");
lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL");
lp_config_destroy(conf);
}
@ -135,13 +134,13 @@ static void linphone_lpconfig_from_file_zerolen_value(){
stores the app bundle in read-only */
conf = lp_config_new_with_factory(NULL, rc_path);
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL");
// non_zero_len=test -> should return test
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test");
lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL");
ms_free(rc_path);
lp_config_destroy(conf);
@ -154,15 +153,15 @@ static void linphone_lpconfig_from_xml_zerolen_value(){
LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE);
CU_ASSERT_EQUAL(linphone_remote_provisioning_load_file(mgr->lc, xml_path), 0);
BC_ASSERT_EQUAL(linphone_remote_provisioning_load_file(mgr->lc, xml_path), 0, int, "%d");
conf = mgr->lc->config;
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL");
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test");
lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */
CU_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL");
BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL");
linphone_core_manager_destroy(mgr);
ms_free(xml_path);
@ -176,15 +175,15 @@ void linphone_proxy_config_address_equal_test() {
LinphoneAddress *e = linphone_address_new("sip:toto@titi;transport=udp");
LinphoneAddress *f = linphone_address_new("sip:toto@titi?X-Create-Account=yes");
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,NULL), LinphoneProxyConfigAddressDifferent);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,b), LinphoneProxyConfigAddressDifferent);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,c), LinphoneProxyConfigAddressDifferent);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,d), LinphoneProxyConfigAddressDifferent);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,e), LinphoneProxyConfigAddressWeakEqual);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(NULL,NULL), LinphoneProxyConfigAddressEqual);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,f), LinphoneProxyConfigAddressWeakEqual);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(c,f), LinphoneProxyConfigAddressDifferent);
CU_ASSERT_EQUAL(linphone_proxy_config_address_equal(e,f), LinphoneProxyConfigAddressWeakEqual);
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,NULL), LinphoneProxyConfigAddressDifferent, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,b), LinphoneProxyConfigAddressDifferent, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,c), LinphoneProxyConfigAddressDifferent, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,d), LinphoneProxyConfigAddressDifferent, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,e), LinphoneProxyConfigAddressWeakEqual, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(NULL,NULL), LinphoneProxyConfigAddressEqual, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(a,f), LinphoneProxyConfigAddressWeakEqual, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(c,f), LinphoneProxyConfigAddressDifferent, int, "%d");
BC_ASSERT_EQUAL(linphone_proxy_config_address_equal(e,f), LinphoneProxyConfigAddressWeakEqual, int, "%d");
linphone_address_destroy(a);
linphone_address_destroy(b);
@ -200,36 +199,36 @@ void linphone_proxy_config_is_server_config_changed_test() {
linphone_proxy_config_set_identity(proxy_config,"sip:toto@titi");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_set_identity(proxy_config,"sips:toto@titi");
CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent);
BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d");
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_set_server_addr(proxy_config,"sip:toto.com");
CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent);
BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d");
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org:4444");
CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent);
BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d");
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org;transport=tcp");
CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent);
BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressDifferent, int, "%d");
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_set_server_addr(proxy_config,"sip:sip.linphone.org;param=blue");
CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressWeakEqual);
BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressWeakEqual, int, "%d");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_set_contact_parameters(proxy_config,"blabla=blue");
CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual);
BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual, int, "%d");
linphone_proxy_config_edit(proxy_config);
linphone_proxy_config_enable_register(proxy_config,TRUE);
CU_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual);
BC_ASSERT_EQUAL(linphone_proxy_config_is_server_config_changed(proxy_config), LinphoneProxyConfigAddressEqual, int, "%d");
linphone_proxy_config_destroy(proxy_config);
}
@ -239,7 +238,7 @@ static void chat_root_test(void) {
LinphoneCore* lc;
memset (&v_table,0,sizeof(v_table));
lc = linphone_core_new(&v_table,NULL,NULL,NULL);
CU_ASSERT_PTR_NOT_NULL_FATAL(lc);
BC_ASSERT_PTR_NOT_NULL_FATAL(lc);
linphone_core_create_chat_room(lc,"sip:toto@titi.com");
linphone_core_destroy(lc);
}
@ -252,14 +251,14 @@ static void devices_reload_test(void) {
devid1 = ms_strdup(linphone_core_get_capture_device(mgr->lc));
linphone_core_reload_sound_devices(mgr->lc);
devid2 = ms_strdup(linphone_core_get_capture_device(mgr->lc));
CU_ASSERT_STRING_EQUAL(devid1, devid2);
BC_ASSERT_STRING_EQUAL(devid1, devid2);
ms_free(devid1);
ms_free(devid2);
devid1 = ms_strdup(linphone_core_get_video_device(mgr->lc));
linphone_core_reload_video_devices(mgr->lc);
devid2 = ms_strdup(linphone_core_get_video_device(mgr->lc));
CU_ASSERT_STRING_EQUAL(devid1, devid2);
BC_ASSERT_STRING_EQUAL(devid1, devid2);
ms_free(devid1);
ms_free(devid2);

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"
@ -57,10 +56,10 @@ static void linphone_stun_test_encode()
size_t bigLen = STUN_MAX_MESSAGE_SIZE;
size_t len = test_stun_encode(smallBuff, smallLen, TRUE);
CU_ASSERT(len == -1);
BC_ASSERT(len == -1);
len = test_stun_encode(bigBuff, bigLen, TRUE);
CU_ASSERT(len > 0);
BC_ASSERT(len > 0);
ms_message("STUN message encoded in %i bytes", (int)len);
}
@ -77,20 +76,20 @@ static void linphone_stun_test_grab_ip()
dummy_call.media_ports[1].rtp_port = 9078;
linphone_core_set_stun_server(lc_stun->lc, stun_address);
CU_ASSERT_STRING_EQUAL(stun_address, linphone_core_get_stun_server(lc_stun->lc));
BC_ASSERT_STRING_EQUAL(stun_address, linphone_core_get_stun_server(lc_stun->lc));
wait_for(lc_stun->lc,lc_stun->lc,&tmp,1);
ping_time = linphone_core_run_stun_tests(lc_stun->lc, &dummy_call);
CU_ASSERT(ping_time != -1);
BC_ASSERT(ping_time != -1);
ms_message("Round trip to STUN: %d ms", ping_time);
CU_ASSERT( dummy_call.ac.addr[0] != '\0');
CU_ASSERT( dummy_call.ac.port != 0);
BC_ASSERT( dummy_call.ac.addr[0] != '\0');
BC_ASSERT( dummy_call.ac.port != 0);
#ifdef VIDEO_ENABLED
CU_ASSERT( dummy_call.vc.addr[0] != '\0');
CU_ASSERT( dummy_call.vc.port != 0);
BC_ASSERT( dummy_call.vc.addr[0] != '\0');
BC_ASSERT( dummy_call.vc.port != 0);
#endif
ms_message("STUN test result: local audio port maps to %s:%i",

View file

@ -67,15 +67,15 @@ void liblinphone_tester_enable_ipv6(bool_t enabled){
LinphoneAddress * create_linphone_address(const char * domain) {
LinphoneAddress *addr = linphone_address_new(NULL);
CU_ASSERT_PTR_NOT_NULL_FATAL(addr);
BC_ASSERT_PTR_NOT_NULL_FATAL(addr);
linphone_address_set_username(addr,test_username);
CU_ASSERT_STRING_EQUAL(test_username,linphone_address_get_username(addr));
BC_ASSERT_STRING_EQUAL(test_username,linphone_address_get_username(addr));
if (!domain) domain= test_route;
linphone_address_set_domain(addr,domain);
CU_ASSERT_STRING_EQUAL(domain,linphone_address_get_domain(addr));
BC_ASSERT_STRING_EQUAL(domain,linphone_address_get_domain(addr));
linphone_address_set_display_name(addr, NULL);
linphone_address_set_display_name(addr, "Mr Tester");
CU_ASSERT_STRING_EQUAL("Mr Tester",linphone_address_get_display_name(addr));
BC_ASSERT_STRING_EQUAL("Mr Tester",linphone_address_get_display_name(addr));
return addr;
}
@ -107,7 +107,7 @@ LinphoneCore* configure_lc_from(LinphoneCoreVTable* v_table, const char* path, c
if (file){
filepath = ms_strdup_printf("%s/%s", path, file);
CU_ASSERT_TRUE_FATAL(ortp_file_exist(filepath)==0);
BC_ASSERT_TRUE_FATAL(ortp_file_exist(filepath)==0);
config = lp_config_new_with_factory(NULL,filepath);
}
@ -297,7 +297,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, const char* rc_file,
LinphoneProxyConfig* proxy;
int proxy_count;
/*CU_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count);*/
/*BC_ASSERT_EQUAL(ms_list_size(linphone_core_get_proxy_config_list(lc)),proxy_count, int, "%d");*/
if (check_for_proxies && rc_file) /**/
proxy_count=ms_list_size(linphone_core_get_proxy_config_list(mgr->lc));
else
@ -311,7 +311,7 @@ void linphone_core_manager_start(LinphoneCoreManager *mgr, const char* rc_file,
ms_error("Did not register after %d seconds for %d proxies", REGISTER_TIMEOUT, proxy_count);
}
}
CU_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationOk,proxy_count);
BC_ASSERT_EQUAL(mgr->stat.number_of_LinphoneRegistrationOk,proxy_count, int, "%d");
enable_codec(mgr->lc,"PCMU",8000);
linphone_core_get_default_proxy(mgr->lc,&proxy);

View file

@ -52,7 +52,7 @@ static char* get_public_contact_ip(LinphoneCore* lc) {
long contact_host_ip_len;
char contact_host_ip[255];
char * contact = linphone_proxy_config_get_contact(linphone_core_get_default_proxy_config(lc));
CU_ASSERT_PTR_NOT_NULL(contact);
BC_ASSERT_PTR_NOT_NULL(contact);
contact_host_ip_len = strchr(contact, ':')-contact;
strncpy(contact_host_ip, contact, contact_host_ip_len);
contact_host_ip[contact_host_ip_len]='\0';
@ -72,30 +72,30 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with
const char * tunnel_ip = get_ip_from_hostname("tunnel.linphone.org");
char *public_ip, *public_ip2=NULL;
CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,1));
BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,1));
public_ip = get_public_contact_ip(pauline->lc);
CU_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip);
BC_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip);
linphone_core_set_media_encryption(pauline->lc, encryption);
if (with_video_and_ice){
/*we want to test that tunnel is able to work with long SIP message, above mtu.
* Enable ICE and many codec to make the SIP message bigger*/
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
linphone_core_enable_payload_type(pauline->lc,
linphone_core_enable_payload_type(pauline->lc,
linphone_core_find_payload_type(pauline->lc, "speex", 32000, 1), TRUE);
linphone_core_enable_payload_type(pauline->lc,
linphone_core_enable_payload_type(pauline->lc,
linphone_core_find_payload_type(pauline->lc, "speex", 16000, 1), TRUE);
linphone_core_enable_payload_type(pauline->lc,
linphone_core_enable_payload_type(pauline->lc,
linphone_core_find_payload_type(pauline->lc, "G722", 8000, 1), TRUE);
linphone_core_enable_payload_type(marie->lc,
linphone_core_enable_payload_type(marie->lc,
linphone_core_find_payload_type(marie->lc, "speex", 32000, 1), TRUE);
linphone_core_enable_payload_type(marie->lc,
linphone_core_enable_payload_type(marie->lc,
linphone_core_find_payload_type(marie->lc, "speex", 16000, 1), TRUE);
linphone_core_enable_payload_type(marie->lc,
linphone_core_enable_payload_type(marie->lc,
linphone_core_find_payload_type(marie->lc, "G722", 8000, 1), TRUE);
}
if (tunnel_mode != LinphoneTunnelModeDisable){
@ -111,14 +111,14 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with
/*
* Enabling the tunnel with sip cause another REGISTER to be made.
* In automatic mode, the udp test should conclude (assuming we have a normal network), that no
* In automatic mode, the udp test should conclude (assuming we have a normal network), that no
* tunnel is needed. Thus the number of registrations should stay to 1.
* The library is missing a notification of "tunnel connectivity test finished" to enable the
* The library is missing a notification of "tunnel connectivity test finished" to enable the
* full testing of the automatic mode.
*/
if (tunnel_mode == LinphoneTunnelModeEnable && with_sip) {
CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,2));
BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,2));
/* Ensure that we did use the tunnel. If so, we should see contact changed from:
Contact: <sip:pauline@192.168.0.201>;.[...]
To:
@ -126,32 +126,32 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with
*/
ms_free(public_ip);
public_ip = get_public_contact_ip(pauline->lc);
CU_ASSERT_STRING_EQUAL(public_ip, tunnel_ip);
BC_ASSERT_STRING_EQUAL(public_ip, tunnel_ip);
} else {
public_ip2 = get_public_contact_ip(pauline->lc);
CU_ASSERT_STRING_EQUAL(public_ip, public_ip2);
BC_ASSERT_STRING_EQUAL(public_ip, public_ip2);
}
}
CU_ASSERT_TRUE(call(pauline,marie));
BC_ASSERT_TRUE(call(pauline,marie));
pauline_call=linphone_core_get_current_call(pauline->lc);
CU_ASSERT_PTR_NOT_NULL(pauline_call);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
if (pauline_call!=NULL){
CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)),
BC_ASSERT_PTR_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)),
encryption);
}
if (tunnel_mode == LinphoneTunnelModeEnable && with_sip){
/* make sure the call from pauline arrived from the tunnel by checking the contact address*/
marie_call = linphone_core_get_current_call(marie->lc);
CU_ASSERT_PTR_NOT_NULL(marie_call);
BC_ASSERT_PTR_NOT_NULL(marie_call);
if (marie_call){
const char *remote_contact = linphone_call_get_remote_contact(marie_call);
CU_ASSERT_PTR_NOT_NULL(remote_contact);
BC_ASSERT_PTR_NOT_NULL(remote_contact);
if (remote_contact){
LinphoneAddress *tmp = linphone_address_new(remote_contact);
CU_ASSERT_PTR_NOT_NULL(tmp);
BC_ASSERT_PTR_NOT_NULL(tmp);
if (tmp){
CU_ASSERT_STRING_EQUAL(linphone_address_get_domain(tmp), tunnel_ip);
BC_ASSERT_STRING_EQUAL(linphone_address_get_domain(tmp), tunnel_ip);
linphone_address_destroy(tmp);
}
}
@ -159,7 +159,7 @@ static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with
}
#ifdef VIDEO_ENABLED
if (with_video_and_ice){
CU_ASSERT_TRUE(add_video(pauline, marie, TRUE));
BC_ASSERT_TRUE(add_video(pauline, marie, TRUE));
}
#endif
end_call(pauline,marie);

View file

@ -16,8 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "lpconfig.h"
#include "private.h"
@ -28,7 +27,7 @@ static void upnp_start_n_stop(void) {
LinphoneCoreManager* lc_upnp = linphone_core_manager_new2( "upnp_rc", FALSE);
wait_for(lc_upnp->lc,lc_upnp->lc,&tmp,1);
#ifdef BUILD_UPNP
CU_ASSERT_TRUE(lc_upnp->lc->upnp != NULL);
BC_ASSERT_TRUE(lc_upnp->lc->upnp != NULL);
#endif
linphone_core_manager_destroy(lc_upnp);
}
@ -37,7 +36,7 @@ static void upnp_check_state(void) {
int tmp = 0;
LinphoneCoreManager* lc_upnp = linphone_core_manager_new2( "upnp_rc", FALSE);
wait_for(lc_upnp->lc,lc_upnp->lc,&tmp,1);
CU_ASSERT_TRUE(linphone_core_get_upnp_state(lc_upnp->lc) == LinphoneUpnpStateOk);
BC_ASSERT_TRUE(linphone_core_get_upnp_state(lc_upnp->lc) == LinphoneUpnpStateOk);
linphone_core_manager_destroy(lc_upnp);
}
@ -47,7 +46,7 @@ static void upnp_check_ipaddress(void) {
LinphoneCoreManager* lc_upnp = linphone_core_manager_new2( "upnp_rc", FALSE);
wait_for(lc_upnp->lc,lc_upnp->lc,&tmp,1);
addr = linphone_core_get_upnp_external_ipaddress(lc_upnp->lc);
CU_ASSERT_TRUE(addr != NULL && strlen(addr)>=7);
BC_ASSERT_TRUE(addr != NULL && strlen(addr)>=7);
linphone_core_manager_destroy(lc_upnp);
}

View file

@ -19,8 +19,7 @@
#if defined(VIDEO_ENABLED) && defined(HAVE_GTK)
#include <stdio.h>
#include "CUnit/Basic.h"
#include "linphonecore.h"
#include "liblinphone_tester.h"
#include "lpconfig.h"
@ -168,11 +167,11 @@ static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCo
bool_t result = TRUE;
bool_t did_received_call;
CU_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc, callee_mgr->identity, caller_params));
BC_ASSERT_PTR_NOT_NULL(linphone_core_invite_address_with_params(caller_mgr->lc, callee_mgr->identity, caller_params));
did_received_call = wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallIncomingReceived, initial_callee.number_of_LinphoneCallIncomingReceived + 1);
if (!did_received_call) return 0;
CU_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress, initial_caller.number_of_LinphoneCallOutgoingProgress + 1);
BC_ASSERT_EQUAL(caller_mgr->stat.number_of_LinphoneCallOutgoingProgress, initial_caller.number_of_LinphoneCallOutgoingProgress + 1, int, "%d");
while (caller_mgr->stat.number_of_LinphoneCallOutgoingRinging != (initial_caller.number_of_LinphoneCallOutgoingRinging + 1)
&& caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia != (initial_caller.number_of_LinphoneCallOutgoingEarlyMedia + 1)
@ -182,10 +181,10 @@ static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCo
ms_usleep(100000);
}
CU_ASSERT_TRUE((caller_mgr->stat.number_of_LinphoneCallOutgoingRinging == initial_caller.number_of_LinphoneCallOutgoingRinging + 1)
BC_ASSERT_TRUE((caller_mgr->stat.number_of_LinphoneCallOutgoingRinging == initial_caller.number_of_LinphoneCallOutgoingRinging + 1)
|| (caller_mgr->stat.number_of_LinphoneCallOutgoingEarlyMedia == initial_caller.number_of_LinphoneCallOutgoingEarlyMedia + 1));
CU_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(callee_mgr->lc));
BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call_remote_address(callee_mgr->lc));
if(!linphone_core_get_current_call(caller_mgr->lc) || !linphone_core_get_current_call(callee_mgr->lc) || !linphone_core_get_current_call_remote_address(callee_mgr->lc)) {
return 0;
}
@ -193,8 +192,8 @@ static bool_t video_call_with_params(LinphoneCoreManager* caller_mgr, LinphoneCo
if (automatically_accept == TRUE) {
linphone_core_accept_call_with_params(callee_mgr->lc, linphone_core_get_current_call(callee_mgr->lc), callee_params);
CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
CU_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
BC_ASSERT_TRUE(wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallConnected, initial_callee.number_of_LinphoneCallConnected + 1));
result = wait_for(callee_mgr->lc, caller_mgr->lc, &caller_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_caller.number_of_LinphoneCallStreamsRunning + 1)
&& wait_for(callee_mgr->lc, caller_mgr->lc, &callee_mgr->stat.number_of_LinphoneCallStreamsRunning, initial_callee.number_of_LinphoneCallStreamsRunning + 1);
}
@ -255,28 +254,28 @@ static void early_media_video_during_video_call_test(void) {
laure_params = configure_for_early_media_video_sending(laure);
/* Normal automatically accepted video call from marie to pauline. */
CU_ASSERT_TRUE(video_call_with_params(marie, pauline, marie_params, pauline_params, TRUE));
BC_ASSERT_TRUE(video_call_with_params(marie, pauline, marie_params, pauline_params, TRUE));
/* Wait for 2s. */
wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000);
/* Early media video call from laure to marie. */
CU_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE));
BC_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE));
/* Wait for 2s. */
wait_for_three_cores(marie->lc, pauline->lc, laure->lc, 2000);
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2);
CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1);
CU_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1, int, "%d");
BC_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1, int, "%d");
linphone_call_params_unref(marie_params);
linphone_call_params_unref(pauline_params);
@ -311,22 +310,22 @@ static void two_incoming_early_media_video_calls_test(void) {
ms_free(ringback_path);
/* Early media video call from pauline to marie. */
CU_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE));
BC_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE));
/* Wait for 2s. */
wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000);
/* Early media video call from laure to marie. */
CU_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE));
BC_ASSERT_TRUE(video_call_with_params(laure, marie, laure_params, NULL, FALSE));
/* Wait for 2s. */
wait_for_three_cores(marie->lc, pauline->lc, laure->lc, 2000);
CU_ASSERT_EQUAL(linphone_core_get_calls_nb(marie->lc), 2);
BC_ASSERT_EQUAL(linphone_core_get_calls_nb(marie->lc), 2, int, "%d");
if (linphone_core_get_calls_nb(marie->lc) == 2) {
calls_list = linphone_core_get_calls(marie->lc);
call = (LinphoneCall *)ms_list_nth_data(calls_list, 0);
CU_ASSERT_PTR_NOT_NULL(call);
BC_ASSERT_PTR_NOT_NULL(call);
if (call != NULL) {
LinphoneCallParams *params = linphone_call_params_copy(linphone_call_get_current_params(call));
linphone_call_params_set_audio_direction(params, LinphoneMediaDirectionSendRecv);
@ -339,16 +338,16 @@ static void two_incoming_early_media_video_calls_test(void) {
}
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, laure->lc, &laure->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2);
CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1);
CU_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 2, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1, int, "%d");
BC_ASSERT_EQUAL(laure->stat.number_of_video_windows_created, 1, int, "%d");
linphone_call_params_unref(marie_params);
linphone_call_params_unref(pauline_params);
@ -370,23 +369,23 @@ static void early_media_video_with_inactive_audio(void) {
pauline_params = configure_for_early_media_video_sending(pauline);
/* Early media video call from pauline to marie. */
CU_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE));
BC_ASSERT_TRUE(video_call_with_params(pauline, marie, pauline_params, NULL, FALSE));
/* Wait for 2s. */
wait_for_three_cores(marie->lc, pauline->lc, NULL, 2000);
/* Check that we are in LinphoneCallOutgoingEarlyMedia state and that the ringstream is present meaning we are playing the ringback tone. */
CU_ASSERT_EQUAL(linphone_call_get_state(linphone_core_get_current_call(pauline->lc)), LinphoneCallOutgoingEarlyMedia);
CU_ASSERT_PTR_NOT_NULL(pauline->lc->ringstream);
BC_ASSERT_EQUAL(linphone_call_get_state(linphone_core_get_current_call(pauline->lc)), LinphoneCallOutgoingEarlyMedia, int, "%d");
BC_ASSERT_PTR_NOT_NULL(pauline->lc->ringstream);
linphone_core_terminate_all_calls(marie->lc);
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallReleased, 1));
BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallReleased, 1));
CU_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 1);
CU_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1);
BC_ASSERT_EQUAL(marie->stat.number_of_video_windows_created, 1, int, "%d");
BC_ASSERT_EQUAL(pauline->stat.number_of_video_windows_created, 1, int, "%d");
linphone_call_params_unref(marie_params);
linphone_call_params_unref(pauline_params);
@ -432,52 +431,52 @@ static void forked_outgoing_early_media_video_call_with_inactive_audio_test(void
linphone_core_invite_address_with_params(pauline->lc, marie1->identity, pauline_params);
linphone_call_params_destroy(pauline_params);
CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallIncomingEarlyMedia, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1, 3000));
pauline_call = linphone_core_get_current_call(pauline->lc);
marie1_call = linphone_core_get_current_call(marie1->lc);
marie2_call = linphone_core_get_current_call(marie2->lc);
CU_ASSERT_PTR_NOT_NULL(pauline_call);
CU_ASSERT_PTR_NOT_NULL(marie1_call);
CU_ASSERT_PTR_NOT_NULL(marie2_call);
BC_ASSERT_PTR_NOT_NULL(pauline_call);
BC_ASSERT_PTR_NOT_NULL(marie1_call);
BC_ASSERT_PTR_NOT_NULL(marie2_call);
if (pauline_call && marie1_call && marie2_call) {
/* wait a bit that streams are established */
wait_for_list(lcs, &dummy, 1, 6000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth == 0);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth == 0);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth == 0);
CU_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth == 0);
CU_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0);
CU_ASSERT_TRUE(linphone_call_get_video_stats(marie2_call)->download_bandwidth > 0);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth == 0);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth == 0);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth == 0);
BC_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth == 0);
BC_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0);
BC_ASSERT_TRUE(linphone_call_get_video_stats(marie2_call)->download_bandwidth > 0);
linphone_call_params_set_audio_direction(marie1_params, LinphoneMediaDirectionSendRecv);
linphone_core_accept_call_with_params(marie1->lc, linphone_core_get_current_call(marie1->lc), marie1_params);
CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallStreamsRunning, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1, 3000));
/* marie2 should get her call terminated */
CU_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 1000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie2->stat.number_of_LinphoneCallEnd, 1, 1000));
/*wait a bit that streams are established*/
wait_for_list(lcs, &dummy, 1, 3000);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth > 71);
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth > 71);
CU_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth > 0);
CU_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth > 71);
BC_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth > 71);
BC_ASSERT_TRUE(linphone_call_get_video_stats(pauline_call)->download_bandwidth > 0);
BC_ASSERT_TRUE(linphone_call_get_video_stats(marie1_call)->download_bandwidth > 0);
/* send an INFO in reverse side to check that dialogs are properly established */
info = linphone_core_create_info_message(marie1->lc);
linphone_call_send_info_message(marie1_call, info);
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_inforeceived, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_inforeceived, 1, 3000));
}
linphone_core_terminate_all_calls(pauline->lc);
CU_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd, 1, 3000));
CU_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallEnd, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd, 1, 3000));
BC_ASSERT_TRUE(wait_for_list(lcs, &marie1->stat.number_of_LinphoneCallEnd, 1, 3000));
linphone_call_params_destroy(marie1_params);
linphone_call_params_destroy(marie2_params);