Add notification unittest refsf/for/tizen
authorSukhyungKang <shine.kang@samsung.com>
Tue, 22 Aug 2023 01:51:31 +0000 (10:51 +0900)
committerSukhyungKang <shine.kang@samsung.com>
Wed, 6 Sep 2023 00:45:07 +0000 (09:45 +0900)
Change-Id: I045b5f72d2d20f024b35cc1e3d51bff5fa7008d8
Signed-off-by: SukhyungKang <shine.kang@samsung.com>
66 files changed:
CMakeLists.txt
packaging/notification.spec
tests/CMakeLists.txt
tests/mock/app_common_mock.cc
tests/mock/app_common_mock.h [deleted file]
tests/mock/app_common_mock.hh [new file with mode: 0644]
tests/mock/aul_mock.cc [new file with mode: 0644]
tests/mock/aul_mock.hh [new file with mode: 0644]
tests/mock/glib_mock.cc
tests/mock/glib_mock.h [deleted file]
tests/mock/glib_mock.hh [new file with mode: 0644]
tests/mock/mock_hook.h [deleted file]
tests/mock/mock_hook.hh [new file with mode: 0644]
tests/mock/module_mock.h [deleted file]
tests/mock/module_mock.hh [new file with mode: 0644]
tests/mock/security_manager_mock.cc
tests/mock/security_manager_mock.h [deleted file]
tests/mock/security_manager_mock.hh [new file with mode: 0644]
tests/mock/smack_mock.cc
tests/mock/smack_mock.h [deleted file]
tests/mock/smack_mock.hh [new file with mode: 0644]
tests/mock/test_fixture.cc
tests/mock/test_fixture.h [deleted file]
tests/mock/test_fixture.hh [new file with mode: 0644]
tests/mock/tzplatform_config_mock.cc
tests/mock/tzplatform_config_mock.h [deleted file]
tests/mock/tzplatform_config_mock.hh [new file with mode: 0644]
tests/noti_ex_unittest/CMakeLists.txt [new file with mode: 0644]
tests/noti_ex_unittest/src/test_main.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_abstract_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_app_control_action.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_button_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_chat_message_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_checkbox_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_entry_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_event_info.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_group_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_icon_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_image_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_input_selector_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_progress_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_shared_file.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_text_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_time_item.cc [new file with mode: 0644]
tests/noti_ex_unittest/src/test_noti_ex_visibility_action.cc [new file with mode: 0644]
tests/noti_unittest/CMakeLists.txt [new file with mode: 0644]
tests/noti_unittest/src/test_main.cc [new file with mode: 0644]
tests/noti_unittest/src/test_noti_notification.cc [new file with mode: 0644]
tests/unittest/CMakeLists.txt [deleted file]
tests/unittest/src/test_main.cc [deleted file]
tests/unittest/src/test_noti_ex_abstract_item.cc [deleted file]
tests/unittest/src/test_noti_ex_app_control_action.cc [deleted file]
tests/unittest/src/test_noti_ex_button_item.cc [deleted file]
tests/unittest/src/test_noti_ex_chat_message_item.cc [deleted file]
tests/unittest/src/test_noti_ex_checkbox_item.cc [deleted file]
tests/unittest/src/test_noti_ex_entry_item.cc [deleted file]
tests/unittest/src/test_noti_ex_event_info.cc [deleted file]
tests/unittest/src/test_noti_ex_group_item.cc [deleted file]
tests/unittest/src/test_noti_ex_icon_item.cc [deleted file]
tests/unittest/src/test_noti_ex_image_item.cc [deleted file]
tests/unittest/src/test_noti_ex_input_selector_item.cc [deleted file]
tests/unittest/src/test_noti_ex_progress_item.cc [deleted file]
tests/unittest/src/test_noti_ex_shared_file.cc [deleted file]
tests/unittest/src/test_noti_ex_text_item.cc [deleted file]
tests/unittest/src/test_noti_ex_time_item.cc [deleted file]
tests/unittest/src/test_noti_ex_visibility_action.cc [deleted file]

index b69932caf40c7199b14322b1a6be706e534b3126..e0c68fffb9c9c429bac8787706d5c696440d6d6a 100644 (file)
@@ -5,5 +5,10 @@ ADD_SUBDIRECTORY(notification-ex)
 ADD_SUBDIRECTORY(tests)
 
 ENABLE_TESTING()
-SET(NOTIFICATION_UNIT_TESTS notification-ex_unittests)
-ADD_TEST(NAME ${NOTIFICATION_UNIT_TESTS} COMMAND ${NOTIFICATION_UNIT_TESTS})
\ No newline at end of file
+SET(NOTIFICATION_EX_UNIT_TESTS notification-ex_unittests)
+ADD_TEST(NAME ${NOTIFICATION_EX_UNIT_TESTS} COMMAND ${NOTIFICATION_EX_UNIT_TESTS})
+ADD_DEPENDENCIES(${NOTIFICATION_EX_UNIT_TESTS} notification-ex)
+
+SET(NOTIFICATION_UNIT_TESTS notification_unittests)
+ADD_TEST(NAME ${NOTIFICATION_UNIT_TESTS} COMMAND ${NOTIFICATION_UNIT_TESTS})
+ADD_DEPENDENCIES(${NOTIFICATION_UNIT_TESTS} notification)
index 17ee72c042d4d1c301efc733841e3815ffec454c..a0b6664d915faaedadd55fabb3d18ef8ce0cb7df 100644 (file)
@@ -101,7 +101,7 @@ setup() {
 
 test_main() {
     echo "test_main start"
-    /usr/bin/notification-ex_unittests
+    /usr/bin/<NAME>_unittests
 }
 
 teardown() {
@@ -119,6 +119,11 @@ EOF
 
 mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}
 install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
+sed -i -e 's/<NAME>/notification/g' %{buildroot}%{_bindir}/tizen-unittests/%{name}/run-unittest.sh
+
+mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name}-ex
+install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}-ex/
+sed -i -e 's/<NAME>/notification-ex/g' %{buildroot}%{_bindir}/tizen-unittests/%{name}-ex/run-unittest.sh
 
 mkdir -p %{buildroot}%{upgrade_script_path}
 cp -f scripts/505.notification_upgrade.sh %{buildroot}%{upgrade_script_path}
@@ -218,6 +223,20 @@ GTest for notification-ex
 %{_bindir}/notification-ex_unittests
 %{_bindir}/tizen-unittests/%{name}/run-unittest.sh
 
+#################################################
+# notification_unittests
+#################################################
+%package -n notification_unittests
+Summary:    GTest for notification
+Group:      Development/Libraries
+
+%description -n notification_unittests
+GTest for notification
+
+%files -n notification_unittests
+%{_bindir}/notification_unittests
+%{_bindir}/tizen-unittests/%{name}-ex/run-unittest.sh
+
 %if 0%{?gcov:1}
 %files gcov
 %{_datadir}/gcov/obj/*
index 907a64da829d3ad8ce5352ce38e9b8b02614f4d6..5e5460b859d3ef4bddfbc2f3734fd1f625602b8d 100644 (file)
@@ -1,2 +1,2 @@
-ADD_SUBDIRECTORY(unittest)
-ADD_DEPENDENCIES(notification-ex_unittests notification-ex)
+ADD_SUBDIRECTORY(noti_unittest)
+ADD_SUBDIRECTORY(noti_ex_unittest)
index 2a4918093af1565d78289782dc89018c5197f4c1..ef5ba696c45e730451902af7b54e1204a61982cb 100644 (file)
  * limitations under the License.
  */
 
-#include "app_common_mock.h"
+#include "app_common_mock.hh"
 
