Merge "Remove DEPRECATED connection_set_ethernet_cable_state_chaged_cb() call" into...
[platform/core/api/connection.git] / test / connection_test.c
index 5ea1d4e..7236b33 100755 (executable)
@@ -92,6 +92,14 @@ static const char *test_print_state(connection_profile_state_e state)
        }
 }
 
+static const char *test_print_internet_state(connection_internet_state_e state)
+{
+       if (state == CONNECTION_INTERNET_STATE_ONLINE)
+               return "Online";
+
+       return "Offline";
+}
+
 static const char *test_print_connection_type(connection_type_e type)
 {
        switch (type) {
@@ -257,6 +265,11 @@ static void test_proxy_changed_callback(const char* ipv4_address, const char* ip
                        ipv4_address, (ipv6_address ? ipv6_address : "NULL"));
 }
 
+static void test_internet_state_changed_callback(connection_internet_state_e state, void* user_data)
+{
+       printf("Internet state changed callback, state : %d\n", state);
+}
+
 static void test_profile_state_callback(connection_profile_state_e state, void* user_data)
 {
        char *profile_name;
@@ -1034,6 +1047,7 @@ int test_register_client(void)
                connection_set_proxy_address_changed_cb(connection, test_proxy_changed_callback, NULL);
                connection_set_ethernet_cable_state_changed_cb(connection,
                                        test_get_ethernet_cable_state_callback, NULL);
+               connection_set_internet_state_changed_cb(connection, test_internet_state_changed_callback, NULL);
        } else {
                printf("Client registration failed [%s]\n", test_print_error(err));
                return -1;
@@ -1628,6 +1642,7 @@ int test_get_profile_info(void)
        connection_profile_type_e prof_type;
        connection_profile_state_e profile_state;
        connection_profile_state_e profile_ipv6_state;
+       connection_internet_state_e internet_state;
        connection_profile_h profile;
        char *profile_name = NULL;
        int address_family = 0;
@@ -1656,6 +1671,11 @@ int test_get_profile_info(void)
        } else
                printf("Profile IPv6 State : %s\n", test_print_state(profile_ipv6_state));
 
+       if (connection_profile_get_internet_state(profile, &internet_state) != CONNECTION_ERROR_NONE) {
+               printf("Fail to get Internet state\n");
+               return -1;
+       } else
+               printf("Internet State : %s\n", test_print_internet_state(internet_state));
 
        if (connection_profile_get_type(profile, &prof_type) != CONNECTION_ERROR_NONE)
                return -1;