The aul_test tool is implemented using C++.
The testcases are separated from the aul_test.c file.
If the developer wants to add a new testcase, a new test file should
be added. The test class had to be derived from the AulTest class.
And, AUL_TEST_RESGITER() has to be called to add the testcase.
Change-Id: I98e6a56439c7cb8acc6a63021005b7a5b1927279
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
#include <pkgmgr-info.h>
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
#include "aul_util.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_PATH_LEN 1024
#define AUL_APP_INFO_FLD_PKG_NAME "package"
free(menu_info->app_path);
menu_info->app_path = NULL;
} else if (path_len > 0) {
- char *tmp_app_path = malloc(sizeof(char) * (path_len + 1));
+ char *tmp_app_path = (char *)malloc(
+ sizeof(char) * (path_len + 1));
if (tmp_app_path == NULL)
return NULL;
snprintf(tmp_app_path, path_len + 1, "%s", menu_info->app_path);
char *exec = NULL;
char *apptype = NULL;
- menu_info = calloc(1, sizeof(app_info_from_db));
+ menu_info = (app_info_from_db *)calloc(1, sizeof(app_info_from_db));
if (menu_info == NULL)
return NULL;
if (appid == NULL)
return NULL;
- menu_info = calloc(1, sizeof(app_info_from_db));
+ menu_info = (app_info_from_db *)calloc(1, sizeof(app_info_from_db));
if (menu_info == NULL)
return NULL;
return _get_app_info_from_db_by_appid_user(appid, GLOBAL_USER);
}
-
+#ifdef __cplusplus
+}
+#endif
SET(TARGET_AUL_TEST "aul_test")
-ADD_EXECUTABLE(${TARGET_AUL_TEST} ${CMAKE_CURRENT_SOURCE_DIR}/aul_test.c)
-SET_TARGET_PROPERTIES(${TARGET_AUL_TEST} PROPERTIES COMPILE_FLAGS ${CFLAGS} "-fPIE")
-SET_TARGET_PROPERTIES(${TARGET_AUL_TEST} PROPERTIES LINK_FLAGS "-pie")
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} AUL_TEST_SRCS)
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/tests TESTS_SRCS)
+
+ADD_EXECUTABLE(${TARGET_AUL_TEST}
+ ${AUL_TEST_SRCS}
+ ${TESTS_SRCS}
+)
+
+SET_TARGET_PROPERTIES(${TARGET_AUL_TEST} PROPERTIES
+ COMPILE_FLAGS ${CFLAGS} "-fPIE")
+SET_TARGET_PROPERTIES(${TARGET_AUL_TEST} PROPERTIES
+ LINK_FLAGS "-pie")
TARGET_LINK_LIBRARIES(${TARGET_AUL_TEST} PRIVATE ${TARGET_AUL})
-TARGET_INCLUDE_DIRECTORIES(${TARGET_AUL_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../src)
-TARGET_INCLUDE_DIRECTORIES(${TARGET_AUL_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include)
-TARGET_INCLUDE_DIRECTORIES(${TARGET_AUL_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../)
-TARGET_INCLUDE_DIRECTORIES(${TARGET_AUL_TEST} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../aul/api)
+TARGET_INCLUDE_DIRECTORIES(${TARGET_AUL_TEST} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../aul/api
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../include
+ ${CMAKE_CURRENT_SOURCE_DIR}/../../src
+)
INSTALL(TARGETS ${TARGET_AUL_TEST} DESTINATION bin)
+++ /dev/null
-/*
- * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <poll.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <glib.h>
-
-#include <bundle_internal.h>
-
-#include "aul.h"
-#include "aul/api/aul_app_lifecycle.h"
-#include "aul_svc.h"
-#include "aul_proc.h"
-#include "aul_proc_group.h"
-#include "menu_db_util.h"
-
-#define MAX_LOCAL_BUFSZ 128
-#define QUERY_LEN 10240
-
-static char **gargv;
-static int gargc;
-static char *cmd;
-static int apn_pid;
-static GMainLoop *mainloop = NULL;
-static status_listen_h listen_handle;
-
-typedef struct _test_func_t {
- char *name;
- int (*func) ();
- char *desc;
- char *usage;
-} test_func_t;
-
-static bundle *create_internal_bundle(int start)
-{
- bundle *kb;
- int i;
-
- kb = bundle_create();
- for (i = start; i < gargc - 1; i++) {
- if ((i + 1) > gargc - 1)
- bundle_add(kb, gargv[i], " ");
- else
- bundle_add(kb, gargv[i], gargv[i + 1]);
- }
-
- return kb;
-}
-
-int launch_test()
-{
- static int num = 0;
- int ret = 0;
- bundle *kb = NULL;
-
- kb = create_internal_bundle(3);
- if (kb == NULL)
- return -1;
-
- printf("[aul_launch_app %d test] %s \n", num++, gargv[2]);
-
- ret = aul_launch_app(gargv[2], kb);
-
- if (kb) {
- bundle_free(kb);
- kb = NULL;
- }
- return ret;
-}
-
-int launch_test_for_uid()
-{
- static int num = 0;
- int ret = 0;
- bundle *kb = NULL;
-
- kb = create_internal_bundle(3);
- if (kb == NULL)
- return -1;
-
- printf("[aul_launch_app %d test] %s \n", num++, gargv[2]);
-
- ret = aul_launch_app_for_uid(gargv[2], kb, atoi(gargv[3]));
-
- if (kb) {
- bundle_free(kb);
- kb = NULL;
- }
- return ret;
-}
-
-int dbus_launch_test()
-{
- bundle *kb = NULL;
- int ret = 0;
-
- kb = create_internal_bundle(3);
-
- if (kb == NULL)
- return -1;
-
- ret = aul_launch_app(gargv[2], kb);
-
- if (kb) {
- bundle_free(kb);
- kb = NULL;
- }
-
- return ret;
-}
-
-int open_test()
-{
- static int num = 0;
-
- printf("[aul_open_app %d test] %s \n", num++, gargv[2]);
- return aul_open_app(gargv[2]);
-}
-
-int resume_test()
-{
- static int num = 0;
-
- printf("[aul_open_app %d test] %s \n", num++, gargv[2]);
- return aul_resume_app(gargv[2]);
-}
-
-int resume_pid_test()
-{
- static int num = 0;
- printf("[aul_resume_pid %d test] %d \n", num++, apn_pid);
- return aul_resume_pid(apn_pid);
-}
-
-int term_pid_test()
-{
- static int num = 0;
- printf("[aul_term_pid %d test] %d \n", num++, apn_pid);
- return aul_terminate_pid(apn_pid);
-}
-
-int term_req_pid_test()
-{
- static int num = 0;
- printf("[aul_subapp_terminate_request_pid %d test] %d \n", num++, apn_pid);
- return aul_subapp_terminate_request_pid(apn_pid);
-}
-
-int term_pid_without_restart_test(void)
-{
- static int num = 0;
- printf("[aul_term_pid_without_restart %d test] %d \n", num++, apn_pid);
- return aul_terminate_pid_without_restart(apn_pid);
-}
-
-int term_bgapp_pid_test(void)
-{
- static int num = 0;
- printf("[aul_term_pid_without_restart %d test] %d \n", num++, apn_pid);
- return aul_terminate_bgapp_pid(apn_pid);
-}
-
-int pause_test(void)
-{
- static int num = 0;
-
- printf("[aul_pause_app %d test] %s \n", num++, gargv[2]);
- return aul_pause_app(gargv[2]);
-}
-
-int pause_pid_test(void)
-{
- static int num = 0;
-
- printf("[aul_pause_pid %d test] %d \n", num++, apn_pid);
- return aul_pause_pid(apn_pid);
-}
-
-static test_func_t scn_func[] = {
- {"n", launch_test, "launch_test", ""},
- {"n", launch_test, "launch_test", ""},
- {"n", resume_test, "open_test", ""},
- {"n", resume_test, "open_test", ""},
- {"p", resume_pid_test, "resume_pid_test", ""},
- {"p", resume_pid_test, "resume_pid_test", ""},
- {"p", term_pid_test, "term_pid_test", ""},
- {"n", resume_test, "open_test", ""},
- {"n", launch_test, "launch_test", ""}
-};
-
-int all_test()
-{
- static int pos = 0;
- int ret;
-
- if (pos > sizeof(scn_func) / sizeof(test_func_t) - 1) {
- printf("all internal test done\n");
- return 0;
- }
-
- if (strncmp(scn_func[pos].name, "n", 1) == 0) {
- printf("[test %d] %s , pkgname = %s\n", pos, scn_func[pos].desc,
- gargv[2]);
- apn_pid = scn_func[pos].func();
- printf("... return pid = %d\n", apn_pid);
- } else {
- printf("[test %d] %s , pid = %d\n", pos, scn_func[pos].desc,
- apn_pid);
- ret = scn_func[pos].func();
- printf("... return res = %d\n", ret);
- }
- pos++;
-
- return 0;
-}
-
-int is_run_test()
-{
- if (aul_app_is_running(gargv[2]))
- printf("... %s is running\n", gargv[2]);
- else
- printf("... %s is not running\n", gargv[2]);
-
- return 0;
-}
-
-int iterfunc(const aul_app_info *info, void *data)
-{
- printf("\t==========================\n");
- printf("\t appid: %s\n", info->appid);
- printf("\t app_path: %s\n", info->app_path);
- printf("\t running pid: %d\n", info->pid);
- printf("\t==========================\n");
-
- return 0;
-}
-
-int get_allpkg_test()
-{
- static int num = 0;
- printf("[aul_app_get_ruuning_app_info %d test] \n", num++);
- return aul_app_get_running_app_info(iterfunc, NULL);
-}
-
-int iterfunc_status(const aul_app_info *info, void *data)
-{
- printf("\t==========================\n");
- printf("\t pid: %d\n", info->pid);
- printf("\t appid: %s\n", info->appid);
- printf("\t app_path: %s\n", info->app_path);
- printf("\t pkgid: %s\n", info->pkgid);
- printf("\t status: %d\n", info->status);
- printf("\t is_sub_app : %d\n", info->is_sub_app);
- printf("\t==========================\n");
-
- return 0;
-}
-
-int get_all_app_test()
-{
- static int num = 0;
- printf("[aul_app_get_all_running_app_info %d test] \n", num++);
- return aul_app_get_all_running_app_info(iterfunc_status, NULL);
-}
-int get_app_bypid_test()
-{
- int pid = 0;
- static int num = 0;
- char buf[MAX_LOCAL_BUFSZ];
-
- printf("[aul_app_get_appid_bypid %d test] \n", num++);
- pid = atoi(gargv[2]);
-
- if (aul_app_get_appid_bypid(pid, buf, sizeof(buf)) < 0)
- printf("no such pkg by %d\n", pid);
- else
- printf("pkgname = %s, pid = %d\n", buf, pid);
-
- return 0;
-}
-
-int get_pkg_bypid_test()
-{
- int pid = 0;
- static int num = 0;
- char buf[MAX_LOCAL_BUFSZ];
-
- printf("[aul_app_get_pkgid_bypid %d test] \n", num++);
- pid = atoi(gargv[2]);
-
- if (aul_app_get_pkgid_bypid(pid, buf, sizeof(buf)) < 0)
- printf("no such pkg by %d\n", pid);
- else
- printf("pkgname = %s, pid = %d\n", buf, pid);
-
- return 0;
-}
-
-int open_file_test()
-{
- static int num = 0;
- printf("[aul_open_file %d test] %s \n", num++, gargv[2]);
- return aul_open_file(gargv[2]);
-}
-
-int open_content_test()
-{
- static int num = 0;
- printf("[aul_open_content %d test] %s \n", num++, gargv[2]);
- return aul_open_content(gargv[2]);
-}
-
-int get_defapp_test()
-{
- static int num = 0;
- int ret;
- char buf[MAX_LOCAL_BUFSZ];
- printf("[aul_get_defapp_from_mime %d test] %s \n", num++, gargv[2]);
- ret = aul_get_defapp_from_mime(gargv[2], buf, sizeof(buf));
- if (ret >= 0)
- printf("==> defapp name = %s\n", buf);
- return ret;
-}
-
-int set_defapp_test()
-{
- static int num = 0;
- int ret;
- printf("[aul_set_defapp_with_mime %d test] %s %s\n", num++, gargv[2],
- gargv[3]);
- ret = aul_set_defapp_with_mime(gargv[2], gargv[3]);
- return ret;
-}
-
-int get_mime_file_test()
-{
- static int num = 0;
- int ret;
- char buf[MAX_LOCAL_BUFSZ];
- printf("[aul_get_mime_from_file %d test] %s \n", num++, gargv[2]);
- ret = aul_get_mime_from_file(gargv[2], buf, sizeof(buf));
- if (ret >= 0)
- printf("==> mime type = %s\n", buf);
- return ret;
-}
-
-int get_mime_content_test()
-{
- static int num = 0;
- int ret;
- char buf[MAX_LOCAL_BUFSZ];
- printf("[aul_get_mime_from_content %d test] %s \n", num++, gargv[2]);
- ret = aul_get_mime_from_content(gargv[2], buf, sizeof(buf));
- if (ret >= 0)
- printf("==> mime type = %s\n", buf);
- return ret;
-}
-
-int aul_get_mime_icon_test()
-{
- int ret;
- char buf[MAX_LOCAL_BUFSZ];
- ret = aul_get_mime_icon(gargv[2], buf, sizeof(buf));
- if (ret >= 0)
- printf("==> mimetype %s : iconname = %s\n", gargv[2], buf);
- return ret;
-}
-
-int aul_get_mime_description_test()
-{
- int ret;
- char buf[MAX_LOCAL_BUFSZ];
- ret = aul_get_mime_description(gargv[2], buf, sizeof(buf));
- if (ret >= 0)
- printf("==> mimetype %s : description = %s\n", gargv[2], buf);
- return ret;
-}
-
-int aul_get_mime_extension_test()
-{
- int ret;
- char buf[MAX_LOCAL_BUFSZ];
- ret = aul_get_mime_extension(gargv[2], buf, sizeof(buf));
- if (ret >= 0)
- printf("==> mimetype %s : extension = %s\n", gargv[2], buf);
- return ret;
-}
-
-static void print_menu_db_info(const app_info_from_db *info)
-{
- if (info == NULL) {
- printf("pkg %s no found\n", gargv[2]);
- return;
- }
-
- printf("\t==========================\n");
- printf("\t appid: %s\n", info->appid);
- printf("\t app_path: %s\n", info->app_path);
- printf("\t is_minst: %d\n", 0);
- printf("\t==========================\n");
-}
-
-static int get_pkg_func()
-{
- app_info_from_db *info;
-
- info = _get_app_info_from_db_by_pkgname(gargv[2]);
- print_menu_db_info(info);
- if (info)
- _free_app_info_from_db(info);
-
- return 0;
-}
-
-static char *status_text[] = {
- "STATUS_LAUNCHING",
- "STATUS_CREATED",
- "STATUS_FOCUS",
- "STATUS_VISIBLE",
- "STATUS_BG",
- "STATUS_DYING",
- "STATUS_HOME",
- "STATUS_NORESTART",
- "STATUS_SERVICE",
-};
-
-static int get_status_pid()
-{
- int ret;
- ret = aul_app_get_status_bypid(apn_pid);
-
- printf("pid: %d status: %d ", apn_pid, ret);
- if (ret >= STATUS_LAUNCHING && ret <= STATUS_NORESTART)
- printf("(%s)", status_text[ret]);
-
- printf("\n");
-
- return 0;
-}
-
-static int get_pid()
-{
- static int num = 0;
-
- printf("[aul_app_get_pid %d test] %s \n", num++, gargv[2]);
- return aul_app_get_pid(gargv[2]);;
-}
-
-static int update_running_list()
-{
- aul_running_list_update(gargv[2], gargv[3], gargv[4]);
-
- return 0;
-}
-
-static int launch_async_test()
-{
- static int num = 0;
- int ret = 0;
- bundle *kb = NULL;
-
- kb = create_internal_bundle(3);
- if (kb == NULL)
- return -1;
-
- printf("[aul_launch_app_async %d test] %s \n", num++, gargv[2]);
-
- ret = aul_launch_app_async(gargv[2], kb);
-
- if (kb) {
- bundle_free(kb);
- kb = NULL;
- }
- return ret;
-}
-
-static int launch_async_test_for_uid()
-{
- static int num = 0;
- int ret = 0;
- bundle *kb = NULL;
-
- kb = create_internal_bundle(3);
- if (kb == NULL)
- return -1;
-
- printf("[aul_launch_app_async_for_uid %d test] %s \n", num++, gargv[2]);
-
- ret = aul_launch_app_async_for_uid(gargv[2], kb, atoi(gargv[3]));
-
- if (kb) {
- bundle_free(kb);
- kb = NULL;
- }
- return ret;
-}
-
-static int open_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_open_app_for_uid %d test] %s \n", num++, gargv[2]);
- return aul_open_app_for_uid(gargv[2], atoi(gargv[3]));
-}
-
-static int resume_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_resume_app_for_uid %d test] %s \n", num++, gargv[2]);
- return aul_resume_app_for_uid(gargv[2], atoi(gargv[3]));
-}
-
-static int resume_pid_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_resume_pid_for_uid %d test] %d \n", num++, apn_pid);
- return aul_resume_pid_for_uid(apn_pid, atoi(gargv[3]));
-}
-
-static int term_pid_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_terminate_pid_for_uid %d test] %d \n", num++, apn_pid);
- return aul_terminate_pid_for_uid(apn_pid, atoi(gargv[3]));
-}
-
-static int term_pid_async_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_terminate_pid_async_for_uid %d test] %d \n", num++, apn_pid);
- return aul_terminate_pid_async_for_uid(apn_pid, atoi(gargv[3]));
-}
-
-static int get_allpkg_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_app_get_running_app_info_for_uid %d test] \n", num++);
- return aul_app_get_running_app_info_for_uid(iterfunc, NULL, atoi(gargv[3]));
-}
-
-static int get_all_app_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_app_get_all_running_app_info_for_uid %d test] \n", num++);
- return aul_app_get_all_running_app_info_for_uid(iterfunc_status, NULL, atoi(gargv[2]));
-}
-
-static int get_status_pid_for_uid()
-{
- int ret;
-
- ret = aul_app_get_status_bypid_for_uid(apn_pid, atoi(gargv[3]));
-
- printf("pid: %d uid: %d status: %d", apn_pid, atoi(gargv[3]), ret);
- if (ret >= STATUS_LAUNCHING && ret <= STATUS_NORESTART)
- printf("(%s)", status_text[ret]);
- printf("\n");
-
- return 0;
-}
-
-static int get_pid_for_uid()
-{
- static int num = 0;
-
- printf("[aul_app_get_pid_for_uid %d test] %s \n", num++, gargv[2]);
- return aul_app_get_pid_for_uid(gargv[2], atoi(gargv[3]));
-}
-
-static int pause_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_pause_app_for_uid %d test] %s \n", num++, gargv[2]);
- return aul_pause_app_for_uid(gargv[2], atoi(gargv[3]));
-}
-
-static int pause_pid_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_pause_pid_for_uid %d test] %d \n", num++, apn_pid);
- return aul_pause_pid_for_uid(apn_pid, atoi(gargv[3]));
-}
-
-static int term_pid_sync_test()
-{
- static int num = 0;
-
- printf("[aul_terminate_pid_sync %d test] %d \n", num++, apn_pid);
- return aul_terminate_pid_sync(apn_pid);
-}
-
-static int term_pid_sync_test_for_uid()
-{
- static int num = 0;
-
- printf("[aul_terminate_pid_sync_for_uid %d test] %d \n", num++, apn_pid);
- return aul_terminate_pid_sync_for_uid(apn_pid, atoi(gargv[3]));
-}
-
-static int get_status_test(void)
-{
- static int num;
- int ret;
-
- printf("[aul_app_get_status %d test] %s \n", num++, gargv[2]);
-
- ret = aul_app_get_status(gargv[2]);
- printf("appid: %s, status: %d", gargv[2], ret);
- if (ret >= STATUS_LAUNCHING && ret <= STATUS_NORESTART)
- printf("(%s)", status_text[ret]);
- printf("\n");
-
- return 0;
-}
-
-static int get_status_test_for_uid(void)
-{
- static int num;
- int ret;
-
- printf("[aul_app_get_status %d test] %s \n", num++, gargv[2]);
-
- ret = aul_app_get_status_for_uid(gargv[2], atoi(gargv[3]));
- printf("appid: %s, uid: %d, status: %d", gargv[2], atoi(gargv[3]), ret);
- if (ret >= STATUS_LAUNCHING && ret <= STATUS_NORESTART)
- printf("(%s)", status_text[ret]);
- printf("\n");
-
- return 0;
-}
-
-static int get_last_caller_pid_test(void)
-{
- static int num;
-
- printf("[aul_app_get_last_caller_pid %d test] %d \n", num++, apn_pid);
- return aul_app_get_last_caller_pid(apn_pid);
-}
-
-static int get_last_caller_pid_test_for_uid(void)
-{
- static int num;
-
- printf("[aul_app_get_last_caller_pid_for_uid %d test] %d \n", num++, apn_pid);
- return aul_app_get_last_caller_pid_for_uid(apn_pid, atoi(gargv[3]));
-}
-
-static int resume_pid_async_test(void)
-{
- static int num;
-
- printf("aul_resume_pid_async %d test] %d \n", num++, apn_pid);
- return aul_resume_pid_async(apn_pid);
-}
-
-static int resume_pid_async_test_for_uid(void)
-{
- static int num;
-
- printf("aul_resume_pid_async_for_uid %d test] %d \n", num++, apn_pid);
- return aul_resume_pid_async_for_uid(apn_pid, atoi(gargv[3]));
-}
-
-static int app_status_handler(aul_app_info *info, int ctx_status, void *data)
-{
- printf("aul_listen_app_status: %s status: %d\n", info->appid, ctx_status);
- return 0;
-}
-
-static int listen_app_status(void)
-{
- static int num;
-
- printf("aul_listen_app_status %d test] %s \n", num++, gargv[2]);
- return aul_listen_app_status(gargv[2], app_status_handler, NULL, &listen_handle);
-}
-
-static int listen_app_status_for_uid_test(void)
-{
- static int num;
-
- printf("aul_listen_app_status %d test] %s \n", num++, gargv[2]);
- return aul_listen_app_status_for_uid(gargv[2], app_status_handler, NULL, &listen_handle, apn_pid);
-}
-
-static const char *__app_lifecycle_state_to_string(aul_app_lifecycle_state_e state)
-{
- switch (state) {
- case AUL_APP_LIFECYCLE_STATE_INITIALIZED:
- return "INITIALIZED";
- case AUL_APP_LIFECYCLE_STATE_CREATED:
- return "CREATED";
- case AUL_APP_LIFECYCLE_STATE_RESUMED:
- return "RESUMED";
- case AUL_APP_LIFECYCLE_STATE_PAUSED:
- return "PAUSED";
- default:
- return "DESTROYED";
- }
-}
-
-static void app_lifecycle_state_changed_cb(const char *app_id, pid_t pid, aul_app_lifecycle_state_e state, bool has_focus, void *user_data)
-{
- printf("app_id(%s), pid(%d), state(%s), has_focus(%s)\n",
- app_id, pid, __app_lifecycle_state_to_string(state),
- has_focus ? "true" : "false");
-}
-
-static int listen_app_lifecycle_test(void)
-{
- static int num;
-
- printf("aul_app_lifecycle_register_state_changed_cb %d test]\n", num++);
- return aul_app_lifecycle_register_state_changed_cb(app_lifecycle_state_changed_cb, NULL);
-}
-
-static int set_default_app_by_operation_test(void)
-{
- bundle* kb;
- int ret;
-
- if (gargc < 4) {
- fprintf(stderr, "[usage] set_default_app_by_operation <operation> <appid>\n");
- return -EINVAL;
- }
-
- printf("aul_set_default_app_by_operation test] %s %s\n",
- gargv[2], gargv[3]);
- kb = bundle_create();
- if (!kb) {
- fprintf(stderr, "bundle_create() is failed\n");
- return -ENOMEM;
- }
-
- aul_svc_set_operation(kb, gargv[2]);
- aul_svc_set_appid(kb, gargv[3]);
- ret = aul_set_default_app_by_operation(kb);
- bundle_free(kb);
- return ret;
-}
-
-static int get_default_app_test(void)
-{
- char *appid = NULL;
- bundle* kb;
- int ret;
-
- if (gargc < 3) {
- fprintf(stderr, "[usage] get_default_app <operation> <uri> <mime>\n");
- return -EINVAL;
- }
-
- printf("[aul_get_default_app test] %s %s %s\n",
- gargv[2], gargc > 3 ? gargv[3] : "null",
- gargc > 4 ? gargv[4] : "null");
- kb = bundle_create();
- if (!kb) {
- fprintf(stderr, "bundle_create() is failed\n");
- return -ENOMEM;
- }
-
- aul_svc_set_operation(kb, gargv[2]);
-
- if (gargc > 3)
- aul_svc_set_uri(kb, gargv[3]);
- if (gargc > 4)
- aul_svc_set_mime(kb, gargv[4]);
-
- ret = aul_get_default_app(kb, &appid);
- bundle_free(kb);
- printf("result: %s\n", appid);
- free(appid);
- return ret;
-}
-
-static const char *__get_string_from_lifecycle_state(
- aul_app_lifecycle_state_e state)
-{
- switch (state) {
- case AUL_APP_LIFECYCLE_STATE_INITIALIZED:
- return "INITIALIZED";
- case AUL_APP_LIFECYCLE_STATE_CREATED:
- return "CREATED";
- case AUL_APP_LIFECYCLE_STATE_RESUMED:
- return "RESUMED";
- case AUL_APP_LIFECYCLE_STATE_PAUSED:
- return "PAUSED";
- case AUL_APP_LIFECYCLE_STATE_DESTROYED:
- return "DESTROYED";
- default:
- return "UNKNOWN";
- }
-}
-
-static int get_app_lifecycle_test(void)
-{
- aul_app_lifecycle_state_e state;
- int ret;
-
- printf("[aul_app_lifecycle_get_state test] %s\n", gargv[2]);
- ret = aul_app_lifecycle_get_state(gargv[2], &state);
- printf("result: %d, state: %s\n",
- ret, __get_string_from_lifecycle_state(state));
- return ret;
-}
-
-static void __foreach_extra_cb(const char *key, const int type, const bundle_keyval_t *kb,
- void *user_data)
-{
- printf("key: %s, type:%d\n", key, type);
-}
-
-static int register_proc_test(void)
-{
- char *name = NULL;
- bundle *extra = NULL;
- int ret;
-
- if (gargc > 3)
- extra = create_internal_bundle(3);
-
- printf("[aul_proc_register] %s\n", gargv[2]);
- ret = aul_proc_register(gargv[2], extra);
- if (extra)
- bundle_free(extra);
- printf("result: %d\n", ret);
- if (ret != AUL_R_OK)
- return ret;
-
- printf("[aul_proc_get_name] %d\n", getpid());
- ret = aul_proc_get_name(getpid(), &name);
- printf("result: %d, name: %s\n", ret, name);
- free(name);
-
- extra = NULL;
- printf("[aul_proc_get_extra] %d\n", getpid());
- ret = aul_proc_get_extra(getpid(), &extra);
- printf("result:%d\n", ret);
- if (extra) {
- bundle_foreach(extra, __foreach_extra_cb, NULL);
- bundle_free(extra);
- }
-
- return ret;
-}
-
-static int get_proc_name_test(void)
-{
- char *name = NULL;
- int ret;
-
- printf("[aul_proc_get_name] %s\n", gargv[2]);
- ret = aul_proc_get_name(atoi(gargv[2]), &name);
- printf("result: %d, name: %s\n", ret, name);
- free(name);
- return ret;
-}
-
-static int get_proc_extra_test(void)
-{
- bundle* extra = NULL;
- int ret;
-
- printf("[aul_proc_get_extra] %s\n", gargv[2]);
- ret = aul_proc_get_extra(atoi(gargv[2]), &extra);
- printf("result: %d\n", ret);
- if (extra) {
- bundle_foreach(extra, __foreach_extra_cb, NULL);
- bundle_free(extra);
- }
-
- return ret;
-}
-
-static int add_proc_group_test(void)
-{
- int ret;
-
- printf("[aul_proc_group_add] %s\n", gargv[2]);
- ret = aul_proc_group_add(atoi(gargv[2]));
-
- return ret;
-}
-
-static int remove_proc_group_test(void)
-{
- int ret;
-
- printf("[aul_proc_group_remove] %s\n", gargv[2]);
- ret = aul_proc_group_remove(atoi(gargv[2]));
-
- return ret;
-}
-
-static int test_regex()
-{
- char *token;
- char mime[MAX_LOCAL_BUFSZ];
- char *saveptr;
-
- printf("=======================\n");
-
- token = strtok_r(gargv[2], " \t\n,.()", &saveptr);
- if (aul_get_mime_from_content(token, mime, sizeof(mime)) == AUL_R_OK)
- printf("found %s %s\n", mime, token);
-
- while (token) {
- token = strtok_r(NULL, " \t\n,()", &saveptr);
- if (aul_get_mime_from_content(token, mime, sizeof(mime)) ==
- AUL_R_OK)
- printf("found %s %s\n", mime, token);
- }
-
- return 0;
-}
-
-int reload_appinfo(void)
-{
- return aul_reload_appinfo();
-}
-
-static test_func_t test_func[] = {
- {"launch", launch_test, "aul_launch_app test",
- "[usage] launch <pkgname> <key1> <val1> <key2> <val2> ..."},
- {"launch_for_uid", launch_test_for_uid,
- "launch with uid test", "[usage] launch_for_uid <appid> <uid>"},
- {"open", open_test, "aul_open_app test",
- "[usage] open <pkgname>" },
- {"resume", resume_test, "aul_resume_app test",
- "[usage] resume <pkgname>" },
- {"resume_pid", resume_pid_test, "aul_resume_pid test",
- "[usage] resume_pid <pid>" },
- {"term_pid", term_pid_test, "aul_terminate_pid test",
- "[usage] term_pid <pid>" },
- {"term_req_pid", term_req_pid_test, "aul_subapp_terminate_request_pid test",
- "[usage] term_req_pid <pid>" },
- {"term_pid_without_restart", term_pid_without_restart_test, "aul_terminate_pid_without_restart test",
- "[usage] term_pid_without_restart <pid>" },
- {"term_bgapp", term_bgapp_pid_test, "aul_terminate_bgapp_pid test",
- "[usage] term_bgapp <pid>" },
- {"dbuslaunch", dbus_launch_test, "launch by dbus auto activation",
- "[usage] term_pid <pid>" },
- {"all", all_test, "test based on predefine scenario",
- "[usage] all <pkgname>"},
- {"is_run", is_run_test, "aul_is_running test",
- "[usage] is_run <pkgname>"},
- {"getallpkg", get_allpkg_test, "aul_app_get_running_app_info test",
- "[usage] getallpkg all"},
- {"getallappstatus", get_all_app_test, "aul_app_get_all_running_app_info test",
- "[usage] getallappstatus "},
- {"get_app_bypid", get_app_bypid_test, "aul_app_get_appid_bypid test",
- "[usage] get_app_bypid <pid>"},
- {"get_pkg_bypid", get_pkg_bypid_test, "aul_app_get_pkgid_bypid test",
- "[usage] get_pkg_bypid <pid>"},
- {"open_file", open_file_test, "aul_open_file test",
- "[usage] open_file <filename>"},
- {"open_content", open_content_test, "aul_open_content test",
- "[usage] open_content <content>"},
- {"get_defapp_mime", get_defapp_test, "aul_get_defapp_from_mime test",
- "[usage] get_defapp_mime <mime_type>"},
- {"set_defapp_mime", set_defapp_test, "aul_set_defapp_with_mime test",
- "[usage] set_defapp_mime <mime_type> <defapp to be set>"},
- {"get_mime_file", get_mime_file_test, "aul_get_mime_from_file test",
- "[usage] get_mime_file <filename>"},
- {"get_mime_content", get_mime_content_test, "aul_get_mime_from_content",
- "[usage] get_mime_content <content>"},
- {"get_mime_icon", aul_get_mime_icon_test, "aul_get_mime_icon test",
- "[usage] get_mime_icon <mimetype>"},
- {"get_mime_desc", aul_get_mime_description_test, "aul_get_mime_description test",
- "[usage] get_mime_desc <mimetype>"},
- {"get_mime_ext", aul_get_mime_extension_test, "aul_get_mime_extension test",
- "[usage] get_mime_ext <mimetype>"},
- {"test_regex", test_regex, "regular expression parser test",
- "[usage] test_regex <full text>"},
- {"getpkg", get_pkg_func, "get package",
- "[usage] getpkg <pkgname>"},
- {"pause", pause_test, "aul_pause_app test",
- "[usage] pause <pkgname>" },
- {"pause_pid", pause_pid_test, "aul_pause_pid test",
- "[usage] pause_pid <pid>" },
- {"update_list", update_running_list, "update running list",
- "[usage] update_list <appid> <app_path> <pid>"},
- {"reload", reload_appinfo, "reload appinfo table",
- "[usage] reload"},
- {"get_status_pid", get_status_pid, "aul_app_get_status_bypid test",
- "[usage] get_status_pid <pid>"},
- {"get_pid", get_pid, "aul_app_get_pid test",
- "[usage] get_pid <appid>"},
- {"launch_async", launch_async_test, "aul_launch_app_async test",
- "[usage] launch_async <appid> <key1> <val1> <key2> <val2> ..."},
- {"launch_async_for_uid", launch_async_test_for_uid, "aul_launch_app_async_for_uid test",
- "[usage] launch_async_for_uid <appid> <uid> <key1> <val1> <key2> <val2> ..."},
- {"open_for_uid", open_test_for_uid, "aul_open_app_for_uid test",
- "[usage] open_for_uid <appid> <uid>"},
- {"resume_for_uid", resume_test_for_uid, "aul_resume_app_for_uid test",
- "[usage] resume_for_uid <appid> <uid>"},
- {"resume_pid_for_uid", resume_pid_test_for_uid, "aul_resume_pid_for_uid test",
- "[usage] resume_pid_for_uid <pid> <uid>"},
- {"term_pid_for_uid", term_pid_test_for_uid, "aul_terminate_pid_for_uid test",
- "[usage] term_pid_for_uid <pid> <uid>"},
- {"term_pid_async_for_uid", term_pid_async_test_for_uid, "aul_terminate_pid_async_for_uid test",
- "[usage] term_pid_async_for_uid <pid> <uid>"},
- {"getallpkg_for_uid", get_allpkg_test_for_uid, "aul_app_get_running_app_info_for_uid test",
- "[usage] getallpkg_for_uid all <uid>"},
- {"getallappstatus_for_uid", get_all_app_test_for_uid, "aul_app_get_all_running_app_info_for_uid test",
- "[usage] getallappstatus_for_uid <uid>"},
- {"get_status_pid_for_uid", get_status_pid_for_uid, "aul_app_get_status_bypid_for_uid test",
- "[usage] get_status_pid_for_uid <pid> <uid>"},
- {"get_pid_for_uid", get_pid_for_uid, "aul_app_get_pid_for_uid test",
- "[usage] get_pid_for_uid <appid> <uid>"},
- {"pause_for_uid", pause_test_for_uid, "aul_pause_app_for_uid test",
- "[usage] pasue_for_uid <appid> <uid>"},
- {"pause_pid_for_uid", pause_pid_test_for_uid, "aul_pause_pid_for_uid test",
- "[usage] pause_pid_for_uid <pid> <uid>"},
- {"term_pid_sync", term_pid_sync_test, "aul_terminate_pid_sync test",
- "[usage] term_pid_sync <pid>"},
- {"term_pid_sync_for_uid", term_pid_sync_test_for_uid, "aul_terminate_pid_sync_for_uid test",
- "[usage] term_pid_sync_for_uid <pid> <uid>"},
- {"get_status", get_status_test, "aul_app_get_status test",
- "[usage] get_status <appid>"},
- {"get_status_for_uid", get_status_test_for_uid, "aul_app_get_status_for_uid test",
- "[usage] get_status_for_uid <appid> <uid>"},
- {"get_last_caller_pid", get_last_caller_pid_test, "aul_app_get_last_caller_pid test",
- "[usage] get_last_caller_pid <pid>"},
- {"get_last_caller_pid_for_uid", get_last_caller_pid_test_for_uid, "aul_app_get_last_caller_pid_for_uid test",
- "[usage] get_last_caller_pid_for_uid <pid> <uid"},
- {"resume_pid_async", resume_pid_async_test, "aul_resume_pid_async",
- "[usage] resume_pid_async <pid>"},
- {"resume_pid_async_for_uid", resume_pid_async_test_for_uid, "aul_resume_pid_async_for_uid",
- "[usage] resume_pid_async_for_uid <pid> <uid>"},
- {"listen_app_status", listen_app_status, "aul_listen_app_status",
- "[usage] listen_app_status <appid>"},
- {"listen_app_status_for_uid", listen_app_status_for_uid_test, "aul_listen_app_status_for_uid",
- "[usage] listen_app_status_for_uid <appid> <uid>"},
- {"listen_app_lifecycle", listen_app_lifecycle_test, "aul_app_lifecycle_register_state_changed_cb",
- "[usage] listen_app_lifecycle"},
- {"set_default_app_by_operation", set_default_app_by_operation_test, "aul_set_default_app_by_operation",
- "[usage] set_default_app_by_operation <operation> <appid>"},
- {"get_default_app", get_default_app_test, "aul_get_default_app",
- "[usage] get_default_appid <operation> <uri> <mime>"},
- {"get_app_lifecycle", get_app_lifecycle_test, "aul_app_lifecycle_get_state",
- "[usage] get_app_lifecycle <appid>"},
- {"register_proc", register_proc_test, "aul_proc_register",
- "[usage] register_proc <name> <key> <value> <key> <value> ..."},
- {"get_proc_name", get_proc_name_test, "aul_proc_get_name",
- "[usage] get_proc_name <pid>"},
- {"get_proc_extra", get_proc_extra_test, "aul_proc_get_extra",
- "[usage] get_proc_extra <pid>"},
- {"add_proc_group", add_proc_group_test, "aul_proc_group_add",
- "[usage] add_proc_group <pid>"},
- {"remove_proc_group", remove_proc_group_test, "aul_proc_group_remove",
- "[usage] remove_proc_group <pid>"},
-};
-
-int callfunc(char *testname)
-{
- test_func_t *tmp;
- int res;
- int i;
-
- for (i = 0; i < sizeof(test_func) / sizeof(test_func_t); i++) {
- tmp = &test_func[i];
- if (strcmp(testname, tmp->name) == 0) {
- res = tmp->func();
- if (strcmp(testname, "all")) {
- if (res < 0)
- printf("... test failed\n");
- else
- printf("... test successs ret = %d\n",
- res);
- }
- }
- }
- return 0;
-}
-
-int dead_tracker(int pid, void *data)
-{
- printf("[DEAD] pid = %d dead\n", pid);
- return 0;
-}
-
-void print_usage(char *progname)
-{
- test_func_t *tmp;
- int i;
-
- printf("[usage] %s <cmd> ...\n", progname);
- printf(" - available cmd list\n");
-
- for (i = 0; i < sizeof(test_func) / sizeof(test_func_t); i++) {
- tmp = &test_func[i];
- printf("\t%s : %s\n", tmp->name, tmp->desc);
- printf("\t\t%s\n", tmp->usage);
- }
-
- printf("[note] getpkg/setpkg/delpkg/init_defapp_mime/reload "
- "cmd is internal purpose\n");
-}
-
-static gboolean run_func(void *data)
-{
- callfunc(cmd);
-
- if (strcmp(cmd, "launch_res") == 0 ||
- strcmp(cmd, "all") == 0 ||
- strcmp(cmd, "dbuslaunch") == 0 ||
- strcmp(cmd, "listen_app_status") == 0 ||
- strcmp(cmd, "open_svc_res") == 0 ||
- strcmp(cmd, "listen_app_status") == 0 ||
- strcmp(cmd, "listen_app_lifecycle") == 0)
- return 0;
- else
- g_main_loop_quit(mainloop);
-
- return 0;
-}
-
-int main(int argc, char **argv)
-{
- if (argc < 2) {
- print_usage(argv[0]);
- exit(0);
- }
-
- cmd = argv[1];
- gargc = argc;
- gargv = argv;
- if (argv[2])
- apn_pid = atoi(argv[2]);
-
- aul_launch_init(NULL, NULL);
-
- /*aul_listen_app_dead_signal(dead_tracker,NULL); */
- /*aul_listen_app_dead_signal(NULL,NULL); */
-
- g_idle_add(run_func, NULL);
-
- mainloop = g_main_loop_new(NULL, FALSE);
- if (!mainloop) {
- printf("failed to create glib main loop\n");
- exit(EXIT_FAILURE);
- }
- g_main_loop_run(mainloop);
- g_main_loop_unref(mainloop);
-
- if (listen_handle)
- aul_ignore_app_status(listen_handle);
-
- return 0;
-}
-
-/* vi: set ts=8 sts=8 sw=8: */
-
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "aul_test.hh"
+
+#include <iostream>
+
+#include "log_private.hh"
+
+namespace aul_test {
+
+AulTest::AulTest(std::string test_name, std::string func_name,
+ std::string usage, bool loop_quit)
+ : test_name_(std::move(test_name)),
+ func_name_(std::move(func_name)),
+ usage_(std::move(usage)),
+ loop_quit_(loop_quit) {
+ AulTestMgr::GetInst().AddTest(test_name_, this);
+}
+
+void AulTest::Usage() {
+ _E("\t%s : %s test", test_name_.c_str(), func_name_.c_str());
+ _E("\t\t[usage] %s", usage_.c_str());
+}
+
+tizen_base::Bundle AulTest::CreateBundleFromArgv(int argc, char** argv,
+ int start) {
+ tizen_base::Bundle b;
+ for (int i = start; i < argc - 1; ++i) {
+ if ((i + 1) > argc - 1)
+ b.Add(std::string(argv[i]), " ");
+ else
+ b.Add(std::string(argv[i]), std::string(argv[i + 1]));
+ }
+
+ return b;
+}
+
+bool AulTest::LoopQuit() const {
+ return loop_quit_;
+}
+
+AulTestMgr::AulTestMgr() {
+ loop_ = g_main_loop_new(nullptr, FALSE);
+}
+
+AulTestMgr::~AulTestMgr() {
+ if (loop_) {
+ if (g_main_loop_is_running(loop_))
+ g_main_loop_quit(loop_);
+
+ g_main_loop_unref(loop_);
+ }
+}
+
+AulTestMgr& AulTestMgr::GetInst() {
+ static AulTestMgr inst;
+ return inst;
+}
+
+void AulTestMgr::AddTest(const std::string& test_name, AulTest* aul_test) {
+ tests_[test_name] = aul_test;
+}
+
+int AulTestMgr::RunTest(int argc, char** argv) {
+ if (argc < 2) {
+ PrintUsage();
+ return -1;
+ }
+
+ argc_ = argc;
+ argv_ = argv;
+ g_idle_add(IdleCb, this);
+ g_main_loop_run(loop_);
+ return result_;
+}
+
+void AulTestMgr::PrintUsage() {
+ for (auto const& iter : tests_) {
+ auto* test = iter.second;
+ test->Usage();
+ }
+}
+
+int AulTestMgr::RunTest() {
+ std::string cmd(argv_[1]);
+ auto found = tests_.find(cmd);
+ if (found == tests_.end()) {
+ PrintUsage();
+ g_main_loop_quit(loop_);
+ return -1;
+ }
+
+ auto* test = found->second;
+ test->SetUp();
+ int ret = test->Test(argc_, argv_);
+ test->TearDown();
+ if (ret < 0) {
+ _E("... test failed");
+ g_main_loop_quit(loop_);
+ } else {
+ _E("... test successful ret = %d", ret);
+ if (test->LoopQuit())
+ g_main_loop_quit(loop_);
+ }
+
+ return ret;
+}
+
+gboolean AulTestMgr::IdleCb(gpointer user_data) {
+ auto* mgr = static_cast<AulTestMgr*>(user_data);
+ mgr->result_ = mgr->RunTest();
+ return G_SOURCE_REMOVE;
+}
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AUL_TEST_AUL_TEST_HH_
+#define AUL_TEST_AUL_TEST_HH_
+
+#include <bundle_cpp.h>
+#include <bundle_internal.h>
+#include <glib.h>
+
+#include <map>
+#include <string>
+
+#include "aul_test_private.hh"
+
+namespace aul_test {
+
+class AulTest {
+ public:
+ explicit AulTest(std::string test_name, std::string func_name,
+ std::string usage, bool loop_quit = true);
+ virtual ~AulTest() = default;
+ virtual void SetUp() {}
+ virtual void TearDown() {}
+ virtual void Usage();
+ virtual int Test(int argc, char** argv) = 0;
+ tizen_base::Bundle CreateBundleFromArgv(int argc, char** argv, int start);
+ bool LoopQuit() const;
+
+ private:
+ std::string test_name_;
+ std::string func_name_;
+ std::string usage_;
+ bool loop_quit_;
+};
+
+class AulTestMgr {
+ private:
+ AulTestMgr();
+ ~AulTestMgr();
+
+ public:
+ static AulTestMgr& GetInst();
+
+ void AddTest(const std::string& test_name, AulTest* test);
+ int RunTest(int argc, char** argv);
+
+ private:
+ void PrintUsage();
+ int RunTest();
+ static gboolean IdleCb(gpointer user_data);
+
+ private:
+ std::map<std::string, AulTest*> tests_;
+ GMainLoop* loop_ = nullptr;
+ int argc_ = 0;
+ char** argv_ = nullptr;
+ int result_ = 0;
+};
+
+} // namespace aul_test
+
+#endif // AUL_TEST_AUL_TEST_HH_
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AUL_TEST_AUL_TEST_PRIVATE_HH_
+#define AUL_TEST_AUL_TEST_PRIVATE_HH_
+
+#define AUL_TEST_REGISTER(test_case_name, test_name) \
+ test_case_name test_name
+
+#endif // AUL_TEST_AUL_TEST_PRIVATE_HH_
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AUL_TEST_LOG_PRIVATE_HH_
+#define AUL_TEST_LOG_PRIVATE_HH_
+
+#include <stdio.h>
+
+#undef _E
+#define _E(fmt, arg...) fprintf(stderr, fmt "\n", ##arg)
+
+#undef _W
+#define _W(fmt, arg...) fprintf(stderr, fmt "\n", ##arg)
+
+#undef _I
+#define _I(fmt, arg...) fprintf(stdout, fmt "\n", ##arg)
+
+#undef _D
+#define _D(fmt, arg...) fprintf(stdout, fmt "\n", ##arg)
+
+#endif // AUL_TEST_LOG_PRIVATE_HH_
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+int main(int argc, char** argv) {
+ return aul_test::AulTestMgr::GetInst().RunTest(argc, argv);
+}
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetAllRunningAppInfoForUidTest : public AulTest {
+ public:
+ AulAppGetAllRunningAppInfoForUidTest()
+ : AulTest("getallappstatus_for_uid",
+ "aul_app_get_all_running_app_info_for_uid",
+ "getallappstatus_for_uid <uid>") {}
+
+ virtual ~AulAppGetAllRunningAppInfoForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_all_running_app_info_for_uid test] %s", argv[2]);
+ return aul_app_get_all_running_app_info_for_uid(AulAppInfoCb, nullptr,
+ atoi(argv[2]));
+ }
+
+ private:
+ static int AulAppInfoCb(const aul_app_info* info, void* user_data) {
+ _D("\t==========================");
+ _D("\t pid: %d", info->pid);
+ _D("\t appid: %s", info->appid);
+ _D("\t app_path: %s", info->app_path);
+ _D("\t pkgid: %s", info->pkgid);
+ _D("\t status: %d", info->status);
+ _D("\t is_sub_app: %d", info->is_sub_app);
+ _D("\t==========================");
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetAllRunningAppInfoForUidTest,
+ getallappstatus_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetAllRunningAppInfoTest : public AulTest {
+ public:
+ AulAppGetAllRunningAppInfoTest()
+ : AulTest("getallappstatus", "aul_app_get_all_running_app_info",
+ "getallappstatus") {}
+
+ virtual ~AulAppGetAllRunningAppInfoTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ _D("[aul_app_get_all_running_app_info test]");
+ return aul_app_get_all_running_app_info(AulAppInfoCb, nullptr);
+ }
+
+ private:
+ static int AulAppInfoCb(const aul_app_info* info, void* user_data) {
+ _D("\t==========================");
+ _D("\t pid: %d", info->pid);
+ _D("\t appid: %s", info->appid);
+ _D("\t app_path: %s", info->app_path);
+ _D("\t pkgid: %s", info->pkgid);
+ _D("\t status: %d", info->status);
+ _D("\t is_sub_app: %d", info->is_sub_app);
+ _D("\t==========================");
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetAllRunningAppInfoTest, getallappstatus_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetAppidBypidTest : public AulTest {
+ public:
+ AulAppGetAppidBypidTest()
+ : AulTest("get_app_bypid", "aul_app_get_appid_bypid",
+ "get_app_bypid <pid>") {}
+
+ virtual ~AulAppGetAppidBypidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_appid_bypid test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int pid = atoi(argv[2]);
+ if (aul_app_get_appid_bypid(pid, buf, sizeof(buf)) < 0)
+ _E("no such pkg by %d", pid);
+ else
+ _D("pkgname = %s, pid = %d", buf, pid);
+
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetAppidBypidTest, get_app_bypid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetLastCallerPidForUidTest : public AulTest {
+ public:
+ AulAppGetLastCallerPidForUidTest()
+ : AulTest("get_last_caller_pid_for_uid",
+ "aul_app_get_last_caller_pid_for_uid",
+ "get_last_caller_pid_for_uid <pid> <uid>") {}
+
+ virtual ~AulAppGetLastCallerPidForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_last_caller_pid_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_app_get_last_caller_pid_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetLastCallerPidForUidTest,
+ get_last_caller_pid_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetLastCallerPidTest : public AulTest {
+ public:
+ AulAppGetLastCallerPidTest()
+ : AulTest("get_last_caller_pid", "aul_app_get_last_caller_pid",
+ "get_last_caller_pid <pid>") {}
+
+ virtual ~AulAppGetLastCallerPidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_last_caller_pid test] %s", argv[2]);
+ return aul_app_get_last_caller_pid(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetLastCallerPidTest, get_last_caller_pid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetPidForUidTest : public AulTest {
+ public:
+ AulAppGetPidForUidTest()
+ : AulTest("get_pid_for_uid", "aul_app_get_pid_for_uid",
+ "get_pid_for_uid <appid> <uid>") {}
+
+ virtual ~AulAppGetPidForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_pid_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_app_get_pid_for_uid(argv[2], atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetPidForUidTest, get_pid_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetPidTest : public AulTest {
+ public:
+ AulAppGetPidTest()
+ : AulTest("get_pid", "aul_app_get_pid", "get_pid <appid>") {}
+
+ virtual ~AulAppGetPidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_pid test] %s", argv[2]);
+ return aul_app_get_pid(argv[2]);
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetPidTest, get_pid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetPkgidBypidTest : public AulTest {
+ public:
+ AulAppGetPkgidBypidTest()
+ : AulTest("get_pkg_bypid", "aul_app_get_pkgid_bypid",
+ "get_pkg_bypid <pid>") {}
+
+ virtual ~AulAppGetPkgidBypidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_pkgid_bypid test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int pid = atoi(argv[2]);
+ if (aul_app_get_pkgid_bypid(pid, buf, sizeof(buf)) < 0)
+ _E("no such pkg by %d", pid);
+ else
+ _D("pkgname = %s, pid = %d", buf, pid);
+
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetPkgidBypidTest, get_pkg_bypid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetRunningAppInfoForUidTest : public AulTest {
+ public:
+ AulAppGetRunningAppInfoForUidTest()
+ : AulTest("getallpkg_for_uid", "aul_app_get_running_app_info_for_uid",
+ "getallpkg_for_uid <uid>") {}
+
+ virtual ~AulAppGetRunningAppInfoForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_running_app_info_for_uid test] %s", argv[2]);
+ return aul_app_get_running_app_info_for_uid(AulAppInfoCb, nullptr,
+ atoi(argv[2]));
+ }
+
+ private:
+ static int AulAppInfoCb(const aul_app_info* info, void* user_data) {
+ _D("\t==========================");
+ _D("\t appid: %s", info->appid);
+ _D("\t app_path: %s", info->app_path);
+ _D("\t running pid: %d", info->pid);
+ _D("\t==========================");
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetRunningAppInfoForUidTest, getallpkg_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetRunningAppInfoTest : public AulTest {
+ public:
+ AulAppGetRunningAppInfoTest()
+ : AulTest("getallpkg", "aul_app_get_running_app_info",
+ "getallpkg") {}
+
+ virtual ~AulAppGetRunningAppInfoTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ _D("[aul_app_get_running_app_info test]");
+ return aul_app_get_running_app_info(AulAppInfoCb, nullptr);
+ }
+
+ private:
+ static int AulAppInfoCb(const aul_app_info* info, void* user_data) {
+ _D("\t==========================");
+ _D("\t appid: %s", info->appid);
+ _D("\t app_path: %s", info->app_path);
+ _D("\t running pid: %d", info->pid);
+ _D("\t==========================");
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetRunningAppInfoTest, getallpkg_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetStatusBypidForUidTest : public AulTest {
+ public:
+ AulAppGetStatusBypidForUidTest()
+ : AulTest("get_status_pid_for_uid", "aul_app_get_status_bypid_for_uid",
+ "get_status_pid_for_uid <pid> <uid>") {}
+
+ virtual ~AulAppGetStatusBypidForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_status_bypid_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_app_get_status_bypid_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetStatusBypidForUidTest, get_status_pid_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetStatusBypidTest : public AulTest {
+ public:
+ AulAppGetStatusBypidTest()
+ : AulTest("get_status_pid", "aul_app_get_status_bypid",
+ "get_status_pid <pid>") {}
+
+ virtual ~AulAppGetStatusBypidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_status_bypid test] %s", argv[2]);
+ int ret = aul_app_get_status_bypid(atoi(argv[2]));
+ if (ret >= 0) {
+ _D("==> pid: %s, status: %d(%s)",
+ argv[2], ret, aul_app_status_convert_to_string(ret));
+ }
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetStatusBypidTest, get_status_pid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetStatusForUidTest : public AulTest {
+ public:
+ AulAppGetStatusForUidTest()
+ : AulTest("get_status_for_uid", "aul_app_get_status_for_uid",
+ "get_status_for_uid <appid> <uid>") {}
+
+ virtual ~AulAppGetStatusForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_status_for_uid test] %s %s", argv[2], argv[3]);
+ int ret = aul_app_get_status_for_uid(argv[2], atoi(argv[3]));
+ if (ret >= 0) {
+ _D("==> appid: %s, uid: %s, status: %d(%s)",
+ argv[2], argv[3], ret, aul_app_status_convert_to_string(ret));
+ }
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetStatusForUidTest, get_status_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppGetStatusTest : public AulTest {
+ public:
+ AulAppGetStatusTest()
+ : AulTest("get_status", "aul_app_get_status", "get_status <appid>") {}
+
+ virtual ~AulAppGetStatusTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_get_status test] %s", argv[2]);
+ int ret = aul_app_get_status(argv[2]);
+ if (ret >= 0) {
+ _D("==> appid: %s, status: %d(%s)",
+ argv[2], ret, aul_app_status_convert_to_string(ret));
+ }
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppGetStatusTest, get_status_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppIsRunningTest : public AulTest {
+ public:
+ AulAppIsRunningTest()
+ : AulTest("is_run", "aul_app_is_running", "is_run <appid>") {}
+
+ virtual ~AulAppIsRunningTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_is_running test] %s", argv[2]);
+ if (aul_app_is_running(argv[2]))
+ _D("... %s is running", argv[2]);
+ else
+ _D("... %s is not running", argv[2]);
+
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulAppIsRunningTest, is_run_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "aul/api/aul_app_lifecycle.h"
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppLifecycleGetStateTest : public AulTest {
+ public:
+ AulAppLifecycleGetStateTest()
+ : AulTest("get_app_lifecycle", "aul_app_lifecycle_get_state",
+ "get_app_lifecycle <appid>") {}
+
+ virtual ~AulAppLifecycleGetStateTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_app_lifecycle_get_state test] %s", argv[2]);
+ aul_app_lifecycle_state_e state;
+ int ret = aul_app_lifecycle_get_state(argv[2], &state);
+ if (ret == AUL_R_OK)
+ _D("==> result: %d, state: %s", ret, LifecycleStateToString(state));
+
+ return ret;
+ }
+
+ private:
+ static const char* LifecycleStateToString(aul_app_lifecycle_state_e state) {
+ switch (state) {
+ case AUL_APP_LIFECYCLE_STATE_INITIALIZED:
+ return "INITIALIZED";
+ case AUL_APP_LIFECYCLE_STATE_CREATED:
+ return "CREATED";
+ case AUL_APP_LIFECYCLE_STATE_RESUMED:
+ return "RESUMED";
+ case AUL_APP_LIFECYCLE_STATE_PAUSED:
+ return "PAUSED";
+ default:
+ return "DESTROYED";
+ }
+ }
+};
+
+AUL_TEST_REGISTER(AulAppLifecycleGetStateTest, get_app_lifecycle_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "aul/api/aul_app_lifecycle.h"
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulAppLifecycleRegisterStateChangedCbTest : public AulTest {
+ public:
+ AulAppLifecycleRegisterStateChangedCbTest()
+ : AulTest("listen_app_lifecycle",
+ "aul_app_lifecycle_register_state_changed_cb",
+ "listen_app_lifecycle", false) {}
+
+ virtual ~AulAppLifecycleRegisterStateChangedCbTest() {
+ aul_app_lifecycle_deregister_state_changed_cb();
+ }
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ _D("[aul_app_lifecycle_register_state_changed_cb test]");
+ return aul_app_lifecycle_register_state_changed_cb(
+ AppLifecycleStateChangedCb, nullptr);
+ }
+
+ private:
+ static const char* LifecycleStateToString(aul_app_lifecycle_state_e state) {
+ switch (state) {
+ case AUL_APP_LIFECYCLE_STATE_INITIALIZED:
+ return "INITIALIZED";
+ case AUL_APP_LIFECYCLE_STATE_CREATED:
+ return "CREATED";
+ case AUL_APP_LIFECYCLE_STATE_RESUMED:
+ return "RESUMED";
+ case AUL_APP_LIFECYCLE_STATE_PAUSED:
+ return "PAUSED";
+ default:
+ return "DESTROYED";
+ }
+ }
+
+ static void AppLifecycleStateChangedCb(const char* appid, pid_t pid,
+ aul_app_lifecycle_state_e state, bool has_focus, void* user_data) {
+ _D("appid: %s, pid: %d, state: %s, has_focus: %s",
+ appid, pid, LifecycleStateToString(state),
+ has_focus ? "true" : "false");
+ }
+};
+
+AUL_TEST_REGISTER(AulAppLifecycleRegisterStateChangedCbTest,
+ listen_app_lifecycle_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "menu_db_util.h"
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetAppInfoFromDbByPkgnameTest : public AulTest {
+ public:
+ AulGetAppInfoFromDbByPkgnameTest()
+ : AulTest("getpkg", "aul_get_app_info_from_db_by_pkgname",
+ "getpkg <appid>") {}
+
+ virtual ~AulGetAppInfoFromDbByPkgnameTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_app_info_from_db_by_pkgname test] %s", argv[2]);
+ app_info_from_db* info = _get_app_info_from_db_by_pkgname(argv[2]);
+ if (info == nullptr) {
+ _E("pkg %s no found", argv[2]);
+ return 0;
+ }
+
+ _D("\t==========================");
+ _D("\t appid: %s", info->appid);
+ _D("\t app_path: %s", info->app_path);
+ _D("\t is_minst: 0");
+ _D("\t==========================");
+ _free_app_info_from_db(info);
+ return 0;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetAppInfoFromDbByPkgnameTest, getpkg_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetDefappFromMimeTest : public AulTest {
+ public:
+ AulGetDefappFromMimeTest()
+ : AulTest("get_defapp_mime", "aul_get_defapp_from_mime",
+ "get_defapp_mime <mime_type>") {}
+
+ virtual ~AulGetDefappFromMimeTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_defapp_from_mime test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int ret = aul_get_defapp_from_mime(argv[2], buf, sizeof(buf));
+ if (ret == AUL_R_OK)
+ _D("==> defapp name = %s", buf);
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetDefappFromMimeTest, get_defapp_mime_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+#include "include/aul_svc.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetDefaultAppTest : public AulTest {
+ public:
+ AulGetDefaultAppTest()
+ : AulTest("get_default_app", "aul_get_default_app",
+ "get_default_app <operation> <uri> <mime>") {}
+
+ virtual ~AulGetDefaultAppTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_default_app test] %s %s %s",
+ argv[2], argc > 3 ? argv[3] : "null", argc > 4 ? argv[4] : "null");
+
+ bundle* b = bundle_create();
+ if (b == nullptr) {
+ _E("bundle_create() is failed");
+ return -ENOMEM;
+ }
+
+ aul_svc_set_operation(b, argv[2]);
+ if (argc > 3)
+ aul_svc_set_uri(b, argv[3]);
+ if (argc > 4)
+ aul_svc_set_mime(b, argv[4]);
+
+ char* appid = nullptr;
+ int ret = aul_get_default_app(b, &appid);
+ bundle_free(b);
+ _D("result: %s", appid);
+ free(appid);
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetDefaultAppTest, get_default_app_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetMimeDescriptionTest : public AulTest {
+ public:
+ AulGetMimeDescriptionTest()
+ : AulTest("get_mime_desc", "aul_get_mime_description",
+ "get_mime_desc <mimetype>") {}
+
+ virtual ~AulGetMimeDescriptionTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_mime_description test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int ret = aul_get_mime_description(argv[2], buf, sizeof(buf));
+ if (ret == AUL_R_OK)
+ _D("==> mime type = %s : description = %s", argv[2], buf);
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetMimeDescriptionTest, get_mime_desc_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetMimeExtensionTest : public AulTest {
+ public:
+ AulGetMimeExtensionTest()
+ : AulTest("get_mime_ext", "aul_get_mime_extension",
+ "get_mime_ext <mimetype>") {}
+
+ virtual ~AulGetMimeExtensionTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_mime_extension test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int ret = aul_get_mime_extension(argv[2], buf, sizeof(buf));
+ if (ret == AUL_R_OK)
+ _D("==> mime type = %s : extension = %s", argv[2], buf);
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetMimeExtensionTest, get_mime_ext_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetMimeFromContentTest : public AulTest {
+ public:
+ AulGetMimeFromContentTest()
+ : AulTest("get_mime_content", "aul_get_mime_from_content",
+ "get_mime_content <content>") {}
+
+ virtual ~AulGetMimeFromContentTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_mime_from_content test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int ret = aul_get_mime_from_content(argv[2], buf, sizeof(buf));
+ if (ret == AUL_R_OK)
+ _D("==> mime type = %s", buf);
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetMimeFromContentTest, get_mime_content_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetMimeFromFileTest : public AulTest {
+ public:
+ AulGetMimeFromFileTest()
+ : AulTest("get_mime_file", "aul_get_mime_from_file",
+ "get_mime_file <filename>") {}
+
+ virtual ~AulGetMimeFromFileTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_mime_from_file test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int ret = aul_get_mime_from_file(argv[2], buf, sizeof(buf));
+ if (ret == AUL_R_OK)
+ _D("==> mime type = %s", buf);
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetMimeFromFileTest, get_mime_file_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulGetMimeIconTest : public AulTest {
+ public:
+ AulGetMimeIconTest()
+ : AulTest("get_mime_icon", "aul_get_mime_icon",
+ "get_mime_icon <mimetype>") {}
+
+ virtual ~AulGetMimeIconTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_get_mime_icon test] %s", argv[2]);
+ char buf[256] = { 0, };
+ int ret = aul_get_mime_icon(argv[2], buf, sizeof(buf));
+ if (ret == AUL_R_OK)
+ _D("==> mime type = %s : iconname = %s", argv[2], buf);
+
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulGetMimeIconTest, get_mime_icon_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulLaunchAppAsyncForUidTest : public AulTest {
+ public:
+ AulLaunchAppAsyncForUidTest()
+ : AulTest("launch_async_for_uid", "aul_launch_app_async_for_uid",
+ "launch_async_for_uid <appid> <uid> <key1> <val1> ...") {}
+
+ virtual ~AulLaunchAppAsyncForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_launch_app_async_for_uid test] %s %s", argv[2], argv[3]);
+ tizen_base::Bundle b = CreateBundleFromArgv(argc, argv, 4);
+ return aul_launch_app_async_for_uid(argv[2], b.GetHandle(), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulLaunchAppAsyncForUidTest, launch_async_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulLaunchAppAsyncTest : public AulTest {
+ public:
+ AulLaunchAppAsyncTest()
+ : AulTest("launch_async", "aul_launch_app_async",
+ "launch_async <appid> <key1> <val1> <key2> <val2> ...") {}
+
+ virtual ~AulLaunchAppAsyncTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_launch_app_async test] %s", argv[2]);
+ tizen_base::Bundle b = CreateBundleFromArgv(argc, argv, 3);
+ return aul_launch_app_async(argv[2], b.GetHandle());
+ }
+};
+
+AUL_TEST_REGISTER(AulLaunchAppAsyncTest, launch_async_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulLaunchAppForUidTest : public AulTest {
+ public:
+ AulLaunchAppForUidTest()
+ : AulTest("launch_for_uid", "aul_launch_app_for_uid",
+ "launch_for_uid <app_id> <uid> <key1> <val1> ...") {}
+
+ virtual ~AulLaunchAppForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_launch_app_for_uid test] %s %s", argv[2], argv[3]);
+ tizen_base::Bundle b = CreateBundleFromArgv(argc, argv, 4);
+ return aul_launch_app_for_uid(argv[2], b.GetHandle(), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulLaunchAppForUidTest, launch_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulLaunchAppTest : public AulTest {
+ public:
+ AulLaunchAppTest()
+ : AulTest("launch", "aul_launch_app",
+ "launch <app_id> <key1> <val1> <key2> <val2> ...") {}
+
+ virtual ~AulLaunchAppTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_launch_app test] %s", argv[2]);
+ tizen_base::Bundle b = CreateBundleFromArgv(argc, argv, 3);
+ return aul_launch_app(argv[2], b.GetHandle());
+ }
+};
+
+AUL_TEST_REGISTER(AulLaunchAppTest, launch_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulListenAppStatusForUidTest : public AulTest {
+ public:
+ AulListenAppStatusForUidTest()
+ : AulTest("listen_app_status_for_uid", "aul_listen_app_status_for_uid",
+ "listen_app_status_for_uid <appid> <uid>", false) {}
+
+ virtual ~AulListenAppStatusForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_listen_app_status_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_listen_app_status_for_uid(argv[2], AppStatusCb, this, &handle_,
+ atoi(argv[3]));
+ }
+
+ private:
+ static int AppStatusCb(aul_app_info* info, int ctx_status, void* user_data) {
+ _D("appid: %s, status: %d", info->appid, ctx_status);
+ return 0;
+ }
+
+ status_listen_h handle_ = nullptr;
+};
+
+AUL_TEST_REGISTER(AulListenAppStatusForUidTest, listen_app_status_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulListenAppStatusTest : public AulTest {
+ public:
+ AulListenAppStatusTest()
+ : AulTest("listen_app_status", "aul_listen_app_status",
+ "listen_app_status <appid>", false) {}
+
+ virtual ~AulListenAppStatusTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_listen_app_status test] %s", argv[2]);
+ return aul_listen_app_status(argv[2], AppStatusCb, this, &handle_);
+ }
+
+ private:
+ static int AppStatusCb(aul_app_info* info, int ctx_status, void* user_data) {
+ _D("appid: %s, status: %d", info->appid, ctx_status);
+ return 0;
+ }
+
+ status_listen_h handle_ = nullptr;
+};
+
+AUL_TEST_REGISTER(AulListenAppStatusTest, listen_app_status_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulOpenAppForUidTest : public AulTest {
+ public:
+ AulOpenAppForUidTest()
+ : AulTest("open_for_uid", "aul_open_app_for_uid",
+ "open_for_uid <appid> <uid>") {}
+
+ virtual ~AulOpenAppForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_open_app_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_open_app_for_uid(argv[2], atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulOpenAppForUidTest, open_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulOpenAppTest : public AulTest {
+ public:
+ AulOpenAppTest() : AulTest("open", "aul_open_app", "open <appid>") {}
+
+ virtual ~AulOpenAppTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_open_app test] %s", argv[2]);
+ return aul_open_app(argv[2]);
+ }
+};
+
+AUL_TEST_REGISTER(AulOpenAppTest, open_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulOpenContentTest : public AulTest {
+ public:
+ AulOpenContentTest()
+ : AulTest("open_content", "aul_open_content", "open_content <content>") {}
+
+ virtual ~AulOpenContentTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_open_content test] %s", argv[2]);
+ return aul_open_content(argv[2]);
+ }
+};
+
+AUL_TEST_REGISTER(AulOpenContentTest, open_content_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulOpenFileTest : public AulTest {
+ public:
+ AulOpenFileTest()
+ : AulTest("open_file", "aul_open_file", "open_file <filename>") {}
+
+ virtual ~AulOpenFileTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_open_file test] %s", argv[2]);
+ return aul_open_file(argv[2]);
+ }
+};
+
+AUL_TEST_REGISTER(AulOpenFileTest, open_file_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulPauseAppForUidTest : public AulTest {
+ public:
+ AulPauseAppForUidTest()
+ : AulTest("pause_for_uid", "aul_pause_app_for_uid",
+ "pause_for_uid <appid> <uid>") {}
+
+ virtual ~AulPauseAppForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_pause_app_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_pause_app_for_uid(argv[2], atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulPauseAppForUidTest, pause_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulPauseAppTest : public AulTest {
+ public:
+ AulPauseAppTest() : AulTest("pause", "aul_pause_app", "pause <app_id>") {}
+
+ virtual ~AulPauseAppTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_pause_app test] %s", argv[2]);
+ return aul_pause_app(argv[2]);
+ }
+};
+
+AUL_TEST_REGISTER(AulPauseAppTest, pause_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulPausePidForUidTest : public AulTest {
+ public:
+ AulPausePidForUidTest()
+ : AulTest("pause_pid_for_uid", "aul_pause_pid_for_uid",
+ "pause_pid_for_uid <pid> <uid>") {}
+
+ virtual ~AulPausePidForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_pause_pid_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_pause_pid_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulPausePidForUidTest, pause_pid_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulPausePidTest : public AulTest {
+ public:
+ AulPausePidTest()
+ : AulTest("pause_pid", "aul_pause_pid", "pause_pid <pid>") {}
+
+ virtual ~AulPausePidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_pause_pid test] %s", argv[2]);
+ return aul_pause_pid(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulPausePidTest, pause_pid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+#include "include/aul_proc.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulProcGetExtraTest : public AulTest {
+ public:
+ AulProcGetExtraTest()
+ : AulTest("get_proc_extra", "aul_proc_get_extra",
+ "get_proc_extra <pid>") {}
+
+ virtual ~AulProcGetExtraTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_proc_get_extra test] %s", argv[2]);
+ bundle* extra = nullptr;
+ int ret = aul_proc_get_extra(atoi(argv[2]), &extra);
+ if (ret == AUL_R_OK)
+ _D("==> result: %d", ret);
+
+ if (extra) {
+ bundle_foreach(extra, ForeachExtraCb, nullptr);
+ bundle_free(extra);
+ }
+
+ return ret;
+ }
+
+ private:
+ static void ForeachExtraCb(const char *key, const int type,
+ const bundle_keyval_t* kb, void* user_data) {
+ _D("key: %s, type: %d", key, type);
+ }
+};
+
+AUL_TEST_REGISTER(AulProcGetExtraTest, get_proc_extra_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+#include "include/aul_proc.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulProcGetNameTest : public AulTest {
+ public:
+ AulProcGetNameTest()
+ : AulTest("get_proc_name", "aul_proc_get_name", "get_proc_name <pid>") {}
+
+ virtual ~AulProcGetNameTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_proc_get_name test] %s", argv[2]);
+ char* name = nullptr;
+ int ret = aul_proc_get_name(atoi(argv[2]), &name);
+ if (ret == AUL_R_OK)
+ _D("==> result: %d, name: %s", ret, name);
+
+ free(name);
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulProcGetNameTest, get_proc_name_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+#include "include/aul_proc_group.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulProcGroupAddTest : public AulTest {
+ public:
+ AulProcGroupAddTest()
+ : AulTest("add_proc_group", "aul_proc_group_add",
+ "add_proc_group <pid>") {}
+
+ virtual ~AulProcGroupAddTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_proc_group_add test] %s", argv[2]);
+ return aul_proc_group_add(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulProcGroupAddTest, add_proc_group_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+#include "include/aul_proc_group.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulProcGroupRemoveTest : public AulTest {
+ public:
+ AulProcGroupRemoveTest()
+ : AulTest("remove_proc_group", "aul_proc_group_remove",
+ "remove_proc_group <pid>") {}
+
+ virtual ~AulProcGroupRemoveTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_proc_group_remove test] %s", argv[2]);
+ return aul_proc_group_remove(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulProcGroupRemoveTest, remove_proc_group_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+#include "include/aul_proc.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulProcRegisterTest : public AulTest {
+ public:
+ AulProcRegisterTest()
+ : AulTest("register_proc", "aul_proc_register",
+ "register_proc <name> <key1> <value1> <key2> <value2> ...") {}
+
+ virtual ~AulProcRegisterTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ tizen_base::Bundle b;
+ bundle* extra = nullptr;
+ if (argc > 3) {
+ b = CreateBundleFromArgv(argc, argv, 3);
+ extra = b.GetHandle();
+ }
+
+ _D("[aul_proc_register] %s", argv[2]);
+ int ret = aul_proc_register(argv[2], extra);
+ _D("result: %d", ret);
+ if (ret != AUL_R_OK)
+ return ret;
+
+ _D("[aul_proc_get_name] %d", getpid());
+ char* name = nullptr;
+ ret = aul_proc_get_name(getpid(), &name);
+ _D("result: %d, name: %s", ret, name);
+ free(name);
+
+ _D("[aul_proc_get_extra] %d", getpid());
+ extra = nullptr;
+ ret = aul_proc_get_extra(getpid(), &extra);
+ _D("result: %d", ret);
+ if (extra) {
+ bundle_foreach(extra, ForeachExtraCb, nullptr);
+ bundle_free(extra);
+ }
+
+ return ret;
+ }
+
+ private:
+ static void ForeachExtraCb(const char *key, const int type,
+ const bundle_keyval_t* kb, void* user_data) {
+ _D("key: %s, type: %d", key, type);
+ }
+};
+
+AUL_TEST_REGISTER(AulProcRegisterTest, register_proc_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulReloadAppinfoTest : public AulTest {
+ public:
+ AulReloadAppinfoTest() : AulTest("reload", "aul_reload_appinfo", "reload") {}
+
+ virtual ~AulReloadAppinfoTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ return aul_reload_appinfo();
+ }
+};
+
+AUL_TEST_REGISTER(AulReloadAppinfoTest, reload_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulResumeAppForUidTest : public AulTest {
+ public:
+ AulResumeAppForUidTest()
+ : AulTest("resume_for_uid", "aul_resume_app_for_uid",
+ "resume_for_uid <appid> <uid>") {}
+
+ virtual ~AulResumeAppForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_resume_app_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_resume_app_for_uid(argv[2], atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulResumeAppForUidTest, resume_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulResumeAppTest : public AulTest {
+ public:
+ AulResumeAppTest() : AulTest("resume", "aul_resume_app", "resume <appid>") {}
+
+ virtual ~AulResumeAppTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_resume_app test] %s", argv[2]);
+ return aul_resume_app(argv[2]);
+ }
+};
+
+AUL_TEST_REGISTER(AulResumeAppTest, resume_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulResumePidAsyncForUidTest : public AulTest {
+ public:
+ AulResumePidAsyncForUidTest()
+ : AulTest("resume_pid_async_for_uid", "aul_resume_pid_async_for_uid",
+ "resume_pid_async_for_uid <pid> <uid>") {}
+
+ virtual ~AulResumePidAsyncForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_resume_pid_async_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_resume_pid_async_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulResumePidAsyncForUidTest, resume_pid_async_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulResumePidAsyncTest : public AulTest {
+ public:
+ AulResumePidAsyncTest()
+ : AulTest("resume_pid_async", "aul_resume_pid_async",
+ "resume_pid_async <pid>") {}
+
+ virtual ~AulResumePidAsyncTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_resume_pid_async test] %s", argv[2]);
+ return aul_resume_pid_async(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulResumePidAsyncTest, resume_pid_async_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulResumePidForUidTest : public AulTest {
+ public:
+ AulResumePidForUidTest()
+ : AulTest("resume_pid_for_uid", "aul_resume_pid_for_uid",
+ "resume_pid_for_uid <pid> <uid>") {}
+
+ virtual ~AulResumePidForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_resume_pid_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_resume_pid_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulResumePidForUidTest, resume_pid_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulResumePidTest : public AulTest {
+ public:
+ AulResumePidTest()
+ : AulTest("resume_pid", "aul_resume_pid", "resume_pid <pid>") {}
+
+ virtual ~AulResumePidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_resume_pid test] %s", argv[2]);
+ return aul_resume_pid(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulResumePidTest, resume_pid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulSetDefappWithMimeTest : public AulTest {
+ public:
+ AulSetDefappWithMimeTest()
+ : AulTest("set_defapp_mime", "aul_set_defapp_with_mime",
+ "set_defapp_mime <mimetype> <appid>") {}
+
+ virtual ~AulSetDefappWithMimeTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_set_defapp_with_mime test] %s %s", argv[2], argv[3]);
+ return aul_set_defapp_with_mime(argv[2], argv[3]);
+ }
+};
+
+AUL_TEST_REGISTER(AulSetDefappWithMimeTest, set_defapp_mime_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "include/aul.h"
+#include "include/aul_svc.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulSetDefaultAppByOperationTest : public AulTest {
+ public:
+ AulSetDefaultAppByOperationTest()
+ : AulTest("set_default_app_by_operation",
+ "aul_set_default_app_by_operation",
+ "set_default_app_by_operation <operation> <appid>") {}
+
+ virtual ~AulSetDefaultAppByOperationTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_set_default_app_by_operation test] %s %s", argv[2], argv[3]);
+ bundle* b = bundle_create();
+ if (b == nullptr) {
+ _E("bundle_create() is failed");
+ return -ENOMEM;
+ }
+
+ aul_svc_set_operation(b, argv[2]);
+ aul_svc_set_appid(b, argv[3]);
+ int ret = aul_set_default_app_by_operation(b);
+ bundle_free(b);
+ return ret;
+ }
+};
+
+AUL_TEST_REGISTER(AulSetDefaultAppByOperationTest,
+ set_default_app_by_operation_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulSubappTerminateRequestPidTest : public AulTest {
+ public:
+ AulSubappTerminateRequestPidTest()
+ : AulTest("term_req_pid", "aul_subapp_terminate_request_pid",
+ "term_req_pid <pid>") {}
+
+ virtual ~AulSubappTerminateRequestPidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_subapp_terminate_request_pid test] %s", argv[2]);
+ return aul_subapp_terminate_request_pid(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulSubappTerminateRequestPidTest, term_req_pid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulTerminateBgappPidTest : public AulTest {
+ public:
+ AulTerminateBgappPidTest()
+ : AulTest("term_bgapp", "aul_terminate_bgapp_pid", "term_bgapp <pid>") {}
+
+ virtual ~AulTerminateBgappPidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_terminate_bgapp_pid test] %s", argv[2]);
+ return aul_terminate_bgapp_pid(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulTerminateBgappPidTest, term_bgapp_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulTerminatePidAsyncForUidTest : public AulTest {
+ public:
+ AulTerminatePidAsyncForUidTest()
+ : AulTest("term_pid_async_for_uid", "aul_terminate_pid_async_for_uid",
+ "term_pid_async_for_uid <pid> <uid>") {}
+
+ virtual ~AulTerminatePidAsyncForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_terminate_pid_async_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_terminate_pid_async_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulTerminatePidAsyncForUidTest, term_pid_async_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulTerminatePidForUidTest : public AulTest {
+ public:
+ AulTerminatePidForUidTest()
+ : AulTest("term_pid_for_uid", "aul_terminate_pid_for_uid",
+ "term_pid_for_uid <pid> <uid>") {}
+
+ virtual ~AulTerminatePidForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_terminate_pid_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_terminate_pid_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulTerminatePidForUidTest, term_pid_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulTerminatePidSyncForUidTest : public AulTest {
+ public:
+ AulTerminatePidSyncForUidTest()
+ : AulTest("term_pid_sync_for_uid", "aul_terminate_pid_sync_for_uid",
+ "term_pid_sync_for_uid <pid> <uid>") {}
+
+ virtual ~AulTerminatePidSyncForUidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 4) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_terminate_pid_sync_for_uid test] %s %s", argv[2], argv[3]);
+ return aul_terminate_pid_sync_for_uid(atoi(argv[2]), atoi(argv[3]));
+ }
+};
+
+AUL_TEST_REGISTER(AulTerminatePidSyncForUidTest, term_pid_sync_for_uid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulTerminatePidSyncTest : public AulTest {
+ public:
+ AulTerminatePidSyncTest()
+ : AulTest("term_pid_sync", "aul_terminate_pid_sync",
+ "term_pid_sync <pid>") {}
+
+ virtual ~AulTerminatePidSyncTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_terminate_pid_sync test] %s", argv[2]);
+ return aul_terminate_pid_sync(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulTerminatePidSyncTest, term_pid_sync_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulTerminatePidTest : public AulTest {
+ public:
+ AulTerminatePidTest()
+ : AulTest("term_pid", "aul_terminate_pid", "term_pid <pid>") {}
+
+ virtual ~AulTerminatePidTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_terminate_pid test] %s", argv[2]);
+ return aul_terminate_pid(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulTerminatePidTest, term_pid_test);
+
+} // namespace aul_test
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdlib.h>
+
+#include "include/aul.h"
+
+#include "aul_test.hh"
+#include "log_private.hh"
+
+namespace aul_test {
+
+class AulTerminatePidWithoutRestartTest : public AulTest {
+ public:
+ AulTerminatePidWithoutRestartTest()
+ : AulTest("term_pid_without_restart", "aul_terminate_pid_without_restart",
+ "term_pid_without_restart <pid>") {}
+
+ virtual ~AulTerminatePidWithoutRestartTest() {}
+
+ void SetUp() override {}
+
+ void TearDown() override {}
+
+ int Test(int argc, char** argv) override {
+ if (argc < 3) {
+ Usage();
+ return -1;
+ }
+
+ _D("[aul_terminate_pid_without_restart test] %s", argv[2]);
+ return aul_terminate_pid_without_restart(atoi(argv[2]));
+ }
+};
+
+AUL_TEST_REGISTER(AulTerminatePidWithoutRestartTest,
+ term_pid_without_restart_test);
+
+} // namespace aul_test