From: Tarun Kumar Date: Wed, 13 Sep 2023 09:02:28 +0000 (+0530) Subject: [ITC][connection][ACR-1769] Added new TCs for getting dhcp state X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=26abad885dd88f8d22cfc84f9f3ae1a7fbfa0139;p=test%2Ftct%2Fnative%2Fapi.git [ITC][connection][ACR-1769] Added new TCs for getting dhcp state Change-Id: I71c77c48cbc5c15018472173caff47d6dd0607c6 Signed-off-by: Tarun Kumar --- diff --git a/src/itc/connection/ITs-connection.c b/src/itc/connection/ITs-connection.c index 58b37d78d..b7e6bf33d 100755 --- a/src/itc/connection/ITs-connection.c +++ b/src/itc/connection/ITs-connection.c @@ -43,6 +43,11 @@ gboolean fn_WaitingCallbackResponse(gpointer data) return false; } +void test_connection_dhcp_state_changed_callback(connection_dhcp_state_e state, const char *interface_name, connection_error_e result, void *user_data) +{ + FPRINTF("[Line : %d][%s]Inside test_connection_dhcp_state_changed_callback\n", __LINE__, API_NAMESPACE); +} + void ConnectionInternetStateChangedCB(connection_internet_state_e state, void* user_data) { FPRINTF("[Line : %d][%s]Inside ConnectionInternetStateChangedCB callback\n", __LINE__, API_NAMESPACE); @@ -242,6 +247,41 @@ int ITc_connection_create_destroy_p(void) return 0; } +//& purpose: To check state of dhcp +//& type : auto +/** +* @testcase ITc_connection_get_dhcp_state_p +* @since_tizen 8.0 +* @author SRID(tarun1.kumar) +* @reviewer SRID(shobhit.v) +* @type auto +* @description To check state of dhcp +* @scenario Call API to get state of dhcp +* @apicovered connection_get_dhcp_state +* @passcase When API return CONNECTION_ERROR_NONE +* @failcase When API not return CONNECTION_ERROR_NONE +* @precondition None +* @postcondition None +*/ +int ITc_connection_get_dhcp_state_p(void) +{ + START_TEST; + + FPRINTF("[Line : %d][%s]Starting test : %s\\n", __LINE__, API_NAMESPACE,__FUNCTION__); + + if ( g_nPreconditionError == 1 ) + { + FPRINTF("[Line : %d][%s] ITc_connection_get_dhcp_state_p failed on precondition\\n", __LINE__, API_NAMESPACE); + return 1; + } + + connection_dhcp_state_e state; + int nRet = connection_get_dhcp_state(g_hConnection, "wlan0", &state); + PRINT_RESULT(CONNECTION_ERROR_NONE, nRet, "connection_get_dhcp_state", ConnectionGetError(nRet)); + + return 0; +} + //& purpose: To check state of Bluetooth //& type : auto /** @@ -1030,5 +1070,41 @@ int ITc_connection_set_unset_internet_state_changed_cb_p(void) return 0; } + +//& purpose: To check whether dhcp state changed +//& type : auto +/** +* @testcase ITc_connection_set_unset_internet_state_changed_cb_p +* @since_tizen 8.0 +* @author SRID(tarun1.kumar) +* @reviewer SRID(shobhit.v) +* @description To check for dhcp state changed callback . +* @apicovered connection_set_dhcp_state_changed_cb, connection_unset_dhcp_state_changed_cb +* @passcase When connection_set_dhcp_state_changed_cb, connection_unset_dhcp_state_changed_cb return CONNECTION_ERROR_NONE +* @failcase When connection_set_dhcp_state_changed_cb, connection_unset_dhcp_state_changed_cb not return CONNECTION_ERROR_NONE +* @precondition None +* @postcondition None +*/ + +int ITc_connection_set_unset_dhcp_state_changed_cb_p(void) +{ + START_TEST; + + if (g_nPreconditionError == 1) + { + FPRINTF("[Line: %d][%s] ITc_connection_set_unset_dhcp_state_changed_cb_p failed\\n", __LINE__, API_NAMESPACE); + return 1; + } + + int nRet = -1; + + nRet = connection_set_dhcp_state_changed_cb(g_hConnection, test_connection_dhcp_state_changed_callback, NULL); + PRINT_RESULT(CONNECTION_ERROR_NONE, nRet, "connection_set_dhcp_state_changed_cb", ConnectionGetError(nRet)); + + nRet = connection_unset_dhcp_state_changed_cb(g_hConnection); + PRINT_RESULT(CONNECTION_ERROR_NONE, nRet, "connection_unset_dhcp_state_changed_cb", ConnectionGetError(nRet)); + + return 0; +} /** @} */ /** @} */ diff --git a/src/itc/connection/tct-connection-native_mobile.h b/src/itc/connection/tct-connection-native_mobile.h index 466fdb11f..f55ff4a6c 100755 --- a/src/itc/connection/tct-connection-native_mobile.h +++ b/src/itc/connection/tct-connection-native_mobile.h @@ -100,6 +100,8 @@ extern int ITc_connection_profile_get_dhcp_lease_duration_p(void); extern int ITc_connection_is_metered_network_p(void); extern int ITc_connection_set_unset_internet_state_changed_cb_p(void); extern int ITc_connection_profile_get_internet_state_p(void); +extern int ITc_connection_get_dhcp_state_p(void); +extern int ITc_connection_set_unset_dhcp_state_changed_cb_p(void); testcase tc_array[] = { {"ITc_connection_profile_get_dhcp_server_address_p",ITc_connection_profile_get_dhcp_server_address_p,ITs_connection_profile_startup, ITs_connection_profile_cleanup}, @@ -172,6 +174,8 @@ testcase tc_array[] = { {"ITc_connection_is_metered_network_p", ITc_connection_is_metered_network_p, ITs_connection_startup, ITs_connection_cleanup}, {"ITc_connection_set_unset_internet_state_changed_cb_p", ITc_connection_set_unset_internet_state_changed_cb_p, ITs_connection_startup, ITs_connection_cleanup}, {"ITc_connection_profile_get_internet_state_p", ITc_connection_profile_get_internet_state_p, ITs_connection_profile_startup, ITs_connection_profile_cleanup}, + {"ITc_connection_get_dhcp_state_p", ITc_connection_get_dhcp_state_p, ITs_connection_startup, ITs_connection_cleanup}, + {"ITc_connection_set_unset_dhcp_state_changed_cb_p", ITc_connection_set_unset_dhcp_state_changed_cb_p, ITs_connection_startup, ITs_connection_cleanup}, {NULL, NULL} }; diff --git a/src/itc/connection/tct-connection-native_tizeniot.h b/src/itc/connection/tct-connection-native_tizeniot.h index 466fdb11f..f55ff4a6c 100755 --- a/src/itc/connection/tct-connection-native_tizeniot.h +++ b/src/itc/connection/tct-connection-native_tizeniot.h @@ -100,6 +100,8 @@ extern int ITc_connection_profile_get_dhcp_lease_duration_p(void); extern int ITc_connection_is_metered_network_p(void); extern int ITc_connection_set_unset_internet_state_changed_cb_p(void); extern int ITc_connection_profile_get_internet_state_p(void); +extern int ITc_connection_get_dhcp_state_p(void); +extern int ITc_connection_set_unset_dhcp_state_changed_cb_p(void); testcase tc_array[] = { {"ITc_connection_profile_get_dhcp_server_address_p",ITc_connection_profile_get_dhcp_server_address_p,ITs_connection_profile_startup, ITs_connection_profile_cleanup}, @@ -172,6 +174,8 @@ testcase tc_array[] = { {"ITc_connection_is_metered_network_p", ITc_connection_is_metered_network_p, ITs_connection_startup, ITs_connection_cleanup}, {"ITc_connection_set_unset_internet_state_changed_cb_p", ITc_connection_set_unset_internet_state_changed_cb_p, ITs_connection_startup, ITs_connection_cleanup}, {"ITc_connection_profile_get_internet_state_p", ITc_connection_profile_get_internet_state_p, ITs_connection_profile_startup, ITs_connection_profile_cleanup}, + {"ITc_connection_get_dhcp_state_p", ITc_connection_get_dhcp_state_p, ITs_connection_startup, ITs_connection_cleanup}, + {"ITc_connection_set_unset_dhcp_state_changed_cb_p", ITc_connection_set_unset_dhcp_state_changed_cb_p, ITs_connection_startup, ITs_connection_cleanup}, {NULL, NULL} }; diff --git a/src/itc/connection/tct-connection-native_tv.h b/src/itc/connection/tct-connection-native_tv.h index d5c0bcd7a..0403727a3 100755 --- a/src/itc/connection/tct-connection-native_tv.h +++ b/src/itc/connection/tct-connection-native_tv.h @@ -99,6 +99,8 @@ extern int ITc_connection_profile_get_dhcp_server_address_p(void); extern int ITc_connection_profile_get_dhcp_lease_duration_p(void); extern int ITc_connection_is_metered_network_p(void); extern int ITc_connection_profile_get_internet_state_p(void); +extern int ITc_connection_get_dhcp_state_p(void); +extern int ITc_connection_set_unset_dhcp_state_changed_cb_p(void); testcase tc_array[] = { {"ITc_connection_profile_get_dhcp_server_address_p",ITc_connection_profile_get_dhcp_server_address_p,ITs_connection_profile_startup, ITs_connection_profile_cleanup}, @@ -170,6 +172,8 @@ testcase tc_array[] = { {"ITc_connection_profile_get_dhcp_lease_duration_p", ITc_connection_profile_get_dhcp_lease_duration_p, ITs_connection_profile_startup, ITs_connection_profile_cleanup}, {"ITc_connection_is_metered_network_p", ITc_connection_is_metered_network_p, ITs_connection_startup, ITs_connection_cleanup}, {"ITc_connection_profile_get_internet_state_p", ITc_connection_profile_get_internet_state_p, ITs_connection_profile_startup, ITs_connection_profile_cleanup}, + {"ITc_connection_get_dhcp_state_p", ITc_connection_get_dhcp_state_p, ITs_connection_startup, ITs_connection_cleanup}, + {"ITc_connection_set_unset_dhcp_state_changed_cb_p", ITc_connection_set_unset_dhcp_state_changed_cb_p, ITs_connection_startup, ITs_connection_cleanup}, {NULL, NULL} }; diff --git a/src/itc/connection/tct-connection-native_wearable.h b/src/itc/connection/tct-connection-native_wearable.h index 466fdb11f..f55ff4a6c 100755 --- a/src/itc/connection/tct-connection-native_wearable.h +++ b/src/itc/connection/tct-connection-native_wearable.h @@ -100,6 +100,8 @@ extern int ITc_connection_profile_get_dhcp_lease_duration_p(void); extern int ITc_connection_is_metered_network_p(void); extern int ITc_connection_set_unset_internet_state_changed_cb_p(void); extern int ITc_connection_profile_get_internet_state_p(void); +extern int ITc_connection_get_dhcp_state_p(void); +extern int ITc_connection_set_unset_dhcp_state_changed_cb_p(void); testcase tc_array[] = { {"ITc_connection_profile_get_dhcp_server_address_p",ITc_connection_profile_get_dhcp_server_address_p,ITs_connection_profile_startup, ITs_connection_profile_cleanup}, @@ -172,6 +174,8 @@ testcase tc_array[] = { {"ITc_connection_is_metered_network_p", ITc_connection_is_metered_network_p, ITs_connection_startup, ITs_connection_cleanup}, {"ITc_connection_set_unset_internet_state_changed_cb_p", ITc_connection_set_unset_internet_state_changed_cb_p, ITs_connection_startup, ITs_connection_cleanup}, {"ITc_connection_profile_get_internet_state_p", ITc_connection_profile_get_internet_state_p, ITs_connection_profile_startup, ITs_connection_profile_cleanup}, + {"ITc_connection_get_dhcp_state_p", ITc_connection_get_dhcp_state_p, ITs_connection_startup, ITs_connection_cleanup}, + {"ITc_connection_set_unset_dhcp_state_changed_cb_p", ITc_connection_set_unset_dhcp_state_changed_cb_p, ITs_connection_startup, ITs_connection_cleanup}, {NULL, NULL} };