Add an API to keep the accounts created on flexisip across calls to liblinphone_tester_run_tests(). This is used by iOS because of how the XCTest framework works.

This commit is contained in:
Guillaume BIENKOWSKI 2014-12-09 10:18:17 +01:00
parent f0a3a75d99
commit 85c7fa2773
2 changed files with 32 additions and 1 deletions

View file

@ -79,6 +79,24 @@ extern void liblinphone_tester_set_fileprefix(const char* file_prefix);
extern void liblinphone_tester_set_writable_dir_prefix(const char* writable_dir_prefix);
extern int liblinphone_tester_ipv6_available(void);
/**
* @brief Tells the tester whether or not to clean the accounts it has created between runs.
* @details Setting this to 1 will not clear the list of created accounts between successive
* calls to liblinphone_run_tests(). Some testing APIs call this function for *each* test,
* in which case we should keep the accounts that were created for further testing.
*
* You are supposed to manually call liblinphone_tester_clear_account when all the tests are
* finished.
*
* @param keep 1 to keep the accounts in-between runs, 0 to clear them after each run.
*/
extern void liblinphone_tester_keep_accounts( int keep );
/**
* @brief Clears the created accounts during the testing session.
*/
extern void liblinphone_tester_clear_accounts(void);
#ifdef __cplusplus
};
#endif

View file

@ -39,6 +39,7 @@ const char* test_username="liblinphone_tester";
const char* test_password="secret";
const char* test_route="sip2.linphone.org";
int liblinphone_tester_use_log_file=0;
static int liblinphone_tester_keep_accounts_flag = 0;
#if WINAPI_FAMILY_PHONE_APP
const char *liblinphone_tester_file_prefix="Assets";
@ -545,7 +546,10 @@ int liblinphone_tester_run_tests(const char *suite_name, const char *test_name)
}
CU_cleanup_registry();
account_manager_destroy();
if( liblinphone_tester_keep_accounts_flag == 0){
liblinphone_tester_clear_accounts();
}
return ret;
}
@ -583,3 +587,12 @@ int liblinphone_tester_ipv6_available(void){
return FALSE;
}
void liblinphone_tester_keep_accounts( int keep ){
liblinphone_tester_keep_accounts_flag = keep;
}
void liblinphone_tester_clear_accounts(void){
account_manager_destroy();
}