Add testcases for GTest (bt-share) 20/167020/2
authorDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 15 Jan 2018 05:20:28 +0000 (14:20 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 15 Jan 2018 05:23:48 +0000 (14:23 +0900)
36 testcases (Line Cov: 84.4%, Func Cov: 92.5%)

Change-Id: I7933e307414d89b0e3dc7cea2629e63a72241632
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-share/include/bt-share-common.h
bt-share/include/obex-event-handler.h
bt-share/src/bt-share-common.c
bt-share/src/bt-share-main.c
bt-share/src/bt-share-noti-handler.c
bt-share/src/bt-share-syspopup.c
bt-share/src/obex-event-handler.c
unittest/bluetooth-share_test.cpp

index 8a0f4bf..90e38d1 100644 (file)
@@ -35,6 +35,9 @@ extern "C" {
 
 #define STORAGE_PATH_LEN_MAX 255
 
+#define BT_ADDRESS_STRING_SIZE 18 /**< This specifies bluetooth device address string length */
+#define BT_ADDRESS_LENGTH 6 /**< This specifies bluetooth device address length */
+
 #define BT_OBEX_PATH_PREFIX "/opt/usr/media"
 #define BT_OBEX_DEFAULT_PATH "/opt/usr/home/owner/media"
 
@@ -74,8 +77,12 @@ char *_bt_share_create_transfer_file(char *text);
 void _bt_remove_tmp_file(char *file_path);
 void _bt_remove_vcf_file(char *file_path);
 char *_bt_get_time_of_the_day(void);
+void _bt_get_default_storage(char *storage);
 char *_bt_share_get_storage_path(int storage_type);
 int _bt_share_get_active_uid(uid_t *uid);
+void _bt_convert_addr_type_to_string(char *address, char *addr);
+int _bt_get_available_int_memory(double *dAvail);
+gboolean _bt_get_available_ext_memory(unsigned long long *available_mem_size);
 
 #ifdef __cplusplus
 }
index 35a1c9c..2ef1cc7 100644 (file)
@@ -26,11 +26,11 @@ extern "C" {
 
 #include "bluetooth-api.h"
 #include "bt-share-main.h"
+#include "bt-share-common.h"
 
 #define BT_FILE_PATH_LEN_MAX   (4096 + 10)
 #define BT_TEMP_FILE_PATH_LEN_MAX 262
 #define BT_TEXT_LEN_MAX 255
-#define BT_ADDRESS_STRING_SIZE 18 /**< This specifies bluetooth device address string length */
 #define BLUETOOTH_DEVICE_NAME_LENGTH_MAX 248 /**< This specifies maximum device name length */
 
 typedef enum {
@@ -66,13 +66,8 @@ void _bt_clear_receive_noti_list(void);
 void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                               void *user_data);
 
-void _bt_get_default_storage(char *storage);
-
 void _bt_obex_cancel_transfer(void *data);
 
-void _bt_convert_addr_type_to_string(char *address,
-                               char *addr);
-
 void _bt_obex_server_event_handler(int event,
                                       bluetooth_event_param_t *param,
                                       void *user_data);
index 9096f83..b8b7f09 100644 (file)
@@ -283,6 +283,31 @@ static bool __bt_get_storage_id(int sid, storage_type_e type, storage_state_e st
        return true;
 }
 
+void _bt_get_default_storage(char *storage)
+{
+       int val = BT_DEFAULT_MEM_PHONE;
+       char *path = NULL;
+
+       if (vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
+                                               (void *)&val)) {
+               ERR("vconf error");
+               val = BT_DEFAULT_MEM_PHONE;
+       }
+
+       path = _bt_share_get_storage_path(val);
+
+       if (path == NULL)
+               path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER);
+
+       g_strlcpy(storage, path, STORAGE_PATH_LEN_MAX);
+       g_free(path);
+
+       DBG("Default storage : %s\n", storage);
+
+       if (access(storage, W_OK) != 0)
+               DBG("Can't access the storage");
+}
+
 char *_bt_share_get_storage_path(int storage_type)
 {
        int ret = 0;
@@ -348,3 +373,50 @@ int _bt_share_get_active_uid(uid_t *uid)
        return BT_SHARE_ERROR_NONE;
 }
 
