[UTC][connection][Non-ACR][Add to check telephony service state]
authorhyunuktak <hyunuk.tak@samsung.com>
Tue, 29 Nov 2016 05:25:28 +0000 (14:25 +0900)
committerhyunuktak <hyunuk.tak@samsung.com>
Tue, 6 Dec 2016 10:39:19 +0000 (19:39 +0900)
Change-Id: I49b4016ef874c23b9d88dcdab5ff13d9fc14999c
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
src/utc/connection/utc-network-connection.c

index ab23db94c24a9b22b24c3d497ee65d6257056dd6..7ecb5eceac146e86db181b9842094895a549651c 100755 (executable)
@@ -2153,21 +2153,28 @@ int utc_connection_open_profile_n(void)
  */
 int utc_connection_close_profile_p(void)
 {
-    connection_profile_h profile_h = NULL;
-    int ret = test_get_any_profile(&profile_h);
+       connection_profile_h profile_h = NULL;
+       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) {
+               fprintf(stderr, "Cellular state is out of service at %s:%d", __FILE__, __LINE__);
+               return 0;
+       }
+
+       ret = test_get_any_profile(&profile_h);
 
        if(!telephony_supported && !wifi_supported && !bt_tethering_supported){
                ret = connection_close_profile(connection, profile_temp, test_connection_closed_callback, NULL);
-           assert_eq(ret, CONNECTION_ERROR_NOT_SUPPORTED);
+               assert_eq(ret, CONNECTION_ERROR_NOT_SUPPORTED);
                return 0;
        }
 
-    assert(profile_h);
-    profile_temp = profile_h;
-    ret = connection_close_profile(connection, profile_temp, test_connection_closed_callback, NULL);
-    assert_eq(ret, CONNECTION_ERROR_NONE);
-
-    return 0;
+       assert(profile_h);
+       profile_temp = profile_h;
+       ret = connection_close_profile(connection, profile_temp, test_connection_closed_callback, NULL);
+       assert_eq(ret, CONNECTION_ERROR_NONE);
+       return 0;
 }
 
 /**