[ITC][connection][ACR-1452][Add APi for getting connection state] 57/215757/3
authormanoj <manoj.g2@samsung.com>
Tue, 15 Oct 2019 09:43:59 +0000 (15:13 +0530)
committershobhit verma <shobhit.v@samsung.com>
Tue, 15 Oct 2019 11:08:18 +0000 (11:08 +0000)
Change-Id: Ica6fc9715f0d7c328c075370f3f8f559b1a47f8f
Signed-off-by: manoj <manoj.g2@samsung.com>
src/itc/connection/ITs-connection-profile.c
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_wearable.h

index 5a8ac25a20d2790ba2423a8fc86d73df56567584..6341e00540c8a23363532d08bdab9e7e753809a6 100755 (executable)
@@ -1543,3 +1543,32 @@ int ITc_connection_profile_get_dhcp_lease_duration_p(void)
        return 0;
 }
 
+//& purpose:  To get profile connection internet state
+//& type : auto
+/**
+* @testcase                    ITc_connection_profile_get_internet_state_p
+* @since_tizen                 5.5
+* @author                      SRID(manoj.g2)
+* @reviewer                    SRID(shobhit.v)
+* @description                 To get profile connection internet state
+* @apicovered                  connection_profile_get_internet_state
+* @passcase                    When connection_profile_get_internet_state return CONNECTION_ERROR_NONE
+* @failcase                    When connection_profile_get_internet_state not return CONNECTION_ERROR_NONE
+* @precondition                        None
+* @postcondition               None
+*/
+int ITc_connection_profile_get_internet_state_p(void)
+{
+       START_TEST;
+
+       connection_internet_state_e eConectionState = -1;
+       int nRet = connection_profile_get_internet_state(g_hConnectionProfileHandleCellular, &eConectionState);
+       PRINT_RESULT(CONNECTION_ERROR_NONE, nRet, "connection_profile_get_internet_state", ConnectionGetError(nRet));
+
+       if(eConectionState > CONNECTION_INTERNET_STATE_ONLINE || eConectionState < CONNECTION_INTERNET_STATE_OFFLINE)
+       {
+               FPRINTF("[Line : %d][%s] connection state is invalid=%d\\n", __LINE__, API_NAMESPACE, eConectionState);
+               return 1;
+       }
+       return 0;
+}
index 84aceeba8e28b40d31ced651e674cef9e3ce564b..fbe6ba749bb51b20649842c57cb9beb5b63ad35d 100755 (executable)
@@ -43,6 +43,10 @@ gboolean fn_WaitingCallbackResponse(gpointer data)
        return false;
 }
 
+void ConnectionInternetStateChangedCB(connection_internet_state_e state, void* user_data)
+{
+       FPRINTF("[Line : %d][%s]Inside ConnectionInternetStateChangedCB callback\n", __LINE__, API_NAMESPACE);
+}
 void test_network_state_changed_cb(connection_type_e state, void* user_data)
 {
        FPRINTF("[Line : %d][%s]Inside test_network_state_changed_cb\\n", __LINE__, API_NAMESPACE);
@@ -1188,5 +1192,40 @@ int ITc_connection_is_metered_network_p(void)
         return 0;
 }
 
+//& purpose: To check whether internet state changed
+//& type : auto
+/**
+* @testcase                     ITc_connection_set_unset_internet_state_changed_cb_p
+* @since_tizen                  5.5
+* @author                       SRID(manoj.g2)
+* @reviewer                     SRID(shobhit.v)
+* @description                  To check for internet state changed callback .
+* @apicovered                  connection_set_internet_state_changed_cb, connection_unset_internet_state_changed_cb
+* @passcase                     When connection_set_internet_state_changed_cb, connection_unset_internet_state_changed_cb return CONNECTION_ERROR_NONE
+* @failcase                     When connection_set_internet_state_changed_cb, connection_unset_internet_state_changed_cb not return CONNECTION_ERROR_NONE
+* @precondition                 None
+* @postcondition                None
+*/
+
+int ITc_connection_set_unset_internet_state_changed_cb_p(void)
+{
+        START_TEST;
+
+        if (g_nPreconditionError == 1)
+        {
+                FPRINTF("[Line: %d][%s] ITc_connection_set_unset_internet_state_changed_cb_p failed\\n", __LINE__, API_NAMESPACE);
+                return 1;
+        }
+
+       int nRet = -1;
+
+       nRet = connection_set_internet_state_changed_cb(g_hConnection, ConnectionInternetStateChangedCB, NULL);
+       PRINT_RESULT(CONNECTION_ERROR_NONE, nRet, "connection_set_internet_state_changed_cb", ConnectionGetError(nRet));
+
+       nRet = connection_unset_internet_state_changed_cb(g_hConnection);
+       PRINT_RESULT(CONNECTION_ERROR_NONE, nRet, "connection_unset_internet_state_changed_cb", ConnectionGetError(nRet));
+
+        return 0;
+}
 /** @} */ 
 /** @} */
index 069727e9c435f52bd76acda2213b247f795d9dfb..69f2a1b30bbdcb9ea090a1e86e23f8ed9fd18f6a 100755 (executable)
@@ -101,6 +101,8 @@ extern int ITc_connection_add_remove_route_entry_p(void);
 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_set_unset_internet_state_changed_cb_p(void);
+extern int ITc_connection_profile_get_internet_state_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},
@@ -174,6 +176,8 @@ testcase tc_array[] = {
     {"ITc_connection_add_remove_route_entry_p",ITc_connection_add_remove_route_entry_p,ITs_connection_startup,ITs_connection_cleanup},
     {"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_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},
     {NULL, NULL}
 };
 
index 069727e9c435f52bd76acda2213b247f795d9dfb..69f2a1b30bbdcb9ea090a1e86e23f8ed9fd18f6a 100755 (executable)
@@ -101,6 +101,8 @@ extern int ITc_connection_add_remove_route_entry_p(void);
 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_set_unset_internet_state_changed_cb_p(void);
+extern int ITc_connection_profile_get_internet_state_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},
@@ -174,6 +176,8 @@ testcase tc_array[] = {
     {"ITc_connection_add_remove_route_entry_p",ITc_connection_add_remove_route_entry_p,ITs_connection_startup,ITs_connection_cleanup},
     {"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_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},
     {NULL, NULL}
 };
 
index 069727e9c435f52bd76acda2213b247f795d9dfb..69f2a1b30bbdcb9ea090a1e86e23f8ed9fd18f6a 100755 (executable)
@@ -101,6 +101,8 @@ extern int ITc_connection_add_remove_route_entry_p(void);
 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_set_unset_internet_state_changed_cb_p(void);
+extern int ITc_connection_profile_get_internet_state_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},
@@ -174,6 +176,8 @@ testcase tc_array[] = {
     {"ITc_connection_add_remove_route_entry_p",ITc_connection_add_remove_route_entry_p,ITs_connection_startup,ITs_connection_cleanup},
     {"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_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},
     {NULL, NULL}
 };