Added Gtest test cases 00/189100/5
authorNishant Chaprana <n.chaprana@samsung.com>
Wed, 12 Sep 2018 14:03:44 +0000 (19:33 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Sat, 6 Oct 2018 14:55:12 +0000 (20:25 +0530)
Overall coverage rate:
  lines......: 44.0% (3563 of 8105 lines)
  functions..: 50.3% (319 of 634 functions)

Change-Id: I84b50556c04ccc19c070e907db5417314d74676d
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
26 files changed:
CMakeLists.txt [changed mode: 0755->0644]
LICENSE [changed mode: 0755->0644]
gtest/CMakeLists.txt [new file with mode: 0644]
gtest/gtest-inm-mgr-connection.cpp [new file with mode: 0644]
gtest/gtest-inm-mgr-connection.h [new file with mode: 0644]
gtest/gtest-inm-mgr-error.h [new file with mode: 0644]
gtest/gtest-inm-mgr-gdbus.cpp [new file with mode: 0644]
gtest/gtest-inm-mgr-gdbus.h [new file with mode: 0644]
gtest/gtest-inm-mgr-mainloop.cpp [new file with mode: 0644]
gtest/gtest-inm-mgr-mainloop.h [new file with mode: 0644]
gtest/gtest-inm-mgr-manager.cpp [new file with mode: 0644]
gtest/gtest-inm-mgr-manager.h [new file with mode: 0644]
gtest/gtest-inm-mgr-unittest.cpp [new file with mode: 0644]
gtest/gtest-inm-mgr-unittest.h [new file with mode: 0644]
gtest/gtest-inm-mgr-wifi.cpp [new file with mode: 0644]
gtest/gtest-inm-mgr-wifi.h [new file with mode: 0644]
include/inm-manager-log.h
inm-manager.manifest [changed mode: 0755->0644]
packaging/inm-manager.spec [changed mode: 0755->0644]
src/CMakeLists.txt
src/inm-connman-service.c [changed mode: 0755->0644]
src/inm-gdbus.c
src/inm-manager-main.c
unittest/CMakeLists.txt [deleted file]
unittest/unittest.cpp [deleted file]
unittest/unittest.h [deleted file]

old mode 100755 (executable)
new mode 100644 (file)
index 64767ae..d3135e6
@@ -23,7 +23,7 @@ ADD_SUBDIRECTORY(files)
 ADD_SUBDIRECTORY(src)
 
 IF(BUILD_GTESTS)
-       ADD_SUBDIRECTORY(unittest)
+       ADD_SUBDIRECTORY(gtest)
 ENDIF(BUILD_GTESTS)
 IF(BUILD_TEST_APP)
        ADD_SUBDIRECTORY(test)
diff --git a/LICENSE b/LICENSE
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/gtest/CMakeLists.txt b/gtest/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0e40268
--- /dev/null
@@ -0,0 +1,65 @@
+# Copyright (c) 2017 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.
+#
+# @file        CMakeLists.txt
+#
+
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
+SET(GTEST_TEST "gtest-inm-manager")
+
+IF(BUILD_GTESTS)
+       ADD_DEFINITIONS(-DBUILD_GTESTS)
+ENDIF(BUILD_GTESTS)
+
+FILE(GLOB GTEST_TEST_SRCS *.cpp ${CMAKE_SOURCE_DIR}/src/*.c)
+LIST(REMOVE_ITEM GTEST_TEST_SRCS ${CMAKE_SOURCE_DIR}/src/inm-manager-main.c)
+
+FILE(GLOB GTEST_TEST_SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(gtest_pkgs REQUIRED
+       glib-2.0
+       gio-2.0
+       gmock
+       vconf
+       libnl-2.0
+       dlog
+       )
+
+SET(REQUIRED_LIBS "-ldl")
+
+IF(BUILD_GCOV)
+       ADD_DEFINITIONS("-DTIZEN_TEST_GCOV")
+       SET(REQUIRED_LIBS "${REQUIRED_LIBS} -lgcov")
+ENDIF(BUILD_GCOV)
+
+FOREACH(flag ${gtest_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpie")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+ADD_EXECUTABLE(${GTEST_TEST} ${GTEST_TEST_SRCS})
+TARGET_LINK_LIBRARIES(${GTEST_TEST} ${gtest_pkgs_LDFLAGS} ${LIBRARY} ${REQUIRED_LIBS})
+
+INSTALL(TARGETS ${GTEST_TEST} DESTINATION bin)
diff --git a/gtest/gtest-inm-mgr-connection.cpp b/gtest/gtest-inm-mgr-connection.cpp
new file mode 100644 (file)
index 0000000..48715d4
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#include "gtest-inm-mgr-connection.h"
+
+#define INM_MGR_CONNECTION_DBUS_INTERFACE   INM_MGR_DBUS_SERVICE ".conn"
+#define INM_MGR_CONNECTION_DBUS_PATH        INM_MGR_DBUS_PATH "/conn"
+#define INM_MGR_MTD_GET_ALL                 "GetAll"
+
+//LCOV_EXCL_START
+Connection::Connection(void) : GDbus(INM_MGR_DBUS_SERVICE,
+                                    INM_MGR_CONNECTION_DBUS_PATH,
+                                    INM_MGR_CONNECTION_DBUS_INTERFACE)
+{
+}
+
+Connection::~Connection(void)
+{
+}
+
+error_e Connection::getAll_p(const char *object_path)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(object_path, INM_MGR_MTD_GET_ALL,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(a{sv})"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+//LCOV_EXCL_STOP
diff --git a/gtest/gtest-inm-mgr-connection.h b/gtest/gtest-inm-mgr-connection.h
new file mode 100644 (file)
index 0000000..876a674
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef __GTEST_INM_MGR_CONNECTION_H__
+#define __GTEST_INM_MGR_CONNECTION_H__
+
+#include "gtest-inm-mgr-gdbus.h"
+#include "gtest-inm-mgr-error.h"
+
+class Connection : public GDbus {
+private:
+public:
+       Connection(void);
+       ~Connection(void);
+       error_e getAll_p(const char *object_path);
+};
+
+#endif /* __GTEST_INM_MGR_CONNECTION_H__ */
diff --git a/gtest/gtest-inm-mgr-error.h b/gtest/gtest-inm-mgr-error.h
new file mode 100644 (file)
index 0000000..52edc9c
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef __GTEST_INM_MGR_ERROR_H__
+#define __GTEST_INM_MGR_ERROR_H__
+
+#include <glib.h>
+
+#define APP_ID_LEN 128
+#define IFNAME_LEN 16
+#define SUBSCRIBER_ID_LEN 128
+
+#ifdef USE_DLOG
+#include <dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "INM_GTEST"
+#define GLOGD(format, args...) LOGD(format, ##args)
+#else
+#define GLOGD(format, args...)
+#endif
+
+typedef enum {
+       ERROR_NONE = 0,
+       ERROR_NOT_INITIALIZED,
+       ERROR_INVALID_PARAM,
+       ERROR_NOT_PERMITTED,
+       ERROR_OUT_OF_MEMORY,
+       ERROR_OPERATION_FAILED,
+       ERROR_IN_PROGRESS
+} error_e;
+
+#endif /* __GTEST_INM_MGR_ERROR_H__ */
diff --git a/gtest/gtest-inm-mgr-gdbus.cpp b/gtest/gtest-inm-mgr-gdbus.cpp
new file mode 100644 (file)
index 0000000..86c3549
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "gtest-inm-mgr-gdbus.h"
+
+//LCOV_EXCL_START
+GDbus::GDbus(void) : m_pConnection(NULL), m_pCancellable(NULL),
+       m_gdbusDestination(NULL), m_gdbusObjectPath(NULL),
+       m_gdbusInterface(NULL)
+{
+}
+
+GDbus::GDbus(const char *gdbusDestination,
+            const char *gdbusObjectPath,
+            const char *gdbusInterface):m_pConnection(NULL), m_pCancellable(NULL)
+{
+       m_gdbusDestination = gdbusDestination;
+       m_gdbusObjectPath = gdbusObjectPath;
+       m_gdbusInterface = gdbusInterface;
+
+       Create();
+}
+
+GDbus::~GDbus(void)
+{
+       Destroy();
+}
+
+error_e GDbus::Create(void)
+{
+       GError *err = NULL;
+
+#if !GLIB_CHECK_VERSION(2, 36, 0)
+       g_type_init();
+#endif
+
+       this->m_pConnection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (this->m_pConnection == NULL) {
+               if (err != NULL) {
+                       GLOGD("Failed to connect to the D-BUS daemon [%s]",
+                             err->message);
+                       g_error_free(err);
+               }
+
+               return ERROR_OPERATION_FAILED;
+       }
+
+       this->m_pCancellable = g_cancellable_new();
+
+       return ERROR_NONE;
+}
+
+error_e GDbus::Destroy(void)
+{
+       g_cancellable_cancel(this->m_pCancellable);
+       g_object_unref(this->m_pCancellable);
+       this->m_pCancellable = NULL;
+
+       g_object_unref(this->m_pConnection);
+       this->m_pConnection = NULL;
+
+       return ERROR_NONE;
+}
+
+GDBusConnection *GDbus::GetConnection(void)
+{
+       return this->m_pConnection;
+}
+
+GCancellable *GDbus::GetCancellable(void)
+{
+       return this->m_pCancellable;
+}
+
+error_e GDbus::ConvertErrorStringToEnum(const char *error)
+{
+       if (NULL != strstr(error, "InvalidParameter"))
+               return ERROR_INVALID_PARAM;
+       else if (NULL != strstr(error, "NotPermitted"))
+               return ERROR_NOT_PERMITTED;
+       else if (NULL != strstr(error, "OutOfMemory"))
+               return ERROR_OUT_OF_MEMORY;
+       else if (NULL != strstr(error, "OperationFailed"))
+               return ERROR_OPERATION_FAILED;
+       else if (NULL != strstr(error, "InProgress"))
+               return ERROR_IN_PROGRESS;
+
+       return ERROR_OPERATION_FAILED;
+}
+
+GVariant *GDbus::InvokeMethod(const char *object_path,
+                             const char *method,
+                             GVariant *params,
+                             error_e *dbus_error)
+{
+       GError *error = NULL;
+       GVariant *reply = NULL;
+       GDBusConnection *connection = NULL;
+       *dbus_error = ERROR_NONE;
+
+       connection = GetConnection();
+       if (connection == NULL) {
+               GLOGD("GDBusconnection is NULL");
+               *dbus_error = ERROR_NOT_INITIALIZED;
+               return reply;
+       }
+
+       reply = g_dbus_connection_call_sync(connection,
+                                           m_gdbusDestination,
+                                           object_path,
+                                           m_gdbusInterface,
+                                           method,
+                                           params,
+                                           NULL,
+                                           G_DBUS_CALL_FLAGS_NONE,
+                                           DBUS_REPLY_TIMEOUT,
+                                           GetCancellable(),
+                                           &error);
+
+       if (reply == NULL) {
+               if (error != NULL) {
+                       GLOGD("g_dbus_connection_call_sync() failed "
+                             "error [%d: %s]", error->code, error->message);
+                       *dbus_error = ConvertErrorStringToEnum(error->message);
+                       g_error_free(error);
+               } else {
+                       GLOGD("g_dbus_connection_call_sync() failed");
+                       *dbus_error = ERROR_OPERATION_FAILED;
+               }
+
+               return NULL;
+       }
+
+       return reply;
+}
+
+GVariant *GDbus::InvokeMethod(const char *method,
+                             GVariant *params,
+                             error_e *dbus_error)
+{
+       return InvokeMethod(m_gdbusObjectPath, method, params, dbus_error);
+}
+
+error_e GDbus::InvokeMethodNonblock(const char *method,
+                                   GVariant *params,
+                                   int timeout,
+                                   GAsyncReadyCallback notify_func,
+                                   void *user_data)
+{
+       GDBusConnection *connection = NULL;
+
+       connection = GetConnection();
+       if (connection == NULL) {
+               GLOGD("GDBusconnection is NULL");
+               return ERROR_NOT_INITIALIZED;
+       }
+
+       g_dbus_connection_call(connection,
+                              m_gdbusDestination,
+                              m_gdbusObjectPath,
+                              m_gdbusInterface,
+                              method,
+                              params,
+                              NULL,
+                              G_DBUS_CALL_FLAGS_NONE,
+                              timeout,
+                              GetCancellable(),
+                              (GAsyncReadyCallback) notify_func,
+                              (gpointer)user_data);
+
+       return ERROR_NONE;
+}
+//LCOV_EXCL_START
diff --git a/gtest/gtest-inm-mgr-gdbus.h b/gtest/gtest-inm-mgr-gdbus.h
new file mode 100644 (file)
index 0000000..6af3387
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef __GTEST_INM_MGR_GDBUS_H__
+#define __GTEST_INM_MGR_GDBUS_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "gtest-inm-mgr-error.h"
+
+#define DBUS_REPLY_TIMEOUT            (2 * 1000)
+
+#define INM_MGR_DBUS_SERVICE          "net.inm_manager"
+#define INM_MGR_DBUS_PATH             "/net/inm_manager"
+#define INM_MGR_DBUS_INTERFACE        "net.inm_manager"
+
+#define INM_MGR_PEER_DBUS_INTERFACE   "org.freedesktop.DBus.Peer"
+#define INM_MGR_MTD_PING              "Ping"
+
+class GDbus {
+private:
+       GDBusConnection *m_pConnection;
+       GCancellable *m_pCancellable;
+
+       const char *m_gdbusDestination;
+       const char *m_gdbusObjectPath;
+       const char *m_gdbusInterface;
+
+       GDbus(void);
+       error_e Create(void);
+       error_e Destroy(void);
+       GDBusConnection *GetConnection(void);
+       GCancellable *GetCancellable(void);
+       error_e ConvertErrorStringToEnum(const char *error);
+public:
+       GDbus(const char *gdbusDestination,
+             const char *gdbusObjectPath,
+             const char *gdbusInterface);
+       ~GDbus(void);
+       GVariant *InvokeMethod(const char *method,
+                              GVariant *params,
+                              error_e *dbus_error);
+       GVariant *InvokeMethod(const char *object_path,
+                              const char *method,
+                              GVariant *params,
+                              error_e *dbus_error);
+       error_e InvokeMethodNonblock(const char *method,
+                                    GVariant *params,
+                                    int timeout,
+                                    GAsyncReadyCallback notify_func,
+                                    void *user_data);
+};
+
+#endif /* __GTEST_INM_MGR_GDBUS_H__ */
diff --git a/gtest/gtest-inm-mgr-mainloop.cpp b/gtest/gtest-inm-mgr-mainloop.cpp
new file mode 100644 (file)
index 0000000..7dbfd82
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+
+#include "gtest-inm-mgr-mainloop.h"
+
+GMainLoop *MainLoop::m_mainLoop = NULL;
+guint MainLoop::m_timerId = 0;
+
+//LCOV_EXCL_START
+MainLoop::MainLoop(void)
+{
+}
+
+MainLoop::~MainLoop(void)
+{
+       if (m_mainLoop)
+               g_main_loop_quit(m_mainLoop);
+       if (m_timerId)
+               g_source_remove(m_timerId);
+
+       m_mainLoop = NULL;
+       m_timerId = 0;
+}
+
+gboolean MainLoop::timeoutCb(gpointer data)
+{
+       if (m_mainLoop)
+               g_main_loop_quit(m_mainLoop);
+       if (m_timerId)
+               g_source_remove(m_timerId);
+
+       m_mainLoop = NULL;
+       m_timerId = 0;
+
+       return false;
+}
+
+void MainLoop::run(unsigned int timeout)
+{
+       if (m_timerId > 0)
+               return;
+
+       m_mainLoop = g_main_loop_new(NULL, false);
+       m_timerId = g_timeout_add_seconds(timeout,
+                                         (GSourceFunc) MainLoop::timeoutCb,
+                                         NULL);
+       g_main_loop_run(m_mainLoop);
+}
+
+void MainLoop::quit(void)
+{
+       timeoutCb(NULL);
+}
+
+//LCOV_EXCL_STOP
diff --git a/gtest/gtest-inm-mgr-mainloop.h b/gtest/gtest-inm-mgr-mainloop.h
new file mode 100644 (file)
index 0000000..cc75779
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef __GTEST_INM_MGR_LOOP_H__
+#define __GTEST_INM_MGR_LOOP_H__
+
+#include <glib.h>
+
+class MainLoop {
+private:
+       static GMainLoop *m_mainLoop;
+       static guint m_timerId;
+
+       static gboolean timeoutCb(gpointer data);
+public:
+       MainLoop(void);
+       ~MainLoop(void);
+       void run(unsigned int timeout);
+       void quit(void);
+};
+
+#endif /* __GTEST_INM_MGR_LOOP_H__ */
diff --git a/gtest/gtest-inm-mgr-manager.cpp b/gtest/gtest-inm-mgr-manager.cpp
new file mode 100644 (file)
index 0000000..742b590
--- /dev/null
@@ -0,0 +1,619 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#include "gtest-inm-mgr-manager.h"
+
+#define INM_MGR_MTD_GET_STATISTICS            "GetStatistics"
+#define INM_MGR_MTD_RESET_STATISTICS          "ResetStatistics"
+#define INM_MGR_MTD_GET_CURRENT_CONNECTION    "GetCurrentConnection"
+#define INM_MGR_MTD_GET_CONNECTIONS           "GetConnections"
+#define INM_MGR_MTD_GET_ETHERNET_CABLE_STATE  "GetEthernetCableState"
+#define INM_MGR_MTD_GET_WIFI_MODULE_STATE     "GetWifiModuleState"
+#define INM_MGR_MTD_GET_IP_CONFLICT_STATE     "GetIpConflictState"
+#define INM_MGR_MTD_GET_IP_CONFLICT_DETECT    "GetIpConflictDetect"
+#define INM_MGR_MTD_SET_IP_CONFLICT_DETECT    "SetIpConflictDetect"
+#define INM_MGR_MTD_GET_TCPDUMP_STATE         "GetTcpdumpState"
+#define INM_MGR_MTD_SET_TCPDUMP_STATE         "SetTcpdumpState"
+#define INM_MGR_MTD_GET_CELLULAR_STATE        "GetCellularState"
+#define INM_MGR_MTD_GET_WIFI_STATE            "GetWifiState"
+#define INM_MGR_MTD_GET_ETHERNET_STATE        "GetEthernetState"
+#define INM_MGR_MTD_GET_CONGESTION_LEVEL      "GetCongestionLevel"
+#define INM_MGR_MTD_GET_RETRY_TX_RATE         "GetRetryTxRate"
+#define INM_MGR_MTD_GET_CHANNEL_INTERFERENCE  "GetChannelInterference"
+#define INM_MGR_MTD_START_ARPING              "StartArping"
+#define INM_MGR_MTD_STOP_ARPING               "StopArping"
+#define INM_MGR_MTD_START_CHECK_GATEWAY       "StartCheckGateway"
+#define INM_MGR_MTD_STOP_CHECK_GATEWAY        "StopCheckGateway"
+#define INM_MGR_MTD_ADD_REACHER_URL           "AddReacherUrl"
+#define INM_MGR_MTD_REMOVE_REACHER_URL        "RemoveReacherUrl"
+#define INM_MGR_MTD_START_REACHER             "StartReacher"
+#define INM_MGR_MTD_STOP_REACHER              "StopReacher"
+#define INM_MGR_MTD_REACHER_IS_RUNNING        "ReacherIsRunning"
+
+//LCOV_EXCL_START
+Manager::Manager(void) : GDbus(INM_MGR_DBUS_SERVICE,
+                              INM_MGR_DBUS_PATH,
+                              INM_MGR_DBUS_INTERFACE)
+{
+}
+
+Manager::~Manager(void)
+{
+}
+
+error_e Manager::getStatistics_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+
+       int connection_type = 1;
+       int statistics_type = 1;
+
+       params = g_variant_new("(ii)", connection_type, statistics_type);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_STATISTICS,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(t)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::resetStatistics_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+
+       int connection_type = 1;
+       int statistics_type = 1;
+
+       params = g_variant_new("(ii)", connection_type, statistics_type);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_RESET_STATISTICS,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getCurrentConnection_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_CURRENT_CONNECTION,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(oa{sv})"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getCurrentConnectionObjectPath(char **objectPath)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariantIter *dict;
+
+       if (objectPath == NULL)
+               return ERROR_OPERATION_FAILED;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_CURRENT_CONNECTION,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(oa{sv})"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_get(reply, "(oa{sv})", objectPath, &dict);
+       g_variant_iter_free(dict);
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getConnections_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_CONNECTIONS,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(a(oa{sv}))"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getEthernetCableState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_ETHERNET_CABLE_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(b)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getWifiModuleState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_WIFI_MODULE_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(b)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getIpConflictState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_IP_CONFLICT_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(b)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getIpConflictDetect_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_IP_CONFLICT_DETECT,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(b)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::setIpConflictDetect_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       gboolean ip_conflict_detect = TRUE;
+
+       params = g_variant_new("(b)", ip_conflict_detect);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_SET_IP_CONFLICT_DETECT,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getTcpdumpState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_TCPDUMP_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(b)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::setTcpdumpState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       gboolean tcp_dump_state = FALSE;
+
+       params = g_variant_new("(b)", tcp_dump_state);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_SET_TCPDUMP_STATE,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getCellularState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_CELLULAR_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(i)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getWifiState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_WIFI_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(i)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getEthernetState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_ETHERNET_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(i)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getCongestionLevel_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_CONGESTION_LEVEL,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(i)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getRetryTxRate_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_RETRY_TX_RATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(i)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::getChannelInterference_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_CHANNEL_INTERFERENCE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(d)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::startArping_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       const char *target_ip = "127.0.0.1";
+       int timeout = 2;
+
+       params = g_variant_new("(si)", target_ip, timeout);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_START_ARPING,
+                                   params, &ret);
+       if (ret != ERROR_NONE && ret != ERROR_IN_PROGRESS)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::stopArping_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       const char *target_ip = "127.0.0.1";
+
+       params = g_variant_new("(s)", target_ip);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_STOP_ARPING,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::startCheckGateway_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_START_CHECK_GATEWAY,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE && ret != ERROR_IN_PROGRESS)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::stopCheckGateway_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_STOP_CHECK_GATEWAY,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::addReacherUrl_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       const char *url = "http://www.tizen.org";
+
+       params = g_variant_new("(s)", url);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_ADD_REACHER_URL,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::removeReacherUrl_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       const char *url = "http://www.tizen.org";
+
+       params = g_variant_new("(s)", url);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_REMOVE_REACHER_URL,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::startReacher_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       int type = 0;
+
+       params = g_variant_new("(i)", type);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_START_REACHER,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::stopReacher_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+       GVariant *params;
+       int type = 0;
+
+       params = g_variant_new("(i)", type);
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_STOP_REACHER,
+                                   params, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("()"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Manager::reacherIsRunning_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_REACHER_IS_RUNNING,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(b)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+//LCOV_EXCL_STOP
diff --git a/gtest/gtest-inm-mgr-manager.h b/gtest/gtest-inm-mgr-manager.h
new file mode 100644 (file)
index 0000000..1decfed
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef __GTEST_INM_MGR_MANAGER_H__
+#define __GTEST_INM_MGR_MANAGER_H__
+
+#include "gtest-inm-mgr-gdbus.h"
+#include "gtest-inm-mgr-error.h"
+
+class Manager : public GDbus {
+private:
+public:
+       Manager(void);
+       ~Manager(void);
+       error_e getStatistics_p(void);
+       error_e resetStatistics_p(void);
+       error_e getCurrentConnection_p(void);
+       error_e getCurrentConnectionObjectPath(char **objectPath);
+       error_e getConnections_p(void);
+       error_e getEthernetCableState_p(void);
+       error_e getWifiModuleState_p(void);
+       error_e getIpConflictState_p(void);
+       error_e getIpConflictDetect_p(void);
+       error_e setIpConflictDetect_p(void);
+       error_e getTcpdumpState_p(void);
+       error_e setTcpdumpState_p(void);
+       error_e getCellularState_p(void);
+       error_e getWifiState_p(void);
+       error_e getEthernetState_p(void);
+       error_e getCongestionLevel_p(void);
+       error_e getRetryTxRate_p(void);
+       error_e getChannelInterference_p(void);
+       error_e startArping_p(void);
+       error_e stopArping_p(void);
+       error_e startCheckGateway_p(void);
+       error_e stopCheckGateway_p(void);
+       error_e addReacherUrl_p(void);
+       error_e removeReacherUrl_p(void);
+       error_e startReacher_p(void);
+       error_e stopReacher_p(void);
+       error_e reacherIsRunning_p(void);
+};
+
+#endif /* __GTEST_INM_MGR_MANAGER_H__ */
diff --git a/gtest/gtest-inm-mgr-unittest.cpp b/gtest/gtest-inm-mgr-unittest.cpp
new file mode 100644 (file)
index 0000000..8c3b6c5
--- /dev/null
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <unistd.h>
+
+#include "gtest-inm-mgr-error.h"
+#include "gtest-inm-mgr-wifi.h"
+#include "gtest-inm-mgr-connection.h"
+#include "gtest-inm-mgr-manager.h"
+#include "gtest-inm-mgr-unittest.h"
+#include "gtest-inm-mgr-mainloop.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;
+
+#ifdef TIZEN_TEST_GCOV
+extern "C" void __gcov_flush(void);
+#endif
+
+//LCOV_EXCL_START
+TEST(InmMgrWifi, getConnectedAp_p)
+{
+       error_e ret = ERROR_NONE;
+       Wifi wifi;
+
+       ret = wifi.getConnectedAp_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrWifi, getFoundAps_p)
+{
+       error_e ret = ERROR_NONE;
+       Wifi wifi;
+
+       ret = wifi.getFoundAps_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrWifi, getScanState_p)
+{
+       error_e ret = ERROR_NONE;
+       Wifi wifi;
+
+       ret = wifi.getScanState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrConnection, getAll_p)
+{
+       error_e ret = ERROR_NONE;
+       Connection connection;
+       Manager manager;
+       MainLoop loop;
+       char *object_path = NULL;
+
+       ret = manager.getCurrentConnectionObjectPath(&object_path);
+       EXPECT_EQ(ERROR_NONE, ret);
+
+       loop.run(1);
+
+       ret = connection.getAll_p(object_path);
+       EXPECT_EQ(ERROR_NONE, ret);
+
+       loop.run(1);
+
+       g_free(object_path);
+}
+
+TEST(InmMgrManager, getStatistics_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getStatistics_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, resetStatistics_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.resetStatistics_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getCurrentConnection_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getCurrentConnection_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getConnections_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getConnections_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getEthernetCableState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getEthernetCableState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getWifiModuleState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getWifiModuleState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getIpConflictState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getIpConflictState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getIpConflictDetect_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getIpConflictDetect_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, setIpConflictDetect_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.setIpConflictDetect_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getTcpdumpState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getTcpdumpState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, setTcpdumpState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.setTcpdumpState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getCellularState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getCellularState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getWifiState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getWifiState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getEthernetState_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getEthernetState_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getCongestionLevel_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getCongestionLevel_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getRetryTxRate_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getRetryTxRate_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, getChannelInterference_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.getChannelInterference_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(InmMgrManager, startArping_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.startArping_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, stopArping_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.stopArping_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, startCheckGateway_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.startCheckGateway_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, stopCheckGateway_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.stopCheckGateway_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, addReacherUrl_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.addReacherUrl_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, removeReacherUrl_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.removeReacherUrl_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, startReacher_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.startReacher_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, stopReacher_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+       MainLoop loop;
+
+       ret = manager.stopReacher_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+       loop.run(1);
+}
+
+TEST(InmMgrManager, reacherIsRunning_p)
+{
+       error_e ret = ERROR_NONE;
+       Manager manager;
+
+       ret = manager.reacherIsRunning_p();
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+int main(int argc, char **argv)
+{
+       int ret = 0;
+
+#ifdef TIZEN_TEST_GCOV
+       setenv("GCOV_PREFIX", "/tmp", 1);
+#endif
+
+       InitGoogleTest(&argc, argv);
+       ret = RUN_ALL_TESTS();
+
+#ifdef TIZEN_TEST_GCOV
+       __gcov_flush();
+#endif
+
+       return ret;
+}
+//LCOV_EXCL_STOP
diff --git a/gtest/gtest-inm-mgr-unittest.h b/gtest/gtest-inm-mgr-unittest.h
new file mode 100644 (file)
index 0000000..dfc5700
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+#ifndef __GTEST_INM_MGR_UNITTEST_H__
+#define __GTEST_INM_MGR_UNITTEST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <glib.h>
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__GTEST_INM_MGR_UNITTEST_H__
diff --git a/gtest/gtest-inm-mgr-wifi.cpp b/gtest/gtest-inm-mgr-wifi.cpp
new file mode 100644 (file)
index 0000000..7434272
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#include "gtest-inm-mgr-wifi.h"
+
+#define INM_MGR_WIFI_DBUS_INTERFACE   INM_MGR_DBUS_SERVICE ".wifi"
+#define INM_MGR_WIFI_DBUS_PATH        INM_MGR_DBUS_PATH "/wifi"
+#define INM_MGR_MTD_GET_CONNECTED_AP  "GetConnectedAp"
+#define INM_MGR_MTD_GET_FOUND_APS     "GetFoundAps"
+#define INM_MGR_MTD_GET_SCAN_STATE    "GetScanState"
+
+//LCOV_EXCL_START
+Wifi::Wifi(void) : GDbus(INM_MGR_DBUS_SERVICE,
+                        INM_MGR_WIFI_DBUS_PATH,
+                        INM_MGR_WIFI_DBUS_INTERFACE)
+{
+}
+
+Wifi::~Wifi(void)
+{
+}
+
+error_e Wifi::getConnectedAp_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_CONNECTED_AP,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply, G_VARIANT_TYPE("(a{sv})"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Wifi::getFoundAps_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_FOUND_APS,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply,
+                                 G_VARIANT_TYPE("(a(oa{sv}))"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+
+error_e Wifi::getScanState_p(void)
+{
+       error_e ret;
+       GVariant *reply;
+
+       reply = GDbus::InvokeMethod(INM_MGR_MTD_GET_SCAN_STATE,
+                                   NULL, &ret);
+       if (ret != ERROR_NONE)
+              return ret;
+
+       if (!g_variant_is_of_type(reply,
+                                 G_VARIANT_TYPE("(b)"))) {
+               g_variant_unref(reply);
+               return ERROR_OPERATION_FAILED;
+       }
+
+       g_variant_unref(reply);
+       return ERROR_NONE;
+}
+//LCOV_EXCL_STOP
diff --git a/gtest/gtest-inm-mgr-wifi.h b/gtest/gtest-inm-mgr-wifi.h
new file mode 100644 (file)
index 0000000..4ee7031
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017 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.
+ */
+#ifndef __GTEST_INM_MGR_WIFI_H__
+#define __GTEST_INM_MGR_WIFI_H__
+
+#include "gtest-inm-mgr-gdbus.h"
+#include "gtest-inm-mgr-error.h"
+
+class Wifi : public GDbus {
+private:
+public:
+       Wifi(void);
+       ~Wifi(void);
+       error_e getConnectedAp_p(void);
+       error_e getFoundAps_p(void);
+       error_e getScanState_p(void);
+};
+
+#endif /* __GTEST_INM_MGR_WIFI_H__ */
index bfcf6f5207c64ea2109f4ce662d13ce23d90fbed..48e1d3686aa667acd18f57f3667c9d4cbdf0a48e 100644 (file)
 extern "C" {
 #endif
 
+#ifdef TIZEN_TEST_GCOV
+       void __gcov_flush(void);
+#define GCOV_FLUSH() \
+       do { \
+               __gcov_flush();\
+       } while (0)
+#else
+#define GCOV_FLUSH()
+#endif
+
 #ifdef USE_DLOG
 #include <dlog.h>
 
@@ -45,7 +55,7 @@ extern "C" {
 #define INM_LOGF(format, args...) LOGF(format, ##args)
 
 #define __INM_FUNC_ENTER__ LOGD("Enter")
-#define __INM_FUNC_EXIT__ LOGD("Quit")
+#define __INM_FUNC_EXIT__ LOGD("Quit");GCOV_FLUSH();
 
 #define INM_SECLOGI(format, args...) SECURE_LOG(LOG_INFO, LOG_TAG, format, ##args)
 #define INM_SECLOGD(format, args...) SECURE_LOG(LOG_DEBUG, LOG_TAG, format, ##args)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 8692c35..fb82a6b
@@ -1,6 +1,6 @@
 Name:       inm-manager
 Summary:    INM(Intelligent Network Monitoring) daemon
-Version:    0.0.7
+Version:    0.0.8
 Release:    1
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
@@ -22,10 +22,15 @@ BuildRequires:      pkgconfig(libcurl)
 BuildRequires:  python
 BuildRequires:  python-xml
 Requires:       security-config
+
 %if 0%{?gtests:1}
 BuildRequires: pkgconfig(gmock)
 %endif
 
+%if 0%{?gcov:1}
+BuildRequires: lcov
+%endif
+
 %description
 An application service platform manager to manage services and sessions
 
@@ -44,11 +49,11 @@ cp -a %{SOURCE3} .
 export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
 export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+
 %if 0%{?gcov:1}
-export CFLAGS+=" -fprofile-arcs -ftest-coverage"
-export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
-export FFLAGS+=" -fprofile-arcs -ftest-coverage"
-export LDFLAGS+=" -lgcov"
+export CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+export CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
+export LDFLAGS="$LDFLAGS -lgcov"
 %endif
 
 %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} \
index 1ef4add2b2236cd94a9b9e89ad957ddb365d345f..b5d998bf196bf6a79f4121b3093f660f2e02c8ad 100644 (file)
@@ -30,6 +30,13 @@ PKG_CHECK_MODULES(inm_pkgs REQUIRED
        libcurl
        )
 
+SET(REQUIRED_LIBS "-ldl")
+
+IF(BUILD_GCOV)
+       ADD_DEFINITIONS("-DTIZEN_TEST_GCOV")
+       SET(REQUIRED_LIBS "${REQUIRED_LIBS} -lgcov")
+ENDIF(BUILD_GCOV)
+
 FOREACH(flag ${inm_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
@@ -69,6 +76,7 @@ SET(SRCS
 SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fpic -Wall -Werror-implicit-function-declaration -fvisibility=hidden")
 SET(ARM_CFLAGS "${ARM_CFLAGS} -mapcs -mabi=aapcs-linux -msoft-float -Uarm -fpic")
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
 
@@ -76,6 +84,6 @@ ADD_DEFINITIONS("-DUSE_DLOG")
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
 
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${inm_pkgs_LDFLAGS} -ldl)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${inm_pkgs_LDFLAGS} ${REQUIRED_LIBS})
 
 INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${BIN_DIR})
old mode 100755 (executable)
new mode 100644 (file)
index 748fb9c0698bd15bb1ec78910f6cd5fc9fb4d08a..f1c722d7629c8ed387599e395eaf6224cdf68978 100644 (file)
@@ -665,6 +665,9 @@ static inline void __handle_set_ip_conflict_detect(GVariant *parameters,
                GDBusMethodInvocation *invocation)
 {
        /* TODO */
+       __INM_FUNC_ENTER__;
+       g_dbus_method_invocation_return_value(invocation, NULL);
+       __INM_FUNC_EXIT__;
        return;
 }
 
@@ -1750,12 +1753,34 @@ static inline void __handle_get_connected_ap(GVariant *parameters,
                GDBusMethodInvocation *invocation)
 {
        /* TODO get & return real Wi-Fi connected AP */
+       GVariant *arg = NULL;
+       GVariantBuilder *builder = NULL;
+
+       __INM_FUNC_ENTER__;
+       builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+       arg = g_variant_new("(a{sv})", builder);
+       g_variant_builder_unref(builder);
+
+       DEBUG_G_VARIANT("Sending = ", arg);
+       g_dbus_method_invocation_return_value(invocation, arg);
+       __INM_FUNC_EXIT__;
 }
 
 static inline void __handle_get_found_aps(GVariant *parameters,
                GDBusMethodInvocation *invocation)
 {
        /* TODO get real Wi-Fi Found AP */
+       GVariant *arg = NULL;
+       GVariantBuilder *builder = NULL;
+
+       __INM_FUNC_ENTER__;
+       builder = g_variant_builder_new(G_VARIANT_TYPE("a(oa{sv})"));
+       arg = g_variant_new("(a(oa{sv}))", builder);
+       g_variant_builder_unref(builder);
+
+       DEBUG_G_VARIANT("Sending = ", arg);
+       g_dbus_method_invocation_return_value(invocation, arg);
+       __INM_FUNC_EXIT__;
 }
 
 static inline void __handle_get_scan_state(GVariant *parameters,
index 04108deb957f05ddbdd5895ef4ea0b67ea01d3af..e4061adb2bdf0feb495420be5ff7962699ad7c6a 100644 (file)
 #include "inm-manager.h"
 #include "inm-manager-log.h"
 
+#ifdef TIZEN_TEST_GCOV
+void __gcov_flush(void);
+#endif
+
 static GMainLoop *g_loop = NULL;
 
 static void __signal_handler(int sig)
@@ -68,6 +72,11 @@ int main(void)
        int ret = 0;
 
        __INM_FUNC_ENTER__;
+
+#ifdef TIZEN_TEST_GCOV
+       setenv("GCOV_PREFIX", "/tmp", 1);
+#endif
+
 /*
        ret = daemon(0, 0);
        if (ret != 0) {
@@ -101,6 +110,10 @@ int main(void)
 
        g_main_loop_unref(g_loop);
 
+#ifdef TIZEN_TEST_GCOV
+       __gcov_flush();
+#endif
+
        __INM_FUNC_EXIT__;
        return 0;
 }
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
deleted file mode 100644 (file)
index 2ec8397..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# Copyright (c) 2014-2015 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.
-#
-# @file        CMakeLists.txt
-#
-
-LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-
-SET(GTEST_TEST "gtest-inm-manager")
-
-IF(BUILD_GTESTS)
-       ADD_DEFINITIONS(-DBUILD_GTESTS)
-ENDIF(BUILD_GTESTS)
-
-FILE(GLOB GTEST_TEST_SRCS *.cpp ${CMAKE_SOURCE_DIR}/src/*.c)
-LIST(REMOVE_ITEM GTEST_TEST_SRCS ${CMAKE_SOURCE_DIR}/src/inm-manager-main.c)
-
-SET(GTEST_TEST_SRCS ${GTEST_TEST_SRCS} unittest.cpp)
-
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(gtest_pkgs REQUIRED glib-2.0  gio-2.0 gmock vconf libnl-2.0)
-
-FOREACH(flag ${gtest_pkgs_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
-
-IF(BUILD_GCOV)
-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpie -fprofile-arcs -ftest-coverage")
-       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie -fprofile-arcs -ftest-coverage")
-       SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-ELSE(BUILD_GCOV)
-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fpie")
-       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpie")
-       SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-ENDIF(BUILD_GCOV)
-
-
-ADD_EXECUTABLE(${GTEST_TEST} ${GTEST_TEST_SRCS})
-TARGET_LINK_LIBRARIES(${GTEST_TEST} ${gtest_pkgs_LDFLAGS} ${LIBRARY} -ldl)
-
-INSTALL(TARGETS ${GTEST_TEST} DESTINATION bin)
diff --git a/unittest/unittest.cpp b/unittest/unittest.cpp
deleted file mode 100644 (file)
index 274fe5f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2018 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.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <unistd.h>
-
-#include "unittest.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;
-
-TEST(inm_manager_main, main_Positive)
-{
-
-}
-
-int main(int argc, char **argv)
-{
-  InitGoogleTest(&argc, argv);
-
-  return RUN_ALL_TESTS();
-}
\ No newline at end of file
diff --git a/unittest/unittest.h b/unittest/unittest.h
deleted file mode 100644 (file)
index eb3fa98..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2018 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.
- */
-#ifndef __INM_MANAGER_UNITTEST_H__
-#define __INM_MANAGER_UNITTEST_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <glib.h>
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__INM_MANAGER_UNITTEST_H__