From cf25820aec64a6ecb676eae872cf106f42fb0085 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 24 Mar 2014 16:53:13 +0100 Subject: [PATCH] add new checks for ErrorInfo mechanism --- tester/eventapi_tester.c | 12 +++++++++++- tester/register_tester.c | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/tester/eventapi_tester.c b/tester/eventapi_tester.c index 49f0cdc83..5f10a5183 100644 --- a/tester/eventapi_tester.c +++ b/tester/eventapi_tester.c @@ -111,6 +111,8 @@ static void subscribe_test_declined(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc"); LinphoneContent content={0}; + LinphoneEvent *lev; + const LinphoneErrorInfo *ei; MSList* lcs=ms_list_append(NULL,marie->lc); lcs=ms_list_append(lcs,pauline->lc); @@ -122,13 +124,21 @@ static void subscribe_test_declined(void) { pauline->decline_subscribe=TRUE; - linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,&content); + 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,1000)); CU_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); + if (ei){ + CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603); + CU_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei)); + } CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); + linphone_event_unref(lev); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } diff --git a/tester/register_tester.c b/tester/register_tester.c index 547c2cec4..28850e141 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -356,6 +356,22 @@ static void authenticated_register_with_wrong_credentials_with_params(const char /*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); + + /*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); + 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)); + } + + } linphone_core_manager_destroy(mgr); } static void authenticated_register_with_wrong_credentials() {