-#include "mock_hook.h"
-#include "test_fixture.h"
+#include "mock_hook.hh"
+#include "test_fixture.hh"
 
 extern "C" int app_get_name(char** arg1) {
   return MOCK_HOOK_P1(AppCommonMock, app_get_name, arg1);
diff --git a/tests/mock/app_common_mock.h b/tests/mock/app_common_mock.h
deleted file mode 100644 (file)
index 18bcbc8..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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_COMMON_MOCK_H_
-#define UNIT_TESTS_MOCK_APP_COMMON_MOCK_H_
-
-#include <gmock/gmock.h>
-#include <app_common.h>
-
-#include "module_mock.h"
-
-class AppCommonMock : public virtual ModuleMock {
- public:
-  AppCommonMock() {
-    using ::testing::_;
-    using ::testing::Return;
-    using ::testing::Invoke;
-  }
-
-  MOCK_METHOD1(app_get_name, int (char**));
-};
-
-#endif  // UNIT_TESTS_MOCK_APP_COMMON_MOCK_H_
\ No newline at end of file
diff --git a/tests/mock/app_common_mock.hh b/tests/mock/app_common_mock.hh
new file mode 100644 (file)
index 0000000..c1b85bc
--- /dev/null
@@ -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_COMMON_MOCK_H_
+#define UNIT_TESTS_MOCK_APP_COMMON_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <app_common.h>
+
+#include "module_mock.hh"
+
+class AppCommonMock : public virtual ModuleMock {
+ public:
+  AppCommonMock() {
+    using ::testing::_;
+    using ::testing::Return;
+    using ::testing::Invoke;
+  }
+
+  MOCK_METHOD1(app_get_name, int (char**));
+};
+
+#endif  // UNIT_TESTS_MOCK_APP_COMMON_MOCK_H_
\ No newline at end of file
diff --git a/tests/mock/aul_mock.cc b/tests/mock/aul_mock.cc
new file mode 100644 (file)
index 0000000..073b902
--- /dev/null
@@ -0,0 +1,239 @@
+/*
+ * 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 "aul_mock.hh"
+
+#include "mock_hook.hh"
+#include "test_fixture.hh"
+
+// // aul_app_manager.h
+// extern "C" int aul_app_manager_foreach_app_context(
+//     aul_app_manager_app_context_cb callback, void* user_data) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_manager_foreach_app_context, callback,
+//                       user_data);
+// }
+
+// extern "C" int aul_app_manager_foreach_all_app_context(
+//     aul_app_manager_app_context_cb callback, void* user_data) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_manager_foreach_all_app_context,
+//                       callback, user_data);
+// }
+
+// extern "C" int aul_app_context_create(const char* app_id,
+//                                       aul_app_context_h* app_context) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_create, app_id, app_context);
+// }
+
+// extern "C" int aul_app_context_create_with_inst_id(
+//     const char *app_id, const char *inst_id, aul_app_context_h *app_context) {
+//   return MOCK_HOOK_P3(AulMock, aul_app_context_create_with_inst_id, app_id,
+//                       inst_id, app_context);
+// }
+
+// extern "C" int aul_app_context_create_with_pid(int pid,
+//                                                aul_app_context_h* app_context) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_create_with_pid, pid,
+//                       app_context);
+// }
+
+// extern "C" int aul_app_context_destroy(aul_app_context_h app_context) {
+//   return MOCK_HOOK_P1(AulMock, aul_app_context_destroy, app_context);
+// }
+
+// extern "C" int aul_app_context_clone(aul_app_context_h app_context,
+//                                      aul_app_context_h* clone) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_clone, app_context, clone);
+// }
+
+// extern "C" int aul_app_context_get_app_id(aul_app_context_h app_context,
+//                                           char** app_id) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_get_app_id, app_context, app_id);
+// }
+
+// extern "C" int aul_app_context_get_pkg_id(aul_app_context_h app_context,
+//                                           char** pkg_id) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_get_pkg_id, app_context, pkg_id);
+// }
+
+// extern "C" int aul_app_context_get_inst_id(aul_app_context_h app_context,
+//                                            char** inst_id) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_get_inst_id, app_context,
+//                       inst_id);
+// }
+
+// extern "C" int aul_app_context_get_pid(aul_app_context_h app_context,
+//                                        int* pid) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_get_pid, app_context, pid);
+// }
+
+// extern "C" int aul_app_context_get_status(aul_app_context_h app_context,
+//                                           int* status) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_get_status, app_context, status);
+// }
+
+// extern "C" int aul_app_context_is_sub_app(aul_app_context_h app_context,
+//                                           bool* is_sub_app) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_is_sub_app, app_context,
+//                       is_sub_app);
+// }
+
+// extern "C" int aul_app_context_is_running(aul_app_context_h app_context,
+//                                           bool* is_running) {
+//   return MOCK_HOOK_P2(AulMock, aul_app_context_is_running, app_context,
+//                       is_running);
+// }
+
+// extern "C" int aul_app_context_is_equal(aul_app_context_h lhs,
+//                                         aul_app_context_h rhs, bool* equal) {
+//   return MOCK_HOOK_P3(AulMock, aul_app_context_is_equal, lhs, rhs, equal);
+// }
+
+// // aul_app_event.h
+// extern "C" int aul_app_event_create_with_appid(
+//     const char* app_id, aul_app_event_launched_cb launched_cb,
+//     aul_app_event_terminated_cb terminated_cb, void* user_data,
+//     aul_app_event_h* app_event) {
+//   return MOCK_HOOK_P5(AulMock, aul_app_event_create_with_appid, app_id,
+//                       launched_cb, terminated_cb, user_data, app_event);
+// }
+
+// extern "C" int aul_app_event_create(aul_app_event_launched_cb launched_cb,
+//                                     aul_app_event_terminated_cb terminated_cb,
+//                                     void* user_data,
+//                                     aul_app_event_h* app_event) {
+//   return MOCK_HOOK_P4(AulMock, aul_app_event_create, launched_cb, terminated_cb,
+//                       user_data, app_event);
+// }
+
+// extern "C" int aul_app_event_destroy(aul_app_event_h app_event) {
+//   return MOCK_HOOK_P1(AulMock, aul_app_event_destroy, app_event);
+// }
+
+// // aul_window.h
+// extern "C" int aul_window_stack_get(aul_window_stack_h* handle) {
+//   return MOCK_HOOK_P1(AulMock, aul_window_stack_get, handle);
+// }
+
+// extern "C" int aul_window_stack_del(aul_window_stack_h handle) {
+//   return MOCK_HOOK_P1(AulMock, aul_window_stack_del, handle);
+// }
+
+// extern "C" int aul_window_stack_foreach(aul_window_stack_h handle,
+//                                         void (*iter_cb)(aul_window_info_h info,
+//                                                         void* data),
+//                                         void* data) {
+//   return MOCK_HOOK_P3(AulMock, aul_window_stack_foreach, handle, iter_cb, data);
+// }
+
+// extern "C" int aul_window_info_get_visibility(aul_window_info_h info,
+//                                               int* visibility) {
+//   return MOCK_HOOK_P2(AulMock, aul_window_info_get_visibility, info,
+//                       visibility);
+// }
+
+// extern "C" int aul_window_info_get_pid(aul_window_info_h info, int* pid) {
+//   return MOCK_HOOK_P2(AulMock, aul_window_info_get_pid, info, pid);
+// }
+
+// extern "C" int aul_window_get_focused_pid(int* pid) {
+//   return MOCK_HOOK_P1(AulMock, aul_window_get_focused_pid, pid);
+// }
+
+// extern "C" int aul_window_attach(const char* parent_app_id,
+//                                  const char* child_app_id) {
+//   return MOCK_HOOK_P2(AulMock, aul_window_attach, parent_app_id, child_app_id);
+// }
+
+// extern "C" int aul_window_attach_below(const char* parent_app_id,
+//                                        const char* child_app_id) {
+//   return MOCK_HOOK_P2(AulMock, aul_window_attach_below, parent_app_id,
+//                       child_app_id);
+// }
+
+// extern "C" int aul_window_detach(const char* app_id) {
+//   return MOCK_HOOK_P1(AulMock, aul_window_detach, app_id);
+// }
+
+// // aul.h
+extern "C" int aul_app_get_appid_bypid(int pid, char* appid, int len) {
+  return MOCK_HOOK_P3(AulMock, aul_app_get_appid_bypid, pid, appid, len);
+}
+
+// extern "C" int aul_resume_app_by_instance_id(const char* appid,
+//                                              const char* inst_id) {
+//   return MOCK_HOOK_P2(AulMock, aul_resume_app_by_instance_id, appid, inst_id);
+// }
+
+// extern "C" int aul_app_is_running(const char* appid) {
+//   return MOCK_HOOK_P1(AulMock, aul_app_is_running, appid);
+// }
+
+// extern "C" int aul_resume_app(const char* appid) {
+//   return MOCK_HOOK_P1(AulMock, aul_resume_app, appid);
+// }
+
+// extern "C" int aul_terminate_pid(int pid) {
+//   return MOCK_HOOK_P1(AulMock, aul_terminate_pid, pid);
+// }
+
+// extern "C" int aul_terminate_bgapp_pid(int pid) {
+//   return MOCK_HOOK_P1(AulMock, aul_terminate_bgapp_pid, pid);
+// }
+
+// extern "C" int aul_get_app_shared_data_path_by_appid(const char* appid,
+//                                                      char** path) {
+//   return MOCK_HOOK_P2(AulMock, aul_get_app_shared_data_path_by_appid, appid,
+//                       path);
+// }
+
+// extern "C" int aul_get_app_shared_resource_path_by_appid(const char* appid,
+//                                                      char** path) {
+//   return MOCK_HOOK_P2(AulMock, aul_get_app_shared_resource_path_by_appid, appid,
+//                       path);
+// }
+
+// extern "C" int aul_get_app_shared_trusted_path_by_appid(const char* appid,
+//                                                         char** path) {
+//   return MOCK_HOOK_P2(AulMock, aul_get_app_shared_trusted_path_by_appid, appid,
+//                       path);
+// }
+
+// extern "C" int aul_get_app_external_shared_data_path_by_appid(const char* appid,
+//                                                           char** path) {
+//   return MOCK_HOOK_P2(AulMock, aul_get_app_external_shared_data_path_by_appid,
+//                       appid, path);
+// }
+
+// extern "C" int aul_terminate_pid_without_restart(int pid) {
+//   return MOCK_HOOK_P1(AulMock, aul_terminate_pid_without_restart, pid);
+// }
+
+// // aul_svc.h
+// extern "C" int aul_svc_get_appid_by_alias_appid(const char* alias_appid,
+//                                                 char** appid) {
+//   return MOCK_HOOK_P2(AulMock, aul_svc_get_appid_by_alias_appid, alias_appid,
+//                       appid);
+// }
+
+// // aul_app_group.h
+
+// extern "C" int aul_app_group_add(int win_id) {
+//   return MOCK_HOOK_P1(AulMock, aul_app_group_add, win_id);
+// }
+
+// extern "C" int aul_app_group_remove(int win_id) {
+//   return MOCK_HOOK_P1(AulMock, aul_app_group_remove, win_id);
+// }
diff --git a/tests/mock/aul_mock.hh b/tests/mock/aul_mock.hh
new file mode 100644 (file)
index 0000000..9d16b6a
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * 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_AUL_MOCK_H_
+#define UNIT_TESTS_MOCK_AUL_MOCK_H_
+
+#include <aul.h>
+#include <gmock/gmock.h>
+#include <aul.h>
+#include <aul_app_event.h>
+#include <aul_app_group.h>
+#include <aul_app_manager.h>
+#include <aul_svc.h>
+#include <aul_window.h>
+
+#include "module_mock.hh"
+
+class AulMock : public virtual ModuleMock {
+ public:
+  AulMock() {
+    using ::testing::_;
+    using ::testing::Return;
+    using ::testing::Invoke;
+  }
+
+  // MOCK_METHOD2(aul_app_manager_foreach_app_context,
+  //              int(aul_app_manager_app_context_cb, void*));
+  // MOCK_METHOD2(aul_app_manager_foreach_all_app_context,
+  //              int(aul_app_manager_app_context_cb, void*));
+  // MOCK_METHOD2(aul_app_context_create, int(const char*, aul_app_context_h*));
+  // MOCK_METHOD1(aul_app_context_destroy, int(aul_app_context_h));
+  // MOCK_METHOD2(aul_app_context_get_app_id, int(aul_app_context_h, char**));
+  // MOCK_METHOD2(aul_app_context_get_pid, int(aul_app_context_h, pid_t*));
+  // MOCK_METHOD2(aul_app_context_get_pkg_id, int(aul_app_context_h, char**));
+  // MOCK_METHOD2(aul_app_context_get_status, int(aul_app_context_h, int*));
+  // MOCK_METHOD2(aul_app_context_is_running, int(aul_app_context_h, bool*));
+  // MOCK_METHOD3(aul_app_context_is_equal,
+  //              int(aul_app_context_h, aul_app_context_h, bool*));
+  // MOCK_METHOD2(aul_app_context_is_sub_app, int(aul_app_context_h, bool*));
+  // MOCK_METHOD2(aul_app_context_clone,
+  //              int(aul_app_context_h, aul_app_context_h*));
+  // MOCK_METHOD3(aul_app_context_create_with_inst_id,
+  //              int(const char*, const char*, aul_app_context_h*));
+  // MOCK_METHOD2(aul_app_context_get_inst_id, int(aul_app_context_h, char**));
+  // MOCK_METHOD2(aul_app_context_create_with_pid, int(pid_t, aul_app_context_h*));
+
+  // MOCK_METHOD4(aul_app_event_create,
+  //              int(aul_app_event_launched_cb, aul_app_event_terminated_cb,
+  //                  void*, aul_app_event_h*));
+  // MOCK_METHOD1(aul_app_event_destroy, int(aul_app_event_h));
+  // MOCK_METHOD5(aul_app_event_create_with_appid,
+  //              int(const char*, aul_app_event_launched_cb,
+  //                  aul_app_event_terminated_cb, void*, aul_app_event_h*));
+
+  // MOCK_METHOD2(aul_window_info_get_visibility, int(aul_window_info_h, int*));
+  // MOCK_METHOD2(aul_window_info_get_pid, int(aul_window_info_h, int*));
+  // MOCK_METHOD1(aul_window_stack_get, int(aul_window_stack_h*));
+  // MOCK_METHOD3(aul_window_stack_foreach,
+  //              int(aul_window_stack_h, void (*)(aul_window_info_h, void*),
+  //                  void*));
+  // MOCK_METHOD1(aul_window_stack_del, int(aul_window_stack_h));
+  // MOCK_METHOD1(aul_window_get_focused_pid, int(int*));
+  // MOCK_METHOD2(aul_window_attach, int(const char*, const char*));
+  // MOCK_METHOD1(aul_window_detach, int(const char*));
+  // MOCK_METHOD2(aul_window_attach_below, int(const char*, const char*));
+
+  MOCK_METHOD3(aul_app_get_appid_bypid, int(int, char*, int));
+  // MOCK_METHOD2(aul_svc_get_appid_by_alias_appid, int(const char*, char**));
+  // MOCK_METHOD2(aul_resume_app_by_instance_id, int(const char*, const char*));
+  // MOCK_METHOD1(aul_app_is_running, int(const char*));
+  // MOCK_METHOD1(aul_resume_app, int(const char*));
+  // MOCK_METHOD1(aul_terminate_pid, int(int));
+  // MOCK_METHOD1(aul_terminate_bgapp_pid, int(int));
+  // MOCK_METHOD2(aul_get_app_shared_data_path_by_appid, int(const char*, char**));
+  // MOCK_METHOD2(aul_get_app_shared_resource_path_by_appid,
+  //              int(const char*, char**));
+  // MOCK_METHOD2(aul_get_app_shared_trusted_path_by_appid,
+  //              int(const char*, char**));
+  // MOCK_METHOD2(aul_get_app_external_shared_data_path_by_appid,
+  //              int(const char*, char**));
+  // MOCK_METHOD1(aul_terminate_pid_without_restart, int(int));
+
+  // MOCK_METHOD1(aul_app_group_add, int(int));
+  // MOCK_METHOD1(aul_app_group_remove, int(int));
+
+};
+
+#endif  // UNIT_TESTS_MOCK_AUL_MOCK_H_
index 15569ac7c6ae3a7650bc6ec26f643e80c7251980..7c33ca071ee6ac95a1ef424eccfdb84e6065e062 100644 (file)
  * limitations under the License.
  */
 
-#include "glib_mock.h"
+#include "glib_mock.hh"
 
-#include "mock_hook.h"
-#include "test_fixture.h"
+#include "mock_hook.hh"
+#include "test_fixture.hh"
 
 extern "C" GFile* g_file_new_for_path(const char* arg1) {
   return MOCK_HOOK_P1(GlibMock, g_file_new_for_path, arg1);
diff --git a/tests/mock/glib_mock.h b/tests/mock/glib_mock.h
deleted file mode 100644 (file)
index 03688ad..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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_GLIB_MOCK_H_
-#define UNIT_TESTS_MOCK_GLIB_MOCK_H_
-
-#include <gio/gio.h>
-#include <glib.h>
-#include <gmock/gmock.h>
-
-#include "module_mock.h"
-
-class GlibMock : public virtual ModuleMock {
- public:
-  GlibMock() {
-    using ::testing::_;
-    using ::testing::Return;
-    using ::testing::Invoke;
-  }
-
-  MOCK_METHOD1(g_file_new_for_path, GFile* (const char*));
-  MOCK_METHOD2(g_file_query_exists, gboolean (GFile*, GCancellable*));
-  MOCK_METHOD3(g_file_make_directory, gboolean (GFile*, GCancellable*, GError**));
-
-  MOCK_METHOD2(access, int (const char*, int));
-};
-
-#endif  // UNIT_TESTS_MOCK_GLIB_MOCK_H_
diff --git a/tests/mock/glib_mock.hh b/tests/mock/glib_mock.hh
new file mode 100644 (file)
index 0000000..2a6cb1e
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * 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_GLIB_MOCK_H_
+#define UNIT_TESTS_MOCK_GLIB_MOCK_H_
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <gmock/gmock.h>
+
+#include "module_mock.hh"
+
+class GlibMock : public virtual ModuleMock {
+ public:
+  GlibMock() {
+    using ::testing::_;
+    using ::testing::Return;
+    using ::testing::Invoke;
+  }
+
+  MOCK_METHOD1(g_file_new_for_path, GFile* (const char*));
+  MOCK_METHOD2(g_file_query_exists, gboolean (GFile*, GCancellable*));
+  MOCK_METHOD3(g_file_make_directory, gboolean (GFile*, GCancellable*, GError**));
+
+  MOCK_METHOD2(access, int (const char*, int));
+};
+
+#endif  // UNIT_TESTS_MOCK_GLIB_MOCK_H_
diff --git a/tests/mock/mock_hook.h b/tests/mock/mock_hook.h
deleted file mode 100644 (file)
index 29b0932..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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_MOCK_HOOK_H_
-#define UNIT_TESTS_MOCK_MOCK_HOOK_H_
-
-#define MOCK_HOOK_P0(MOCK_CLASS, f)                                            \
-    TestFixture::GetMock<MOCK_CLASS>().f()
-#define MOCK_HOOK_P1(MOCK_CLASS, f, p1)                                        \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1)
-#define MOCK_HOOK_P2(MOCK_CLASS, f, p1, p2)                                    \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2)
-#define MOCK_HOOK_P3(MOCK_CLASS, f, p1, p2, p3)                                \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3)
-#define MOCK_HOOK_P4(MOCK_CLASS, f, p1, p2, p3, p4)                            \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4)
-#define MOCK_HOOK_P5(MOCK_CLASS, f, p1, p2, p3, p4, p5)                        \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5)
-#define MOCK_HOOK_P6(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6)                    \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6)
-#define MOCK_HOOK_P7(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7)                \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6, p7)
-#define MOCK_HOOK_P8(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8)            \
-    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6, p7, p8)
-#define MOCK_HOOK_P10(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)  \
-    TestFixture::GetMock<MOCK_CLASS>().f(                                      \
-        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
-#define MOCK_HOOK_P11(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)  \
-    TestFixture::GetMock<MOCK_CLASS>().f(                                      \
-        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
-
-#endif  // UNIT_TESTS_MOCK_MOCK_HOOK_H_
diff --git a/tests/mock/mock_hook.hh b/tests/mock/mock_hook.hh
new file mode 100644 (file)
index 0000000..29b0932
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * 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_MOCK_HOOK_H_
+#define UNIT_TESTS_MOCK_MOCK_HOOK_H_
+
+#define MOCK_HOOK_P0(MOCK_CLASS, f)                                            \
+    TestFixture::GetMock<MOCK_CLASS>().f()
+#define MOCK_HOOK_P1(MOCK_CLASS, f, p1)                                        \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1)
+#define MOCK_HOOK_P2(MOCK_CLASS, f, p1, p2)                                    \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2)
+#define MOCK_HOOK_P3(MOCK_CLASS, f, p1, p2, p3)                                \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3)
+#define MOCK_HOOK_P4(MOCK_CLASS, f, p1, p2, p3, p4)                            \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4)
+#define MOCK_HOOK_P5(MOCK_CLASS, f, p1, p2, p3, p4, p5)                        \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5)
+#define MOCK_HOOK_P6(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6)                    \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6)
+#define MOCK_HOOK_P7(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7)                \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6, p7)
+#define MOCK_HOOK_P8(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8)            \
+    TestFixture::GetMock<MOCK_CLASS>().f(p1, p2, p3, p4, p5, p6, p7, p8)
+#define MOCK_HOOK_P10(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)  \
+    TestFixture::GetMock<MOCK_CLASS>().f(                                      \
+        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
+#define MOCK_HOOK_P11(MOCK_CLASS, f, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)  \
+    TestFixture::GetMock<MOCK_CLASS>().f(                                      \
+        p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11)
+
+#endif  // UNIT_TESTS_MOCK_MOCK_HOOK_H_
diff --git a/tests/mock/module_mock.h b/tests/mock/module_mock.h
deleted file mode 100644 (file)
index 9b19d89..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (c) 2020 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_MODULE_MOCK_H_
-#define UNIT_TESTS_MOCK_MODULE_MOCK_H_
-
-class ModuleMock {
- public:
-  virtual ~ModuleMock() {}
-};
-
-#endif  // UNIT_TESTS_MOCK_MODULE_MOCK_H_
diff --git a/tests/mock/module_mock.hh b/tests/mock/module_mock.hh
new file mode 100644 (file)
index 0000000..9b19d89
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2020 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_MODULE_MOCK_H_
+#define UNIT_TESTS_MOCK_MODULE_MOCK_H_
+
+class ModuleMock {
+ public:
+  virtual ~ModuleMock() {}
+};
+
+#endif  // UNIT_TESTS_MOCK_MODULE_MOCK_H_
index 85710d68aae9b0c7006d92d74137b8a2b02c0268..67c2dadf7f1e1344685927c49c9f54669e5c511e 100644 (file)
  * limitations under the License.
  */
 
-#include "security_manager_mock.h"
+#include "security_manager_mock.hh"
 
-#include "mock_hook.h"
-#include "test_fixture.h"
+#include "mock_hook.hh"
+#include "test_fixture.hh"
 
 extern "C" int security_manager_private_sharing_req_new(private_sharing_req** arg1) {
   return MOCK_HOOK_P1(SecurityManagerMock, security_manager_private_sharing_req_new, arg1);
diff --git a/tests/mock/security_manager_mock.h b/tests/mock/security_manager_mock.h
deleted file mode 100644 (file)
index c5424fd..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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_SECURITY_MANAGER_MOCK_H_
-#define UNIT_TESTS_MOCK_SECURITY_MANAGER_MOCK_H_
-
-#include <security-manager.h>
-#include <gmock/gmock.h>
-
-#include "module_mock.h"
-
-class SecurityManagerMock : public virtual ModuleMock {
- public:
-  SecurityManagerMock() {
-    using ::testing::_;
-    using ::testing::Return;
-    using ::testing::Invoke;
-  }
-
-  MOCK_METHOD1(security_manager_private_sharing_req_new, int (private_sharing_req**));
-  MOCK_METHOD1(security_manager_private_sharing_apply, int (const private_sharing_req*));
-  MOCK_METHOD1(security_manager_private_sharing_drop, int (const private_sharing_req*));
-  MOCK_METHOD2(security_manager_private_sharing_req_set_target_appid,
-      int (private_sharing_req*, const char*));
-  MOCK_METHOD3(security_manager_private_sharing_req_add_paths,
-      int (private_sharing_req*, const char**, size_t));
-
-};
-
-#endif  // UNIT_TESTS_MOCK_SECURITY_MANAGER_MOCK_H_
diff --git a/tests/mock/security_manager_mock.hh b/tests/mock/security_manager_mock.hh
new file mode 100644 (file)
index 0000000..cc35956
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * 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_SECURITY_MANAGER_MOCK_H_
+#define UNIT_TESTS_MOCK_SECURITY_MANAGER_MOCK_H_
+
+#include <security-manager.h>
+#include <gmock/gmock.h>
+
+#include "module_mock.hh"
+
+class SecurityManagerMock : public virtual ModuleMock {
+ public:
+  SecurityManagerMock() {
+    using ::testing::_;
+    using ::testing::Return;
+    using ::testing::Invoke;
+  }
+
+  MOCK_METHOD1(security_manager_private_sharing_req_new, int (private_sharing_req**));
+  MOCK_METHOD1(security_manager_private_sharing_apply, int (const private_sharing_req*));
+  MOCK_METHOD1(security_manager_private_sharing_drop, int (const private_sharing_req*));
+  MOCK_METHOD2(security_manager_private_sharing_req_set_target_appid,
+      int (private_sharing_req*, const char*));
+  MOCK_METHOD3(security_manager_private_sharing_req_add_paths,
+      int (private_sharing_req*, const char**, size_t));
+
+};
+
+#endif  // UNIT_TESTS_MOCK_SECURITY_MANAGER_MOCK_H_
index 4b8388dac208867e57c36c8c9f8ee47d2874743a..28aae23c823f8e5f4d69358b46111b02d06154c7 100644 (file)
  * limitations under the License.
  */
 
-#include "smack_mock.h"
+#include "smack_mock.hh"
 
-#include "mock_hook.h"
-#include "test_fixture.h"
+#include "mock_hook.hh"
+#include "test_fixture.hh"
 
 extern "C" ssize_t smack_new_label_from_path(const char* arg1,
     const char* arg2, int arg3, char** arg4) {
diff --git a/tests/mock/smack_mock.h b/tests/mock/smack_mock.h
deleted file mode 100644 (file)
index 2517c16..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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_SMACK_MOCK_H_
-#define UNIT_TESTS_MOCK_SMACK_MOCK_H_
-
-#include <gmock/gmock.h>
-#include <sys/smack.h>
-
-#include "module_mock.h"
-
-class SmackMock : public virtual ModuleMock {
- public:
-  SmackMock() {
-    using ::testing::_;
-    using ::testing::Return;
-    using ::testing::Invoke;
-  }
-
-  MOCK_METHOD4(smack_new_label_from_path, ssize_t (const char*,
-    const char*, int, char**));
-};
-
-#endif  // UNIT_TESTS_MOCK_SMACK_MOCK_H_
\ No newline at end of file
diff --git a/tests/mock/smack_mock.hh b/tests/mock/smack_mock.hh
new file mode 100644 (file)
index 0000000..4ebdf44
--- /dev/null
@@ -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.
+ */
+
+#ifndef UNIT_TESTS_MOCK_SMACK_MOCK_H_
+#define UNIT_TESTS_MOCK_SMACK_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <sys/smack.h>
+
+#include "module_mock.hh"
+
+class SmackMock : public virtual ModuleMock {
+ public:
+  SmackMock() {
+    using ::testing::_;
+    using ::testing::Return;
+    using ::testing::Invoke;
+  }
+
+  MOCK_METHOD4(smack_new_label_from_path, ssize_t (const char*,
+    const char*, int, char**));
+};
+
+#endif  // UNIT_TESTS_MOCK_SMACK_MOCK_H_
\ No newline at end of file
index 27f566616c9fcf6a9202a80e6d16569ad2d127e1..50f39e99370bf23870e073a3c8386ec0fde1420f 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#include "test_fixture.h"
+#include "test_fixture.hh"
 
 #include <memory>
 
diff --git a/tests/mock/test_fixture.h b/tests/mock/test_fixture.h
deleted file mode 100644 (file)
index 1ea3b8f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2020 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_TEST_FIXTURE_H_
-#define UNIT_TESTS_MOCK_TEST_FIXTURE_H_
-
-#include <gtest/gtest.h>
-
-#include <memory>
-#include <stdexcept>
-#include <string>
-#include <utility>
-
-#include "module_mock.h"
-
-class TestFixture : public ::testing::Test {
- public:
-  explicit TestFixture(std::unique_ptr<ModuleMock>&& mock) {
-    mock_ = std::move(mock);
-  }
-  virtual ~TestFixture() {
-    mock_.reset();
-  }
-
-  virtual void SetUp() {}
-  virtual void TearDown() {}
-
-  template <typename T>
-  static T& GetMock() {
-    auto ptr = dynamic_cast<T*>(mock_.get());
-    if (!ptr)
-      throw std::invalid_argument("The test does not provide mock of \"" +
-          std::string(typeid(T).name()) + "\"");
-    return *ptr;
-  }
-
-  static std::unique_ptr<ModuleMock> mock_;
-};
-
-#endif  // UNIT_TESTS_MOCK_TEST_FIXTURE_H_
diff --git a/tests/mock/test_fixture.hh b/tests/mock/test_fixture.hh
new file mode 100644 (file)
index 0000000..0bf58d1
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2020 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_TEST_FIXTURE_H_
+#define UNIT_TESTS_MOCK_TEST_FIXTURE_H_
+
+#include <gtest/gtest.h>
+
+#include <memory>
+#include <stdexcept>
+#include <string>
+#include <utility>
+
+#include "module_mock.hh"
+
+class TestFixture : public ::testing::Test {
+ public:
+  explicit TestFixture(std::unique_ptr<ModuleMock>&& mock) {
+    mock_ = std::move(mock);
+  }
+  virtual ~TestFixture() {
+    mock_.reset();
+  }
+
+  virtual void SetUp() {}
+  virtual void TearDown() {}
+
+  template <typename T>
+  static T& GetMock() {
+    auto ptr = dynamic_cast<T*>(mock_.get());
+    if (!ptr)
+      throw std::invalid_argument("The test does not provide mock of \"" +
+          std::string(typeid(T).name()) + "\"");
+    return *ptr;
+  }
+
+  static std::unique_ptr<ModuleMock> mock_;
+};
+
+#endif  // UNIT_TESTS_MOCK_TEST_FIXTURE_H_
index e6b3cbdf20181a68af0b751d2d4b6cc4e5e6370e..60946548783545c4a4a007b40df9403c1ba4114d 100644 (file)
  * limitations under the License.
  */
 
-#include "tzplatform_config_mock.h"
+#include "tzplatform_config_mock.hh"
 
-#include "mock_hook.h"
-#include "test_fixture.h"
+#include "mock_hook.hh"
+#include "test_fixture.hh"
 
 extern "C" const char* tzplatform_getenv(enum tzplatform_variable arg1) {
   return MOCK_HOOK_P1(TzplatformConfigMock, tzplatform_getenv, arg1);
diff --git a/tests/mock/tzplatform_config_mock.h b/tests/mock/tzplatform_config_mock.h
deleted file mode 100644 (file)
index b6c75e4..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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_TZPLATFORM_CONFIG_MOCK_H_
-#define UNIT_TESTS_MOCK_TZPLATFORM_CONFIG_MOCK_H_
-
-#include <tzplatform_config.h>
-#include <gmock/gmock.h>
-
-#include "module_mock.h"
-
-class TzplatformConfigMock : public virtual ModuleMock {
- public:
-  TzplatformConfigMock() {
-    using ::testing::_;
-    using ::testing::Return;
-    using ::testing::Invoke;
-  }
-
-  MOCK_METHOD1(tzplatform_getenv, const char* (enum tzplatform_variable));
-};
-
-#endif  // UNIT_TESTS_MOCK_TZPLATFORM_CONFIG_MOCK_H_
\ No newline at end of file
diff --git a/tests/mock/tzplatform_config_mock.hh b/tests/mock/tzplatform_config_mock.hh
new file mode 100644 (file)
index 0000000..43d1ac1
--- /dev/null
@@ -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_TZPLATFORM_CONFIG_MOCK_H_
+#define UNIT_TESTS_MOCK_TZPLATFORM_CONFIG_MOCK_H_
+
+#include <tzplatform_config.h>
+#include <gmock/gmock.h>
+
+#include "module_mock.hh"
+
+class TzplatformConfigMock : public virtual ModuleMock {
+ public:
+  TzplatformConfigMock() {
+    using ::testing::_;
+    using ::testing::Return;
+    using ::testing::Invoke;
+  }
+
+  MOCK_METHOD1(tzplatform_getenv, const char* (enum tzplatform_variable));
+};
+
+#endif  // UNIT_TESTS_MOCK_TZPLATFORM_CONFIG_MOCK_H_
\ No newline at end of file
diff --git a/tests/noti_ex_unittest/CMakeLists.txt b/tests/noti_ex_unittest/CMakeLists.txt
new file mode 100644 (file)
index 0000000..58e266b
--- /dev/null
@@ -0,0 +1,50 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+PROJECT(notification-ex_unittests CXX)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(notification-ex_unittests REQUIRED
+    dlog
+    gmock
+    capi-appfw-app-control
+    glib-2.0
+    gio-2.0
+    gio-unix-2.0
+    aul
+    security-manager
+    libtzplatform-config
+)
+
+FOREACH(flag ${notification-ex_unittests_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(
+    ${CMAKE_SOURCE_DIR}/
+    ${CMAKE_SOURCE_DIR}/notification-ex/
+    ${CMAKE_SOURCE_DIR}/notification-ex/api
+    ${CMAKE_CURRENT_SOURCE_DIR}/../
+    ${CMAKE_CURRENT_SOURCE_DIR}/../mock
+)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../mock MOCK_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/notification-ex NOTIFICATION_EX_SOURCES)
+ADD_EXECUTABLE(${PROJECT_NAME}
+    ${SOURCES}
+    ${NOTIFICATION_EX_SOURCES}
+    ${MOCK_SOURCES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${notification-ex_unittests_LDFLAGS}
+    ${pkgs_LDFLAGS}
+    ${pkgs_LIBRARIES}
+    gmock
+    notification-ex
+)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
diff --git a/tests/noti_ex_unittest/src/test_main.cc b/tests/noti_ex_unittest/src/test_main.cc
new file mode 100644 (file)
index 0000000..ad7ec6c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+int main(int argc, char** argv) {
+  int ret = -1;
+
+  try {
+    testing::InitGoogleTest(&argc, argv);
+  } catch(...) {
+    std::cout << "Exception occurred" << std::endl;
+  }
+
+  try {
+    ret = RUN_ALL_TESTS();
+  } catch (const ::testing::internal::GoogleTestFailureException& e) {
+    ret = -1;
+    std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
+  }
+
+  return ret;
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_abstract_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_abstract_item.cc
new file mode 100644 (file)
index 0000000..3d1549a
--- /dev/null
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+#include <app_control.h>
+#include <app_common.h>
+
+#include "notification-ex/item_inflator.h"
+#include "notification-ex/app_control_action.h"
+#include "notification-ex/item_info_internal.h"
+#include "notification-ex/iitem_factory.h"
+#include "notification-ex/factory_manager.h"
+#include "notification-ex/default_item_factory.h"
+#include "notification-ex/group_item.h"
+#include "notification-ex/button_item.h"
+
+#include "mock/test_fixture.hh"
+#include "mock/smack_mock.hh"
+#include "mock/app_common_mock.hh"
+#include "mock/aul_mock.hh"
+
+#define MY_ITEM_TYPE AbstractItem::Type::Custom + 1
+
+using namespace notification;
+using namespace tizen_base;
+using namespace notification::item;
+
+using ::testing::_;
+using ::testing::Invoke;
+
+namespace {
+class TestItem : public AbstractItem {
+  public:
+   TestItem(std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}))
+     : AbstractItem(action) {
+   }
+   TestItem(std::string id, std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}))
+     : AbstractItem(id, action) {
+   }
+   virtual ~TestItem() {}
+
+  Bundle Serialize() const override {
+    Bundle b;
+    b = AbstractItem::Serialize();
+    return b;
+  }
+  void Deserialize(Bundle b) override {
+    AbstractItem::Deserialize(b);
+  }
+  AbstractItem& FindByID(std::string id) override {
+    return *this;
+  }
+  bool IsItemTypeExist(int type) {
+  if (GetType() == type)
+      return true;
+    return false;
+  }
+  int GetType() const override {
+    return MY_ITEM_TYPE;
+  }
+};
+
+class MyFactory : public IItemFactory {
+ public:
+  MyFactory() {}
+  virtual ~MyFactory() {}
+
+  std::unique_ptr<AbstractItem> CreateItem(int type) override {
+    if (type == MY_ITEM_TYPE)
+      return std::unique_ptr<AbstractItem>(new TestItem(""));
+
+    return nullptr;
+  }
+};
+
+class Mocks :
+    virtual public ::testing::NiceMock<AulMock>,
+    virtual public ::testing::NiceMock<SmackMock>,
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class AbstractItemTest : public TestFixture {
+ public:
+  AbstractItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+
+  virtual void SetUp() {
+    FactoryManager::GetInst().RegisterFactory(std::unique_ptr<IItemFactory>(new MyFactory()));
+  }
+  virtual void TearDown() {
+    FactoryManager::GetInst().RegisterFactory(std::unique_ptr<IItemFactory>(new DefaultItemFactory()));
+  }
+};
+
+TEST_F(AbstractItemTest, SerializeDeserialize) {
+  /* Serialize */
+  app_control_h app_control, app_control_1;
+  char* app_id = NULL;
+  time_t current_time;
+  Bundle extension_b;
+
+  app_control_create(&app_control);
+  app_control_set_app_id(app_control, "new_appid");
+  std::shared_ptr<AppControlAction> action = std::make_shared<AppControlAction>(app_control);
+  app_control_destroy(app_control);
+
+  app_control_create(&app_control_1);
+  app_control_set_app_id(app_control_1, "new_appid_1");
+  std::shared_ptr<AppControlAction> action_1 = std::make_shared<AppControlAction>(app_control_1);
+  app_control_destroy(app_control_1);
+
+  TestItem item("test_id", action);
+
+  std::shared_ptr<Color> color = std::make_shared<Color>(50, 100,150,200);
+  std::shared_ptr<Padding> padding = std::make_shared<Padding>(10, 20, 30, 40);
+  std::shared_ptr<Geometry> geometry = std::make_shared<Geometry>(110, 120, 130, 140);
+  std::shared_ptr<Color> bg_color = std::make_shared<Color>(71, 72, 73, 74);
+
+  item.SetStyle(std::make_shared<Style>(color, padding, geometry, bg_color, "bg path"));
+  item.SetVisible(false);
+  item.SetEnable(false);
+  item.AddReceiver("receiver_1");
+  item.AddReceiver("receiver_2");
+  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->AddHideViewer("hide_1");
+  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->AddHideViewer("hide_2");
+  item.SetPolicy(AbstractItem::Policy::OnBootClear);
+  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetVersion(3);
+  item.GetInfo()->SetHideTime(5);
+  item.GetInfo()->SetDeleteTime(9);
+  item.SetChannel("channel99");
+  item.SetSoundPath("soundpath");
+  item.SetVibrationPath("vibrationpath");
+  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetUid(3);
+  item.SetSenderAppId("sender");
+  item.SetTag("tag");
+
+  time(&current_time);
+  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetTime(current_time);
+
+  std::shared_ptr<Color> color2 = std::make_shared<Color>(150, 160, 170, 180);
+  std::shared_ptr<LEDInfo> led = std::make_shared<LEDInfo>(color2);
+  led->SetOnPeriod(10);
+  led->SetOffPeriod(20);
+
+  item.SetLEDInfo(led);
+  item.SetOnGoingState(true);
+
+  extension_b.Add("test_key", "test_value");
+  item.SetExtensionData("extension_key", extension_b);
+
+  /* Deserialize */
+  Bundle b = item.Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  TestItem* gen_test = static_cast<TestItem*>(gen_item.get());
+
+  ASSERT_EQ(gen_test->GetId(), "test_id");
+  ASSERT_EQ(gen_test->GetType(), MY_ITEM_TYPE);
+  ASSERT_EQ(std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetUid(), 3);
+  ASSERT_EQ(gen_test->GetEnable(), false);
+  ASSERT_EQ(gen_test->GetVisible(),false);
+  ASSERT_EQ(gen_test->GetPolicy(), AbstractItem::Policy::OnBootClear);
+  ASSERT_EQ(std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetVersion(), 3);
+  ASSERT_EQ(gen_test->GetInfo()->GetHideTime(), 5);
+  ASSERT_EQ(gen_test->GetInfo()->GetDeleteTime(), 9);
+  ASSERT_EQ(gen_test->GetChannel(), "channel99");
+  ASSERT_EQ(gen_test->GetSoundPath(), "soundpath");
+  ASSERT_EQ(gen_test->GetVibrationPath(), "vibrationpath");
+  ASSERT_EQ(gen_test->GetSenderAppId(), "sender");
+  ASSERT_EQ(gen_test->GetTag(), "tag");
+  ASSERT_EQ(gen_test->GetInfo()->GetTime(), current_time);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetLeft(), 10);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetTop(), 20);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetRight(), 30);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetBottom(), 40);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetAVal(), 50);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetRVal(), 100);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetGVal(), 150);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetBVal(), 200);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetX(), 110);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetY(), 120);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetWidth(), 130);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetHeight(), 140);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetAVal(), 71);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetRVal(), 72);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetGVal(), 73);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetBVal(), 74);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundImage(), "bg path");
+
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetAVal(), 150);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetRVal(), 160);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetGVal(), 170);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetBVal(), 180);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetOnPeriod(), 10);
+  ASSERT_EQ(gen_test->GetLEDInfo()->GetOffPeriod(), 20);
+
+  std::list<std::string> receiver1 = item.GetReceiverList();
+  std::list<std::string> receiver2 = gen_test->GetReceiverList();
+
+  ASSERT_EQ(receiver1.size(), receiver2.size());
+
+  for (unsigned int i = 0; i < receiver1.size(); i++) {
+    ASSERT_EQ(receiver1.front(), receiver2.front());
+    receiver1.pop_front();
+    receiver2.pop_front();
+  }
+
+  std::list<std::string> hide1 =
+      std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->GetHideViewerList();
+  std::list<std::string> hide2 =
+      std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetHideViewerList();
+
+  ASSERT_EQ(hide1.size(), hide2.size());
+
+  for (unsigned int i = 0; i < hide1.size(); i++) {
+    ASSERT_EQ(hide1.front(), hide2.front());
+    hide1.pop_front();
+    hide2.pop_front();
+  }
+
+  ASSERT_EQ(gen_test->GetAction()->GetType(), AbstractAction::Type::AppControl);
+
+  std::shared_ptr<AppControlAction> ac =
+      std::static_pointer_cast<AppControlAction>(gen_test->GetAction());
+  app_control_get_app_id(ac->GetAppControl(), &app_id);
+
+  ASSERT_STREQ(app_id, "new_appid");
+
+  item.SetAction(action_1);
+
+  b = item.Serialize();
+  gen_item = ItemInflator::Create(b);
+  gen_test = static_cast<TestItem*>(gen_item.get());
+
+  ac = std::static_pointer_cast<AppControlAction>(gen_test->GetAction());
+  app_control_get_app_id(ac->GetAppControl(), &app_id);
+
+  ASSERT_STREQ(app_id, "new_appid_1");
+  ASSERT_EQ(gen_test->GetOnGoingState(), true);
+
+  Bundle extension_b2 = gen_test->GetExtensionData("extension_key");
+  ASSERT_EQ(extension_b2.GetString("test_key"), "test_value");
+}
+
+TEST_F(AbstractItemTest, SerializeDeserialize2) {
+  /* Serialize */
+  TestItem item("test_id");
+
+  std::shared_ptr<Color> color = std::make_shared<Color>(50, 100,150,200);
+  std::shared_ptr<Padding> padding = std::make_shared<Padding>(10, 20, 30, 40);
+  std::shared_ptr<Geometry> geometry = std::make_shared<Geometry>(110, 120, 130, 140);
+
+  item.SetStyle(std::make_shared<Style>(color, padding, geometry, nullptr, ""));
+
+  /* Deserialize */
+  Bundle b = item.Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  TestItem* gen_test = static_cast<TestItem*>(gen_item.get());
+
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetLeft(), 10);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetTop(), 20);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetRight(), 30);
+  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetBottom(), 40);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetAVal(), 50);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetRVal(), 100);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetGVal(), 150);
+  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetBVal(), 200);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetX(), 110);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetY(), 120);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetWidth(), 130);
+  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetHeight(), 140);
+
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor(), nullptr);
+  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundImage(), "");
+}
+
+TEST_F(AbstractItemTest, ItemInfoCanReceive) {
+  TestItem item("test_id");
+
+  item.AddReceiver(ReceiverGroup::Panel);
+  item.AddReceiver(ReceiverGroup::LockScreen);
+
+  ASSERT_TRUE(std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->CanReceive(ReceiverGroup::Panel));
+  ASSERT_TRUE(std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->CanReceive(ReceiverGroup::LockScreen));
+  ASSERT_FALSE(std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->CanReceive(ReceiverGroup::Popup));
+}
+
+TEST_F(AbstractItemTest, SetGetOnGoingState) {
+  TestItem item("test_id");
+
+  ASSERT_EQ(item.GetOnGoingState(), false);
+
+  item.SetOnGoingState(true);
+
+  ASSERT_EQ(item.GetOnGoingState(), true);
+}
+
+int __fake_app_get_name(char** app_name) {
+  *app_name = strdup("unittest_appname");
+  return 0;
+}
+
+TEST_F(AbstractItemTest, SetGetFindMainType) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  auto root = std::make_shared<GroupItem>("test_group");
+  auto item = std::make_shared<ButtonItem>("test_id", "title");
+  root->AddChild(item);
+
+  bool ret = root->SetMainType("test_id", AbstractItem::MainButton);
+  EXPECT_TRUE(ret);
+  EXPECT_EQ(item->GetMainType(), AbstractItem::MainButton);
+  auto& i = root->FindByMainType(AbstractItem::MainButton);
+  EXPECT_EQ(i.GetId(), "test_id");
+}
+
+TEST_F(AbstractItemTest, SetInvalidMainType) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  auto root = std::make_shared<GroupItem>("test_group");
+  auto item = std::make_shared<ButtonItem>("test_id", "title");
+  root->AddChild(item);
+
+  bool ret = root->SetMainType("test_id", AbstractItem::MainTitle);
+  EXPECT_FALSE(ret);
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_app_control_action.cc b/tests/noti_ex_unittest/src/test_noti_ex_app_control_action.cc
new file mode 100644 (file)
index 0000000..70f53e1
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+
+#include "notification-ex/app_control_action.h"
+#include "notification-ex/action_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class AppControlActionTest : public TestFixture {
+ public:
+  AppControlActionTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  AppControlAction* action;
+  app_control_h app_control;
+  const char* app_id = "test_appid";
+  std::string extra = "appcontrol_extra";
+
+  virtual void SetUp() {
+    app_control_create(&app_control);
+    app_control_set_app_id(app_control, app_id);
+
+    action = new AppControlAction(app_control, extra);
+  }
+  virtual void TearDown() {
+    delete action;
+    app_control_destroy(app_control);
+  }
+};
+
+TEST_F(AppControlActionTest, create) {
+  EXPECT_NE(AppControlActionTest::action, nullptr);
+}
+
+TEST_F(AppControlActionTest, IsLocal) {
+  ASSERT_EQ(AppControlActionTest::action->IsLocal(), 1);
+}
+
+TEST_F(AppControlActionTest, GetExtra) {
+  ASSERT_EQ(AppControlActionTest::action->GetExtra(),
+    AppControlActionTest::extra);
+}
+
+TEST_F(AppControlActionTest, SerializeDeserialize) {
+  Bundle b = AppControlActionTest::action->Serialize();
+
+  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
+  ASSERT_EQ(gen_action->GetType(), AbstractAction::AppControl);
+
+  AppControlAction* gen_appcontrol_action =
+    static_cast<AppControlAction*>(gen_action.get());
+
+  char* app_id = nullptr;
+  app_control_get_app_id(gen_appcontrol_action->GetAppControl(), &app_id);
+  std::unique_ptr<char, decltype(std::free)*> ptr(app_id, std::free);
+  ASSERT_STREQ(app_id, AppControlActionTest::app_id);
+}
+
+TEST_F(AppControlActionTest, AppControl) {
+  app_control_h app_control;
+  const char* app_id = "new_appid";
+
+  app_control_create(&app_control);
+  app_control_set_app_id(app_control, app_id);
+  AppControlActionTest::action->SetAppControl(app_control);
+  app_control_destroy(app_control);
+
+  Bundle b = AppControlActionTest::action->Serialize();
+
+  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
+  AppControlAction* gen_appcontrol_action =
+    static_cast<AppControlAction*>(gen_action.get());
+
+  char* app_id_ = nullptr;
+  app_control_get_app_id(gen_appcontrol_action->GetAppControl(), &app_id_);
+  std::unique_ptr<char, decltype(std::free)*> ptr(app_id_, std::free);
+  EXPECT_STREQ(app_id, app_id_);
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_button_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_button_item.cc
new file mode 100644 (file)
index 0000000..7c39bf6
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019 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 <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/button_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+using namespace std;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class ButtonItemTest : public TestFixture {
+ public:
+  ButtonItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+ protected:
+  void SetUp() override {}
+  void TearDown() override {}
+};
+
+
+TEST_F(ButtonItemTest, FindByID) {
+  ButtonItem item("btn_id", "title");
+
+  AbstractItem& child = item.FindByID("btn_id");
+  ButtonItem& btn = static_cast<ButtonItem&>(child);
+  ASSERT_EQ(btn.GetTitle(), "title");
+}
+
+TEST_F(ButtonItemTest, FindByIDNullItemReturn) {
+  ButtonItem item("btn_id", "title");
+
+  AbstractItem& child = item.FindByID("not_exist_button");
+  ASSERT_EQ(child.GetType(), AbstractItem::NullObject);
+}
+
+TEST_F(ButtonItemTest, SerializeDeserializeGetTitle) {
+  ButtonItem item("title");
+  Bundle b = item.Serialize();
+  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(gen_item->GetType(), item.GetType());
+
+  auto gen_btn = std::static_pointer_cast<ButtonItem>(gen_item);
+  ASSERT_EQ(item.GetTitle(), gen_btn->GetTitle());
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_chat_message_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_chat_message_item.cc
new file mode 100644 (file)
index 0000000..aa0f9fb
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/smack_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/chat_message_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<SmackMock>,
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class ChatMessageItemTest : public TestFixture {
+ public:
+  ChatMessageItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  ChatMessageItem* item;
+  ChatMessageItem::Type type = ChatMessageItem::Type::user;
+  std::string id = "chatmessage_id";
+  time_t current_time;
+  virtual void SetUp() {
+    time(&current_time);
+
+    item = new ChatMessageItem(id,
+      std::make_shared<TextItem>("name_id", "name"),
+      std::make_shared<TextItem>("text_id", "text"),
+      std::make_shared<ImageItem>("image_id", "path"),
+      std::make_shared<TimeItem>(current_time),type);
+  }
+  virtual void TearDown() {
+    delete item;
+  }
+};
+
+TEST_F(ChatMessageItemTest, create) {
+  EXPECT_NE(ChatMessageItemTest::item, nullptr);
+}
+
+TEST_F(ChatMessageItemTest, FindByID) {
+  AbstractItem& child = ChatMessageItemTest::item->FindByID(ChatMessageItemTest::id);
+  ChatMessageItem& message = static_cast<ChatMessageItem&>(child);
+  ASSERT_EQ(message.GetNameItem().GetContents(), "name");
+  ASSERT_EQ(message.GetTextItem().GetContents(), "text");
+  ASSERT_EQ(message.GetImageItem().GetImagePath(), "path");
+  ASSERT_EQ(message.GetMessageType(), ChatMessageItemTest::type);
+}
+
+TEST_F(ChatMessageItemTest, FindByIDNullItemReturn) {
+  AbstractItem& child = ChatMessageItemTest::item->FindByID("not_existed_item");
+  ASSERT_EQ(child.GetType(), ChatMessageItem::NullObject);
+}
+
+TEST_F(ChatMessageItemTest, SerializeDeserialize) {
+  Bundle b = ChatMessageItemTest::item->Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  auto gen_message = std::static_pointer_cast<ChatMessageItem>(gen_item);
+  ASSERT_EQ(gen_message->GetNameItem().GetContents(), "name");
+  ASSERT_EQ(gen_message->GetTextItem().GetContents(), "text");
+  ASSERT_EQ(gen_message->GetImageItem().GetImagePath(), "path");
+  ASSERT_EQ(gen_message->GetTimeItem().GetTime(), ChatMessageItemTest::current_time);
+  ASSERT_EQ(gen_message->GetMessageType(), ChatMessageItemTest::type);
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_checkbox_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_checkbox_item.cc
new file mode 100644 (file)
index 0000000..e27f192
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/checkbox_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class CheckBoxItemTest : public TestFixture {
+ public:
+  CheckBoxItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  CheckBoxItem* item;
+  std::string id = "checkbox_id";
+  std::string title = "title";
+  bool isChecked = false;
+  virtual void SetUp() {
+    item = new CheckBoxItem(id, title, isChecked);
+  }
+  virtual void TearDown() {
+    delete item;
+  }
+};
+
+TEST_F(CheckBoxItemTest, create) {
+  EXPECT_NE(CheckBoxItemTest::item, nullptr);
+}
+
+TEST_F(CheckBoxItemTest, FindByID) {
+  AbstractItem& child = CheckBoxItemTest::item->FindByID(CheckBoxItemTest::id);
+  CheckBoxItem& checkbox = static_cast<CheckBoxItem&>(child);
+  ASSERT_EQ(checkbox.GetTitle(), CheckBoxItemTest::title);
+  ASSERT_EQ(checkbox.IsChecked(), CheckBoxItemTest::isChecked);
+}
+
+TEST_F(CheckBoxItemTest, FindByIDNullItemReturn) {
+  AbstractItem& child = CheckBoxItemTest::item->FindByID("not_existed_item");
+  ASSERT_EQ(child.GetType(), CheckBoxItem::NullObject);
+}
+
+TEST_F(CheckBoxItemTest, SerializeDeserialize) {
+  Bundle b = CheckBoxItemTest::item->Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(CheckBoxItemTest::item->GetType(), gen_item->GetType());
+
+  auto gen_checkbox = std::static_pointer_cast<CheckBoxItem>(gen_item);
+  ASSERT_EQ(CheckBoxItemTest::item->GetTitle(), gen_checkbox->GetTitle());
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_entry_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_entry_item.cc
new file mode 100644 (file)
index 0000000..6234c44
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/entry_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class EntryItemTest : public TestFixture {
+ public:
+  EntryItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  virtual void SetUp() {}
+  virtual void TearDown() {}
+};
+
+TEST_F(EntryItemTest, FindByID) {
+  EntryItem item("entry_id");
+
+  AbstractItem& child = item.FindByID("entry_id");
+  EntryItem& btn = static_cast<EntryItem&>(child);
+  ASSERT_EQ(btn.GetId(), "entry_id");
+}
+
+TEST_F(EntryItemTest, FindByIDNullItemReturn) {
+  EntryItem item("entry_id");
+
+  AbstractItem& child = item.FindByID("not_existed_item");
+  ASSERT_EQ(child.GetType(), EntryItem::NullObject);
+}
+
+TEST_F(EntryItemTest, SerializeDeserialize) {
+  EntryItem item("entry_id");
+
+  Bundle b = item.Serialize();
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(gen_item->GetType(), item.GetType());
+
+  auto gen_effect = std::static_pointer_cast<EntryItem>(gen_item);
+  ASSERT_EQ(item.GetId(), gen_effect->GetId());
+}
+
+TEST_F(EntryItemTest, SetTextGetText) {
+  EntryItem item("entry_id");
+  item.SetText("test");
+
+  ASSERT_EQ(item.GetText(), "test");
+}
+
+TEST_F(EntryItemTest, GetTextLimit) {
+  EntryItem item("entry_id");
+
+  ASSERT_EQ(item.GetTextLimit(), 160);
+}
\ No newline at end of file
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_event_info.cc b/tests/noti_ex_unittest/src/test_noti_ex_event_info.cc
new file mode 100644 (file)
index 0000000..91f5505
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2019 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 <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/event_info_internal.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace std;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class EventInfoTest : public TestFixture {
+ public:
+  EventInfoTest() : TestFixture(std::make_unique<::Mocks>()) {}
+ protected:
+  void SetUp() override {}
+  void TearDown() override {}
+};
+
+TEST_F(EventInfoTest, SerializeDeserialize) {
+  EventInfo info(EventInfo::Get, "test", "channel", "id");
+  Bundle b = info.Serialize();
+  EventInfo serialized(b);
+  ASSERT_EQ(serialized.GetEventType(), info.GetEventType());
+  ASSERT_EQ(serialized.GetOwner(), info.GetOwner());
+  ASSERT_EQ(serialized.GetChannel(), info.GetChannel());
+  ASSERT_EQ(serialized.GetItemId(), info.GetItemId());
+  ASSERT_EQ(serialized.GetUid(), info.GetUid());
+}
+
+TEST_F(EventInfoTest, GetString) {
+  ASSERT_EQ(EventInfo::GetString(EventInfo::Post), "Post");
+  ASSERT_EQ(EventInfo::GetString(EventInfo::Update), "Update");
+  ASSERT_EQ(EventInfo::GetString(EventInfo::Delete), "Delete");
+  ASSERT_EQ(EventInfo::GetString(EventInfo::Get), "Get");
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_group_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_group_item.cc
new file mode 100644 (file)
index 0000000..e00ae1f
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2019 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 <gmock/gmock.h>
+
+#include "notification-ex/group_item.h"
+#include "notification-ex/button_item.h"
+#include "notification-ex/text_item.h"
+#include "notification-ex/item_inflator.h"
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+using namespace std;
+
+using ::testing::_;
+using ::testing::Invoke;
+
+namespace {
+  int __fake_app_get_name(char** app_name) {
+    *app_name = strdup("unittest_appname");
+    return 0;
+  }
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class GroupItemTest : public TestFixture {
+ public:
+  GroupItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+ protected:
+  void SetUp() override {}
+  void TearDown() override {}
+};
+
+TEST_F(GroupItemTest, AddChild) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+  ASSERT_EQ(item.GetChildren().size(), 2);
+}
+
+TEST_F(GroupItemTest, RemoveChild) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+  ASSERT_EQ(item.GetChildren().size(), 2);
+
+  item.RemoveChild("btn1");
+  ASSERT_EQ(item.GetChildren().size(), 1);
+}
+
+TEST_F(GroupItemTest, SerializeDeserialize) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+
+  Bundle b = item.Serialize();
+  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(gen_item->GetType(), item.GetType());
+
+  auto gen_group = static_pointer_cast<GroupItem>(gen_item);
+  list<shared_ptr<AbstractItem>> gen_children_list = gen_group->GetChildren();
+  list<shared_ptr<AbstractItem>> origin_children_list = item.GetChildren();
+
+  list<shared_ptr<AbstractItem>>::iterator it = origin_children_list.begin();
+  for (auto& i : gen_children_list) {
+    ASSERT_EQ(i->GetType(), (*it)->GetType());
+    if (i->GetType() == AbstractItem::Button) {
+      ButtonItem* btn1 = static_cast<ButtonItem*>(i.get());
+      ButtonItem* btn2 = static_cast<ButtonItem*>((*it).get());
+      ASSERT_EQ(btn1->GetTitle(), btn2->GetTitle());
+    }
+    it++;
+  }
+  ASSERT_EQ(item.GetChildren().size(), 2);
+}
+
+TEST_F(GroupItemTest, FindByID) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+  ASSERT_EQ(item.GetChildren().size(), 2);
+
+  AbstractItem& child = item.FindByID("btn2");
+  ButtonItem& btn = static_cast<ButtonItem&>(child);
+  ASSERT_EQ(btn.GetTitle(), "test2");
+}
+
+TEST_F(GroupItemTest, FindByIDGroupItem) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  shared_ptr<GroupItem> gr2 = shared_ptr<GroupItem>(new GroupItem("GROUP2"));
+  shared_ptr<GroupItem> gr3 = shared_ptr<GroupItem>(new GroupItem("GROUP3"));
+  gr2->AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+  gr2->AddChild(std::make_shared<ButtonItem>("btn3", "test3"));
+  gr2->AddChild(std::make_shared<ButtonItem>("btn4", "test4"));
+  gr3->AddChild(std::make_shared<ButtonItem>("btn6", "test6"));
+  gr2->AddChild(gr3);
+
+  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+  item.AddChild(gr2);
+  item.AddChild(std::make_shared<ButtonItem>("btn5", "test5"));
+  ASSERT_EQ(item.GetChildren().size(), 3);
+
+  AbstractItem& child = item.FindByID("btn3");
+  ButtonItem& btn = static_cast<ButtonItem&>(child);
+  ASSERT_EQ(btn.GetTitle(), "test3");
+
+  AbstractItem& child2 = item.FindByID("GROUP3");
+  GroupItem& ret_gr = static_cast<GroupItem&>(child2);
+  ASSERT_EQ(ret_gr.GetChildren().size(), 1);
+}
+
+
+TEST_F(GroupItemTest, IsItemTypeExist) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  shared_ptr<GroupItem> gr2 = shared_ptr<GroupItem>(new GroupItem("GROUP2"));
+  shared_ptr<GroupItem> gr3 = shared_ptr<GroupItem>(new GroupItem("GROUP3"));
+  gr2->AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+  gr2->AddChild(std::make_shared<ButtonItem>("btn3", "test3"));
+  gr2->AddChild(std::make_shared<ButtonItem>("btn4", "test4"));
+  gr3->AddChild(std::make_shared<ButtonItem>("btn6", "test6"));
+  gr3->AddChild(std::make_shared<TextItem>("text1", "text1"));
+  gr2->AddChild(gr3);
+
+  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+  item.AddChild(gr2);
+  item.AddChild(std::make_shared<ButtonItem>("btn5", "test5"));
+  ASSERT_EQ(item.GetChildren().size(), 3);
+
+  ASSERT_EQ(item.IsItemTypeExist(AbstractItem::Text), true);
+  ASSERT_EQ(item.IsItemTypeExist(AbstractItem::Image), false);
+}
+
+TEST_F(GroupItemTest, FindByIDNullItemReturn) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
+  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
+  ASSERT_EQ(item.GetChildren().size(), 2);
+
+  AbstractItem& child = item.FindByID("not_exist_button");
+  ASSERT_EQ(child.GetType(), AbstractItem::NullObject);
+}
+
+TEST_F(GroupItemTest, GetAppLabel) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  string app_label = item.GetAppLabel();
+
+  ASSERT_EQ(app_label, "unittest_appname");
+}
+
+TEST_F(GroupItemTest, SetAppLabel) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  item.SetAppLabel("test");
+  string app_label = item.GetAppLabel();
+
+  ASSERT_EQ(app_label, "test");
+}
+
+TEST_F(GroupItemTest, SetDirection) {
+  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
+      .WillRepeatedly(Invoke(__fake_app_get_name));
+
+  GroupItem item("GROUP1");
+  item.SetDirection(true);
+
+  ASSERT_TRUE(item.IsVertical());
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_icon_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_icon_item.cc
new file mode 100644 (file)
index 0000000..0ca4010
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/smack_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/icon_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<SmackMock>,
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class IconItemTest : public TestFixture {
+ public:
+  IconItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  IconItem* item;
+  std::string id = "icon_id";
+  virtual void SetUp() {
+    item = new IconItem(id, "icon_path");
+  }
+  virtual void TearDown() {
+    delete item;
+  }
+};
+
+TEST_F(IconItemTest, create) {
+  EXPECT_NE(IconItemTest::item, nullptr);
+}
+
+TEST_F(IconItemTest, FindByID) {
+  AbstractItem& child = IconItemTest::item->FindByID(IconItemTest::id);
+  IconItem& icon = static_cast<IconItem&>(child);
+  ASSERT_EQ(icon.GetImagePath(), "icon_path");
+}
+
+TEST_F(IconItemTest, FindByIDNullItemReturn) {
+  AbstractItem& child = IconItemTest::item->FindByID("not_existed_item");
+  ASSERT_EQ(child.GetType(), IconItem::NullObject);
+}
+
+TEST_F(IconItemTest, SerializeDeserialize) {
+  Bundle b = IconItemTest::item->Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(IconItemTest::item->GetType(), gen_item->GetType());
+
+  auto gen_icon = std::static_pointer_cast<IconItem>(gen_item);
+  ASSERT_EQ(IconItemTest::item->GetImagePath(), gen_icon->GetImagePath());
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_image_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_image_item.cc
new file mode 100644 (file)
index 0000000..0aeb77e
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/smack_mock.hh"
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/image_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<SmackMock>,
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class ImageItemTest : public TestFixture {
+ public:
+  ImageItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  ImageItem* item;
+  std::string id = "image_id";
+  std::string imagePath = "image_path";
+  virtual void SetUp() {
+    item = new ImageItem(id, imagePath);
+  }
+  virtual void TearDown() {
+    delete item;
+  }
+};
+
+TEST_F(ImageItemTest, create) {
+  EXPECT_NE(ImageItemTest::item, nullptr);
+}
+
+TEST_F(ImageItemTest, FindByID) {
+  AbstractItem& child = ImageItemTest::item->FindByID(ImageItemTest::id);
+  ImageItem& image = static_cast<ImageItem&>(child);
+  ASSERT_EQ(image.GetImagePath(), ImageItemTest::imagePath);
+}
+
+TEST_F(ImageItemTest, FindByIDNullItemReturn) {
+  AbstractItem& child = ImageItemTest::item->FindByID("not_existed_item");
+  ASSERT_EQ(child.GetType(), ImageItem::NullObject);
+}
+
+TEST_F(ImageItemTest, SerializeDeserialize) {
+  Bundle b = ImageItemTest::item->Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(ImageItemTest::item->GetType(), gen_item->GetType());
+
+  auto gen_image = std::static_pointer_cast<ImageItem>(gen_item);
+  ASSERT_EQ(ImageItemTest::item->GetImagePath(), gen_image->GetImagePath());
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_input_selector_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_input_selector_item.cc
new file mode 100644 (file)
index 0000000..e8b2669
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2019 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 <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/input_selector_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+using namespace std;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class InputSelectorItemTest : public TestFixture {
+ public:
+  InputSelectorItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+ protected:
+  void SetUp() override {}
+  void TearDown() override {}
+};
+
+TEST_F(InputSelectorItemTest, SerializeDeserialize) {
+  InputSelectorItem item;
+  list<string> contents;
+  contents.push_back("AA");
+  contents.push_back("BB");
+  contents.push_back("CC");
+  item.SetContents(contents);
+
+  Bundle b = item.Serialize();
+  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(gen_item->GetType(), item.GetType());
+
+  auto gen_input = static_pointer_cast<InputSelectorItem>(gen_item);
+
+  list<string> l1 = item.GetContents();
+  list<string> l2 = gen_input->GetContents();
+  list<string>::iterator it1 = l1.begin();
+  list<string>::iterator it2 = l2.begin();
+  while(it1 != l1.end() && it2 != l2.end()) {
+    ASSERT_EQ((*it1), (*it2));
+    it1++;
+    it2++;
+  }
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_progress_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_progress_item.cc
new file mode 100644 (file)
index 0000000..0328ef3
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2019 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 <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/progress_item.h"
+#include "notification-ex/item_inflator.h"
+
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+using namespace std;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class ProgressItemTest : public TestFixture {
+ public:
+  ProgressItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+ protected:
+  void SetUp() override {}
+  void TearDown() override {}
+};
+
+TEST_F(ProgressItemTest, SerializeDeserializeGetTitle) {
+  ProgressItem item(1.0, 10.0, 100.0);
+  item.SetDefaultUnit("byte");
+  Bundle b = item.Serialize();
+  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+
+  auto gen_progress = std::static_pointer_cast<ProgressItem>(gen_item);
+  ASSERT_EQ(item.GetCurrent(), gen_progress->GetCurrent());
+  ASSERT_EQ(item.GetMin(), gen_progress->GetMin());
+  ASSERT_EQ(item.GetMax(), gen_progress->GetMax());
+  ASSERT_EQ(item.GetType(), gen_progress->GetType());
+  ASSERT_EQ(item.GetDefaultUnit(), gen_progress->GetDefaultUnit());
+
+  ASSERT_EQ(gen_progress->GetMin(), 1.0);
+  ASSERT_EQ(gen_progress->GetCurrent(), 10.0);
+  ASSERT_EQ(gen_progress->GetMax(), 100.0);
+  ASSERT_EQ(gen_progress->GetProgressType(), ProgressItem::Type::Default);
+  ASSERT_EQ(gen_progress->GetDefaultUnit(), "byte");
+}
+
+TEST_F(ProgressItemTest, SetGetProgressType) {
+  ProgressItem item(1.0, 10.0, 100.0);
+
+  ASSERT_EQ(item.GetProgressType(), ProgressItem::Type::Default);
+
+  item.SetProgressType(ProgressItem::Type::Pending);
+  ASSERT_EQ(item.GetProgressType(), ProgressItem::Type::Pending);
+}
+
+TEST_F(ProgressItemTest, SetGetUnit) {
+  ProgressItem item(1.0, 10.0, 100.0);
+  item.SetDefaultUnit("byte");
+
+  ASSERT_EQ(item.GetDefaultUnit(), "byte");
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_shared_file.cc b/tests/noti_ex_unittest/src/test_noti_ex_shared_file.cc
new file mode 100644 (file)
index 0000000..edbd6e7
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/shared_file.h"
+#include "notification-ex/image_item.h"
+#include "notification-ex/common.h"
+
+#include "mock/glib_mock.hh"
+#include "mock/smack_mock.hh"
+#include "mock/tzplatform_config_mock.hh"
+#include "mock/security_manager_mock.hh"
+#include "mock/aul_mock.hh"
+
+
+using namespace notification;
+using namespace notification::item;
+using namespace std;
+
+using ::testing::_;
+using ::testing::Invoke;
+
+namespace {
+
+// smack
+ssize_t __fake_smack_new_label_from_path(const char* path, const char* xattr,
+    int follow, char** label) {
+  *label = strdup("User::Pkg::unittest::RO");
+  return 1;
+}
+
+// tzplatform
+const char* __fake_tzplatform_getenv(tzplatform_variable id) {
+  return "/opt/usr/home/owner/apps_rw";
+}
+
+// security-manager
+int __fake_security_manager_private_sharing_req_new(private_sharing_req** pp_req) {
+  return 0;
+}
+
+int __fake_security_manager_private_sharing_req_add_paths(
+    private_sharing_req* p_req, const char** pp_paths, size_t count) {
+  return 0;
+}
+
+int __fake_security_manager_private_sharing_req_set_target_appid(
+    private_sharing_req* p_req, const char* appid) {
+  return 0;
+}
+
+int __fake_security_manager_private_sharing_apply(const private_sharing_req* p_req) {
+  return 0;
+}
+
+int __fake_security_manager_private_sharing_drop(const private_sharing_req* p_req) {
+  return 0;
+}
+
+class Mocks :
+    virtual public ::testing::NiceMock<GlibMock>,
+    virtual public ::testing::NiceMock<SmackMock>,
+    virtual public ::testing::NiceMock<TzplatformConfigMock>,
+    virtual public ::testing::NiceMock<SecurityManagerMock> {};
+} // namespace
+
+class SharedFileTest : public TestFixture {
+ public:
+  SharedFileTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  std::shared_ptr<ImageItem> item;
+  std::string id = "image_id";
+  std::string image_path = "res/image.png";
+
+  SharedFile* shared_file;
+
+  virtual void SetUp() {
+    item = make_shared<ImageItem>(id, image_path);
+    shared_file = new SharedFile();
+    item->SetSenderAppId("notification-ex_unittests");
+  }
+
+  virtual void TearDown() {
+  }
+};
+
+TEST_F(SharedFileTest, IsPrivatePath) {
+  EXPECT_CALL(GetMock<SmackMock>(), smack_new_label_from_path(_, _, _, _))
+      .WillRepeatedly(Invoke(__fake_smack_new_label_from_path));
+
+  ASSERT_TRUE(shared_file->IsPrivatePath(SharedFileTest::image_path));
+}
+
+TEST_F(SharedFileTest, GetDataPath) {
+  EXPECT_CALL(GetMock<TzplatformConfigMock>(), tzplatform_getenv(_))
+      .WillRepeatedly(Invoke(__fake_tzplatform_getenv));
+
+  ASSERT_EQ(shared_file->GetDataPath(item->GetSenderAppId(), SharedFileTest::image_path),
+    "/opt/usr/home/owner/apps_rw/notification-ex_unittests/data/.notification_ex/image.png");
+}
+
+TEST_F(SharedFileTest, SetPrivateSharing) {
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_req_new(_))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_new));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_req_add_paths(_, _, _))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_add_paths));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_req_set_target_appid(_, _))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_set_target_appid));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_apply(_))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_apply));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_drop(_))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_drop));
+
+  list<shared_ptr<item::AbstractItem>> notiList;
+  notiList.push_back(SharedFileTest::item);
+
+  std::multimap<std::string, std::string> map_;
+  map_.insert(make_pair("tizen.org/receiver/popup", "test_appid"));
+
+  ASSERT_EQ(shared_file->SetPrivateSharing(notiList, map_), ERROR_NONE);
+}
+
+TEST_F(SharedFileTest, RemovePrivateSharing) {
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_req_new(_))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_new));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_req_add_paths(_, _, _))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_add_paths));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_req_set_target_appid(_, _))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_set_target_appid));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_apply(_))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_apply));
+  EXPECT_CALL(GetMock<SecurityManagerMock>(),
+      security_manager_private_sharing_drop(_))
+      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_drop));
+
+  list<shared_ptr<item::AbstractItem>> notiList;
+  notiList.push_back(SharedFileTest::item);
+
+  std::multimap<std::string, std::string> map_;
+  map_.insert(make_pair("tizen.org/receiver/popup", "test_appid"));
+
+  ASSERT_EQ(shared_file->RemovePrivateSharing(notiList, map_), ERROR_NONE);
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_text_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_text_item.cc
new file mode 100644 (file)
index 0000000..744a230
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/text_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class TexttItemTest : public TestFixture {
+ public:
+  TexttItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  virtual void SetUp() {
+  }
+  virtual void TearDown() {
+  }
+};
+
+TEST_F(TexttItemTest, FindByID) {
+  TextItem item("text_id", "contents", "hyperlink");
+
+  AbstractItem& child = item.FindByID("text_id");
+  TextItem& btn = static_cast<TextItem&>(child);
+  ASSERT_EQ(btn.GetContents(), "contents");
+}
+
+TEST_F(TexttItemTest, FindByIDNullItemReturn) {
+  TextItem item("text_id", "contents", "hyperlink");
+
+  AbstractItem& child = item.FindByID("not_existed_item");
+  ASSERT_EQ(child.GetType(), TextItem::NullObject);
+}
+
+TEST_F(TexttItemTest, SerializeDeserializeGetContents) {
+  TextItem item("text_id", "contents");
+  Bundle b = item.Serialize();
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(gen_item->GetType(), item.GetType());
+
+  auto gen_text = std::static_pointer_cast<TextItem>(gen_item);
+  ASSERT_EQ(item.GetContents(), gen_text->GetContents());
+}
+
+TEST_F(TexttItemTest, SetContentsGetContents) {
+  TextItem item("text_id", "contents");
+  ASSERT_EQ(item.GetContents(), "contents");
+
+  item.SetContents("changed");
+  ASSERT_EQ(item.GetContents(), "changed");
+}
+
+TEST_F(TexttItemTest, GetHyperLink) {
+  TextItem item("text_id", "contents");
+  ASSERT_TRUE(item.GetHyperLink().empty());
+
+  TextItem item2("text_id", "contents", "hyperlink2");
+  ASSERT_EQ(item2.GetHyperLink(), "hyperlink2");
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_time_item.cc b/tests/noti_ex_unittest/src/test_noti_ex_time_item.cc
new file mode 100644 (file)
index 0000000..94edabe
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/time_item.h"
+#include "notification-ex/item_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class TimeItemTest : public TestFixture {
+ public:
+  TimeItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  TimeItem* item;
+  time_t current_time;
+  std::string id = "time_id";
+  virtual void SetUp() {
+    time(&current_time);
+    item = new TimeItem(id, current_time);
+  }
+  virtual void TearDown() {
+    delete item;
+  }
+};
+
+TEST_F(TimeItemTest, create) {
+  EXPECT_NE(TimeItemTest::item, nullptr);
+}
+
+TEST_F(TimeItemTest, FindByID) {
+  AbstractItem& child = TimeItemTest::item->FindByID(TimeItemTest::id);
+  TimeItem& time_ = static_cast<TimeItem&>(child);
+  ASSERT_EQ(time_.GetTime(), TimeItemTest::current_time);
+}
+
+TEST_F(TimeItemTest, FindByIDNullItemReturn) {
+  AbstractItem& child = TimeItemTest::item->FindByID("not_existed_item");
+  ASSERT_EQ(child.GetType(), TimeItem::NullObject);
+}
+
+TEST_F(TimeItemTest, SerializeDeserialize) {
+  Bundle b = TimeItemTest::item->Serialize();
+
+  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
+  ASSERT_EQ(TimeItemTest::item->GetType(), gen_item->GetType());
+
+  auto gen_time = std::static_pointer_cast<TimeItem>(gen_item);
+  ASSERT_EQ(item->GetTime(), gen_time->GetTime());
+}
diff --git a/tests/noti_ex_unittest/src/test_noti_ex_visibility_action.cc b/tests/noti_ex_unittest/src/test_noti_ex_visibility_action.cc
new file mode 100644 (file)
index 0000000..d56e26d
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2019 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 <string>
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "mock/app_common_mock.hh"
+#include "mock/test_fixture.hh"
+#include "notification-ex/visibility_action.h"
+#include "notification-ex/action_inflator.h"
+
+using namespace tizen_base;
+using namespace notification;
+using namespace notification::item;
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class VisibilityActionTest : public TestFixture {
+ public:
+  VisibilityActionTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  VisibilityAction* visibility;
+  std::string id = "visibility_id";
+  std::string extra = "visibility_extra";
+  bool visible = true;
+
+  virtual void SetUp() {
+    visibility = new VisibilityAction(extra);
+    visibility->SetVisibility("visibility_id", visible);
+  }
+  virtual void TearDown() {
+    delete visibility;
+  }
+};
+
+TEST_F(VisibilityActionTest, create) {
+  EXPECT_NE(VisibilityActionTest::visibility, nullptr);
+}
+
+TEST_F(VisibilityActionTest, IsLocal) {
+  ASSERT_EQ(VisibilityActionTest::visibility->IsLocal(), 1);
+}
+
+TEST_F(VisibilityActionTest, GetExtra) {
+  ASSERT_EQ(VisibilityActionTest::visibility->GetExtra(),
+    VisibilityActionTest::extra);
+}
+
+TEST_F(VisibilityActionTest, SerializeDeserialize) {
+  Bundle b = VisibilityActionTest::visibility->Serialize();
+
+  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
+  ASSERT_EQ(gen_action->GetType(), AbstractAction::Visibility);
+
+  auto gen_visibility_action =
+    std::static_pointer_cast<VisibilityAction>(gen_action);
+  EXPECT_NE(gen_visibility_action, nullptr);
+  ASSERT_EQ(gen_visibility_action->IsLocal(), true);
+  ASSERT_EQ(gen_visibility_action->GetExtra(), VisibilityActionTest::extra);
+}
+
+TEST_F(VisibilityActionTest, SetVisibility) {
+  VisibilityActionTest::visibility->SetVisibility("test_id", true);
+  Bundle b = VisibilityActionTest::visibility->Serialize();
+
+  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
+  ASSERT_EQ(gen_action->GetType(), AbstractAction::Visibility);
+
+  auto gen_visibility_action =
+    std::static_pointer_cast<VisibilityAction>(gen_action);
+  EXPECT_NE(gen_visibility_action, nullptr);
+  ASSERT_EQ(gen_visibility_action->IsLocal(), true);
+  ASSERT_EQ(gen_visibility_action->GetExtra(), VisibilityActionTest::extra);
+}
diff --git a/tests/noti_unittest/CMakeLists.txt b/tests/noti_unittest/CMakeLists.txt
new file mode 100644 (file)
index 0000000..10bdf56
--- /dev/null
@@ -0,0 +1,57 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+PROJECT(notification_unittests C CXX)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(notification_unittests REQUIRED
+    dlog
+    dbus-1
+    gmock
+    capi-appfw-app-control
+    glib-2.0
+    gio-2.0
+    gio-unix-2.0
+    aul
+    security-manager
+    libtzplatform-config
+)
+
+FOREACH(flag ${notification_unittests_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+
+SET(INIT-SRCS ${CMAKE_SOURCE_DIR}/notification/src/notification_init.c)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/notification/src)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/notification/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../mock)
+
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../mock MOCK_SOURCES)
+AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/notification/src NOTIFICATION_SOURCES)
+
+LIST(REMOVE_ITEM NOTIFICATION_SOURCES ${INIT-SRCS})
+
+ADD_EXECUTABLE(${PROJECT_NAME}
+    ${SOURCES}
+    ${NOTIFICATION_SOURCES}
+    ${MOCK_SOURCES}
+)
+
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS}")
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${notification_unittests_LDFLAGS}
+    ${pkgs_LDFLAGS}
+    ${pkgs_LIBRARIES}
+    gmock
+    notification
+)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
diff --git a/tests/noti_unittest/src/test_main.cc b/tests/noti_unittest/src/test_main.cc
new file mode 100644 (file)
index 0000000..ad7ec6c
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+int main(int argc, char** argv) {
+  int ret = -1;
+
+  try {
+    testing::InitGoogleTest(&argc, argv);
+  } catch(...) {
+    std::cout << "Exception occurred" << std::endl;
+  }
+
+  try {
+    ret = RUN_ALL_TESTS();
+  } catch (const ::testing::internal::GoogleTestFailureException& e) {
+    ret = -1;
+    std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
+  }
+
+  return ret;
+}
diff --git a/tests/noti_unittest/src/test_noti_notification.cc b/tests/noti_unittest/src/test_noti_notification.cc
new file mode 100644 (file)
index 0000000..c61a690
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019 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 <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+#include "notification/include/notification.h"
+#include "mock/aul_mock.hh"
+#include "mock/test_fixture.hh"
+#include "mock/app_common_mock.hh"
+#include "mock/aul_mock.hh"
+
+namespace {
+class Mocks :
+    virtual public ::testing::NiceMock<AulMock>,
+    virtual public ::testing::NiceMock<AppCommonMock> {};
+} // namespace
+
+class NotificationTest : public TestFixture {
+ public:
+  NotificationTest() : TestFixture(std::make_unique<::Mocks>()) {}
+  virtual void SetUp() {
+  }
+  virtual void TearDown() {
+  }
+};
+
+TEST_F(NotificationTest, create) {
+  notification_h noti = nullptr;
+  noti = notification_create(NOTIFICATION_TYPE_NOTI);
+
+  //EXPECT_NE(noti, nullptr);
+  ASSERT_EQ(noti, nullptr);
+}
diff --git a/tests/unittest/CMakeLists.txt b/tests/unittest/CMakeLists.txt
deleted file mode 100644 (file)
index 58e266b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-PROJECT(notification-ex_unittests CXX)
-
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(notification-ex_unittests REQUIRED
-    dlog
-    gmock
-    capi-appfw-app-control
-    glib-2.0
-    gio-2.0
-    gio-unix-2.0
-    aul
-    security-manager
-    libtzplatform-config
-)
-
-FOREACH(flag ${notification-ex_unittests_CFLAGS})
-    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall")
-
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
-SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
-
-INCLUDE_DIRECTORIES(
-    ${CMAKE_SOURCE_DIR}/
-    ${CMAKE_SOURCE_DIR}/notification-ex/
-    ${CMAKE_SOURCE_DIR}/notification-ex/api
-    ${CMAKE_CURRENT_SOURCE_DIR}/../
-    ${CMAKE_CURRENT_SOURCE_DIR}/../mock
-)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../mock MOCK_SOURCES)
-AUX_SOURCE_DIRECTORY(${CMAKE_SOURCE_DIR}/notification-ex NOTIFICATION_EX_SOURCES)
-ADD_EXECUTABLE(${PROJECT_NAME}
-    ${SOURCES}
-    ${NOTIFICATION_EX_SOURCES}
-    ${MOCK_SOURCES}
-)
-
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${notification-ex_unittests_LDFLAGS}
-    ${pkgs_LDFLAGS}
-    ${pkgs_LIBRARIES}
-    gmock
-    notification-ex
-)
-
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
diff --git a/tests/unittest/src/test_main.cc b/tests/unittest/src/test_main.cc
deleted file mode 100644 (file)
index ad7ec6c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-int main(int argc, char** argv) {
-  int ret = -1;
-
-  try {
-    testing::InitGoogleTest(&argc, argv);
-  } catch(...) {
-    std::cout << "Exception occurred" << std::endl;
-  }
-
-  try {
-    ret = RUN_ALL_TESTS();
-  } catch (const ::testing::internal::GoogleTestFailureException& e) {
-    ret = -1;
-    std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
-  }
-
-  return ret;
-}
diff --git a/tests/unittest/src/test_noti_ex_abstract_item.cc b/tests/unittest/src/test_noti_ex_abstract_item.cc
deleted file mode 100644 (file)
index e9d8459..0000000
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-#include <app_control.h>
-#include <app_common.h>
-
-#include "notification-ex/item_inflator.h"
-#include "notification-ex/app_control_action.h"
-#include "notification-ex/item_info_internal.h"
-#include "notification-ex/iitem_factory.h"
-#include "notification-ex/factory_manager.h"
-#include "notification-ex/default_item_factory.h"
-#include "notification-ex/group_item.h"
-#include "notification-ex/button_item.h"
-
-#include "mock/test_fixture.h"
-#include "mock/smack_mock.h"
-#include "mock/app_common_mock.h"
-
-#define MY_ITEM_TYPE AbstractItem::Type::Custom + 1
-
-using namespace notification;
-using namespace tizen_base;
-using namespace notification::item;
-
-using ::testing::_;
-using ::testing::Invoke;
-
-namespace {
-class TestItem : public AbstractItem {
-  public:
-   TestItem(std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}))
-     : AbstractItem(action) {
-   }
-   TestItem(std::string id, std::shared_ptr<AbstractAction> action = std::shared_ptr<AbstractAction>({}))
-     : AbstractItem(id, action) {
-   }
-   virtual ~TestItem() {}
-
-  Bundle Serialize() const override {
-    Bundle b;
-    b = AbstractItem::Serialize();
-    return b;
-  }
-  void Deserialize(Bundle b) override {
-    AbstractItem::Deserialize(b);
-  }
-  AbstractItem& FindByID(std::string id) override {
-    return *this;
-  }
-  bool IsItemTypeExist(int type) {
-  if (GetType() == type)
-      return true;
-    return false;
-  }
-  int GetType() const override {
-    return MY_ITEM_TYPE;
-  }
-};
-
-class MyFactory : public IItemFactory {
- public:
-  MyFactory() {}
-  virtual ~MyFactory() {}
-
-  std::unique_ptr<AbstractItem> CreateItem(int type) override {
-    if (type == MY_ITEM_TYPE)
-      return std::unique_ptr<AbstractItem>(new TestItem(""));
-
-    return nullptr;
-  }
-};
-
-class Mocks :
-    virtual public ::testing::NiceMock<SmackMock>,
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class AbstractItemTest : public TestFixture {
- public:
-  AbstractItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-
-  virtual void SetUp() {
-    FactoryManager::GetInst().RegisterFactory(std::unique_ptr<IItemFactory>(new MyFactory()));
-  }
-  virtual void TearDown() {
-    FactoryManager::GetInst().RegisterFactory(std::unique_ptr<IItemFactory>(new DefaultItemFactory()));
-  }
-};
-
-TEST_F(AbstractItemTest, SerializeDeserialize) {
-  /* Serialize */
-  app_control_h app_control, app_control_1;
-  char* app_id = NULL;
-  time_t current_time;
-  Bundle extension_b;
-
-  app_control_create(&app_control);
-  app_control_set_app_id(app_control, "new_appid");
-  std::shared_ptr<AppControlAction> action = std::make_shared<AppControlAction>(app_control);
-  app_control_destroy(app_control);
-
-  app_control_create(&app_control_1);
-  app_control_set_app_id(app_control_1, "new_appid_1");
-  std::shared_ptr<AppControlAction> action_1 = std::make_shared<AppControlAction>(app_control_1);
-  app_control_destroy(app_control_1);
-
-  TestItem item("test_id", action);
-
-  std::shared_ptr<Color> color = std::make_shared<Color>(50, 100,150,200);
-  std::shared_ptr<Padding> padding = std::make_shared<Padding>(10, 20, 30, 40);
-  std::shared_ptr<Geometry> geometry = std::make_shared<Geometry>(110, 120, 130, 140);
-  std::shared_ptr<Color> bg_color = std::make_shared<Color>(71, 72, 73, 74);
-
-  item.SetStyle(std::make_shared<Style>(color, padding, geometry, bg_color, "bg path"));
-  item.SetVisible(false);
-  item.SetEnable(false);
-  item.AddReceiver("receiver_1");
-  item.AddReceiver("receiver_2");
-  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->AddHideViewer("hide_1");
-  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->AddHideViewer("hide_2");
-  item.SetPolicy(AbstractItem::Policy::OnBootClear);
-  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetVersion(3);
-  item.GetInfo()->SetHideTime(5);
-  item.GetInfo()->SetDeleteTime(9);
-  item.SetChannel("channel99");
-  item.SetSoundPath("soundpath");
-  item.SetVibrationPath("vibrationpath");
-  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetUid(3);
-  item.SetSenderAppId("sender");
-  item.SetTag("tag");
-
-  time(&current_time);
-  std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->SetTime(current_time);
-
-  std::shared_ptr<Color> color2 = std::make_shared<Color>(150, 160, 170, 180);
-  std::shared_ptr<LEDInfo> led = std::make_shared<LEDInfo>(color2);
-  led->SetOnPeriod(10);
-  led->SetOffPeriod(20);
-
-  item.SetLEDInfo(led);
-  item.SetOnGoingState(true);
-
-  extension_b.Add("test_key", "test_value");
-  item.SetExtensionData("extension_key", extension_b);
-
-  /* Deserialize */
-  Bundle b = item.Serialize();
-
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  TestItem* gen_test = static_cast<TestItem*>(gen_item.get());
-
-  ASSERT_EQ(gen_test->GetId(), "test_id");
-  ASSERT_EQ(gen_test->GetType(), MY_ITEM_TYPE);
-  ASSERT_EQ(std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetUid(), 3);
-  ASSERT_EQ(gen_test->GetEnable(), false);
-  ASSERT_EQ(gen_test->GetVisible(),false);
-  ASSERT_EQ(gen_test->GetPolicy(), AbstractItem::Policy::OnBootClear);
-  ASSERT_EQ(std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetVersion(), 3);
-  ASSERT_EQ(gen_test->GetInfo()->GetHideTime(), 5);
-  ASSERT_EQ(gen_test->GetInfo()->GetDeleteTime(), 9);
-  ASSERT_EQ(gen_test->GetChannel(), "channel99");
-  ASSERT_EQ(gen_test->GetSoundPath(), "soundpath");
-  ASSERT_EQ(gen_test->GetVibrationPath(), "vibrationpath");
-  ASSERT_EQ(gen_test->GetSenderAppId(), "sender");
-  ASSERT_EQ(gen_test->GetTag(), "tag");
-  ASSERT_EQ(gen_test->GetInfo()->GetTime(), current_time);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetLeft(), 10);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetTop(), 20);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetRight(), 30);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetBottom(), 40);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetAVal(), 50);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetRVal(), 100);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetGVal(), 150);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetBVal(), 200);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetX(), 110);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetY(), 120);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetWidth(), 130);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetHeight(), 140);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetAVal(), 71);
-  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetRVal(), 72);
-  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetGVal(), 73);
-  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor()->GetBVal(), 74);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundImage(), "bg path");
-
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetAVal(), 150);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetRVal(), 160);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetGVal(), 170);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetColor()->GetBVal(), 180);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetOnPeriod(), 10);
-  ASSERT_EQ(gen_test->GetLEDInfo()->GetOffPeriod(), 20);
-
-  std::list<std::string> receiver1 = item.GetReceiverList();
-  std::list<std::string> receiver2 = gen_test->GetReceiverList();
-
-  ASSERT_EQ(receiver1.size(), receiver2.size());
-
-  for (unsigned int i = 0; i < receiver1.size(); i++) {
-    ASSERT_EQ(receiver1.front(), receiver2.front());
-    receiver1.pop_front();
-    receiver2.pop_front();
-  }
-
-  std::list<std::string> hide1 =
-      std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->GetHideViewerList();
-  std::list<std::string> hide2 =
-      std::static_pointer_cast<IItemInfoInternal>(gen_test->GetInfo())->GetHideViewerList();
-
-  ASSERT_EQ(hide1.size(), hide2.size());
-
-  for (unsigned int i = 0; i < hide1.size(); i++) {
-    ASSERT_EQ(hide1.front(), hide2.front());
-    hide1.pop_front();
-    hide2.pop_front();
-  }
-
-  ASSERT_EQ(gen_test->GetAction()->GetType(), AbstractAction::Type::AppControl);
-
-  std::shared_ptr<AppControlAction> ac =
-      std::static_pointer_cast<AppControlAction>(gen_test->GetAction());
-  app_control_get_app_id(ac->GetAppControl(), &app_id);
-
-  ASSERT_STREQ(app_id, "new_appid");
-
-  item.SetAction(action_1);
-
-  b = item.Serialize();
-  gen_item = ItemInflator::Create(b);
-  gen_test = static_cast<TestItem*>(gen_item.get());
-
-  ac = std::static_pointer_cast<AppControlAction>(gen_test->GetAction());
-  app_control_get_app_id(ac->GetAppControl(), &app_id);
-
-  ASSERT_STREQ(app_id, "new_appid_1");
-  ASSERT_EQ(gen_test->GetOnGoingState(), true);
-
-  Bundle extension_b2 = gen_test->GetExtensionData("extension_key");
-  ASSERT_EQ(extension_b2.GetString("test_key"), "test_value");
-}
-
-TEST_F(AbstractItemTest, SerializeDeserialize2) {
-  /* Serialize */
-  TestItem item("test_id");
-
-  std::shared_ptr<Color> color = std::make_shared<Color>(50, 100,150,200);
-  std::shared_ptr<Padding> padding = std::make_shared<Padding>(10, 20, 30, 40);
-  std::shared_ptr<Geometry> geometry = std::make_shared<Geometry>(110, 120, 130, 140);
-
-  item.SetStyle(std::make_shared<Style>(color, padding, geometry, nullptr, ""));
-
-  /* Deserialize */
-  Bundle b = item.Serialize();
-
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  TestItem* gen_test = static_cast<TestItem*>(gen_item.get());
-
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetLeft(), 10);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetTop(), 20);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetRight(), 30);
-  ASSERT_EQ(gen_test->GetStyle()->GetPadding()->GetBottom(), 40);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetAVal(), 50);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetRVal(), 100);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetGVal(), 150);
-  ASSERT_EQ(gen_test->GetStyle()->GetColor()->GetBVal(), 200);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetX(), 110);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetY(), 120);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetWidth(), 130);
-  ASSERT_EQ(gen_test->GetStyle()->GetGeometry()->GetHeight(), 140);
-
-  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundColor(), nullptr);
-  ASSERT_EQ(gen_test->GetStyle()->GetBackgroundImage(), "");
-}
-
-TEST_F(AbstractItemTest, ItemInfoCanReceive) {
-  TestItem item("test_id");
-
-  item.AddReceiver(ReceiverGroup::Panel);
-  item.AddReceiver(ReceiverGroup::LockScreen);
-
-  ASSERT_TRUE(std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->CanReceive(ReceiverGroup::Panel));
-  ASSERT_TRUE(std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->CanReceive(ReceiverGroup::LockScreen));
-  ASSERT_FALSE(std::static_pointer_cast<IItemInfoInternal>(item.GetInfo())->CanReceive(ReceiverGroup::Popup));
-}
-
-TEST_F(AbstractItemTest, SetGetOnGoingState) {
-  TestItem item("test_id");
-
-  ASSERT_EQ(item.GetOnGoingState(), false);
-
-  item.SetOnGoingState(true);
-
-  ASSERT_EQ(item.GetOnGoingState(), true);
-}
-
-int __fake_app_get_name(char** app_name) {
-  *app_name = strdup("unittest_appname");
-  return 0;
-}
-
-TEST_F(AbstractItemTest, SetGetFindMainType) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  auto root = std::make_shared<GroupItem>("test_group");
-  auto item = std::make_shared<ButtonItem>("test_id", "title");
-  root->AddChild(item);
-
-  bool ret = root->SetMainType("test_id", AbstractItem::MainButton);
-  EXPECT_TRUE(ret);
-  EXPECT_EQ(item->GetMainType(), AbstractItem::MainButton);
-  auto& i = root->FindByMainType(AbstractItem::MainButton);
-  EXPECT_EQ(i.GetId(), "test_id");
-}
-
-TEST_F(AbstractItemTest, SetInvalidMainType) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  auto root = std::make_shared<GroupItem>("test_group");
-  auto item = std::make_shared<ButtonItem>("test_id", "title");
-  root->AddChild(item);
-
-  bool ret = root->SetMainType("test_id", AbstractItem::MainTitle);
-  EXPECT_FALSE(ret);
-}
diff --git a/tests/unittest/src/test_noti_ex_app_control_action.cc b/tests/unittest/src/test_noti_ex_app_control_action.cc
deleted file mode 100644 (file)
index 1bdd3c4..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-
-#include "notification-ex/app_control_action.h"
-#include "notification-ex/action_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class AppControlActionTest : public TestFixture {
- public:
-  AppControlActionTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  AppControlAction* action;
-  app_control_h app_control;
-  const char* app_id = "test_appid";
-  std::string extra = "appcontrol_extra";
-
-  virtual void SetUp() {
-    app_control_create(&app_control);
-    app_control_set_app_id(app_control, app_id);
-
-    action = new AppControlAction(app_control, extra);
-  }
-  virtual void TearDown() {
-    delete action;
-    app_control_destroy(app_control);
-  }
-};
-
-TEST_F(AppControlActionTest, create) {
-  EXPECT_NE(AppControlActionTest::action, nullptr);
-}
-
-TEST_F(AppControlActionTest, IsLocal) {
-  ASSERT_EQ(AppControlActionTest::action->IsLocal(), 1);
-}
-
-TEST_F(AppControlActionTest, GetExtra) {
-  ASSERT_EQ(AppControlActionTest::action->GetExtra(),
-    AppControlActionTest::extra);
-}
-
-TEST_F(AppControlActionTest, SerializeDeserialize) {
-  Bundle b = AppControlActionTest::action->Serialize();
-
-  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
-  ASSERT_EQ(gen_action->GetType(), AbstractAction::AppControl);
-
-  AppControlAction* gen_appcontrol_action =
-    static_cast<AppControlAction*>(gen_action.get());
-
-  char* app_id = nullptr;
-  app_control_get_app_id(gen_appcontrol_action->GetAppControl(), &app_id);
-  std::unique_ptr<char, decltype(std::free)*> ptr(app_id, std::free);
-  ASSERT_STREQ(app_id, AppControlActionTest::app_id);
-}
-
-TEST_F(AppControlActionTest, AppControl) {
-  app_control_h app_control;
-  const char* app_id = "new_appid";
-
-  app_control_create(&app_control);
-  app_control_set_app_id(app_control, app_id);
-  AppControlActionTest::action->SetAppControl(app_control);
-  app_control_destroy(app_control);
-
-  Bundle b = AppControlActionTest::action->Serialize();
-
-  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
-  AppControlAction* gen_appcontrol_action =
-    static_cast<AppControlAction*>(gen_action.get());
-
-  char* app_id_ = nullptr;
-  app_control_get_app_id(gen_appcontrol_action->GetAppControl(), &app_id_);
-  std::unique_ptr<char, decltype(std::free)*> ptr(app_id_, std::free);
-  EXPECT_STREQ(app_id, app_id_);
-}
diff --git a/tests/unittest/src/test_noti_ex_button_item.cc b/tests/unittest/src/test_noti_ex_button_item.cc
deleted file mode 100644 (file)
index edc1560..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/button_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-using namespace std;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class ButtonItemTest : public TestFixture {
- public:
-  ButtonItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-
-TEST_F(ButtonItemTest, FindByID) {
-  ButtonItem item("btn_id", "title");
-
-  AbstractItem& child = item.FindByID("btn_id");
-  ButtonItem& btn = static_cast<ButtonItem&>(child);
-  ASSERT_EQ(btn.GetTitle(), "title");
-}
-
-TEST_F(ButtonItemTest, FindByIDNullItemReturn) {
-  ButtonItem item("btn_id", "title");
-
-  AbstractItem& child = item.FindByID("not_exist_button");
-  ASSERT_EQ(child.GetType(), AbstractItem::NullObject);
-}
-
-TEST_F(ButtonItemTest, SerializeDeserializeGetTitle) {
-  ButtonItem item("title");
-  Bundle b = item.Serialize();
-  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(gen_item->GetType(), item.GetType());
-
-  auto gen_btn = std::static_pointer_cast<ButtonItem>(gen_item);
-  ASSERT_EQ(item.GetTitle(), gen_btn->GetTitle());
-}
diff --git a/tests/unittest/src/test_noti_ex_chat_message_item.cc b/tests/unittest/src/test_noti_ex_chat_message_item.cc
deleted file mode 100644 (file)
index e5b8772..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/smack_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/chat_message_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<SmackMock>,
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class ChatMessageItemTest : public TestFixture {
- public:
-  ChatMessageItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  ChatMessageItem* item;
-  ChatMessageItem::Type type = ChatMessageItem::Type::user;
-  std::string id = "chatmessage_id";
-  time_t current_time;
-  virtual void SetUp() {
-    time(&current_time);
-
-    item = new ChatMessageItem(id,
-      std::make_shared<TextItem>("name_id", "name"),
-      std::make_shared<TextItem>("text_id", "text"),
-      std::make_shared<ImageItem>("image_id", "path"),
-      std::make_shared<TimeItem>(current_time),type);
-  }
-  virtual void TearDown() {
-    delete item;
-  }
-};
-
-TEST_F(ChatMessageItemTest, create) {
-  EXPECT_NE(ChatMessageItemTest::item, nullptr);
-}
-
-TEST_F(ChatMessageItemTest, FindByID) {
-  AbstractItem& child = ChatMessageItemTest::item->FindByID(ChatMessageItemTest::id);
-  ChatMessageItem& message = static_cast<ChatMessageItem&>(child);
-  ASSERT_EQ(message.GetNameItem().GetContents(), "name");
-  ASSERT_EQ(message.GetTextItem().GetContents(), "text");
-  ASSERT_EQ(message.GetImageItem().GetImagePath(), "path");
-  ASSERT_EQ(message.GetMessageType(), ChatMessageItemTest::type);
-}
-
-TEST_F(ChatMessageItemTest, FindByIDNullItemReturn) {
-  AbstractItem& child = ChatMessageItemTest::item->FindByID("not_existed_item");
-  ASSERT_EQ(child.GetType(), ChatMessageItem::NullObject);
-}
-
-TEST_F(ChatMessageItemTest, SerializeDeserialize) {
-  Bundle b = ChatMessageItemTest::item->Serialize();
-
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  auto gen_message = std::static_pointer_cast<ChatMessageItem>(gen_item);
-  ASSERT_EQ(gen_message->GetNameItem().GetContents(), "name");
-  ASSERT_EQ(gen_message->GetTextItem().GetContents(), "text");
-  ASSERT_EQ(gen_message->GetImageItem().GetImagePath(), "path");
-  ASSERT_EQ(gen_message->GetTimeItem().GetTime(), ChatMessageItemTest::current_time);
-  ASSERT_EQ(gen_message->GetMessageType(), ChatMessageItemTest::type);
-}
diff --git a/tests/unittest/src/test_noti_ex_checkbox_item.cc b/tests/unittest/src/test_noti_ex_checkbox_item.cc
deleted file mode 100644 (file)
index a2f2a6a..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/checkbox_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class CheckBoxItemTest : public TestFixture {
- public:
-  CheckBoxItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  CheckBoxItem* item;
-  std::string id = "checkbox_id";
-  std::string title = "title";
-  bool isChecked = false;
-  virtual void SetUp() {
-    item = new CheckBoxItem(id, title, isChecked);
-  }
-  virtual void TearDown() {
-    delete item;
-  }
-};
-
-TEST_F(CheckBoxItemTest, create) {
-  EXPECT_NE(CheckBoxItemTest::item, nullptr);
-}
-
-TEST_F(CheckBoxItemTest, FindByID) {
-  AbstractItem& child = CheckBoxItemTest::item->FindByID(CheckBoxItemTest::id);
-  CheckBoxItem& checkbox = static_cast<CheckBoxItem&>(child);
-  ASSERT_EQ(checkbox.GetTitle(), CheckBoxItemTest::title);
-  ASSERT_EQ(checkbox.IsChecked(), CheckBoxItemTest::isChecked);
-}
-
-TEST_F(CheckBoxItemTest, FindByIDNullItemReturn) {
-  AbstractItem& child = CheckBoxItemTest::item->FindByID("not_existed_item");
-  ASSERT_EQ(child.GetType(), CheckBoxItem::NullObject);
-}
-
-TEST_F(CheckBoxItemTest, SerializeDeserialize) {
-  Bundle b = CheckBoxItemTest::item->Serialize();
-
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(CheckBoxItemTest::item->GetType(), gen_item->GetType());
-
-  auto gen_checkbox = std::static_pointer_cast<CheckBoxItem>(gen_item);
-  ASSERT_EQ(CheckBoxItemTest::item->GetTitle(), gen_checkbox->GetTitle());
-}
diff --git a/tests/unittest/src/test_noti_ex_entry_item.cc b/tests/unittest/src/test_noti_ex_entry_item.cc
deleted file mode 100644 (file)
index 869e25a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/entry_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class EntryItemTest : public TestFixture {
- public:
-  EntryItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  virtual void SetUp() {}
-  virtual void TearDown() {}
-};
-
-TEST_F(EntryItemTest, FindByID) {
-  EntryItem item("entry_id");
-
-  AbstractItem& child = item.FindByID("entry_id");
-  EntryItem& btn = static_cast<EntryItem&>(child);
-  ASSERT_EQ(btn.GetId(), "entry_id");
-}
-
-TEST_F(EntryItemTest, FindByIDNullItemReturn) {
-  EntryItem item("entry_id");
-
-  AbstractItem& child = item.FindByID("not_existed_item");
-  ASSERT_EQ(child.GetType(), EntryItem::NullObject);
-}
-
-TEST_F(EntryItemTest, SerializeDeserialize) {
-  EntryItem item("entry_id");
-
-  Bundle b = item.Serialize();
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(gen_item->GetType(), item.GetType());
-
-  auto gen_effect = std::static_pointer_cast<EntryItem>(gen_item);
-  ASSERT_EQ(item.GetId(), gen_effect->GetId());
-}
-
-TEST_F(EntryItemTest, SetTextGetText) {
-  EntryItem item("entry_id");
-  item.SetText("test");
-
-  ASSERT_EQ(item.GetText(), "test");
-}
-
-TEST_F(EntryItemTest, GetTextLimit) {
-  EntryItem item("entry_id");
-
-  ASSERT_EQ(item.GetTextLimit(), 160);
-}
\ No newline at end of file
diff --git a/tests/unittest/src/test_noti_ex_event_info.cc b/tests/unittest/src/test_noti_ex_event_info.cc
deleted file mode 100644 (file)
index c480953..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/event_info_internal.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace std;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class EventInfoTest : public TestFixture {
- public:
-  EventInfoTest() : TestFixture(std::make_unique<::Mocks>()) {}
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-TEST_F(EventInfoTest, SerializeDeserialize) {
-  EventInfo info(EventInfo::Get, "test", "channel", "id");
-  Bundle b = info.Serialize();
-  EventInfo serialized(b);
-  ASSERT_EQ(serialized.GetEventType(), info.GetEventType());
-  ASSERT_EQ(serialized.GetOwner(), info.GetOwner());
-  ASSERT_EQ(serialized.GetChannel(), info.GetChannel());
-  ASSERT_EQ(serialized.GetItemId(), info.GetItemId());
-  ASSERT_EQ(serialized.GetUid(), info.GetUid());
-}
-
-TEST_F(EventInfoTest, GetString) {
-  ASSERT_EQ(EventInfo::GetString(EventInfo::Post), "Post");
-  ASSERT_EQ(EventInfo::GetString(EventInfo::Update), "Update");
-  ASSERT_EQ(EventInfo::GetString(EventInfo::Delete), "Delete");
-  ASSERT_EQ(EventInfo::GetString(EventInfo::Get), "Get");
-}
diff --git a/tests/unittest/src/test_noti_ex_group_item.cc b/tests/unittest/src/test_noti_ex_group_item.cc
deleted file mode 100644 (file)
index 5a1dc89..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gmock/gmock.h>
-
-#include "notification-ex/group_item.h"
-#include "notification-ex/button_item.h"
-#include "notification-ex/text_item.h"
-#include "notification-ex/item_inflator.h"
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-using namespace std;
-
-using ::testing::_;
-using ::testing::Invoke;
-
-namespace {
-  int __fake_app_get_name(char** app_name) {
-    *app_name = strdup("unittest_appname");
-    return 0;
-  }
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class GroupItemTest : public TestFixture {
- public:
-  GroupItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-TEST_F(GroupItemTest, AddChild) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
-  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
-  ASSERT_EQ(item.GetChildren().size(), 2);
-}
-
-TEST_F(GroupItemTest, RemoveChild) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
-  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
-  ASSERT_EQ(item.GetChildren().size(), 2);
-
-  item.RemoveChild("btn1");
-  ASSERT_EQ(item.GetChildren().size(), 1);
-}
-
-TEST_F(GroupItemTest, SerializeDeserialize) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
-  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
-
-  Bundle b = item.Serialize();
-  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(gen_item->GetType(), item.GetType());
-
-  auto gen_group = static_pointer_cast<GroupItem>(gen_item);
-  list<shared_ptr<AbstractItem>> gen_children_list = gen_group->GetChildren();
-  list<shared_ptr<AbstractItem>> origin_children_list = item.GetChildren();
-
-  list<shared_ptr<AbstractItem>>::iterator it = origin_children_list.begin();
-  for (auto& i : gen_children_list) {
-    ASSERT_EQ(i->GetType(), (*it)->GetType());
-    if (i->GetType() == AbstractItem::Button) {
-      ButtonItem* btn1 = static_cast<ButtonItem*>(i.get());
-      ButtonItem* btn2 = static_cast<ButtonItem*>((*it).get());
-      ASSERT_EQ(btn1->GetTitle(), btn2->GetTitle());
-    }
-    it++;
-  }
-  ASSERT_EQ(item.GetChildren().size(), 2);
-}
-
-TEST_F(GroupItemTest, FindByID) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
-  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
-  ASSERT_EQ(item.GetChildren().size(), 2);
-
-  AbstractItem& child = item.FindByID("btn2");
-  ButtonItem& btn = static_cast<ButtonItem&>(child);
-  ASSERT_EQ(btn.GetTitle(), "test2");
-}
-
-TEST_F(GroupItemTest, FindByIDGroupItem) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  shared_ptr<GroupItem> gr2 = shared_ptr<GroupItem>(new GroupItem("GROUP2"));
-  shared_ptr<GroupItem> gr3 = shared_ptr<GroupItem>(new GroupItem("GROUP3"));
-  gr2->AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
-  gr2->AddChild(std::make_shared<ButtonItem>("btn3", "test3"));
-  gr2->AddChild(std::make_shared<ButtonItem>("btn4", "test4"));
-  gr3->AddChild(std::make_shared<ButtonItem>("btn6", "test6"));
-  gr2->AddChild(gr3);
-
-  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
-  item.AddChild(gr2);
-  item.AddChild(std::make_shared<ButtonItem>("btn5", "test5"));
-  ASSERT_EQ(item.GetChildren().size(), 3);
-
-  AbstractItem& child = item.FindByID("btn3");
-  ButtonItem& btn = static_cast<ButtonItem&>(child);
-  ASSERT_EQ(btn.GetTitle(), "test3");
-
-  AbstractItem& child2 = item.FindByID("GROUP3");
-  GroupItem& ret_gr = static_cast<GroupItem&>(child2);
-  ASSERT_EQ(ret_gr.GetChildren().size(), 1);
-}
-
-
-TEST_F(GroupItemTest, IsItemTypeExist) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  shared_ptr<GroupItem> gr2 = shared_ptr<GroupItem>(new GroupItem("GROUP2"));
-  shared_ptr<GroupItem> gr3 = shared_ptr<GroupItem>(new GroupItem("GROUP3"));
-  gr2->AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
-  gr2->AddChild(std::make_shared<ButtonItem>("btn3", "test3"));
-  gr2->AddChild(std::make_shared<ButtonItem>("btn4", "test4"));
-  gr3->AddChild(std::make_shared<ButtonItem>("btn6", "test6"));
-  gr3->AddChild(std::make_shared<TextItem>("text1", "text1"));
-  gr2->AddChild(gr3);
-
-  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
-  item.AddChild(gr2);
-  item.AddChild(std::make_shared<ButtonItem>("btn5", "test5"));
-  ASSERT_EQ(item.GetChildren().size(), 3);
-
-  ASSERT_EQ(item.IsItemTypeExist(AbstractItem::Text), true);
-  ASSERT_EQ(item.IsItemTypeExist(AbstractItem::Image), false);
-}
-
-TEST_F(GroupItemTest, FindByIDNullItemReturn) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  item.AddChild(std::make_shared<ButtonItem>("btn1", "test1"));
-  item.AddChild(std::make_shared<ButtonItem>("btn2", "test2"));
-  ASSERT_EQ(item.GetChildren().size(), 2);
-
-  AbstractItem& child = item.FindByID("not_exist_button");
-  ASSERT_EQ(child.GetType(), AbstractItem::NullObject);
-}
-
-TEST_F(GroupItemTest, GetAppLabel) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  string app_label = item.GetAppLabel();
-
-  ASSERT_EQ(app_label, "unittest_appname");
-}
-
-TEST_F(GroupItemTest, SetAppLabel) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  item.SetAppLabel("test");
-  string app_label = item.GetAppLabel();
-
-  ASSERT_EQ(app_label, "test");
-}
-
-TEST_F(GroupItemTest, SetDirection) {
-  EXPECT_CALL(GetMock<AppCommonMock>(), app_get_name(_))
-      .WillRepeatedly(Invoke(__fake_app_get_name));
-
-  GroupItem item("GROUP1");
-  item.SetDirection(true);
-
-  ASSERT_TRUE(item.IsVertical());
-}
diff --git a/tests/unittest/src/test_noti_ex_icon_item.cc b/tests/unittest/src/test_noti_ex_icon_item.cc
deleted file mode 100644 (file)
index 5925d3c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/smack_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/icon_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<SmackMock>,
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class IconItemTest : public TestFixture {
- public:
-  IconItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  IconItem* item;
-  std::string id = "icon_id";
-  virtual void SetUp() {
-    item = new IconItem(id, "icon_path");
-  }
-  virtual void TearDown() {
-    delete item;
-  }
-};
-
-TEST_F(IconItemTest, create) {
-  EXPECT_NE(IconItemTest::item, nullptr);
-}
-
-TEST_F(IconItemTest, FindByID) {
-  AbstractItem& child = IconItemTest::item->FindByID(IconItemTest::id);
-  IconItem& icon = static_cast<IconItem&>(child);
-  ASSERT_EQ(icon.GetImagePath(), "icon_path");
-}
-
-TEST_F(IconItemTest, FindByIDNullItemReturn) {
-  AbstractItem& child = IconItemTest::item->FindByID("not_existed_item");
-  ASSERT_EQ(child.GetType(), IconItem::NullObject);
-}
-
-TEST_F(IconItemTest, SerializeDeserialize) {
-  Bundle b = IconItemTest::item->Serialize();
-
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(IconItemTest::item->GetType(), gen_item->GetType());
-
-  auto gen_icon = std::static_pointer_cast<IconItem>(gen_item);
-  ASSERT_EQ(IconItemTest::item->GetImagePath(), gen_icon->GetImagePath());
-}
diff --git a/tests/unittest/src/test_noti_ex_image_item.cc b/tests/unittest/src/test_noti_ex_image_item.cc
deleted file mode 100644 (file)
index 63968cb..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/smack_mock.h"
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/image_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<SmackMock>,
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class ImageItemTest : public TestFixture {
- public:
-  ImageItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  ImageItem* item;
-  std::string id = "image_id";
-  std::string imagePath = "image_path";
-  virtual void SetUp() {
-    item = new ImageItem(id, imagePath);
-  }
-  virtual void TearDown() {
-    delete item;
-  }
-};
-
-TEST_F(ImageItemTest, create) {
-  EXPECT_NE(ImageItemTest::item, nullptr);
-}
-
-TEST_F(ImageItemTest, FindByID) {
-  AbstractItem& child = ImageItemTest::item->FindByID(ImageItemTest::id);
-  ImageItem& image = static_cast<ImageItem&>(child);
-  ASSERT_EQ(image.GetImagePath(), ImageItemTest::imagePath);
-}
-
-TEST_F(ImageItemTest, FindByIDNullItemReturn) {
-  AbstractItem& child = ImageItemTest::item->FindByID("not_existed_item");
-  ASSERT_EQ(child.GetType(), ImageItem::NullObject);
-}
-
-TEST_F(ImageItemTest, SerializeDeserialize) {
-  Bundle b = ImageItemTest::item->Serialize();
-
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(ImageItemTest::item->GetType(), gen_item->GetType());
-
-  auto gen_image = std::static_pointer_cast<ImageItem>(gen_item);
-  ASSERT_EQ(ImageItemTest::item->GetImagePath(), gen_image->GetImagePath());
-}
diff --git a/tests/unittest/src/test_noti_ex_input_selector_item.cc b/tests/unittest/src/test_noti_ex_input_selector_item.cc
deleted file mode 100644 (file)
index 2e13a6e..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/input_selector_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-using namespace std;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class InputSelectorItemTest : public TestFixture {
- public:
-  InputSelectorItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-TEST_F(InputSelectorItemTest, SerializeDeserialize) {
-  InputSelectorItem item;
-  list<string> contents;
-  contents.push_back("AA");
-  contents.push_back("BB");
-  contents.push_back("CC");
-  item.SetContents(contents);
-
-  Bundle b = item.Serialize();
-  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(gen_item->GetType(), item.GetType());
-
-  auto gen_input = static_pointer_cast<InputSelectorItem>(gen_item);
-
-  list<string> l1 = item.GetContents();
-  list<string> l2 = gen_input->GetContents();
-  list<string>::iterator it1 = l1.begin();
-  list<string>::iterator it2 = l2.begin();
-  while(it1 != l1.end() && it2 != l2.end()) {
-    ASSERT_EQ((*it1), (*it2));
-    it1++;
-    it2++;
-  }
-}
diff --git a/tests/unittest/src/test_noti_ex_progress_item.cc b/tests/unittest/src/test_noti_ex_progress_item.cc
deleted file mode 100644 (file)
index 348e0c5..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/progress_item.h"
-#include "notification-ex/item_inflator.h"
-
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-using namespace std;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class ProgressItemTest : public TestFixture {
- public:
-  ProgressItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
- protected:
-  void SetUp() override {}
-  void TearDown() override {}
-};
-
-TEST_F(ProgressItemTest, SerializeDeserializeGetTitle) {
-  ProgressItem item(1.0, 10.0, 100.0);
-  item.SetDefaultUnit("byte");
-  Bundle b = item.Serialize();
-  shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-
-  auto gen_progress = std::static_pointer_cast<ProgressItem>(gen_item);
-  ASSERT_EQ(item.GetCurrent(), gen_progress->GetCurrent());
-  ASSERT_EQ(item.GetMin(), gen_progress->GetMin());
-  ASSERT_EQ(item.GetMax(), gen_progress->GetMax());
-  ASSERT_EQ(item.GetType(), gen_progress->GetType());
-  ASSERT_EQ(item.GetDefaultUnit(), gen_progress->GetDefaultUnit());
-
-  ASSERT_EQ(gen_progress->GetMin(), 1.0);
-  ASSERT_EQ(gen_progress->GetCurrent(), 10.0);
-  ASSERT_EQ(gen_progress->GetMax(), 100.0);
-  ASSERT_EQ(gen_progress->GetProgressType(), ProgressItem::Type::Default);
-  ASSERT_EQ(gen_progress->GetDefaultUnit(), "byte");
-}
-
-TEST_F(ProgressItemTest, SetGetProgressType) {
-  ProgressItem item(1.0, 10.0, 100.0);
-
-  ASSERT_EQ(item.GetProgressType(), ProgressItem::Type::Default);
-
-  item.SetProgressType(ProgressItem::Type::Pending);
-  ASSERT_EQ(item.GetProgressType(), ProgressItem::Type::Pending);
-}
-
-TEST_F(ProgressItemTest, SetGetUnit) {
-  ProgressItem item(1.0, 10.0, 100.0);
-  item.SetDefaultUnit("byte");
-
-  ASSERT_EQ(item.GetDefaultUnit(), "byte");
-}
diff --git a/tests/unittest/src/test_noti_ex_shared_file.cc b/tests/unittest/src/test_noti_ex_shared_file.cc
deleted file mode 100644 (file)
index 2b58335..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/shared_file.h"
-#include "notification-ex/image_item.h"
-#include "notification-ex/common.h"
-
-#include "mock/glib_mock.h"
-#include "mock/smack_mock.h"
-#include "mock/tzplatform_config_mock.h"
-#include "mock/security_manager_mock.h"
-
-
-using namespace notification;
-using namespace notification::item;
-using namespace std;
-
-using ::testing::_;
-using ::testing::Invoke;
-
-namespace {
-
-// smack
-ssize_t __fake_smack_new_label_from_path(const char* path, const char* xattr,
-    int follow, char** label) {
-  *label = strdup("User::Pkg::unittest::RO");
-  return 1;
-}
-
-// tzplatform
-const char* __fake_tzplatform_getenv(tzplatform_variable id) {
-  return "/opt/usr/home/owner/apps_rw";
-}
-
-// security-manager
-int __fake_security_manager_private_sharing_req_new(private_sharing_req** pp_req) {
-  return 0;
-}
-
-int __fake_security_manager_private_sharing_req_add_paths(
-    private_sharing_req* p_req, const char** pp_paths, size_t count) {
-  return 0;
-}
-
-int __fake_security_manager_private_sharing_req_set_target_appid(
-    private_sharing_req* p_req, const char* appid) {
-  return 0;
-}
-
-int __fake_security_manager_private_sharing_apply(const private_sharing_req* p_req) {
-  return 0;
-}
-
-int __fake_security_manager_private_sharing_drop(const private_sharing_req* p_req) {
-  return 0;
-}
-
-class Mocks :
-    virtual public ::testing::NiceMock<GlibMock>,
-    virtual public ::testing::NiceMock<SmackMock>,
-    virtual public ::testing::NiceMock<TzplatformConfigMock>,
-    virtual public ::testing::NiceMock<SecurityManagerMock> {};
-} // namespace
-
-class SharedFileTest : public TestFixture {
- public:
-  SharedFileTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  std::shared_ptr<ImageItem> item;
-  std::string id = "image_id";
-  std::string image_path = "res/image.png";
-
-  SharedFile* shared_file;
-
-  virtual void SetUp() {
-    item = make_shared<ImageItem>(id, image_path);
-    shared_file = new SharedFile();
-  }
-
-  virtual void TearDown() {
-  }
-};
-
-TEST_F(SharedFileTest, IsPrivatePath) {
-  EXPECT_CALL(GetMock<SmackMock>(), smack_new_label_from_path(_, _, _, _))
-      .WillRepeatedly(Invoke(__fake_smack_new_label_from_path));
-
-  ASSERT_TRUE(shared_file->IsPrivatePath(SharedFileTest::image_path));
-}
-
-TEST_F(SharedFileTest, GetDataPath) {
-  EXPECT_CALL(GetMock<TzplatformConfigMock>(), tzplatform_getenv(_))
-      .WillRepeatedly(Invoke(__fake_tzplatform_getenv));
-
-  ASSERT_EQ(shared_file->GetDataPath(item->GetSenderAppId(), SharedFileTest::image_path),
-    "/opt/usr/home/owner/apps_rw/notification-ex_unittests/data/.notification_ex/image.png");
-}
-
-TEST_F(SharedFileTest, SetPrivateSharing) {
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_req_new(_))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_new));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_req_add_paths(_, _, _))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_add_paths));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_req_set_target_appid(_, _))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_set_target_appid));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_apply(_))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_apply));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_drop(_))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_drop));
-
-  list<shared_ptr<item::AbstractItem>> notiList;
-  notiList.push_back(SharedFileTest::item);
-
-  std::multimap<std::string, std::string> map_;
-  map_.insert(make_pair("tizen.org/receiver/popup", "test_appid"));
-
-  ASSERT_EQ(shared_file->SetPrivateSharing(notiList, map_), ERROR_NONE);
-}
-
-TEST_F(SharedFileTest, RemovePrivateSharing) {
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_req_new(_))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_new));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_req_add_paths(_, _, _))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_add_paths));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_req_set_target_appid(_, _))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_req_set_target_appid));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_apply(_))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_apply));
-  EXPECT_CALL(GetMock<SecurityManagerMock>(),
-      security_manager_private_sharing_drop(_))
-      .WillRepeatedly(Invoke(__fake_security_manager_private_sharing_drop));
-
-  list<shared_ptr<item::AbstractItem>> notiList;
-  notiList.push_back(SharedFileTest::item);
-
-  std::multimap<std::string, std::string> map_;
-  map_.insert(make_pair("tizen.org/receiver/popup", "test_appid"));
-
-  ASSERT_EQ(shared_file->RemovePrivateSharing(notiList, map_), ERROR_NONE);
-}
diff --git a/tests/unittest/src/test_noti_ex_text_item.cc b/tests/unittest/src/test_noti_ex_text_item.cc
deleted file mode 100644 (file)
index 7f5c318..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/text_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class TexttItemTest : public TestFixture {
- public:
-  TexttItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  virtual void SetUp() {
-  }
-  virtual void TearDown() {
-  }
-};
-
-TEST_F(TexttItemTest, FindByID) {
-  TextItem item("text_id", "contents", "hyperlink");
-
-  AbstractItem& child = item.FindByID("text_id");
-  TextItem& btn = static_cast<TextItem&>(child);
-  ASSERT_EQ(btn.GetContents(), "contents");
-}
-
-TEST_F(TexttItemTest, FindByIDNullItemReturn) {
-  TextItem item("text_id", "contents", "hyperlink");
-
-  AbstractItem& child = item.FindByID("not_existed_item");
-  ASSERT_EQ(child.GetType(), TextItem::NullObject);
-}
-
-TEST_F(TexttItemTest, SerializeDeserializeGetContents) {
-  TextItem item("text_id", "contents");
-  Bundle b = item.Serialize();
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(gen_item->GetType(), item.GetType());
-
-  auto gen_text = std::static_pointer_cast<TextItem>(gen_item);
-  ASSERT_EQ(item.GetContents(), gen_text->GetContents());
-}
-
-TEST_F(TexttItemTest, SetContentsGetContents) {
-  TextItem item("text_id", "contents");
-  ASSERT_EQ(item.GetContents(), "contents");
-
-  item.SetContents("changed");
-  ASSERT_EQ(item.GetContents(), "changed");
-}
-
-TEST_F(TexttItemTest, GetHyperLink) {
-  TextItem item("text_id", "contents");
-  ASSERT_TRUE(item.GetHyperLink().empty());
-
-  TextItem item2("text_id", "contents", "hyperlink2");
-  ASSERT_EQ(item2.GetHyperLink(), "hyperlink2");
-}
diff --git a/tests/unittest/src/test_noti_ex_time_item.cc b/tests/unittest/src/test_noti_ex_time_item.cc
deleted file mode 100644 (file)
index 1e5c29b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2019 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 <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/time_item.h"
-#include "notification-ex/item_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class TimeItemTest : public TestFixture {
- public:
-  TimeItemTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  TimeItem* item;
-  time_t current_time;
-  std::string id = "time_id";
-  virtual void SetUp() {
-    time(&current_time);
-    item = new TimeItem(id, current_time);
-  }
-  virtual void TearDown() {
-    delete item;
-  }
-};
-
-TEST_F(TimeItemTest, create) {
-  EXPECT_NE(TimeItemTest::item, nullptr);
-}
-
-TEST_F(TimeItemTest, FindByID) {
-  AbstractItem& child = TimeItemTest::item->FindByID(TimeItemTest::id);
-  TimeItem& time_ = static_cast<TimeItem&>(child);
-  ASSERT_EQ(time_.GetTime(), TimeItemTest::current_time);
-}
-
-TEST_F(TimeItemTest, FindByIDNullItemReturn) {
-  AbstractItem& child = TimeItemTest::item->FindByID("not_existed_item");
-  ASSERT_EQ(child.GetType(), TimeItem::NullObject);
-}
-
-TEST_F(TimeItemTest, SerializeDeserialize) {
-  Bundle b = TimeItemTest::item->Serialize();
-
-  std::shared_ptr<AbstractItem> gen_item = ItemInflator::Create(b);
-  ASSERT_EQ(TimeItemTest::item->GetType(), gen_item->GetType());
-
-  auto gen_time = std::static_pointer_cast<TimeItem>(gen_item);
-  ASSERT_EQ(item->GetTime(), gen_time->GetTime());
-}
diff --git a/tests/unittest/src/test_noti_ex_visibility_action.cc b/tests/unittest/src/test_noti_ex_visibility_action.cc
deleted file mode 100644 (file)
index 258d8e5..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2019 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 <string>
-
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include "mock/app_common_mock.h"
-#include "mock/test_fixture.h"
-#include "notification-ex/visibility_action.h"
-#include "notification-ex/action_inflator.h"
-
-using namespace tizen_base;
-using namespace notification;
-using namespace notification::item;
-
-namespace {
-class Mocks :
-    virtual public ::testing::NiceMock<AppCommonMock> {};
-} // namespace
-
-class VisibilityActionTest : public TestFixture {
- public:
-  VisibilityActionTest() : TestFixture(std::make_unique<::Mocks>()) {}
-  VisibilityAction* visibility;
-  std::string id = "visibility_id";
-  std::string extra = "visibility_extra";
-  bool visible = true;
-
-  virtual void SetUp() {
-    visibility = new VisibilityAction(extra);
-    visibility->SetVisibility("visibility_id", visible);
-  }
-  virtual void TearDown() {
-    delete visibility;
-  }
-};
-
-TEST_F(VisibilityActionTest, create) {
-  EXPECT_NE(VisibilityActionTest::visibility, nullptr);
-}
-
-TEST_F(VisibilityActionTest, IsLocal) {
-  ASSERT_EQ(VisibilityActionTest::visibility->IsLocal(), 1);
-}
-
-TEST_F(VisibilityActionTest, GetExtra) {
-  ASSERT_EQ(VisibilityActionTest::visibility->GetExtra(),
-    VisibilityActionTest::extra);
-}
-
-TEST_F(VisibilityActionTest, SerializeDeserialize) {
-  Bundle b = VisibilityActionTest::visibility->Serialize();
-
-  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
-  ASSERT_EQ(gen_action->GetType(), AbstractAction::Visibility);
-
-  auto gen_visibility_action =
-    std::static_pointer_cast<VisibilityAction>(gen_action);
-  EXPECT_NE(gen_visibility_action, nullptr);
-  ASSERT_EQ(gen_visibility_action->IsLocal(), true);
-  ASSERT_EQ(gen_visibility_action->GetExtra(), VisibilityActionTest::extra);
-}
-
-TEST_F(VisibilityActionTest, SetVisibility) {
-  VisibilityActionTest::visibility->SetVisibility("test_id", true);
-  Bundle b = VisibilityActionTest::visibility->Serialize();
-
-  std::shared_ptr<AbstractAction> gen_action = ActionInflator::Create(b);
-  ASSERT_EQ(gen_action->GetType(), AbstractAction::Visibility);
-
-  auto gen_visibility_action =
-    std::static_pointer_cast<VisibilityAction>(gen_action);
-  EXPECT_NE(gen_visibility_action, nullptr);
-  ASSERT_EQ(gen_visibility_action->IsLocal(), true);
-  ASSERT_EQ(gen_visibility_action->GetExtra(), VisibilityActionTest::extra);
-}