Adding-Gtest-for-Line-and-Functional-Coverage 02/254402/2
authorTarun Pratap Singh Bhadouria <tp.bhadouria@samsung.com>
Tue, 2 Mar 2021 09:27:27 +0000 (14:57 +0530)
committerTarun Pratap Singh Bhadouria <tp.bhadouria@samsung.com>
Wed, 3 Mar 2021 12:56:06 +0000 (18:26 +0530)
Change-Id: I9fc47c64841165100224ea2e9849526a597cd35a

27 files changed:
CMakeLists.txt
packaging/capi-network-wifi-manager.spec
test/CMakeLists.txt [deleted file]
tests/CMakeLists.txt [new file with mode: 0644]
tests/gtest-wifi-manager-activation.cpp [new file with mode: 0755]
tests/gtest-wifi-manager-ap.cpp [new file with mode: 0644]
tests/gtest-wifi-manager-conflict.cpp [new file with mode: 0644]
tests/gtest-wifi-manager-connection.cpp [new file with mode: 0644]
tests/gtest-wifi-manager-dpp.cpp [new file with mode: 0644]
tests/gtest-wifi-manager-info.cpp [new file with mode: 0755]
tests/gtest-wifi-manager-init.cpp [new file with mode: 0755]
tests/gtest-wifi-manager-scan.cpp [new file with mode: 0755]
tests/gtest-wifi-manager-tdls.cpp [new file with mode: 0644]
tests/gtest-wifi-manager-util.cpp [new file with mode: 0755]
tests/gtest-wifi-manager-util.h [new file with mode: 0644]
tests/gtest-wifi-manager-vsie.cpp [new file with mode: 0644]
tests/gtest-wifi-manager.cpp [new file with mode: 0755]
tests/mocks/mock_gdbus.c [new file with mode: 0644]
tests/mocks/mock_gdbus.h [new file with mode: 0644]
tests/mocks/mock_memory.c [new file with mode: 0644]
tests/mocks/mock_memory.h [new file with mode: 0644]
tests/mocks/mock_system_info.c [new file with mode: 0644]
tests/mocks/mock_system_info.h [new file with mode: 0644]
tests/mocks/mock_vconf.c [new file with mode: 0644]
tests/mocks/mock_vconf.h [new file with mode: 0644]
tool/CMakeLists.txt
tool/wifi_manager_test.c [moved from test/wifi_manager_test.c with 100% similarity]

index aa4c9c2..bee226f 100755 (executable)
@@ -65,9 +65,12 @@ CONFIGURE_FILE(
 )
 INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB}/pkgconfig)
 
-ADD_SUBDIRECTORY(test)
 ADD_SUBDIRECTORY(tool)
 
+IF(BUILD_GTESTS)
+    ADD_SUBDIRECTORY(tests)
+ENDIF(BUILD_GTESTS)
+
 IF(UNIX)
 
 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
index 02aa421..cd9aa27 100755 (executable)
@@ -39,8 +39,12 @@ Test Application for Wi-Fi Manager
 
 %if 0%{?gcov:1}
 %package gcov
-Summary:  Network Wi-Fi manager library(gcov)
-Group:    Network/Testing
+Summary:       Network Wi-Fi manager library(gcov)
+Group:         Network/Testing
+BuildRequires: pkgconfig(gmock)
+BuildRequires:  lcov
+BuildRequires:  tar
+
 %description gcov
 gcov objects for coverage test
 %endif
@@ -62,24 +66,24 @@ export CFLAGS+=' -Wno-unused-local-typedefs'
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 cmake -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
       -DLIB_INSTALL_DIR=%{_libdir} -DINCLUDE_INSTALL_DIR=%{_includedir} \
-      -DBIN_DIR=%{_bindir} \
-       -DLIB_PATH=%{_lib} \
-       .
+      -DBIN_DIR=%{_bindir} -DLIB_PATH=%{_lib} \
+      -DBUILD_GTESTS=%{?gcov:1}%{!?gcov:0} \
+      .
 
 make %{?_smp_mflags}
 
-
-%if 0%{?gcov:1}
-mkdir -p gcov-obj
-find . -name '*.gcno' -exec cp '{}' gcov-obj ';'
-%endif
-
 %install
 %make_install
 
 %if 0%{?gcov:1}