+void _bt_convert_addr_type_to_string(char *address,
+                               char *addr)
+{
+       ret_if(address == NULL || addr == NULL);
+
+       g_snprintf(address, BT_ADDRESS_STRING_SIZE,
+                       "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
+                       addr[0], addr[1], addr[2],
+                       addr[3], addr[4], addr[5]);
+}
+
+int _bt_get_available_int_memory(double *dAvail)
+{
+       struct statvfs s = { 0, };
+       int r = 0;
+
+       r = storage_get_internal_memory_size(&s);
+       if (r < 0)
+               ERR("ret : %d", r);
+       else {
+               INFO("total : %lf, avail : %lf",
+               (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
+               *dAvail = (double)s.f_bsize*s.f_bavail;
+       }
+
+       return r;
+}
+
+gboolean _bt_get_available_ext_memory(unsigned long long *available_mem_size)
+{
+       struct statvfs s = {0, };
+       int r;
+
+       r = storage_get_internal_memory_size(&s);
+       if (r < 0) {
+               ERR("ret : %d", r);
+               *available_mem_size = 0;
+               return FALSE;
+       } else {
+               INFO("total : %lf, avail : %lf",
+               (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
+               *available_mem_size = (unsigned long long)s.f_bsize*s.f_bavail;
+       }
+
+       return TRUE;
+}
+
index d9db513..00851da 100644 (file)
@@ -71,6 +71,7 @@ void _bt_terminate_bluetooth_share(void)
        FN_END;
 }
 
+/* LCOV_EXCL_START */
 static void __bt_release_service(bt_appdata_t *ad)
 {
        ret_if(ad == NULL);
@@ -102,7 +103,9 @@ static void __bt_release_service(bt_appdata_t *ad)
 
        DBG("Terminating bluetooth-share daemon");
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void __bt_sigterm_handler(int signo)
 {
        FN_START;
@@ -114,7 +117,9 @@ static void __bt_sigterm_handler(int signo)
 
        FN_END;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void __bt_update_transfer_status_values(void)
 {
        bt_appdata_t *ad = app_state;
@@ -193,7 +198,9 @@ static void __bt_update_transfer_status_values(void)
        DBG("[Receive] success %d, fail %d", ad->recv_data.tr_success,
                        ad->recv_data.tr_fail);
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static GSList *__merge_sorted(GSList *inbound, GSList *outbound)
 {
        GSList *slist = NULL;
@@ -237,6 +244,7 @@ static GSList *__merge_sorted(GSList *inbound, GSList *outbound)
 
        return slist;
 }
+/* LCOV_EXCL_STOP */
 
 void _bt_remove_temporary_files_by_noti_id(sqlite3 *db, int noti_id)
 {
@@ -245,15 +253,18 @@ void _bt_remove_temporary_files_by_noti_id(sqlite3 *db, int noti_id)
 
        GSList *current_file = file_list;
        while (current_file) {
+               /* LCOV_EXCL_START */
                DBG("Removing [%s]", (char *)(current_file->data));
                ecore_file_remove((char *)(current_file->data));
                current_file = g_slist_next(current_file);
+               /* LCOV_EXCL_STOP */
        }
 
        bt_share_release_temporary_file_list(file_list);
        FN_END;
 }
 
+/* LCOV_EXCL_START */
 gboolean __bt_clean_database(gpointer user_data)
 {
        bt_appdata_t *ad = app_state;
@@ -342,7 +353,9 @@ gboolean __bt_clean_database(gpointer user_data)
        FN_END
        return G_SOURCE_REMOVE;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static gboolean __bt_dbus_request_name(void)
 {
        owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, BLUETOOTH_SHARE_BUS,
@@ -350,6 +363,7 @@ static gboolean __bt_dbus_request_name(void)
 
        return (owner_id != 0) ? TRUE : FALSE;
 }
+/* LCOV_EXCL_STOP */
 
 int _bt_init_obex_server(void)
 {
@@ -359,9 +373,11 @@ int _bt_init_obex_server(void)
        retvm_if(bluetooth_obex_server_init(storage) != BLUETOOTH_ERROR_NONE,
                        BT_SHARE_FAIL, "Fail to init obex server");
 
+       /* LCOV_EXCL_START */
        bluetooth_obex_server_set_root(BT_FTP_FOLDER);
 
        return BT_SHARE_ERROR_NONE;
+       /* LCOV_EXCL_STOP */
 }
 
 /* LCOV_EXCL_START */
index 4fa5f6f..98c6b9b 100644 (file)
@@ -35,6 +35,7 @@
 #include "bt-share-notification.h"
 #include "obex-event-handler.h"
 
+/* LCOV_EXCL_START */
 static void __bt_default_memory_changed_cb(keynode_t *node, void *data)
 {
        FN_START;
@@ -79,7 +80,9 @@ static void __bt_default_memory_changed_cb(keynode_t *node, void *data)
 
        FN_END;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void __bt_mmc_status_changed_cb(keynode_t *node, void *data)
 {
        FN_START;
@@ -154,6 +157,7 @@ static void __bt_mmc_status_changed_cb(keynode_t *node, void *data)
 
        FN_END;
 }
+/* LCOV_EXCL_STOP */
 
 void _bt_init_vconf_notification(void *data)
 {
index cff757a..58693f0 100644 (file)
@@ -58,9 +58,16 @@ int _bt_launch_system_popup(bt_app_event_type_e event_type,
        FN_START;
        int ret = BT_SHARE_ERROR_NONE;
        bundle *b = NULL;
-       bt_appdata_t *ad = app_state;
+       bt_appdata_t *ad = NULL;
        char event_str[BT_SYSPOPUP_EVENT_LEN_MAX] = {0, };
 
+       if (data)
+               ad = (bt_appdata_t *)data;
+       else
+               ad = app_state;
+
+       retv_if(!ad, BT_SHARE_FAIL);
+
        b = bundle_create();
        retvm_if(!b, BT_SHARE_FAIL, "bundle_create failed");
 
index 881734e..312f2b7 100644 (file)
@@ -82,17 +82,7 @@ static void *__bt_obex_writeclose(bt_file_info_t *info);
 
 static void __bt_obex_file_push_auth(bt_obex_server_authorize_into_t *server_auth_info);
 
-void _bt_convert_addr_type_to_string(char *address,
-                               char *addr)
-{
-       ret_if(address == NULL || addr == NULL);
-
-       g_snprintf(address, BT_ADDRESS_STRING_SIZE,
-                       "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
-                       addr[0], addr[1], addr[2],
-                       addr[3], addr[4], addr[5]);
-}
-
+/* LCOV_EXCL_START */
 static void __bt_free_rcv_notification(gpointer data)
 {
        bt_device_rcv_noti_info_t *noti_data = data;
@@ -104,7 +94,9 @@ static void __bt_free_rcv_notification(gpointer data)
        g_free(noti_data->db_sid);
        g_free(noti_data);
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void __bt_free_snd_notification(gpointer data)
 {
        bt_device_snd_noti_info_t *noti_data = data;
@@ -114,7 +106,9 @@ static void __bt_free_snd_notification(gpointer data)
        g_free(noti_data->db_sid);
        g_free(noti_data);
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void _bt_get_pending_list(bt_appdata_t *ad)
 {
        sqlite3 *db = NULL;
@@ -135,7 +129,9 @@ static void _bt_get_pending_list(bt_appdata_t *ad)
        if (ad->tr_send_list)
                ad->tr_next_data = ad->tr_send_list;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static bt_device_snd_noti_info_t *__bt_get_snd_noti_data_by_device_address(char *address)
 {
        GSList *l = NULL;
@@ -151,7 +147,9 @@ static bt_device_snd_noti_info_t *__bt_get_snd_noti_data_by_device_address(char
 
        return NULL;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static bt_device_rcv_noti_info_t *__bt_get_rcv_noti_data_by_device_address(char *address)
 {
        GSList *l = NULL;
@@ -167,7 +165,9 @@ static bt_device_rcv_noti_info_t *__bt_get_rcv_noti_data_by_device_address(char
 
        return NULL;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static bt_noti_data_t *__bt_get_noti_data_by_transfer_id(int transfer_id)
 {
        GSList *l = NULL;
@@ -183,7 +183,9 @@ static bt_noti_data_t *__bt_get_noti_data_by_transfer_id(int transfer_id)
 
        return NULL;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static char *__get_file_name(int cnt, char **path)
 {
        retvm_if(path == NULL || path[cnt] == NULL, NULL, "Path is invalid");
@@ -193,7 +195,9 @@ static char *__get_file_name(int cnt, char **path)
        DBG_SECURE("File name[%d] : %s", cnt, pfilename);
        return pfilename;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void __delete_notification(gpointer data, gpointer user_data)
 {
        bt_noti_data_t *noti_data = data;
@@ -202,6 +206,7 @@ static void __delete_notification(gpointer data, gpointer user_data)
        _bt_delete_notification(noti_data->noti_handle);
        g_free(noti_data);
 }
+/* LCOV_EXCL_STOP */
 
 void _bt_obex_cancel_transfer(void *data)
 {
@@ -213,6 +218,7 @@ void _bt_obex_cancel_transfer(void *data)
        int ret = 0;
 
        for (l = bt_receive_noti_list; l != NULL; l = l->next) {
+               /* LCOV_EXCL_START */
                noti_data = l->data;
                if (noti_data == NULL)
                        continue;
@@ -221,6 +227,7 @@ void _bt_obex_cancel_transfer(void *data)
                ret = bluetooth_obex_server_cancel_transfer(noti_data->transfer_id);
                warn_if(ret != BLUETOOTH_ERROR_NONE,
                        "bluetooth_obex_server_cancel_transfer[ret:%d]", ret);
+               /* LCOV_EXCL_STOP */
        }
        FN_END;
 }
@@ -228,14 +235,17 @@ void _bt_obex_cancel_transfer(void *data)
 void _bt_clear_receive_noti_list(void)
 {
        if (bt_receive_noti_list) {
+               /* LCOV_EXCL_START */
                g_slist_foreach(bt_receive_noti_list,
                                (GFunc)__delete_notification,
                                NULL);
                g_slist_free(bt_receive_noti_list);
                bt_receive_noti_list = NULL;
+               /* LCOV_EXCL_STOP */
        }
 }
 
+/* LCOV_EXCL_START */
 char *__get_dest_file_path(const char *path)
 {
        char file_path[BT_TEMP_FILE_PATH_LEN_MAX] = {0, };
@@ -260,13 +270,17 @@ char *__get_dest_file_path(const char *path)
        DBG_SECURE("File path %s", file_path);
        return g_strdup(file_path);
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void __free_file_info(bt_file_info_t *info)
 {
        g_free(info->file_path);
        g_free(info);
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static bt_file_type_e __get_file_type(char *extn)
 {
        DBG("extn : %s", extn);
@@ -281,7 +295,9 @@ static bt_file_type_e __get_file_type(char *extn)
        }
        return BT_FILE_OTHER;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static gboolean __bt_scan_media_file(char *file_path)
 {
        int ret = 0;
@@ -305,7 +321,9 @@ static gboolean __bt_scan_media_file(char *file_path)
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 void __bt_update_db_with_noti_id(bt_tr_db_table_e table, notification_h noti,
                const char *db_sid)
 {
@@ -318,8 +336,10 @@ void __bt_update_db_with_noti_id(bt_tr_db_table_e table, notification_h noti,
 
        bt_share_close_db(db);
 }
+/* LCOV_EXCL_STOP */
 
 #ifdef ENABLE_CONTACTS_SERVICE2
+/* LCOV_EXCL_START */
 void _bt_util_get_number(char *source, char *dest)
 {
        int len = 7;
@@ -554,8 +574,10 @@ fail:
 
        DBG("-");
 }
+/* LCOV_EXCL_STOP */
 #endif
 
+/* LCOV_EXCL_START */
 void _bt_share_event_handler(int event, bluetooth_event_param_t *param,
                               void *user_data)
 {
@@ -1361,69 +1383,9 @@ done:
        }
 
 }
+/* LCOV_EXCL_STOP */
 
-void _bt_get_default_storage(char *storage)
-{
-       int val = BT_DEFAULT_MEM_PHONE;
-       char *path = NULL;
-
-       if (vconf_get_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT,
-                                               (void *)&val)) {
-               ERR("vconf error");
-               val = BT_DEFAULT_MEM_PHONE;
-       }
-
-       path = _bt_share_get_storage_path(val);
-
-       if (path == NULL)
-               path = g_strdup(BT_DOWNLOAD_DEFAULT_MEDIA_FOLDER);
-
-       g_strlcpy(storage, path, STORAGE_PATH_LEN_MAX);
-       g_free(path);
-
-       DBG("Default storage : %s\n", storage);
-
-       if (access(storage, W_OK) != 0)
-               DBG("Can't access the storage");
-}
-
-static int __bt_get_available_int_memory(double *dAvail)
-{
-       struct statvfs s = { 0, };
-       int r = 0;
-
-       r = storage_get_internal_memory_size(&s);
-       if (r < 0)
-               ERR("ret : %d", r);
-       else {
-               INFO("total : %lf, avail : %lf",
-               (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
-               *dAvail = (double)s.f_bsize*s.f_bavail;
-       }
-
-       return r;
-}
-
-
-static gboolean __bt_get_available_ext_memory(unsigned long long *available_mem_size)
-{
-       struct statvfs s = {0, };
-       int r;
-
-       r = storage_get_internal_memory_size(&s);
-       if (r < 0) {
-               ERR("ret : %d", r);
-               *available_mem_size = 0;
-               return FALSE;
-       } else {
-               INFO("total : %lf, avail : %lf",
-               (double)s.f_frsize*s.f_blocks, (double)s.f_bsize*s.f_bavail);
-               *available_mem_size = (unsigned long long)s.f_bsize*s.f_bavail;
-       }
-
-       return TRUE;
-}
-
+/* LCOV_EXCL_START */
 static gchar *__bt_get_unique_file_name(char *storage_path, char *filename)
 {
        char temp_filepath[BT_FILE_PATH_LEN_MAX] = { 0, };
@@ -1460,8 +1422,9 @@ static gchar *__bt_get_unique_file_name(char *storage_path, char *filename)
 
        return g_strdup(temp_filename);
 }
+/* LCOV_EXCL_STOP */
 
-
+/* LCOV_EXCL_START */
 static void __bt_app_obex_openwrite_requested(bt_obex_server_authorize_into_t
                                                        *server_auth_info)
 {
@@ -1505,7 +1468,9 @@ static void __bt_app_obex_openwrite_requested(bt_obex_server_authorize_into_t
 
        bluetooth_obex_server_accept_authorize(server_auth_info->filename);
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void __bt_obex_file_push_auth(bt_obex_server_authorize_into_t
                                                        *server_auth_info)
 {
@@ -1525,7 +1490,7 @@ static void __bt_obex_file_push_auth(bt_obex_server_authorize_into_t
        INFO("File Length =%ld", server_auth_info->length);
 
        if (val == BT_DEFAULT_MEM_MMC) {
-               ret = __bt_get_available_ext_memory(&available_ext_mem_size);
+               ret = _bt_get_available_ext_memory(&available_ext_mem_size);
                if (ret == FALSE) {
                        ERR("Unable to get available memory size");
                        goto reject;
@@ -1539,7 +1504,7 @@ static void __bt_obex_file_push_auth(bt_obex_server_authorize_into_t
                        goto reject;
                }
        } else {
-               if (__bt_get_available_int_memory(&available_int_mem_size) < 0) {
+               if (_bt_get_available_int_memory(&available_int_mem_size) < 0) {
                        ERR("Unable to get available memory size");
                        goto reject;
                }
@@ -1570,8 +1535,10 @@ reject:
 
        FN_END;
 }
+/* LCOV_EXCL_STOP */
 
 #ifdef ENABLE_CONTACTS_SERVICE2
+/* LCOV_EXCL_START */
 static bool __bt_vcard_handler(contacts_record_h record, void *user_data)
 {
        int ret = 0;
@@ -1582,9 +1549,11 @@ static bool __bt_vcard_handler(contacts_record_h record, void *user_data)
 
        return true;
 }
+/* LCOV_EXCL_STOP */
 #endif /* ENABLE_CONTACTS_SERVICE2 */
 
 #ifdef ENABLE_CALENDAR_SERVICE2
+/* LCOV_EXCL_START */
 static bool __bt_vcalendar_handler(calendar_record_h record, void *user_data)
 {
        int ret = 0;
@@ -1594,9 +1563,11 @@ static bool __bt_vcalendar_handler(calendar_record_h record, void *user_data)
                "calendar_db_insert_record error : %d", ret);
 
        return true;
+       /* LCOV_EXCL_STOP */
 }
 #endif /* ENABLE_CALENDAR_SERVICE2 */
 
+/* LCOV_EXCL_START */
 static gboolean __bt_save_v_object(char *file_path,
                                            bt_file_type_e file_type)
 {
@@ -1663,7 +1634,9 @@ static gboolean __bt_save_v_object(char *file_path,
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
+/* LCOV_EXCL_START */
 static void *__bt_obex_writeclose(bt_file_info_t *info)
 {
        if (__bt_save_v_object(info->file_path, info->file_type) == FALSE) {
@@ -1676,3 +1649,4 @@ static void *__bt_obex_writeclose(bt_file_info_t *info)
 
        return NULL;
 }
+/* LCOV_EXCL_STOP */
index 99a164a..14ac91c 100644 (file)
 #include <gtest/gtest.h>
 #include <unistd.h>
 #include <glib.h>
+#include <syspopup_caller.h>
 #include "bluetooth-share-api.h"
 #include "bt-share-common.h"
 #include "bt-share-ipc.h"
 #include "bt-share-resource.h"
 #include "bt-share-main.h"
+#include "bt-share-noti-handler.h"
+#include "bt-share-notification.h"
+#include "bt-share-syspopup.h"
+#include "obex-event-handler.h"
 
 using ::testing::EmptyTestEventListener;
 using ::testing::InitGoogleTest;
@@ -260,6 +265,241 @@ TEST(BluetoothShare_test, _bt_terminate_bluetooth_share_p) {
        _bt_terminate_bluetooth_share();
 }
 
+
+TEST(BluetoothShare_test, _bt_remove_temporary_files_by_noti_id_p) {
+       sqlite3 *db = NULL;
+
+       db = bt_share_open_db();
+
+       _bt_remove_temporary_files_by_noti_id(db, 1);
+
+       bt_share_close_db(db);
+}
+
+TEST(BluetoothShare_test, _bt_init_obex_server_p) {
+       int ret = BT_SHARE_ERROR_NONE;
+
+       ret = _bt_init_obex_server();
+
+       /* bluetooth-share process already allocate the obex serivce, so will return the error */
+       /* ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE); */
+}
+
+TEST(BluetoothShare_test, _bt_init_vconf_notification_p) {
+       _bt_init_vconf_notification(NULL);
+
+       _bt_deinit_vconf_notification();
+}
+
+TEST(BluetoothShare_test, _bt_insert_instant_notification_p) {
+       _bt_insert_instant_notification(BT_SENT_NOTI);
+
+       _bt_insert_instant_notification(BT_SENT_FAILED_NOTI);
+
+       _bt_insert_instant_notification(BT_SENDING_NOTI);
+
+       _bt_insert_instant_notification(BT_RECEIVED_NOTI);
+
+       _bt_insert_instant_notification(BT_RECEIVED_FAILED_NOTI);
+
+       _bt_insert_instant_notification(BT_RECEIVING_NOTI);
+}
+
+TEST(BluetoothShare_test, _bt_notification_test_p) {
+       bt_appdata_t *ad = NULL;
+
+       notification_h noti = NULL;
+
+       ad = (bt_appdata_t *)calloc(1, sizeof(bt_appdata_t));
+
+
+       noti = _bt_insert_notification(ad,
+                                                       BT_SENDING_NOTI, "TEST",
+                                                       "test address", "1");
+
+       if (noti == NULL)
+               g_free(ad);
+
+       ASSERT_FALSE(noti == NULL);
+
+       ad->send_noti = noti;
+       ad->opc_noti_id = _bt_get_notification_priv_id(noti);
+
+       _bt_set_notification_app_launch(noti, "TEST", "test address", "1",
+                                       CREATE_TR_LIST, NOTI_TR_TYPE_OUT, NULL, 0, NULL, 0);
+
+       _bt_update_notification(ad, ad->send_noti,
+                                                       NULL, NULL, NULL, NULL, NULL);
+
+       _bt_delete_notification(noti);
+       ad->send_noti = NULL;
+
+       noti = _bt_insert_notification(ad,
+                                                       BT_RECEIVED_NOTI, "TEST",
+                                                       "test address", "1");
+
+       if (noti == NULL)
+               g_free(ad);
+
+       ASSERT_FALSE(noti == NULL);
+
+       ad->receive_noti = noti;
+
+       _bt_update_notification(ad, ad->receive_noti,
+                                                       NULL, NULL, NULL, NULL, NULL);
+
+       _bt_delete_notification(noti);
+       ad->receive_noti = NULL;
+
+       noti = _bt_insert_notification(ad,
+                                                       BT_SENDING_NOTI, "TEST",
+                                                       "test address", "1");
+
+       if (noti == NULL)
+               g_free(ad);
+
+       ASSERT_FALSE(noti == NULL);
+
+       ad->opc_noti_id = _bt_get_notification_priv_id(noti);
+
+       _bt_set_notification_app_launch(noti, "TEST", "test address",
+                                               "1", CREATE_PROGRESS, NOTI_TR_TYPE_OUT,
+                                               "TEST", 0, NULL, 1);
+
+       _bt_update_notification_progress(noti, ad->opc_noti_id, 100);
+
+       _bt_delete_notification(noti);
+
+       noti = _bt_insert_notification(ad,
+                                                       BT_RECEIVING_NOTI, "TEST",
+                                                       "test address", "1");
+
+       if (noti == NULL)
+               g_free(ad);
+
+       ASSERT_FALSE(noti == NULL);
+
+       _bt_delete_notification(noti);
+}
+
+
+TEST(BluetoothShare_test, _bt_register_notification_cb_p) {
+       _bt_register_notification_cb(NULL);
+
+       _bt_unregister_notification_cb(NULL);
+}
+
+TEST(BluetoothShare_test, _bt_launch_system_popup_p) {
+       bt_app_sys_popup_params_t popup_params = { NULL };
+       int ret = BT_SHARE_ERROR_NONE;
+       bt_appdata_t *ad = NULL;
+
+       ad = (bt_appdata_t *)calloc(1, sizeof(bt_appdata_t));
+
+       popup_params.title = BT_STR_MEMORY_FULL;
+       popup_params.type = "none";
+
+       ret = _bt_launch_system_popup(BT_APP_EVENT_CONFIRM_MODE_REQUEST,
+                               &popup_params, NULL, ad);
+
+       if (ret != BT_SHARE_ERROR_NONE)
+               g_free(ad);
+
+       ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+       syspopup_destroy_all();
+       usleep(1000 * 200);
+
+       ret = _bt_launch_system_popup(BT_APP_EVENT_FILE_RECEIVED,
+                               &popup_params, NULL, ad);
+
+       syspopup_destroy_all();
+       usleep(1000 * 200);
+
+       if (ret != BT_SHARE_ERROR_NONE)
+               g_free(ad);
+
+       ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+       ret = _bt_launch_system_popup(BT_APP_EVENT_INFORMATION,
+                       &popup_params, NULL, ad);
+
+       if (ret != BT_SHARE_ERROR_NONE)
+               g_free(ad);
+
+       ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+       syspopup_destroy_all();
+       usleep(1000 * 200);
+
+       ret = _bt_launch_system_popup(BT_APP_EVENT_OVERWRITE_REQUEST,
+                               &popup_params, NULL, ad);
+
+       if (ret != BT_SHARE_ERROR_NONE)
+               g_free(ad);
+
+       ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+       syspopup_destroy_all();
+       usleep(1000 * 200);
+}
+
+TEST(BluetoothShare_test, _bt_app_popup_memoryfull_p) {
+       _bt_app_popup_memoryfull(NULL);
+}
+
+TEST(BluetoothShare_test, _bt_convert_addr_type_to_string_p) {
+       char bd_addr[BT_ADDRESS_STRING_SIZE] = {0, };
+       char addr[BT_ADDRESS_LENGTH] = {0, };
+
+       addr[0] = '1';
+       addr[1] = '1';
+       addr[2] = '1';
+       addr[3] = '1';
+       addr[4] = '1';
+       addr[5] = '1';
+
+       _bt_convert_addr_type_to_string(bd_addr, addr);
+}
+
+TEST(BluetoothShare_test, _bt_obex_cancel_transfer_p) {
+       bt_appdata_t *ad = NULL;
+
+       ad = (bt_appdata_t *)calloc(1, sizeof(bt_appdata_t));
+
+       _bt_obex_cancel_transfer((void *)ad);
+
+       g_free(ad);
+}
+
+TEST(BluetoothShare_test, _bt_clear_receive_noti_list_p) {
+       _bt_clear_receive_noti_list();
+}
+
+TEST(BluetoothShare_test, _bt_get_default_storage_p) {
+       char storage[STORAGE_PATH_LEN_MAX] = {0, };
+
+       _bt_get_default_storage(storage);
+}
+
+TEST(BluetoothShare_test, _bt_get_available_int_memory_p) {
+       int ret = 0;
+       double available_int_mem_size = 0;
+
+       ret = _bt_get_available_int_memory(&available_int_mem_size);
+
+       ASSERT_TRUE(ret >= 0);
+}
+
+TEST(BluetoothShare_test, _bt_get_available_ext_memory_p) {
+       int ret = 0;
+       unsigned long long available_ext_mem_size = 0;
+
+       ret = _bt_get_available_ext_memory(&available_ext_mem_size);
+
+       ASSERT_TRUE(ret >= 0);
+}
+
 int main(int argc, char **argv) {
   InitGoogleTest(&argc, argv);