[UTC][connection][ACR-1072][Add new API to check whether metered or non metered]
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 27 Sep 2017 08:14:51 +0000 (17:14 +0900)
committertaesub kim <taesub.kim@samsung.com>
Tue, 10 Oct 2017 01:05:48 +0000 (01:05 +0000)
Change-Id: Icc17c111f0160d94591625c73f3a9d1e22e0e5ca
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/utc/connection/public.list
src/utc/connection/tct-connection-core_mobile.h
src/utc/connection/tct-connection-core_wearable.h
src/utc/connection/utc-network-connection.c

index de0a96466fe67224124532f75d683d4fc1f40a91..27b6d2e08a377b2a3b70b8f49e7fca5406334dfe 100755 (executable)
@@ -84,4 +84,5 @@ connection_unset_proxy_address_changed_cb
 connection_unset_type_changed_cb
 connection_unset_ethernet_cable_state_chaged_cb
 connection_update_profile
+connection_is_metered_network
 
index 9a1bae32a1030725be2439e77338588991468062..031fc1aacc3ea8602e005c61f945c9d65b7830ff 100755 (executable)
@@ -148,6 +148,8 @@ extern int utc_connection_get_proxy_p(void);
 extern int utc_connection_get_proxy_n(void);
 extern int utc_connection_get_type_n(void);
 extern int utc_connection_get_type_p(void);
+extern int utc_connection_is_metered_network_n(void);
+extern int utc_connection_is_metered_network_p(void);
 extern int utc_connection_get_cellular_state_n(void);
 extern int utc_connection_get_cellular_state_p(void);
 extern int utc_connection_get_ethernet_state_n(void);
@@ -354,6 +356,8 @@ testcase tc_array[] = {
     {"utc_connection_get_proxy_n", utc_connection_get_proxy_n, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_type_n", utc_connection_get_type_n, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_type_p", utc_connection_get_type_p, utc_network_connection_startup, utc_network_connection_cleanup},
+    {"utc_connection_is_metered_network_n", utc_connection_is_metered_network_n, utc_network_connection_startup, utc_network_connection_cleanup},
+    {"utc_connection_is_metered_network_p", utc_connection_is_metered_network_p, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_cellular_state_n", utc_connection_get_cellular_state_n, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_cellular_state_p", utc_connection_get_cellular_state_p, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_ethernet_state_n", utc_connection_get_ethernet_state_n, utc_network_connection_startup, utc_network_connection_cleanup},
index 9a1bae32a1030725be2439e77338588991468062..031fc1aacc3ea8602e005c61f945c9d65b7830ff 100755 (executable)
@@ -148,6 +148,8 @@ extern int utc_connection_get_proxy_p(void);
 extern int utc_connection_get_proxy_n(void);
 extern int utc_connection_get_type_n(void);
 extern int utc_connection_get_type_p(void);
+extern int utc_connection_is_metered_network_n(void);
+extern int utc_connection_is_metered_network_p(void);
 extern int utc_connection_get_cellular_state_n(void);
 extern int utc_connection_get_cellular_state_p(void);
 extern int utc_connection_get_ethernet_state_n(void);
@@ -354,6 +356,8 @@ testcase tc_array[] = {
     {"utc_connection_get_proxy_n", utc_connection_get_proxy_n, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_type_n", utc_connection_get_type_n, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_type_p", utc_connection_get_type_p, utc_network_connection_startup, utc_network_connection_cleanup},
+    {"utc_connection_is_metered_network_n", utc_connection_is_metered_network_n, utc_network_connection_startup, utc_network_connection_cleanup},
+    {"utc_connection_is_metered_network_p", utc_connection_is_metered_network_p, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_cellular_state_n", utc_connection_get_cellular_state_n, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_cellular_state_p", utc_connection_get_cellular_state_p, utc_network_connection_startup, utc_network_connection_cleanup},
     {"utc_connection_get_ethernet_state_n", utc_connection_get_ethernet_state_n, utc_network_connection_startup, utc_network_connection_cleanup},
index 26472c394e5e8196ef266af9fe5e814e6a1923e2..204d9b22d5f2d82b31ceb07847999be6eec68273 100755 (executable)
@@ -401,6 +401,60 @@ int utc_connection_get_type_p(void)
        return 0;
 }
 
+/**
+ * @testcase           utc_connection_is_metered_network_n
+ * @since_tizen        4.0
+ * @type               Negative
+ * @description                connection_is_metered_network should fail with invalid parameter.
+ * @scenario           Verify utc_connection_is_metered_network_n by passing invalid parameter.
+ */
+int utc_connection_is_metered_network_n(void)
+{
+       int ret;
+       bool state;
+
+       if (all_features_not_supported) {
+               ret = connection_is_metered_network(connection, NULL);
+               CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       ret = connection_is_metered_network(NULL, NULL);
+       CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_INVALID_PARAMETER);
+       ret = connection_is_metered_network(NULL, &state);
+       CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_INVALID_PARAMETER);
+       ret = connection_is_metered_network(connection, NULL);
+       CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_INVALID_PARAMETER);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_connection_is_metered_network_p
+ * @since_tizen        4.0
+ * @type               Positive
+ * @description                Gets if the current connection is metered.
+ * @scenario           Invoking utc_connection_is_metered_network_p with valid parameter.
+ */
+int utc_connection_is_metered_network_p(void)
+{
+       bool state = false;
+       connection_type_e type;
+
+       int ret = connection_is_metered_network(connection, &state);
+       int err = connection_get_type(connection, &type);
+
+       if (all_features_not_supported) {
+               CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_NOT_SUPPORTED);
+       } else if (state) {
+               CHECK_RETURN("connection_is_metered_network", type, CONNECTION_TYPE_CELLULAR);
+       } else {
+               CHECK_RETURN("connection_is_metered_network", ret, CONNECTION_ERROR_NONE);
+       }
+
+       return 0;
+}
+
 /**
  * @testcase           utc_connection_get_cellular_state_n
  * @since_tizen        2.3