[ITC][connection][ACR-1769] Added new TCs for getting dhcp state 73/298773/3
authorTarun Kumar <tarun1.kumar@samsung.com>
Wed, 13 Sep 2023 09:02:28 +0000 (14:32 +0530)
committerTarun Kumar <tarun1.kumar@samsung.com>
Thu, 14 Sep 2023 10:31:14 +0000 (16:01 +0530)
Change-Id: I71c77c48cbc5c15018472173caff47d6dd0607c6
Signed-off-by: Tarun Kumar <tarun1.kumar@samsung.com>
src/itc/connection/ITs-connection.c
src/itc/connection/tct-connection-native_mobile.h
src/itc/connection/tct-connection-native_tizeniot.h
src/itc/connection/tct-connection-native_tv.h
src/itc/connection/tct-connection-native_wearable.h

index 58b37d78de0c0266ebb8f605ddaaefda881b77a4..b7e6bf33d581db966ccaf67b47b6143c40ef8e0f 100755 (executable)
@@ -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;
+}
 /** @} */
 /** @} */
index 466fdb11f7154e950925b0dab82bfddf14f18780..f55ff4a6cec37f812ccb90b970b916ba6d7d4da7 100755 (executable)
@@ -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}
 };
 
index 466fdb11f7154e950925b0dab82bfddf14f18780..f55ff4a6cec37f812ccb90b970b916ba6d7d4da7 100755 (executable)
@@ -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}
 };
 
index d5c0bcd7a3b99a8e5e1940988464f2653c2c7e5b..0403727a35feb15a7e4860594605d423dee82b23 100755 (executable)
@@ -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}
 };
 
index 466fdb11f7154e950925b0dab82bfddf14f18780..f55ff4a6cec37f812ccb90b970b916ba6d7d4da7 100755 (executable)
@@ -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}
 };