-mkdir -p %{buildroot}%{_datadir}/gcov/obj
-install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj
+find .. -name '*.gcno' | tar cf %{name}-gcov.tar -T -
+install -d -m 755 %{buildroot}%{_datadir}/gcov/obj
+tar xf %{name}-gcov.tar -C %{buildroot}%{_datadir}/gcov/obj
+
+%check
+tests/gtest-wifi-manager
+lcov -c --ignore-errors graph --no-external -b . -d . -o %{name}.info
+genhtml %{name}.info -o out --legend --show-details
 %endif
 
 %post -p /sbin/ldconfig
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100755 (executable)
index 6772f67..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-PROJECT(wifi_manager_test C)
-
-SET(fw_test "${fw_name}-test")
-
-SET(dependents "capi-base-common glib-2.0")
-SET(pc_dependents "capi-base-common")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED ${dependents})
-FOREACH(flag ${${fw_test}_CFLAGS})
-    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE")
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-
-aux_source_directory(. sources)
-FOREACH(src ${sources})
-    GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
-    MESSAGE("${src_name}")
-    ADD_EXECUTABLE(${src_name} ${src})
-    TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
-ENDFOREACH()
-
-INSTALL(TARGETS wifi_manager_test RUNTIME DESTINATION bin/)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1f1759d
--- /dev/null
@@ -0,0 +1,25 @@
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+SET(GTEST "gtest-wifi-manager")
+
+pkg_check_modules(gtest_pkgs REQUIRED gmock glib-2.0)
+INCLUDE_DIRECTORIES(${gtest_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${gtest_pkgs_LIBRARY_DIRS})
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-lto")
+
+FILE(GLOB GTEST_SRCS *.cpp mocks/*.c ${CMAKE_SOURCE_DIR}/src/*.c)
+ADD_EXECUTABLE(${GTEST} ${GTEST_SRCS})
+TARGET_LINK_LIBRARIES(${GTEST} ${gtest_pkgs_LIBRARIES} ${${fw_name}_LIBRARIES})
+SET_TARGET_PROPERTIES(${GTEST} PROPERTIES COMPILE_FLAGS "-fPIE" LINK_FLAGS "-Wl,\
+--wrap=system_info_get_platform_bool,\
+--wrap=g_try_malloc0,\
+--wrap=g_bus_get_sync,\
+--wrap=g_cancellable_new,\
+--wrap=g_dbus_connection_call_sync,\
+--wrap=g_dbus_connection_call,\
+--wrap=g_dbus_connection_call_finish,\
+--wrap=g_dbus_connection_signal_subscribe,\
+--wrap=g_dbus_connection_signal_unsubscribe,\
+--wrap=vconf_get_int,\
+--wrap=vconf_get_bool,\
+--wrap=vconf_get_str")
diff --git a/tests/gtest-wifi-manager-activation.cpp b/tests/gtest-wifi-manager-activation.cpp
new file mode 100755 (executable)
index 0000000..2847dd4
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerActivation : public ::testing::Test {
+protected:
+       wifi_manager_h handle;
+       WifiManagerTestUtil testUtil;
+
+       UtcWifiManagerActivation() : handle(nullptr)
+       {
+       }
+
+       void SetUp() override
+       {
+               mock_set_system_info_result(true);
+               mock_set_memory_result(true);
+               mock_set_gdbus_result(true);
+               mock_set_vconf_result(true);
+               mock_set_gdbus_powered(true);
+               mock_set_gdbus_devicePolicy(false);
+               wifi_manager_initialize(&handle);
+       }
+
+       void TearDown() override
+       {
+               wifi_manager_deinitialize(handle);
+               mock_set_system_info_result(false);
+               mock_set_memory_result(false);
+               mock_set_gdbus_result(false);
+               mock_set_vconf_result(false);
+               mock_set_gdbus_powered(false);
+               mock_set_gdbus_devicePolicy(true);
+       }
+};
+
+
+static void utc_wifi_manager_activated_cb(wifi_manager_error_e result, void *user_data)
+{
+       g_nCallbackRet = result;
+}
+
+static void utc_wifi_manager_deactivated_cb(wifi_manager_error_e result, void *user_data)
+{
+       g_nCallbackRet = result;
+}
+
+TEST_F(UtcWifiManagerActivation, ActivateP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_activate(handle, utc_wifi_manager_activated_cb, nullptr));
+       testUtil.runMainLoop();
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerActivation, ActivateN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_activate(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, ActivateN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_activate(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, ActivateN3)
+{
+       mock_set_gdbus_devicePolicy(true);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_activate(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, ActivateN4)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_activate(handle, utc_wifi_manager_activated_cb, nullptr));
+       mock_set_gdbus_error_msg(ERROR_SECURITY_RESTRICTED);
+       testUtil.runMainLoop();
+       EXPECT_EQ(WIFI_MANAGER_ERROR_SECURITY_RESTRICTED, g_nCallbackRet);
+}
+
+#if 0 //This will enable after fix in wifi-manager code
+TEST_F(UtcWifiManagerActivation, ActivateN5)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_activate(handle, utc_wifi_manager_activated_cb, nullptr));
+       mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+       testUtil.runMainLoop();
+       EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerActivation, ActivateN6)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_activate(handle, utc_wifi_manager_activated_cb, nullptr));
+       mock_set_gdbus_error_msg(ERROR_ALREADY_EXISTS);
+       testUtil.runMainLoop();
+       EXPECT_EQ(WIFI_MANAGER_ERROR_ALREADY_EXISTS, g_nCallbackRet);
+}
+#endif
+
+TEST_F(UtcWifiManagerActivation, Activate_with_wifi_pickerN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_activate_with_wifi_picker_tested(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, Activate_with_wifi_pickerP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_activate_with_wifi_picker_tested(handle, utc_wifi_manager_activated_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, Activate_with_wifi_pickerN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_activate_with_wifi_picker_tested(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, Activate_with_wifi_pickerN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_activate_with_wifi_picker_tested(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, Activate_with_wifi_pickerN4)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_activate_with_wifi_picker_tested(handle, utc_wifi_manager_activated_cb, nullptr));
+        mock_set_gdbus_error_msg(ERROR_SECURITY_RESTRICTED);
+        testUtil.runMainLoop();
+        EXPECT_EQ(WIFI_MANAGER_ERROR_SECURITY_RESTRICTED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerActivation, DeactivateP1)
+{
+       mock_set_gdbus_tech_state("wlan0", TRUE, FALSE);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deactivate(handle, utc_wifi_manager_deactivated_cb, nullptr)); 
+       mock_set_gdbus_tech_state("wlan0", FALSE, FALSE);
+}
+
+TEST_F(UtcWifiManagerActivation, DeactivateN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_deactivate(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerActivation, DeactivateN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_ALREADY_EXISTS, wifi_manager_deactivate(handle, utc_wifi_manager_deactivated_cb, nullptr)); 
+}
+
+TEST_F(UtcWifiManagerActivation, DeactivateN3)
+{
+       mock_set_gdbus_tech_state("wlan0", TRUE, FALSE);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deactivate(handle, utc_wifi_manager_deactivated_cb, nullptr));
+       mock_set_gdbus_error_msg(ERROR_SECURITY_RESTRICTED);
+       testUtil.runMainLoop();
+       EXPECT_EQ(WIFI_MANAGER_ERROR_SECURITY_RESTRICTED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerActivation, DeactivateN4)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_deactivate(handle, nullptr, nullptr));
+}
+
+
+#if 0 //This will enable after fix in wifi-manager code
+TEST_F(UtcWifiManagerActivation, DeactivateN4)
+{
+       mock_set_gdbus_tech_state("wlan0", TRUE, FALSE);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deactivate(handle, utc_wifi_manager_deactivated_cb, nullptr));
+       mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+       testUtil.runMainLoop();
+       EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, g_nCallbackRet);
+}
+#endif
diff --git a/tests/gtest-wifi-manager-ap.cpp b/tests/gtest-wifi-manager-ap.cpp
new file mode 100644 (file)
index 0000000..47f29d8
--- /dev/null
@@ -0,0 +1,884 @@
+/*
+* Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+#include <wifi-manager-extension.h>
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerAp : public ::testing::Test {
+        protected:
+                wifi_manager_h handle;
+                WifiManagerTestUtil testUtil;
+
+                UtcWifiManagerAp() : handle(nullptr)
+                {
+                }
+
+                void SetUp() override
+                {
+                        mock_set_system_info_result(true);
+                        mock_set_memory_result(true);
+                        mock_set_gdbus_result(true);
+                        mock_set_vconf_result(true);
+                        wifi_manager_initialize(&handle);
+                        mock_set_gdbus_tech_state("wlan0", true, false);
+                }
+
+                void TearDown() override
+                {
+                        wifi_manager_deinitialize(handle);
+                        mock_set_system_info_result(false);
+                        mock_set_memory_result(false);
+                        mock_set_gdbus_result(false);
+                        mock_set_vconf_result(false);
+                        mock_set_gdbus_tech_state("wlan0", false, false);
+                        g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+                }
+};
+
+
+bool callback(unsigned char *vsie, int length, void *user_data)
+{
+       return true;
+}
+
+bool vsie_cb (unsigned char *vsie, int length, void *user_data)
+{
+       return true;
+}
+
+bool found_bssid_cb(const char *bssid, int rssi, int freq, void *user_data)
+{
+       return true;
+}
+
+bool ipv6_cb(char *ipv6_address, void *user_data)
+{
+       return true;
+}
+
+wifi_manager_ap_h _ap;
+
+wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+
+wifi_manager_ip_config_type_e type;
+
+const char essid = '1';
+
+TEST_F(UtcWifiManagerAp, ApCreateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_create(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApCreateN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_create(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApCreateN3)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_create(handle, &essid, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApCreateP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_create(handle, &essid, &_ap));
+}
+
+TEST_F(UtcWifiManagerAp, ApHiddenCreateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_hidden_create(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApHiddenCreateN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_hidden_create(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApHiddenCreateN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_hidden_create(handle, &essid, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApHiddenCreateP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_hidden_create(handle, &essid, &_ap));
+}
+
+TEST_F(UtcWifiManagerAp, ApDestroyN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_destroy(nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApCloneN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_clone(nullptr, _ap));
+}
+
+TEST_F(UtcWifiManagerAp, ApCloneN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_clone(nullptr, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerAp, ApRefreshP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_refresh(_ap));
+}
+*/
+
+TEST_F(UtcWifiManagerAp, ApRefreshN1)
+{
+        wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_ap_refresh(_ap));
+}
+
+TEST_F(UtcWifiManagerAp, ApRefreshN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_refresh(nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApRefreshN3)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_ap_refresh(_ap));
+}
+
+TEST_F(UtcWifiManagerAp, ApRefreshN4)
+{
+        mock_set_gdbus_error_msg(ERROR_NULL);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_refresh(_ap));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEssidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_essid(_ap, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_essid(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetRawSsidN1)
+{
+       int *len = NULL;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_raw_ssid(_ap, nullptr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_raw_ssid(nullptr, nullptr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_raw_ssid(_ap, nullptr, len));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetBssidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_bssid(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetRssiN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_rssi(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetRssiLevelN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_rssi_level(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetFrequencyN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_frequency(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApForeachVsieN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_foreach_vsie(_ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApForeachVsieP1)
+{
+        wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_foreach_vsie(_ap, vsie_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetMaxSpeedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_max_speed(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApIsFavoriteN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_is_favorite(_ap, nullptr));
+}
+
+
+TEST_F(UtcWifiManagerAp, ApIsPasspointN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_is_passpoint(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetConnectionStateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_connection_state(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetIpConfigTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_ip_config_type(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetIpConfigTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_ip_config_type(nullptr, addr, type));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetIpConfigTypeP1)
+{
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_ip_config_type_e type = WIFI_MANAGER_IP_CONFIG_TYPE_NONE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_ip_config_type(_ap, addr, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_ip_config_type(_ap, addr, &type));
+       addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_ip_config_type(_ap, addr, type));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_ip_config_type(_ap, addr, &type));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetIpAddressN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_ip_address(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetIpAddressN2)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       char *ip_address;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NO_CONNECTION, wifi_manager_ap_get_ip_address(_ap, addr, &ip_address));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetIpAddressN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_ip_address(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetIpAddressP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       char ip = '1';
+       char *ip_addr = &ip;
+       const char *ip_address = &ip;
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_ip_address(_ap, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_ip_address(_ap, addr, ip_address));
+       EXPECT_EQ(-30277630, wifi_manager_ap_get_ip_address(_ap, addr, &ip_addr));
+       addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_ip_address(_ap, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_ip_address(_ap, addr, &ip_addr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_ip_address(_ap, addr, ip_address));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetSubnetMaskN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_subnet_mask(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetSubnetMaskN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_subnet_mask(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetSubnetMaskP1)
+{
+       const char mask = '1';
+       char *subnet;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_subnet_mask(_ap, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_subnet_mask(_ap, addr, &subnet));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_subnet_mask(_ap, addr, &mask));
+       addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_subnet_mask(_ap, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_subnet_mask(_ap, addr, &subnet));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetPrefixLengthN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_prefix_length(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetPrefixLengthN1)
+{
+       int prefix_len = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_prefix_length(nullptr, addr, prefix_len));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetPrefixLengthP1)
+{
+        int prefix_len = 1;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_prefix_length(_ap, addr, prefix_len));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_prefix_length(_ap, addr, &prefix_len));
+       addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_prefix_length(_ap, addr, prefix_len));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_prefix_length(_ap, addr, &prefix_len));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetGatewayAddressN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_gateway_address(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetGatewayAddressN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_gateway_address(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetGatewayAddressP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+       const char g_addr = '1';
+       char g_ad = '1';
+       char *ad = &g_ad;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_gateway_address(_ap, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_gateway_address(_ap, addr, &ad));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_gateway_address(_ap, addr, &g_addr));
+       addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_gateway_address(_ap, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_gateway_address(_ap, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_gateway_address(_ap, addr, &g_addr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDhcpServerAddressN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_dhcp_server_address(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDhcpServerAddressP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+       char dhcp = '1';
+       char *dp = &dhcp;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_dhcp_server_address(_ap, addr, &dp));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDhcpServerAddressN2)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       char dhcp = '1';
+       char *dp = &dhcp;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_SUPPORTED, wifi_manager_ap_get_dhcp_server_address(_ap, addr, &dp));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDhcpLeaseDurationN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_dhcp_lease_duration(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDhcpLeaseDurationP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+       int dhcp = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_dhcp_lease_duration(_ap, addr, &dhcp));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDhcpLeaseDurationN2)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+        int dhcp = 1;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_SUPPORTED, wifi_manager_ap_get_dhcp_lease_duration(_ap, addr, &dhcp));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetProxyAddressN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_proxy_address(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetProxyAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_proxy_address(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetProxyAddressP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       const char add = '1';
+       char ad = '1';
+       char *a = &ad;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_proxy_address(_ap, addr, &add));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_proxy_address(_ap, addr, &a));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetProxyTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_proxy_type(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetProxyTypeN1)
+{
+       wifi_manager_proxy_type_e type = WIFI_MANAGER_PROXY_TYPE_DIRECT;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_proxy_type(nullptr, type));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDnsConfigTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_dns_config_type(_ap, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetDnsConfigTypeN1)
+{
+       wifi_manager_dns_config_type_e type = WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_dns_config_type(nullptr, addr, type));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetDnsConfigTypeP1)
+{
+       wifi_manager_dns_config_type_e type = WIFI_MANAGER_DNS_CONFIG_TYPE_STATIC;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_dns_config_type(_ap, addr, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_dns_config_type(_ap, addr, &type));
+       addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_dns_config_type(_ap, addr, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_dns_config_type(_ap, addr, &type));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDnsAddressN1)
+{
+       int order = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_dns_address(_ap, order, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetDnsAddressN1)
+{
+       int order = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_dns_address(_ap, order, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetDnsAddressP1)
+{
+        int order = 1;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_address_family_e addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV4;
+       const char ad = '1';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_dns_address(_ap, order, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_dns_address(_ap, order, addr, &ad));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_dns_address(_ap, order, addr, nullptr));
+       addr = WIFI_MANAGER_ADDRESS_FAMILY_IPV6;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_dns_address(_ap, order, addr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_dns_address(_ap, order, addr,&ad));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_dns_address(_ap, order, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetDnsAddressN2)
+{
+        int order = 0;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_dns_address(_ap, order, addr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetCountryCodeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_countrycode(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ForeachFoundBssidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_bssid(_ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ForeachFoundBssidP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_foreach_found_bssid(_ap, found_bssid_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetSecurityTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_security_type(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetSecurityTypeN1)
+{
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_NONE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_security_type(nullptr, type));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetSecurityTypeP1)
+{
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_NONE;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_security_type(_ap, &type));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEncryptionTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_encryption_type(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEncryptionTypeN1)
+{
+       wifi_manager_encryption_type_e type = WIFI_MANAGER_ENCRYPTION_TYPE_NONE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_encryption_type(nullptr, type));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEncryptionTypeP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        wifi_manager_encryption_type_e type = WIFI_MANAGER_ENCRYPTION_TYPE_NONE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_encryption_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_encryption_type(_ap, &type));
+}
+
+TEST_F(UtcWifiManagerAp, ApIsPassphraseRequiredN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_is_passphrase_required(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApIsPassphraseRequiredP1)
+{
+       bool required = true;
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_WEP;
+       const char pass = '1';
+       wifi_manager_get_connected_ap(handle, &_ap);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_ap_is_passphrase_required(_ap, &required));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_ap_set_passphrase(_ap, &pass));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_is_passphrase_required(_ap, &required));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_passphrase(_ap, &pass));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetPassphraseN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_passphrase(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApIsWpsSupportedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_is_wps_supported(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApIsWpsSupportedP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       bool support = true;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_is_wps_supported(_ap, &support));
+}
+
+TEST_F(UtcWifiManagerAp, ApIsHiddenN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_is_hidden(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApIsHiddenP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       bool hidden = true;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_is_hidden(_ap, &hidden));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapPassphraseN1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_passphrase(nullptr, nullptr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_passphrase(_ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapPassphraseP1)
+{
+       const char username = '1';
+       const char pass = '1';
+       wifi_manager_get_connected_ap(handle, &_ap);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_set_eap_passphrase(_ap, &username, &pass));
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_eap_passphrase(_ap, &username, &pass));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapPassphraseN1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_passphrase(nullptr, nullptr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_passphrase(_ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapPassphraseP1)
+{
+       char usr = '1';
+       char *username = &usr;
+       bool is_set = true;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_get_eap_passphrase(_ap, &username, &is_set));
+        wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_eap_passphrase(_ap, &username, &is_set));
+
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapAnonymousIdentityN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_anonymous_identity(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapAnonymousIdentityP1)
+{
+       const char name = '1';
+       wifi_manager_get_connected_ap(handle, &_ap);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_set_eap_anonymous_identity(_ap, &name));
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_eap_anonymous_identity(_ap, &name));
+}
+
+
+TEST_F(UtcWifiManagerAp, ApGetEapAnonymousIdentityN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_anonymous_identity(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapAnonymousIdentityP1)
+{
+       char name = '1';
+       char *identity = &name;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_get_eap_anonymous_identity(_ap, &identity));
+        wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_eap_anonymous_identity(_ap, &identity));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapCertFileN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_ca_cert_file(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapCertFileP1)
+{
+       char name = '1';
+       char *file = &name;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_get_eap_ca_cert_file(_ap, &file));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_eap_ca_cert_file(_ap, &file));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapCertFileN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_ca_cert_file(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapCertFileP1)
+{
+       const char file = '1';
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_set_eap_ca_cert_file(_ap, &file));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_eap_ca_cert_file(_ap, &file));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapClientCertFileN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_client_cert_file(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapClientCertFileP1)
+{
+       char name = '1';
+       char *file = &name;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_get_eap_client_cert_file(_ap, &file));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_eap_client_cert_file(_ap, &file));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapClientCertFileN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_client_cert_file(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapClientCertFileP1)
+{
+       const char file = '1';
+       wifi_manager_get_connected_ap(handle, &_ap);
+        wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_set_eap_client_cert_file(_ap, &file));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_eap_client_cert_file(_ap, &file));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapPrivateKeyFileN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_private_key_file(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapPrivateKeyFileP1)
+{
+       char name = '1';
+       char *file = &name;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_get_eap_private_key_file(_ap, &file));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_eap_private_key_file(_ap, &file));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapPrivateKeyInfoN1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_private_key_info(nullptr, nullptr, nullptr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_private_key_info(_ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapPrivateKeyInfoP1)
+{
+       const char file = '1';
+       const char pass = '1';
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_set_eap_private_key_info(_ap, &file, &pass));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_eap_private_key_info(_ap, &file, &pass));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_type(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapTypeN1)
+{
+       wifi_manager_eap_type_e type = WIFI_MANAGER_EAP_TYPE_PEAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_type(nullptr, type));
+}
+
+
+TEST_F(UtcWifiManagerAp, ApSetEapTypeP1)
+{
+        wifi_manager_eap_type_e eap_type = WIFI_MANAGER_EAP_TYPE_PEAP;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_set_eap_type(_ap, eap_type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_get_eap_type(_ap, &eap_type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_eap_type(_ap, eap_type));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_eap_type(_ap, &eap_type));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetEapAuthTypeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_eap_auth_type(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapAuthTypeN1)
+{
+       wifi_manager_eap_auth_type_e type = WIFI_MANAGER_EAP_AUTH_TYPE_NONE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_eap_auth_type(nullptr, type));
+}
+
+TEST_F(UtcWifiManagerAp, ApSetEapAuthTypeP1)
+{
+        wifi_manager_eap_auth_type_e auth_type = WIFI_MANAGER_EAP_AUTH_TYPE_NONE;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       wifi_manager_security_type_e type = WIFI_MANAGER_SECURITY_TYPE_EAP;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_set_eap_auth_type(_ap, auth_type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_ap_get_eap_auth_type(_ap, &auth_type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_security_type(_ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_eap_auth_type(_ap, auth_type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_eap_auth_type(_ap, &auth_type));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDisconnectReasonN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_disconnect_reason(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetDisconnectReasonP1)
+{
+       wifi_manager_disconnect_reason_e dc_reason = WIFI_REASON_UNSPECIFIED;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_disconnect_reason(_ap, &dc_reason));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetAssocStatusCodeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_assoc_status_code(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetAssocStatusCodeP1)
+{
+       wifi_manager_assoc_status_code_e status_code = WLAN_STATUS_SUCCESS;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_assoc_status_code(_ap, &status_code));
+}
+
+TEST_F(UtcWifiManagerAp, ApForeachIpv6AddressN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_foreach_ipv6_address(_ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApForeachIpv6AddressP1)
+{
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_foreach_ipv6_address(_ap, ipv6_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetErrorStateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_error_state(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetErrorStateP1)
+{
+       wifi_manager_error_e error_state = WIFI_MANAGER_ERROR_NONE;
+       wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_error_state(_ap, &error_state));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetConnectionModeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_connection_mode(_ap, nullptr));
+}
+
+TEST_F(UtcWifiManagerAp, ApGetConnectionModeN2)
+{
+       wifi_manager_connection_mode_e mode = WIFI_MANAGER_CONNECTION_MODE_80211_B;
+       wifi_manager_get_connected_ap(handle, &_ap);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_ap_get_connection_mode(_ap, &mode));
+}
+
+/*
+ * TEST_F(UtcWifiManagerAp, ApGetConnectionModeP1)
+{
+       wifi_manager_connection_mode_e mode = WIFI_MANAGER_CONNECTION_MODE_80211_B;
+        wifi_manager_get_connected_ap(handle, &_ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_connection_mode(_ap, &mode));
+}
+*/
diff --git a/tests/gtest-wifi-manager-conflict.cpp b/tests/gtest-wifi-manager-conflict.cpp
new file mode 100644 (file)
index 0000000..28ae916
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+* Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+#include <wifi-manager-extension.h>
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerConflict : public ::testing::Test {
+        protected:
+                wifi_manager_h handle;
+                WifiManagerTestUtil testUtil;
+
+                UtcWifiManagerConflict() : handle(nullptr)
+                {
+                }
+
+                void SetUp() override
+                {
+                        mock_set_system_info_result(true);
+                        mock_set_memory_result(true);
+                        mock_set_gdbus_result(true);
+                        mock_set_vconf_result(true);
+                        wifi_manager_initialize(&handle);
+                        mock_set_gdbus_tech_state("wlan0", true, false);
+                }
+
+                void TearDown() override
+                {
+                        wifi_manager_deinitialize(handle);
+                        mock_set_system_info_result(false);
+                        mock_set_memory_result(false);
+                        mock_set_gdbus_result(false);
+                        mock_set_vconf_result(false);
+                        mock_set_gdbus_tech_state("wlan0", false, false);
+                        g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+                }
+};
+
+void ip_conflict_cb (char *mac, wifi_manager_ip_conflict_state_e state, void *user_data)
+{
+}
+
+void rssi_level_changed_cb (wifi_manager_rssi_level_e rssi_level, void *user_data)
+{
+}
+
+void module_state_changed_cb (wifi_manager_module_state_e wifi_module_state, void *user_data)
+{
+}
+
+wifi_manager_module_state_e state;
+
+TEST_F(UtcWifiManagerConflict, SetConflictN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_ip_conflict_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, SetConflictN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_ip_conflict_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, SetConflictP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_ip_conflict_cb(handle, &ip_conflict_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, UnsetConflictN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_ip_conflict_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, UnsetConflictP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_ip_conflict_cb(handle));
+}
+
+TEST_F(UtcWifiManagerConflict, SetConflictDetectP1)
+{
+        bool detect = true;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_ip_conflict_detect_enable(handle, detect));
+}
+
+TEST_F(UtcWifiManagerConflict, SetConflictDetectN1)
+{
+       bool detect = true;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_ip_conflict_detect_enable(nullptr, detect));
+}
+
+TEST_F(UtcWifiManagerConflict, ConflictIsEnabledN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ip_conflict_detect_is_enabled(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, ConflictIsEnabledN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ip_conflict_detect_is_enabled(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, ConflictIsEnabledP1)
+{
+       bool state = true;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ip_conflict_detect_is_enabled(handle, &state));
+}
+
+TEST_F(UtcWifiManagerConflict, SetConflictPeriodN1)
+{
+       unsigned int time = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_ip_conflict_period(nullptr, time));
+}
+
+TEST_F(UtcWifiManagerConflict, SetConflictPeriodP1)
+{
+        unsigned int time = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_ip_conflict_period(handle, time));
+}
+
+TEST_F(UtcWifiManagerConflict, GetConflictPeriodN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_ip_conflict_period(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, GetConflictPeriodN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_ip_conflict_period(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, GetConflictPeriodP1)
+{
+        unsigned int time;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_ip_conflict_period(handle, &time));
+}
+
+TEST_F(UtcWifiManagerConflict, GetConflictStateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_ip_conflict_state(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, GetConflictStateN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_ip_conflict_state(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, GetConflictStateP1)
+{
+        wifi_manager_ip_conflict_state_e state;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_ip_conflict_state(handle, &state));
+}
+
+TEST_F(UtcWifiManagerConflict, RssiLevelChangedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_rssi_level_changed_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, RssiLevelChangedN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_rssi_level_changed_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, RssiLevelChangedP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_rssi_level_changed_cb(handle, &rssi_level_changed_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, UnsetRssiLevelChangedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_rssi_level_changed_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, UnsetRssiLevelChangedP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_rssi_level_changed_cb(handle));
+}
+
+TEST_F(UtcWifiManagerConflict, ModuleStateChangedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_module_state_changed_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, ModuleStateChangedN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_module_state_changed_cb(nullptr, &module_state_changed_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, ModuleStateChangedP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_module_state_changed_cb(handle, &module_state_changed_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, UnsetModuleStateChangedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_module_state_changed_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, UnsetModuleStateChangedP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_module_state_changed_cb(handle));
+}
+
+TEST_F(UtcWifiManagerConflict, GetModuleStateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_module_state(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, GetModuleStateN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_module_state(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConflict, GetModuleStateP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_module_state(handle, &state));
+}
+
diff --git a/tests/gtest-wifi-manager-connection.cpp b/tests/gtest-wifi-manager-connection.cpp
new file mode 100644 (file)
index 0000000..d6e6956
--- /dev/null
@@ -0,0 +1,583 @@
+/*
+* Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+#include <wifi-manager-extension.h>
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerConnection : public ::testing::Test {
+        protected:
+                wifi_manager_h handle;
+                WifiManagerTestUtil testUtil;
+
+                UtcWifiManagerConnection() : handle(nullptr)
+                {
+                }
+
+                void SetUp() override
+                {
+                        mock_set_system_info_result(true);
+                        mock_set_memory_result(true);
+                        mock_set_gdbus_result(true);
+                        mock_set_vconf_result(true);
+                        wifi_manager_initialize(&handle);
+                        mock_set_gdbus_tech_state("wlan0", true, false);
+                }
+
+                void TearDown() override
+                {
+                        wifi_manager_deinitialize(handle);
+                        mock_set_system_info_result(false);
+                        mock_set_memory_result(false);
+                        mock_set_gdbus_result(false);
+                        mock_set_vconf_result(false);
+                        mock_set_gdbus_tech_state("wlan0", false, false);
+                        g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+                }
+};
+
+wifi_manager_security_type_e sec_type = WIFI_MANAGER_SECURITY_TYPE_WPA2_PSK;
+
+wifi_manager_ap_h ap;
+
+wifi_manager_connection_state_e conn_state;
+
+void __cb(wifi_manager_error_e result, void* user_data)
+{
+       g_nCallbackRet = result;
+}
+
+void manager_connected_cb (wifi_manager_error_e error_code, void *user_data)
+{
+        g_nCallbackRet = error_code;
+}
+
+void manager_disconnected_cb (wifi_manager_error_e error_code, void *user_data)
+{
+        g_nCallbackRet = error_code;
+}
+
+void manager_forget_ap_finished_cb (wifi_manager_error_e error_code, void *user_data)
+{
+        g_nCallbackRet = error_code;
+}
+
+void conn_state_changed_cb (wifi_manager_connection_state_e state, wifi_manager_ap_h ap, void *user_data)
+{
+}
+
+void device_state_changed_cb (wifi_manager_device_state_e state, void *user_data)
+{
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectHiddenN1)
+{
+        const char essid = 'a';
+       const char passphrase = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_hidden_ap(nullptr, &essid, sec_type, &passphrase, manager_connected_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectHiddenN2)
+{
+        const char essid = 'a';
+        const char passphrase = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_hidden_ap(handle, &essid, sec_type, &passphrase, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectHiddenN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_hidden_ap(handle, nullptr, sec_type, nullptr, manager_connected_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectHiddenN4)
+{
+        const char essid = 'a';
+        const char passphrase = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_connect_hidden_ap(handle, &essid, sec_type, &passphrase, manager_connected_cb, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, ConnectHiddenP1)
+{
+        const char essid = 'a';
+        const char passphrase = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_connect_hidden_ap(handle, &essid, sec_type, &passphrase, manager_connected_cb, nullptr));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, GetConnectedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_connected_ap(nullptr, &ap));
+}
+
+TEST_F(UtcWifiManagerConnection, GetConnectedN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_connected_ap(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetConnectedP1)
+{
+       wifi_manager_ap_h g_wifi_ap;
+       char *ap_name = NULL;
+       char *ssid = NULL;
+       int ssid_len;
+       bool favor;
+       wifi_manager_connection_state_e state;
+       wifi_manager_rssi_level_e rssi_level;
+       wifi_manager_proxy_type_e type;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_clone(&g_wifi_ap, ap));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_essid(ap, &ap_name));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_raw_ssid(ap, &ssid, &ssid_len));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_bssid(ap, &ssid));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_rssi(ap, &ssid_len));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_rssi_level(ap, &rssi_level));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_frequency(ap, &ssid_len));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_max_speed(ap, &ssid_len));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_is_favorite(ap, &favor));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_is_passpoint(ap, &favor));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_connection_state(ap, &state));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_proxy_type(ap, &type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_proxy_type(ap, type));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_countrycode(ap, &ssid));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_destroy(ap));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect(nullptr, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect(handle, &ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectN3)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_connect(handle, ap, manager_connected_cb, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, ConnectP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_connect(handle, ap, manager_connected_cb, nullptr));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, DisconnectN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_disconnect(nullptr, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, DisconnectN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_disconnect(handle, &ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, DisconnectP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_disconnect(handle, ap, manager_disconnected_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectByPbcN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pbc(nullptr, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectByPbcN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pbc(handle, &ap, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectByPbcP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+       int rv = wifi_manager_connect_by_wps_pbc(handle, ap, manager_connected_cb, nullptr);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, rv);
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectByPinN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pin(nullptr, nullptr, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectByPinN2)
+{
+       const char pin = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pin(handle, &ap, &pin, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectByPinN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pin(handle, &ap, nullptr, manager_connected_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectByPinP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+       const char pin = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_connect_by_wps_pin(handle, ap, &pin, manager_connected_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ForgetApN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_forget_ap(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ForgetApN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_forget_ap(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ForgetApN3)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_forget_ap(handle, ap));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, ForgetApP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_forget_ap(handle, ap));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, UpdateApN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_update_ap(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, UpdateApN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_update_ap(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, UpdateApN3)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_SECURITY_RESTRICTED, wifi_manager_update_ap(handle, ap));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, UpdateApP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_SECURITY_RESTRICTED, wifi_manager_update_ap(handle, ap));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, ForgetApAsyncN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_forget_ap_async(nullptr, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ForgetApAsyncN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_forget_ap_async(handle, nullptr, nullptr,nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ForgetApAsyncP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_forget_ap_async(handle, ap, manager_forget_ap_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetConnStateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_connection_state(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetConnStateN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_connection_state(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetConnStateP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connection_state(handle, &conn_state));
+}
+
+TEST_F(UtcWifiManagerConnection, UnsetDeviceStateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_device_state_changed_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, UnsetDeviceStateP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_device_state_changed_cb(handle));
+}
+
+TEST_F(UtcWifiManagerConnection, DevStateChangedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_device_state_changed_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, DevStateChangedN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_device_state_changed_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, DevStateChangedP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_device_state_changed_cb(handle, &device_state_changed_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnStateChangedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_connection_state_changed_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnStateChangedN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_connection_state_changed_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnStateChangedP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_connection_state_changed_cb(handle, &conn_state_changed_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, UnsetConnStateChangedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_connection_state_changed_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, UnsetConnStateChangedP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_connection_state_changed_cb(handle));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectWpsPbcN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pbc_without_ssid(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectWpsPbcN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pbc_without_ssid(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectWpsPbcN3)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOW_IN_PROGRESS, wifi_manager_connect_by_wps_pbc_without_ssid(handle, &manager_connected_cb, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, ConnectWpsPbcP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_connect_by_wps_pbc_without_ssid(handle, &manager_connected_cb, nullptr));
+}
+*/
+
+
+TEST_F(UtcWifiManagerConnection, ConnectWpsPinN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pin_without_ssid(nullptr, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectWpsPinN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pin_without_ssid(handle, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectWpsPinN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pin_without_ssid(handle, nullptr, &manager_connected_cb, nullptr));
+       const char pin[255] = "123";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_connect_by_wps_pin_without_ssid(handle, pin, &manager_connected_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ConnectWpsPinN4)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+       const char pin[255] = "1234";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NOW_IN_PROGRESS, wifi_manager_connect_by_wps_pin_without_ssid(handle, pin, &manager_connected_cb, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, ConnectWpsPinP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        const char pin[255] = "1234";
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOW_IN_PROGRESS, wifi_manager_connect_by_wps_pin_without_ssid(handle, pin, &manager_connected_cb, nullptr));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, CancelWpsN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_cancel_wps(nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, CancelWpsN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_cancel_wps(handle));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, CancelWpsP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_cancel_wps(handle));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, GetWpsPinN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_wps_generated_pin(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetWpsPinN2)
+{
+       char *pin;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_get_wps_generated_pin(handle, &pin));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, GetWpsPinP1)
+{
+        char *pin;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_get_wps_generated_pin(handle, &pin));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, SetPasspointN1)
+{
+       int passpoint = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_passpoint(nullptr, passpoint));
+}
+
+TEST_F(UtcWifiManagerConnection, SetPasspointP1)
+{
+       int passpoint = 1;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_passpoint(handle, passpoint));
+}
+
+TEST_F(UtcWifiManagerConnection, GetPasspointN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_passpoint(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetPasspointN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_passpoint(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetPasspointN3)
+{
+        int passpoint;
+        EXPECT_EQ(-999, wifi_manager_get_passpoint(handle, &passpoint));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, GetPasspointP1)
+{
+        int passpoint;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_passpoint(handle, &passpoint));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, GetAutoConnectN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_auto_connect(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetAutoConnectN2)
+{
+        int connect_mode = 1;
+        EXPECT_EQ(-999, wifi_manager_get_auto_connect(handle, &connect_mode));
+}
+
+
+/*
+ * TEST_F(UtcWifiManagerConnection, GetAutoConnectP1)
+{
+        int connect_mode = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_auto_connect(handle, &connect_mode));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, SetAutoConnectP1)
+{
+        int connect_mode = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_auto_connect(handle, connect_mode));
+}
+
+TEST_F(UtcWifiManagerConnection, ApSetAutoConnectN1)
+{
+        bool autoconnect = TRUE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_set_auto_connect(nullptr, autoconnect));
+}
+
+TEST_F(UtcWifiManagerConnection, ApSetAutoConnectP1)
+{
+        bool autoconnect = TRUE;
+       wifi_manager_get_connected_ap(handle, &ap);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_set_auto_connect(ap, autoconnect));
+}
+
+TEST_F(UtcWifiManagerConnection, ApGetAutoConnectN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_auto_connect(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, ApGetAutoConnectN2)
+{
+        bool autoconnect = 1;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connected_ap(handle, &ap));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_ap_get_auto_connect(&ap, &autoconnect));
+}
+
+/*
+ * TEST_F(UtcWifiManagerConnection, ApGetAutoConnectP1)
+{
+        bool autoconnect = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_ap_get_auto_connect(&ap, &autoconnect));
+}
+*/
+
+TEST_F(UtcWifiManagerConnection, GetConnectionModeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_connection_mode(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetConnectionModeN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_connection_mode(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerConnection, GetConnectionModeP1)
+{
+       wifi_manager_connection_mode_e mode;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_connection_mode(handle, &mode));
+}
+
diff --git a/tests/gtest-wifi-manager-dpp.cpp b/tests/gtest-wifi-manager-dpp.cpp
new file mode 100644 (file)
index 0000000..4555545
--- /dev/null
@@ -0,0 +1,600 @@
+/*
+ * Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+#include "wifi-manager-extension.h"
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerDpp : public ::testing::Test {
+protected:
+       wifi_manager_h handle;
+       WifiManagerTestUtil testUtil;
+       const char *name;
+       const char *passphrase;
+       wifi_manager_security_type_e security_type;
+       wifi_manager_config_h origin;
+       wifi_manager_config_h clone;
+
+       UtcWifiManagerDpp() : handle(nullptr), name("dummy"), passphrase("dummy"),
+               security_type(WIFI_MANAGER_SECURITY_TYPE_NONE), origin(nullptr), clone(nullptr)
+       {
+       }
+
+       void SetUp() override
+       {
+               mock_set_system_info_result(true);
+               mock_set_memory_result(true);
+               mock_set_gdbus_result(true);
+               mock_set_vconf_result(true);
+               wifi_manager_initialize(&handle);
+               mock_set_gdbus_tech_state("wlan0", true, false);
+       }
+
+       void TearDown() override
+       {
+               wifi_manager_config_destroy(origin);
+               wifi_manager_config_destroy(clone);
+
+               wifi_manager_deinitialize(handle);
+               mock_set_system_info_result(false);
+               mock_set_memory_result(false);
+               mock_set_gdbus_result(false);
+               mock_set_vconf_result(false);
+               mock_set_gdbus_tech_state("wlan0", false, false);
+               g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+       }
+};
+
+
+wifi_manager_address_family_e address_family;
+
+int order = 1;
+
+TEST_F(UtcWifiManagerDpp, ConfigCreateN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_create(nullptr, nullptr, nullptr, security_type, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigCreateN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_create(handle, nullptr, nullptr, security_type, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigCreateP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigDestroyN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_destroy(nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigDestroyP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_save(handle, origin));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigCloneN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_clone(origin, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigCloneP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_clone(origin, &clone));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSaveN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_save(nullptr, origin));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSaveP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_save(handle, origin));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigRemoveN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_remove(nullptr, origin));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigRemoveP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_remove(handle, origin));
+}
+
+static bool __tests_foreach_config_cb(const wifi_manager_config_h config, void *user_data)
+{
+       return TRUE;
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigForeachConfigurationN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_foreach_configuration(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigForeachConfigurationN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_foreach_configuration(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigForeachConfigurationP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_foreach_configuration(handle, __tests_foreach_config_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigForeachConfigurationAllN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_foreach_configuration_in_all_interfaces(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigForeachConfigurationAllN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_foreach_configuration_in_all_interfaces(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigForeachConfigurationAllP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_foreach_configuration_in_all_interfaces(handle, __tests_foreach_config_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetNameN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_name(origin, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetNameP1)
+{
+       char *new_name = NULL;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_name(origin, &new_name));
+       free(new_name);
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetSecurityTypeN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_security_type(origin, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetSecurityTypeP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_security_type(origin, &security_type));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetProxyAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_proxy_address(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetProxyAddressP1)
+{
+       const char *proxy_addr = "dummy";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_proxy_address(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, proxy_addr));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, wifi_manager_config_set_proxy_address(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV6, proxy_addr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetProxyAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_proxy_address(origin, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetProxyAddressP1)
+{
+       wifi_manager_address_family_e addr_family;
+       char *proxy_addr = NULL;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_proxy_address(origin, &addr_family, &proxy_addr));
+       free(proxy_addr);
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetHiddenApN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_hidden_ap_property(nullptr, true));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetHiddenApP1)
+{
+       bool hidden = true;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_hidden_ap_property(origin, hidden));
+}
+
+
+TEST_F(UtcWifiManagerDpp, ConfigGetHiddenApN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_hidden_ap_property(origin, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetHiddenApP1)
+{
+       bool hidden = true;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_hidden_ap_property(origin, &hidden));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetIpConfigTypeN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_ip_config_type(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetIpConfigTypeP1)
+{
+       wifi_manager_ip_config_type_e type;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_ip_config_type(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &type));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetIpConfigTypeN1)
+{
+       wifi_manager_ip_config_type_e type = WIFI_MANAGER_IP_CONFIG_TYPE_NONE;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_ip_config_type(nullptr, address_family, type));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetIpConfigTypeP1)
+{
+       wifi_manager_ip_config_type_e type = WIFI_MANAGER_IP_CONFIG_TYPE_NONE;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_ip_config_type(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, type));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetIpAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_ip_address(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetIpAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_ip_address(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetIpAddressP1)
+{
+       const char *ip_addr = "192.168.0.1";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_ip_address(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, ip_addr));
+       char *ip_address = nullptr;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_ip_address(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &ip_address));
+       free(ip_address);
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetSubnetMaskN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_subnet_mask(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetSubnetMaskN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_subnet_mask(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetSubnetMaskP1)
+{
+       const char *subnet = "255.255.255.0";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_subnet_mask(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, subnet));
+        char *sub_mask = NULL;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_subnet_mask(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &sub_mask));
+        free(sub_mask);
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetPrefixLenN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_prefix_length(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetPrefixLenP1)
+{
+       int prefix_len = 24;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_prefix_length(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &prefix_len));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetPrefixLenN1)
+{
+       int prefix_len = 24;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_prefix_length(nullptr, address_family, prefix_len));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetPrefixLenP1)
+{
+       int prefix_len = 24;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_prefix_length(origin, WIFI_MANAGER_ADDRESS_FAMILY_IPV6, prefix_len));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetGatewayAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_gateway_address(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetGatewayAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_gateway_address(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetGatewayAddressP1)
+{
+       const char *gw_addr = "192.168.0.1";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_gateway_address(origin, address_family, gw_addr));
+        char *gw_address = NULL;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_gateway_address(origin, address_family, &gw_address));
+        free(gw_address);
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetDnsConfigTypeN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_dns_config_type(origin, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetDnsConfigTypeP1)
+{
+       wifi_manager_dns_config_type_e type;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_dns_config_type(origin, address_family, &type));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetDnsConfigTypeN1)
+{
+       wifi_manager_dns_config_type_e type = WIFI_MANAGER_DNS_CONFIG_TYPE_NONE;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_dns_config_type(nullptr, address_family, type));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetDnsConfigTypeP1)
+{
+       wifi_manager_dns_config_type_e type = WIFI_MANAGER_DNS_CONFIG_TYPE_NONE;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_dns_config_type(nullptr, address_family, type));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetDnsAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_dns_address(origin, order, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetDnsAddressN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_dns_address(origin, order, address_family, nullptr));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigSetDnsAddressP1)
+{
+       int order = 1;
+       const char *dns_addr = "192.168.0.1";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_dns_address(origin, order, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, dns_addr));
+       char *dns_address = NULL;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_dns_address(origin, order, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &dns_address));
+}
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapAnonymousIdentityN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_anonymous_identity(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapAnonymousIdentityP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_anonymous_identity(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapAnonymousIdentityN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_anonymous_identity(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapAnonymousIdentityP1)
+{
+       const char * identity = "";
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, name, passphrase, security_type, &origin));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_eap_anonymous_identity(origin, identity));
+}
+*/
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapCaCertFileN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_ca_cert_file(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapCaCertFileP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_ca_cert_file(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapCaCertFileN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_ca_cert_file(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapCaCertFileP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_ca_cert_file(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapClientCertFileN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_client_cert_file(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapClientCertFileP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_client_cert_file(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapClientCertFileN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_client_cert_file(origin, nullptr, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapClientCertFileP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_client_cert_file(origin, nullptr, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapPrivateKeyFileN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_private_key_file(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapPrivateKeyFileP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_private_key_file(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapPrivateKeyInfoN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_private_key_info(origin, nullptr, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapPrivateKeyInfoP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_private_key_info(origin, nullptr, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapIdentityN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_identity(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapIdentityP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_identity(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapIdentityN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_identity(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapIdentityP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_identity(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapTypeN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_type(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapTypeP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_type(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapTypeN1)
+{
+       wifi_manager_eap_type_e eap_type = WIFI_MANAGER_EAP_TYPE_PEAP;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_type(nullptr, eap_type));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapTypeP1)
+ {
+ wifi_manager_eap_type_e eap_type;
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_type(nullptr, eap_type));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapAuthTypeN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_auth_type(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapAuthTypeP1)
+ {
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_auth_type(origin, nullptr));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapAuthTypeN1)
+{
+       wifi_manager_eap_auth_type_e eap_auth_type = WIFI_MANAGER_EAP_AUTH_TYPE_NONE;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_auth_type(nullptr, eap_auth_type));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapAuthTypeP1)
+ {
+ wifi_manager_eap_auth_type_e eap_auth_type;
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_auth_type(nullptr, eap_auth_type));
+ }
+ */
+
+TEST_F(UtcWifiManagerDpp, ConfigGetEapSubjectMatchN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_subject_match(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigGetEapSubjectMatchP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_eap_subject_match(origin, nullptr));
+}
+*/
+
+TEST_F(UtcWifiManagerDpp, ConfigSetEapSubjectMatchN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_subject_match(origin, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerDpp, ConfigSetEapSubjectMatchP1)
+{
+ EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_eap_subject_match(origin, nullptr));
+}
+*/
diff --git a/tests/gtest-wifi-manager-info.cpp b/tests/gtest-wifi-manager-info.cpp
new file mode 100755 (executable)
index 0000000..74a6b57
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "wifi-manager.h"
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+class UtcWifiManagerInfo : public ::testing::Test {
+       protected:
+               wifi_manager_h handle;
+               UtcWifiManagerInfo() : handle(nullptr)
+               {
+               }
+
+               void SetUp() override
+               {
+                       mock_set_system_info_result(true);
+                       mock_set_memory_result(true);
+                       mock_set_gdbus_result(true);
+                       mock_set_vconf_result(true);
+                       wifi_manager_initialize(&handle);
+                       mock_set_gdbus_tech_state("wlan0", true, false);
+                       //wifi_manager_activate(handle, nullptr, nullptr);
+               }
+
+               void TearDown() override
+               {
+                       //wifi_manager_deactivate(handle, nullptr, nullptr);
+                       wifi_manager_deinitialize(handle);
+                       mock_set_system_info_result(false);
+                       mock_set_memory_result(false);
+                       mock_set_gdbus_result(false);
+                       mock_set_vconf_result(false);
+                       mock_set_gdbus_tech_state("wlan0", false, false);
+               }
+};
+
+
+/*
+ * static void utc_wifi_manager_activated_cb(wifi_manager_error_e result, void *user_data)
+{
+}
+
+static void utc_wifi_manager_deactivated_cb(wifi_manager_error_e result, void *user_data)
+{
+}
+*/
+
+TEST_F(UtcWifiManagerInfo, IsActivateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_is_activated(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, IsActivateN2)
+{
+       bool activated;
+       mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_is_activated(handle, &activated));
+}
+
+TEST_F(UtcWifiManagerInfo, IsActivateN3)
+{
+       bool activated;
+       mock_set_gdbus_error_msg(ERROR_ALREADY_EXISTS);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_is_activated(handle, &activated));
+}
+
+TEST_F(UtcWifiManagerInfo, IsActivateN4)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_is_activated(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, IsActivateN5)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_is_activated(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, IsActivateP1)
+{
+        bool activated;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_is_activated(handle, &activated));
+}
+
+TEST_F(UtcWifiManagerInfo, GetMACAddrP1)
+{
+        char *mac_address = NULL;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_mac_address(handle, &mac_address));
+}
+
+TEST_F(UtcWifiManagerInfo, GetMACAddrN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_mac_address(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, GetMACAddrN2)
+{
+       char *mac_address = NULL;
+       mock_set_vconf_result(false);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_get_mac_address(handle, &mac_address));
+}
+
+TEST_F(UtcWifiManagerInfo, GetMACAddrN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_mac_address(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, GetMACAddrN4)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_get_mac_address(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, GetNetworkIntfNameN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_network_interface_name(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, GetNetworkIntfNameN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_get_network_interface_name(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, GetNetworkIntfNameN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_network_interface_name(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, GetNetworkIntfNameP1)
+{
+        char* intf_name = NULL;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_network_interface_name(handle, &intf_name));
+}
+
+TEST_F(UtcWifiManagerInfo, Is5GhzSupportedP1)
+{
+       bool supported;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_is_5ghz_band_supported(handle, &supported));
+}
+
+TEST_F(UtcWifiManagerInfo, Is5GhzSupportedN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_is_5ghz_band_supported(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, Is5GhzSupportedN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_is_5ghz_band_supported(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInfo, Is5GhzSupportedN3)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_is_5ghz_band_supported(handle, nullptr));
+}
diff --git a/tests/gtest-wifi-manager-init.cpp b/tests/gtest-wifi-manager-init.cpp
new file mode 100755 (executable)
index 0000000..a745b27
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2021 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/gtest.h>
+
+#include "wifi-manager.h"
+#include "wifi-manager-extension.h"
+
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+}
+
+class UtcWifiManagerInit : public ::testing::Test {
+protected:
+       wifi_manager_h handle;
+       UtcWifiManagerInit() : handle(nullptr)
+       {
+       }
+
+       void SetUp() override
+       {
+               mock_set_system_info_result(true);
+               mock_set_memory_result(true);
+               mock_set_gdbus_result(true);
+       }
+
+       void TearDown() override
+       {
+               mock_set_system_info_result(false);
+               mock_set_memory_result(false);
+               mock_set_gdbus_result(false);
+       }
+};
+
+TEST_F(UtcWifiManagerInit, InitializeN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_initialize(nullptr));
+}
+
+TEST_F(UtcWifiManagerInit, InitializeN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_initialize(&handle));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_ALREADY_INITIALIZED, wifi_manager_initialize(&handle));
+}
+
+TEST_F(UtcWifiManagerInit, InitializeN3)
+{
+       mock_set_memory_result(false);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OUT_OF_MEMORY, wifi_manager_initialize(&handle));
+}
+
+TEST_F(UtcWifiManagerInit, InitializeP)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_initialize(&handle));
+}
+
+TEST_F(UtcWifiManagerInit, DeinitializeN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_deinitialize(nullptr));
+}
+
+TEST_F(UtcWifiManagerInit, DeinitializeN2)
+{
+       int garbage_memory;
+       handle = (wifi_manager_h) &garbage_memory;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NOT_INITIALIZED, wifi_manager_deinitialize(handle));
+}
+
+TEST_F(UtcWifiManagerInit, DeinitializeP)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_initialize(&handle));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_deinitialize(handle));
+}
+
+TEST_F(UtcWifiManagerInit, Initialize_with_ifnameN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_initialize_with_interface_name(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerInit, Initialize_with_ifnameN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_initialize_with_interface_name(&handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerInit, Initialize_with_ifnameN3)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_initialize_with_interface_name(&handle, "wlan0"));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_ALREADY_INITIALIZED, wifi_manager_initialize_with_interface_name(&handle, "wlan0"));
+}
+
+TEST_F(UtcWifiManagerInit, Initialize_with_ifnameN4)
+{
+       mock_set_memory_result(false);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OUT_OF_MEMORY, wifi_manager_initialize_with_interface_name(&handle, "wlan0"));
+}
+
+TEST_F(UtcWifiManagerInit, Initialize_with_ifnameP)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_initialize_with_interface_name(&handle, "wlan0"));
+}
+
+TEST_F(UtcWifiManagerInit, InitializeCsN1)
+{
+       int tid = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_initialize_cs(tid, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerInit, InitializeCsP)
+{
+        int tid = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_initialize_cs(tid, nullptr));
+}
+*/
+
+/*
+ * TEST_F(UtcWifiManagerInit, DeInitializeCsN1)
+{
+        int tid = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_deinitialize_cs(tid, nullptr));
+}
+*/
+
diff --git a/tests/gtest-wifi-manager-scan.cpp b/tests/gtest-wifi-manager-scan.cpp
new file mode 100755 (executable)
index 0000000..ae958d1
--- /dev/null
@@ -0,0 +1,781 @@
+/*
+* Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+#include <wifi-manager-extension.h>
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerScan : public ::testing::Test {
+       protected:
+               wifi_manager_h handle;
+               WifiManagerTestUtil testUtil;
+
+               UtcWifiManagerScan() : handle(nullptr)
+               {
+               }
+
+               void SetUp() override
+               {
+                       mock_set_system_info_result(true);
+                       mock_set_memory_result(true);
+                       mock_set_gdbus_result(true);
+                       mock_set_vconf_result(true);
+                       wifi_manager_initialize(&handle);
+                       mock_set_gdbus_tech_state("wlan0", true, false);
+               }
+
+               void TearDown() override
+               {
+                       wifi_manager_deinitialize(handle);
+                       mock_set_system_info_result(false);
+                       mock_set_memory_result(false);
+                       mock_set_gdbus_result(false);
+                       mock_set_vconf_result(false);
+                       mock_set_gdbus_tech_state("wlan0", false, false);
+                       g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+               }
+};
+
+wifi_manager_autoscan_mode_e mode;
+
+wifi_manager_netlink_scan_h netlink_scan;
+
+wifi_manager_specific_scan_h specific_scan = NULL;
+
+void scan_finished_cb (wifi_manager_error_e error_code, void *user_data)
+{
+       g_nCallbackRet = error_code;
+}
+
+void scan_state_cb(wifi_manager_scan_state_e state, void *user_data)
+{
+}
+
+void set_background_scan_cb (wifi_manager_error_e error_code, void *user_data)
+{
+        g_nCallbackRet = error_code;
+}
+
+void bssid_scan_finished_cb(wifi_manager_error_e error_code, void *user_data)
+{
+       g_nCallbackRet = error_code;
+}
+
+bool interface_cb(char *ifname, void *user_data)
+{
+       return true;
+}
+
+static bool found_ap_cb(wifi_manager_ap_h ap, void *user_data)
+{
+       int rv = 0;
+        char *ap_name = NULL;
+        wifi_manager_connection_state_e state;
+
+        rv = wifi_manager_ap_get_essid(ap, &ap_name);
+        if (rv != WIFI_MANAGER_ERROR_NONE) {
+                return false;
+        }
+
+        rv = wifi_manager_ap_get_connection_state(ap, &state);
+        if (rv != WIFI_MANAGER_ERROR_NONE) {
+                g_free(ap_name);
+                return false;
+        }
+
+        g_free(ap_name);
+
+        return true;
+}
+
+TEST_F(UtcWifiManagerScan, GetScanStateP1)
+{
+        wifi_manager_scan_state_e scan_state;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_scan_state(handle, &scan_state));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanStateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_scan_state(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanStateN2)
+{
+       wifi_manager_scan_state_e scan_state;
+       mock_set_gdbus_result(false);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_get_scan_state(handle, &scan_state));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanStateN4)
+{
+       wifi_manager_scan_state_e scan_state;
+       mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_get_scan_state(handle, &scan_state));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanStateN5)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_scan_state(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan(handle, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_scan(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanN2)
+{
+       mock_set_gdbus_tech_state("wlan0", false, false);
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_scan(handle, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanN3)
+{
+        mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_scan(handle, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetScanN4)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan(handle, scan_finished_cb, nullptr));
+        mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+       testUtil.runMainLoop();
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerScan, GetScanN5)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan(handle, scan_finished_cb, nullptr));
+        mock_set_gdbus_error_msg(ERROR_NOW_IN_PROGRESS);
+        testUtil.runMainLoop();
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerScan, GetScanN6)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan(handle, scan_finished_cb, nullptr));
+        mock_set_gdbus_error_msg(ERROR_FAIL_DEVICE_BUSY);
+        testUtil.runMainLoop();
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerScan, GetScanN7)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_scan(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificP1)
+{
+        const char essid = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan_specific_ap(handle, &essid, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_scan_specific_ap(handle, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_scan_specific_ap(nullptr, nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificN3)
+{
+        const char essid = 'a';
+        mock_set_gdbus_tech_state("wlan0", false, false);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_OPERATION, wifi_manager_scan_specific_ap(handle, &essid, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificN4)
+{
+        const char essid = 'a';
+        mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_scan_specific_ap(handle, &essid, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificN5)
+{
+        const char essid = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan_specific_ap(handle, &essid, scan_finished_cb, nullptr));
+        mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+        testUtil.runMainLoop();
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificN6)
+{
+        const char essid = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan_specific_ap(handle, &essid, scan_finished_cb, nullptr));
+        mock_set_gdbus_error_msg(ERROR_NOW_IN_PROGRESS);
+        testUtil.runMainLoop();
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerScan, GetSpecificN7)
+{
+        const char essid = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan_specific_ap(handle, &essid, scan_finished_cb, nullptr));
+        mock_set_gdbus_error_msg(ERROR_FAIL_DEVICE_BUSY);
+        testUtil.runMainLoop();
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerScan, ForeachAvailIN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_available_interface(nullptr, nullptr, nullptr));
+}
+
+ TEST_F(UtcWifiManagerScan, ForeachAvailIN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_available_interface(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachAvailIP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_foreach_available_interface(handle, interface_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundApN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_ap(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundApN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_ap(handle, nullptr, nullptr));
+}
+
+#if 0  //enable once fix in wifi_manager code
+TEST_F(UtcWifiManagerScan, ForeachFoundApN3)
+{
+        mock_set_gdbus_error_msg(ERROR_NULL);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_foreach_found_ap(handle, found_ap_cb, nullptr));
+}
+#endif
+
+TEST_F(UtcWifiManagerScan, ForeachFoundApP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_foreach_found_ap(handle, found_ap_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundAllN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_ap_in_all_interfaces(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetFrequencyN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_get_frequency(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetFrequencyN1)
+{
+        int frequency = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_config_set_frequency(nullptr, frequency));
+}
+
+/*
+ * TEST_F(UtcWifiManagerScan, SetFrequencyP1)
+{
+       wifi_manager_config_h origin;
+       const char name = '1';
+        const char passphrase = '1';
+       int frequency = 1;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_create(handle, &name, &passphrase, WIFI_MANAGER_SECURITY_TYPE_NONE, &origin));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_set_frequency(origin, frequency));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_config_get_frequency(origin, &frequency));
+}
+*/
+
+TEST_F(UtcWifiManagerScan, ForeachFoundAllN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_ap_in_all_interfaces(handle, nullptr, nullptr));
+}
+
+#if 0  //enable once fix in wifi_manager code
+TEST_F(UtcWifiManagerScan, ForeachFoundAllN3)
+{
+        mock_set_gdbus_error_msg(ERROR_NULL);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_foreach_found_ap_in_all_interfaces(handle, found_ap_cb, nullptr));
+}
+#endif
+
+TEST_F(UtcWifiManagerScan, ForeachFoundAllP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_foreach_found_ap_in_all_interfaces(handle, found_ap_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundSpecificN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_specific_ap(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundSpecificN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_specific_ap(handle, nullptr, nullptr));
+}
+
+#if 0  //enable once fix in wifi_manager code
+TEST_F(UtcWifiManagerScan, ForeachFoundSpecificN3)
+{
+        mock_set_gdbus_error_msg(ERROR_NULL);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_foreach_found_specific_ap(handle, found_ap_cb, nullptr));
+}
+#endif
+
+TEST_F(UtcWifiManagerScan, ForeachFoundSpecificP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_foreach_found_specific_ap(handle, found_ap_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundBssidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_bssid_ap(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundBssidN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_bssid_ap(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundBssidP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_foreach_found_bssid_ap(handle, found_ap_cb, nullptr));
+}
+
+
+#if 0  //enable once fix in wifi_manager code
+TEST_F(UtcWifiManagerScan, ForeachFoundBssidN3)
+{
+        mock_set_gdbus_error_msg(ERROR_NULL);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_foreach_found_bssid_ap(handle, found_ap_cb, nullptr));
+}
+#endif
+
+TEST_F(UtcWifiManagerScan, ForeachFoundNetlinkN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_netlink_scan_ap(nullptr, nullptr, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerScan, ForeachFoundNetlinkP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_foreach_found_netlink_scan_ap(handle, found_ap_cb, nullptr));
+}
+*/
+
+TEST_F(UtcWifiManagerScan, ForeachFoundNetlinkN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_foreach_found_netlink_scan_ap(handle, found_ap_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ForeachFoundNetlinkN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_foreach_found_netlink_scan_ap(handle, nullptr, nullptr));
+}
+
+#if 0  //enable once fix in wifi_manager code
+TEST_F(UtcWifiManagerScan, ForeachFoundNetlinkN3)
+{
+        mock_set_gdbus_error_msg(ERROR_NULL);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_foreach_found_netlink_scan_ap(handle, found_ap_cb, nullptr));
+}
+#endif
+
+TEST_F(UtcWifiManagerScan, NetlinkScanN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_netlink_scan(nullptr, netlink_scan, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_netlink_scan(handle, netlink_scan, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanN3)
+{
+        EXPECT_EQ(-38, wifi_manager_netlink_scan(handle, netlink_scan, scan_finished_cb, nullptr));
+}
+
+/*
+ * TEST_F(UtcWifiManagerScan, NetlinkScanP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_netlink_scan(handle, netlink_scan, scan_finished_cb, nullptr));
+}
+*/
+
+TEST_F(UtcWifiManagerScan, ScanSpecificApN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_scan_specific_ap(handle, nullptr, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ScanSpecificApN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_scan_specific_ap(handle, nullptr, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ScanSpecificApN3)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan_specific_ap(handle, "TEMP_AP1", scan_finished_cb, nullptr));
+       mock_set_gdbus_error_msg(ERROR_SECURITY_RESTRICTED);
+        testUtil.runMainLoop();
+       EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, g_nCallbackRet);
+}
+
+TEST_F(UtcWifiManagerScan, ScanSpecificApN4)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_scan_specific_ap(nullptr, nullptr, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ScanSpecificApP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_scan_specific_ap(handle, "TEMP_AP1", scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetBackgroundScanCbN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_background_scan_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetBackgroundScanCbN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_background_scan_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetBackgroundScanCbP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_background_scan_cb(handle, scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, UnSetBackgroundScanCbN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_background_scan_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, UnSetBackgroundScanCbP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_background_scan_cb(handle));
+}
+
+TEST_F(UtcWifiManagerScan, SetScanStateChangedCbN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_scan_state_changed_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetScanStateChangedCbN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_scan_state_changed_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetScanStateChangedCbP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_scan_state_changed_cb(handle, scan_state_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, UnSetScanStateChangedCbP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_scan_state_changed_cb(handle));
+}
+
+TEST_F(UtcWifiManagerScan, UnSetScanStateChangedCbN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_scan_state_changed_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetAutoScanP1)
+{
+        mock_set_gdbus_error_msg(ERROR_NONE);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_autoscan(handle, true));
+}
+
+TEST_F(UtcWifiManagerScan, SetAutoScanN1)
+{
+       mock_set_gdbus_error_msg(ERROR_PERMISSION_DENIED);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_PERMISSION_DENIED, wifi_manager_set_autoscan(handle, true));
+}
+
+TEST_F(UtcWifiManagerScan, SetAutoScanN2)
+{
+       mock_set_gdbus_error_msg(ERROR_FAIL_DEVICE_BUSY);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_OPERATION_FAILED, wifi_manager_set_autoscan(handle, true));
+}
+
+TEST_F(UtcWifiManagerScan, SetBkgScanN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_background_scan_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetBkgScanN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_background_scan_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetBkgScanP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_background_scan_cb(handle, set_background_scan_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, UnsetBkgScanN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_background_scan_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, UnsetBkgScanP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_background_scan_cb(handle));
+}
+
+TEST_F(UtcWifiManagerScan, ScanStateChangeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_scan_state_changed_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ScanStateChangeN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_scan_state_changed_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, ScanStateChangeP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_scan_state_changed_cb(handle, scan_state_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, UnsetScanStateChangeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_unset_scan_state_changed_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, UnsetScanStateChangeP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_unset_scan_state_changed_cb(handle));
+}
+
+TEST_F(UtcWifiManagerScan, SetAutoScanModeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_autoscan_mode(nullptr, mode));
+}
+
+TEST_F(UtcWifiManagerScan, GetAutoScanN1)
+{
+        bool autoscan = TRUE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_autoscan(nullptr, &autoscan));
+}
+
+TEST_F(UtcWifiManagerScan, GetAutoScanN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_autoscan(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetAutoScanP1)
+{
+        bool autoscan = FALSE;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_autoscan(handle, &autoscan));
+}
+
+TEST_F(UtcWifiManagerScan, GetAutoScanModeN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_autoscan_mode(nullptr, &mode));
+}
+
+TEST_F(UtcWifiManagerScan, GetAutoScanModeN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_autoscan_mode(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, GetAutoScanModeP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_autoscan_mode(handle, &mode));
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_autoscan_mode(handle, mode));
+}
+
+TEST_F(UtcWifiManagerScan, BssidScanN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_bssid_scan(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, BssidScanN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_bssid_scan(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, BssidScanP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_bssid_scan(handle, bssid_scan_finished_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, FlushBssN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_flush_bss(nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, FlushBssP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_flush_bss(handle));
+}
+
+TEST_F(UtcWifiManagerScan, SetBssidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_bssid(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetBssidN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_set_bssid(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SetBssidP1)
+{
+        char bssid = 'a';
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_set_bssid(handle, &bssid));
+}
+
+
+TEST_F(UtcWifiManagerScan, NetlinkScanCreateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_netlink_scan_create(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanCreateP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_netlink_scan_create(handle, &netlink_scan));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanDestroyN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_netlink_scan_destroy(nullptr, netlink_scan));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanDestroyP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_netlink_scan_create(handle, &netlink_scan));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_netlink_scan_destroy(handle, netlink_scan));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanSetSsidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_netlink_scan_set_ssid(netlink_scan, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanSetSsidP1)
+{
+       const char essid = 'a';
+       wifi_manager_netlink_scan_create(handle, &netlink_scan);
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_netlink_scan_set_ssid(netlink_scan, &essid));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanSetVsieN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_netlink_scan_set_vsie(netlink_scan, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanSetVsieP1)
+{
+       const char* essid = "ddcdefghijklm";
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_netlink_scan_set_vsie(netlink_scan, essid));
+}
+
+TEST_F(UtcWifiManagerScan, NetlinkScanSetVsieN2)
+{
+        const char* essid = "abcdefghijklm";
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_netlink_scan_set_vsie(netlink_scan, essid));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanCreateN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_specific_scan_create(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanCreateP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_scan_create(handle, &specific_scan));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanDestroyN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_specific_scan_destroy(nullptr, specific_scan));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanDestroyP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_scan_create(handle, &specific_scan));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_scan_destroy(handle, specific_scan));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanGetMaxSsidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_specific_scan_get_max_ssids(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanGetMaxSsidN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_specific_scan_get_max_ssids(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanGetMaxSsidP1)
+{
+       int max_scan_ssids = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_scan_get_max_ssids(handle, &max_scan_ssids));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanSetSsidN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_specific_scan_set_ssid(specific_scan, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanSetSsidP1)
+{
+       const char essid = 'a';
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_scan_create(handle, &specific_scan));
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_scan_set_ssid(specific_scan, &essid));
+}
+
+TEST_F(UtcWifiManagerScan, SpecificScanSetFreqP1)
+{
+       int freq = 1;
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_scan_set_freq(specific_scan, freq));
+}
+
+TEST_F(UtcWifiManagerScan, StartMultiScanN1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_specific_ap_start_multi_scan(nullptr, specific_scan, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, StartMultiScanN2)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_specific_ap_start_multi_scan(handle, specific_scan, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerScan, StartMultiScanP1)
+{
+        EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_specific_ap_start_multi_scan(handle, specific_scan, scan_finished_cb, nullptr));
+}
diff --git a/tests/gtest-wifi-manager-tdls.cpp b/tests/gtest-wifi-manager-tdls.cpp
new file mode 100644 (file)
index 0000000..9beaa03
--- /dev/null
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerTdls : public ::testing::Test {
+protected:
+       wifi_manager_h handle;
+       WifiManagerTestUtil testUtil;
+
+       UtcWifiManagerTdls() : handle(nullptr)
+       {
+       }
+
+       void SetUp() override
+       {
+               mock_set_system_info_result(true);
+               mock_set_memory_result(true);
+               mock_set_gdbus_result(true);
+               mock_set_vconf_result(true);
+               mock_set_gdbus_tech_state("wlan0", true, false);
+               wifi_manager_initialize(&handle);
+       }
+
+       void TearDown() override
+       {
+               wifi_manager_deinitialize(handle);
+               mock_set_system_info_result(false);
+               mock_set_memory_result(false);
+               mock_set_gdbus_result(false);
+               mock_set_vconf_result(false);
+               mock_set_gdbus_tech_state("wlan0", false, false);
+               g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+       }
+};
+
+static void __tdls_discovered_cb(wifi_manager_tdls_discovery_state_e state,
+               char *peer_mac_addr, void *user_data)
+{
+}
+
+static void __tdls_state_changed_cb(wifi_manager_tdls_state_e state,
+               char *peer_mac_addr, void *user_data)
+{
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsSetDiscoveredN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_set_discovered_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsSetDiscoveredN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_set_discovered_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsSetDiscoveredP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_set_discovered_cb(handle, __tdls_discovered_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsUnsetDiscoveredN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_unset_discovered_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsUnsetDiscoveredP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE,wifi_manager_tdls_unset_discovered_cb(handle));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsStartDiscoveryN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_start_discovery(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsStartDiscoveryN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_start_discovery(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsStartDiscoveryP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_start_discovery(handle, "11:22:33:44:55:66"));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsConnectN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_connect(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsConnectN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_connect(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsConnectP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_connect(handle, "11:22:33:44:55:66"));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsDisconnectN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_disconnect(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsDisconnectN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_disconnect(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsDisconnectP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_disconnect(handle, "11:22:33:44:55:66"));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsGetConnectedPeerN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_get_connected_peer(nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsGetConnectedPeerN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_get_connected_peer(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsGetConnectedPeerP1)
+{
+       char *peer = NULL;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_get_connected_peer(handle, &peer));
+       free(peer);
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsSetStateChangedN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_set_state_changed_cb(nullptr, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsSetStateChangedN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_set_state_changed_cb(handle, nullptr, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsSetStateChangedP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_set_state_changed_cb(handle, __tdls_state_changed_cb, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsUnsetStateChangedN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_unset_state_changed_cb(nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsUnsetStateChangedP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_unset_state_changed_cb(handle));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsEnableChannelSwitchingN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_enable_channel_switching(nullptr, nullptr, 1));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsEnableChannelSwitchingN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_enable_channel_switching(handle, nullptr, 1));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsEnableChannelSwitchingP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_enable_channel_switching(handle, "11:22:33:44:55:66", 2412));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsDisableChannelSwitchingN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_disable_channel_switching(nullptr,nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsDisableChannelSwitchingN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_tdls_disable_channel_switching(handle, nullptr));
+}
+
+TEST_F(UtcWifiManagerTdls, TdlsDisableChannelSwitchingP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_tdls_disable_channel_switching(handle, "11:22:33:44:55:66"));
+}
diff --git a/tests/gtest-wifi-manager-util.cpp b/tests/gtest-wifi-manager-util.cpp
new file mode 100755 (executable)
index 0000000..bf358e7
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2021 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-wifi-manager-util.h"
+
+#include <glib.h>
+#include<stdio.h>
+#include <glib-object.h>
+extern "C" {
+#include "mocks/mock_gdbus.h"
+};
+
+WifiManagerTestUtil::WifiManagerTestUtil(void) : testType(WIFIMANAGER_TEST_UTIL_MAX), mainLoop(NULL), timeoutId(0)
+{
+}
+
+WifiManagerTestUtil::~WifiManagerTestUtil(void)
+{
+}
+
+void WifiManagerTestUtil::setTestType(int type)
+{
+       testType = type;
+}
+
+int WifiManagerTestUtil::getTestType(void)
+{
+       return testType;
+}
+
+void WifiManagerTestUtil::runMainLoop(void)
+{
+       mainLoop = g_main_loop_new(NULL, false);
+       timeoutId = g_timeout_add(10, WifiManagerTestUtil::timeoutCallback, this);
+       g_main_loop_run(mainLoop);
+}
+
+void WifiManagerTestUtil::stopMainLoop(void)
+{
+       if (mainLoop)
+               g_main_loop_quit(mainLoop);
+
+       if (timeoutId)
+               g_source_remove(timeoutId);
+}
+
+gboolean WifiManagerTestUtil::timeoutCallback(gpointer user_data)
+{
+       WifiManagerTestUtil *util = (WifiManagerTestUtil *)user_data;
+       //int type = util->getTestType();
+       mock_invoke_gdbus_async_callback();
+       util->stopMainLoop();
+
+    return FALSE;
+}
diff --git a/tests/gtest-wifi-manager-util.h b/tests/gtest-wifi-manager-util.h
new file mode 100644 (file)
index 0000000..def7449
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2021 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/gtest.h>
+#include <glib.h>
+#define WIFIMANAGER_TEST_UTIL_MAX 10
+
+class WifiManagerTestUtil
+{
+public:
+       WifiManagerTestUtil(void);
+       ~WifiManagerTestUtil();
+
+       void runMainLoop(void);
+       void setTestType(int type);
+       int getTestType(void);
+
+private:
+       int testType;
+       GMainLoop *mainLoop;
+       guint timeoutId;
+
+       void stopMainLoop(void);
+
+       static gboolean timeoutCallback(gpointer user_data);
+};
diff --git a/tests/gtest-wifi-manager-vsie.cpp b/tests/gtest-wifi-manager-vsie.cpp
new file mode 100644 (file)
index 0000000..5a9f400
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2021 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 <gtest/gtest.h>
+
+#include "gtest-wifi-manager-util.h"
+#include "wifi-manager.h"
+#include <wifi-manager-extension.h>
+extern "C" {
+#include "mocks/mock_system_info.h"
+#include "mocks/mock_memory.h"
+#include "mocks/mock_gdbus.h"
+#include "mocks/mock_vconf.h"
+}
+
+static int g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+
+class UtcWifiManagerVsie : public ::testing::Test {
+protected:
+       wifi_manager_h handle;
+       WifiManagerTestUtil testUtil;
+
+       UtcWifiManagerVsie() : handle(nullptr)
+       {
+       }
+
+       void SetUp() override
+       {
+               mock_set_system_info_result(true);
+               mock_set_memory_result(true);
+               mock_set_gdbus_result(true);
+               mock_set_vconf_result(true);
+               wifi_manager_initialize(&handle);
+               mock_set_gdbus_tech_state("wlan0", true, false);
+       }
+
+       void TearDown() override
+       {
+               wifi_manager_deinitialize(handle);
+               mock_set_system_info_result(false);
+               mock_set_memory_result(false);
+               mock_set_gdbus_result(false);
+               mock_set_vconf_result(false);
+               mock_set_gdbus_tech_state("wlan0", false, false);
+               g_nCallbackRet = WIFI_MANAGER_ERROR_NONE;
+       }
+};
+
+TEST_F(UtcWifiManagerVsie, AddVsieN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_add_vsie(nullptr, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, nullptr));
+}
+
+TEST_F(UtcWifiManagerVsie, AddVsieN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_add_vsie(handle, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, nullptr));
+}
+
+
+TEST_F(UtcWifiManagerVsie, AddVsieP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_add_vsie(handle, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, "dummy_vsie"));
+}
+
+
+TEST_F(UtcWifiManagerVsie, GetVsieN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_vsie(nullptr, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, nullptr));
+}
+
+TEST_F(UtcWifiManagerVsie, GetVsieN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_get_vsie(handle, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, nullptr));
+}
+
+
+TEST_F(UtcWifiManagerVsie, GetVsieP1)
+{
+       char *vsie_str = NULL;
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_get_vsie(handle, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, &vsie_str));
+       free(vsie_str);
+}
+
+
+TEST_F(UtcWifiManagerVsie, RemoveVsieN1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_remove_vsie(nullptr, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, nullptr));
+}
+
+TEST_F(UtcWifiManagerVsie, RemoveVsieN2)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_INVALID_PARAMETER, wifi_manager_remove_vsie(handle, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, nullptr));
+}
+
+
+TEST_F(UtcWifiManagerVsie, RemoveVsieP1)
+{
+       EXPECT_EQ(WIFI_MANAGER_ERROR_NONE, wifi_manager_remove_vsie(handle, WIFI_MANAGER_VSIE_FRAME_PROBE_REQ, "dummy_vsie"));
+}
diff --git a/tests/gtest-wifi-manager.cpp b/tests/gtest-wifi-manager.cpp
new file mode 100755 (executable)
index 0000000..4f45cb4
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2021 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/gtest.h>
+
+int main(int argc, char **argv)
+{
+       ::testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/tests/mocks/mock_gdbus.c b/tests/mocks/mock_gdbus.c
new file mode 100644 (file)
index 0000000..629b327
--- /dev/null
@@ -0,0 +1,493 @@
+/*
+ * Copyright (c) 2021 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.
+ */
+
+/**
+ * TODO: Add logic to methodcall and it's mock reply.
+ * TODO: Add logic to emit mock signals.
+ */
+
+#include<stdio.h>
+#include "mock_gdbus.h"
+
+#include <stdbool.h>
+#include <gio/gio.h>
+
+static bool mock_gdbus_result;
+static bool mock_gdbus_devicePolicy;
+static bool mock_gdbus_powered;
+#define MOCK_TECH_COUNT_MAX 2
+#define MOCK_SERVICES_COUNT_MAX 2
+#define ERROR_DOMAIN   5
+#define ERROR_CODE     10
+
+typedef struct {
+       GAsyncReadyCallback callback;
+       gpointer user_data;
+       const char *method_name;
+} gdbus_async_callback_info_s;
+
+#if 0
+typedef struct {
+       GDBusSignalCallback callback;
+       gpointer user_data;
+} gdbus_signal_callback_info_s;
+
+
+static const char *gdbus_signal_list[WIFI_MOCK_GDBUS_SIGNAL_MAX] = {
+       [WIFI_MOCK_GDBUS_SIGNAL_STATE_CHANGED_PROPERTIES] = "StateChangedPropertie",
+       [WIFI_MOCK_GDBUS_SIGNAL_PROPERTY_CHANGED] = "PropertyChanged",
+       [WIFI_MOCK_GDBUS_SIGNAL_SCAN_CHANGED] = "ScanChanged",
+       [WIFI_MOCK_GDBUS_SIGNAL_SCAN_DONE] = "ScanDone",
+};
+
+static gdbus_signal_callback_info_s gdbus_signal_callbacks[WIFI_MOCK_GDBUS_SIGNAL_MAX] = {
+        {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL} }; // {NULL, NULL},
+ //       {NULL, NULL}, {NULL, NULL}, {NULL, NULL}, {NULL, NULL} };
+
+#endif
+static gdbus_async_callback_info_s gdbus_async_callback = {NULL, NULL};
+
+typedef struct {
+       const char *ifname;
+       const char *mac_address;
+       gboolean powered;
+       gboolean connected;
+} mock_gdbus_tech_s;
+
+typedef struct {
+       const char *EncryptionMode;
+       const char *State;
+       const char *Name;
+       const char *Interface;
+       const char *BssId;
+} mock_gdbus_services_s;
+
+char *err_msg[ERROR_MAX] = {"", "PermissionDenied", "AccessDenied", "AlreadyExists", "InProgress", "Device or resource busy", "NULL" };
+static int err_no;
+
+mock_gdbus_tech_s mock_tech[MOCK_TECH_COUNT_MAX] = {
+       {"wlan0", "11:22:33:44:55:66", 0, 0},
+       {"wlan1", "66:55:44:33:22:11", 0, 0}
+};
+
+mock_gdbus_services_s mock_services[MOCK_SERVICES_COUNT_MAX] = {
+       {"wep", "ready", "TEMP_AP1", "wlan0", "11:22:33:44:55:66"},
+       {"aes", "ready", "TEMP_AP2", "wlan0", "11:22:33:44:55:66"}
+};
+
+void mock_set_gdbus_tech_state(const char *ifname, bool powered, bool connected)
+{
+       for (int i = 0; i < MOCK_TECH_COUNT_MAX; i++) {
+               if (g_strcmp0(mock_tech[i].ifname, ifname) != 0)
+                       continue;
+
+               mock_tech[i].powered = powered;
+               mock_tech[i].connected = connected;
+               break;
+       }
+}
+
+void mock_set_gdbus_error_msg(int error)
+{
+       err_no = error;
+}
+
+static GVariant * __get_mock_variant_get_technologies(void)
+{
+       GVariant *return_parameter;
+       GVariantBuilder *builder_technologies = g_variant_builder_new(G_VARIANT_TYPE("a(oa{sv})"));;
+       GVariantBuilder *builder_technology = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+       GVariantBuilder *deviceList = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+       const gchar *object_path = "/net/connman/technology/wifi";
+
+       // TODO: fill technology data
+       g_variant_builder_add(builder_technology, "{sv}", "Name", g_variant_new_string("WiFi"));
+       g_variant_builder_add(builder_technology, "{sv}", "Type", g_variant_new_string("wifi"));
+       g_variant_builder_add(builder_technology, "{sv}", "Tethering", g_variant_new_boolean(FALSE));
+       g_variant_builder_add(builder_technology, "{sv}", "Powered", g_variant_new_boolean(TRUE));
+       g_variant_builder_add(builder_technology, "{sv}", "Connected", g_variant_new_boolean(FALSE));
+
+       for (int i = 0; i < MOCK_TECH_COUNT_MAX; i++) {
+
+               g_variant_builder_add(deviceList, "{sv}", "Ifname", g_variant_new_string(mock_tech[i].ifname));
+               g_variant_builder_add(deviceList, "{sv}", "Powered", g_variant_new_boolean(mock_tech[i].powered));
+               g_variant_builder_add(deviceList, "{sv}", "Connected", g_variant_new_boolean(mock_tech[i].connected));
+               g_variant_builder_add(deviceList, "{sv}", "MAC.Address", g_variant_new_string(mock_tech[i].mac_address));
+       }
+
+       g_variant_builder_add(builder_technology, "{sv}", "Device.List", g_variant_builder_end(deviceList));
+
+       g_variant_builder_add(builder_technologies, "(oa{sv})", object_path, builder_technology);
+
+       return_parameter = g_variant_new("(a(oa{sv}))", builder_technologies);
+
+
+       g_variant_builder_unref(deviceList);
+       g_variant_builder_unref(builder_technology);
+       g_variant_builder_unref(builder_technologies);
+
+       return return_parameter;
+}
+
+static GVariant * __get_mock_variant_get_DevicePolicyGetWifi(void)
+{
+       GVariant *value;
+       if (mock_gdbus_devicePolicy)
+               value = g_variant_new("(i)", 0);
+       else
+               value = g_variant_new("(i)", 1);
+
+       return value;
+}
+
+static GVariant * __get_mock_variant_int(void)
+{
+       return g_variant_new("(i)", 0);
+}
+
+static GVariant * __get_mock_variant_uint(void)
+{
+       return g_variant_new("(u)", 1);
+}
+
+static GVariant * __get_mock_variant_bool(void)
+{
+       return g_variant_new("(b)", TRUE);
+}
+
+static GVariant * __get_mock_variant_get_scanstate(void)
+{
+       GVariant *value;
+       GVariantBuilder *scanstate = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+       //g_variant_builder_add(scanstate, "{sv}", g_variant_new_string(mock_tech[0].ifname), g_variant_new_boolean(FALSE));
+       g_variant_builder_add(scanstate, "{sv}", "wlan0", g_variant_new_boolean(FALSE));
+       value = g_variant_new("(a{sv})", scanstate);
+       return value;
+}
+
+static GVariant * __get_mock_variant_get_services(void)
+{
+       GVariant *return_parameter;
+       GVariantBuilder *builder_services = g_variant_builder_new(G_VARIANT_TYPE("a(oa{sv})"));;
+       int i = 0;
+       for (i = 0; i < MOCK_SERVICES_COUNT_MAX; i++) {
+               GVariantBuilder *builder_service = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+               GVariantBuilder *builder_eth = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+               const gchar *object_path = "/net/connman/service/wifi_112233445566_496e6672612d36412d33_managed_psk";
+
+               // TODO: fill service data
+               g_variant_builder_add(builder_service, "{sv}", "EncryptionMode", g_variant_new_string(mock_services[i].EncryptionMode));
+               g_variant_builder_add(builder_service, "{sv}", "BSSID", g_variant_new_string(mock_services[i].BssId));
+               g_variant_builder_add(builder_service, "{sv}", "State", g_variant_new_string(mock_services[i].State));
+               g_variant_builder_add(builder_service, "{sv}", "Name", g_variant_new_string(mock_services[i].Name));
+
+               g_variant_builder_add(builder_eth, "{sv}", "Interface", g_variant_new_string(mock_services[i].Interface));
+
+               g_variant_builder_add(builder_service, "{sv}", "Ethernet", g_variant_builder_end(builder_eth));
+               g_variant_builder_add(builder_services, "(oa{sv})", object_path, builder_service);
+               g_variant_builder_unref(builder_service);
+               g_variant_builder_unref(builder_eth);
+       }
+       return_parameter = g_variant_new("(a(oa{sv}))", builder_services);
+
+       //g_variant_builder_unref(builder_service);
+       g_variant_builder_unref(builder_services);
+
+       return return_parameter;
+}
+
+static GVariant * __get_mock_variant_get_properties(void)
+{
+       return NULL;
+}
+
+static GVariant * __get_mock_variant_get_interfaces(void)
+{
+       const gchar *interface_name = "wlan0";
+       GVariantBuilder *builder_interfaces = g_variant_builder_new(G_VARIANT_TYPE("as"));
+
+       g_variant_builder_add(builder_interfaces, "s", interface_name);
+
+       return g_variant_new("(as)", builder_interfaces);
+}
+
+static GVariant * __get_mock_variant_string(void)
+{
+       return g_variant_new("(s)", "dummy");
+}
+
+void mock_set_gdbus_result(bool value)
+{
+       mock_gdbus_result = value;
+}
+
+void mock_set_gdbus_devicePolicy(bool value)
+{
+       mock_gdbus_devicePolicy = value;
+}
+
+void mock_set_gdbus_powered(bool value)
+{
+       mock_gdbus_powered = value;
+}
+
+GCancellable *__wrap_g_cancellable_new(void)
+{
+       if (mock_gdbus_result == false)
+               return NULL;
+
+       return (GCancellable *)g_object_new(G_TYPE_CANCELLABLE, NULL);
+}
+
+GDBusConnection *__wrap_g_bus_get_sync(GBusType bus_type, GCancellable *cancellable, GError **error)
+{
+       if (mock_gdbus_result == false)
+               return NULL;
+
+       return (GDBusConnection *)g_object_new(G_TYPE_DBUS_CONNECTION, NULL);
+}
+
+typedef GVariant * (*g_dbus_reply_fn)(void);
+
+typedef struct {
+       const char *method_name;
+       g_dbus_reply_fn fn;
+} method_call_reply_s;
+
+method_call_reply_s g_dbus_reply[] = {
+       {"GetTechnologies",         __get_mock_variant_get_technologies},
+       {"GetServices",             __get_mock_variant_get_services},
+       {"GetProperties",           __get_mock_variant_get_properties},
+       {"GetInterfaces",           __get_mock_variant_get_interfaces},
+       {"DevicePolicyGetWifi",     __get_mock_variant_get_DevicePolicyGetWifi},
+       {"GetScanState",            __get_mock_variant_get_scanstate},
+       {"IpConflictSetEnable",     __get_mock_variant_int},
+       {"SetIpConflictPeriod",     __get_mock_variant_int},
+       {"GetIpConflictPeriod",     __get_mock_variant_uint},
+       {"GetIpConflictState",      __get_mock_variant_uint},
+       {"SetProperty",             __get_mock_variant_int},
+       {"GetAutoscan",             __get_mock_variant_bool},
+       {"GetAutoscanmode",         __get_mock_variant_uint},
+       {"FlushBss",                __get_mock_variant_int},
+       {"CheckGetPrivilege",       __get_mock_variant_int},
+       {"GetMaxScanSsid",          __get_mock_variant_get_scanstate},
+       {"Get5GhzSupported",        __get_mock_variant_get_scanstate},
+       {"ResumeBgscan",            __get_mock_variant_string},
+       {"PauseBgscan",             __get_mock_variant_string},
+       {"AddVsie",                 __get_mock_variant_string},
+       {"GetVsie",                 __get_mock_variant_string},
+       {"RemoveVsie",              __get_mock_variant_string},
+       {"TdlsDiscover",            __get_mock_variant_int},
+       {"TdlsConnect",             __get_mock_variant_int},
+       {"TdlsDisconnect",          __get_mock_variant_int},
+       {"TdlsConnectedPeer",       __get_mock_variant_string},
+       {"SetBgscan",               __get_mock_variant_int},
+       {"SaveConfiguration",       __get_mock_variant_int},
+       {"SaveEapConfiguration",    __get_mock_variant_int},
+       {"TdlsChannelSwitch",       __get_mock_variant_int},
+       {"TdlsCancelChannelSwitch", __get_mock_variant_int},
+       {"LoadConfiguration",       __get_mock_variant_get_scanstate},
+       {"GetConfigIds",            __get_mock_variant_get_interfaces},
+       {NULL, NULL}
+};
+
+GVariant *__wrap_g_dbus_connection_call_sync(GDBusConnection *connection,
+                                            const gchar *bus_name,
+                                            const gchar *object_path,
+                                            const gchar *interface_name,
+                                            const gchar *method_name,
+                                            GVariant *parameters,
+                                            const GVariantType *reply_type,
+                                            GDBusCallFlags flags,
+                                            gint timeout_msec,
+                                            GCancellable *cancellable,
+                                            GError **error)
+{
+       if (mock_gdbus_result == false)
+               return NULL;
+
+       if (err_no) {
+               g_set_error(error, ERROR_DOMAIN, ERROR_CODE, "error message  %s", err_msg[err_no]);
+               err_no = ERROR_NONE;
+               return NULL;
+       }
+
+       for (int i = 0; g_dbus_reply[i].method_name; i++)
+               if (!g_strcmp0(g_dbus_reply[i].method_name, method_name))
+                       return g_dbus_reply[i].fn();
+
+       return NULL;
+}
+
+void __wrap_g_dbus_connection_call(GDBusConnection *connection,
+                                  const gchar *bus_name,
+                                  const gchar *object_path,
+                                  const gchar *interface_name,
+                                  const gchar *method_name,
+                                  GVariant *parameters,
+                                  const GVariantType *reply_type,
+                                  GDBusCallFlags flags,
+                                  gint timeout_msec,
+                                  GCancellable *cancellable,
+                                  GAsyncReadyCallback callback,
+                                  gpointer user_data)
+{
+       if (mock_gdbus_result == false)
+               return;
+
+       gdbus_async_callback.callback = callback;
+       gdbus_async_callback.user_data = user_data;
+       gdbus_async_callback.method_name = method_name;
+
+       return;
+}
+
+GVariant * __wrap_g_dbus_connection_call_finish(GDBusConnection *connection,
+                                               GAsyncResult *res,
+                                               GError **error)
+{
+       GVariant *params = NULL;
+       const char *method_name = gdbus_async_callback.method_name;
+       if (mock_gdbus_result == false)
+               return NULL;
+       if ((strcmp(method_name, "LoadDriver") == 0) || (strcmp(method_name, "RemoveDriver") == 0)) {
+               if (!g_strcmp0("", err_msg[err_no]))
+                       error = NULL;
+               else
+                       g_set_error(error, ERROR_DOMAIN, ERROR_CODE, "error message  %s", err_msg[err_no]);
+               params = g_variant_new("(u)", 0);
+       } else if (strcmp(method_name, "ScanDevice") == 0) {
+               g_set_error(error, ERROR_DOMAIN, ERROR_CODE, "error message  %s", err_msg[err_no]);
+               params = g_variant_new("(u)", 0);
+       } else if (strcmp(method_name, "SpecificScan") == 0) {
+               g_set_error(error, ERROR_DOMAIN, ERROR_CODE, "error message  %s", err_msg[err_no]);
+               params = g_variant_new("(u)", 0);
+       }
+
+       gdbus_async_callback.callback = NULL;
+       gdbus_async_callback.user_data = NULL;
+       gdbus_async_callback.method_name = NULL;
+       err_no = ERROR_NONE;
+
+       return params;
+}
+
+void mock_invoke_gdbus_async_callback(void)
+{
+       if (!gdbus_async_callback.callback)
+               return;
+       gdbus_async_callback.callback(NULL, NULL, gdbus_async_callback.user_data);
+}
+
+#if 0
+void mock_emit_gdbus_signal(int signo)
+{
+        if (signo < WIFI_MOCK_GDBUS_SIGNAL_STATE_CHANGED_PROPERTIES|| signo >= WIFI_MOCK_GDBUS_SIGNAL_MAX)
+                return;
+
+        if (!gdbus_signal_callbacks[signo].callback)
+                return;
+
+       GVariant *params = NULL;
+       return;
+        switch (signo) {
+        case TETHERING_MOCK_GDBUS_SIGNAL_NET_CLOSED:
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_WIFI_TETHER_ON:
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_WIFI_TETHER_OFF:
+                params = g_variant_new("(s)", "There is no connection for a while");
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_USB_TETHER_ON:
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_USB_TETHER_OFF:
+                params = g_variant_new("(s)", "Interface is not available");
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_BT_TETHER_ON:
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_BT_TETHER_OFF:
+                params = g_variant_new("(s)", "There is no connection for a while");
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_NO_DATA_TIMEOUT:
+        case TETHERING_MOCK_GDBUS_SIGNAL_LOW_BATTERY_MODE:
+        case TETHERING_MOCK_GDBUS_SIGNAL_FLIGHT_MODE:
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_SECURITY_TYPE_CHANGED:
+                params = g_variant_new("(s)", "wpa2-psk");
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_SSID_VISIBILITY_CHANGED:
+                params = g_variant_new("(s)", "ssid_visible");
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_PASSPHRASE_CHANGED:
+                break;
+        case TETHERING_MOCK_GDBUS_SIGNAL_DHCP_STATUS:
+                params = g_variant_new("(susssu)", "DhcpConnected", 1,
+                                "192.168.43.24", "ab:cd:ef:ab:cd:ef",
+                                "client", 1592460260);
+                break;
+        default:
+                break;
+        }
+       gdbus_signal_callbacks[signo].callback(NULL, NULL,
+                        NULL, NULL, gdbus_signal_list[signo],
+                        params, gdbus_signal_callbacks[signo].user_data);
+}
+#endif
+
+guint __wrap_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)
+{
+       if (mock_gdbus_result == false)
+               return 0;
+
+       return 1;
+#if 0
+       if(!member)
+               return 0;
+        for (int i = WIFI_MOCK_GDBUS_SIGNAL_STATE_CHANGED_PROPERTIES; i < WIFI_MOCK_GDBUS_SIGNAL_MAX; i++) {
+                if (strcmp(gdbus_signal_list[i], member) == 0) {
+                        gdbus_signal_callbacks[i].callback = callback;
+                        gdbus_signal_callbacks[i].user_data = user_data;
+                        return i;
+                }
+        }
+        return 0;
+#endif
+}
+
+void __wrap_g_dbus_connection_signal_unsubscribe(GDBusConnection *connection,
+                guint subscription_id)
+{
+       if (mock_gdbus_result == false)
+               return;
+#if 0
+        if (subscription_id >= WIFI_MOCK_GDBUS_SIGNAL_STATE_CHANGED_PROPERTIES
+                        && subscription_id < WIFI_MOCK_GDBUS_SIGNAL_MAX) {
+                gdbus_signal_callbacks[subscription_id].callback = NULL;
+                gdbus_signal_callbacks[subscription_id].user_data = NULL;
+        }
+
+        return;
+#endif
+}
diff --git a/tests/mocks/mock_gdbus.h b/tests/mocks/mock_gdbus.h
new file mode 100644 (file)
index 0000000..5b3215f
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2021 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.
+*/
+
+#pragma once
+
+#include <stdbool.h>
+
+enum {
+       ERROR_NONE = 0,
+       ERROR_SECURITY_RESTRICTED,
+       ERROR_PERMISSION_DENIED,
+       ERROR_ALREADY_EXISTS,
+       ERROR_NOW_IN_PROGRESS,
+       ERROR_FAIL_DEVICE_BUSY,
+       ERROR_NULL,
+       ERROR_MAX
+};
+
+enum {
+       WIFI_MOCK_GDBUS_SIGNAL_STATE_CHANGED_PROPERTIES = 0 ,
+       WIFI_MOCK_GDBUS_SIGNAL_PROPERTY_CHANGED,
+       WIFI_MOCK_GDBUS_SIGNAL_SCAN_CHANGED,
+       WIFI_MOCK_GDBUS_SIGNAL_SCAN_DONE,
+       WIFI_MOCK_GDBUS_SIGNAL_MAX
+};
+
+void mock_set_gdbus_result(bool value);
+void mock_set_gdbus_devicePolicy(bool value);
+void mock_set_gdbus_powered(bool value);
+void mock_set_gdbus_tech_state(const char *ifname, bool powered, bool connected);
+void mock_invoke_gdbus_async_callback(void);
+void mock_set_gdbus_error_msg(int error);
diff --git a/tests/mocks/mock_memory.c b/tests/mocks/mock_memory.c
new file mode 100644 (file)
index 0000000..e17e284
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2021 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 "mock_memory.h"
+
+#include <glib.h>
+#include <stdbool.h>
+
+static bool mock_memory_result;
+
+extern gpointer __real_g_try_malloc0(gsize n_bytes);
+
+void mock_set_memory_result(bool result)
+{
+       mock_memory_result = result;
+}
+
+void *__wrap_g_try_malloc0(size_t size)
+{
+       if (mock_memory_result == false)
+               return NULL;
+
+       return __real_g_try_malloc0(size);
+}
diff --git a/tests/mocks/mock_memory.h b/tests/mocks/mock_memory.h
new file mode 100644 (file)
index 0000000..d9ece49
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2021 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.
+ */
+
+#pragma once
+
+#include <stdbool.h>
+
+void mock_set_memory_result(bool result);
diff --git a/tests/mocks/mock_system_info.c b/tests/mocks/mock_system_info.c
new file mode 100644 (file)
index 0000000..ff4acb6
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2021 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 "mock_system_info.h"
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <system_info.h>
+
+static bool mock_sysinfo_result = false;
+
+void mock_set_system_info_result(bool value)
+{
+       mock_sysinfo_result = value;
+}
+
+int __wrap_system_info_get_platform_bool(const char *key, bool *value)
+{
+       if (mock_sysinfo_result == false)
+               return -1;
+
+       *value = mock_sysinfo_result;
+       return SYSTEM_INFO_ERROR_NONE;
+}
diff --git a/tests/mocks/mock_system_info.h b/tests/mocks/mock_system_info.h
new file mode 100644 (file)
index 0000000..d1aee99
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2021 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.
+*/
+
+#pragma once
+
+#include <stdbool.h>
+
+void mock_set_system_info_result(bool value);
diff --git a/tests/mocks/mock_vconf.c b/tests/mocks/mock_vconf.c
new file mode 100644 (file)
index 0000000..a1b010c
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2021 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 "mock_vconf.h"
+
+#include <vconf.h>
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+
+static bool mock_vconf_result;
+static int mock_hotspot_mode = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
+static bool mock_flight_mode = 0;
+
+void mock_set_vconf_result(bool result)
+{
+       mock_vconf_result = result;
+}
+
+void mock_set_vonf_hospot_mode(int hotspot_mode)
+{
+       mock_hotspot_mode = hotspot_mode;
+}
+
+void mock_set_vonf_flight_mode(int flight_mode)
+{
+       mock_flight_mode = flight_mode;
+}
+
+int __wrap_vconf_get_int(const char *key, int *intval)
+{
+       if (!mock_vconf_result)
+               return -1;
+
+       if (!strcmp(VCONFKEY_MOBILE_HOTSPOT_MODE, key))
+               *intval = mock_hotspot_mode;
+       else
+               *intval = 0;
+
+       return 0;
+}
+
+int __wrap_vconf_get_bool(const char *key, bool *boolval)
+{
+       if (!mock_vconf_result)
+               return -1;
+
+       if (!strcmp(VCONFKEY_TELEPHONY_FLIGHT_MODE, key))
+               *boolval = mock_flight_mode;
+       else
+               *boolval = false;
+
+       return 0;
+}
+
+char *__wrap_vconf_get_str(const char *key)
+{
+       if (!mock_vconf_result)
+               return NULL;
+       if (!strcmp(VCONFKEY_WIFI_BSSID_ADDRESS, key))
+               return strdup("11:22:33:44:55:66");
+
+       return NULL;
+}
diff --git a/tests/mocks/mock_vconf.h b/tests/mocks/mock_vconf.h
new file mode 100644 (file)
index 0000000..d74b04c
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2021 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.
+*/
+
+#pragma once
+
+#include <stdbool.h>
+
+void mock_set_vconf_result(bool result);
+void mock_set_vonf_hospot_mode(int hotspot_mode);
+void mock_set_vonf_flight_mode(int flight_mode);
index b2b79d1..a2f3169 100755 (executable)
@@ -47,5 +47,13 @@ SET(wifi_connect_tool_src
 ADD_EXECUTABLE(wifi_connect_tool ${wifi_connect_tool_src})
 TARGET_LINK_LIBRARIES(wifi_connect_tool ${fw_name})
 
+SET(wifi_manager_test_src
+       wifi_manager_test.c
+)
+
+ADD_EXECUTABLE(wifi_manager_test ${wifi_manager_test_src})
+TARGET_LINK_LIBRARIES(wifi_manager_test ${fw_name})
+
 INSTALL(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${BIN_DIR})
 INSTALL(TARGETS wifi_connect_tool RUNTIME DESTINATION ${BIN_DIR})
+INSTALL(TARGETS wifi_manager_test RUNTIME DESTINATION ${BIN_DIR})