if (is_block) {
if (block_sleep_count < 0) {
+ /* This condition is for preventing the exception case, Never be called in the current logic */
+ /* LCOV_EXCL_START */
INFO("block_sleep_count[%d] is invalid. It is set to 0.\n",
block_sleep_count);
block_sleep_count = 0;
+ /* LCOV_EXCL_STOP */
} else if (block_sleep_count == 0) {
result = display_lock_state(LCD_OFF, STAY_CUR_STATE, 0);
if (result != 0)
DBG("event_value: %s", event_val);
if (_bt_set_eventsystem_transfer_value(state) != BT_SHARE_ERROR_NONE)
- ERR("Fail to set value");
+ ERR("Fail to set value"); /* LCOV_EXCL_LINE */
#if 0
if (__bt_eventsystem_set_value(SYS_EVENT_BT_STATE, EVT_KEY_BT_TRANSFERING_STATE,
void _bt_remove_tmp_file(char *file_path)
{
- if (g_str_has_prefix(file_path, BT_TMP_FILE) == TRUE) {
+ if (g_str_has_prefix(file_path, BT_TMP_DIR) == TRUE) {
DBG_SECURE("Remove the file: %s", file_path);
ecore_file_remove(file_path);
}
fd = open(file, O_RDWR | O_CREAT, 0755);
if (fd < 0) {
+ /* LCOV_EXCL_START */
ERR("Fail to open the file : %s", file);
goto fail;
+ /* LCOV_EXCL_STOP */
}
if (file_type == BT_HTTP_FILE)
close(fd);
if (write_size < 0) {
+ /* LCOV_EXCL_START */
ERR("Fail to write in file");
goto fail;
+ /* LCOV_EXCL_STOP */
}
return file;
g_free(data);
}
+/* LCOV_EXCL_START */
static void __popup_res_cb(int res)
{
FN_START;
}
FN_END;
}
+/* LCOV_EXCL_STOP */
static char *__bt_transfer_folder_path(char *dest_path)
{
return dst_path;
}
+/* LCOV_EXCL_START */
static opc_transfer_info_t *__add_transfer_info(GVariant *msg)
{
FN_START;
return data;
}
+/* LCOV_EXCL_STOP */
static void __free_transfer_info(opc_transfer_info_t *node)
{
FN_END;
}
+/* LCOV_EXCL_START */
static int __request_file_send(opc_transfer_info_t *node)
{
FN_START;
FN_END;
return BLUETOOTH_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static void __event_filter(GDBusConnection *connection,
const gchar *sender_name,
const gchar *object_path,
DBG("Unhandled signal");
}
}
+/* LCOV_EXCL_STOP */
static int __bt_share_add_filter_subscribe_signal(GDBusConnection *conn,
gboolean subscribe)
conn = __bt_get_system_gconn();
if (!conn) {
+ /* LCOV_EXCL_START */
ERR("GDBUS get failed");
g_error_free(error);
return FALSE;
+ /* LCOV_EXCL_STOP */
}
gdbus_connection = conn;
return g_strdup(address);
}
+/* LCOV_EXCL_START */
static void __bt_create_send_failed_data(char *filepath, char *dev_name,
char *addr, char *type, unsigned int size)
{
bt_share_close_db(db);
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static void __bt_create_send_data(opc_transfer_info_t *node)
{
FN_START;
FN_END;
}
+/* LCOV_EXCL_STOP */
gboolean _bt_update_sent_data_status(int uid,
bt_app_tr_status_e status, char *db_sid)
return index_id;
}
+/* LCOV_EXCL_START */
static void __bt_share_update_tr_info(int tr_uid, int tr_type)
{
DBG("tr_uid = %d", tr_uid);
bt_share_close_db(db);
}
}
+/* LCOV_EXCL_STOP */
static GDBusConnection *__bt_init_system_gconn(void)
{
#include <glib.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"
using ::testing::EmptyTestEventListener;
using ::testing::InitGoogleTest;
ret = _bt_share_block_sleep(TRUE);
ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+ ret = _bt_share_block_sleep(TRUE);
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+ ret = _bt_share_block_sleep(FALSE);
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+ ret = _bt_share_block_sleep(FALSE);
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+}
+
+TEST(BluetoothShare_test, _bt_share_block_sleep_n) {
+ int ret = BT_SHARE_ERROR_NONE;
+
ret = _bt_share_block_sleep(FALSE);
+ ASSERT_TRUE(ret == BT_SHARE_FAIL);
+}
+
+TEST(BluetoothShare_test, _bt_set_transfer_indicator_p) {
+ int ret = BT_SHARE_ERROR_NONE;
+
+ ret = _bt_set_transfer_indicator(TRUE);
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+ ret = _bt_set_transfer_indicator(TRUE);
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+ ret = _bt_set_transfer_indicator(FALSE);
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+
+ ret = _bt_set_transfer_indicator(FALSE);
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+}
+
+TEST(BluetoothShare_test, _bt_remove_tmp_file_p) {
+ _bt_remove_tmp_file(BT_TMP_FILE);
+}
+
+TEST(BluetoothShare_test, _bt_remove_vcf_file_p) {
+ _bt_remove_vcf_file(BT_CONTACT_SHARE_TMP_DIR"test");
+}
+
+TEST(BluetoothShare_test, _bt_share_create_transfer_file_p) {
+ char *file = NULL;
+
+ file = _bt_share_create_transfer_file("http://www.tizen.org");
+ ASSERT_FALSE(file == NULL);
+
+ _bt_remove_tmp_file(HTML_FILE_NAME);
+ g_free(file);
+
+ file = _bt_share_create_transfer_file("Text test");
+ ASSERT_FALSE(file == NULL);
+
+ _bt_remove_tmp_file(TXT_FILE_FORMAT);
+ g_free(file);
+}
+
+TEST(BluetoothShare_test, _bt_share_create_transfer_file_n) {
+ char *file = NULL;
+
+ file = _bt_share_create_transfer_file(NULL);
+ ASSERT_TRUE(file == NULL);
+}
+
+TEST(BluetoothShare_test, _bt_get_time_of_the_day_p) {
+ char *time = NULL;
+
+ time = _bt_get_time_of_the_day();
+ ASSERT_FALSE(time == NULL);
+
+ g_free(time);
+}
+
+TEST(BluetoothShare_test, _bt_share_get_storage_path_p) {
+ char *path = NULL;
+
+ path = _bt_share_get_storage_path(BT_DEFAULT_MEM_PHONE);
+ ASSERT_FALSE(path == NULL);
+
+ g_free(path);
+
+ path = _bt_share_get_storage_path(BT_DEFAULT_MEM_MMC);
+ ASSERT_FALSE(path == NULL);
+
+ g_free(path);
+}
+
+
+TEST(BluetoothShare_test, _bt_share_get_active_uid_p) {
+ int ret = BT_SHARE_ERROR_NONE;
+ uid_t uid = 0;
+
+ ret = _bt_share_get_active_uid(&uid);
+
+ ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
+}
+
+TEST(BluetoothShare_test, _remove_transfer_info_p) {
+ opc_transfer_info_t *data = NULL;
+
+ data = g_new0(opc_transfer_info_t, 1);
+ data->content = g_new0(char *, 1);
+ data->file_path = g_new0(char *, 1);
+ data->file_cnt = 1;
+ data->type = g_new0(char *, 1);
+ data->size = (unsigned int *)g_new0(unsigned int *, 1);
+
+ _remove_transfer_info(data);
+}
+
+TEST(BluetoothShare_test, _bt_init_dbus_signal_p) {
+ gboolean ret = FALSE;
+
+ ret = _bt_init_dbus_signal();
+
+ ASSERT_TRUE(ret == TRUE);
+
+ _bt_deinit_dbus_signal();
+}
+
+
+TEST(BluetoothShare_test, _bt_send_disconnected_signal_p) {
+ gboolean ret = FALSE;
+
+ ret = _bt_init_dbus_signal();
+
+ ASSERT_TRUE(ret == TRUE);
+
+ _bt_send_disconnected_signal(BT_SHARE_ENG_SIGNAL_OPP_CLIENT_DISCONNECTED,
+ BLUETOOTH_ERROR_NONE, "BT address", 0);
+
+ _bt_deinit_dbus_signal();
+}
+
+TEST(BluetoothShare_test, _bt_update_transfer_list_view_p) {
+ gboolean ret = FALSE;
+
+ ret = _bt_init_dbus_signal();
+
+ ASSERT_TRUE(ret == TRUE);
+
+ _bt_update_transfer_list_view(BT_OUTBOUND_TABLE);
+
+ _bt_deinit_dbus_signal();
+}
+
+
+TEST(BluetoothShare_test, _bt_create_warning_popup_p) {
+ gboolean ret = FALSE;
+
+ ret = _bt_init_dbus_signal();
+
+ ASSERT_TRUE(ret == TRUE);
+
+ _bt_create_warning_popup(BLUETOOTH_ERROR_INTERNAL, BT_STR_UNABLE_TO_SEND);
+
+ _bt_deinit_dbus_signal();
+}
+
+TEST(BluetoothShare_test, _bt_update_sent_data_status_p) {
+ gboolean ret = FALSE;
+
+ ret = _bt_update_sent_data_status(1, BT_TR_ONGOING, "1");
+
+ ASSERT_TRUE(ret == TRUE);
+}
+
+TEST(BluetoothShare_test, _bt_update_recv_data_status_p) {
+ gboolean ret = FALSE;
+
+ ret = _bt_update_recv_data_status(1, BT_TR_FAIL, "1", 100, "text/vcard");
+
+ ASSERT_TRUE(ret == TRUE);
+}
+
+TEST(BluetoothShare_test, _bt_update_multiple_sent_data_status_p) {
+ gboolean ret = FALSE;
+
+ int uids[2] = { 1, 2};
+
+ ret = _bt_update_multiple_sent_data_status(uids, 1, BT_TR_FAIL, "1");
+
+ ASSERT_TRUE(ret == TRUE);
+}
+
+TEST(BluetoothShare_test, _bt_add_recv_transfer_status_data_p) {
+ gboolean ret = FALSE;
+
+ ret = _bt_add_recv_transfer_status_data("NAME",
+ "ADDRESS", "FILE NAME", NULL,
+ 100, BT_TR_ONGOING, "1");
+
+ ASSERT_TRUE(ret == TRUE);
+}
+
+TEST(BluetoothShare_test, _bt_share_get_unique_id_p) {
+ int id;
+
+ id = _bt_share_get_unique_id(BT_DB_INBOUND, "1");
+
+ ASSERT_FALSE(id < 0);
+}
+
+TEST(BluetoothShare_test, _bt_set_eventsystem_transfer_value_p) {
+ int ret = BT_SHARE_ERROR_NONE;
+
+ ret = _bt_set_eventsystem_transfer_value(TRUE);
+
ASSERT_TRUE(ret == BT_SHARE_ERROR_NONE);
}
+TEST(BluetoothShare_test, _bt_terminate_bluetooth_share_p) {
+ _bt_terminate_bluetooth_share();
+}
+
int main(int argc, char **argv) {
InitGoogleTest(&argc, argv);