diff options
author | Ilho Kim <ilho159.kim@samsung.com> | 2024-04-04 11:18:28 +0900 |
---|---|---|
committer | Ilho Kim <ilho159.kim@samsung.com> | 2024-04-04 11:23:34 +0900 |
commit | fff61bc1f7b056823d3dfb0714489d693a69adb8 (patch) | |
tree | 19ce7ce6841cd56d25fc23fe720159d110b35edc | |
parent | b54894f6cb4b17b007d957923961677394fc4656 (diff) | |
download | slp-pkgmgr-fff61bc1f7b056823d3dfb0714489d693a69adb8.tar.gz slp-pkgmgr-fff61bc1f7b056823d3dfb0714489d693a69adb8.tar.bz2 slp-pkgmgr-fff61bc1f7b056823d3dfb0714489d693a69adb8.zip |
Revert "Remove app event dependency"
This reverts following commits
- 441d34a89b31dd19ab12688a4f802928c8e7f789
- 0edaf0178d64a07fd2448627e02f9ea400c432d4
Change-Id: I071e17ba25493066e37d38da5e9c07563fac4642
Signed-off-by: Ilho Kim <ilho159.kim@samsung.com>
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | client/CMakeLists.txt | 1 | ||||
-rw-r--r-- | installer/CMakeLists.txt | 1 | ||||
-rw-r--r-- | installer/pkgmgr-installer.pc.in | 2 | ||||
-rw-r--r-- | packaging/pkgmgr.spec | 1 | ||||
-rw-r--r-- | test/unit_tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/unit_tests/mock/app_event_mock.cc | 37 | ||||
-rw-r--r-- | test/unit_tests/mock/app_event_mock.hh | 36 | ||||
-rw-r--r-- | test/unit_tests/test_client.cc | 4 |
9 files changed, 82 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 51d0da6..2cbea2f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock) PKG_CHECK_MODULES(GLIB_DEPS REQUIRED glib-2.0) PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0) PKG_CHECK_MODULES(RPC_PORT_DEPS REQUIRED rpc-port) +PKG_CHECK_MODULES(CAPI_APPFW_EVENT_DEPS REQUIRED capi-appfw-event) PKG_CHECK_MODULES(PKGMGR_PARSER_DEPS REQUIRED pkgmgr-parser) PKG_CHECK_MODULES(PKGMGR_INFO_DEPS REQUIRED pkgmgr-info) PKG_CHECK_MODULES(INIPARSER_DEPS REQUIRED iniparser) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e97eb4f..fe06c79 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -21,6 +21,7 @@ APPLY_PKG_CONFIG(${PKGMGR_CLIENT} PUBLIC PLATFORM_CONFIG_DEPS MINIZIP_DEPS RPC_PORT_DEPS + CAPI_APPFW_EVENT_DEPS ) TARGET_LINK_LIBRARIES(${PKGMGR_CLIENT} PUBLIC "dl") diff --git a/installer/CMakeLists.txt b/installer/CMakeLists.txt index 0395123..d117ebd 100644 --- a/installer/CMakeLists.txt +++ b/installer/CMakeLists.txt @@ -9,6 +9,7 @@ PKG_CHECK_MODULES(INSTALLER_DEPS REQUIRED pkgmgr-info libtzplatform-config rpc-port + capi-appfw-event ) FOREACH(FLAGS ${INSTALLER_DEPS_CFLAGS}) diff --git a/installer/pkgmgr-installer.pc.in b/installer/pkgmgr-installer.pc.in index f812a3b..fe02345 100644 --- a/installer/pkgmgr-installer.pc.in +++ b/installer/pkgmgr-installer.pc.in @@ -11,6 +11,6 @@ includedir=@INCLUDEDIR@ Name: package manager installer library Description: SLP package manager's installer lib for each backends Version: @FULLVER@ -Requires: +Requires: capi-appfw-event Libs: -L${libdir} -lpkgmgr_installer Cflags: -I${includedir}/pkgmgr diff --git a/packaging/pkgmgr.spec b/packaging/pkgmgr.spec index 73ad4f1..b5c2321 100644 --- a/packaging/pkgmgr.spec +++ b/packaging/pkgmgr.spec @@ -33,6 +33,7 @@ BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(libsystemd) BuildRequires: pkgconfig(minizip) BuildRequires: pkgconfig(rpc-port) +BuildRequires: pkgconfig(capi-appfw-event) BuildRequires: pkgconfig(gmock) BuildRequires: pkgmgr-info-parser-devel BuildRequires: pkgmgr-info-parser diff --git a/test/unit_tests/CMakeLists.txt b/test/unit_tests/CMakeLists.txt index 967dec9..d328392 100644 --- a/test/unit_tests/CMakeLists.txt +++ b/test/unit_tests/CMakeLists.txt @@ -18,6 +18,7 @@ APPLY_PKG_CONFIG(${TARGET_PKGMGR_UNIT_TEST} PUBLIC GMOCK_DEPS GLIB_DEPS RPC_PORT_DEPS + CAPI_APPFW_EVENT_DEPS DLOG_DEPS BUNDLE_DEPS ) diff --git a/test/unit_tests/mock/app_event_mock.cc b/test/unit_tests/mock/app_event_mock.cc new file mode 100644 index 0000000..165caa3 --- /dev/null +++ b/test/unit_tests/mock/app_event_mock.cc @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * + * 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/app_event_mock.hh" +#include "mock/mock_hook.hh" +#include "mock/test_fixture.hh" + +extern "C" int event_add_event_handler(const char *event_name, + event_cb callback, void *user_data, event_handler_h *event_handler) { + return MOCK_HOOK_P4(AppEventMock, event_add_event_handler, + event_name, callback, user_data, event_handler); +} + +extern "C" int event_remove_event_handler(event_handler_h event_handler) { + return MOCK_HOOK_P1(AppEventMock, event_remove_event_handler, + event_handler); +} + +extern "C" int event_publish_app_event(const char *event_name, + bundle *event_data) { + return MOCK_HOOK_P2(AppEventMock, event_publish_app_event, + event_name, event_data); +} diff --git a/test/unit_tests/mock/app_event_mock.hh b/test/unit_tests/mock/app_event_mock.hh new file mode 100644 index 0000000..fe6af4b --- /dev/null +++ b/test/unit_tests/mock/app_event_mock.hh @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UNIT_TESTS_MOCK_APP_EVENT_MOCK_HH_ +#define UNIT_TESTS_MOCK_APP_EVENT_MOCK_HH_ + +#include <app_event.h> +#include <gmock/gmock.h> + +#include "mock/module_mock.hh" + +class AppEventMock : public virtual ModuleMock { + public: + AppEventMock() {} + virtual ~AppEventMock() {} + + MOCK_METHOD(int, event_add_event_handler, (const char*, + event_cb, void*, event_handler_h*)); + MOCK_METHOD(int, event_remove_event_handler, (event_handler_h)); + MOCK_METHOD(int, event_publish_app_event, (const char*, bundle*)); +}; + +#endif // UNIT_TESTS_MOCK_APP_EVENT_MOCK_HH_ diff --git a/test/unit_tests/test_client.cc b/test/unit_tests/test_client.cc index b8c44ee..c5fb6e7 100644 --- a/test/unit_tests/test_client.cc +++ b/test/unit_tests/test_client.cc @@ -4,13 +4,15 @@ #include <gmock/gmock.h> #include "unit_tests/mock/rpc_port_mock.hh" +#include "unit_tests/mock/app_event_mock.hh" #include "unit_tests/mock/test_fixture.hh" using ::testing::_; using ::testing::Invoke; namespace { -class Mocks : public ::testing::NiceMock<RpcPortMock> {}; +class Mocks : public ::testing::NiceMock<RpcPortMock>, + virtual public ::testing::NiceMock<AppEventMock> {}; } // namespace |