[UTC][Connection][Non-ACR][Add to check for cellular state]
authorhyunuktak <hyunuk.tak@samsung.com>
Fri, 3 Jun 2016 06:17:44 +0000 (15:17 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Fri, 3 Jun 2016 06:31:57 +0000 (15:31 +0900)
Change-Id: I175bd9360ef902bfa054546a3b4b37994a9a7bf5
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
src/utc/connection/utc-network-connection.c

index e8b7ad4..ab23db9 100755 (executable)
@@ -876,8 +876,14 @@ int utc_connection_get_default_cellular_service_profile_p(void)
         return 0;
     }
 
+    connection_cellular_state_e state;
+    int ret = connection_get_cellular_state(connection, &state);
+    assert_eq(ret, CONNECTION_ERROR_NONE);
+    if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
+           return 0;
+
     int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET;
-    int ret = connection_get_default_cellular_service_profile(connection, service_type, &profile);
+    ret = connection_get_default_cellular_service_profile(connection, service_type, &profile);
     assert_eq(ret, CONNECTION_ERROR_NONE);
 
     service_type = CONNECTION_CELLULAR_SERVICE_TYPE_MMS;
@@ -935,7 +941,13 @@ int utc_connection_set_default_cellular_service_profile_p(void)
         return 0;
     }
 
-    int ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular);
+    connection_cellular_state_e state;
+    int ret = connection_get_cellular_state(connection, &state);
+    assert_eq(ret, CONNECTION_ERROR_NONE);
+    if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
+           return 0;
+
+    ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular);
     assert_eq(ret, CONNECTION_ERROR_NONE);
 
     ret = connection_set_default_cellular_service_profile(connection, service_type, profile_cellular);
@@ -989,7 +1001,13 @@ int utc_connection_set_default_cellular_service_profile_async_p(void)
         return 0;
     }
 
-    int ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular);
+    connection_cellular_state_e state;
+    int ret = connection_get_cellular_state(connection, &state);
+    assert_eq(ret, CONNECTION_ERROR_NONE);
+    if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE)
+           return 0;
+
+    ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular);
     assert_eq(ret, CONNECTION_ERROR_NONE);
 
     ret = connection_set_default_cellular_service_profile_async(connection, service_type, profile_cellular, test_connection_set_default_callback, NULL);