# @author
# @brief Cmake for tests
#
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
SET(TARGET_GTEST_TESTS "gtest-bluetooth-agent")
INCLUDE_DIRECTORIES(/usr/include)
SET(INCLUDEDIR "/usr/include")
INCLUDE(FindPkgConfig)
-pkg_check_modules(testpkgs REQUIRED dlog glib-2.0 gmock)
+pkg_check_modules(testpkgs REQUIRED dlog msg-service email-service glib-2.0)
INCLUDE_DIRECTORIES(${testpkgs_INCLUDE_DIRS})
bluetooth-agent_test.cpp
)
+SET(BLUETOOTH_AGENT_MOCK "bluetooth-agent-mock")
+SET(BLUETOOTH_AGENT_MOCK_SRCS
+ mock/bluetooth-agent-mock.c)
+SET(BLUETOOTH_AGENT_MOCK_CFLAGS "${CMAKE_C_FLAGS}" )
+ADD_LIBRARY(${BLUETOOTH_AGENT_MOCK} SHARED ${BLUETOOTH_AGENT_MOCK_SRCS})
+TARGET_LINK_LIBRARIES(${BLUETOOTH_AGENT_MOCK} -ldl)
+SET_TARGET_PROPERTIES(${BLUETOOTH_AGENT_MOCK} PROPERTIES
+ COMPILE_FLAGS ${BLUETOOTH_AGENT_MOCK_CFLAGS}
+)
+
ADD_EXECUTABLE(${TARGET_GTEST_TESTS}
${GTEST_TESTS_SOURCES}
)
TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS}
${testpkgs_LDFLAGS}
${testpkgs_LIBRARIES}
- gmock
+ gtest
-L${CMAKE_SOURCE_DIR}/ag-agent
-L${CMAKE_SOURCE_DIR}/hf-agent
-L${CMAKE_SOURCE_DIR}/hid-agent
* @brief Unit-tests setup
*/
-#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <unistd.h>
#include <glib.h>
/* pb-agent header files */
#include "bluetooth_pb_vcard.h"
-using ::testing::EmptyTestEventListener;
-using ::testing::InitGoogleTest;
-using ::testing::Test;
-using ::testing::TestCase;
-using ::testing::TestEventListeners;
-using ::testing::TestInfo;
-using ::testing::TestPartResult;
-using ::testing::UnitTest;
-
static GMainLoop *mainloop = NULL;
}
int main(int argc, char **argv) {
- InitGoogleTest(&argc, argv);
+ testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+
+/*Messaging Header Files*/
+#include "msg.h"
+#include "msg_transport_types.h"
+#include "msg_types.h"
+#include "email-types.h"
+
+#ifndef API
+#define API __attribute__ ((visibility("default")))
+#endif
+
+
+API int vconf_get_int(const char *in_key, const int intval)
+{
+ return 0;
+}
+
+API char *vconf_get_str(const char *in_key)
+{
+ return strdup("memory/telephony/nw_name");
+}
+
+API int email_service_end()
+{
+ return EMAIL_ERROR_NONE;
+}
+
+API int msg_open_msg_handle(msg_handle_t *handle)
+{
+ return MSG_SUCCESS;
+}
+
+API int msg_reg_sent_status_callback(msg_handle_t handle, msg_sent_status_cb cb, void *user_param)
+{
+ return MSG_SUCCESS;
+}
+
+API int msg_reg_sms_message_callback(msg_handle_t handle, msg_sms_incoming_cb cb, unsigned short port, void *user_param)
+{
+ return MSG_SUCCESS;
+}
+
+API GDBusConnection *g_bus_get_sync (GBusType bus_type,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return (void *)1234;
+}
+
+API guint g_dbus_connection_register_object (GDBusConnection *connection,
+ const gchar *object_path,
+ GDBusInterfaceInfo *interface_info,
+ const GDBusInterfaceVTable *vtable,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func,
+ GError **error)
+{
+ return 1234;
+}
+
+API guint g_dbus_connection_signal_subscribe (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *interface_name,
+ const gchar *member,
+ const gchar *object_path,
+ const gchar *arg0,
+ GDBusSignalFlags flags,
+ GDBusSignalCallback callback,
+ gpointer user_data,
+ GDestroyNotify user_data_free_func)
+{
+ return 0;
+}
+API void g_dbus_connection_signal_unsubscribe(GDBusConnection *connection,
+ guint subscription_id)
+{
+}
+
+API gboolean g_dbus_connection_unregister_object(GDBusConnection *connection,
+ guint registration_id)
+{
+ return TRUE;
+}
+
+API void g_object_unref(gpointer object)
+{
+}
+
+API GVariant *g_dbus_proxy_call_sync(GDBusProxy *proxy,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusCallFlags flags,
+ gint timeout_msec,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return NULL;
+}
+
+API GDBusProxy *g_dbus_proxy_new_sync(GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ GDBusInterfaceInfo *info,
+ const gchar *name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ GCancellable *cancellable,
+ GError **error)
+{
+ return (void *)1234;
+}
+
+API GVariant *g_variant_get_child_value(GVariant *value,
+ gsize index_)
+{
+ return (void *)1234;
+}
+
+API gsize g_variant_n_children(GVariant *value)
+{
+ return 1234;
+}
+
+API void g_variant_unref(GVariant *value)
+{
+}
+
+API void g_variant_get (GVariant *value,
+ const gchar *format_string,
+ ...)
+{
+}
+
+API gint g_io_channel_unix_get_fd(GIOChannel *channel)
+{
+ return 0;
+}