Add new API to check whether metered or non metered
[platform/core/api/connection.git] / test / connection_test.c
index 588d06c..815a918 100755 (executable)
@@ -860,6 +860,7 @@ static void test_print_network_info(connection_profile_h profile, connection_add
        char *subnet = NULL;
        char *gateway = NULL;
        char *dhcp_server = NULL;
+       int dhcp_lease_duration = 0;
        char *dns1 = NULL;
        char *dns2 = NULL;
        char *proxy = NULL;
@@ -901,6 +902,12 @@ static void test_print_network_info(connection_profile_h profile, connection_add
                g_free(dhcp_server);
        }
 
+       if (connection_profile_get_dhcp_lease_duration(profile, address_family, &dhcp_lease_duration) != CONNECTION_ERROR_NONE)
+               printf("Fail to get DHCP lease duration!\n");
+       else {
+               printf("DHCP lease duration : %d\n", dhcp_lease_duration);
+       }
+
        if (connection_profile_get_subnet_mask(profile, address_family, &subnet) != CONNECTION_ERROR_NONE)
                printf("Fail to get subnet mask!\n");
        else {
@@ -2100,6 +2107,23 @@ int test_foreach_ipv6_address(void)
        return 1;
 }
 
+int test_is_metered_network(void)
+{
+       int rv = 0;
+       bool metered_state;
+
+       rv = connection_is_metered_network(connection, &metered_state);
+
+       if (rv != CONNECTION_ERROR_NONE) {
+               printf("Fail to get metered state [%s]\n", test_print_error(rv));
+               return -1;
+       }
+
+       printf("Retval = [%s] metered state [%s]\n",
+               test_print_error(rv), metered_state ? "TRUE" : "FALSE");
+
+       return 1;
+}
 
 int main(int argc, char **argv)
 {
@@ -2171,7 +2195,10 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
                printf("x   - Get ethernet cable state\n");
                printf("B   - Add IPv6 new route\n");
                printf("C   - Remove IPv6 route\n");
-               printf("D   - Get IPv6 address\n");
+               printf("D   - Add new route entry\n");
+               printf("E   - Remove route entry\n");
+               printf("F   - Get all IPv6 address\n");
+               printf("G   - Get metered state\n");
                printf(LOG_RED "0   - Exit \n" LOG_END);
                printf("ENTER   - Show options menu.......\n");
        }
@@ -2291,6 +2318,9 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data)
        case 'F':
                rv = test_foreach_ipv6_address();
                break;
+       case 'G':
+               rv = test_is_metered_network();
+               break;
        }
 
        if (rv == 1)