From f9ece7be47607b65ec6ee1e4fa3d5d38d084f6a7 Mon Sep 17 00:00:00 2001 From: wchang kim Date: Mon, 3 Jul 2023 11:04:31 +0900 Subject: [PATCH 01/16] Fixed the build error using gcc 13 Change-Id: Id8c09ebc0a4285324995a8da81a84decc5eeea33 --- client/CMakeLists.txt | 3 +++ common/VoiceControlEngines.h | 1 + server/CMakeLists.txt | 2 ++ 3 files changed, 6 insertions(+) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 0195eb3..28801c7 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -83,6 +83,9 @@ FOREACH(flag ${pkgs_CFLAGS}) ENDFOREACH(flag) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + +ADD_DEFINITIONS("-Wno-format-overflow") +ADD_DEFINITIONS("-Wno-nonnull") ## for LCOV #SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fprofile-arcs -ftest-coverage") #SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fprofile-arcs -ftest-coverage") diff --git a/common/VoiceControlEngines.h b/common/VoiceControlEngines.h index 9848900..60dfe59 100644 --- a/common/VoiceControlEngines.h +++ b/common/VoiceControlEngines.h @@ -19,6 +19,7 @@ #include #include #include +#include #include "VoiceControlEngineInfo.h" diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 4b1b80e..12ae377 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -43,6 +43,8 @@ SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -fPIE") SET(CMAKE_C_FLAGS_RELEASE "-O2 -fPIE") SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie") +ADD_DEFINITIONS("-Wno-format-overflow") + ## Executable ## #ADD_EXECUTABLE("${PROJECT_NAME}-daemon" ${SRCS}) #TARGET_LINK_LIBRARIES("${PROJECT_NAME}-daemon" -ldl -lm ${pkgs_LDFLAGS}) -- 2.7.4 From 07c10ce6b94459a75a54d3464bc1acb4384f4af4 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 11 Jul 2023 11:32:03 +0900 Subject: [PATCH 02/16] Use static memory for DB file path - Issue: In some code, g_path and g_backup_path can be deallocated even if it would be referenced. - Solution: g_path and g_backup_path should not be allocated the memory dynamically because the life cycle of those variables are the same as the program. So this patch changes the variables to use static memory. Through this patch, unintended memory deallocation will be removed. Change-Id: Idc64bc76e4cfc884770d83576923d2670e61c364 Signed-off-by: Suyeon Hwang --- common/vc_cmd_db.c | 88 +++++++++++++++++------------------------------------- 1 file changed, 27 insertions(+), 61 deletions(-) diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 9a30848..6626bd5 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -58,8 +58,8 @@ const char* vc_db_tag() //#define DB_PATH tzplatform_mkpath(TZ_USER_DB, ".vc_info.db") static sqlite3* g_db_handle = NULL; static sqlite3* g_db_backup_handle = NULL; -static char* g_path = NULL; -static char* g_backup_path = NULL; +static char g_path[256] = {0, }; +static char g_backup_path[256] = {0, }; static int g_ref_cnt = 0; int g_fpid = -1; @@ -1493,32 +1493,28 @@ static int __vc_db_create_table(sqlite3* db_handle, const char* table) return VC_DB_ERROR_NONE; } -int __vc_db_open_db_for_daemon(char** path, sqlite3** db_handle) +static int __vc_db_open_db_for_daemon(const char* path, sqlite3** db_handle) { struct stat stat; - int ret = db_util_open(*path, db_handle, DB_UTIL_REGISTER_HOOK_METHOD); + int ret = db_util_open(path, db_handle, DB_UTIL_REGISTER_HOOK_METHOD); if (ret != SQLITE_OK) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open db, path = %s, ret(%d)", *path, ret); + SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open db, path = %s, ret(%d)", path, ret); if (db_handle && *db_handle) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Error msg (%s)", sqlite3_errmsg(*db_handle)); db_util_close(*db_handle); *db_handle = NULL; } - free(*path); - *path = NULL; return VC_DB_ERROR_OPERATION_FAILED; } - if (lstat(*path, &stat) < 0) { + if (lstat(path, &stat) < 0) { char buf_err[256]; SLOG(LOG_ERROR, vc_db_tag(), "%d", strerror_r(errno, buf_err, sizeof(buf_err))); if (*db_handle) db_util_close(*db_handle); *db_handle = NULL; - free(*path); - *path = NULL; return VC_DB_ERROR_OPERATION_FAILED; } @@ -1528,8 +1524,6 @@ int __vc_db_open_db_for_daemon(char** path, sqlite3** db_handle) db_util_close(*db_handle); *db_handle = NULL; - free(*path); - *path = NULL; return VC_DB_ERROR_OPERATION_FAILED; } @@ -1584,7 +1578,7 @@ static int __vc_db_restore_table(sqlite3* db_handle, const char* table) return VC_DB_ERROR_NONE; } -bool __vc_db_connect_db_for_daemon(char** path, sqlite3** db_handle) +static bool __vc_db_connect_db_for_daemon(const char* path, sqlite3** db_handle) { bool is_connect = false; int ret = __vc_db_open_db_for_daemon(path, db_handle); @@ -1621,7 +1615,7 @@ static int __vc_db_integrity_check_cb(void *NotUsed, int argc, char **argv, char g_db_cnt = (g_db_cnt + 1) % 1000; snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } - bool is_connect = __vc_db_connect_db_for_daemon(&g_path, &g_db_handle); + bool is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect main DB for daemon"); ret = __vc_db_restore_table(g_db_handle, VC_INFO_TABLE); @@ -1632,7 +1626,7 @@ static int __vc_db_integrity_check_cb(void *NotUsed, int argc, char **argv, char if (0 != ret) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to create table (%s)", VC_RESULT_TABLE); } - is_connect = __vc_db_connect_db_for_daemon(&g_backup_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db_for_daemon(g_backup_path, &g_db_backup_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect backup DB for daemon"); if (0 != vc_db_restore_command()) { @@ -1659,23 +1653,13 @@ int vc_db_initialize_for_daemon(void) } /* For voice control DB */ - g_path = (char*)calloc(256, sizeof(char)); - if (NULL == g_path) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to allocate memory"); - return VC_DB_ERROR_OUT_OF_MEMORY; - } /* This should be changed to general DB space - TZ_USER_DB */ snprintf(g_path, 256, "%s/.vc_info.db", VC_RUNTIME_INFO_ROOT); /* For Backup DB */ - g_backup_path = (char*)calloc(256, sizeof(char)); - if (NULL == g_backup_path) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to allocate memory"); - return VC_DB_ERROR_OUT_OF_MEMORY; - } snprintf(g_backup_path, 256, "%s/.vc_backup.db", VC_RUNTIME_INFO_ROOT); - bool is_connect = __vc_db_connect_db_for_daemon(&g_path, &g_db_handle); + bool is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (false == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to connect main DB, retry to connect after removing"); if (0 != remove(g_path)) { @@ -1683,10 +1667,10 @@ int vc_db_initialize_for_daemon(void) g_db_cnt = (g_db_cnt + 1) % 1000; snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } - is_connect = __vc_db_connect_db_for_daemon(&g_path, &g_db_handle); + is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect main DB for daemon"); - is_connect = __vc_db_connect_db_for_daemon(&g_backup_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db_for_daemon(g_backup_path, &g_db_backup_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect backup DB for daemon"); if (0 != vc_db_restore_command()) { @@ -1714,10 +1698,10 @@ int vc_db_initialize_for_daemon(void) g_db_cnt = (g_db_cnt + 1) % 1000; snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } - is_connect = __vc_db_connect_db_for_daemon(&g_path, &g_db_handle); + is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect main DB for daemon"); - is_connect = __vc_db_connect_db_for_daemon(&g_backup_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db_for_daemon(g_backup_path, &g_db_backup_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect backup DB for daemon"); if (0 != vc_db_restore_command()) { @@ -1734,7 +1718,7 @@ int vc_db_initialize_for_daemon(void) return VC_DB_ERROR_NONE; } - is_connect = __vc_db_connect_db_for_daemon(&g_backup_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db_for_daemon(g_backup_path, &g_db_backup_handle); if (false == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open backup DB, retry to connect after removing file for daemon"); if (0 != remove(g_backup_path)) { @@ -1742,7 +1726,7 @@ int vc_db_initialize_for_daemon(void) SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed", g_backup_path); snprintf(g_backup_path, 256, "%s/.vc_backup_%d.db", VC_RUNTIME_INFO_ROOT, g_backup_db_cnt); } - is_connect = __vc_db_connect_db_for_daemon(&g_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_backup_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect backup DB for daemon"); if (0 != vc_db_restore_command()) { @@ -1757,25 +1741,23 @@ int vc_db_initialize_for_daemon(void) return VC_DB_ERROR_NONE; } -int __vc_db_open_db(char** path, sqlite3** db_handle) +static int __vc_db_open_db(const char* path, sqlite3** db_handle) { - int ret = db_util_open(*path, db_handle, DB_UTIL_REGISTER_HOOK_METHOD); + int ret = db_util_open(path, db_handle, DB_UTIL_REGISTER_HOOK_METHOD); if (ret != SQLITE_OK) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open db for daemon, path = %s, ret(%d)", *path, ret); + SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open db for daemon, path = %s, ret(%d)", path, ret); if (db_handle && *db_handle) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Error msg (%s)", sqlite3_errmsg(*db_handle)); db_util_close(*db_handle); *db_handle = NULL; } - free(*path); - *path = NULL; return VC_DB_ERROR_OPERATION_FAILED; } return VC_DB_ERROR_NONE; } -bool __vc_db_connect_db(char** path, sqlite3** db_handle) +static bool __vc_db_connect_db(const char* path, sqlite3** db_handle) { bool is_connect = false; int ret = __vc_db_open_db(path, db_handle); @@ -1809,23 +1791,13 @@ int vc_db_initialize(void) } /* For voice control DB */ - g_path = (char*)calloc(256, sizeof(char)); - if (NULL == g_path) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to allocate memory"); - return VC_DB_ERROR_OUT_OF_MEMORY; - } /* This should be changed to general DB space - TZ_USER_DB */ snprintf(g_path, 256, "%s/.vc_info.db", VC_RUNTIME_INFO_ROOT); /* For Backup DB */ - g_backup_path = (char*)calloc(256, sizeof(char)); - if (NULL == g_backup_path) { - SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to allocate memory"); - return VC_DB_ERROR_OUT_OF_MEMORY; - } snprintf(g_backup_path, 256, "%s/.vc_backup.db", VC_RUNTIME_INFO_ROOT); - bool is_connect = __vc_db_connect_db(&g_path, &g_db_handle); + bool is_connect = __vc_db_connect_db(g_path, &g_db_handle); if (false == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to connect main DB, retry to connect after removing"); if (0 != remove(g_path)) { @@ -1833,10 +1805,10 @@ int vc_db_initialize(void) g_db_cnt = (g_db_cnt + 1) % 1000; snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } - is_connect = __vc_db_connect_db(&g_path, &g_db_handle); + is_connect = __vc_db_connect_db(g_path, &g_db_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect main DB"); - is_connect = __vc_db_connect_db(&g_backup_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db(g_backup_path, &g_db_backup_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect backup DB"); if (0 != vc_db_restore_command()) { @@ -1849,7 +1821,7 @@ int vc_db_initialize(void) } } - is_connect = __vc_db_connect_db(&g_backup_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db(g_backup_path, &g_db_backup_handle); if (false == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to open backup DB, retry to connect after removing file"); if (0 != remove(g_backup_path)) { @@ -1857,7 +1829,7 @@ int vc_db_initialize(void) SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed", g_backup_path); snprintf(g_backup_path, 256, "%s/.vc_backup_%d.db", VC_RUNTIME_INFO_ROOT, g_backup_db_cnt); } - is_connect = __vc_db_connect_db(&g_path, &g_db_backup_handle); + is_connect = __vc_db_connect_db(g_path, &g_db_backup_handle); if (true == is_connect) { SLOG(LOG_ERROR, vc_db_tag(), "[INFO] Success to connect backup"); if (0 != vc_db_restore_command()) { @@ -1878,15 +1850,9 @@ int vc_db_finalize(void) if (0 != --g_ref_cnt) return VC_DB_ERROR_NONE; - if (NULL != g_path) { - free(g_path); - g_path = NULL; - } + memset(g_path, 0, 256); - if (NULL != g_backup_path) { - free(g_backup_path); - g_backup_path = NULL; - } + memset(g_backup_path, 0, 256); if (!g_db_handle) return VC_DB_ERROR_NONE; -- 2.7.4 From 0eec3b095468759e5229bf643c81e00932816f78 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 11 Jul 2023 14:31:48 +0900 Subject: [PATCH 03/16] Use macro for length of file path Change-Id: I5352069100e10540f69cb763a88a560013644920 Signed-off-by: Suyeon Hwang --- common/vc_cmd_db.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 6626bd5..dff7ec0 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "vc_cmd_db.h" #include "vc_main.h" @@ -58,8 +59,8 @@ const char* vc_db_tag() //#define DB_PATH tzplatform_mkpath(TZ_USER_DB, ".vc_info.db") static sqlite3* g_db_handle = NULL; static sqlite3* g_db_backup_handle = NULL; -static char g_path[256] = {0, }; -static char g_backup_path[256] = {0, }; +static char g_path[_POSIX_PATH_MAX] = {0, }; +static char g_backup_path[_POSIX_PATH_MAX] = {0, }; static int g_ref_cnt = 0; int g_fpid = -1; @@ -1613,7 +1614,7 @@ static int __vc_db_integrity_check_cb(void *NotUsed, int argc, char **argv, char if (0 != remove(g_path)) { SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed for daemon", g_path); g_db_cnt = (g_db_cnt + 1) % 1000; - snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); + snprintf(g_path, _POSIX_PATH_MAX, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } bool is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (true == is_connect) { @@ -1654,10 +1655,10 @@ int vc_db_initialize_for_daemon(void) /* For voice control DB */ /* This should be changed to general DB space - TZ_USER_DB */ - snprintf(g_path, 256, "%s/.vc_info.db", VC_RUNTIME_INFO_ROOT); + snprintf(g_path, _POSIX_PATH_MAX, "%s/.vc_info.db", VC_RUNTIME_INFO_ROOT); /* For Backup DB */ - snprintf(g_backup_path, 256, "%s/.vc_backup.db", VC_RUNTIME_INFO_ROOT); + snprintf(g_backup_path, _POSIX_PATH_MAX, "%s/.vc_backup.db", VC_RUNTIME_INFO_ROOT); bool is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (false == is_connect) { @@ -1665,7 +1666,7 @@ int vc_db_initialize_for_daemon(void) if (0 != remove(g_path)) { SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed for daemon", g_path); g_db_cnt = (g_db_cnt + 1) % 1000; - snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); + snprintf(g_path, _POSIX_PATH_MAX, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (true == is_connect) { @@ -1696,7 +1697,7 @@ int vc_db_initialize_for_daemon(void) if (0 != remove(g_path)) { SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed for daemon", g_path); g_db_cnt = (g_db_cnt + 1) % 1000; - snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); + snprintf(g_path, _POSIX_PATH_MAX, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_handle); if (true == is_connect) { @@ -1724,7 +1725,7 @@ int vc_db_initialize_for_daemon(void) if (0 != remove(g_backup_path)) { g_backup_db_cnt = (g_backup_db_cnt + 1) % 1000; SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed", g_backup_path); - snprintf(g_backup_path, 256, "%s/.vc_backup_%d.db", VC_RUNTIME_INFO_ROOT, g_backup_db_cnt); + snprintf(g_backup_path, _POSIX_PATH_MAX, "%s/.vc_backup_%d.db", VC_RUNTIME_INFO_ROOT, g_backup_db_cnt); } is_connect = __vc_db_connect_db_for_daemon(g_path, &g_db_backup_handle); if (true == is_connect) { @@ -1792,10 +1793,10 @@ int vc_db_initialize(void) /* For voice control DB */ /* This should be changed to general DB space - TZ_USER_DB */ - snprintf(g_path, 256, "%s/.vc_info.db", VC_RUNTIME_INFO_ROOT); + snprintf(g_path, _POSIX_PATH_MAX, "%s/.vc_info.db", VC_RUNTIME_INFO_ROOT); /* For Backup DB */ - snprintf(g_backup_path, 256, "%s/.vc_backup.db", VC_RUNTIME_INFO_ROOT); + snprintf(g_backup_path, _POSIX_PATH_MAX, "%s/.vc_backup.db", VC_RUNTIME_INFO_ROOT); bool is_connect = __vc_db_connect_db(g_path, &g_db_handle); if (false == is_connect) { @@ -1803,7 +1804,7 @@ int vc_db_initialize(void) if (0 != remove(g_path)) { SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed", g_path); g_db_cnt = (g_db_cnt + 1) % 1000; - snprintf(g_path, 256, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); + snprintf(g_path, _POSIX_PATH_MAX, "%s/.vc_info_%d.db", VC_RUNTIME_INFO_ROOT, g_db_cnt); } is_connect = __vc_db_connect_db(g_path, &g_db_handle); if (true == is_connect) { @@ -1827,7 +1828,7 @@ int vc_db_initialize(void) if (0 != remove(g_backup_path)) { g_backup_db_cnt = (g_backup_db_cnt + 1) % 1000; SLOG(LOG_ERROR, vc_db_tag(), "[Error] remove file(%s) is failed", g_backup_path); - snprintf(g_backup_path, 256, "%s/.vc_backup_%d.db", VC_RUNTIME_INFO_ROOT, g_backup_db_cnt); + snprintf(g_backup_path, _POSIX_PATH_MAX, "%s/.vc_backup_%d.db", VC_RUNTIME_INFO_ROOT, g_backup_db_cnt); } is_connect = __vc_db_connect_db(g_path, &g_db_backup_handle); if (true == is_connect) { @@ -1850,9 +1851,9 @@ int vc_db_finalize(void) if (0 != --g_ref_cnt) return VC_DB_ERROR_NONE; - memset(g_path, 0, 256); + memset(g_path, 0, _POSIX_PATH_MAX); - memset(g_backup_path, 0, 256); + memset(g_backup_path, 0, _POSIX_PATH_MAX); if (!g_db_handle) return VC_DB_ERROR_NONE; -- 2.7.4 From 801dbaf53eb26fe6e26281448ff2b359359c8c2a Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 14 Jul 2023 13:01:54 +0900 Subject: [PATCH 04/16] Fix build error on gcc-13 Build Change-Id: I43bd5da223ca1703e39e4c3e033f76d81680a4a7 --- client/vc_mgr_tidl.c | 9 +++++---- common/vc_json_parser.c | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/client/vc_mgr_tidl.c b/client/vc_mgr_tidl.c index a4cec35..0037087 100644 --- a/client/vc_mgr_tidl.c +++ b/client/vc_mgr_tidl.c @@ -188,19 +188,20 @@ static void __notify_cb(void *user_data, bundle *msg) else if (0 == strncmp(VCD_MANAGER_METHOD_SET_PRIVATE_DATA, method, strlen(VCD_MANAGER_METHOD_SET_PRIVATE_DATA))) { SLOG(LOG_INFO, TAG_VCM, "@@@ Get request set private data"); - char* pid = NULL; + char* tmp_pid = NULL; char* key = NULL; char* private_data = NULL; - bundle_get_str(msg, VC_BUNDLE_PID, &pid); + bundle_get_str(msg, VC_BUNDLE_PID, &tmp_pid); bundle_get_str(msg, VC_BUNDLE_KEY, &key); bundle_get_str(msg, VC_BUNDLE_PRIVATE_DATA, &private_data); - SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr get request set private data : pid(%d) ", atoi(pid)); + int pid = atoi(tmp_pid); + SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr get request set private data : pid(%d) ", pid); if (pid > 0) { vc_mgr_core_send_private_data_set(key, private_data); } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ got invalid pid(%d)", atoi(pid)); + SLOG(LOG_ERROR, TAG_VCM, "@@ got invalid pid(%d)", pid); } } /* VCD_MANAGER_METHOD_SET_PRIVATE_DATA */ diff --git a/common/vc_json_parser.c b/common/vc_json_parser.c index 3fc4eea..4c02835 100644 --- a/common/vc_json_parser.c +++ b/common/vc_json_parser.c @@ -50,15 +50,15 @@ static int __vc_json_get_invocation_name(const char* appid, char** invocation_na lang = NULL; return ret; } + free(lang); *invocation_name = strdup(temp_lable); if (NULL == *invocation_name) { SLOG(LOG_ERROR, vc_json_tag(), "[ERROR] Fail to allocate memory"); + free(temp_lable); + return VC_ERROR_OUT_OF_MEMORY; } free(temp_lable); - temp_lable = NULL; - free(lang); - lang = NULL; } SLOG(LOG_DEBUG, vc_json_tag(), "Get invocation name(%s)", *invocation_name); -- 2.7.4 From 16b2a7cd06503159aaad6670c6380faed5f1113b Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 14 Jul 2023 17:45:21 +0900 Subject: [PATCH 05/16] Update version (1.80.1) Change-Id: I1d56e60454416c469f59036c3693f316172ac9f6 --- packaging/voice-control.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 774ab40..115ab4e 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.80.0 +Version: 1.80.1 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From e495974f95aebddc4112b32f94551cf7f9bb4968 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 13 Jul 2023 16:58:01 +0900 Subject: [PATCH 06/16] Add test utility classes - Contents: This patch introduces new utility classes for test case. Through these classes, developers can easily make the test cases. These new classes provide many useful utility methods and frequently used code blocks. Change-Id: I955ac4f97fc790baa7bbfa796b2fc63e570ea3c2 Signed-off-by: Suyeon Hwang --- tests/src/vc_common_test_util.cpp | 190 ++++++++++++++++++++++++++ tests/src/vc_common_test_util.h | 46 +++++++ tests/src/vc_mgr_test_util.cpp | 280 ++++++++++++++++++++++++++++++++++++++ tests/src/vc_mgr_test_util.h | 81 +++++++++++ tests/src/vc_test_util.cpp | 148 ++++++++++++++++++++ tests/src/vc_test_util.h | 60 ++++++++ 6 files changed, 805 insertions(+) create mode 100644 tests/src/vc_common_test_util.cpp create mode 100644 tests/src/vc_common_test_util.h create mode 100644 tests/src/vc_mgr_test_util.cpp create mode 100644 tests/src/vc_mgr_test_util.h create mode 100644 tests/src/vc_test_util.cpp create mode 100644 tests/src/vc_test_util.h diff --git a/tests/src/vc_common_test_util.cpp b/tests/src/vc_common_test_util.cpp new file mode 100644 index 0000000..a230eba --- /dev/null +++ b/tests/src/vc_common_test_util.cpp @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "vc_common_test_util.h" + + +static const char *TEST_COMMAND_JSON_PATH = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/test_command.json"); +static const char *TEST_EMPTY_FILE_PATH = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/empty_file"); + + +vc_cmd_h VcCommonTestUtility::CreateTestCommand(const char *commandText) +{ + vc_cmd_h command = nullptr; + + EXPECT_EQ(vc_cmd_create(&command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_set_command(command, commandText), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_set_unfixed_command(command, commandText), VC_ERROR_NONE); + + return command; +} + +vc_cmd_list_h VcCommonTestUtility::CreateTestCommandList() +{ + vc_cmd_h command1 = CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_set_type(command1, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NONE); + + vc_cmd_h command2 = CreateTestCommand("background"); + EXPECT_EQ(vc_cmd_set_type(command2, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); + + vc_cmd_list_h commands = nullptr; + EXPECT_EQ(vc_cmd_list_create(&commands), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_add(commands, command1), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_add(commands, command2), VC_ERROR_NONE); + + return commands; +} + +vc_cmd_list_h VcCommonTestUtility::CreateSystemCommandList() +{ + vc_cmd_h command1 = CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_set_type(command1, VC_COMMAND_TYPE_SYSTEM), VC_ERROR_NONE); + + vc_cmd_h command2 = CreateTestCommand("background"); + EXPECT_EQ(vc_cmd_set_type(command2, VC_COMMAND_TYPE_SYSTEM_BACKGROUND), VC_ERROR_NONE); + + vc_cmd_list_h commands = nullptr; + EXPECT_EQ(vc_cmd_list_create(&commands), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_add(commands, command1), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_add(commands, command2), VC_ERROR_NONE); + + return commands; +} + +void VcCommonTestUtility::TerminateCurrentEngine() +{ + char* engineId = vconf_get_str(VCONFKEY_VC_ENGINE_DEFAULT); + + app_context_h context = nullptr; + app_manager_get_app_context(engineId, &context); + free(engineId); + + ASSERT_NE(context, nullptr); + + EXPECT_EQ(app_manager_terminate_app(context), APP_MANAGER_ERROR_NONE); + EXPECT_EQ(app_context_destroy(context), APP_MANAGER_ERROR_NONE); +} + +void VcCommonTestUtility::WaitUntilEngineTerminated(int duration) +{ + auto engineChcker = [](void) { + bool is_running = false; + + char* engineId = vconf_get_str(VCONFKEY_VC_ENGINE_DEFAULT); + app_manager_is_running(engineId, &is_running); + free(engineId); + + return !is_running; + }; + + WaitCondtion(engineChcker, duration); +} + +bool VcCommonTestUtility::IsVcFeatureSupported() +{ + bool isVcSupported = false; + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool("http://tizen.org/feature/speech.control", &isVcSupported)) { + return false; + } + + bool isMicSupported = false; + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool("http://tizen.org/feature/microphone", &isMicSupported)) { + return false; + } + + return isVcSupported && isMicSupported; +} + +bool VcCommonTestUtility::IsVcMgrFeatureSupported() +{ + bool isVcSupported = false; + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool("http://tizen.org/feature/speech.control_manager", &isVcSupported)) { + return false; + } + + bool isMicSupported = false; + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool("http://tizen.org/feature/microphone", &isMicSupported)) { + return false; + } + + return isVcSupported && isMicSupported; +} + +const char *VcCommonTestUtility::GetCommandJsonFilePath() +{ + return TEST_COMMAND_JSON_PATH; +} + +const char *VcCommonTestUtility::GetCommandEmptyFilePath() +{ + return TEST_EMPTY_FILE_PATH; +} + +void VcCommonTestUtility::SetCurrentLanguage(const char *language) +{ + vc_setting_initialize(); + vc_setting_set_language("en_US"); + vc_setting_deinitialize(); +} + +void VcCommonTestUtility::EnableAutoLanguageSelection() +{ + vc_setting_initialize(); + vc_setting_set_auto_language(true); + vc_setting_deinitialize(); +} + +bool VcCommonTestUtility::WaitCondtion(std::function checker, int duration) +{ + auto mainLoopQuitTimer = ecore_timer_add(static_cast(duration), [](void *data) -> Eina_Bool { + ecore_main_loop_quit(); + return EINA_FALSE; + }, nullptr); + + auto checkerTimer = ecore_timer_add(0.0, [](void *data) -> Eina_Bool { + auto &checker = *reinterpret_cast *>(data); + if (false == checker()) { + return EINA_TRUE; + } + + ecore_main_loop_quit(); + return EINA_FALSE; + }, &checker); + + ecore_main_loop_begin(); + + ecore_timer_del(mainLoopQuitTimer); + mainLoopQuitTimer = nullptr; + + ecore_timer_del(checkerTimer); + checkerTimer = nullptr; + + return checker(); +} diff --git a/tests/src/vc_common_test_util.h b/tests/src/vc_common_test_util.h new file mode 100644 index 0000000..c37c1ac --- /dev/null +++ b/tests/src/vc_common_test_util.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __VC_COMMON_TEST_UTIL_H__ +#define __VC_COMMON_TEST_UTIL_H__ + + +#include +#include + + +class VcCommonTestUtility { +public: + static vc_cmd_h CreateTestCommand(const char *commandText); + static vc_cmd_list_h CreateTestCommandList(); + static vc_cmd_list_h CreateSystemCommandList(); + + static void TerminateCurrentEngine(); + static void WaitUntilEngineTerminated(int duration); + static bool IsVcFeatureSupported(); + static bool IsVcMgrFeatureSupported(); + static const char *GetCommandJsonFilePath(); + static const char *GetCommandEmptyFilePath(); + + static void SetCurrentLanguage(const char *language); + static void EnableAutoLanguageSelection(); + + static bool WaitCondtion(std::function checker, int duration); +}; + + +#endif /* __VC_COMMON_TEST_UTIL_H__ */ diff --git a/tests/src/vc_mgr_test_util.cpp b/tests/src/vc_mgr_test_util.cpp new file mode 100644 index 0000000..699526f --- /dev/null +++ b/tests/src/vc_mgr_test_util.cpp @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +#include "vc_common_test_util.h" +#include "vc_mgr_test_util.h" + + +VcMgrTestUtility::VcMgrTestUtility() +{ + mCurrentState = VC_STATE_NONE; + mCurrentServiceState = VC_SERVICE_STATE_NONE; + mDefaultCommandList = nullptr; + + mErrorOccured = false; + mGetErrorMessageReturn = VC_ERROR_OPERATION_FAILED; + mAllResultReceived = false; + mSetSelectedResultReturn = VC_ERROR_OPERATION_FAILED; + mResultReceived = false; + mSpeechDetected = false; + + mErrorMessage = nullptr; + + mPCMData = nullptr; + mPCMSize = 0; +} + +VcMgrTestUtility::~VcMgrTestUtility() +{ + vc_cmd_list_destroy(mDefaultCommandList, true); + mDefaultCommandList = nullptr; + + free(mErrorMessage); + mErrorMessage = nullptr; + + free(mPCMData); + mPCMData = nullptr; + mPCMSize = 0; + + Deinitialize(); +} + +void VcMgrTestUtility::StateChangedCallback(vc_state_e previous, vc_state_e current, void *user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mCurrentState = current; +} + +void VcMgrTestUtility::ServiceStateChangedCallback(vc_service_state_e previous, vc_service_state_e current, void* user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mCurrentServiceState = current; +} + +void VcMgrTestUtility::ErrorCallback(vc_error_e reason, void *user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mErrorOccured = true; + + char *error = nullptr; + instance->mGetErrorMessageReturn = vc_mgr_get_error_message(&error); + free(error); +} + +bool VcMgrTestUtility::AllResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char *result, const char *msg, void *user_data) +{ + auto instance = reinterpret_cast(user_data); + + instance->mAllResultReceived = true; + instance->mSetSelectedResultReturn = vc_mgr_set_selected_results(instance->mDefaultCommandList); + return false; +} + +void VcMgrTestUtility::ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mResultReceived = true; +} + +void VcMgrTestUtility::SpeechDetectedCallback(void *user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mSpeechDetected = true; +} + +void VcMgrTestUtility::GetTestPCMData() +{ + const char* pcm_path = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/test_pcm.dat"); + FILE* fp_in = fopen(pcm_path, "rb"); + if (fp_in == nullptr) { + return; + } + + fseek(fp_in, 0, SEEK_END); + long size = ftell(fp_in); + fseek(fp_in, 0, SEEK_SET); + if (size <= 0) { + fclose(fp_in); + return; + } + + unsigned char* data = reinterpret_cast(calloc(sizeof(unsigned char), size)); + if (nullptr == data) { + fclose(fp_in); + return; + } + + size_t read_size = fread(data, sizeof(char), size, fp_in); + fclose(fp_in); + + if (read_size <= 0) { + free(data); + return; + } + + mPCMSize = size; + mPCMData = data; +} + +void VcMgrTestUtility::Initialize() +{ + if (VcCommonTestUtility::IsVcFeatureSupported() == false) { + return; + } + + vc_mgr_initialize(); + + vc_mgr_set_state_changed_cb(StateChangedCallback, this); + vc_mgr_set_service_state_changed_cb(ServiceStateChangedCallback, this); + vc_mgr_set_error_cb(ErrorCallback, this); + vc_mgr_set_all_result_cb(AllResultCallback, this); +} + +void VcMgrTestUtility::Deinitialize() +{ + vc_mgr_deinitialize(); +} + +bool VcMgrTestUtility::IsStateChanged(vc_state_e targetState, int duration) +{ + auto stateChecker = std::bind([](VcMgrTestUtility *instance, vc_state_e target) { + return target == instance->mCurrentState; + }, this, targetState); + + return VcCommonTestUtility::WaitCondtion(stateChecker, duration); +} + +bool VcMgrTestUtility::IsServiceStateChanged(vc_service_state_e targetState, int duration) +{ + auto serviceStateChecker = std::bind([](VcMgrTestUtility *instance, vc_service_state_e target) { + return target == instance->mCurrentServiceState; + }, this, targetState); + + return VcCommonTestUtility::WaitCondtion(serviceStateChecker, duration); +} + +bool VcMgrTestUtility::IsErrorOccurring(int duration) +{ + auto errorChecker = std::bind([](VcMgrTestUtility *instance) { + return instance->mErrorOccured; + }, this); + + return VcCommonTestUtility::WaitCondtion(errorChecker, duration); +} + +bool VcMgrTestUtility::IsAllResultReceived(int duration) +{ + auto resultChecker = std::bind([](VcMgrTestUtility *instance) { + return instance->mAllResultReceived; + }, this); + + return VcCommonTestUtility::WaitCondtion(resultChecker, duration); +} + +bool VcMgrTestUtility::IsResultReceived(int duration) +{ + auto resultChecker = std::bind([](VcMgrTestUtility *instance) { + return instance->mResultReceived; + }, this); + + return VcCommonTestUtility::WaitCondtion(resultChecker, duration); +} + +bool VcMgrTestUtility::IsSpeechDetected(int duration) +{ + auto resultChecker = std::bind([](VcMgrTestUtility *instance) { + return instance->mSpeechDetected; + }, this); + + return VcCommonTestUtility::WaitCondtion(resultChecker, duration); +} + +bool VcMgrTestUtility::Prepare() +{ + vc_state_e state = VC_STATE_INITIALIZED; + vc_mgr_get_state(&state); + if (VC_STATE_INITIALIZED != state) { + return false; + } + + vc_mgr_prepare(); + return IsStateChanged(VC_STATE_READY, 5); +} + +bool VcMgrTestUtility::Unprepare() +{ + vc_state_e state = VC_STATE_INITIALIZED; + vc_mgr_get_state(&state); + if (VC_STATE_READY != state) { + return false; + } + + vc_mgr_unprepare(); + return IsStateChanged(VC_STATE_INITIALIZED, 5); +} + +void VcMgrTestUtility::SetDefaultCommands() +{ + mDefaultCommandList = VcCommonTestUtility::CreateSystemCommandList(); + vc_mgr_set_command_list(mDefaultCommandList); +} + +bool VcMgrTestUtility::Start(bool isExclusive) +{ + EXPECT_EQ(vc_mgr_start(isExclusive), VC_ERROR_NONE); + return IsServiceStateChanged(VC_SERVICE_STATE_RECORDING, 5); +} + +bool VcMgrTestUtility::Stop() +{ + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); + return IsServiceStateChanged(VC_SERVICE_STATE_PROCESSING, 5); +} + +bool VcMgrTestUtility::Cancel() +{ + EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); + return IsServiceStateChanged(VC_SERVICE_STATE_READY, 5); +} + +void VcMgrTestUtility::SimulateVoiceRecording() +{ + EXPECT_EQ(vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_MANUAL), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_OUTSIDE), VC_ERROR_NONE); + + SetDefaultCommands(); + ASSERT_EQ(Start(false), true); + + GetTestPCMData(); + + const size_t shift_size = 12000; + int data_num = mPCMSize / shift_size; + for (int i = 0; i <= data_num; i++ ) { + if (0 == i) { + EXPECT_EQ(vc_mgr_send_audio_streaming(VC_AUDIO_STREAMING_EVENT_START, &mPCMData[i*shift_size], shift_size), VC_ERROR_NONE); + } else if (data_num == i) { + EXPECT_EQ(vc_mgr_send_audio_streaming(VC_AUDIO_STREAMING_EVENT_FINISH, &mPCMData[i*shift_size], mPCMSize % shift_size), VC_ERROR_NONE); + } else { + EXPECT_EQ(vc_mgr_send_audio_streaming(VC_AUDIO_STREAMING_EVENT_CONTINUE, &mPCMData[i*shift_size], shift_size), VC_ERROR_NONE); + } + } + + ASSERT_EQ(Stop(), true); +} diff --git a/tests/src/vc_mgr_test_util.h b/tests/src/vc_mgr_test_util.h new file mode 100644 index 0000000..2d8dd92 --- /dev/null +++ b/tests/src/vc_mgr_test_util.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __VC_MGR_TEST_UTIL_H__ +#define __VC_MGR_TEST_UTIL_H__ + + +#include +#include + + +class VcMgrTestUtility { +public: + static void StateChangedCallback(vc_state_e previous, vc_state_e current, void *user_data); + static void ServiceStateChangedCallback(vc_service_state_e previous, vc_service_state_e current, void* user_data); + static void ErrorCallback(vc_error_e reason, void *user_data); + static bool AllResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char *result, const char *msg, void *user_data); + static void ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data); + static void SpeechDetectedCallback(void *user_data); + +public: + VcMgrTestUtility(); + ~VcMgrTestUtility(); + + void GetTestPCMData(); + + void Initialize(); + void Deinitialize(); + + bool Prepare(); + bool Unprepare(); + + void SetDefaultCommands(); + + bool Start(bool isExclusive); + bool Stop(); + bool Cancel(); + + void SimulateVoiceRecording(); + + bool IsStateChanged(vc_state_e targetState, int duration); + bool IsServiceStateChanged(vc_service_state_e targetState, int duration); + bool IsErrorOccurring(int duration); + bool IsAllResultReceived(int duration); + bool IsResultReceived(int duration); + bool IsSpeechDetected(int duration); + +public: + vc_state_e mCurrentState; + vc_service_state_e mCurrentServiceState; + vc_cmd_list_h mDefaultCommandList; + + bool mErrorOccured; + int mGetErrorMessageReturn; + bool mAllResultReceived; + int mSetSelectedResultReturn; + bool mResultReceived; + bool mSpeechDetected; + + char *mErrorMessage; + + unsigned char* mPCMData; + size_t mPCMSize; +}; + + +#endif /* __VC_MGR_TEST_UTIL_H__ */ diff --git a/tests/src/vc_test_util.cpp b/tests/src/vc_test_util.cpp new file mode 100644 index 0000000..3788465 --- /dev/null +++ b/tests/src/vc_test_util.cpp @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include + +#include "vc_common_test_util.h" +#include "vc_test_util.h" + + +VcTestUtility::VcTestUtility() +{ + mCurrentState = VC_STATE_NONE; + mCurrentServiceState = VC_SERVICE_STATE_NONE; + mErrorOccured = false; + mResultReceived = false; + + mErrorMessage = nullptr; + + mTestCommands = VcCommonTestUtility::CreateTestCommandList(); +} + +VcTestUtility::~VcTestUtility() +{ + free(mErrorMessage); + mErrorMessage = nullptr; + + vc_cmd_list_destroy(mTestCommands, true); + mTestCommands = nullptr; + + Deinitialize(); +} + +void VcTestUtility::StateChangedCallback(vc_state_e previous, vc_state_e current, void *user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mCurrentState = current; +} + +void VcTestUtility::ServiceStateChangedCallback(vc_service_state_e previous, vc_service_state_e current, void* user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mCurrentServiceState = current; +} + +void VcTestUtility::ErrorCallback(vc_error_e reason, void *user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mErrorOccured = true; +} + +void VcTestUtility::ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mResultReceived = true; +} + +void VcTestUtility::Initialize() +{ + if (VcCommonTestUtility::IsVcFeatureSupported() == false) { + return; + } + + EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); + + EXPECT_EQ(vc_set_state_changed_cb(StateChangedCallback, this), VC_ERROR_NONE); + EXPECT_EQ(vc_set_service_state_changed_cb(ServiceStateChangedCallback, this), VC_ERROR_NONE); + EXPECT_EQ(vc_set_error_cb(ErrorCallback, this), VC_ERROR_NONE); +} + +void VcTestUtility::Deinitialize() +{ + vc_deinitialize(); +} + +bool VcTestUtility::IsStateChanged(vc_state_e targetState, int duration) +{ + auto stateChecker = std::bind([](VcTestUtility *instance, vc_state_e target) { + return target == instance->mCurrentState; + }, this, targetState); + + return VcCommonTestUtility::WaitCondtion(stateChecker, duration); +} + +bool VcTestUtility::IsServiceStateChanged(vc_service_state_e targetState, int duration) +{ + auto serviceStateChecker = std::bind([](VcTestUtility *instance, vc_service_state_e target) { + return target == instance->mCurrentServiceState; + }, this, targetState); + + return VcCommonTestUtility::WaitCondtion(serviceStateChecker, duration); +} + +bool VcTestUtility::IsErrorOccurring(int duration) +{ + auto errorChecker = std::bind([](VcTestUtility *instance) { + return instance->mErrorOccured; + }, this); + + return VcCommonTestUtility::WaitCondtion(errorChecker, duration); +} + +bool VcTestUtility::IsResultReceived(int duration) +{ + auto resultChecker = std::bind([](VcTestUtility *instance) { + return instance->mResultReceived; + }, this); + + return VcCommonTestUtility::WaitCondtion(resultChecker, duration); +} + +bool VcTestUtility::Prepare() +{ + vc_state_e state = VC_STATE_INITIALIZED; + vc_get_state(&state); + if (VC_STATE_INITIALIZED != state) { + return false; + } + + vc_prepare(); + return IsStateChanged(VC_STATE_READY, 5); +} + +bool VcTestUtility::Unprepare() +{ + vc_state_e state = VC_STATE_INITIALIZED; + vc_get_state(&state); + if (VC_STATE_READY != state) { + return false; + } + + vc_unprepare(); + return IsStateChanged(VC_STATE_INITIALIZED, 5); +} + diff --git a/tests/src/vc_test_util.h b/tests/src/vc_test_util.h new file mode 100644 index 0000000..51e94d3 --- /dev/null +++ b/tests/src/vc_test_util.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#ifndef __VC_TEST_UTIL_H__ +#define __VC_TEST_UTIL_H__ + + +#include +#include + + +class VcTestUtility { +public: + static void StateChangedCallback(vc_state_e previous, vc_state_e current, void *user_data); + static void ServiceStateChangedCallback(vc_service_state_e previous, vc_service_state_e current, void* user_data); + static void ErrorCallback(vc_error_e reason, void *user_data); + static void ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data); + +public: + VcTestUtility(); + ~VcTestUtility(); + + void Initialize(); + void Deinitialize(); + + bool Prepare(); + bool Unprepare(); + + bool IsStateChanged(vc_state_e targetState, int duration); + bool IsServiceStateChanged(vc_service_state_e targetState, int duration); + bool IsErrorOccurring(int duration); + bool IsResultReceived(int duration); + +public: + vc_state_e mCurrentState; + vc_service_state_e mCurrentServiceState; + + bool mErrorOccured; + bool mResultReceived; + + char *mErrorMessage; + vc_cmd_list_h mTestCommands; +}; + + +#endif /* __VC_TEST_UTIL_H__ */ -- 2.7.4 From 37cebfaf189cd591b2805ce51a57d2c40a2a47b4 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 13 Jul 2023 18:04:44 +0900 Subject: [PATCH 07/16] Refactor unit tests with utility class - Contents: This patch fixes all unit tests using new utility class from previous commit. Through this change, many duplicated codes in test cases can be removed. Change-Id: I2a81b9de530f12a20b789755768f6b8da79eca98 Signed-off-by: Suyeon Hwang --- tests/CMakeLists.txt | 2 +- tests/src/test_util.cpp | 57 - tests/src/test_util.h | 33 - tests/src/vc_command_unittests.cpp | 1377 ++++++++++++ tests/src/vc_mgr_unittests.cpp | 2160 ++++++++---------- tests/src/vc_unittests.cpp | 4229 +++++++----------------------------- 6 files changed, 3138 insertions(+), 4720 deletions(-) delete mode 100644 tests/src/test_util.cpp delete mode 100644 tests/src/test_util.h create mode 100644 tests/src/vc_command_unittests.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bec7880..b2e4c8b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -14,7 +14,7 @@ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIE") SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -std=c++11") +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -std=c++14") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}") SET(SOURCES "") diff --git a/tests/src/test_util.cpp b/tests/src/test_util.cpp deleted file mode 100644 index 0a0f1c6..0000000 --- a/tests/src/test_util.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#include -#include -#include -#include - -#include "test_util.h" - -void terminate_current_engine() -{ - char* engine_id = vconf_get_str(VCONFKEY_VC_ENGINE_DEFAULT); - - app_context_h context = nullptr; - EXPECT_EQ(app_manager_get_app_context(engine_id, &context), APP_MANAGER_ERROR_NONE); - EXPECT_NE(context, nullptr); - free(engine_id); - - EXPECT_EQ(app_manager_terminate_app(context), APP_MANAGER_ERROR_NONE); - EXPECT_EQ(app_context_destroy(context), APP_MANAGER_ERROR_NONE); -} - -void wait_engine_terminated(int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - - char* engine_id = vconf_get_str(VCONFKEY_VC_ENGINE_DEFAULT); - - while (max_count > count) { - bool is_running = false; - app_manager_is_running(engine_id, &is_running); - - if (false == is_running) { - return; - } - - ecore_main_loop_iterate(); - usleep(100000); - count++; - } -} diff --git a/tests/src/test_util.h b/tests/src/test_util.h deleted file mode 100644 index 702831b..0000000 --- a/tests/src/test_util.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2022 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __VC_TEST_UTIL_H__ -#define __VC_TEST_UTIL_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -void terminate_current_engine(); -void wait_engine_terminated(int wait_delay); - -#ifdef __cplusplus -} -#endif - -#endif /* __VC_TEST_UTIL_H__ */ \ No newline at end of file diff --git a/tests/src/vc_command_unittests.cpp b/tests/src/vc_command_unittests.cpp new file mode 100644 index 0000000..fc69406 --- /dev/null +++ b/tests/src/vc_command_unittests.cpp @@ -0,0 +1,1377 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include +#include + +#include +#include +#include + +#include "vc_common_test_util.h" + + +static bool test_cmd_list_cb(vc_cmd_h vc_command, void* user_data) +{ + return true; +} + + +namespace { + + +class VCCommandTest : public testing::Test { +public: + virtual void SetUp() { + ecore_init(); + ecore_main_loop_glib_integrate(); + } + + virtual void TearDown() + { + ecore_shutdown(); + } +}; + + +/** + * @testcase utc_vc_cmd_list_create_p1 + * @since_tizen 2.4 + * @description Positive UTC to create command list handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_create_p1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + vc_cmd_list_destroy(list, true); +} + +/** + * @testcase utc_vc_cmd_list_create_n1 + * @since_tizen 2.4 + * @description Negative UTC to create command list handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_create_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_create(nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(nullptr), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_list_destroy_p1 + * @since_tizen 2.4 + * @description Positive UTC to destroy command list handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_destroy_p1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_destroy(list, false), VC_ERROR_NOT_SUPPORTED); + return; + } + + ASSERT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_destroy(list, false), VC_ERROR_NONE); + + ASSERT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + + list = VcCommonTestUtility::CreateTestCommandList(); + ASSERT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_destroy_n1 + * @since_tizen 2.4 + * @description Negative UTC to destroy command list handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_destroy_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_destroy(nullptr, false), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_destroy(nullptr, false), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_list_get_count_p1 + * @since_tizen 2.4 + * @description Positive UTC to get count of command in command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_get_count_p1) +{ + vc_cmd_list_h list = nullptr; + int count = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 0); + + vc_cmd_h command = VcCommonTestUtility::CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 1); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_get_count_n1 + * @since_tizen 2.4 + * @description Negative UTC to get count of command in command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_get_count_n1) +{ + vc_cmd_list_h list = nullptr; + int cnt = 0; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_get_count(nullptr, &cnt), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_get_count(list, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_add_p1 + * @since_tizen 2.4 + * @description Positive UTC to add command in command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_add_p1) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_add_n1 + * @since_tizen 2.4 + * @description Negative UTC to add command in command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_add_n1) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_list_add(list, nullptr), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_add(nullptr, command), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_remove_p1 + * @since_tizen 2.4 + * @description Positive UTC to remove command in command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_remove_p1) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_remove(list, command), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + command = VcCommonTestUtility::CreateTestCommand("test"); + + ASSERT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_remove(list, command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_remove_n1 + * @since_tizen 2.4 + * @description Negative UTC to remove command in command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_remove_n1) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_remove(list, command), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_list_remove(list, nullptr), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_remove(nullptr, command), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_remove(list, command), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_remove_all_p1 + * @since_tizen 2.4 + * @description Positive UTC to destroy command list handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_remove_all_p1) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_remove_all(list, true), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + command = VcCommonTestUtility::CreateTestCommand("test"); + + int count = -1; + EXPECT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 1); + + EXPECT_EQ(vc_cmd_list_remove_all(list, false), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 0); + + EXPECT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 1); + + EXPECT_EQ(vc_cmd_list_remove_all(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 0); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_remove_all_n1 + * @since_tizen 2.4 + * @description Negative UTC to destroy command list handle (invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_remove_all_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_remove_all(nullptr, true), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_remove_all(nullptr, true), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_list_foreach_commands_p1 + * @since_tizen 2.4 + * @description Positive UTC to get whole command in command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_foreach_commands_p1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_foreach_commands(list, test_cmd_list_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_foreach_commands(list, test_cmd_list_cb, nullptr), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_foreach_commands_n1 + * @since_tizen 2.4 + * @description Negative UTC to get whole command in command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_foreach_commands_n1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_foreach_commands(list, test_cmd_list_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_foreach_commands(list, nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_foreach_commands(nullptr, test_cmd_list_cb, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_filter_by_type_p1 + * @since_tizen 3.0 + * @description Positive UTC to get filtered command list by type + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_filter_by_type_p1) +{ + vc_cmd_list_h base_list = nullptr; + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_filter_by_type(base_list, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_NOT_SUPPORTED); + return; + } + + int count = -1; + base_list = VcCommonTestUtility::CreateTestCommandList(); + + EXPECT_EQ(vc_cmd_list_filter_by_type(base_list, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 1); + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + list = nullptr; + + EXPECT_EQ(vc_cmd_list_filter_by_type(base_list, VC_COMMAND_TYPE_BACKGROUND, &list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_EQ(count, 1); + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + list = nullptr; + + EXPECT_EQ(vc_cmd_list_destroy(base_list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_filter_by_type_n1 + * @since_tizen 3.0 + * @description Negative UTC to get filtered command list by type (invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_filter_by_type_n1) +{ + vc_cmd_list_h base_list = nullptr; + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_filter_by_type(base_list, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_NOT_SUPPORTED); + return; + } + + base_list = VcCommonTestUtility::CreateTestCommandList(); + + EXPECT_EQ(vc_cmd_list_filter_by_type(nullptr, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_filter_by_type(base_list, -1, &list), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_filter_by_type(base_list, VC_COMMAND_TYPE_FOREGROUND, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_list_destroy(base_list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_first_p1 + * @since_tizen 2.4 + * @description Positive UTC to move pointer to the first of command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_first_p1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_first_n1 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to the first of command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_first_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_first(nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_first(nullptr), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_list_first_n2 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to the first of command list (Empty list) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_first_n2) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_EMPTY); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_last_p1 + * @since_tizen 2.4 + * @description Positive UTC to move pointer to the last of command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_last_p1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_last_n1 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to the last of command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_last_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_last(nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_last(nullptr), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_list_last_n2 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to the last of command list (Empty list) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_last_n2) +{ + vc_cmd_list_h list = nullptr; + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_EMPTY); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_next_p1 + * @since_tizen 2.4 + * @description Positive UTC to move pointer to next command in command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_next_p1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_next(list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_next_n1 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to next command in command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_next_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_next(nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_next(nullptr), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_list_next_n2 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to next command in command list (Empty list) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_next_n2) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_next(list), VC_ERROR_EMPTY); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_next_n3 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to next command in command list (Iteration end) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_next_n3) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_next(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_next(list), VC_ERROR_ITERATION_END); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_prev_p1 + * @since_tizen 2.4 + * @description Positive UTC to move pointer to previous command in command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_prev_p1) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_prev_n1 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to previous command in command list (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_prev_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_prev(nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_prev(nullptr), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_list_prev_n2 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to next command in command list (Empty list) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_prev_n2) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_EMPTY); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_prev_n3 + * @since_tizen 2.4 + * @description Negative UTC to move pointer to next command in command list (Iteration end) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_prev_n3) +{ + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + + EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_ITERATION_END); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_get_current_p1 + * @since_tizen 2.4 + * @description Positive UTC to get command handle of current pointer + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_get_current_p1) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_get_current(list, &command), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_get_current(list, &command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_get_current_n1 + * @since_tizen 2.4 + * @description Negative UTC to get command handle of current pointer (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_get_current_n1) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_get_current(list, &command), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + + EXPECT_EQ(vc_cmd_list_get_current(nullptr, &command), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_list_get_current(list, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_list_get_current_n2 + * @since_tizen 2.4 + * @description Negative UTC to get command handle of current pointer (Empty list) + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_get_current_n2) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_get_current(list, &command), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_get_current(list, &command), VC_ERROR_EMPTY); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_create_p1 + * @since_tizen 2.4 + * @description Positive UTC to create command handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_create_p1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_create(&command), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_create(&command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_create_n1 + * @since_tizen 2.4 + * @description Negative UTC to create command handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_create_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_create(nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_create(nullptr), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_destroy_p1 + * @since_tizen 2.4 + * @description Positive UTC to destroy command handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_destroy_p1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_destroy_n1 + * @since_tizen 2.4 + * @description Negative UTC to destroy command handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_destroy_n1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_destroy(nullptr), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_destroy(nullptr), VC_ERROR_INVALID_PARAMETER); + + command = VcCommonTestUtility::CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_set_command_p1 + * @since_tizen 2.4 + * @description Positive UTC to set command text in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_command_p1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_command(command, "voice"), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_command(command, "voice"), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_command_n1 + * @since_tizen 2.4 + * @description Negative UTC to set command text in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_command_n1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_command(command, "voice"), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_command(nullptr, "voice"), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_set_command(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_command_p1 + * @since_tizen 2.4 + * @description Positive UTC to get command text in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_command_p1) +{ + const char *command_text = "voice"; + vc_cmd_h command = nullptr; + char *text = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_command(command, &text), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_create(&command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_get_command(command, &text), VC_ERROR_NONE); + EXPECT_EQ(text, nullptr); + + EXPECT_EQ(vc_cmd_set_command(command, command_text), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_get_command(command, &text), VC_ERROR_NONE); + EXPECT_STREQ(text, command_text); + free(text); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_command_n1 + * @since_tizen 2.4 + * @description Negative UTC to get command text in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_command_n1) +{ + vc_cmd_h command = nullptr; + char *text = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_command(command, &text), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_get_command(nullptr, &text), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_get_command(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_unfixed_command_p1 + * @since_tizen 2.4 + * @description Positive UTC to set the unfixed command text in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_unfixed_command_p1) +{ + const char *command_text = "voice"; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_unfixed_command(command, command_text), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_set_unfixed_command(command, command_text), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_unfixed_command_n1 + * @since_tizen 2.4 + * @description Negative UTC to set the unfixed command text in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_unfixed_command_n1) +{ + const char *command_text = "voice"; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_unfixed_command(command, command_text), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_unfixed_command(nullptr, command_text), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_set_unfixed_command(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_unfixed_command_p1 + * @since_tizen 3.0 + * @description Positive UTC to get the unfixed command text in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_unfixed_command_p1) +{ + const char *command_text = "voice"; + vc_cmd_h command = nullptr; + char *text = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_unfixed_command(command, &text), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_create(&command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_get_unfixed_command(command, &text), VC_ERROR_NONE); + EXPECT_EQ(text, nullptr); + + EXPECT_EQ(vc_cmd_set_unfixed_command(command, command_text), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_get_unfixed_command(command, &text), VC_ERROR_NONE); + EXPECT_STREQ(text, command_text); + free(text); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_unfixed_command_n1 + * @since_tizen 3.0 + * @description Negative UTC to get the unfixed command text in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_unfixed_command_n1) +{ + vc_cmd_h command = nullptr; + char *text = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_unfixed_command(command, &text), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_get_unfixed_command(nullptr, &text), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_get_unfixed_command(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_type_p1 + * @since_tizen 2.4 + * @description Positive UTC to set command type in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_type_p1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_type(command, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_set_type(command, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_type_n1 + * @since_tizen 2.4 + * @description Negative UTC to set command type in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_type_n1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_type(command, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_type(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_set_type(command, -1), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_type_p1 + * @since_tizen 2.4 + * @description Positive UTC to get command type in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_type_p1) +{ + vc_cmd_h command = nullptr; + int type = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_type(command, &type), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_type(command, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_get_type(command, &type), VC_ERROR_NONE); + EXPECT_EQ(type, VC_COMMAND_TYPE_BACKGROUND); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_type_n1 + * @since_tizen 2.4 + * @description Negative UTC to get command type in handle (invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_type_n1) +{ + vc_cmd_h command = nullptr; + int type = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_type(command, &type), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_get_type(nullptr, &type), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_get_type(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_format_p1 + * @since_tizen 3.0 + * @description Positive UTC to set command format in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_format_p1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_format(command, VC_COMMAND_FORMAT_FIXED), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_format(command, VC_COMMAND_FORMAT_FIXED), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_format_n1 + * @since_tizen 3.0 + * @description Negative UTC to set command format in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_format_n1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_format(command, VC_COMMAND_FORMAT_FIXED), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_format(nullptr, VC_COMMAND_FORMAT_FIXED), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_set_format(command, -1), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_format_p1 + * @since_tizen 3.0 + * @description Positive UTC to get command format in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_format_p1) +{ + vc_cmd_h command = nullptr; + int type = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_format(command, &type), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_set_format(command, VC_CMD_FORMAT_FIXED_AND_NONFIXED), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_get_format(command, &type), VC_ERROR_NONE); + EXPECT_EQ(type, VC_CMD_FORMAT_FIXED_AND_NONFIXED); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_format_n1 + * @since_tizen 3.0 + * @description Negative UTC to get command format in handle(invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_format_n1) +{ + vc_cmd_h command = nullptr; + int type = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_format(command, &type), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_get_format(nullptr, &type), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_get_format(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_pid_p1 + * @since_tizen 3.0 + * @description Positive UTC to set pid in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_pid_p1) +{ + vc_cmd_h command = nullptr; + int pid = getpid(); + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_pid(command, pid), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_pid(command, pid), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_pid_n1 + * @since_tizen 3.0 + * @description Negative UTC to set pid in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_pid_n1) +{ + vc_cmd_h command = nullptr; + int pid = getpid(); + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_pid(command, pid), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_pid(nullptr, pid), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_set_pid(command, -1), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_pid_p1 + * @since_tizen 3.0 + * @description Positive UTC to get pid format in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_pid_p1) +{ + vc_cmd_h command = nullptr; + int pid = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_pid(command, &pid), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_pid(command, getpid()), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_get_pid(command, &pid), VC_ERROR_NONE); + EXPECT_EQ(pid, getpid()); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_pid_n1 + * @since_tizen 3.0 + * @description Positive UTC to get pid format in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_pid_n1) +{ + vc_cmd_h command = nullptr; + int pid = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_pid(command, &pid), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_get_pid(nullptr, &pid), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_get_pid(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_domain_p1 + * @since_tizen 3.0 + * @description Positive UTC to set command domain in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_domain_p1) +{ + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_domain(command, 1), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_set_domain(command, 1), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_set_domain_n1 + * @since_tizen 3.0 + * @description Negative UTC to set command domain in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_set_domain_n1) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_set_domain(nullptr, 1), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_cmd_set_domain(nullptr, 1), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_cmd_get_domain_p1 + * @since_tizen 3.0 + * @description Positive UTC to get command domain in handle + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_domain_p1) +{ + vc_cmd_h command = nullptr; + int domain = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_domain(command, &domain), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + EXPECT_EQ(vc_cmd_set_domain(command, 1), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_get_domain(command, &domain), VC_ERROR_NONE); + EXPECT_EQ(domain, 1); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_cmd_get_domain_n1 + * @since_tizen 3.0 + * @description Negative UTC to get command domain in handle (Invalid parameter) + */ +TEST_F(VCCommandTest, utc_vc_cmd_get_domain_n1) +{ + vc_cmd_h command = nullptr; + int domain = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_get_domain(command, &domain), VC_ERROR_NOT_SUPPORTED); + return; + } + + command = VcCommonTestUtility::CreateTestCommand("test"); + + EXPECT_EQ(vc_cmd_get_domain(nullptr, &domain), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_cmd_get_domain(command, nullptr), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + + +} // namespace diff --git a/tests/src/vc_mgr_unittests.cpp b/tests/src/vc_mgr_unittests.cpp index 8711dbd..a762bcc 100644 --- a/tests/src/vc_mgr_unittests.cpp +++ b/tests/src/vc_mgr_unittests.cpp @@ -27,521 +27,246 @@ #include "system_info_mock.h" #include "cynara_mock.h" +#include "vc_common_test_util.h" +#include "vc_mgr_test_util.h" + -static const char *TEST_COMMAND_JSON_PATH = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/test_command.json"); static const char *TEST_DEMANDABLE_LIST_XML_PATH = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/test_demandable_list.xml"); -static const char *TEST_EMPTY_FILE_PATH = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/empty_file"); -static const char *TEST_PCM_DATA_PATH = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/test_pcm.dat"); static const char *TEST_DOMAIN = "domain"; static const char *DEFAULT_ENGINE_APP_ID = "org.tizen.vc-engine-default"; -static vc_state_e g_vc_mgr_state = VC_STATE_NONE; -static vc_service_state_e g_vc_mgr_service_state = VC_SERVICE_STATE_NONE; -static bool g_all_result_cb_invoked = false; -static bool g_result_cb_invoked = false; -static bool g_speech_detected_cb_invoked = false; -static bool g_error_cb_invoked = false; -static int g_set_selected_result_return = VC_ERROR_NONE; -static int g_get_error_message_return = VC_ERROR_NONE; - -static unsigned char* g_pcm_data = nullptr; -static long g_pcm_size = 0; -static vc_cmd_list_h g_test_commands = nullptr; - -static bool __is_mgr_state_changed(vc_state_e state, int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && state != g_vc_mgr_state) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } - - if (state != g_vc_mgr_state) { - return false; - } - - return true; -} - -static bool __is_mgr_service_state_changed(vc_service_state_e state, int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && state != g_vc_mgr_service_state) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } - - if (state != g_vc_mgr_service_state) { - return false; - } - - return true; -} - -static void __vc_mgr_specific_engine_result_cb(const char* engine_app_id, const char* event, const char* result, void *user_data) -{ -} - -static bool __vc_mgr_all_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char *result, const char *msg, void *user_data) +static void test_specific_engine_result_cb(const char* engine_app_id, const char* event, const char* result, void *user_data) { - g_all_result_cb_invoked = true; - g_set_selected_result_return = vc_mgr_set_selected_results(g_test_commands); - return false; } -static void __vc_mgr_pre_result_cb(vc_pre_result_event_e event, const char *result, void *user_data) +static void test_pre_result_cb(vc_pre_result_event_e event, const char *result, void *user_data) { } -static void __vc_mgr_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void* user_data) +static void test_dialog_request_cb(int pid, const char *disp_text, const char *utt_text, bool continuous, void *user_data) { - g_result_cb_invoked = true; } -static void __vc_mgr_begin_speech_detected_cb(void *user_data) -{ - g_speech_detected_cb_invoked = true; -} - -static void __vc_mgr_dialog_request_cb(int pid, const char *disp_text, const char *utt_text, bool continuous, void *user_data) -{ -} - -static int __vc_mgr_private_data_set_cb(const char *key, const char *data, void *user_data) +static int test_private_data_set_cb(const char *key, const char *data, void *user_data) { return 0; } -static int __vc_mgr_private_data_requested_cb(const char *key, char **data, void *user_data) +static int test_private_data_requested_cb(const char *key, char **data, void *user_data) { return 0; } -static void __vc_mgr_feedback_audio_format_cb(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type, void *user_data) +static void test_feedback_audio_format_cb(int rate, vc_audio_channel_e channel, vc_audio_type_e audio_type, void *user_data) { } -static void __vc_mgr_feedback_streaming_cb(vc_feedback_event_e event, char* buffer, int len, void *user_data) +static void test_feedback_streaming_cb(vc_feedback_event_e event, char* buffer, int len, void *user_data) { } -static void __vc_current_language_changed_cb(const char* previous, const char* current, void* user_data) +static void test_current_language_changed_cb(const char* previous, const char* current, void* user_data) { } -static bool __vc_supported_language_cb(const char* language, void* user_data) +static bool test_supported_language_cb(const char* language, void* user_data) { return true; } -static void __vc_mgr_state_changed_cb(vc_state_e previous, vc_state_e current, void* user_data) -{ - g_vc_mgr_state = current; -} - -static void __vc_mgr_service_state_changed_cb(vc_service_state_e previous, vc_service_state_e current, void* user_data) -{ - g_vc_mgr_service_state = current; -} - -static void __vc_mgr_error_cb(vc_error_e reason, void* user_data) +static void test_tts_streaming_cb(int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len, void *user_data) { - g_error_cb_invoked = true; - - char *error = nullptr; - g_get_error_message_return = vc_mgr_get_error_message(&error); - free(error); } -static void __vc_mgr_vc_tts_streaming_cb(int pid, int utt_id, vc_feedback_event_e event, char* buffer, int len, void *user_data) -{ -} +namespace { -static vc_cmd_list_h __create_test_command_list() -{ - vc_cmd_h system_command = nullptr; - EXPECT_EQ(vc_cmd_create(&system_command), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_command(system_command, "test"), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_type(system_command, VC_COMMAND_TYPE_SYSTEM), VC_ERROR_NONE); - - vc_cmd_list_h commands = nullptr; - EXPECT_EQ(vc_cmd_list_create(&commands), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_add(commands, system_command), VC_ERROR_NONE); - - return commands; -} -static bool __is_vc_mgr_supported() -{ - bool is_vc_supported = false; - bool is_mic_supported = false; - if (0 != system_info_get_platform_bool("http://tizen.org/feature/speech.control", &is_vc_supported)) +class VcMgrTestInNoneState : public testing::Test { +public: + virtual void SetUp() { - is_vc_supported = false; - } + ecore_init(); + ecore_main_loop_glib_integrate(); + mMgrTestUtil = new VcMgrTestUtility(); - if (0 != system_info_get_platform_bool("http://tizen.org/feature/microphone", &is_mic_supported)) - { - is_mic_supported = false; + VcCommonTestUtility::SetCurrentLanguage("en_US"); } - if (is_vc_supported && is_mic_supported) + virtual void TearDown() { - return true; - } - - return false; -} + delete mMgrTestUtil; + mMgrTestUtil = nullptr; -static bool __is_all_result_cb_invoked(int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && false == g_all_result_cb_invoked) { - ecore_main_loop_iterate(); - usleep(100000); - count++; + VcCommonTestUtility::EnableAutoLanguageSelection(); + ecore_shutdown(); } - return g_all_result_cb_invoked; -} - -static bool __is_result_cb_invoked(int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && false == g_result_cb_invoked) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } +public: + VcMgrTestUtility *mMgrTestUtil = nullptr; +}; - return g_result_cb_invoked; -} +class VcMgrTestInInitializedState : public testing::Test { +public: + virtual void SetUp() + { + ecore_init(); + ecore_main_loop_glib_integrate(); + mMgrTestUtil = new VcMgrTestUtility(); -static bool __is_speech_detected_cb_invoked(int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && false == g_speech_detected_cb_invoked) { - ecore_main_loop_iterate(); - usleep(100000); - count++; + mMgrTestUtil->Initialize(); + VcCommonTestUtility::SetCurrentLanguage("en_US"); } - return g_speech_detected_cb_invoked; -} - -static bool __is_error_cb_invoked(int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && false == g_error_cb_invoked) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } + virtual void TearDown() + { + mMgrTestUtil->Unprepare(); - return g_error_cb_invoked; -} + delete mMgrTestUtil; + mMgrTestUtil = nullptr; -static void __get_test_PCM_data() -{ - const char* pcm_path = TEST_PCM_DATA_PATH; - FILE* fp_in = fopen(pcm_path, "rb"); - if (fp_in == nullptr) { - return; + VcCommonTestUtility::EnableAutoLanguageSelection(); + ecore_shutdown(); } - fseek(fp_in, 0, SEEK_END); - long size = ftell(fp_in); - fseek(fp_in, 0, SEEK_SET); - if (size <= 0) { - fclose(fp_in); - return; - } +public: + VcMgrTestUtility *mMgrTestUtil = nullptr; +}; - unsigned char* data = (unsigned char*)calloc(sizeof(unsigned char), size); - if (NULL == data) { - fclose(fp_in); - return; - } - size_t read_size = fread(data, sizeof(unsigned char), size, fp_in); - fclose(fp_in); +class VcMgrTestInReadyState : public testing::Test { +public: + virtual void SetUp() + { + ecore_init(); + ecore_main_loop_glib_integrate(); + mMgrTestUtil = new VcMgrTestUtility(); - if (read_size <= 0) { - free(data); - return; + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + VcCommonTestUtility::SetCurrentLanguage("en_US"); } - g_pcm_size = size; - g_pcm_data = data; - - return; -} - -static void __initialize_test_environment() -{ - ecore_init(); - ecore_main_loop_glib_integrate(); - - g_vc_mgr_state = VC_STATE_NONE; - g_vc_mgr_service_state = VC_SERVICE_STATE_NONE; - - g_all_result_cb_invoked = false; - g_result_cb_invoked = false; - g_speech_detected_cb_invoked = false; - g_error_cb_invoked = false; - g_set_selected_result_return = VC_ERROR_OPERATION_FAILED; - g_get_error_message_return = VC_ERROR_OPERATION_FAILED; - - g_test_commands = __create_test_command_list(); - - vc_setting_initialize(); - vc_setting_set_language("en_US"); -} - -static void __shutdown_test_environment() -{ - vc_cmd_list_destroy(g_test_commands, true); - g_test_commands = nullptr; - - vc_setting_set_auto_language(true); - vc_setting_deinitialize(); - - ecore_shutdown(); -} - -static void __test_voice_recording() -{ - EXPECT_EQ(vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_MANUAL), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_OUTSIDE), VC_ERROR_NONE); - - ASSERT_EQ(vc_mgr_set_command_list(g_test_commands), VC_ERROR_NONE); - - ASSERT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + virtual void TearDown() + { + mMgrTestUtil->Unprepare(); - __get_test_PCM_data(); - ASSERT_NE(g_pcm_data, nullptr); - ASSERT_GT(g_pcm_size, 0); + delete mMgrTestUtil; + mMgrTestUtil = nullptr; - const size_t shift_size = 12000; - int data_num = g_pcm_size / shift_size; - for (int i = 0; i <= data_num; i++ ) { - if (0 == i) { - EXPECT_EQ(vc_mgr_send_audio_streaming(VC_AUDIO_STREAMING_EVENT_START, &g_pcm_data[i*shift_size], shift_size), VC_ERROR_NONE); - } else if (data_num == i) { - EXPECT_EQ(vc_mgr_send_audio_streaming(VC_AUDIO_STREAMING_EVENT_FINISH, &g_pcm_data[i*shift_size], g_pcm_size % shift_size), VC_ERROR_NONE); - } else { - EXPECT_EQ(vc_mgr_send_audio_streaming(VC_AUDIO_STREAMING_EVENT_CONTINUE, &g_pcm_data[i*shift_size], shift_size), VC_ERROR_NONE); - } + VcCommonTestUtility::EnableAutoLanguageSelection(); + ecore_shutdown(); } - ASSERT_EQ(vc_mgr_stop(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_PROCESSING, 5), true); -} - -namespace { - -class VcMgrTestInNoneState : public testing::Test { - public: - virtual void SetUp() - { - __initialize_test_environment(); - __is_feature_supported = __is_vc_mgr_supported(); - } - - virtual void TearDown() - { - vc_mgr_deinitialize(); - __shutdown_test_environment(); - } - - public: - bool __is_feature_supported = false; -}; - -class VcMgrTestInInitializedState : public testing::Test { - public: - virtual void SetUp() - { - __initialize_test_environment(); - __is_feature_supported = __is_vc_mgr_supported(); - - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_state_changed_cb(__vc_mgr_state_changed_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_service_state_changed_cb(__vc_mgr_service_state_changed_cb, nullptr), VC_ERROR_NONE); - } - - virtual void TearDown() - { - vc_mgr_unprepare(); - EXPECT_EQ(vc_mgr_unset_state_changed_cb(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); - - __shutdown_test_environment(); - } - - public: - bool __is_feature_supported = false; +public: + VcMgrTestUtility *mMgrTestUtil = nullptr; }; -class VcMgrTestInReadyState : public testing::Test { - public: - virtual void SetUp() - { - __initialize_test_environment(); - __is_feature_supported = __is_vc_mgr_supported(); - - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_state_changed_cb(__vc_mgr_state_changed_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_service_state_changed_cb(__vc_mgr_service_state_changed_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(true, __is_mgr_state_changed(VC_STATE_READY, 5)); - ASSERT_EQ(true, __is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5)); - } - - virtual void TearDown() - { - EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_unset_state_changed_cb(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); - - __shutdown_test_environment(); - } - - public: - bool __is_feature_supported = false; -}; /** * @testcase utc_vc_mgr_initialize_p1 * @since_tizen 5.0 - * @description Positive UTC for initialize voice control manager handle + * @description Positive UTC to initialize voice control manager */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_initialize_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + return; } -} -/** - * @testcase utc_vc_mgr_initialize_p2 - * @since_tizen 5.0 - * @description Positive UTC for initialize voice control manager handle - */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_initialize_p2) -{ - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); - } + EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_deinitialize_p + * @testcase utc_vc_mgr_deinitialize_p1 * @since_tizen 5.0 - * @description Positive UTC for deinitialize voice control manager handle + * @description Positive UTC to deinitialize voice control manager */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_deinitialize_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_deinitialize_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); + return; } + + EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_deinitialize_n + * @testcase utc_vc_mgr_deinitialize_n1 * @since_tizen 5.0 - * @description Negative UTC for deinitialize voice control manager handle + * @description Negative UTC to deinitialize voice control manager */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_deinitialize_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_deinitialize_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_INVALID_STATE); + return; } + + EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_prepare_p + * @testcase utc_vc_mgr_prepare_p1 * @since_tizen 5.0 - * @description Positive UTC for connect service daemon + * @description Positive UTC to connect service engine */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_prepare_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_prepare_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); + ASSERT_EQ(mMgrTestUtil->IsStateChanged(VC_STATE_READY, 5), true); } /** - * @testcase utc_vc_mgr_prepare_n + * @testcase utc_vc_mgr_prepare_n1 * @since_tizen 5.0 - * @description Negative UTC for connect service daemon + * @description Negative UTC to connect service engine */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_prepare_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_prepare_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); + EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_INVALID_STATE); + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unprepare_p + * @testcase utc_vc_mgr_unprepare_p1 * @since_tizen 5.0 - * @description Positive UTC for disconnect service daemon + * @description Positive UTC to disconnect service engine */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unprepare_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unprepare_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); - EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_unprepare_n + * @testcase utc_vc_mgr_unprepare_n1 * @since_tizen 5.0 - * @description Negative UTC for disconnect service daemon + * @description Negative UTC to disconnect service engine */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unprepare_n) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unprepare_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_NOT_SUPPORTED); return; } @@ -550,28 +275,28 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unprepare_n) } /** - * @testcase utc_vc_mgr_foreach_supported_languages_p + * @testcase utc_vc_mgr_foreach_supported_languages_p1 * @since_tizen 5.0 - * @description Positive UTC for get supported language list + * @description Positive UTC to get supported language list */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_foreach_supported_languages_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_foreach_supported_languages_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_foreach_supported_languages(__vc_supported_language_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_foreach_supported_languages(__vc_supported_language_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_foreach_supported_languages_n1 * @since_tizen 5.0 - * @description Negatvie UTC for get supported language list + * @description Negatvie UTC to get supported language list */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_foreach_supported_languages_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_foreach_supported_languages(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -582,27 +307,27 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_foreach_supported_languages_n1) /** * @testcase utc_vc_mgr_foreach_supported_languages_n2 * @since_tizen 5.0 - * @description Negatvie UTC for get supported language list + * @description Negatvie UTC to get supported language list */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_foreach_supported_languages_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_foreach_supported_languages(__vc_supported_language_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_foreach_supported_languages(__vc_supported_language_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_get_current_language_p + * @testcase utc_vc_mgr_get_current_language_p1 * @since_tizen 5.0 - * @description Positive UTC for get current language + * @description Positive UTC to get current language */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_language_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_language_p1) { char *language = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_current_language(&language), VC_ERROR_NOT_SUPPORTED); free(language); return; @@ -616,11 +341,11 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_language_p) /** * @testcase utc_vc_mgr_get_current_language_n1 * @since_tizen 5.0 - * @description Negatvie UTC for get current language + * @description Negatvie UTC to get current language */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_language_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_current_language(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -631,14 +356,13 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_language_n1) /** * @testcase utc_vc_mgr_get_current_language_n2 * @since_tizen 5.0 - * @description Negatvie UTC for get current language + * @description Negatvie UTC to get current language */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_current_language_n2) { char *language = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_current_language(&language), VC_ERROR_NOT_SUPPORTED); - free(language); return; } @@ -648,45 +372,32 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_current_language_n2) /** * @testcase utc_vc_mgr_get_state_p1 * @since_tizen 5.0 - * @description Positive UTC for get current state + * @description Positive UTC to get current state */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_state_p1) { vc_state_e state; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_state(&state), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_get_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_STATE_INITIALIZED); -} - -/** - * @testcase utc_vc_mgr_get_state_p2 - * @since_tizen 5.0 - * @description Positive UTC for get current state - */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_state_p2) -{ - vc_state_e state; - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_get_state(&state), VC_ERROR_NOT_SUPPORTED); - return; - } + mMgrTestUtil->Prepare(); EXPECT_EQ(vc_mgr_get_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_STATE_READY); } /** - * @testcase utc_vc_mgr_get_state_n + * @testcase utc_vc_mgr_get_state_n1 * @since_tizen 5.0 - * @description Negative UTC for get current state + * @description Negative UTC to get current state */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_state_n) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_state_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_state(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -697,12 +408,12 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_state_n) /** * @testcase utc_vc_mgr_get_state_n2 * @since_tizen 5.0 - * @description Negative UTC for get current state + * @description Negative UTC to get current state */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_state_n2) { vc_state_e state; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_state(&state), VC_ERROR_NOT_SUPPORTED); return; } @@ -711,14 +422,14 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_state_n2) } /** - * @testcase utc_vc_mgr_get_service_state_p + * @testcase utc_vc_mgr_get_service_state_p1 * @since_tizen 5.0 - * @description Positive UTC for get current state of service daemon + * @description Positive UTC to get current state of service engine */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_service_state_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_service_state_p1) { vc_service_state_e state; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_NOT_SUPPORTED); return; } @@ -730,11 +441,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_service_state_p) /** * @testcase utc_vc_mgr_get_service_state_n1 * @since_tizen 5.0 - * @description Negative UTC for get current state of service daemon + * @description Negative UTC to get current state of service engine */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_service_state_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_service_state(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -745,12 +456,12 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_service_state_n1) /** * @testcase utc_vc_mgr_get_service_state_n2 * @since_tizen 5.0 - * @description Negative UTC for get current state of service daemon + * @description Negative UTC to get current state of service engine */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_service_state_n2) { vc_service_state_e state; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_NOT_SUPPORTED); return; } @@ -759,15 +470,15 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_service_state_n2) } /** - * @testcase utc_vc_mgr_is_command_format_supported_p + * @testcase utc_vc_mgr_is_command_format_supported_p1 * @since_tizen 5.0 - * @description Positive UTC for get supported command format + * @description Positive UTC to get supported command format */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_is_command_format_supported_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_is_command_format_supported_p1) { int format = VC_COMMAND_FORMAT_FIXED; bool support = false; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_is_command_format_supported(format, &support), VC_ERROR_NOT_SUPPORTED); return; } @@ -778,12 +489,12 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_is_command_format_supported_p) /** * @testcase utc_vc_mgr_is_command_format_supported_n1 * @since_tizen 5.0 - * @description Negative UTC for get supported command format + * @description Negative UTC to get supported command format */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_is_command_format_supported_n1) { int format = VC_COMMAND_FORMAT_FIXED; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_is_command_format_supported(format, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -794,13 +505,13 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_is_command_format_supported_n1) /** * @testcase utc_vc_mgr_is_command_format_supported_n2 * @since_tizen 5.0 - * @description Negative UTC for get supported command format + * @description Negative UTC to get supported command format */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_is_command_format_supported_n2) { int format = VC_COMMAND_FORMAT_FIXED; bool support = false; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_is_command_format_supported(format, &support), VC_ERROR_NOT_SUPPORTED); return; } @@ -809,33 +520,33 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_is_command_format_supported_n2) } /** - * @testcase utc_vc_mgr_set_command_list_p + * @testcase utc_vc_mgr_set_command_list_p1 * @since_tizen 5.0 - * @description Positive UTC for set command list used as candidate set + * @description Positive UTC to set command list used as candidate set */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_p1) { - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_NE(commands, nullptr); + vc_cmd_list_h commands = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NOT_SUPPORTED); - vc_cmd_list_destroy(commands, true); return; } + commands = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - vc_cmd_list_destroy(commands, true); + EXPECT_EQ(vc_cmd_list_destroy(commands, true), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_command_list_n1 * @since_tizen 5.0 - * @description Negative UTC for set command list used as candidate set + * @description Negative UTC to set command list used as candidate set */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_command_list(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -846,51 +557,49 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_n1) /** * @testcase utc_vc_mgr_set_command_list_n2 * @since_tizen 5.0 - * @description Negative UTC for set command list used as candidate set + * @description Negative UTC to set command list used as candidate set */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_n2) { - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_NE(commands, nullptr); + vc_cmd_list_h commands = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NOT_SUPPORTED); - vc_cmd_list_destroy(commands, true); return; } + commands = VcCommonTestUtility::CreateTestCommandList(); + ASSERT_NE(commands, nullptr); + EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_INVALID_STATE); - vc_cmd_list_destroy(commands, true); + EXPECT_EQ(vc_cmd_list_destroy(commands, true), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_unset_command_list_p + * @testcase utc_vc_mgr_unset_command_list_p1 * @since_tizen 5.0 - * @description Positive UTC for unset command list used as candidate set + * @description Positive UTC to unset command list used as candidate set */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unset_command_list_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unset_command_list_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_command_list(), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_NE(commands, nullptr); + mMgrTestUtil->SetDefaultCommands(); - EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); EXPECT_EQ(vc_mgr_unset_command_list(), VC_ERROR_NONE); - vc_cmd_list_destroy(commands, true); } /** - * @testcase utc_vc_mgr_unset_command_list_n + * @testcase utc_vc_mgr_unset_command_list_n1 * @since_tizen 5.0 - * @description Negative UTC for unset command list used as candidate set + * @description Negative UTC to unset command list used as candidate set */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_command_list_n) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_command_list_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_command_list(), VC_ERROR_NOT_SUPPORTED); return; } @@ -899,90 +608,97 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_command_list_n) } /** - * @testcase utc_vc_mgr_set_command_list_from_file_p + * @testcase utc_vc_mgr_set_command_list_from_file_p1 * @since_tizen 5.0 - * @description Positive UTC for unset command list from file used as candidate set + * @description Positive UTC to unset command list from file used as candidate set */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_from_file_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_from_file_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); + + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_command_list_from_file_n1 * @since_tizen 5.0 - * @description Negative UTC for unset command list from file used as candidate set + * @description Negative UTC to unset command list from file used as candidate set */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_from_file_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_command_list_from_file(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_EMPTY_FILE_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_set_command_list_from_file(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_EMPTY_FILE_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_mgr_set_command_list_from_file(VcCommonTestUtility::GetCommandEmptyFilePath(), VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_mgr_set_command_list_from_file_n2 * @since_tizen 5.0 - * @description Negative UTC for unset command list from file used as candidate set + * @description Negative UTC to unset command list from file used as candidate set */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_from_file_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_COMMAND_JSON_PATH, -1), VC_ERROR_NOT_SUPPORTED); + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); + + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, -1), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_COMMAND_JSON_PATH, -1), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, -1), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_mgr_set_command_list_from_file_n3 * @since_tizen 5.0 - * @description Negative UTC for unset command list from file used as candidate set + * @description Negative UTC to unset command list from file used as candidate set */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_from_file_n3) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); + + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_preloaded_commands_from_file_p + * @testcase utc_vc_mgr_set_preloaded_commands_from_file_p1 * @since_tizen 5.0 - * @description Positive UTC for set preloaded commands from file used as candidate set + * @description Positive UTC to set preloaded commands from file used as candidate set */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_preloaded_commands_from_file_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_preloaded_commands_from_file_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(TEST_COMMAND_JSON_PATH), VC_ERROR_NOT_SUPPORTED); + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); + + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(filePath), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(TEST_COMMAND_JSON_PATH), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(filePath), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_preloaded_commands_from_file_n1 * @since_tizen 5.0 - * @description Negative UTC for set preloaded commands from file used as candidate set + * @description Negative UTC to set preloaded commands from file used as candidate set */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_preloaded_commands_from_file_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -993,42 +709,46 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_preloaded_commands_from_file_n1) /** * @testcase utc_vc_mgr_set_command_list_from_file_n2 * @since_tizen 5.0 - * @description Negative UTC for unset command list from file used as candidate set + * @description Negative UTC to unset command list from file used as candidate set */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_from_file_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(TEST_COMMAND_JSON_PATH), VC_ERROR_NOT_SUPPORTED); + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); + + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(filePath), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(TEST_COMMAND_JSON_PATH), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(filePath), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_get_current_commands_p + * @testcase utc_vc_mgr_get_current_commands_p1 * @since_tizen 5.0 - * @description Positive UTC for get command handle of current pointer + * @description Positive UTC to get command of current pointer */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_current_commands_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_current_commands_p1) { vc_cmd_list_h commands = nullptr; - if (false == __is_feature_supported) { + + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_current_commands(&commands), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_get_current_commands(&commands), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_destroy(commands, true), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_get_current_commands_n1 * @since_tizen 5.0 - * @description Negative UTC for get command handle of current pointer + * @description Negative UTC to get command of current pointer */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_current_commands_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_current_commands(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1039,12 +759,12 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_current_commands_n1) /** * @testcase utc_vc_mgr_get_current_commands_n2 * @since_tizen 5.0 - * @description Negative UTC for get command handle of current pointer + * @description Negative UTC to get command of current pointer */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_commands_n2) { vc_cmd_list_h commands = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_current_commands(&commands), VC_ERROR_NOT_SUPPORTED); return; } @@ -1053,14 +773,14 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_commands_n2) } /** - * @testcase utc_vc_mgr_set_audio_type_p + * @testcase utc_vc_mgr_set_audio_type_p1 * @since_tizen 5.0 - * @description Positive UTC for set audio type + * @description Positive UTC to set audio type */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_audio_type_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_audio_type_p1) { const char *audioType = "audio_id"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_audio_type(audioType), VC_ERROR_NOT_SUPPORTED); return; } @@ -1071,11 +791,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_audio_type_p) /** * @testcase utc_vc_mgr_set_audio_type_n1 * @since_tizen 5.0 - * @description Negative UTC for set audio type + * @description Negative UTC to set audio type */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_audio_type_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_audio_type(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1086,12 +806,12 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_audio_type_n1) /** * @testcase utc_vc_mgr_set_audio_type_n2 * @since_tizen 5.0 - * @description Negative UTC for set audio type + * @description Negative UTC to set audio type */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_type_n2) { const char *audioType = "audio_id"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_audio_type(audioType), VC_ERROR_NOT_SUPPORTED); return; } @@ -1100,16 +820,15 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_type_n2) } /** - * @testcase utc_vc_mgr_get_audio_type_p + * @testcase utc_vc_mgr_get_audio_type_p1 * @since_tizen 5.0 - * @description Positive UTC for get audio type + * @description Positive UTC to get audio type */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_audio_type_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_audio_type_p1) { char *audioType = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_audio_type(&audioType), VC_ERROR_NOT_SUPPORTED); - free(audioType); return; } @@ -1120,11 +839,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_audio_type_p) /** * @testcase utc_vc_mgr_get_audio_type_n1 * @since_tizen 5.0 - * @description Positive UTC for get audio type + * @description Positive UTC to get audio type */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_audio_type_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_audio_type(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1135,29 +854,27 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_audio_type_n1) /** * @testcase utc_vc_mgr_get_audio_type_n2 * @since_tizen 5.0 - * @description Positive UTC for get audio type + * @description Positive UTC to get audio type */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_audio_type_n2) { char *audioType = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_audio_type(&audioType), VC_ERROR_NOT_SUPPORTED); - free(audioType); return; } EXPECT_EQ(vc_mgr_get_audio_type(&audioType), VC_ERROR_INVALID_STATE); - free(audioType); } /** - * @testcase utc_vc_mgr_set_recognition_mode_p + * @testcase utc_vc_mgr_set_recognition_mode_p1 * @since_tizen 5.0 - * @description Positive UTC for set recognition mode + * @description Positive UTC to set recognition mode */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_recognition_mode_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_recognition_mode_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_STOP_BY_SILENCE), VC_ERROR_NOT_SUPPORTED); return; } @@ -1168,11 +885,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_recognition_mode_p) /** * @testcase utc_vc_mgr_set_recognition_mode_n1 * @since_tizen 5.0 - * @description Negative UTC for set recognition mode + * @description Negative UTC to set recognition mode */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_recognition_mode_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_recognition_mode(static_cast(-1)), VC_ERROR_NOT_SUPPORTED); return; } @@ -1183,11 +900,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_recognition_mode_n1) /** * @testcase utc_vc_mgr_set_recognition_mode_n2 * @since_tizen 5.0 - * @description Negative UTC for set recognition mode + * @description Negative UTC to set recognition mode */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_recognition_mode_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_STOP_BY_SILENCE), VC_ERROR_NOT_SUPPORTED); return; } @@ -1196,14 +913,14 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_recognition_mode_n2) } /** - * @testcase utc_vc_mgr_get_recognition_mode_p + * @testcase utc_vc_mgr_get_recognition_mode_p1 * @since_tizen 5.0 - * @description Positive UTC for get recognition mode + * @description Positive UTC to get recognition mode */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recognition_mode_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recognition_mode_p1) { vc_recognition_mode_e mode = VC_RECOGNITION_MODE_MANUAL; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_recognition_mode(&mode), VC_ERROR_NOT_SUPPORTED); return; } @@ -1216,11 +933,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recognition_mode_p) /** * @testcase utc_vc_mgr_get_recognition_mode_n1 * @since_tizen 5.0 - * @description Negative UTC for get recognition mode + * @description Negative UTC to get recognition mode */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recognition_mode_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_recognition_mode(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1231,12 +948,12 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recognition_mode_n1) /** * @testcase utc_vc_mgr_get_recognition_mode_n2 * @since_tizen 5.0 - * @description Negative UTC for get recognition mode + * @description Negative UTC to get recognition mode */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_recognition_mode_n2) { vc_recognition_mode_e mode = VC_RECOGNITION_MODE_MANUAL; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_recognition_mode(&mode), VC_ERROR_NOT_SUPPORTED); return; } @@ -1245,15 +962,15 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_recognition_mode_n2) } /** - * @testcase utc_vc_mgr_set_private_data_p + * @testcase utc_vc_mgr_set_private_data_p1 * @since_tizen 5.0 - * @description Positive UTC for set private data + * @description Positive UTC to set private data */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_private_data_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_private_data_p1) { const char *key = "key"; const char *data = "data"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_private_data(key, data), VC_ERROR_NOT_SUPPORTED); EXPECT_EQ(vc_mgr_set_private_data(key, nullptr), VC_ERROR_NOT_SUPPORTED); return; @@ -1266,12 +983,12 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_private_data_p) /** * @testcase utc_vc_mgr_set_private_data_n1 * @since_tizen 5.0 - * @description Negative UTC for set private data + * @description Negative UTC to set private data */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_private_data_n1) { const char *data = "data"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_private_data(nullptr, data), VC_ERROR_NOT_SUPPORTED); return; } @@ -1282,13 +999,13 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_private_data_n1) /** * @testcase utc_vc_mgr_set_private_data_n2 * @since_tizen 5.0 - * @description Negative UTC for set private data + * @description Negative UTC to set private data */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_n2) { const char *key = "key"; const char *data = "data"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_private_data(key, data), VC_ERROR_NOT_SUPPORTED); return; } @@ -1297,17 +1014,16 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_n2) } /** - * @testcase utc_vc_mgr_get_private_data_p + * @testcase utc_vc_mgr_get_private_data_p1 * @since_tizen 5.0 - * @description Positive UTC for get private data + * @description Positive UTC to get private data */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_private_data_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_private_data_p1) { const char *key = "key"; char *data = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_private_data(key, &data), VC_ERROR_NOT_SUPPORTED); - free(data); return; } @@ -1318,15 +1034,14 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_private_data_p) /** * @testcase utc_vc_mgr_get_private_data_n1 * @since_tizen 5.0 - * @description Negative UTC for get private data + * @description Negative UTC to get private data */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_private_data_n1) { const char *key = "key"; char *data = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_private_data(nullptr, &data), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_mgr_get_private_data(key, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1337,13 +1052,13 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_private_data_n1) /** * @testcase utc_vc_mgr_get_private_data_n2 * @since_tizen 5.0 - * @description Negative UTC for get private data + * @description Negative UTC to get private data */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_private_data_n2) { const char *key = "key"; char *data = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_private_data(key, &data), VC_ERROR_NOT_SUPPORTED); return; } @@ -1352,14 +1067,14 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_private_data_n2) } /** - * @testcase utc_vc_mgr_do_action_p + * @testcase utc_vc_mgr_do_action_p1 * @since_tizen 5.0 - * @description Positive UTC for requesting the do action + * @description Positive UTC to requesting the do action */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_do_action_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_do_action_p1) { char *event = strdup("send_event"); - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_do_action(VC_SEND_EVENT_TYPE_TEXT, event), VC_ERROR_NOT_SUPPORTED); free(event); return; @@ -1372,14 +1087,13 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_do_action_p) /** * @testcase utc_vc_mgr_do_action_n1 * @since_tizen 5.0 - * @description Negative UTC for requesting the do action + * @description Negative UTC to requesting the do action */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_do_action_n1) { char *event = strdup("send_event"); - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_do_action(static_cast(-1), event), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_mgr_do_action(VC_SEND_EVENT_TYPE_TEXT, nullptr), VC_ERROR_NOT_SUPPORTED); free(event); return; } @@ -1392,32 +1106,30 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_do_action_n1) /** * @testcase utc_vc_mgr_do_action_n2 * @since_tizen 5.0 - * @description Negative UTC for requesting the do action + * @description Negative UTC to requesting the do action */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_do_action_n2) { char *event = strdup("send_event"); - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_do_action(VC_SEND_EVENT_TYPE_TEXT, event), VC_ERROR_NOT_SUPPORTED); - free(event); return; } EXPECT_EQ(vc_mgr_do_action(VC_SEND_EVENT_TYPE_TEXT, event), VC_ERROR_INVALID_STATE); - free(event); } /** - * @testcase utc_vc_mgr_send_specific_engine_request_p + * @testcase utc_vc_mgr_send_specific_engine_request_p1 * @since_tizen 5.0 - * @description Positive UTC for send specific engine request + * @description Positive UTC to send specific engine request */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_specific_engine_request_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_specific_engine_request_p1) { const char* engineAppId = DEFAULT_ENGINE_APP_ID; const char* event = "event"; const char* request = "request"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_specific_engine_request(engineAppId, event, request), VC_ERROR_NOT_SUPPORTED); return; } @@ -1428,16 +1140,15 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_specific_engine_request_p) /** * @testcase utc_vc_mgr_send_specific_engine_request_n1 * @since_tizen 5.0 - * @description Negative UTC for send specific engine request + * @description Negative UTC to send specific engine request */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_specific_engine_request_n1) { const char* engineAppId = DEFAULT_ENGINE_APP_ID; const char* event = "event"; const char* request = "request"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_specific_engine_request(nullptr, event, request), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_mgr_send_specific_engine_request(engineAppId, nullptr, request), VC_ERROR_NOT_SUPPORTED); return; } @@ -1448,14 +1159,14 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_specific_engine_request_n1) /** * @testcase utc_vc_mgr_send_specific_engine_request_n2 * @since_tizen 5.0 - * @description Negative UTC for send specific engine request + * @description Negative UTC to send specific engine request */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_send_specific_engine_request_n2) { const char* engineAppId = DEFAULT_ENGINE_APP_ID; const char* event = "event"; const char* request = "request"; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_specific_engine_request(engineAppId, event, request), VC_ERROR_NOT_SUPPORTED); return; } @@ -1464,61 +1175,52 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_send_specific_engine_request_n2) } /** - * @testcase utc_vc_mgr_start_p + * @testcase utc_vc_mgr_start_p1 * @since_tizen 5.0 - * @description Positive UTC for start about voice control manager + * @description Positive UTC to start about voice control manager */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); + mMgrTestUtil->SetDefaultCommands(); EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); - - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_RECORDING, 5), true); - vc_cmd_list_destroy(commands, true); + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_start_n1 * @since_tizen 5.0 - * @description Negative UTC for start about voice control manager + * @description Negative UTC to start about voice control manager */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); EXPECT_EQ(vc_mgr_start(false), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - - vc_cmd_list_destroy(commands, true); + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_start_n2 * @since_tizen 5.0 - * @description Negative UTC for start about voice control manager + * @description Negative UTC to start about voice control manager */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_start_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NOT_SUPPORTED); return; } @@ -1527,68 +1229,55 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_start_n2) } /** - * @testcase utc_vc_mgr_stop_p + * @testcase utc_vc_mgr_stop_p1 * @since_tizen 5.0 - * @description Positive UTC for stop about voice control manager + * @description Positive UTC to stop about voice control manager */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_PROCESSING, 5), true); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_PROCESSING, 5), true); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - - vc_cmd_list_destroy(commands, true); + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_stop_n1 * @since_tizen 5.0 - * @description Negative UTC for stop about voice control manager + * @description Negative UTC to stop about voice control manager */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); - - EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_PROCESSING, 5), true); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); + mMgrTestUtil->Stop(); EXPECT_EQ(vc_mgr_stop(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - vc_cmd_list_destroy(commands, true); + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_stop_n2 * @since_tizen 5.0 - * @description Negative UTC for stop about voice control manager + * @description Negative UTC to stop about voice control manager */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_stop_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NOT_SUPPORTED); return; } @@ -1597,104 +1286,91 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_stop_n2) } /** - * @testcase utc_vc_mgr_cancel_p + * @testcase utc_vc_mgr_cancel_p1 * @since_tizen 5.0 - * @description Positive UTC for cancel about voice control manager + * @description Positive UTC to cancel about voice control manager */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_cancel_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_cancel_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - - ASSERT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - - vc_cmd_list_destroy(commands, true); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_READY, 5), true); } /** * @testcase utc_vc_mgr_cancel_n1 * @since_tizen 5.0 - * @description Negative UTC for cancel about voice control manager + * @description Negative UTC to cancel about voice control manager */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_cancel_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - - ASSERT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_IN_PROGRESS_TO_READY); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - - vc_cmd_list_destroy(commands, true); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_READY, 5), true); } /** * @testcase utc_vc_mgr_cancel_n2 * @since_tizen 5.0 - * @description Negative UTC for cancel about voice control manager + * @description Negative UTC to cancel about voice control manager */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_cancel_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_get_recording_volume_p + * @testcase utc_vc_mgr_get_recording_volume_p1 * @since_tizen 5.0 - * @description Positive UTC for get recording volume + * @description Positive UTC to get recording volume */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recording_volume_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recording_volume_p1) { float volume = 0.0; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_recording_volume(&volume), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - - ASSERT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); EXPECT_EQ(vc_mgr_get_recording_volume(&volume), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - - vc_cmd_list_destroy(commands, true); + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_get_recording_volume_n1 * @since_tizen 5.0 - * @description Negative UTC for get recording volume + * @description Negative UTC to get recording volume */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recording_volume_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_recording_volume(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1705,12 +1381,12 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recording_volume_n1) /** * @testcase utc_vc_mgr_get_recording_volume_n2 * @since_tizen 5.0 - * @description Negative UTC for get recording volume + * @description Negative UTC to get recording volume */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recording_volume_n2) { float volume = 0; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_recording_volume(&volume), VC_ERROR_NOT_SUPPORTED); return; } @@ -1719,51 +1395,48 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_recording_volume_n2) } /** - * @testcase utc_vc_mgr_set_all_result_cb_p + * @testcase utc_vc_mgr_set_all_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set all result callback + * @description Positive UTC to set all result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_all_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_all_result_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_all_result_cb_p2 * @since_tizen 5.0 - * @description Positive UTC for set all result callback + * @description Positive UTC to set all result callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_all_result_cb_p2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_NONE); - ASSERT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); + mMgrTestUtil->Prepare(); + mMgrTestUtil->SimulateVoiceRecording(); - __test_voice_recording(); - - EXPECT_EQ(__is_all_result_cb_invoked(5), true); + EXPECT_EQ(mMgrTestUtil->IsAllResultReceived(5), true); } /** * @testcase utc_vc_mgr_set_all_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set all result callback + * @description Negative UTC to set all result callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_all_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_all_result_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1774,26 +1447,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_all_result_cb_n1) /** * @testcase utc_vc_mgr_set_all_result_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set all result callback + * @description Negative UTC to set all result callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_all_result_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_all_result_cb_p + * @testcase utc_vc_mgr_unset_all_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset all result callback + * @description Positive UTC to unset all result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_all_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_all_result_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_all_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -1802,43 +1479,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_all_result_cb_p) } /** - * @testcase utc_vc_mgr_unset_all_result_cb_n + * @testcase utc_vc_mgr_unset_all_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset all result callback + * @description Negative UTC to unset all result callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_all_result_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_all_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_all_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_all_result_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_all_result_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_pre_result_cb_p + * @testcase utc_vc_mgr_set_pre_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set pre result callback + * @description Positive UTC to set pre result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_pre_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_pre_result_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_pre_result_cb(__vc_mgr_pre_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_pre_result_cb(test_pre_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_pre_result_cb(__vc_mgr_pre_result_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_pre_result_cb(test_pre_result_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_pre_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set pre result callback + * @description Negative UTC to set pre result callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_pre_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_pre_result_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1849,26 +1530,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_pre_result_cb_n1) /** * @testcase utc_vc_mgr_set_pre_result_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set pre result callback + * @description Negative UTC to set pre result callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_pre_result_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_pre_result_cb(__vc_mgr_pre_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_pre_result_cb(test_pre_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_pre_result_cb(__vc_mgr_pre_result_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_pre_result_cb(test_pre_result_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_pre_result_cb(test_pre_result_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_pre_result_cb_p + * @testcase utc_vc_mgr_unset_pre_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset pre result callback + * @description Positive UTC to unset pre result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_pre_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_pre_result_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_pre_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -1877,43 +1562,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_pre_result_cb_p) } /** - * @testcase utc_vc_mgr_unset_pre_result_cb_n + * @testcase utc_vc_mgr_unset_pre_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset pre result callback + * @description Negative UTC to unset pre result callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_pre_result_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_pre_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_pre_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_pre_result_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_pre_result_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_specific_engine_result_cb_p + * @testcase utc_vc_mgr_set_specific_engine_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set specific engine result callback + * @description Positive UTC to set specific engine result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_specific_engine_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_specific_engine_result_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(__vc_mgr_specific_engine_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(test_specific_engine_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(__vc_mgr_specific_engine_result_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(test_specific_engine_result_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_specific_engine_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set specific engine result callback + * @description Negative UTC to set specific engine result callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_specific_engine_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -1924,26 +1613,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_specific_engine_result_cb_n1) /** * @testcase utc_vc_mgr_set_specific_engine_result_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set specific engine result callback + * @description Negative UTC to set specific engine result callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_specific_engine_result_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(__vc_mgr_specific_engine_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(test_specific_engine_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(__vc_mgr_specific_engine_result_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(test_specific_engine_result_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_specific_engine_result_cb(test_specific_engine_result_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_specific_engine_result_cb_p + * @testcase utc_vc_mgr_unset_specific_engine_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset specific engine result callback + * @description Positive UTC to unset specific engine result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_specific_engine_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_specific_engine_result_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_specific_engine_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -1952,68 +1645,69 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_specific_engine_result_cb_p } /** - * @testcase utc_vc_mgr_unset_specific_engine_result_cb_n + * @testcase utc_vc_mgr_unset_specific_engine_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset specific engine result callback + * @description Negative UTC to unset specific engine result callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_specific_engine_result_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_specific_engine_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_specific_engine_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_specific_engine_result_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_specific_engine_result_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_result_cb_p + * @testcase utc_vc_mgr_set_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set result callback + * @description Positive UTC to set result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_result_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_result_cb(__vc_mgr_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_result_cb(mMgrTestUtil->ResultCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_result_cb(__vc_mgr_result_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_result_cb(mMgrTestUtil->ResultCallback, mMgrTestUtil), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_result_cb_p2 * @since_tizen 5.0 - * @description Positive UTC for set result callback + * @description Positive UTC to set result callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_result_cb_p2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_result_cb(__vc_mgr_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_result_cb(mMgrTestUtil->ResultCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } // TODO: Is it necessary to set all result callback? - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_result_cb(__vc_mgr_result_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_all_result_cb(mMgrTestUtil->AllResultCallback, mMgrTestUtil), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_result_cb(mMgrTestUtil->ResultCallback, mMgrTestUtil), VC_ERROR_NONE); - ASSERT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); + mMgrTestUtil->Prepare(); + mMgrTestUtil->SimulateVoiceRecording(); - __test_voice_recording(); - - EXPECT_EQ(__is_result_cb_invoked(5), true); + EXPECT_EQ(mMgrTestUtil->IsResultReceived(5), true); } /** * @testcase utc_vc_mgr_set_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set result callback + * @description Negative UTC to set result callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_result_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2024,26 +1718,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_result_cb_n1) /** * @testcase utc_vc_mgr_set_result_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set result callback + * @description Negative UTC to set result callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_result_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_result_cb(__vc_mgr_result_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_result_cb(mMgrTestUtil->ResultCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_result_cb(__vc_mgr_result_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_result_cb(mMgrTestUtil->ResultCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_result_cb(mMgrTestUtil->ResultCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_result_cb_p + * @testcase utc_vc_mgr_unset_result_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset result callback + * @description Positive UTC to unset result callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_result_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_result_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2052,43 +1750,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_result_cb_p) } /** - * @testcase utc_vc_mgr_unset_result_cb_n + * @testcase utc_vc_mgr_unset_result_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset result callback + * @description Negative UTC to unset result callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_result_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_result_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_result_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_result_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_result_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_state_changed_cb_p + * @testcase utc_vc_mgr_set_state_changed_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set state changed callback + * @description Positive UTC to set state changed callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_state_changed_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_state_changed_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_state_changed_cb(__vc_mgr_state_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_state_changed_cb(mMgrTestUtil->StateChangedCallback, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_state_changed_cb(__vc_mgr_state_changed_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_state_changed_cb(mMgrTestUtil->StateChangedCallback, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_state_changed_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set state changed callback + * @description Negative UTC to set state changed callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_state_changed_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_state_changed_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2099,26 +1801,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_state_changed_cb_n1) /** * @testcase utc_vc_mgr_set_state_changed_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set state changed callback + * @description Negative UTC to set state changed callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_state_changed_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_state_changed_cb(__vc_mgr_state_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_state_changed_cb(mMgrTestUtil->StateChangedCallback, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_state_changed_cb(__vc_mgr_state_changed_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_state_changed_cb(mMgrTestUtil->StateChangedCallback, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_state_changed_cb(mMgrTestUtil->StateChangedCallback, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_state_changed_cb_p + * @testcase utc_vc_mgr_unset_state_changed_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset state changed callback + * @description Positive UTC to unset state changed callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_state_changed_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_state_changed_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2127,43 +1833,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_state_changed_cb_p) } /** - * @testcase utc_vc_mgr_unset_state_changed_cb_n + * @testcase utc_vc_mgr_unset_state_changed_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset state changed callback + * @description Negative UTC to unset state changed callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_state_changed_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_state_changed_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_state_changed_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_state_changed_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_service_state_changed_cb_p + * @testcase utc_vc_mgr_set_service_state_changed_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set service state changed callback + * @description Positive UTC to set service state changed callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_service_state_changed_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_service_state_changed_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_service_state_changed_cb(__vc_mgr_service_state_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_service_state_changed_cb(mMgrTestUtil->ServiceStateChangedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_service_state_changed_cb(__vc_mgr_service_state_changed_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_service_state_changed_cb(mMgrTestUtil->ServiceStateChangedCallback, mMgrTestUtil), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_service_state_changed_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set service state changed callback + * @description Negative UTC to set service state changed callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_service_state_changed_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_service_state_changed_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2174,26 +1884,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_service_state_changed_cb_n1) /** * @testcase utc_vc_mgr_set_service_state_changed_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set service state changed callback + * @description Negative UTC to set service state changed callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_service_state_changed_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_service_state_changed_cb(__vc_mgr_service_state_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_service_state_changed_cb(mMgrTestUtil->ServiceStateChangedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_service_state_changed_cb(__vc_mgr_service_state_changed_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_service_state_changed_cb(mMgrTestUtil->ServiceStateChangedCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_service_state_changed_cb(mMgrTestUtil->ServiceStateChangedCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_service_state_changed_cb_p + * @testcase utc_vc_mgr_unset_service_state_changed_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset service state changed callback + * @description Positive UTC to unset service state changed callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_service_state_changed_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_service_state_changed_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2202,66 +1916,67 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_service_state_changed_cb_p) } /** - * @testcase utc_vc_mgr_unset_service_state_changed_cb_n + * @testcase utc_vc_mgr_unset_service_state_changed_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset service state changed callback + * @description Negative UTC to unset service state changed callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_service_state_changed_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_service_state_changed_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_speech_detected_cb_p + * @testcase utc_vc_mgr_set_speech_detected_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set speech detected callback + * @description Positive UTC to set speech detected callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_speech_detected_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_speech_detected_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_speech_detected_cb(__vc_mgr_begin_speech_detected_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_speech_detected_cb(mMgrTestUtil->SpeechDetectedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_speech_detected_cb(__vc_mgr_begin_speech_detected_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_speech_detected_cb(mMgrTestUtil->SpeechDetectedCallback, mMgrTestUtil), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_speech_detected_cb_p2 * @since_tizen 5.0 - * @description Positive UTC for set speech detected callback + * @description Positive UTC to set speech detected callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_speech_detected_cb_p2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_speech_detected_cb(__vc_mgr_begin_speech_detected_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_speech_detected_cb(mMgrTestUtil->SpeechDetectedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_speech_detected_cb(__vc_mgr_begin_speech_detected_cb, nullptr), VC_ERROR_NONE); - - ASSERT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); + EXPECT_EQ(vc_mgr_set_speech_detected_cb(mMgrTestUtil->SpeechDetectedCallback, mMgrTestUtil), VC_ERROR_NONE); - __test_voice_recording(); + mMgrTestUtil->Prepare(); + mMgrTestUtil->SimulateVoiceRecording(); - EXPECT_EQ(__is_speech_detected_cb_invoked(5), true); + EXPECT_EQ(mMgrTestUtil->IsSpeechDetected(5), true); } /** * @testcase utc_vc_mgr_set_speech_detected_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set speech detected callback + * @description Negative UTC to set speech detected callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_speech_detected_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_speech_detected_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2272,26 +1987,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_speech_detected_cb_n1) /** * @testcase utc_vc_mgr_set_speech_detected_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set speech detected callback + * @description Negative UTC to set speech detected callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_speech_detected_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_speech_detected_cb(__vc_mgr_begin_speech_detected_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_speech_detected_cb(mMgrTestUtil->SpeechDetectedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_speech_detected_cb(__vc_mgr_begin_speech_detected_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_speech_detected_cb(mMgrTestUtil->SpeechDetectedCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_speech_detected_cb(mMgrTestUtil->SpeechDetectedCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_speech_detected_cb_p + * @testcase utc_vc_mgr_unset_speech_detected_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset speech detected callback + * @description Positive UTC to unset speech detected callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_speech_detected_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_speech_detected_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_speech_detected_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2300,43 +2019,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_speech_detected_cb_p) } /** - * @testcase utc_vc_mgr_unset_speech_detected_cb_n + * @testcase utc_vc_mgr_unset_speech_detected_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset speech detected callback + * @description Negative UTC to unset speech detected callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_speech_detected_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_speech_detected_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_speech_detected_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_speech_detected_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_speech_detected_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_current_language_changed_cb_p + * @testcase utc_vc_mgr_set_current_language_changed_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set current language changed callback + * @description Positive UTC to set current language changed callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_current_language_changed_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_current_language_changed_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(__vc_current_language_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(__vc_current_language_changed_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_current_language_changed_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set current language changed callback + * @description Negative UTC to set current language changed callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_current_language_changed_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_current_language_changed_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2347,26 +2070,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_current_language_changed_cb_n /** * @testcase utc_vc_mgr_set_current_language_changed_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set current language changed callback + * @description Negative UTC to set current language changed callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_current_language_changed_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(__vc_current_language_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(__vc_current_language_changed_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_current_language_changed_cb_p + * @testcase utc_vc_mgr_unset_current_language_changed_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset current language changed callback + * @description Positive UTC to unset current language changed callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_current_language_changed_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_current_language_changed_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_current_language_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2375,60 +2102,50 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_current_language_changed_cb } /** - * @testcase utc_vc_mgr_unset_current_language_changed_cb_n + * @testcase utc_vc_mgr_unset_current_language_changed_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset current language changed callback + * @description Negative UTC to unset current language changed callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_current_language_changed_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_current_language_changed_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_current_language_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_current_language_changed_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_current_language_changed_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_get_error_message_p + * @testcase utc_vc_mgr_get_error_message_p1 * @since_tizen 5.0 - * @description Positive UTC for get error message + * @description Positive UTC to get error message */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_error_message_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_error_message_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - char* engine_id = vconf_get_str(VCONFKEY_VC_ENGINE_DEFAULT); + VcCommonTestUtility::TerminateCurrentEngine(); - app_context_h context = nullptr; - EXPECT_EQ(app_manager_get_app_context(engine_id, &context), APP_MANAGER_ERROR_NONE); - EXPECT_NE(context, nullptr); - free(engine_id); - - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_NONE); - - EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - - EXPECT_EQ(app_manager_terminate_app(context), APP_MANAGER_ERROR_NONE); - app_context_destroy(context); - - EXPECT_EQ(__is_error_cb_invoked(5), true); - EXPECT_EQ(g_get_error_message_return, VC_ERROR_NONE); + EXPECT_EQ(mMgrTestUtil->IsErrorOccurring(5), true); + EXPECT_EQ(mMgrTestUtil->mGetErrorMessageReturn, VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_get_error_message_n1 * @since_tizen 5.0 - * @description Negative UTC for get error message + * @description Negative UTC to get error message */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_error_message_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_error_message(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2439,12 +2156,12 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_error_message_n1) /** * @testcase utc_vc_mgr_get_error_message_n2 * @since_tizen 5.0 - * @description Negative UTC for get error message + * @description Negative UTC to get error message */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_error_message_n2) { char *err_msg = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_error_message(&err_msg), VC_ERROR_NOT_SUPPORTED); return; } @@ -2455,12 +2172,12 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_error_message_n2) /** * @testcase utc_vc_mgr_get_error_message_n3 * @since_tizen 5.0 - * @description Negative UTC for get error message + * @description Negative UTC to get error message */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_error_message_n3) { char *err_msg = nullptr; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_get_error_message(&err_msg), VC_ERROR_NOT_SUPPORTED); return; } @@ -2469,59 +2186,48 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_error_message_n3) } /** - * @testcase utc_vc_mgr_set_error_cb_p + * @testcase utc_vc_mgr_set_error_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set error callback + * @description Positive UTC to set error callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_error_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_error_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_error_cb_p2 * @since_tizen 5.0 - * @description Positive UTC for set error callback + * @description Positive UTC to set error callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_error_cb_p2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - char* engine_id = vconf_get_str(VCONFKEY_VC_ENGINE_DEFAULT); - - app_context_h context = nullptr; - EXPECT_EQ(app_manager_get_app_context(engine_id, &context), APP_MANAGER_ERROR_NONE); - EXPECT_NE(context, nullptr); - free(engine_id); - - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_NONE); - - EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_NONE); - EXPECT_EQ(app_manager_terminate_app(context), APP_MANAGER_ERROR_NONE); - app_context_destroy(context); + mMgrTestUtil->Prepare(); + VcCommonTestUtility::TerminateCurrentEngine(); - EXPECT_EQ(__is_error_cb_invoked(5), true); + EXPECT_EQ(mMgrTestUtil->IsErrorOccurring(5), true); } /** * @testcase utc_vc_mgr_set_error_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set error callback + * @description Negative UTC to set error callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_error_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_error_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2532,26 +2238,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_error_cb_n1) /** * @testcase utc_vc_mgr_set_error_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set error callback + * @description Negative UTC to set error callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_error_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_error_cb(mMgrTestUtil->ErrorCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_error_cb_p + * @testcase utc_vc_mgr_unset_error_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset error callback + * @description Positive UTC to unset error callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_error_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_error_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_error_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2560,43 +2270,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_error_cb_p) } /** - * @testcase utc_vc_mgr_unset_error_cb_n + * @testcase utc_vc_mgr_unset_error_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset error callback + * @description Negative UTC to unset error callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_error_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_error_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_error_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_error_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_error_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_dialog_request_cb_p + * @testcase utc_vc_mgr_set_dialog_request_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set dialog request callback + * @description Positive UTC to set dialog request callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_dialog_request_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_dialog_request_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_dialog_request_cb(__vc_mgr_dialog_request_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_dialog_request_cb(test_dialog_request_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_dialog_request_cb(__vc_mgr_dialog_request_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_dialog_request_cb(test_dialog_request_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_dialog_request_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set dialog request callback + * @description Negative UTC to set dialog request callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_dialog_request_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_dialog_request_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2607,26 +2321,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_dialog_request_cb_n1) /** * @testcase utc_vc_mgr_set_dialog_request_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set dialog request callback + * @description Negative UTC to set dialog request callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_dialog_request_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_dialog_request_cb(__vc_mgr_dialog_request_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_dialog_request_cb(test_dialog_request_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_dialog_request_cb(__vc_mgr_dialog_request_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_dialog_request_cb(test_dialog_request_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_dialog_request_cb(test_dialog_request_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_dialog_request_cb_p + * @testcase utc_vc_mgr_unset_dialog_request_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset dialog request callback + * @description Positive UTC to unset dialog request callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_dialog_request_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_dialog_request_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_dialog_request_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2635,28 +2353,32 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_dialog_request_cb_p) } /** - * @testcase utc_vc_mgr_unset_dialog_request_cb_n + * @testcase utc_vc_mgr_unset_dialog_request_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset dialog request callback + * @description Negative UTC to unset dialog request callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_dialog_request_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_dialog_request_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_dialog_request_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_dialog_request_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_dialog_request_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_enable_command_type_p + * @testcase utc_vc_mgr_enable_command_type_p1 * @since_tizen 5.0 - * @description Positive UTC for enable command type + * @description Positive UTC to enable command type */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_enable_command_type_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_enable_command_type_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_enable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } @@ -2667,11 +2389,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_enable_command_type_p) /** * @testcase utc_vc_mgr_enable_command_type_n1 * @since_tizen 5.0 - * @description Negative UTC for enable command type + * @description Negative UTC to enable command type */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_enable_command_type_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_enable_command_type(-1), VC_ERROR_NOT_SUPPORTED); return; } @@ -2682,29 +2404,29 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_enable_command_type_n1) /** * @testcase utc_vc_mgr_enable_command_type_n2 * @since_tizen 5.0 - * @description Negative UTC for enable command type + * @description Negative UTC to enable command type */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_enable_command_type_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_enable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_enable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + + mMgrTestUtil->Initialize(); EXPECT_EQ(vc_mgr_enable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_disable_command_type_p + * @testcase utc_vc_mgr_disable_command_type_p1 * @since_tizen 5.0 - * @description Positive UTC for disable command type + * @description Positive UTC to disable command type */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_disable_command_type_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_disable_command_type_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_disable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } @@ -2715,11 +2437,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_disable_command_type_p) /** * @testcase utc_vc_mgr_disable_command_type_n1 * @since_tizen 5.0 - * @description Negative UTC for disable command type + * @description Negative UTC to disable command type */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_disable_command_type_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_disable_command_type(-1), VC_ERROR_NOT_SUPPORTED); return; } @@ -2730,44 +2452,44 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_disable_command_type_n1) /** * @testcase utc_vc_mgr_disable_command_type_n2 * @since_tizen 5.0 - * @description Negative UTC for disable command type + * @description Negative UTC to disable command type */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_disable_command_type_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_disable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_disable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + + mMgrTestUtil->Initialize(); EXPECT_EQ(vc_mgr_disable_command_type(VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_set_private_data_set_cb_p + * @testcase utc_vc_mgr_set_private_data_set_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set private data set callback + * @description Positive UTC to set private data set callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_set_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_set_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_private_data_set_cb(__vc_mgr_private_data_set_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_private_data_set_cb(test_private_data_set_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_private_data_set_cb(__vc_mgr_private_data_set_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_private_data_set_cb(test_private_data_set_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_private_data_set_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set private data set callback + * @description Negative UTC to set private data set callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_set_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_private_data_set_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2778,26 +2500,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_set_cb_n1) /** * @testcase utc_vc_mgr_set_private_data_set_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set private data set callback + * @description Negative UTC to set private data set callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_private_data_set_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_private_data_set_cb(__vc_mgr_private_data_set_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_private_data_set_cb(test_private_data_set_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_private_data_set_cb(__vc_mgr_private_data_set_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_private_data_set_cb(test_private_data_set_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_private_data_set_cb(test_private_data_set_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_private_data_set_cb_p + * @testcase utc_vc_mgr_unset_private_data_set_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset private data set callback + * @description Positive UTC to unset private data set callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_private_data_set_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_private_data_set_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_private_data_set_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2806,43 +2532,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_private_data_set_cb_p) } /** - * @testcase utc_vc_mgr_unset_private_data_set_cb_n + * @testcase utc_vc_mgr_unset_private_data_set_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset private data set callback + * @description Negative UTC to unset private data set callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_private_data_set_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_private_data_set_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_private_data_set_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_private_data_set_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_private_data_set_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_private_data_requested_cb_p + * @testcase utc_vc_mgr_set_private_data_requested_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set private data requested callback + * @description Positive UTC to set private data requested callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_requested_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_requested_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_private_data_requested_cb(__vc_mgr_private_data_requested_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_private_data_requested_cb(test_private_data_requested_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_private_data_requested_cb(__vc_mgr_private_data_requested_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_private_data_requested_cb(test_private_data_requested_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_private_data_requested_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set private data requested callback + * @description Negative UTC to set private data requested callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_requested_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_private_data_requested_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2853,26 +2583,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_requested_cb_n1) /** * @testcase utc_vc_mgr_set_private_data_requested_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set private data requested callback + * @description Negative UTC to set private data requested callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_private_data_requested_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_private_data_requested_cb(__vc_mgr_private_data_requested_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_private_data_requested_cb(test_private_data_requested_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_private_data_requested_cb(__vc_mgr_private_data_requested_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_private_data_requested_cb(test_private_data_requested_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_private_data_requested_cb(test_private_data_requested_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_private_data_requested_cb_p + * @testcase utc_vc_mgr_unset_private_data_requested_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset private data requested callback + * @description Positive UTC to unset private data requested callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_private_data_requested_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_private_data_requested_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_private_data_requested_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2881,43 +2615,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_private_data_requested_cb_p } /** - * @testcase utc_vc_mgr_set_feedback_audio_format_cb_p + * @testcase utc_vc_mgr_set_feedback_audio_format_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set feedback audio format callback + * @description Positive UTC to set feedback audio format callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_feedback_audio_format_cb_p) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_feedback_audio_format_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_private_data_requested_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_private_data_requested_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_private_data_requested_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_feedback_audio_format_cb_p + * @testcase utc_vc_mgr_set_feedback_audio_format_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set feedback audio format callback + * @description Positive UTC to set feedback audio format callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_audio_format_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_audio_format_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(__vc_mgr_feedback_audio_format_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(test_feedback_audio_format_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(__vc_mgr_feedback_audio_format_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(test_feedback_audio_format_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_feedback_audio_format_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set feedback audio format callback + * @description Negative UTC to set feedback audio format callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_audio_format_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -2928,26 +2666,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_audio_format_cb_n1) /** * @testcase utc_vc_mgr_set_feedback_audio_format_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set feedback audio format callback + * @description Negative UTC to set feedback audio format callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_feedback_audio_format_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(__vc_mgr_feedback_audio_format_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(test_feedback_audio_format_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(__vc_mgr_feedback_audio_format_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(test_feedback_audio_format_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_feedback_audio_format_cb(test_feedback_audio_format_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_feedback_audio_format_cb_p + * @testcase utc_vc_mgr_unset_feedback_audio_format_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset feedback audio format callback + * @description Positive UTC to unset feedback audio format callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_feedback_audio_format_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_feedback_audio_format_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_feedback_audio_format_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -2956,43 +2698,47 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_feedback_audio_format_cb_p) } /** - * @testcase utc_vc_mgr_unset_feedback_audio_format_cb_n + * @testcase utc_vc_mgr_unset_feedback_audio_format_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset feedback audio format callback + * @description Negative UTC to unset feedback audio format callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_feedback_audio_format_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_feedback_audio_format_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_feedback_audio_format_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_feedback_audio_format_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_feedback_audio_format_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_feedback_streaming_cb_p + * @testcase utc_vc_mgr_set_feedback_streaming_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set feedback streaming callback + * @description Positive UTC to set feedback streaming callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_streaming_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_streaming_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(__vc_mgr_feedback_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(test_feedback_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(__vc_mgr_feedback_streaming_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(test_feedback_streaming_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_feedback_streaming_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set feedback streaming callback + * @description Negative UTC to set feedback streaming callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_streaming_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -3003,26 +2749,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_feedback_streaming_cb_n1) /** * @testcase utc_vc_mgr_set_feedback_streaming_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set feedback streaming callback + * @description Negative UTC to set feedback streaming callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_feedback_streaming_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(__vc_mgr_feedback_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(test_feedback_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(__vc_mgr_feedback_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(test_feedback_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_feedback_streaming_cb(test_feedback_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_feedback_streaming_cb_p + * @testcase utc_vc_mgr_unset_feedback_streaming_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset feedback streaming callback + * @description Positive UTC to unset feedback streaming callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_feedback_streaming_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_feedback_streaming_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_feedback_streaming_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3031,28 +2781,32 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_feedback_streaming_cb_p) } /** - * @testcase utc_vc_mgr_unset_feedback_streaming_cb_n + * @testcase utc_vc_mgr_unset_feedback_streaming_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset feedback streaming callback + * @description Negative UTC to unset feedback streaming callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_feedback_streaming_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_feedback_streaming_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_feedback_streaming_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_feedback_streaming_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_feedback_streaming_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_start_feedback_p + * @testcase utc_vc_mgr_start_feedback_p1 * @since_tizen 5.0 - * @description Positive UTC for start feedback + * @description Positive UTC to start feedback */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_feedback_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_feedback_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_start_feedback(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3061,31 +2815,31 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_feedback_p) } /** - * @testcase utc_vc_mgr_start_feedback_n + * @testcase utc_vc_mgr_start_feedback_n1 * @since_tizen 5.0 - * @description Negative UTC for start feedback + * @description Negative UTC to start feedback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_start_feedback_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_start_feedback_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_start_feedback(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_start_feedback(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + + mMgrTestUtil->Initialize(); EXPECT_EQ(vc_mgr_start_feedback(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_stop_feedback_p + * @testcase utc_vc_mgr_stop_feedback_p1 * @since_tizen 5.0 - * @description Negative UTC for stop feedback + * @description Negative UTC to stop feedback */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_feedback_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_feedback_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_stop_feedback(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3094,46 +2848,46 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_feedback_p) } /** - * @testcase utc_vc_mgr_stop_feedback_n + * @testcase utc_vc_mgr_stop_feedback_n1 * @since_tizen 5.0 - * @description Negative UTC for stop feedback + * @description Negative UTC to stop feedback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_stop_feedback_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_stop_feedback_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_stop_feedback(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_stop_feedback(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + + mMgrTestUtil->Initialize(); EXPECT_EQ(vc_mgr_stop_feedback(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_set_vc_tts_streaming_cb_p + * @testcase utc_vc_mgr_set_vc_tts_streaming_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for set tts streaming callback + * @description Positive UTC to set tts streaming callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_vc_tts_streaming_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_vc_tts_streaming_cb_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(__vc_mgr_vc_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(__vc_mgr_vc_tts_streaming_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_vc_tts_streaming_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for set tts streaming callback + * @description Negative UTC to set tts streaming callback */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_vc_tts_streaming_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -3144,26 +2898,30 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_vc_tts_streaming_cb_n1) /** * @testcase utc_vc_mgr_set_vc_tts_streaming_cb_n2 * @since_tizen 5.0 - * @description Negative UTC for set tts streaming callback + * @description Negative UTC to set tts streaming callback */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_vc_tts_streaming_cb_n2) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(__vc_mgr_vc_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(__vc_mgr_vc_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_set_vc_tts_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_unset_vc_tts_streaming_cb_p + * @testcase utc_vc_mgr_unset_vc_tts_streaming_cb_p1 * @since_tizen 5.0 - * @description Positive UTC for unset tts streaming callback + * @description Positive UTC to unset tts streaming callback */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_vc_tts_streaming_cb_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_vc_tts_streaming_cb_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_vc_tts_streaming_cb(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3172,31 +2930,35 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_vc_tts_streaming_cb_p) } /** - * @testcase utc_vc_mgr_unset_vc_tts_streaming_cb_n + * @testcase utc_vc_mgr_unset_vc_tts_streaming_cb_n1 * @since_tizen 5.0 - * @description Negative UTC for unset tts streaming callback + * @description Negative UTC to unset tts streaming callback */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_vc_tts_streaming_cb_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_vc_tts_streaming_cb_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_vc_tts_streaming_cb(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_unset_vc_tts_streaming_cb(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_unset_vc_tts_streaming_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_send_utterance_status_p + * @testcase utc_vc_mgr_send_utterance_status_p1 * @since_tizen 5.0 - * @description Positive UTC for send utterance status + * @description Positive UTC to send utterance status */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_utterance_status_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_utterance_status_p1) { int pid = static_cast(getpid()); int utt_id = 1; vc_tts_utterance_status_e status = VC_TTS_UTTERANCE_NONE; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_utterance_status(pid, utt_id, status), VC_ERROR_NOT_SUPPORTED); return; } @@ -3207,14 +2969,14 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_utterance_status_p) /** * @testcase utc_vc_mgr_send_utterance_status_n1 * @since_tizen 5.0 - * @description Negative UTC for send utterance status + * @description Negative UTC to send utterance status */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_utterance_status_n1) { int pid = static_cast(getpid()); int utt_id = 1; vc_tts_utterance_status_e status = VC_TTS_UTTERANCE_NONE; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_utterance_status(pid, utt_id, status), VC_ERROR_NOT_SUPPORTED); return; } @@ -3225,154 +2987,143 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_utterance_status_n1) /** * @testcase utc_vc_mgr_send_utterance_status_n2 * @since_tizen 5.0 - * @description Negative UTC for send utterance status + * @description Negative UTC to send utterance status */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_send_utterance_status_n2) { int pid = static_cast(getpid()); int utt_id = 1; vc_tts_utterance_status_e status = VC_TTS_UTTERANCE_NONE; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_utterance_status(pid, utt_id, status), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_send_utterance_status(pid, utt_id, status), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + + mMgrTestUtil->Initialize(); EXPECT_EQ(vc_mgr_send_utterance_status(pid, utt_id, status), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_mgr_send_audio_streaming_p + * @testcase utc_vc_mgr_send_audio_streaming_p1 * @since_tizen 5.0 - * @description Positive UTC for send audio streaming + * @description Positive UTC to send audio streaming */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_audio_streaming_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_audio_streaming_p1) { unsigned char data[10] = {0, }; vc_audio_streaming_event_e event = VC_AUDIO_STREAMING_EVENT_START; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_audio_streaming(event, data, 10), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - vc_cmd_list_destroy(commands, true); - + mMgrTestUtil->SetDefaultCommands(); ASSERT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_OUTSIDE), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + mMgrTestUtil->Start(false); EXPECT_EQ(vc_mgr_send_audio_streaming(event, data, 10), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); + + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_send_audio_streaming_n1 * @since_tizen 5.0 - * @description Negative UTC for send audio streaming + * @description Negative UTC to send audio streaming */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_audio_streaming_n1) { unsigned char data[10] = {0, }; vc_audio_streaming_event_e event = VC_AUDIO_STREAMING_EVENT_START; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_audio_streaming(static_cast(0), data, 10), VC_ERROR_NOT_SUPPORTED); EXPECT_EQ(vc_mgr_send_audio_streaming(event, nullptr, 10), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - vc_cmd_list_destroy(commands, true); - + mMgrTestUtil->SetDefaultCommands(); ASSERT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_OUTSIDE), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + mMgrTestUtil->Start(false); EXPECT_EQ(vc_mgr_send_audio_streaming(static_cast(0), data, 10), VC_ERROR_INVALID_PARAMETER); EXPECT_EQ(vc_mgr_send_audio_streaming(event, nullptr, 10), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); + + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_send_audio_streaming_n2 * @since_tizen 5.0 - * @description Negative UTC for send audio streaming + * @description Negative UTC to send audio streaming */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_audio_streaming_n2) { unsigned char data[10] = {0, }; vc_audio_streaming_event_e event = VC_AUDIO_STREAMING_EVENT_START; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_audio_streaming(event, data, 10), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - vc_cmd_list_destroy(commands, true); - + mMgrTestUtil->SetDefaultCommands(); ASSERT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_OUTSIDE), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); - EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); - ASSERT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_PROCESSING, 5), true); + + mMgrTestUtil->Start(false); + mMgrTestUtil->Stop(); EXPECT_EQ(vc_mgr_send_audio_streaming(event, data, 10), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); + + mMgrTestUtil->Cancel(); } /** * @testcase utc_vc_mgr_send_audio_streaming_n3 * @since_tizen 5.0 - * @description Negative UTC for send audio streaming + * @description Negative UTC to send audio streaming */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_send_audio_streaming_n3) { unsigned char data[10] = {0, }; vc_audio_streaming_event_e event = VC_AUDIO_STREAMING_EVENT_START; - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_send_audio_streaming(event, data, 10), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_send_audio_streaming(event, data, 10), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); + + mMgrTestUtil->Initialize(); EXPECT_EQ(vc_mgr_send_audio_streaming(event, data, 10), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_mgr_set_audio_streaming_mode_p + * @testcase utc_vc_mgr_set_audio_streaming_mode_p1 * @since_tizen 5.0 - * @description Positive UTC for set audio streaming mode + * @description Positive UTC to set audio streaming mode */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_streaming_mode_p) +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_streaming_mode_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_VC_SERVICE), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_VC_SERVICE), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_state_changed(VC_STATE_READY, 5), true); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5), true); + mMgrTestUtil->Prepare(); EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_VC_SERVICE), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_audio_streaming_mode_n1 * @since_tizen 5.0 - * @description Negative UTC for set audio streaming mode + * @description Negative UTC to set audio streaming mode */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_streaming_mode_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_audio_streaming_mode(static_cast(-1)), VC_ERROR_NOT_SUPPORTED); return; } @@ -3383,11 +3134,11 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_streaming_mode_n1) /** * @testcase utc_vc_mgr_set_audio_streaming_mode_n2 * @since_tizen 5.0 - * @description Negative UTC for set audio streaming mode + * @description Negative UTC to set audio streaming mode */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_audio_streaming_mode_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_VC_SERVICE), VC_ERROR_NOT_SUPPORTED); return; } @@ -3396,13 +3147,13 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_audio_streaming_mode_n2) } /** - * @testcase utc_vc_mgr_change_background_volume_p + * @testcase utc_vc_mgr_change_background_volume_p1 * @since_tizen 5.0 - * @description Positive UTC for change background volume + * @description Positive UTC to change background volume */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_change_background_volume_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_change_background_volume_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_change_background_volume(VC_BACKGROUND_VOLUME_EVENT_CHANGE_FOR_NEARFIELD), VC_ERROR_NOT_SUPPORTED); return; } @@ -3414,11 +3165,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_change_background_volume_p) /** * @testcase utc_vc_mgr_change_background_volume_n1 * @since_tizen 5.0 - * @description Negative UTC for change background volume + * @description Negative UTC to change background volume */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_change_background_volume_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_change_background_volume(static_cast(-1)), VC_ERROR_NOT_SUPPORTED); return; } @@ -3429,11 +3180,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_change_background_volume_n1) /** * @testcase utc_vc_mgr_change_background_volume_n2 * @since_tizen 5.0 - * @description Negative UTC for change background volume + * @description Negative UTC to change background volume */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_change_background_volume_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_change_background_volume(VC_BACKGROUND_VOLUME_EVENT_CHANGE_FOR_NEARFIELD), VC_ERROR_NOT_SUPPORTED); return; } @@ -3442,13 +3193,13 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_change_background_volume_n2) } /** - * @testcase utc_vc_mgr_reset_background_volume_p + * @testcase utc_vc_mgr_reset_background_volume_p1 * @since_tizen 5.0 - * @description Positive UTC for change background volume + * @description Positive UTC to change background volume */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_reset_background_volume_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_reset_background_volume_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_reset_background_volume(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3459,13 +3210,13 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_reset_background_volume_p) } /** - * @testcase utc_vc_mgr_reset_background_volume_n + * @testcase utc_vc_mgr_reset_background_volume_n1 * @since_tizen 5.0 - * @description Negative UTC for change background volume + * @description Negative UTC to change background volume */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_reset_background_volume_n) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_reset_background_volume_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_reset_background_volume(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3474,31 +3225,31 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_reset_background_volume_n) } /** - * @testcase utc_vc_mgr_set_selected_results_p + * @testcase utc_vc_mgr_set_selected_results_p1 * @since_tizen 5.0 - * @description Positive UTC for set selected results + * @description Positive UTC to set selected results */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_selected_results_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_selected_results_p1) { - if (false == __is_feature_supported) { - EXPECT_EQ(vc_mgr_set_selected_results(g_test_commands), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_selected_results(mMgrTestUtil->mDefaultCommandList), VC_ERROR_NOT_SUPPORTED); return; } - __test_voice_recording(); + mMgrTestUtil->SimulateVoiceRecording(); - EXPECT_EQ(__is_all_result_cb_invoked(5), true); - EXPECT_EQ(g_set_selected_result_return, VC_ERROR_NONE); + EXPECT_EQ(mMgrTestUtil->IsAllResultReceived(5), true); + EXPECT_EQ(mMgrTestUtil->mSetSelectedResultReturn, VC_ERROR_NONE); } /** * @testcase utc_vc_mgr_set_selected_results_n1 * @since_tizen 5.0 - * @description Negative UTC for set selected results + * @description Negative UTC to set selected results */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_selected_results_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_selected_results(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -3510,37 +3261,32 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_selected_results_n1) /** * @testcase utc_vc_mgr_set_selected_results_n2 * @since_tizen 5.0 - * @description Negative UTC for set selected results + * @description Negative UTC to set selected results */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_selected_results_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_selected_results(nullptr), VC_ERROR_NOT_SUPPORTED); return; } - vc_cmd_list_h commands = __create_test_command_list(); - ASSERT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); + mMgrTestUtil->Stop(); - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); - - EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); - EXPECT_EQ(__is_mgr_service_state_changed(VC_SERVICE_STATE_PROCESSING, 5), true); - EXPECT_EQ(vc_mgr_set_selected_results(commands), VC_ERROR_OPERATION_FAILED); + // EXPECT_EQ(vc_mgr_set_selected_results(commands), VC_ERROR_OPERATION_FAILED); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); - vc_cmd_list_destroy(commands, true); + mMgrTestUtil->Cancel(); } /** - * @testcase utc_vc_mgr_set_demandable_client_rule_p + * @testcase utc_vc_mgr_set_demandable_client_rule_p1 * @since_tizen 5.0 - * @description Positive UTC for set demandable client rule + * @description Positive UTC to set demandable client rule */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_demandable_client_rule_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_demandable_client_rule_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_demandable_client_rule(TEST_DEMANDABLE_LIST_XML_PATH), VC_ERROR_NOT_SUPPORTED); return; } @@ -3551,28 +3297,28 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_demandable_client_rule_p) /** * @testcase utc_vc_mgr_set_demandable_client_rule_n1 * @since_tizen 5.0 - * @description Negative UTC for set demandable client rule + * @description Negative UTC to set demandable client rule */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_demandable_client_rule_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_demandable_client_rule(nullptr), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_mgr_set_demandable_client_rule(TEST_EMPTY_FILE_PATH), VC_ERROR_NOT_SUPPORTED); + EXPECT_EQ(vc_mgr_set_demandable_client_rule(VcCommonTestUtility::GetCommandEmptyFilePath()), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_mgr_set_demandable_client_rule(nullptr), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_mgr_set_demandable_client_rule(TEST_EMPTY_FILE_PATH), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_mgr_set_demandable_client_rule(VcCommonTestUtility::GetCommandEmptyFilePath()), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_mgr_set_demandable_client_rule_n2 * @since_tizen 5.0 - * @description Negative UTC for set demandable client rule + * @description Negative UTC to set demandable client rule */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_demandable_client_rule_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_demandable_client_rule(TEST_DEMANDABLE_LIST_XML_PATH), VC_ERROR_NOT_SUPPORTED); return; } @@ -3581,13 +3327,13 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_demandable_client_rule_n2) } /** - * @testcase utc_vc_mgr_unset_demandable_client_rule_p + * @testcase utc_vc_mgr_unset_demandable_client_rule_p1 * @since_tizen 5.0 - * @description Positive UTC for unset demandable client rule + * @description Positive UTC to unset demandable client rule */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unset_demandable_client_rule_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unset_demandable_client_rule_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_demandable_client_rule(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3598,11 +3344,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unset_demandable_client_rule_p) /** * @testcase utc_vc_mgr_unset_demandable_client_rule_n1 * @since_tizen 5.0 - * @description Negative UTC for unset demandable client rule + * @description Negative UTC to unset demandable client rule */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_demandable_client_rule_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_demandable_client_rule(), VC_ERROR_NOT_SUPPORTED); return; } @@ -3611,13 +3357,13 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_demandable_client_rule_n1) } /** - * @testcase utc_vc_mgr_set_domain_p + * @testcase utc_vc_mgr_set_domain_p1 * @since_tizen 5.0 - * @description Positive UTC for set domain + * @description Positive UTC to set domain */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_domain_p) +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_domain_p1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_domain(TEST_DOMAIN), VC_ERROR_NOT_SUPPORTED); return; } @@ -3628,11 +3374,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_domain_p) /** * @testcase utc_vc_mgr_set_domain_n1 * @since_tizen 5.0 - * @description Negative UTC for set domain + * @description Negative UTC to set domain */ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_domain_n1) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_domain(nullptr), VC_ERROR_NOT_SUPPORTED); return; } @@ -3643,11 +3389,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_domain_n1) /** * @testcase utc_vc_mgr_set_domain_n2 * @since_tizen 5.0 - * @description Negative UTC for set domain + * @description Negative UTC to set domain */ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_domain_n2) { - if (false == __is_feature_supported) { + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_domain(TEST_DOMAIN), VC_ERROR_NOT_SUPPORTED); return; } diff --git a/tests/src/vc_unittests.cpp b/tests/src/vc_unittests.cpp index fea3a83..3324ac6 100644 --- a/tests/src/vc_unittests.cpp +++ b/tests/src/vc_unittests.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ + #include #include #include -#include -#include #include +#include #include #include @@ -28,360 +28,149 @@ #include "system_info_mock.h" #include "cynara_mock.h" -#include "test_util.h" +#include "vc_test_util.h" +#include "vc_common_test_util.h" +#include "vc_mgr_test_util.h" -static const char *TEST_COMMAND_JSON_PATH = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/test_command.json"); static const char *TEST_APP_ID = "org.tizen.vc-unittests"; static const char *TEST_INVOCATION_NAME = "invocation"; static const char *TEST_CREDENTIAL = "credential"; -static int g_vc_init = false; -static vc_state_e g_vc_state = VC_STATE_NONE; -static vc_service_state_e g_vc_service_state = VC_SERVICE_STATE_NONE; - -static vc_state_e g_vc_mgr_state = VC_STATE_NONE; -static vc_service_state_e g_vc_mgr_service_state = VC_SERVICE_STATE_NONE; -static bool g_vc_supported = false; - -static bool g_error_cb_invoked = false; - -vc_cmd_list_h g_test_commands = nullptr; - -static bool __is_mgr_state_changed(vc_state_e state, int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && state != g_vc_mgr_state) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } - - if (state != g_vc_mgr_state) { - return false; - } - - return true; -} - -static bool __is_mgr_service_state_changed(vc_service_state_e state, int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && state != g_vc_mgr_service_state) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } - - if (state != g_vc_mgr_service_state) { - return false; - } - - return true; -} - -static bool __is_state_changed(vc_state_e state, int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && state != g_vc_state) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } - - return (state == g_vc_state); -} - -static bool __is_service_state_changed(vc_service_state_e state, int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && state != g_vc_service_state) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } - - return (state == g_vc_service_state); -} - -static bool __is_error_cb_invoked(int wait_delay) -{ - int max_count = wait_delay * 10; - int count = 0; - while (max_count > count && false == g_error_cb_invoked) { - ecore_main_loop_iterate(); - usleep(100000); - count++; - } - - return g_error_cb_invoked; -} - -static void __vc_mgr_state_changed_cb(vc_state_e previous, vc_state_e current, void* user_data) -{ - g_vc_mgr_state = current; -} - -static void __vc_mgr_service_state_changed_cb(vc_service_state_e previous, vc_service_state_e current, void* user_data) -{ - g_vc_mgr_service_state = current; -} - -static bool __vc_mgr_all_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char *result, const char *msg, void *user_data) -{ - return true; -} - -static void __vc_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void* user_data) -{ -} -static void __vc_current_language_changed_cb(const char* previous, const char* current, void* user_data) +static void test_current_language_changed_cb(const char* previous, const char* current, void* user_data) { } -static bool __vc_supported_language_cb(const char* language, void* user_data) +static bool test_supported_language_cb(const char* language, void* user_data) { return true; } -static void __vc_state_changed_cb(vc_state_e previous, vc_state_e current, void* user_data) -{ - g_vc_state = current; -} - -static void __vc_service_state_changed_cb(vc_service_state_e previous, vc_service_state_e current, void* user_data) -{ - g_vc_service_state = current; -} - -static void __vc_error_cb(vc_error_e reason, void* user_data) -{ - g_error_cb_invoked = true; -} -static void __vc_tts_streaming_cb(vc_tts_event_e event, char* buffer, int len, int utt_id, void *user_data) +static void test_tts_streaming_cb(vc_tts_event_e event, char* buffer, int len, int utt_id, void *user_data) { } -static void __vc_tts_utterance_status_cb(int utt_id, vc_tts_utterance_status_e status, void *user_data) +static void test_tts_utterance_status_cb(int utt_id, vc_tts_utterance_status_e status, void *user_data) { } -static bool __vc_cmd_list_cb(vc_cmd_h vc_command, void* user_data) -{ - return true; -} +namespace { -static void __vc_mgr_ready() -{ - EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_state_changed_cb(__vc_mgr_state_changed_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_service_state_changed_cb(__vc_mgr_service_state_changed_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); - ASSERT_EQ(true, __is_mgr_state_changed(VC_STATE_READY, 5)); - ASSERT_EQ(true, __is_mgr_service_state_changed(VC_SERVICE_STATE_READY, 5)); - - vc_cmd_h system_command = nullptr; - EXPECT_EQ(vc_cmd_create(&system_command), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_command(system_command, "manager"), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_type(system_command, VC_COMMAND_TYPE_SYSTEM), VC_ERROR_NONE); - - vc_cmd_list_h commands = nullptr; - EXPECT_EQ(vc_cmd_list_create(&commands), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_add(commands, system_command), VC_ERROR_NONE); - - EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_destroy(commands, true), VC_ERROR_NONE); -} -static void __vc_mgr_finish() -{ - EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_unset_state_changed_cb(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_NONE); - EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE); -} +class VCTestInNoneState : public testing::Test { +public: + virtual void SetUp() { + ecore_init(); + ecore_main_loop_glib_integrate(); -static bool __is_vc_supported() -{ - bool is_vc_supported = false; - bool is_mic_supported = false; - if (0 != system_info_get_platform_bool("http://tizen.org/feature/speech.control", &is_vc_supported)) - { - is_vc_supported = false; + mVcTestUtil = new VcTestUtility(); } - if (0 != system_info_get_platform_bool("http://tizen.org/feature/microphone", &is_mic_supported)) + virtual void TearDown() { - is_mic_supported = false; - } - - return (is_vc_supported && is_mic_supported); -} - -static vc_cmd_list_h __create_test_command_list() -{ - vc_cmd_h system_command = nullptr; - EXPECT_EQ(vc_cmd_create(&system_command), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_command(system_command, "test"), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_type(system_command, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NONE); + delete mVcTestUtil; + mVcTestUtil = nullptr; + VcCommonTestUtility::WaitUntilEngineTerminated(1); - vc_cmd_list_h commands = nullptr; - EXPECT_EQ(vc_cmd_list_create(&commands), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_add(commands, system_command), VC_ERROR_NONE); + ecore_shutdown(); + } - return commands; -} +public: + VcTestUtility *mVcTestUtil = nullptr; +}; -static void __initialize_test_environment() -{ - ecore_init(); - ecore_main_loop_glib_integrate(); +class VCTest : public testing::Test { +public: + virtual void SetUp() { + ecore_init(); + ecore_main_loop_glib_integrate(); - g_vc_supported = __is_vc_supported(); + mVcTestUtil = new VcTestUtility(); - g_vc_mgr_state = VC_STATE_NONE; - g_vc_mgr_service_state = VC_SERVICE_STATE_NONE; + mVcTestUtil->Initialize(); + } - g_vc_state = VC_STATE_NONE; - g_vc_service_state = VC_SERVICE_STATE_NONE; + virtual void TearDown() + { + delete mVcTestUtil; + mVcTestUtil = nullptr; + VcCommonTestUtility::WaitUntilEngineTerminated(1); - g_error_cb_invoked = false; + ecore_shutdown(); + } - g_test_commands = __create_test_command_list(); -} +public: + VcTestUtility *mVcTestUtil = nullptr; +}; -static void __shutdown_test_environment() -{ - vc_cmd_list_destroy(g_test_commands, true); - g_test_commands = nullptr; +class VCTestInReadyState : public testing::Test { +public: + virtual void SetUp() { + ecore_init(); + ecore_main_loop_glib_integrate(); - wait_engine_terminated(1); + mVcTestUtil = new VcTestUtility(); - ecore_shutdown(); -} + mVcTestUtil->Initialize(); + mVcTestUtil->Prepare(); + } -namespace { + virtual void TearDown() + { + delete mVcTestUtil; + mVcTestUtil = nullptr; + VcCommonTestUtility::WaitUntilEngineTerminated(1); -class VCTestInNoneState : public testing::Test { - public: - virtual void SetUp() { - __initialize_test_environment(); - } - - virtual void TearDown() - { - vc_deinitialize(); - __shutdown_test_environment(); - } -}; + ecore_shutdown(); + } -class VCTest : public testing::Test { - public: - virtual void SetUp() { - __initialize_test_environment(); - - if (false == g_vc_supported) { - g_vc_init = false; - return; - } - - g_vc_init = true; - vc_initialize(); - vc_set_state_changed_cb(__vc_state_changed_cb, NULL); - vc_set_service_state_changed_cb(__vc_service_state_changed_cb, nullptr); - } - - virtual void TearDown() - { - if (true == g_vc_supported) - { - vc_unset_state_changed_cb(); - vc_deinitialize(); - } - - __shutdown_test_environment(); - } +public: + VcTestUtility *mVcTestUtil = nullptr; }; -class VCTestInReadyState : public testing::Test { - public: - virtual void SetUp() { - __initialize_test_environment(); - - if (false == g_vc_supported) { - return; - } - - vc_initialize(); - vc_set_state_changed_cb(__vc_state_changed_cb, nullptr); - vc_set_service_state_changed_cb(__vc_service_state_changed_cb, nullptr); - - vc_prepare_sync(); - EXPECT_EQ(__is_state_changed(VC_STATE_READY, 5), true); - EXPECT_EQ(__is_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - } - - virtual void TearDown() - { - if (true == g_vc_supported) - { - vc_unprepare(); - vc_unset_state_changed_cb(); - vc_deinitialize(); - } - - __shutdown_test_environment(); - } -}; -TEST_F(VCTest, utc_vc_initialize_p) +/** + * @testcase utc_vc_initialize_p1 + * @since_tizen 2.4 + * @description Positive UTC to initialize voice control + */ +TEST_F(VCTestInNoneState, utc_vc_initialize_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - } else { - EXPECT_EQ(g_vc_init, true); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_initialize(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); + EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_deinitialize_p + * @testcase utc_vc_deinitialize_p1 * @since_tizen 2.4 - * @description Positive UTC for deinitialize voice control handle + * @description Positive UTC to deinitialize voice control */ -TEST_F(VCTest, vc_deinitialize_p) +TEST_F(VCTest, utc_vc_deinitialize_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_deinitialize(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); } /** * @testcase utc_vc_deinitialize_p2 * @since_tizen 2.4 - * @description Positive UTC for deinitialize voice control handle + * @description Positive UTC to deinitialize voice control */ TEST_F(VCTest, utc_vc_deinitialize_p2) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_deinitialize(), VC_ERROR_NOT_SUPPORTED); return; } @@ -393,11 +182,11 @@ TEST_F(VCTest, utc_vc_deinitialize_p2) /** * @testcase utc_vc_deinitialize_p3 * @since_tizen 2.4 - * @description Positive UTC for deinitialize voice control handle + * @description Positive UTC to deinitialize voice control */ TEST_F(VCTestInReadyState, utc_vc_deinitialize_p3) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_deinitialize(), VC_ERROR_NOT_SUPPORTED); return; } @@ -406,343 +195,240 @@ TEST_F(VCTestInReadyState, utc_vc_deinitialize_p3) } /** - * @testcase utc_vc_deinitialize_n + * @testcase utc_vc_deinitialize_n1 * @since_tizen 2.4 - * @description Negative UTC for deinitialize voice control handle (Already deinitialized) + * @description Negative UTC to deinitialize voice control (Invalid state) */ -TEST_F(VCTest, vc_deinitialize_n) +TEST_F(VCTestInNoneState, utc_vc_deinitialize_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_deinitialize(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_deinitialize(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_prepare_p + * @testcase utc_vc_prepare_p1 * @since_tizen 2.4 - * @description Positive UTC for connect service daemon + * @description Positive UTC to connect service engine */ -TEST_F(VCTest, vc_prepare_p) +TEST_F(VCTest, utc_vc_prepare_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_prepare(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_prepare(), VC_ERROR_NONE); + EXPECT_EQ(mVcTestUtil->IsStateChanged(VC_STATE_READY, 5), true); } /** - * @testcase utc_vc_prepare_n + * @testcase utc_vc_prepare_n1 * @since_tizen 2.4 - * @description Negative UTC for connect service daemon (Invalid state) + * @description Negative UTC to connect service engine (Invalid state) */ -TEST_F(VCTestInNoneState, utc_vc_prepare_n) +TEST_F(VCTestInNoneState, utc_vc_prepare_n1) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_prepare(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_prepare(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_set_state_changed_cb(__vc_state_changed_cb, nullptr), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); - EXPECT_EQ(vc_prepare(), VC_ERROR_NONE); - EXPECT_EQ(__is_state_changed(VC_STATE_READY, 5), true); EXPECT_EQ(vc_prepare(), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_prepare_sync_p + * @testcase utc_vc_prepare_sync_p1 * @since_tizen 4.0 - * @description Positive UTC for connect service engine synchronously + * @description Positive UTC to connect service engine synchronously */ -TEST_F(VCTest, utc_vc_prepare_sync_p) +TEST_F(VCTest, utc_vc_prepare_sync_p1) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NOT_SUPPORTED); return; } + vc_state_e state = VC_STATE_NONE; EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NONE); - EXPECT_EQ(__is_state_changed(VC_STATE_READY, 5), true); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); + EXPECT_EQ(vc_get_state(&state), VC_ERROR_NONE); + EXPECT_EQ(state, VC_STATE_READY); } /** - * @testcase utc_vc_prepare_sync_n + * @testcase utc_vc_prepare_sync_n1 * @since_tizen 4.0 - * @description Negative UTC for connect service engine synchronously (Invalid state) + * @description Negative UTC to connect service engine synchronously (Invalid state) */ -TEST_F(VCTestInNoneState, utc_vc_prepare_sync_n) +TEST_F(VCTestInNoneState, utc_vc_prepare_sync_n1) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_prepare_sync(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_set_state_changed_cb(__vc_state_changed_cb, nullptr), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); - EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NONE); - EXPECT_EQ(__is_state_changed(VC_STATE_READY, 5), true); EXPECT_EQ(vc_prepare_sync(), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_unprepare_p + * @testcase utc_vc_unprepare_p1 * @since_tizen 2.4 - * @description Positive UTC for disconnect service daemon + * @description Positive UTC to disconnect service engine */ -TEST_F(VCTest, vc_unprepare_p) +TEST_F(VCTestInReadyState, utc_vc_unprepare_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unprepare(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); } /** - * @testcase utc_vc_unprepare_n + * @testcase utc_vc_unprepare_n1 * @since_tizen 2.4 - * @description Negative UTC for disconnect service daemon (Invalid state) + * @description Negative UTC to disconnect service engine (Invalid state) */ -TEST_F(VCTestInNoneState, utc_vc_unprepare_n) +TEST_F(VCTestInNoneState, utc_vc_unprepare_n1) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_unprepare(), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_unprepare(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); + mVcTestUtil->Initialize(); EXPECT_EQ(vc_unprepare(), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_foreach_supported_languages_p + * @testcase utc_vc_foreach_supported_languages_p1 * @since_tizen 2.4 - * @description Positive UTC for get supported language list + * @description Positive UTC to get supported language list */ -TEST_F(VCTest, vc_foreach_supported_languages_p) +TEST_F(VCTest, utc_vc_foreach_supported_languages_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_NONE); + + ASSERT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_NONE); } /** - * @testcase utc_vc_foreach_supported_languages_n + * @testcase utc_vc_foreach_supported_languages_n1 * @since_tizen 2.4 - * @description Negative UTC for get supported language list (Invalid parameter) + * @description Negative UTC to get supported language list (Invalid parameter) */ -TEST_F(VCTest, vc_foreach_supported_languages_n) +TEST_F(VCTest, utc_vc_foreach_supported_languages_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_foreach_supported_languages(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_foreach_supported_languages(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_foreach_supported_languages(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_foreach_supported_languages(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_foreach_supported_languages_n2 * @since_tizen 2.4 - * @description Negative UTC for get supported language list (Invalid state) + * @description Negative UTC to get supported language list (Invalid state) */ -TEST_F(VCTest, vc_foreach_supported_languages_n2) +TEST_F(VCTestInNoneState, utc_vc_foreach_supported_languages_n2) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_foreach_supported_languages(__vc_supported_language_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_foreach_supported_languages(test_supported_language_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_get_current_language_p + * @testcase utc_vc_get_current_language_p1 * @since_tizen 2.4 - * @description Positive UTC for get current language + * @description Positive UTC to get current language */ -TEST_F(VCTest, vc_get_current_language_p) +TEST_F(VCTest, utc_vc_get_current_language_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - char *lang = NULL; - ret = vc_get_current_language(&lang); - if (NULL != lang) { - free(lang); - lang = NULL; - } - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - char *lang = NULL; - ret = vc_get_current_language(&lang); - if (NULL != lang) { - free(lang); - lang = NULL; - } - EXPECT_EQ(ret, VC_ERROR_NONE); + char *language = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_current_language(&language), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_get_current_language(&language), VC_ERROR_NONE); + EXPECT_NE(language, nullptr); + free(language); + + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_get_current_language(&language), VC_ERROR_NONE); + EXPECT_NE(language, nullptr); + free(language); } /** - * @testcase utc_vc_get_current_language_n + * @testcase utc_vc_get_current_language_n1 * @since_tizen 2.4 - * @description Negative UTC for get current language (Invalid parameter) + * @description Negative UTC to get current language (Invalid parameter) */ -TEST_F(VCTest, vc_get_current_language_n) +TEST_F(VCTest, utc_vc_get_current_language_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_get_current_language(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_get_current_language(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_current_language(nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_get_current_language(nullptr), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_get_current_language_n2 * @since_tizen 2.4 - * @description Negative UTC for get current language (Invalid state) + * @description Negative UTC to get current language (Invalid state) */ -TEST_F(VCTest, vc_get_current_language_n2) +TEST_F(VCTestInNoneState, utc_vc_get_current_language_n2) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - char *lang = NULL; - ret = vc_get_current_language(&lang); - if (NULL != lang) { - free(lang); - lang = NULL; - } - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - char *lang = NULL; - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_get_current_language(&lang); - if (NULL != lang) { - free(lang); - lang = NULL; - } - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); + char *language = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_current_language(&language), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_get_current_language(&language), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_get_state_p + * @testcase utc_vc_get_state_p1 * @since_tizen 2.4 - * @description Positive UTC for get current state + * @description Positive UTC to get current state */ -TEST_F(VCTestInNoneState, vc_get_state_p) +TEST_F(VCTestInNoneState, utc_vc_get_state_p1) { vc_state_e state = VC_STATE_NONE; - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_get_state(&state), VC_ERROR_NOT_SUPPORTED); return; } @@ -750,51 +436,40 @@ TEST_F(VCTestInNoneState, vc_get_state_p) EXPECT_EQ(vc_get_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_STATE_NONE); - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); + mVcTestUtil->Initialize(); EXPECT_EQ(vc_get_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_STATE_INITIALIZED); - EXPECT_EQ(vc_set_state_changed_cb(__vc_state_changed_cb, nullptr), VC_ERROR_NONE); - EXPECT_EQ(vc_prepare(), VC_ERROR_NONE); - EXPECT_EQ(__is_state_changed(VC_STATE_READY, 5), true); + EXPECT_EQ(mVcTestUtil->Prepare(), true); EXPECT_EQ(vc_get_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_STATE_READY); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_get_state_n + * @testcase utc_vc_get_state_n1 * @since_tizen 2.4 - * @description Negative UTC for get current state (Invalid parameter) + * @description Negative UTC to get current state (Invalid parameter) */ -TEST_F(VCTest, vc_get_state_n) +TEST_F(VCTest, utc_vc_get_state_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_get_state(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_get_state(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_state(nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_get_state(nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_get_service_state_p + * @testcase utc_vc_get_service_state_p1 * @since_tizen 2.4 - * @description Positive UTC for get current state of service daemon + * @description Positive UTC to get current state of service engine */ -TEST_F(VCTestInReadyState, utc_vc_get_service_state_p) +TEST_F(VCTestInReadyState, utc_vc_get_service_state_p1) { vc_service_state_e state = VC_SERVICE_STATE_NONE; - if (false == g_vc_supported) { + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_get_service_state(&state), VC_ERROR_NOT_SUPPORTED); return; } @@ -802,349 +477,220 @@ TEST_F(VCTestInReadyState, utc_vc_get_service_state_p) EXPECT_EQ(vc_get_service_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_SERVICE_STATE_READY); - __vc_mgr_ready(); - - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); - EXPECT_EQ(__is_service_state_changed(VC_SERVICE_STATE_RECORDING, 5), true); + auto mgrUtil = std::make_shared(); + mgrUtil->Initialize(); + mgrUtil->Prepare(); + mgrUtil->SetDefaultCommands(); + mgrUtil->Start(false); EXPECT_EQ(vc_get_service_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_SERVICE_STATE_RECORDING); - EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); - EXPECT_EQ(__is_service_state_changed(VC_SERVICE_STATE_PROCESSING, 5), true); - + mgrUtil->Stop(); EXPECT_EQ(vc_get_service_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_SERVICE_STATE_PROCESSING); - __vc_mgr_finish(); + mgrUtil->IsServiceStateChanged(VC_SERVICE_STATE_READY, 5); } /** - * @testcase utc_vc_get_service_state_n + * @testcase utc_vc_get_service_state_n1 * @since_tizen 2.4 - * @description Negative UTC for get current state of service daemon (Invalid parameter) + * @description Negative UTC to get current state of service engine (Invalid parameter) */ -TEST_F(VCTest, vc_get_service_state_n) +TEST_F(VCTestInReadyState, utc_vc_get_service_state_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_get_service_state(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_get_service_state(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_service_state(nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_get_service_state(nullptr), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_get_service_state_n2 * @since_tizen 2.4 - * @description Negative UTC for get current state of service daemon (Invalid state) + * @description Negative UTC to get current state of service engine (Invalid state) */ -TEST_F(VCTestInNoneState, vc_get_service_state_n2) +TEST_F(VCTestInNoneState, utc_vc_get_service_state_n2) { vc_service_state_e state = VC_SERVICE_STATE_NONE; - if (false == g_vc_supported) { + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_get_service_state(&state), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_get_service_state(&state), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); + mVcTestUtil->Initialize(); EXPECT_EQ(vc_get_service_state(&state), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_get_system_command_list_p + * @testcase utc_vc_get_system_command_list_p1 * @since_tizen 3.0 - * @description Positive UTC for get the system command list + * @description Positive UTC to get the system command list */ -TEST_F(VCTest, vc_get_system_command_list_p) +TEST_F(VCTestInReadyState, utc_vc_get_system_command_list_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_get_system_command_list(&list); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - vc_cmd_list_h list = NULL; - ret = vc_get_system_command_list(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - if (NULL != list) { - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); - } - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); + vc_cmd_list_h list = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_system_command_list(&list), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_get_system_command_list(&list), VC_ERROR_NONE); + EXPECT_EQ(list, nullptr); } /** * @testcase utc_vc_get_system_command_list_p2 * @since_tizen 3.0 - * @description Positive UTC for get the system command list when system command is registered + * @description Positive UTC to get the system command list when system command is registered */ -TEST_F(VCTest, vc_get_system_command_list_p2) +TEST_F(VCTestInReadyState, utc_vc_get_system_command_list_p2) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_get_system_command_list(&list); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - __vc_mgr_ready(); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); + vc_cmd_list_h list = nullptr; - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_system_command_list(&list), VC_ERROR_NOT_SUPPORTED); + return; + } - vc_cmd_list_h list = NULL; - ret = vc_get_system_command_list(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); + auto mgrUtil = std::make_shared(); + mgrUtil->Initialize(); + mgrUtil->Prepare(); + mgrUtil->SetDefaultCommands(); - int count = 0; - ret = vc_cmd_list_get_count(list, &count); - EXPECT_EQ(ret, VC_ERROR_NONE); - EXPECT_GT(count, 0); + EXPECT_EQ(vc_get_system_command_list(&list), VC_ERROR_NONE); + ASSERT_NE(list, nullptr); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + int count = 0; + EXPECT_EQ(vc_cmd_list_get_count(list, &count), VC_ERROR_NONE); + EXPECT_GT(count, 0); - __vc_mgr_finish(); - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); } /** - * @testcase utc_vc_get_system_command_list_n + * @testcase utc_vc_get_system_command_list_n1 * @since_tizen 3.0 - * @description Negative UTC for get the system command list (Invalid parameter) + * @description Negative UTC to get the system command list (Invalid parameter) */ -TEST_F(VCTest, vc_get_system_command_list_n) +TEST_F(VCTest, utc_vc_get_system_command_list_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_get_system_command_list(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_get_system_command_list(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_system_command_list(nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_get_system_command_list(nullptr), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_get_system_command_list_n2 * @since_tizen 3.0 - * @description Negative UTC for get the system command list (Invalid state) + * @description Negative UTC to get the system command list (Invalid state) */ -TEST_F(VCTestInNoneState, vc_get_system_command_list_n2) +TEST_F(VCTestInNoneState, utc_vc_get_system_command_list_n2) { vc_cmd_list_h list = nullptr; - if (false == g_vc_supported) { + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_get_system_command_list(&list), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_get_system_command_list(&list), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); + mVcTestUtil->Initialize(); EXPECT_EQ(vc_get_system_command_list(&list), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_set_command_list_p + * @testcase utc_vc_set_command_list_p1 * @since_tizen 2.4 - * @description Positive UTC for set command list used as candidate set + * @description Positive UTC to set command list used as candidate set */ -TEST_F(VCTest, vc_set_command_list_p) +TEST_F(VCTestInReadyState, utc_vc_set_command_list_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_set_command(cmd, "voice"); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_destroy(list, true); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); } /** - * @testcase utc_vc_set_command_list_n + * @testcase utc_vc_set_command_list_n1 * @since_tizen 2.4 - * @description Negative UTC for set command list used as candidate set (Invalid parameter) + * @description Negative UTC to set command list used as candidate set (Invalid parameter) */ -TEST_F(VCTestInReadyState, utc_vc_set_command_list_n) +TEST_F(VCTestInReadyState, utc_vc_set_command_list_n1) { vc_cmd_list_h empty_cmd_list = nullptr; - EXPECT_EQ(vc_cmd_list_create(&empty_cmd_list), VC_ERROR_NONE); - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_command_list(nullptr, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_set_command_list(empty_cmd_list, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_set_command_list(g_test_commands, -1), VC_ERROR_NOT_SUPPORTED); - vc_cmd_list_destroy(empty_cmd_list, true); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); return; } + EXPECT_EQ(vc_cmd_list_create(&empty_cmd_list), VC_ERROR_NONE); + EXPECT_EQ(vc_set_command_list(nullptr, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_PARAMETER); EXPECT_EQ(vc_set_command_list(empty_cmd_list, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_set_command_list(g_test_commands, -1), VC_ERROR_INVALID_PARAMETER); - vc_cmd_list_destroy(empty_cmd_list, true); + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, -1), VC_ERROR_INVALID_PARAMETER); + + EXPECT_EQ(vc_cmd_list_destroy(empty_cmd_list, true), VC_ERROR_NONE); } /** * @testcase utc_vc_set_command_list_n2 * @since_tizen 2.4 - * @description Negative UTC for set command list used as candidate set (Invalid state) + * @description Negative UTC to set command list used as candidate set (Invalid state) */ TEST_F(VCTestInNoneState, utc_vc_set_command_list_n2) { - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_command_list(g_test_commands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_set_command_list(g_test_commands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_set_command_list(g_test_commands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_unset_command_list_p + * @testcase utc_vc_unset_command_list_p1 * @since_tizen 2.4 - * @description Positive UTC for unset command list used as candidate set + * @description Positive UTC to unset command list used as candidate set */ -TEST_F(VCTest, vc_unset_command_list_p) +TEST_F(VCTestInReadyState, utc_vc_unset_command_list_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_set_command(cmd, "voice"); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_command_list(list, VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); + return; + } - ret = vc_cmd_list_destroy(list, true); - EXPECT_EQ(ret, VC_ERROR_NONE); + EXPECT_EQ(vc_set_command_list(mVcTestUtil->mTestCommands, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } + EXPECT_EQ(vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); } /** - * @testcase utc_vc_unset_command_list_n + * @testcase utc_vc_unset_command_list_n1 * @since_tizen 2.4 - * @description Negative UTC for unset command list used as candidate set (Invalid parameter) + * @description Negative UTC to unset command list used as candidate set (Invalid parameter) */ -TEST_F(VCTestInReadyState, utc_vc_unset_command_list_n) +TEST_F(VCTestInReadyState, utc_vc_unset_command_list_n1) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_unset_command_list(-1), VC_ERROR_NOT_SUPPORTED); return; } @@ -1155,3118 +701,977 @@ TEST_F(VCTestInReadyState, utc_vc_unset_command_list_n) /** * @testcase utc_vc_unset_command_list_n2 * @since_tizen 2.4 - * @description Negative UTC for unset command list used as candidate set (Invalid state) + * @description Negative UTC to unset command list used as candidate set (Invalid state) */ TEST_F(VCTestInNoneState, utc_vc_unset_command_list_n2) { - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); + mVcTestUtil->Initialize(); EXPECT_EQ(vc_unset_command_list(VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); } /** - * @testcase utc_vc_set_command_list_from_file_p + * @testcase utc_vc_set_command_list_from_file_p1 * @since_tizen 2.4 - * @description Positive UTC for set command list used as candidate set from file + * @description Positive UTC to set command list used as candidate set from file */ -TEST_F(VCTestInReadyState, utc_vc_set_command_list_from_file_p) +TEST_F(VCTestInReadyState, utc_vc_set_command_list_from_file_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NOT_SUPPORTED); + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_set_invocation_name(TEST_INVOCATION_NAME), VC_ERROR_NONE); - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NONE); - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); + EXPECT_EQ(vc_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NONE); + EXPECT_EQ(vc_set_command_list_from_file(filePath, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); } /** - * @testcase utc_vc_set_command_list_from_file_n + * @testcase utc_vc_set_command_list_from_file_n1 * @since_tizen 2.4 - * @description Negative UTC for set command list used as candidate set from file (Invalid parameter) + * @description Negative UTC to set command list used as candidate set from file (Invalid parameter) */ -TEST_F(VCTestInReadyState, utc_vc_set_command_list_from_file_n) +TEST_F(VCTestInReadyState, utc_vc_set_command_list_from_file_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, -1), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_set_command_list_from_file(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, -1), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_set_command_list_from_file(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); -} + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); -/** - * @testcase utc_vc_set_command_list_from_file_n2 - * @since_tizen 2.4 - * @description Negative UTC for set command list used as candidate set from file (Invalid state) - */ -TEST_F(VCTestInNoneState, utc_vc_set_command_list_from_file_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_command_list_from_file(filePath, -1), VC_ERROR_NOT_SUPPORTED); + EXPECT_EQ(vc_set_command_list_from_file(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_set_command_list_from_file(TEST_COMMAND_JSON_PATH, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_get_result_p - * @since_tizen 3.0 - * @description Positive UTC for getting the recognition result - */ -TEST_F(VCTest, vc_get_result_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_get_result(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_get_result(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_get_result_n - * @since_tizen 3.0 - * @description Negative UTC for getting the recognition result (Invalid parameter) - */ -TEST_F(VCTest, vc_get_result_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_get_result(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_get_result(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_result_cb_p - * @since_tizen 2.4 - * @description Positive UTC for set result callback - */ -TEST_F(VCTest, vc_set_result_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_result_cb(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_result_cb(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_result_cb_n - * @since_tizen 2.4 - * @description Negative UTC for set result callback (Invalid parameter) - */ -TEST_F(VCTest, vc_set_result_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_result_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_result_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } -} - -/** - * @testcase utc_vc_set_result_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for set result callback (Invalid state) - */ -TEST_F(VCTest, vc_set_result_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_result_cb(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_result_cb(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_set_result_cb_n3 - * @since_tizen 2.4 - * @description Negative UTC for set result callback (Invalid state) - */ -TEST_F(VCTest, vc_set_result_cb_n3) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_result_cb(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_set_result_cb(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_result_cb_p - * @since_tizen 2.4 - * @description Positive UTC for unset result callback - */ -TEST_F(VCTest, vc_unset_result_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_result_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_result_cb(__vc_result_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unset_result_cb(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_result_cb_n - * @since_tizen 2.4 - * @description Negative UTC for unset result callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_result_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_result_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unset_result_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_unset_result_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for unset result callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_result_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_result_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_unset_result_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_service_state_changed_cb_p - * @since_tizen 2.4 - * @description Positive UTC for set service state changed callback - */ -TEST_F(VCTest, vc_set_service_state_changed_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - } - - -} - -/** - * @testcase utc_vc_set_service_state_changed_cb_n - * @since_tizen 2.4 - * @description Negative UTC for set service state changed callback (Invalid parameter) - */ -TEST_F(VCTest, vc_set_service_state_changed_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_service_state_changed_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_service_state_changed_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } -} - -/** - * @testcase utc_vc_set_service_state_changed_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for set service state changed callback (Invalid state) - */ -TEST_F(VCTest, vc_set_service_state_changed_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_set_service_state_changed_cb_n3 - * @since_tizen 2.4 - * @description Nagative UTC for set service state changed callback (Invalid state) - */ -TEST_F(VCTest, vc_set_service_state_changed_cb_n3) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_service_state_changed_cb_p - * @since_tizen 2.4 - * @description Positive UTC for unset service state changed callback - */ -TEST_F(VCTest, vc_unset_service_state_changed_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_service_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_service_state_changed_cb(__vc_service_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unset_service_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_service_state_changed_cb_n - * @since_tizen 2.4 - * @description Negative UTC for unset service state changed callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_service_state_changed_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_service_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - vc_deinitialize(); - - int ret = VC_ERROR_NONE; - ret = vc_unset_service_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_unset_service_state_changed_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for unset service state changed callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_service_state_changed_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_service_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_unset_service_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_state_changed_cb_p - * @since_tizen 2.4 - * @description Positive UTC for set state changed callback - */ -TEST_F(VCTest, vc_set_state_changed_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - int ret = VC_ERROR_NONE; - ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - } -} - -/** - * @testcase utc_vc_set_state_changed_cb_n - * @since_tizen 2.4 - * @description Negative UTC for set state changed callback (Invalid parameter) - */ -TEST_F(VCTest, vc_set_state_changed_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_state_changed_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_state_changed_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } -} - -/** - * @testcase utc_vc_set_state_changed_cb_n2 - * @since_tizen 2.4 - * @description Nagative UTC for set state changed callback (Invalid state) - */ -TEST_F(VCTest, vc_set_state_changed_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_set_state_changed_cb_n3 - * @since_tizen 2.4 - * @description Negative UTC for set state changed callback (Invalid state) - */ -TEST_F(VCTest, vc_set_state_changed_cb_n3) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_set_state_changed_cb(__vc_state_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_state_changed_cb_p - * @since_tizen 2.4 - * @description Positive UTC for unset state changed callback - */ -TEST_F(VCTest, vc_unset_state_changed_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_unset_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_state_changed_cb_n - * @since_tizen 2.4 - * @description Negative UTC for unset state changed callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_state_changed_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - vc_deinitialize(); - - int ret = VC_ERROR_NONE; - ret = vc_unset_state_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_set_current_language_changed_cb_p - * @since_tizen 2.4 - * @description Positive UTC for set current language changed callback - */ -TEST_F(VCTest, vc_set_current_language_changed_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_current_language_changed_cb_n - * @since_tizen 2.4 - * @description Negative UTC for set current language changed callback (invalid parameter) - */ -TEST_F(VCTest, vc_set_current_language_changed_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_current_language_changed_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_current_language_changed_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } -} - -/** - * @testcase utc_vc_set_current_language_changed_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for set current language changed callback (Invalid state) - */ -TEST_F(VCTest, vc_set_current_language_changed_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_current_language_changed_cb_n3 - * @since_tizen 2.4 - * @description Negative UTC for set current language changed callback (Invalid state) - */ -TEST_F(VCTest, vc_set_current_language_changed_cb_n3) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_unset_current_language_changed_cb_p - * @since_tizen 2.4 - * @description Positive UTC for unset current language changed callback - */ -TEST_F(VCTest, vc_unset_current_language_changed_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_current_language_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_current_language_changed_cb(__vc_current_language_changed_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unset_current_language_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_current_language_changed_cb_n - * @since_tizen 2.4 - * @description Negative UTC for unset current language changed callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_current_language_changed_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_current_language_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - vc_deinitialize(); - - int ret = VC_ERROR_NONE; - ret = vc_unset_current_language_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_unset_current_language_changed_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for unset current language changed callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_current_language_changed_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_current_language_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_unset_current_language_changed_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_error_cb_p - * @since_tizen 2.4 - * @description Positive UTC for set error callback - */ -TEST_F(VCTest, vc_set_error_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_error_cb(__vc_error_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_error_cb(__vc_error_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_error_cb_p2 - * @since_tizen 2.4 - * @description Positive UTC for set error callback - */ -TEST_F(VCTest, utc_vc_set_error_cb_p2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_error_cb(__vc_error_cb, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_set_error_cb(__vc_error_cb, nullptr), VC_ERROR_NONE); - - EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NONE); - EXPECT_EQ(__is_state_changed(VC_STATE_READY, 5), true); - EXPECT_EQ(__is_service_state_changed(VC_SERVICE_STATE_READY, 5), true); - - terminate_current_engine(); - - EXPECT_EQ(__is_error_cb_invoked(5), true); - EXPECT_EQ(__is_state_changed(VC_STATE_READY, 5), true); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_set_error_cb_n - * @since_tizen 2.4 - * @description Negative UTC for set error callback (Invalid parameter) - */ -TEST_F(VCTest, vc_set_error_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_error_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_error_cb(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } -} - -/** - * @testcase utc_vc_set_error_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for set error callback (Invalid state) - */ -TEST_F(VCTest, vc_set_error_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_error_cb(__vc_error_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_deinitialize(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_error_cb(__vc_error_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_set_error_cb_n3 - * @since_tizen 2.4 - * @description Negative UTC for set error callback (Invalid state) - */ -TEST_F(VCTest, vc_set_error_cb_n3) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_set_error_cb(__vc_error_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_set_error_cb(__vc_error_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_error_cb_p - * @since_tizen 2.4 - * @description Positive UTC for unset error callback - */ -TEST_F(VCTest, vc_unset_error_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_error_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_set_error_cb(__vc_error_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unset_error_cb(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_unset_error_cb_n - * @since_tizen 2.4 - * @description Negative UTC for unset error callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_error_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_error_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - vc_deinitialize(); - - int ret = VC_ERROR_NONE; - ret = vc_unset_error_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_unset_error_cb_n2 - * @since_tizen 2.4 - * @description Negative UTC for unset error callback (Invalid state) - */ -TEST_F(VCTest, vc_unset_error_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_unset_error_cb(); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_unset_error_cb(); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -// TODO: invalid parameter TC is needed? -/** - * @testcase utc_vc_set_invocation_name_p - * @since_tizen 3.0 - * @description Positive UTC for setting the invocation name - */ -TEST_F(VCTest, vc_set_invocation_name_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - const char* invoc_name = "testapp"; - ret = vc_set_invocation_name(invoc_name); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - const char* invoc_name = "testapp"; - - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_set_invocation_name(invoc_name); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_set_invocation_name(invoc_name); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_set_invocation_name_n - * @since_tizen 3.0 - * @description Negative UTC for setting the invocation name (Invalid state) - */ -TEST_F(VCTest, vc_set_invocation_name_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - const char* invoc_name = "testapp"; - ret = vc_set_invocation_name(invoc_name); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - const char* invoc_name = "testapp"; - - ret = vc_set_invocation_name(invoc_name); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_set_server_dialog_p - * @since_tizen 5.0 - * @description Positive UTC for setting the server dialog - */ -TEST_F(VCTestInReadyState, utc_vc_set_server_dialog_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_NONE); - EXPECT_EQ(vc_set_server_dialog(nullptr, TEST_CREDENTIAL), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_set_server_dialog_n - * @since_tizen 5.0 - * @description Negative UTC for setting the server dialog (Invalid parameter) - */ -TEST_F(VCTestInReadyState, utc_vc_set_server_dialog_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, nullptr), VC_ERROR_INVALID_PARAMETER); -} - -/** - * @testcase utc_vc_set_server_dialog_n2 - * @since_tizen 5.0 - * @description Negative UTC for setting the server dialog (Invalid state) - */ -TEST_F(VCTestInNoneState, utc_vc_set_server_dialog_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_unset_server_dialog_p - * @since_tizen 5.0 - * @description Positive UTC for setting the server dialog - */ -TEST_F(VCTestInReadyState, utc_vc_unset_server_dialog_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_unset_server_dialog_n - * @since_tizen 5.0 - * @description Negative UTC for setting the server dialog (Invalid state) - */ -TEST_F(VCTestInNoneState, utc_vc_unset_server_dialog_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_request_dialog_p - * @since_tizen 3.0 - * @description Positive UTC for requesting the dialog - */ -TEST_F(VCTest, vc_request_dialog_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - const char* disp_txt = "test"; - const char* utt_txt = "test"; - bool is_auto_start = true; - ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - const char* disp_txt = "test"; - const char* utt_txt = "test"; - bool is_auto_start = true; - - ret = vc_prepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - - while (VC_STATE_READY != g_vc_state) { - ecore_main_loop_iterate(); - } - - ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_unprepare(); - EXPECT_EQ(ret, VC_ERROR_NONE); - } -} - -/** - * @testcase utc_vc_request_dialog_n - * @since_tizen 3.0 - * @description Negative UTC for requesting the dialog (Invalid state) - */ -TEST_F(VCTest, vc_request_dialog_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - const char* disp_txt = "voice control test"; - const char* utt_txt = "This is a test for requesting the dialog"; - bool is_auto_start = true; - ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - vc_deinitialize(); - - int ret = VC_ERROR_NONE; - const char* disp_txt = "voice control test"; - const char* utt_txt = "This is a test for requesting the dialog"; - bool is_auto_start = true; - ret = vc_request_dialog(disp_txt, utt_txt, is_auto_start); - EXPECT_EQ(ret, VC_ERROR_INVALID_STATE); - } -} - -/** - * @testcase utc_vc_tts_set_streaming_cb_p - * @since_tizen 5.5 - * @description Positive UTC for setting tts streaming callback - */ -TEST_F(VCTest, utc_vc_tts_set_streaming_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_streaming_cb(__vc_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_set_streaming_cb(__vc_tts_streaming_cb, nullptr), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_tts_set_streaming_cb_n - * @since_tizen 5.5 - * @description Negative UTC for setting tts streaming callback (Invalid parameter) - */ -TEST_F(VCTest, utc_vc_tts_set_streaming_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_streaming_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_set_streaming_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); -} - -/** - * @testcase utc_vc_tts_set_streaming_cb_n2 - * @since_tizen 5.5 - * @description Negative UTC for setting tts streaming callback (Invalid state) - */ -TEST_F(VCTestInNoneState, utc_vc_tts_set_streaming_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_streaming_cb(__vc_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_set_streaming_cb(__vc_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NONE); - - EXPECT_EQ(vc_tts_set_streaming_cb(__vc_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_tts_set_streaming_cb_n3 - * @since_tizen 5.5 - * @description Negative UTC for setting tts streaming callback (Invalid state) - */ -TEST_F(VCTest, utc_vc_tts_set_streaming_cb_n3) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_streaming_cb(__vc_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_tts_set_streaming_cb(__vc_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); -} - -/** - * @testcase utc_vc_tts_unset_streaming_cb_p - * @since_tizen 5.5 - * @description Positive UTC for unsetting tts streaming callback - */ -TEST_F(VCTest, utc_vc_tts_unset_streaming_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_tts_unset_streaming_cb_n - * @since_tizen 5.5 - * @description Negative UTC for unsetting tts streaming callback (Invalid state) - */ -TEST_F(VCTestInNoneState, utc_vc_tts_unset_streaming_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NONE); - - EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_tts_set_utterance_status_cb_p - * @since_tizen 5.5 - * @description Positive UTC for setting tts utterance status callback - */ -TEST_F(VCTest, utc_vc_tts_set_utterance_status_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_utterance_status_cb(__vc_tts_utterance_status_cb, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_set_utterance_status_cb(__vc_tts_utterance_status_cb, nullptr), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_tts_set_utterance_status_cb_n - * @since_tizen 5.5 - * @description Negative UTC for setting tts utterance status callback (Invalid parameter) - */ -TEST_F(VCTest, utc_vc_tts_set_utterance_status_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_utterance_status_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_set_utterance_status_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); -} - -/** - * @testcase utc_vc_tts_set_utterance_status_cb_n2 - * @since_tizen 5.5 - * @description Negative UTC for setting tts utterance status callback (Invalid state) - */ -TEST_F(VCTestInNoneState, utc_vc_tts_set_utterance_status_cb_n2) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_utterance_status_cb(__vc_tts_utterance_status_cb, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_set_utterance_status_cb(__vc_tts_utterance_status_cb, nullptr), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NONE); - - EXPECT_EQ(vc_tts_set_utterance_status_cb(__vc_tts_utterance_status_cb, nullptr), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_tts_set_utterance_status_cb_n3 - * @since_tizen 5.5 - * @description Negative UTC for setting tts utterance status callback (Invalid state) - */ -TEST_F(VCTest, utc_vc_tts_set_utterance_status_cb_n3) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_set_utterance_status_cb(__vc_tts_utterance_status_cb, nullptr), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_tts_set_utterance_status_cb(__vc_tts_utterance_status_cb, nullptr), VC_ERROR_INVALID_STATE); -} - -/** - * @testcase utc_vc_tts_unset_utterance_status_cb_p - * @since_tizen 5.5 - * @description Positive UTC for unsetting tts utterance status callback - */ -TEST_F(VCTest, utc_vc_tts_unset_utterance_status_cb_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_tts_unset_utterance_status_cb_n - * @since_tizen 5.5 - * @description Negative UTC for unsetting tts utterance status callback (Invalid state) - */ -TEST_F(VCTestInNoneState, utc_vc_tts_unset_utterance_status_cb_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_initialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_prepare_sync(), VC_ERROR_NONE); - - EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_INVALID_STATE); - - EXPECT_EQ(vc_unprepare(), VC_ERROR_NONE); - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_cmd_list_create_p - * @since_tizen 2.4 - * @description Positive UTC for create command list handle - */ -TEST_F(VCTest, vc_cmd_list_create_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, false); - } -} - -/** - * @testcase utc_vc_cmd_list_create_n - * @since_tizen 2.4 - * @description Negative UTC for create command list handle (Invalid parameter) - */ -TEST_F(VCTest, vc_cmd_list_create_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_create(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_create(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } -} - -/** - * @testcase utc_vc_cmd_list_destroy_p - * @since_tizen 2.4 - * @description Positive UTC for destroy command list handle - */ -TEST_F(VCTest, vc_cmd_list_destroy_p) -{ - vc_cmd_list_h list = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_destroy(list, false), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_destroy(list, false), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_cmd_list_destroy_n - * @since_tizen 2.4 - * @description Negative UTC for destroy command list handle (Invalid parameter) - */ -TEST_F(VCTest, vc_cmd_list_destroy_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_destroy(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_destroy(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } -} - -/** - * @testcase utc_vc_cmd_list_get_count_p - * @since_tizen 2.4 - * @description Positive UTC for get count of command in command list - */ -TEST_F(VCTest, vc_cmd_list_get_count_p) -{ - vc_cmd_list_h list = nullptr; - int cnt = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 0); - - vc_cmd_h command = nullptr; - EXPECT_EQ(vc_cmd_create(&command), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 1); - - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_cmd_list_get_count_n - * @since_tizen 2.4 - * @description Negative UTC for get count of command in command list (Invalid parameter) - */ -TEST_F(VCTest, vc_cmd_list_get_count_n) -{ - vc_cmd_list_h list = nullptr; - int cnt = 0; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_get_count(nullptr, &cnt), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_get_count(list, nullptr), VC_ERROR_NOT_SUPPORTED); - } - - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_get_count(nullptr, &cnt), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_get_count(list, nullptr), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_list_destroy(list, false), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_cmd_list_add_p - * @since_tizen 2.4 - * @description Positive UTC for add command in command list - */ -TEST_F(VCTest, vc_cmd_list_add_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - vc_cmd_h cmd = NULL; - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, true); - } -} - -/** - * @testcase utc_vc_cmd_list_add_n - * @since_tizen 2.4 - * @description Negative UTC for add command in command list (Invalid parameter) - */ -TEST_F(VCTest, vc_cmd_list_add_n) -{ - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_add(list, nullptr), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_add(nullptr, cmd), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_add(list, nullptr), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_add(nullptr, cmd), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_cmd_list_remove_p - * @since_tizen 2.4 - * @description Positive UTC for remove command in command list - */ -TEST_F(VCTest, vc_cmd_list_remove_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - vc_cmd_h cmd = NULL; - ret = vc_cmd_list_remove(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_remove(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, true); - } -} - -/** - * @testcase utc_vc_cmd_list_remove_n - * @since_tizen 2.4 - * @description Negative UTC for remove command in command list (Invalid parameter) - */ -TEST_F(VCTest, vc_cmd_list_remove_n) -{ - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_remove(list, nullptr), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_remove(nullptr, cmd), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_remove(list, cmd), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_remove(list, nullptr), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_remove(nullptr, cmd), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_remove(list, cmd), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_list_destroy(list, false), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_cmd_list_remove_all_p - * @since_tizen 2.4 - * @description Positive UTC for destroy command list handle - */ -TEST_F(VCTest, utc_vc_cmd_list_remove_all_p) -{ - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - int cnt = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_remove_all(list, false), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_remove_all(list, true), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_add(list, cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 1); - - EXPECT_EQ(vc_cmd_list_remove_all(list, false), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 0); - - EXPECT_EQ(vc_cmd_list_add(list, cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 1); - - EXPECT_EQ(vc_cmd_list_remove_all(list, true), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 0); - - EXPECT_EQ(vc_cmd_list_destroy(list, false), VC_ERROR_NONE); -} - -/** - * @testcase utc_vc_cmd_list_remove_all_n - * @since_tizen 2.4 - * @description Negative UTC for destroy command list handle (invalid parameter) - */ -TEST_F(VCTest, utc_vc_cmd_list_remove_all_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_remove_all(nullptr, false), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_remove_all(nullptr, true), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_cmd_list_remove_all(nullptr, false), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_remove_all(nullptr, true), VC_ERROR_INVALID_PARAMETER); -} - -/** - * @testcase utc_vc_cmd_list_foreach_commands_p - * @since_tizen 2.4 - * @description Positive UTC for get whole command in command list - */ -TEST_F(VCTest, vc_cmd_list_foreach_commands_p) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_foreach_commands(list, __vc_cmd_list_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_foreach_commands(list, __vc_cmd_list_cb, NULL); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, true); - } + EXPECT_EQ(vc_set_command_list_from_file(filePath, -1), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_set_command_list_from_file(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_list_foreach_commands_n + * @testcase utc_vc_set_command_list_from_file_n2 * @since_tizen 2.4 - * @description Negative UTC for get whole command in command list (Invalid parameter) + * @description Negative UTC to set command list used as candidate set from file (Invalid state) */ -TEST_F(VCTest, vc_cmd_list_foreach_commands_n) +TEST_F(VCTestInNoneState, utc_vc_set_command_list_from_file_n2) { - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_foreach_commands(list, nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_foreach_commands(nullptr, __vc_cmd_list_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_add(list, cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_foreach_commands(list, nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_foreach_commands(nullptr, __vc_cmd_list_cb, nullptr), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_list_filter_by_type_p + * @testcase utc_vc_get_result_p1 * @since_tizen 3.0 - * @description Positive UTC for get filtered command list by type + * @description Positive UTC to getting the recognition result */ -TEST_F(VCTest, utc_vc_cmd_list_filter_by_type_p) +TEST_F(VCTestInReadyState, utc_vc_get_result_p1) { - vc_cmd_list_h list = nullptr; - int cnt = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, VC_COMMAND_TYPE_BACKGROUND, &list), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 1); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); - list = nullptr; - - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, VC_COMMAND_TYPE_BACKGROUND, &list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_get_count(list, &cnt), VC_ERROR_NONE); - EXPECT_EQ(cnt, 0); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); - list = nullptr; + EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, nullptr), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_filter_by_type_n + * @testcase utc_vc_get_result_n1 * @since_tizen 3.0 - * @description Negative UTC for get filtered command list by type (invalid parameter) + * @description Negative UTC to getting the recognition result (Invalid parameter) */ -TEST_F(VCTest, utc_vc_cmd_list_filter_by_type_n) +TEST_F(VCTestInReadyState, utc_vc_get_result_n1) { - vc_cmd_list_h list = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_filter_by_type(nullptr, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, -1, &list), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, VC_COMMAND_TYPE_FOREGROUND, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_result(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_filter_by_type(nullptr, VC_COMMAND_TYPE_FOREGROUND, &list), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, -1, &list), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_filter_by_type(g_test_commands, VC_COMMAND_TYPE_FOREGROUND, nullptr), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_get_result(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_list_first_p + * @testcase utc_vc_set_result_cb_p1 * @since_tizen 2.4 - * @description Positive UTC for move pointer to the first of command list + * @description Positive UTC to set result callback */ -TEST_F(VCTest, vc_cmd_list_first_p) +TEST_F(VCTest, utc_vc_set_result_cb_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_first(list); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_first(list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, true); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_result_cb(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_result_cb(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_first_n + * @testcase utc_vc_set_result_cb_n1 * @since_tizen 2.4 - * @description Negative UTC for move pointer to the first of command list (Invalid parameter) + * @description Negative UTC to set result callback (Invalid parameter) */ -TEST_F(VCTest, vc_cmd_list_first_n) +TEST_F(VCTest, utc_vc_set_result_cb_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_first(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_first(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_result_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_result_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_list_first_n2 + * @testcase utc_vc_set_result_cb_n2 * @since_tizen 2.4 - * @description Negative UTC for move pointer to the first of command list (Empty list) + * @description Negative UTC to set result callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_list_first_n2) +TEST_F(VCTestInNoneState, utc_vc_set_result_cb_n2) { - vc_cmd_list_h list = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_result_cb(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_first(list), VC_ERROR_EMPTY); + EXPECT_EQ(vc_set_result_cb(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_set_result_cb(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_list_last_p + * @testcase utc_vc_unset_result_cb_p1 * @since_tizen 2.4 - * @description Positive UTC for move pointer to the last of command list + * @description Positive UTC to unset result callback */ -TEST_F(VCTest, vc_cmd_list_last_p) +TEST_F(VCTest, utc_vc_unset_result_cb_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_last(list); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_last(list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, true); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_result_cb(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_unset_result_cb(), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_last_n + * @testcase utc_vc_unset_result_cb_n1 * @since_tizen 2.4 - * @description Negative UTC for move pointer to the last of command list (Invalid parameter) + * @description Negative UTC to unset result callback (Invalid state) */ -TEST_F(VCTest, vc_cmd_list_last_n) +TEST_F(VCTestInNoneState, utc_vc_unset_result_cb_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_last(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_last(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_result_cb(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_unset_result_cb(), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_unset_result_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_list_last_n2 + * @testcase utc_vc_set_service_state_changed_cb_p1 * @since_tizen 2.4 - * @description Negative UTC for move pointer to the last of command list (Empty list) + * @description Positive UTC to set service state changed callback */ -TEST_F(VCTest, utc_vc_cmd_list_last_n2) +TEST_F(VCTest, utc_vc_set_service_state_changed_cb_p1) { - vc_cmd_list_h list = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_service_state_changed_cb(mVcTestUtil->ServiceStateChangedCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_EMPTY); - - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_set_service_state_changed_cb(mVcTestUtil->ServiceStateChangedCallback, mVcTestUtil), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_next_p + * @testcase utc_vc_set_service_state_changed_cb_n1 * @since_tizen 2.4 - * @description Positive UTC for move pointer to next command in command list + * @description Negative UTC to set service state changed callback (Invalid parameter) */ -TEST_F(VCTest, vc_cmd_list_next_p) +TEST_F(VCTest, utc_vc_set_service_state_changed_cb_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_next(list); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - int i; - for (i = 0; i < 2; i++) { - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - } - - ret = vc_cmd_list_first(list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_next(list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, true); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_service_state_changed_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_service_state_changed_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_list_next_n + * @testcase utc_vc_set_service_state_changed_cb_n2 * @since_tizen 2.4 - * @description Negative UTC for move pointer to next command in command list (Invalid parameter) + * @description Negative UTC to set service state changed callback (Invalid state) */ -TEST_F(VCTest, vc_cmd_list_next_n) +TEST_F(VCTestInNoneState, utc_vc_set_service_state_changed_cb_n2) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_next(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_next(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_service_state_changed_cb(mVcTestUtil->ServiceStateChangedCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_service_state_changed_cb(mVcTestUtil->ServiceStateChangedCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_set_service_state_changed_cb(mVcTestUtil->ServiceStateChangedCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_list_next_n2 + * @testcase utc_vc_unset_service_state_changed_cb_p1 * @since_tizen 2.4 - * @description Negative UTC for move pointer to next command in command list (Empty list) + * @description Positive UTC to unset service state changed callback */ -TEST_F(VCTest, utc_vc_cmd_list_next_n2) +TEST_F(VCTest, utc_vc_unset_service_state_changed_cb_p1) { - vc_cmd_list_h list = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_service_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_next(list), VC_ERROR_EMPTY); - - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_unset_service_state_changed_cb(), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_next_n3 + * @testcase utc_vc_unset_service_state_changed_cb_n1 * @since_tizen 2.4 - * @description Negative UTC for move pointer to next command in command list (Iteration end) + * @description Negative UTC to unset service state changed callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_list_next_n3) +TEST_F(VCTestInNoneState, utc_vc_unset_service_state_changed_cb_n1) { - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_next(list), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_service_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_add(list, cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_next(list), VC_ERROR_ITERATION_END); + EXPECT_EQ(vc_unset_service_state_changed_cb(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_unset_service_state_changed_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_list_prev_p + * @testcase utc_vc_set_state_changed_cb_p1 * @since_tizen 2.4 - * @description Positive UTC for move pointer to previous command in command list + * @description Positive UTC to set state changed callback */ -TEST_F(VCTest, vc_cmd_list_prev_p) +TEST_F(VCTest, utc_vc_set_state_changed_cb_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_prev(list); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - int i; - for (i = 0; i < 2; i++) { - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - } - - ret = vc_cmd_list_last(list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_prev(list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_list_destroy(list, true); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_state_changed_cb(mVcTestUtil->StateChangedCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_state_changed_cb(mVcTestUtil->StateChangedCallback, mVcTestUtil), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_prev_n + * @testcase utc_vc_set_state_changed_cb_n1 * @since_tizen 2.4 - * @description Negative UTC for move pointer to previous command in command list (Invalid parameter) + * @description Negative UTC to set state changed callback (Invalid parameter) */ -TEST_F(VCTest, vc_cmd_list_prev_n) +TEST_F(VCTest, utc_vc_set_state_changed_cb_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_prev(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_list_prev(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_state_changed_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_state_changed_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_list_prev_n2 + * @testcase utc_vc_set_state_changed_cb_n2 * @since_tizen 2.4 - * @description Negative UTC for move pointer to next command in command list (Empty list) + * @description Negative UTC to set state changed callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_list_prev_n2) +TEST_F(VCTestInNoneState, utc_vc_set_state_changed_cb_n2) { - vc_cmd_list_h list = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_state_changed_cb(mVcTestUtil->StateChangedCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_EMPTY); + EXPECT_EQ(vc_set_state_changed_cb(mVcTestUtil->StateChangedCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_set_state_changed_cb(mVcTestUtil->StateChangedCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_list_prev_n3 + * @testcase utc_vc_unset_state_changed_cb_p1 * @since_tizen 2.4 - * @description Negative UTC for move pointer to next command in command list (Iteration end) + * @description Positive UTC to unset state changed callback */ -TEST_F(VCTest, utc_vc_cmd_list_prev_n3) +TEST_F(VCTest, utc_vc_unset_state_changed_cb_p1) { - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_add(list, cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_list_prev(list), VC_ERROR_ITERATION_END); - - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_unset_state_changed_cb(), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_get_current_p + * @testcase utc_vc_unset_state_changed_cb_n1 * @since_tizen 2.4 - * @description Positive UTC for get command handle of current pointer + * @description Negative UTC to unset state changed callback (Invalid state) */ -TEST_F(VCTest, vc_cmd_list_get_current_p) +TEST_F(VCTestInNoneState, utc_vc_unset_state_changed_cb_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - vc_cmd_h cur = NULL; - ret = vc_cmd_list_get_current(list, &cur); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_list_h list = NULL; - ret = vc_cmd_list_create(&list); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_add(list, cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_list_first(list); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_state_changed_cb(), VC_ERROR_NOT_SUPPORTED); + return; + } - vc_cmd_h cur = NULL; - ret = vc_cmd_list_get_current(list, &cur); - EXPECT_EQ(ret, VC_ERROR_NONE); + EXPECT_EQ(vc_unset_state_changed_cb(), VC_ERROR_INVALID_STATE); - vc_cmd_list_destroy(list, true); - } + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_unset_state_changed_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_list_get_current_n + * @testcase utc_vc_set_current_language_changed_cb_p1 * @since_tizen 2.4 - * @description Negative UTC for get command handle of current pointer (Invalid parameter) + * @description Positive UTC to set current language changed callback */ -TEST_F(VCTest, vc_cmd_list_get_current_n) +TEST_F(VCTest, utc_vc_set_current_language_changed_cb_p1) { - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_get_current(list, &cmd), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_list_get_current(list, &cmd), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_get_current(nullptr, &cmd), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_list_get_current(list, nullptr), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_list_get_current_n2 + * @testcase utc_vc_set_current_language_changed_cb_n1 * @since_tizen 2.4 - * @description Negative UTC for get command handle of current pointer (Empty list) + * @description Negative UTC to set current language changed callback (invalid parameter) */ -TEST_F(VCTest, utc_vc_cmd_list_get_current_n2) +TEST_F(VCTest, utc_vc_set_current_language_changed_cb_n1) { - vc_cmd_list_h list = nullptr; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_list_get_current(list, &cmd), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_current_language_changed_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_list_create(&list), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_list_get_current(list, &cmd), VC_ERROR_EMPTY); - - EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_set_current_language_changed_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_create_p + * @testcase utc_vc_set_current_language_changed_cb_n2 * @since_tizen 2.4 - * @description Positive UTC for create command handle + * @description Negative UTC to set current language changed callback (Invalid state) */ -TEST_F(VCTest, vc_cmd_create_p) +TEST_F(VCTestInNoneState, utc_vc_set_current_language_changed_cb_n2) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_destroy(cmd); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_create_n + * @testcase utc_vc_unset_current_language_changed_cb_p1 * @since_tizen 2.4 - * @description Negative UTC for create command handle + * @description Positive UTC to unset current language changed callback */ -TEST_F(VCTest, vc_cmd_create_n) +TEST_F(VCTest, utc_vc_unset_current_language_changed_cb_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_create(NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_create(NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_current_language_changed_cb(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_unset_current_language_changed_cb(), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_destroy_p + * @testcase utc_vc_unset_current_language_changed_cb_n1 * @since_tizen 2.4 - * @description Positive UTC for destroy command handle + * @description Negative UTC to unset current language changed callback (Invalid state) */ -TEST_F(VCTest, vc_cmd_destroy_p) +TEST_F(VCTestInNoneState, utc_vc_unset_current_language_changed_cb_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_destroy(cmd); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_destroy(cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_current_language_changed_cb(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_unset_current_language_changed_cb(), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_unset_current_language_changed_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_destroy_n + * @testcase utc_vc_set_error_cb_p1 * @since_tizen 2.4 - * @description Negative UTC for destroy command handle (Invalid parameter) + * @description Positive UTC to set error callback */ -TEST_F(VCTest, utc_vc_cmd_destroy_n) +TEST_F(VCTest, utc_vc_set_error_cb_p1) { - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_destroy(nullptr), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_error_cb(mVcTestUtil->ErrorCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_destroy(nullptr), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_set_error_cb(mVcTestUtil->ErrorCallback, mVcTestUtil), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_set_command_p + * @testcase utc_vc_set_error_cb_p2 * @since_tizen 2.4 - * @description Positive UTC for set command text in handle + * @description Positive UTC to set error callback */ -TEST_F(VCTest, vc_cmd_set_command_p) +TEST_F(VCTest, utc_vc_set_error_cb_p2) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_set_command(cmd, "voice"); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_set_command(cmd, "voice"); - EXPECT_EQ(ret, VC_ERROR_NONE); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_error_cb(mVcTestUtil->ErrorCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + return; + } - ret = vc_cmd_set_command(cmd, "voice"); - EXPECT_EQ(ret, VC_ERROR_NONE); + EXPECT_EQ(vc_set_error_cb(mVcTestUtil->ErrorCallback, mVcTestUtil), VC_ERROR_NONE); + EXPECT_EQ(mVcTestUtil->Prepare(), true); - vc_cmd_destroy(cmd); - } + VcCommonTestUtility::TerminateCurrentEngine(); + EXPECT_EQ(mVcTestUtil->IsErrorOccurring(5), true); + EXPECT_EQ(mVcTestUtil->IsStateChanged(VC_STATE_READY, 5), true); } /** - * @testcase utc_vc_cmd_set_command_n + * @testcase utc_vc_set_error_cb_n1 * @since_tizen 2.4 - * @description Negative UTC for set command text in handle (Invalid parameter) + * @description Negative UTC to set error callback (Invalid parameter) */ -TEST_F(VCTest, vc_cmd_set_command_n) +TEST_F(VCTest, utc_vc_set_error_cb_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_set_command(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_set_command(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_error_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_error_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_get_command_p + * @testcase utc_vc_set_error_cb_n2 * @since_tizen 2.4 - * @description Positive UTC for get command text in handle + * @description Negative UTC to set error callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_get_command_p) +TEST_F(VCTestInNoneState, utc_vc_set_error_cb_n2) { - const char *command_text = "voice"; - vc_cmd_h cmd = nullptr; - char *text = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_command(cmd, &text), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_error_cb(mVcTestUtil->ErrorCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_get_command(cmd, &text), VC_ERROR_NONE); - EXPECT_EQ(text, nullptr); - - EXPECT_EQ(vc_cmd_set_command(cmd, command_text), VC_ERROR_NONE); + EXPECT_EQ(vc_set_error_cb(mVcTestUtil->ErrorCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_get_command(cmd, &text), VC_ERROR_NONE); - EXPECT_STREQ(text, command_text); - free(text); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_set_error_cb(mVcTestUtil->ErrorCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_get_command_n + * @testcase utc_vc_unset_error_cb_p1 * @since_tizen 2.4 - * @description Negative UTC for get command text in handle (Invalid parameter) + * @description Positive UTC to unset error callback */ -TEST_F(VCTest, vc_cmd_get_command_n) +TEST_F(VCTest, utc_vc_unset_error_cb_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_command(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_command(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_error_cb(), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_unset_error_cb(), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_set_unfixed_command_p + * @testcase utc_vc_unset_error_cb_n1 * @since_tizen 2.4 - * @description Positive UTC for setting the unfixed command text in handle + * @description Negative UTC to unset error callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_set_unfixed_command_p) +TEST_F(VCTestInNoneState, utc_vc_unset_error_cb_n1) { - const char *command_text = "voice"; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_unfixed_command(cmd, command_text), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_error_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_unfixed_command(cmd, command_text), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_set_unfixed_command(cmd, command_text), VC_ERROR_NONE); + EXPECT_EQ(vc_unset_error_cb(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + EXPECT_EQ(vc_unset_error_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_set_unfixed_command_n - * @since_tizen 2.4 - * @description Negative UTC for setting the unfixed command text in handle (Invalid parameter) + * @testcase utc_vc_set_invocation_name_p1 + * @since_tizen 3.0 + * @description Positive UTC to setting the invocation name */ -TEST_F(VCTest, utc_vc_cmd_set_unfixed_command_n) +TEST_F(VCTestInReadyState, utc_vc_set_invocation_name_p1) { - const char *command_text = "voice"; - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_unfixed_command(nullptr, command_text), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_set_unfixed_command(cmd, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_invocation_name(TEST_INVOCATION_NAME), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_unfixed_command(nullptr, command_text), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_set_unfixed_command(cmd, nullptr), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_set_invocation_name(TEST_INVOCATION_NAME), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_get_unfixed_command_p + * @testcase utc_vc_set_invocation_name_n1 * @since_tizen 3.0 - * @description Positive UTC for getting the unfixed command text in handle + * @description Negative UTC to setting the invocation name (Invalid state) */ -TEST_F(VCTest, vc_cmd_get_unfixed_command_p) +TEST_F(VCTestInNoneState, utc_vc_set_invocation_name_n1) { - const char *command_text = "voice"; - vc_cmd_h cmd = nullptr; - char *text = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_unfixed_command(cmd, &text), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_invocation_name(TEST_INVOCATION_NAME), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_get_unfixed_command(cmd, &text), VC_ERROR_NONE); - EXPECT_EQ(text, nullptr); + EXPECT_EQ(vc_set_invocation_name(TEST_INVOCATION_NAME), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_set_unfixed_command(cmd, command_text), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_get_unfixed_command(cmd, &text), VC_ERROR_NONE); - EXPECT_STREQ(text, command_text); - free(text); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_set_invocation_name(TEST_INVOCATION_NAME), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_get_unfixed_command_n - * @since_tizen 3.0 - * @description Negative UTC for getting the unfixed command text in handle (Invalid parameter) + * @testcase utc_vc_set_server_dialog_p1 + * @since_tizen 5.0 + * @description Positive UTC to setting the server dialog */ -TEST_F(VCTest, vc_cmd_get_unfixed_command_n) +TEST_F(VCTestInReadyState, utc_vc_set_server_dialog_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_unfixed_command(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_unfixed_command(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_NONE); + EXPECT_EQ(vc_set_server_dialog(nullptr, TEST_CREDENTIAL), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_set_type_p - * @since_tizen 2.4 - * @description Positive UTC for set command type in handle + * @testcase utc_vc_set_server_dialog_n1 + * @since_tizen 5.0 + * @description Negative UTC to setting the server dialog (Invalid parameter) */ -TEST_F(VCTest, vc_cmd_set_type_p) +TEST_F(VCTestInReadyState, utc_vc_set_server_dialog_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_destroy(cmd); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, nullptr), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_set_type_n - * @since_tizen 2.4 - * @description Negative UTC for set command type in handle (Invalid parameter) + * @testcase utc_vc_set_server_dialog_n2 + * @since_tizen 5.0 + * @description Negative UTC to setting the server dialog (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_set_type_n) +TEST_F(VCTestInNoneState, utc_vc_set_server_dialog_n2) { - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_type(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_set_type(cmd, -1), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_type(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_set_type(cmd, -1), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_set_server_dialog(TEST_APP_ID, TEST_CREDENTIAL), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_get_type_p - * @since_tizen 2.4 - * @description Positive UTC for get command type in handle + * @testcase utc_vc_unset_server_dialog_p1 + * @since_tizen 5.0 + * @description Positive UTC to unsetting the server dialog */ -TEST_F(VCTest, utc_vc_cmd_get_type_p) +TEST_F(VCTestInReadyState, utc_vc_unset_server_dialog_p1) { - vc_cmd_h cmd = nullptr; - int type = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_type(cmd, &type), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_type(cmd, VC_COMMAND_TYPE_BACKGROUND), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_get_type(cmd, &type), VC_ERROR_NONE); - EXPECT_EQ(type, VC_COMMAND_TYPE_BACKGROUND); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_NONE); + EXPECT_EQ(vc_unset_server_dialog(nullptr), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_get_type_n - * @since_tizen 2.4 - * @description Negative UTC for get command type in handle (invalid parameter) + * @testcase utc_vc_unset_server_dialog_n1 + * @since_tizen 5.0 + * @description Negative UTC to unsetting the server dialog (Invalid state) */ -TEST_F(VCTest, vc_cmd_get_type_n) +TEST_F(VCTestInNoneState, utc_vc_unset_server_dialog_n1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_type(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_type(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_unset_server_dialog(TEST_APP_ID), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_set_format_p + * @testcase utc_vc_request_dialog_p1 * @since_tizen 3.0 - * @description Positive UTC for setting command format in handle + * @description Positive UTC to requesting the dialog */ -TEST_F(VCTest, vc_cmd_set_format_p) +TEST_F(VCTestInReadyState, utc_vc_request_dialog_p1) { - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - - ret = vc_cmd_set_format(cmd, VC_COMMAND_FORMAT_FIXED); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - - vc_cmd_destroy(cmd); - } else { - EXPECT_EQ(g_vc_init, true); + const char* disp_txt = "voice control test"; + const char* utt_txt = "This is a test for requesting the dialog"; + bool is_auto_start = true; - int ret = VC_ERROR_NONE; - vc_cmd_h cmd = NULL; - ret = vc_cmd_create(&cmd); - EXPECT_EQ(ret, VC_ERROR_NONE); - - ret = vc_cmd_set_format(cmd, VC_COMMAND_FORMAT_FIXED); - EXPECT_EQ(ret, VC_ERROR_NONE); - - vc_cmd_destroy(cmd); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_request_dialog(disp_txt, utt_txt, is_auto_start), VC_ERROR_NOT_SUPPORTED); + return; } + + EXPECT_EQ(vc_request_dialog(disp_txt, utt_txt, is_auto_start), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_set_format_n + * @testcase utc_vc_request_dialog_n1 * @since_tizen 3.0 - * @description Negative UTC for setting command format in handle (Invalid parameter) + * @description Negative UTC to requesting the dialog (Invalid parameter) */ -TEST_F(VCTest, utc_vc_cmd_set_format_n) +TEST_F(VCTestInReadyState, utc_vc_request_dialog_n1) { - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_format(nullptr, VC_COMMAND_FORMAT_FIXED), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_set_format(cmd, -1), VC_ERROR_NOT_SUPPORTED); + const char* disp_txt = "voice control test"; + const char* utt_txt = "This is a test for requesting the dialog"; + bool is_auto_start = true; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_request_dialog(disp_txt, utt_txt, is_auto_start), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_format(nullptr, VC_COMMAND_FORMAT_FIXED), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_set_format(cmd, -1), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_request_dialog(nullptr, nullptr, is_auto_start), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_get_format_p + * @testcase utc_vc_request_dialog_n2 * @since_tizen 3.0 - * @description Positive UTC for getting command format in handle + * @description Negative UTC to requesting the dialog (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_get_format_p) +TEST_F(VCTestInNoneState, utc_vc_request_dialog_n2) { - vc_cmd_h cmd = nullptr; - int type = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_format(cmd, &type), VC_ERROR_NOT_SUPPORTED); + const char* disp_txt = "voice control test"; + const char* utt_txt = "This is a test for requesting the dialog"; + bool is_auto_start = true; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_request_dialog(disp_txt, utt_txt, is_auto_start), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_request_dialog(disp_txt, utt_txt, is_auto_start), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_set_format(cmd, VC_CMD_FORMAT_FIXED_AND_NONFIXED), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_get_format(cmd, &type), VC_ERROR_NONE); - EXPECT_EQ(type, VC_CMD_FORMAT_FIXED_AND_NONFIXED); + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_request_dialog(disp_txt, utt_txt, is_auto_start), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); -} + auto mgrUtil = std::make_unique(); -/** - * @testcase utc_vc_cmd_get_format_n - * @since_tizen 3.0 - * @description Negative UTC for getting command format in handle(invalid parameter) - */ -TEST_F(VCTest, vc_cmd_get_format_n) -{ - if (false == g_vc_supported) { - EXPECT_EQ(g_vc_init, false); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_format(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_NOT_SUPPORTED); - } else { - EXPECT_EQ(g_vc_init, true); - - int ret = VC_ERROR_NONE; - ret = vc_cmd_get_format(NULL, NULL); - EXPECT_EQ(ret, VC_ERROR_INVALID_PARAMETER); - } + mgrUtil->Initialize(); + mgrUtil->Prepare(); + mgrUtil->SetDefaultCommands(); + mgrUtil->Start(false); + + EXPECT_EQ(vc_request_dialog(disp_txt, utt_txt, is_auto_start), VC_ERROR_INVALID_STATE); + + mgrUtil->Cancel(); } /** - * @testcase utc_vc_cmd_set_pid_p - * @since_tizen 3.0 - * @description Positive UTC for setting pid in handle + * @testcase utc_vc_tts_set_streaming_cb_p1 + * @since_tizen 5.5 + * @description Positive UTC to setting tts streaming callback */ -TEST_F(VCTest, utc_vc_cmd_set_pid_p) +TEST_F(VCTest, utc_vc_tts_set_streaming_cb_p1) { - vc_cmd_h cmd = nullptr; - int pid = getpid(); - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_pid(cmd, pid), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_set_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_pid(cmd, pid), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_set_pid_n - * @since_tizen 3.0 - * @description Negative UTC for setting pid in handle (Invalid handle) + * @testcase utc_vc_tts_set_streaming_cb_n1 + * @since_tizen 5.5 + * @description Negative UTC to setting tts streaming callback (Invalid parameter) */ -TEST_F(VCTest, utc_vc_cmd_set_pid_n) +TEST_F(VCTest, utc_vc_tts_set_streaming_cb_n1) { - vc_cmd_h cmd = nullptr; - int pid = getpid(); - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_pid(nullptr, pid), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_set_pid(cmd, -1), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_set_streaming_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_pid(nullptr, pid), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_set_pid(cmd, -1), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_streaming_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_get_pid_p - * @since_tizen 3.0 - * @description Positive UTC for getting pid format in handle + * @testcase utc_vc_tts_set_streaming_cb_n2 + * @since_tizen 5.5 + * @description Negative UTC to setting tts streaming callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_get_pid_p) +TEST_F(VCTestInNoneState, utc_vc_tts_set_streaming_cb_n2) { - vc_cmd_h cmd = nullptr; - int pid = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_pid(cmd, &pid), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_set_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_set_pid(cmd, getpid()), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_get_pid(cmd, &pid), VC_ERROR_NONE); - EXPECT_EQ(pid, getpid()); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_streaming_cb(test_tts_streaming_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_get_pid_n - * @since_tizen 3.0 - * @description Positive UTC for getting pid format in handle + * @testcase utc_vc_tts_unset_streaming_cb_p1 + * @since_tizen 5.5 + * @description Positive UTC to unsetting tts streaming callback */ -TEST_F(VCTest, utc_vc_cmd_get_pid_n) +TEST_F(VCTest, utc_vc_tts_unset_streaming_cb_p1) { - vc_cmd_h cmd = nullptr; - int pid = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_pid(nullptr, &pid), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_get_pid(cmd, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_get_pid(nullptr, &pid), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_get_pid(cmd, nullptr), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_set_domain_p - * @since_tizen 3.0 - * @description Positive UTC for setting command domain in handle + * @testcase utc_vc_tts_unset_streaming_cb_n1 + * @since_tizen 5.5 + * @description Negative UTC to unsetting tts streaming callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_set_domain_p) +TEST_F(VCTestInNoneState, utc_vc_tts_unset_streaming_cb_n1) { - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_domain(cmd, 1), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_set_domain(cmd, 1), VC_ERROR_NONE); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_unset_streaming_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_cmd_set_domain_n - * @since_tizen 3.0 - * @description Negative UTC for setting command domain in handle (Invalid parameter) + * @testcase utc_vc_tts_set_utterance_status_cb_p1 + * @since_tizen 5.5 + * @description Positive UTC to setting tts utterance status callback */ -TEST_F(VCTest, utc_vc_cmd_set_domain_n) +TEST_F(VCTest, utc_vc_tts_set_utterance_status_cb_p1) { - vc_cmd_h cmd = nullptr; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_set_domain(nullptr, 1), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_set_utterance_status_cb(test_tts_utterance_status_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_domain(nullptr, 1), VC_ERROR_INVALID_PARAMETER); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_utterance_status_cb(test_tts_utterance_status_cb, nullptr), VC_ERROR_NONE); } /** - * @testcase utc_vc_cmd_get_domain_p - * @since_tizen 3.0 - * @description Positive UTC for getting command domain in handle + * @testcase utc_vc_tts_set_utterance_status_cb_n1 + * @since_tizen 5.5 + * @description Negative UTC to setting tts utterance status callback (Invalid parameter) */ -TEST_F(VCTest, utc_vc_cmd_get_domain_p) +TEST_F(VCTest, utc_vc_tts_set_utterance_status_cb_n1) { - vc_cmd_h cmd = nullptr; - int domain = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_domain(cmd, &domain), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_set_utterance_status_cb(nullptr, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); - - EXPECT_EQ(vc_cmd_set_domain(cmd, 1), VC_ERROR_NONE); - EXPECT_EQ(vc_cmd_get_domain(cmd, &domain), VC_ERROR_NONE); - EXPECT_EQ(domain, 1); - - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_utterance_status_cb(nullptr, nullptr), VC_ERROR_INVALID_PARAMETER); } /** - * @testcase utc_vc_cmd_get_domain_n - * @since_tizen 3.0 - * @description Negative UTC for getting command domain in handle (Invalid parameter) + * @testcase utc_vc_tts_set_utterance_status_cb_n2 + * @since_tizen 5.5 + * @description Negative UTC to setting tts utterance status callback (Invalid state) */ -TEST_F(VCTest, utc_vc_cmd_get_domain_n) +TEST_F(VCTestInNoneState, utc_vc_tts_set_utterance_status_cb_n2) { - vc_cmd_h cmd = nullptr; - int domain = -1; - if (false == g_vc_supported) { - EXPECT_EQ(vc_cmd_get_domain(nullptr, &domain), VC_ERROR_NOT_SUPPORTED); - EXPECT_EQ(vc_cmd_get_domain(cmd, nullptr), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_set_utterance_status_cb(test_tts_utterance_status_cb, nullptr), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_cmd_create(&cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_utterance_status_cb(test_tts_utterance_status_cb, nullptr), VC_ERROR_INVALID_STATE); - EXPECT_EQ(vc_cmd_get_domain(nullptr, &domain), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_cmd_get_domain(cmd, nullptr), VC_ERROR_INVALID_PARAMETER); + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); - EXPECT_EQ(vc_cmd_destroy(cmd), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_set_utterance_status_cb(test_tts_utterance_status_cb, nullptr), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_tts_request_p + * @testcase utc_vc_tts_unset_utterance_status_cb_p1 * @since_tizen 5.5 - * @description Positive UTC for vc tts request + * @description Positive UTC to unsetting tts utterance status callback */ -TEST_F(VCTestInReadyState, vc_tts_request_p) +TEST_F(VCTest, utc_vc_tts_unset_utterance_status_cb_p1) { - const char *text = "안녕"; - const char *lang = "ko_KR"; - int utt_id; - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NONE); - EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_NONE); } /** - * @testcase utc_vc_tts_request_n + * @testcase utc_vc_tts_unset_utterance_status_cb_n1 * @since_tizen 5.5 - * @description Nagative UTC for vc tts request + * @description Negative UTC to unsetting tts utterance status callback (Invalid state) */ -TEST_F(VCTestInReadyState, vc_tts_request_n) +TEST_F(VCTestInNoneState, utc_vc_tts_unset_utterance_status_cb_n1) { - const char *text = "안녕"; - const char *lang = "ko_KR"; - int utt_id; - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NOT_SUPPORTED); + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); - EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(mVcTestUtil->Prepare(), true); + + EXPECT_EQ(vc_tts_unset_utterance_status_cb(), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_tts_request_n2 + * @testcase utc_vc_tts_request_p1 * @since_tizen 5.5 - * @description Nagative UTC for vc tts request + * @description Positive UTC to request tts */ -TEST_F(VCTestInReadyState, vc_tts_request_n2) +TEST_F(VCTestInReadyState, utc_vc_tts_request_p1) { + const char *text = "안녕"; const char *lang = "ko_KR"; - int utt_id; - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_request(NULL, lang, false, &utt_id), VC_ERROR_NOT_SUPPORTED); + int utt_id = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_tts_request(NULL, lang, false, &utt_id), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NONE); EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_NONE); } /** - * @testcase utc_vc_tts_request_n3 + * @testcase utc_vc_tts_request_n1 * @since_tizen 5.5 - * @description Nagative UTC for vc tts request + * @description Nagative UTC to request tts */ -TEST_F(VCTestInReadyState, vc_tts_request_n3) +TEST_F(VCTestInNoneState, utc_vc_tts_request_n1) { - int utt_id; - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_request(NULL, NULL, false, &utt_id), VC_ERROR_NOT_SUPPORTED); + const char *text = "안녕"; + const char *lang = "ko_KR"; + int utt_id = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_tts_request(NULL, NULL, false, &utt_id), VC_ERROR_INVALID_PARAMETER); - EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_NONE); + EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_INVALID_STATE); } /** - * @testcase utc_vc_tts_request_n4 + * @testcase utc_vc_tts_request_n2 * @since_tizen 5.5 - * @description Nagative UTC for vc tts request + * @description Nagative UTC to request tts */ -TEST_F(VCTest, vc_tts_request_n4) +TEST_F(VCTestInReadyState, utc_vc_tts_request_n2) { const char *text = "안녕"; const char *lang = "ko_KR"; - int utt_id; - if (false == g_vc_supported) { + int utt_id = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_tts_request(nullptr, lang, false, &utt_id), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_tts_request(text, nullptr, false, &utt_id), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_tts_request(text, lang, false, nullptr), VC_ERROR_INVALID_PARAMETER); } - /** - * @testcase utc_vc_tts_cancel_p + * @testcase utc_vc_tts_cancel_p1 * @since_tizen 5.5 - * @description Positive UTC for vc tts cancel + * @description Positive UTC to cancel tts */ -TEST_F(VCTestInReadyState, vc_tts_cancel_p) +TEST_F(VCTestInReadyState, utc_vc_tts_cancel_p1) { const char *text = "안녕"; const char *lang = "ko_KR"; - int utt_id = 0; - if (false == g_vc_supported) { + int utt_id = -1; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_NOT_SUPPORTED); return; } @@ -4277,41 +1682,21 @@ TEST_F(VCTestInReadyState, vc_tts_cancel_p) } /** - * @testcase utc_vc_tts_cancel_n + * @testcase utc_vc_tts_cancel_n1 * @since_tizen 5.5 - * @description Nagative UTC for vc tts cancel + * @description Nagative UTC to cancel tts */ - -TEST_F(VCTest, vc_tts_cancel_n) +TEST_F(VCTestInNoneState, utc_vc_tts_cancel_n1) { int utt_id = 0; - if (false == g_vc_supported) { + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_NOT_SUPPORTED); return; } EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_INVALID_STATE); -} - -/** - * @testcase utc_vc_tts_cancel_n2 - * @since_tizen 5.5 - * @description Nagative UTC for vc tts cancel - */ -TEST_F(VCTestInReadyState, vc_tts_cancel_n2) -{ - const char *text = "안녕"; - const char *lang = "ko_KR"; - int utt_id = 0; - if (false == g_vc_supported) { - EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_tts_request(text, lang, false, &utt_id), VC_ERROR_NONE); - - EXPECT_EQ(vc_deinitialize(), VC_ERROR_NONE); + mVcTestUtil->Initialize(); EXPECT_EQ(vc_tts_cancel(utt_id), VC_ERROR_INVALID_STATE); } -- 2.7.4 From 208363be5a85f051e775d2eef5dda12ae331781a Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 18 Jul 2023 15:02:48 +0900 Subject: [PATCH 08/16] Add new test cases to increse the coverage - Contents: This patch adds new test cases for uncovered line. Through this patch, developers can check the behavior about specific situations. Change-Id: I192b38e190f4b59991c06d2865df0b37b4a8914b --- tests/src/vc_command_unittests.cpp | 35 +++++ tests/src/vc_mgr_test_util.cpp | 18 ++- tests/src/vc_mgr_test_util.h | 3 + tests/src/vc_mgr_unittests.cpp | 314 +++++++++++++++++++++++++------------ tests/src/vc_test_util.cpp | 16 ++ tests/src/vc_test_util.h | 3 + tests/src/vc_unittests.cpp | 58 +++++-- 7 files changed, 333 insertions(+), 114 deletions(-) diff --git a/tests/src/vc_command_unittests.cpp b/tests/src/vc_command_unittests.cpp index fc69406..93ec705 100644 --- a/tests/src/vc_command_unittests.cpp +++ b/tests/src/vc_command_unittests.cpp @@ -118,6 +118,10 @@ TEST_F(VCCommandTest, utc_vc_cmd_list_destroy_n1) } EXPECT_EQ(vc_cmd_list_destroy(nullptr, false), VC_ERROR_INVALID_PARAMETER); + + vc_cmd_list_h list = VcCommonTestUtility::CreateTestCommandList(); + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_INVALID_PARAMETER); } /** @@ -246,6 +250,37 @@ TEST_F(VCCommandTest, utc_vc_cmd_list_remove_p1) } /** + * @testcase utc_vc_cmd_list_remove_p2 + * @since_tizen 2.4 + * @description Positive UTC to remove command in command list + */ +TEST_F(VCCommandTest, utc_vc_cmd_list_remove_p2) +{ + vc_cmd_list_h list = nullptr; + vc_cmd_h command = nullptr; + + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_cmd_list_remove(list, command), VC_ERROR_NOT_SUPPORTED); + return; + } + + list = VcCommonTestUtility::CreateTestCommandList(); + command = VcCommonTestUtility::CreateTestCommand("test"); + + ASSERT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_last(list), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_remove(list, command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_remove_all(list, true), VC_ERROR_NONE); + + ASSERT_EQ(vc_cmd_list_add(list, command), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_list_remove(list, command), VC_ERROR_NONE); + + EXPECT_EQ(vc_cmd_list_destroy(list, true), VC_ERROR_NONE); + EXPECT_EQ(vc_cmd_destroy(command), VC_ERROR_NONE); +} + +/** * @testcase utc_vc_cmd_list_remove_n1 * @since_tizen 2.4 * @description Negative UTC to remove command in command list (Invalid parameter) diff --git a/tests/src/vc_mgr_test_util.cpp b/tests/src/vc_mgr_test_util.cpp index 699526f..db17219 100644 --- a/tests/src/vc_mgr_test_util.cpp +++ b/tests/src/vc_mgr_test_util.cpp @@ -34,6 +34,7 @@ VcMgrTestUtility::VcMgrTestUtility() mSetSelectedResultReturn = VC_ERROR_OPERATION_FAILED; mResultReceived = false; mSpeechDetected = false; + mLanguageChanged = false; mErrorMessage = nullptr; @@ -83,7 +84,7 @@ bool VcMgrTestUtility::AllResultCallback(vc_result_event_e event, vc_cmd_list_h auto instance = reinterpret_cast(user_data); instance->mAllResultReceived = true; - instance->mSetSelectedResultReturn = vc_mgr_set_selected_results(instance->mDefaultCommandList); + instance->mSetSelectedResultReturn = vc_mgr_set_selected_results(vc_cmd_list); return false; } @@ -99,6 +100,12 @@ void VcMgrTestUtility::SpeechDetectedCallback(void *user_data) instance->mSpeechDetected = true; } +void VcMgrTestUtility::LanguageChangedCallback(const char* previous, const char* current, void* user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mLanguageChanged = true; +} + void VcMgrTestUtility::GetTestPCMData() { const char* pcm_path = tzplatform_mkpath(tzplatform_getid("TZ_SYS_RO_APP"), "/org.tizen.vc-unittests/res/test_pcm.dat"); @@ -206,6 +213,15 @@ bool VcMgrTestUtility::IsSpeechDetected(int duration) return VcCommonTestUtility::WaitCondtion(resultChecker, duration); } +bool VcMgrTestUtility::IsLanguageChanged(int duration) +{ + auto resultChecker = std::bind([](VcMgrTestUtility *instance) { + return instance->mLanguageChanged; + }, this); + + return VcCommonTestUtility::WaitCondtion(resultChecker, duration); +} + bool VcMgrTestUtility::Prepare() { vc_state_e state = VC_STATE_INITIALIZED; diff --git a/tests/src/vc_mgr_test_util.h b/tests/src/vc_mgr_test_util.h index 2d8dd92..c0db4ad 100644 --- a/tests/src/vc_mgr_test_util.h +++ b/tests/src/vc_mgr_test_util.h @@ -31,6 +31,7 @@ public: static bool AllResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char *result, const char *msg, void *user_data); static void ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data); static void SpeechDetectedCallback(void *user_data); + static void LanguageChangedCallback(const char* previous, const char* current, void* user_data); public: VcMgrTestUtility(); @@ -58,6 +59,7 @@ public: bool IsAllResultReceived(int duration); bool IsResultReceived(int duration); bool IsSpeechDetected(int duration); + bool IsLanguageChanged(int duration); public: vc_state_e mCurrentState; @@ -70,6 +72,7 @@ public: int mSetSelectedResultReturn; bool mResultReceived; bool mSpeechDetected; + bool mLanguageChanged; char *mErrorMessage; diff --git a/tests/src/vc_mgr_unittests.cpp b/tests/src/vc_mgr_unittests.cpp index a762bcc..833f75d 100644 --- a/tests/src/vc_mgr_unittests.cpp +++ b/tests/src/vc_mgr_unittests.cpp @@ -28,6 +28,7 @@ #include "cynara_mock.h" #include "vc_common_test_util.h" +#include "vc_test_util.h" #include "vc_mgr_test_util.h" @@ -66,10 +67,6 @@ static void test_feedback_streaming_cb(vc_feedback_event_e event, char* buffer, { } -static void test_current_language_changed_cb(const char* previous, const char* current, void* user_data) -{ -} - static bool test_supported_language_cb(const char* language, void* user_data) { return true; @@ -222,6 +219,7 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_prepare_p1) } EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_prepare(), VC_ERROR_NONE); ASSERT_EQ(mMgrTestUtil->IsStateChanged(VC_STATE_READY, 5), true); } @@ -264,7 +262,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unprepare_p1) * @since_tizen 5.0 * @description Negative UTC to disconnect service engine */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unprepare_n1) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unprepare_n1) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_NOT_SUPPORTED); @@ -272,6 +270,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unprepare_n1) } EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_unprepare(), VC_ERROR_INVALID_STATE); } /** @@ -436,6 +437,19 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_service_state_p1) EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_NONE); EXPECT_EQ(state, VC_SERVICE_STATE_READY); + + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); + EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_NONE); + EXPECT_EQ(state, VC_SERVICE_STATE_RECORDING); + + mMgrTestUtil->Stop(); + EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_NONE); + EXPECT_EQ(state, VC_SERVICE_STATE_PROCESSING); + + mMgrTestUtil->Cancel(); + EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_NONE); + EXPECT_EQ(state, VC_SERVICE_STATE_READY); } /** @@ -458,7 +472,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_service_state_n1) * @since_tizen 5.0 * @description Negative UTC to get current state of service engine */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_service_state_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_service_state_n2) { vc_service_state_e state; if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { @@ -467,6 +481,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_service_state_n2) } EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_get_service_state(&state), VC_ERROR_INVALID_STATE); } /** @@ -483,7 +500,12 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_is_command_format_supported_p1) return; } - EXPECT_EQ(vc_mgr_is_command_format_supported(format, &support), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_is_command_format_supported(VC_COMMAND_FORMAT_FIXED, &support), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_is_command_format_supported(VC_COMMAND_FORMAT_FIXED_AND_VFIXED, &support), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_is_command_format_supported(VC_COMMAND_FORMAT_VFIXED_AND_FIXED, &support), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_is_command_format_supported(VC_COMMAND_FORMAT_FIXED_AND_NONFIXED, &support), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_is_command_format_supported(VC_COMMAND_FORMAT_NONFIXED_AND_FIXED, &support), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_is_command_format_supported(10, &support), VC_ERROR_NONE); } /** @@ -559,7 +581,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_n1) * @since_tizen 5.0 * @description Negative UTC to set command list used as candidate set */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_command_list_n2) { vc_cmd_list_h commands = nullptr; @@ -572,6 +594,10 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_n2) ASSERT_NE(commands, nullptr); EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_command_list(commands), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_cmd_list_destroy(commands, true), VC_ERROR_NONE); } @@ -597,7 +623,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unset_command_list_p1) * @since_tizen 5.0 * @description Negative UTC to unset command list used as candidate set */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_command_list_n1) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_command_list_n1) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_command_list(), VC_ERROR_NOT_SUPPORTED); @@ -605,6 +631,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_command_list_n1) } EXPECT_EQ(vc_mgr_unset_command_list(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_unset_command_list(), VC_ERROR_INVALID_STATE); } /** @@ -638,31 +667,15 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_from_file_n1) EXPECT_EQ(vc_mgr_set_command_list_from_file(nullptr, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); EXPECT_EQ(vc_mgr_set_command_list_from_file(VcCommonTestUtility::GetCommandEmptyFilePath(), VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_mgr_set_command_list_from_file(VcCommonTestUtility::GetCommandJsonFilePath(), -1), VC_ERROR_INVALID_PARAMETER); } /** * @testcase utc_vc_mgr_set_command_list_from_file_n2 * @since_tizen 5.0 - * @description Negative UTC to unset command list from file used as candidate set - */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_command_list_from_file_n2) -{ - const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); - - if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { - EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, -1), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, -1), VC_ERROR_INVALID_PARAMETER); -} - -/** - * @testcase utc_vc_mgr_set_command_list_from_file_n3 - * @since_tizen 5.0 - * @description Negative UTC to unset command list from file used as candidate set + * @description Negative UTC to unset command list from file used as candidate set (Invalid state) */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_from_file_n3) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_command_list_from_file_n2) { const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); @@ -672,6 +685,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_from_file_n3) } EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_command_list_from_file(filePath, VC_COMMAND_TYPE_FOREGROUND), VC_ERROR_INVALID_STATE); } /** @@ -707,11 +723,11 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_preloaded_commands_from_file_n1) } /** - * @testcase utc_vc_mgr_set_command_list_from_file_n2 + * @testcase utc_vc_mgr_set_preloaded_commands_from_file_n2 * @since_tizen 5.0 * @description Negative UTC to unset command list from file used as candidate set */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_from_file_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_preloaded_commands_from_file_n2) { const char *filePath = VcCommonTestUtility::GetCommandJsonFilePath(); @@ -721,6 +737,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_command_list_from_file_n2) } EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(filePath), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_preloaded_commands_from_file(filePath), VC_ERROR_INVALID_STATE); } /** @@ -761,7 +780,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_current_commands_n1) * @since_tizen 5.0 * @description Negative UTC to get command of current pointer */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_commands_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_current_commands_n2) { vc_cmd_list_h commands = nullptr; if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { @@ -770,6 +789,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_commands_n2) } EXPECT_EQ(vc_mgr_get_current_commands(&commands), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_get_current_commands(&commands), VC_ERROR_INVALID_STATE); } /** @@ -808,7 +830,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_audio_type_n1) * @since_tizen 5.0 * @description Negative UTC to set audio type */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_type_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_audio_type_n2) { const char *audioType = "audio_id"; if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { @@ -817,6 +839,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_audio_type_n2) } EXPECT_EQ(vc_mgr_set_audio_type(audioType), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_audio_type(audioType), VC_ERROR_INVALID_STATE); } /** @@ -856,7 +881,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_audio_type_n1) * @since_tizen 5.0 * @description Positive UTC to get audio type */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_audio_type_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_audio_type_n2) { char *audioType = nullptr; if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { @@ -865,6 +890,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_audio_type_n2) } EXPECT_EQ(vc_mgr_get_audio_type(&audioType), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_get_audio_type(&audioType), VC_ERROR_INVALID_STATE); } /** @@ -902,7 +930,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_recognition_mode_n1) * @since_tizen 5.0 * @description Negative UTC to set recognition mode */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_recognition_mode_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_recognition_mode_n2) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_STOP_BY_SILENCE), VC_ERROR_NOT_SUPPORTED); @@ -910,6 +938,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_recognition_mode_n2) } EXPECT_EQ(vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_STOP_BY_SILENCE), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_recognition_mode(VC_RECOGNITION_MODE_STOP_BY_SILENCE), VC_ERROR_INVALID_STATE); } /** @@ -1001,7 +1032,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_private_data_n1) * @since_tizen 5.0 * @description Negative UTC to set private data */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_private_data_n2) { const char *key = "key"; const char *data = "data"; @@ -1011,6 +1042,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_private_data_n2) } EXPECT_EQ(vc_mgr_set_private_data(key, data), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_private_data(key, data), VC_ERROR_INVALID_STATE); } /** @@ -1054,7 +1088,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_get_private_data_n1) * @since_tizen 5.0 * @description Negative UTC to get private data */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_private_data_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_get_private_data_n2) { const char *key = "key"; char *data = nullptr; @@ -1064,6 +1098,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_private_data_n2) } EXPECT_EQ(vc_mgr_get_private_data(key, &data), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_get_private_data(key, &data), VC_ERROR_INVALID_STATE); } /** @@ -1108,7 +1145,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_do_action_n1) * @since_tizen 5.0 * @description Negative UTC to requesting the do action */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_do_action_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_do_action_n2) { char *event = strdup("send_event"); if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { @@ -1117,6 +1154,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_do_action_n2) } EXPECT_EQ(vc_mgr_do_action(VC_SEND_EVENT_TYPE_TEXT, event), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_do_action(VC_SEND_EVENT_TYPE_TEXT, event), VC_ERROR_INVALID_STATE); } /** @@ -1135,6 +1175,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_specific_engine_request_p1) } EXPECT_EQ(vc_mgr_send_specific_engine_request(engineAppId, event, request), VC_ERROR_NONE); + // EXPECT_EQ(vc_mgr_send_specific_engine_request(engineAppId, event, nullptr), VC_ERROR_NONE); } /** @@ -1161,7 +1202,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_send_specific_engine_request_n1) * @since_tizen 5.0 * @description Negative UTC to send specific engine request */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_send_specific_engine_request_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_send_specific_engine_request_n2) { const char* engineAppId = DEFAULT_ENGINE_APP_ID; const char* event = "event"; @@ -1172,6 +1213,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_send_specific_engine_request_n2) } EXPECT_EQ(vc_mgr_send_specific_engine_request(engineAppId, event, request), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_send_specific_engine_request(engineAppId, event, request), VC_ERROR_INVALID_STATE); } /** @@ -1198,34 +1242,26 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_p1) * @since_tizen 5.0 * @description Negative UTC to start about voice control manager */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_start_n1) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_start_n1) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NOT_SUPPORTED); return; } - mMgrTestUtil->SetDefaultCommands(); - mMgrTestUtil->Start(false); - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_INVALID_STATE); - mMgrTestUtil->Cancel(); -} + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_start(false), VC_ERROR_INVALID_STATE); -/** - * @testcase utc_vc_mgr_start_n2 - * @since_tizen 5.0 - * @description Negative UTC to start about voice control manager - */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_start_n2) -{ - if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { - EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NOT_SUPPORTED); - return; - } + mMgrTestUtil->Prepare(); + mMgrTestUtil->SetDefaultCommands(); + EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_start(false), VC_ERROR_IN_PROGRESS_TO_RECORDING); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_RECORDING, 5), true); EXPECT_EQ(vc_mgr_start(false), VC_ERROR_INVALID_STATE); + mMgrTestUtil->Cancel(); } /** @@ -1254,35 +1290,34 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_p1) * @since_tizen 5.0 * @description Negative UTC to stop about voice control manager */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_stop_n1) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_stop_n1) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NOT_SUPPORTED); return; } - mMgrTestUtil->SetDefaultCommands(); - mMgrTestUtil->Start(false); - mMgrTestUtil->Stop(); + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_INVALID_STATE); + mMgrTestUtil->Initialize(); EXPECT_EQ(vc_mgr_stop(), VC_ERROR_INVALID_STATE); - mMgrTestUtil->Cancel(); -} + mMgrTestUtil->Prepare(); + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_INVALID_STATE); -/** - * @testcase utc_vc_mgr_stop_n2 - * @since_tizen 5.0 - * @description Negative UTC to stop about voice control manager - */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_stop_n2) -{ - if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { - EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NOT_SUPPORTED); - return; - } + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_IN_PROGRESS_TO_PROCESSING); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_PROCESSING, 5), true); EXPECT_EQ(vc_mgr_stop(), VC_ERROR_INVALID_STATE); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_READY, 5), true); + + mMgrTestUtil->Start(false); + EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_IN_PROGRESS_TO_READY); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_READY, 5), true); } /** @@ -1309,15 +1344,28 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_cancel_p1) * @since_tizen 5.0 * @description Negative UTC to cancel about voice control manager */ -TEST_F(VcMgrTestInReadyState, utc_vc_mgr_cancel_n1) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_cancel_n1) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NOT_SUPPORTED); return; } + EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Prepare(); mMgrTestUtil->SetDefaultCommands(); - mMgrTestUtil->Start(false); + EXPECT_EQ(vc_mgr_start(false), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_IN_PROGRESS_TO_RECORDING); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_RECORDING, 5), true); + + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_IN_PROGRESS_TO_PROCESSING); + EXPECT_EQ(mMgrTestUtil->IsServiceStateChanged(VC_SERVICE_STATE_PROCESSING, 5), true); + EXPECT_EQ(vc_mgr_stop(), VC_ERROR_INVALID_STATE); EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NONE); EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_IN_PROGRESS_TO_READY); @@ -1325,24 +1373,6 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_cancel_n1) } /** - * @testcase utc_vc_mgr_cancel_n2 - * @since_tizen 5.0 - * @description Negative UTC to cancel about voice control manager - */ -TEST_F(VcMgrTestInNoneState, utc_vc_mgr_cancel_n2) -{ - if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_NOT_SUPPORTED); - return; - } - - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_INVALID_STATE); - - mMgrTestUtil->Initialize(); - EXPECT_EQ(vc_mgr_cancel(), VC_ERROR_INVALID_STATE); -} - -/** * @testcase utc_vc_mgr_get_recording_volume_p1 * @since_tizen 5.0 * @description Positive UTC to get recording volume @@ -2045,11 +2075,29 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_speech_detected_cb_n1) TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_current_language_changed_cb_p1) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(mMgrTestUtil->LanguageChangedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(mMgrTestUtil->LanguageChangedCallback, mMgrTestUtil), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_mgr_set_current_language_changed_cb_p2 + * @since_tizen 5.0 + * @description Positive UTC to set current language changed callback + */ +TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_current_language_changed_cb_p2) +{ + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(mMgrTestUtil->LanguageChangedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(mMgrTestUtil->LanguageChangedCallback, mMgrTestUtil), VC_ERROR_NONE); + + VcCommonTestUtility::SetCurrentLanguage("ko_KR"); + EXPECT_EQ(mMgrTestUtil->IsLanguageChanged(5), true); } /** @@ -2070,20 +2118,20 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_current_language_changed_cb_n /** * @testcase utc_vc_mgr_set_current_language_changed_cb_n2 * @since_tizen 5.0 - * @description Negative UTC to set current language changed callback + * @description Negative UTC to set current language changed callback (Invalid state) */ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_current_language_changed_cb_n2) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_NOT_SUPPORTED); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(mMgrTestUtil->LanguageChangedCallback, mMgrTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(mMgrTestUtil->LanguageChangedCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); mMgrTestUtil->Initialize(); mMgrTestUtil->Prepare(); - EXPECT_EQ(vc_mgr_set_current_language_changed_cb(test_current_language_changed_cb, nullptr), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_mgr_set_current_language_changed_cb(mMgrTestUtil->LanguageChangedCallback, mMgrTestUtil), VC_ERROR_INVALID_STATE); } /** @@ -3144,6 +3192,14 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_audio_streaming_mode_n2) } EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_VC_SERVICE), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + mMgrTestUtil->Prepare(); + mMgrTestUtil->SetDefaultCommands(); + mMgrTestUtil->Start(false); + + EXPECT_EQ(vc_mgr_set_audio_streaming_mode(VC_AUDIO_STREAMING_MODE_VC_SERVICE), VC_ERROR_INVALID_STATE); + } /** @@ -3193,6 +3249,53 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_change_background_volume_n2) } /** + * @testcase utc_vc_mgr_change_background_volume_by_ratio_p1 + * @since_tizen 5.0 + * @description Positive UTC to change background volume by ratio + */ +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_change_background_volume_by_ratio_p1) +{ + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_change_background_volume_by_ratio(0.5), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_mgr_change_background_volume_by_ratio(0.5), VC_ERROR_NONE); + EXPECT_EQ(vc_mgr_reset_background_volume(), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_mgr_change_background_volume_by_ratio_n1 + * @since_tizen 5.0 + * @description Negative UTC to change background volume by ratio + */ +TEST_F(VcMgrTestInReadyState, utc_vc_mgr_change_background_volume_by_ratio_n1) +{ + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_change_background_volume_by_ratio(-1.0), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_mgr_change_background_volume_by_ratio(-0.5), VC_ERROR_INVALID_PARAMETER); + EXPECT_EQ(vc_mgr_change_background_volume_by_ratio(1.5), VC_ERROR_INVALID_PARAMETER); +} + +/** + * @testcase utc_vc_mgr_change_background_volume_by_ratio_n2 + * @since_tizen 5.0 + * @description Negative UTC to change background volume by ratio + */ +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_change_background_volume_by_ratio_n2) +{ + if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { + EXPECT_EQ(vc_mgr_change_background_volume_by_ratio(0.5), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_mgr_change_background_volume_by_ratio(0.5), VC_ERROR_INVALID_STATE); +} + +/** * @testcase utc_vc_mgr_reset_background_volume_p1 * @since_tizen 5.0 * @description Positive UTC to change background volume @@ -3316,7 +3419,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_demandable_client_rule_n1) * @since_tizen 5.0 * @description Negative UTC to set demandable client rule */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_demandable_client_rule_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_demandable_client_rule_n2) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_demandable_client_rule(TEST_DEMANDABLE_LIST_XML_PATH), VC_ERROR_NOT_SUPPORTED); @@ -3324,6 +3427,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_demandable_client_rule_n2) } EXPECT_EQ(vc_mgr_set_demandable_client_rule(TEST_DEMANDABLE_LIST_XML_PATH), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_demandable_client_rule(TEST_DEMANDABLE_LIST_XML_PATH), VC_ERROR_INVALID_STATE); } /** @@ -3346,7 +3452,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_unset_demandable_client_rule_p1) * @since_tizen 5.0 * @description Negative UTC to unset demandable client rule */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_demandable_client_rule_n1) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_demandable_client_rule_n1) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_unset_demandable_client_rule(), VC_ERROR_NOT_SUPPORTED); @@ -3354,6 +3460,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_unset_demandable_client_rule_n1) } EXPECT_EQ(vc_mgr_unset_demandable_client_rule(), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_unset_demandable_client_rule(), VC_ERROR_INVALID_STATE); } /** @@ -3391,7 +3500,7 @@ TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_domain_n1) * @since_tizen 5.0 * @description Negative UTC to set domain */ -TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_domain_n2) +TEST_F(VcMgrTestInNoneState, utc_vc_mgr_set_domain_n2) { if (false == VcCommonTestUtility::IsVcMgrFeatureSupported()) { EXPECT_EQ(vc_mgr_set_domain(TEST_DOMAIN), VC_ERROR_NOT_SUPPORTED); @@ -3399,6 +3508,9 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_domain_n2) } EXPECT_EQ(vc_mgr_set_domain(TEST_DOMAIN), VC_ERROR_INVALID_STATE); + + mMgrTestUtil->Initialize(); + EXPECT_EQ(vc_mgr_set_domain(TEST_DOMAIN), VC_ERROR_INVALID_STATE); } diff --git a/tests/src/vc_test_util.cpp b/tests/src/vc_test_util.cpp index 3788465..b150f73 100644 --- a/tests/src/vc_test_util.cpp +++ b/tests/src/vc_test_util.cpp @@ -27,6 +27,7 @@ VcTestUtility::VcTestUtility() mCurrentServiceState = VC_SERVICE_STATE_NONE; mErrorOccured = false; mResultReceived = false; + mLanguageChanged = false; mErrorMessage = nullptr; @@ -68,6 +69,12 @@ void VcTestUtility::ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd instance->mResultReceived = true; } +void VcTestUtility::LanguageChangedCallback(const char* previous, const char* current, void* user_data) +{ + auto instance = reinterpret_cast(user_data); + instance->mLanguageChanged = true; +} + void VcTestUtility::Initialize() { if (VcCommonTestUtility::IsVcFeatureSupported() == false) { @@ -122,6 +129,15 @@ bool VcTestUtility::IsResultReceived(int duration) return VcCommonTestUtility::WaitCondtion(resultChecker, duration); } +bool VcTestUtility::IsLanguageChanged(int duration) +{ + auto resultChecker = std::bind([](VcTestUtility *instance) { + return instance->mLanguageChanged; + }, this); + + return VcCommonTestUtility::WaitCondtion(resultChecker, duration); +} + bool VcTestUtility::Prepare() { vc_state_e state = VC_STATE_INITIALIZED; diff --git a/tests/src/vc_test_util.h b/tests/src/vc_test_util.h index 51e94d3..4de8dc8 100644 --- a/tests/src/vc_test_util.h +++ b/tests/src/vc_test_util.h @@ -29,6 +29,7 @@ public: static void ServiceStateChangedCallback(vc_service_state_e previous, vc_service_state_e current, void* user_data); static void ErrorCallback(vc_error_e reason, void *user_data); static void ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data); + static void LanguageChangedCallback(const char* previous, const char* current, void* user_data); public: VcTestUtility(); @@ -44,6 +45,7 @@ public: bool IsServiceStateChanged(vc_service_state_e targetState, int duration); bool IsErrorOccurring(int duration); bool IsResultReceived(int duration); + bool IsLanguageChanged(int duration); public: vc_state_e mCurrentState; @@ -51,6 +53,7 @@ public: bool mErrorOccured; bool mResultReceived; + bool mLanguageChanged; char *mErrorMessage; vc_cmd_list_h mTestCommands; diff --git a/tests/src/vc_unittests.cpp b/tests/src/vc_unittests.cpp index 3324ac6..f529acd 100644 --- a/tests/src/vc_unittests.cpp +++ b/tests/src/vc_unittests.cpp @@ -38,16 +38,11 @@ static const char *TEST_INVOCATION_NAME = "invocation"; static const char *TEST_CREDENTIAL = "credential"; -static void test_current_language_changed_cb(const char* previous, const char* current, void* user_data) -{ -} - static bool test_supported_language_cb(const char* language, void* user_data) { return true; } - static void test_tts_streaming_cb(vc_tts_event_e event, char* buffer, int len, int utt_id, void *user_data) { } @@ -783,11 +778,11 @@ TEST_F(VCTestInNoneState, utc_vc_set_command_list_from_file_n2) TEST_F(VCTestInReadyState, utc_vc_get_result_p1) { if (false == VcCommonTestUtility::IsVcFeatureSupported()) { - EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, nullptr), VC_ERROR_NOT_SUPPORTED); + EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, nullptr), VC_ERROR_NONE); + EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_NONE); } /** @@ -806,6 +801,24 @@ TEST_F(VCTestInReadyState, utc_vc_get_result_n1) } /** + * @testcase utc_vc_get_result_n2 + * @since_tizen 3.0 + * @description Negative UTC to get the recognition result (Invalid state) + */ +TEST_F(VCTestInNoneState, utc_vc_get_result_n2) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); + + mVcTestUtil->Initialize(); + EXPECT_EQ(vc_get_result(mVcTestUtil->ResultCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); +} + +/** * @testcase utc_vc_set_result_cb_p1 * @since_tizen 2.4 * @description Positive UTC to set result callback @@ -1062,11 +1075,32 @@ TEST_F(VCTestInNoneState, utc_vc_unset_state_changed_cb_n1) TEST_F(VCTest, utc_vc_set_current_language_changed_cb_p1) { if (false == VcCommonTestUtility::IsVcFeatureSupported()) { - EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + EXPECT_EQ(vc_set_current_language_changed_cb(mVcTestUtil->LanguageChangedCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + return; + } + + EXPECT_EQ(vc_set_current_language_changed_cb(mVcTestUtil->LanguageChangedCallback, mVcTestUtil), VC_ERROR_NONE); +} + +/** + * @testcase utc_vc_set_current_language_changed_cb_p2 + * @since_tizen 2.4 + * @description Positive UTC to set current language changed callback + */ +TEST_F(VCTest, utc_vc_set_current_language_changed_cb_p2) +{ + if (false == VcCommonTestUtility::IsVcFeatureSupported()) { + EXPECT_EQ(vc_set_current_language_changed_cb(mVcTestUtil->LanguageChangedCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_NONE); + EXPECT_EQ(vc_set_current_language_changed_cb(mVcTestUtil->LanguageChangedCallback, mVcTestUtil), VC_ERROR_NONE); + + VcCommonTestUtility::SetCurrentLanguage("en_US"); + VcCommonTestUtility::SetCurrentLanguage("ko_KR"); + EXPECT_EQ(mVcTestUtil->IsLanguageChanged(5), true); + + VcCommonTestUtility::EnableAutoLanguageSelection(); } /** @@ -1092,15 +1126,15 @@ TEST_F(VCTest, utc_vc_set_current_language_changed_cb_n1) TEST_F(VCTestInNoneState, utc_vc_set_current_language_changed_cb_n2) { if (false == VcCommonTestUtility::IsVcFeatureSupported()) { - EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); + EXPECT_EQ(vc_set_current_language_changed_cb(mVcTestUtil->LanguageChangedCallback, mVcTestUtil), VC_ERROR_NOT_SUPPORTED); return; } - EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_set_current_language_changed_cb(mVcTestUtil->LanguageChangedCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); mVcTestUtil->Initialize(); EXPECT_EQ(mVcTestUtil->Prepare(), true); - EXPECT_EQ(vc_set_current_language_changed_cb(test_current_language_changed_cb, mVcTestUtil), VC_ERROR_INVALID_STATE); + EXPECT_EQ(vc_set_current_language_changed_cb(mVcTestUtil->LanguageChangedCallback, mVcTestUtil), VC_ERROR_INVALID_STATE); } /** -- 2.7.4 From c3204c389c3d25d6cee573b11997f5db3e30b015 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 18 Jul 2023 15:09:59 +0900 Subject: [PATCH 09/16] Remove unused or unreachable code - Contents: This patch removes some unused or unrechable code. Through this patch, unvaluable code is removed and also test cases covers more code and logics. Change-Id: I1fe9c3e17303740b8793d56def022b26b4acb110 Signed-off-by: Suyeon Hwang --- client/vc.c | 579 ++++++++++++------------------------------- client/vc_client.c | 39 +-- client/vc_mgr.c | 90 ++++--- client/vc_mgr_client.c | 58 +++-- client/vc_mgr_core.c | 74 +++--- common/vc_command.c | 36 +-- packaging/voice-control.spec | 8 +- 7 files changed, 305 insertions(+), 579 deletions(-) diff --git a/client/vc.c b/client/vc.c index afb3334..6695e1a 100644 --- a/client/vc.c +++ b/client/vc.c @@ -73,25 +73,29 @@ static int __vc_get_feature_enabled() } else if (-1 == g_feature_enabled) { bool vc_supported = false; bool mic_supported = false; - if (0 == system_info_get_platform_bool(VC_FEATURE_PATH, &vc_supported)) { - if (0 == system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { - if (false == vc_supported || false == mic_supported) { - //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Voice control feature NOT supported"); - g_feature_enabled = 0; - return VC_ERROR_NOT_SUPPORTED; - //LCOV_EXCL_STOP - } + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool(VC_FEATURE_PATH, &vc_supported)) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP + } - g_feature_enabled = 1; - } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE - return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE - } - } else { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); //LCOV_EXCL_LINE - return VC_ERROR_NOT_SUPPORTED; //LCOV_EXCL_LINE + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get feature value"); + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } + + if (false == vc_supported || false == mic_supported) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Voice control feature NOT supported"); + g_feature_enabled = 0; + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP + } + + g_feature_enabled = 1; } return VC_ERROR_NONE; @@ -270,6 +274,7 @@ static int __vc_convert_config_error_code(vc_config_error_e code) return VC_ERROR_NONE; } +//LCOV_EXCL_STOP static void __vc_lang_changed_cb(const char* previous_lang, const char* current_lang) { @@ -288,10 +293,9 @@ static void __vc_lang_changed_cb(const char* previous_lang, const char* current_ } else { SLOG(LOG_WARN, TAG_VCC, "[WARNING] Language changed callback is null"); } - - return; } +//LCOV_EXCL_START static Eina_Bool __notify_auth_changed_cb(void *data) { vc_auth_state_changed_cb callback = NULL; @@ -388,8 +392,8 @@ int vc_initialize(void) /* check handle */ if (true == vc_client_is_valid()) { - SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Already initialized"); //LCOV_EXCL_LINE - return VC_ERROR_NONE; //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] Already initialized"); + return VC_ERROR_NONE; } if (0 != vc_tidl_open_connection()) { @@ -405,23 +409,23 @@ int vc_initialize(void) g_pid = getpid(); ret = vc_config_mgr_initialize(g_pid); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to init config manager : %s", - __vc_get_error_code(__vc_convert_config_error_code(ret))); //LCOV_EXCL_LINE + ret = __vc_convert_config_error_code(ret); //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to init config manager : %s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE vc_client_destroy(); //LCOV_EXCL_LINE - return __vc_convert_config_error_code(ret); //LCOV_EXCL_LINE + return ret; //LCOV_EXCL_LINE } ret = vc_config_mgr_set_lang_cb(g_pid, __vc_lang_changed_cb); if (0 != ret) { + ret = __vc_convert_config_error_code(ret); //LCOV_EXCL_LINE SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set config changed : %d", ret); //LCOV_EXCL_LINE vc_config_mgr_finalize(g_pid); //LCOV_EXCL_LINE vc_client_destroy(); //LCOV_EXCL_LINE - return __vc_convert_config_error_code(ret); + return ret; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "[Success] pid(%d)", g_pid); - return VC_ERROR_NONE; } @@ -434,7 +438,7 @@ static void __vc_internal_unprepare(void) } if (VC_AUTH_STATE_NONE != state) { - if (0 != vc_auth_disable()) { + if (0 != vc_auth_disable()) { //LCOV_EXCL_LINE SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to auth disable"); //LCOV_EXCL_LINE } } @@ -459,8 +463,6 @@ static void __vc_internal_unprepare(void) ret = vc_cmd_parser_delete_file(getpid(), VC_COMMAND_TYPE_FOREGROUND); if (0 != ret) SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to delete file, type(%d), ret(%d)", VC_COMMAND_TYPE_FOREGROUND, ret); //LCOV_EXCL_LINE - - return; } int vc_deinitialize(void) @@ -526,7 +528,7 @@ int vc_deinitialize(void) return VC_ERROR_NONE; } -static Eina_Bool __vc_connect_daemon(void *data) +static Eina_Bool connect_service(void *data) { SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Connect daemon"); @@ -536,110 +538,111 @@ static Eina_Bool __vc_connect_daemon(void *data) int service_state = 0; /* check handle */ - if (true == vc_client_is_valid()) { - SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] The current client is valid"); + if (false == vc_client_is_valid()) { + SLOG(LOG_ERROR, TAG_VCC, "[Not ERROR] The current client is not valid. It is destroyed."); //LCOV_EXCL_LINE + return EINA_FALSE; + } - /* Initialize DB */ - ret = vc_db_initialize(); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize DB : %d", ret); //LCOV_EXCL_LINE - return EINA_TRUE; - } + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] The current client is valid"); - ret = vc_cmd_parser_delete_file(getpid(), VC_COMMAND_TYPE_FOREGROUND); - if (0 != ret) - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to delete file, type(%d), ret(%d)", VC_COMMAND_TYPE_FOREGROUND, ret); //LCOV_EXCL_LINE + /* Initialize DB */ + ret = vc_db_initialize(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize DB : %d", ret); //LCOV_EXCL_LINE + return EINA_TRUE; + } - ret = vc_tidl_request_initialize(g_pid, &mgr_pid, &service_state, &g_daemon_pid); - //LCOV_EXCL_START - if (VC_ERROR_ENGINE_NOT_FOUND == ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize : %s", __vc_get_error_code(ret)); + ret = vc_cmd_parser_delete_file(getpid(), VC_COMMAND_TYPE_FOREGROUND); + if (0 != ret) + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to delete file, type(%d), ret(%d)", VC_COMMAND_TYPE_FOREGROUND, ret); //LCOV_EXCL_LINE - vc_client_set_error(VC_ERROR_ENGINE_NOT_FOUND); - ecore_main_loop_thread_safe_call_async(__vc_notify_error, NULL); + ret = vc_tidl_request_initialize(g_pid, &mgr_pid, &service_state, &g_daemon_pid); + //LCOV_EXCL_START + if (VC_ERROR_ENGINE_NOT_FOUND == ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize : %s", __vc_get_error_code(ret)); - return EINA_FALSE; - //LCOV_EXCL_STOP - } else if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize :%s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE + vc_client_set_error(VC_ERROR_ENGINE_NOT_FOUND); + ecore_main_loop_thread_safe_call_async(__vc_notify_error, NULL); - vc_client_set_error(VC_ERROR_TIMED_OUT); - ecore_main_loop_thread_safe_call_async(__vc_notify_error, NULL); + return EINA_FALSE; + //LCOV_EXCL_STOP + } else if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to initialize :%s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE - ret = vc_db_finalize(); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to finalize DB : %d", ret); //LCOV_EXCL_LINE - } + vc_client_set_error(VC_ERROR_TIMED_OUT); + ecore_main_loop_thread_safe_call_async(__vc_notify_error, NULL); - return EINA_TRUE; - } else { - /* Success to connect */ + ret = vc_db_finalize(); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to finalize DB : %d", ret); //LCOV_EXCL_LINE } - /* Set service state */ - vc_service_state_e previous_service_state; - vc_client_get_service_state(&previous_service_state); + return EINA_TRUE; + } else { + /* Success to connect */ + } - vc_client_set_service_state((vc_service_state_e)service_state); + /* Set service state */ + vc_service_state_e previous_service_state; + vc_client_get_service_state(&previous_service_state); - vc_service_state_changed_cb service_changed_callback = NULL; - void* user_data = NULL; - vc_client_get_service_state_changed_cb(&service_changed_callback, &user_data); + vc_client_set_service_state((vc_service_state_e)service_state); - if (NULL != service_changed_callback) { - vc_client_use_callback(); - service_changed_callback(previous_service_state, service_state, user_data); - vc_client_not_use_callback(); - SLOG(LOG_DEBUG, TAG_VCC, "Service state changed callback is called"); //LCOV_EXCL_LINE - } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] Service state changed callback is null"); //LCOV_EXCL_LINE - } + vc_service_state_changed_cb service_changed_callback = NULL; + void* user_data = NULL; + vc_client_get_service_state_changed_cb(&service_changed_callback, &user_data); - /* Register focus handler */ - ecore_thread_main_loop_begin(); - g_focus_in_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, __focus_changed_cb, NULL); - g_focus_out_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, __focus_changed_cb, NULL); - ecore_thread_main_loop_end(); - - char appid[1024] = {'\0',}; - ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1); - if (ret != AUL_R_OK) - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get aul_app_get_appid_bypid : %d", ret); - - int status = aul_app_get_status(appid); - if (STATUS_FOCUS == status) { - SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set foreground"); //LCOV_EXCL_LINE - ret = vc_tidl_request_set_foreground(getpid(), true); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set foreground (true) : %d", ret); //LCOV_EXCL_LINE - } + if (NULL != service_changed_callback) { + vc_client_use_callback(); + service_changed_callback(previous_service_state, service_state, user_data); + vc_client_not_use_callback(); + SLOG(LOG_DEBUG, TAG_VCC, "Service state changed callback is called"); //LCOV_EXCL_LINE + } else { + SLOG(LOG_WARN, TAG_VCC, "[WARNING] Service state changed callback is null"); //LCOV_EXCL_LINE + } - ret = vc_client_set_is_foreground(true); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to save is_foreground (true) : %d", ret); //LCOV_EXCL_LINE - } + /* Register focus handler */ + ecore_thread_main_loop_begin(); + g_focus_in_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_IN, __focus_changed_cb, NULL); + g_focus_out_handler = ecore_event_handler_add(ECORE_WL2_EVENT_FOCUS_OUT, __focus_changed_cb, NULL); + ecore_thread_main_loop_end(); - /* set authority valid */ - vc_auth_state_e state = VC_AUTH_STATE_NONE; - if (0 != vc_client_get_auth_state(&state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); //LCOV_EXCL_LINE - } - if (VC_AUTH_STATE_INVALID == state) { - vc_client_set_auth_state(VC_AUTH_STATE_VALID); + char appid[1024] = {'\0',}; + ret = aul_app_get_appid_bypid(getpid(), appid, sizeof(appid) - 1); + if (ret != AUL_R_OK) + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get aul_app_get_appid_bypid : %d", ret); - /* notify auth changed cb */ - ecore_idler_add(__notify_auth_changed_cb, NULL); - } + int status = aul_app_get_status(appid); + if (STATUS_FOCUS == status) { + SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set foreground"); //LCOV_EXCL_LINE + ret = vc_tidl_request_set_foreground(getpid(), true); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set foreground (true) : %d", ret); //LCOV_EXCL_LINE } - vc_client_set_client_state(VC_STATE_READY); - ecore_main_loop_thread_safe_call_async(__vc_notify_state_changed, NULL); + ret = vc_client_set_is_foreground(true); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to save is_foreground (true) : %d", ret); //LCOV_EXCL_LINE + } - vc_client_set_mgr_pid(mgr_pid); - } else { - SLOG(LOG_ERROR, TAG_VCC, "[Not ERROR] The current client is not valid. It is destroyed."); //LCOV_EXCL_LINE - return EINA_FALSE; + /* set authority valid */ + vc_auth_state_e state = VC_AUTH_STATE_NONE; + if (0 != vc_client_get_auth_state(&state)) { + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get auth state"); //LCOV_EXCL_LINE + } + if (VC_AUTH_STATE_INVALID == state) { + vc_client_set_auth_state(VC_AUTH_STATE_VALID); + + /* notify auth changed cb */ + ecore_idler_add(__notify_auth_changed_cb, NULL); + } } + + vc_client_set_client_state(VC_STATE_READY); + ecore_main_loop_thread_safe_call_async(__vc_notify_state_changed, NULL); + + vc_client_set_mgr_pid(mgr_pid); + /* TODO set_start_listening should be move to proper place */ vc_client_set_start_listening(true); @@ -657,15 +660,15 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) while (0 != ret) { pthread_mutex_lock(&g_prepare_thread_mutex); if (EINA_TRUE == ecore_thread_check(thread)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); pthread_mutex_unlock(&g_prepare_thread_mutex); return; } if (retry_count == VC_TIDL_RETRY_COUNT) { // 200 ms * 20 = 4 sec SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE - pthread_mutex_unlock(&g_prepare_thread_mutex); - return; + pthread_mutex_unlock(&g_prepare_thread_mutex); //LCOV_EXCL_LINE + return; //LCOV_EXCL_LINE } ret = vc_tidl_request_hello(); @@ -685,17 +688,17 @@ static void __start_prepare_thread(void *data, Ecore_Thread *thread) pthread_mutex_lock(&g_prepare_thread_mutex); if (EINA_TRUE == ecore_thread_check(thread)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request hello !!"); //LCOV_EXCL_LINE - pthread_mutex_unlock(&g_prepare_thread_mutex); - return; + pthread_mutex_unlock(&g_prepare_thread_mutex); //LCOV_EXCL_LINE + return; //LCOV_EXCL_LINE } if (retry_count == 10) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to connect daemon !!"); //LCOV_EXCL_LINE - pthread_mutex_unlock(&g_prepare_thread_mutex); - return; + pthread_mutex_unlock(&g_prepare_thread_mutex); //LCOV_EXCL_LINE + return; //LCOV_EXCL_LINE } - ret = __vc_connect_daemon(NULL); + ret = connect_service(NULL); pthread_mutex_unlock(&g_prepare_thread_mutex); if (ret == 0) break; @@ -773,7 +776,7 @@ int vc_prepare_sync(void) } cnt = 0; - while (EINA_TRUE == __vc_connect_daemon(NULL) && VC_CONNECTION_RETRY_COUNT > cnt) { + while (EINA_TRUE == connect_service(NULL) && VC_CONNECTION_RETRY_COUNT > cnt) { cnt++; } @@ -829,7 +832,7 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user ret = vc_config_mgr_get_language_list(callback, user_data); if (0 != ret) { - ret = vc_config_convert_error_code((vc_config_error_e)ret); + ret = vc_config_convert_error_code((vc_config_error_e)ret); //LCOV_EXCL_LINE SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get languages : %s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE } @@ -854,12 +857,11 @@ int vc_get_current_language(char** language) return VC_ERROR_INVALID_STATE; } - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get Current Language"); ret = vc_config_mgr_get_default_language(language); if (0 != ret) { - ret = vc_config_convert_error_code((vc_config_error_e)ret); + ret = vc_config_convert_error_code((vc_config_error_e)ret); //LCOV_EXCL_LINE SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current languages : %s", __vc_get_error_code(ret)); //LCOV_EXCL_LINE } @@ -888,9 +890,9 @@ int vc_get_state(vc_state_e* state) case VC_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_DEBUG, TAG_VCC, "Current state is 'Ready'"); break; - default: - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state. Return state as 'None'."); - temp = VC_STATE_NONE; + default: //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state. Return state as 'None'."); //LCOV_EXCL_LINE + temp = VC_STATE_NONE; //LCOV_EXCL_LINE } *state = temp; @@ -920,7 +922,7 @@ int vc_get_service_state(vc_service_state_e* state) vc_service_state_e service_state; if (0 != vc_client_get_service_state(&service_state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get service state"); //LCOV_EXCL_LINE - return VC_ERROR_OPERATION_FAILED; + return VC_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get Service State"); @@ -928,11 +930,11 @@ int vc_get_service_state(vc_service_state_e* state) *state = service_state; switch (*state) { - case VC_SERVICE_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'None'"); break; + case VC_SERVICE_STATE_NONE: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'None'"); break; //LCOV_EXCL_LINE case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCC, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); + default: SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid state"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get Service State DONE"); @@ -1001,7 +1003,7 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) ret = vc_client_get_mgr_pid(&mgr_pid); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get the manager pid"); //LCOV_EXCL_LINE - return VC_ERROR_OPERATION_FAILED; + return VC_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE } if (true == is_sys_cmd_valid) { @@ -1009,26 +1011,26 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) ret = vc_cmd_list_create((vc_cmd_list_h*)&list); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create command list"); //LCOV_EXCL_LINE - return ret; + return ret; //LCOV_EXCL_LINE } ret = vc_cmd_parser_get_commands(mgr_pid, VC_COMMAND_TYPE_SYSTEM, &(list->list)); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get parsing commands"); //LCOV_EXCL_LINE - vc_cmd_list_destroy((vc_cmd_list_h)list, true); - return ret; + vc_cmd_list_destroy((vc_cmd_list_h)list, true); //LCOV_EXCL_LINE + return ret; //LCOV_EXCL_LINE } ret = vc_cmd_parser_get_commands(mgr_pid, VC_COMMAND_TYPE_SYSTEM_BACKGROUND, &(list->list)); if (0 != ret) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get parsing commands"); //LCOV_EXCL_LINE - vc_cmd_list_destroy((vc_cmd_list_h)list, true); - return ret; + vc_cmd_list_destroy((vc_cmd_list_h)list, true); //LCOV_EXCL_LINE + return ret; //LCOV_EXCL_LINE } *vc_sys_cmd_list = (vc_cmd_list_h)list; } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] No system commands"); //LCOV_EXCL_LINE + SLOG(LOG_WARN, TAG_VCC, "[WARNING] No system commands"); return VC_ERROR_NONE; } @@ -1107,7 +1109,7 @@ static int __vc_get_invocation_name(char** invocation_name) ret = app_manager_get_app_id(getpid(), &appid); if (0 != ret || NULL == appid) { //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get appid, ret(%d)", ret); //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get appid, ret(%d)", ret); FREE(appid); return VC_ERROR_OPERATION_FAILED; //LCOV_EXCL_STOP @@ -1115,16 +1117,18 @@ static int __vc_get_invocation_name(char** invocation_name) ret = vc_get_current_language(&lang); if (0 != ret || NULL == lang) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current language, ret(%d)", ret); //LCOV_EXCL_LINE + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get current language, ret(%d)", ret); FREE(appid); FREE(lang); return VC_ERROR_OPERATION_FAILED; + //LCOV_EXCL_STOP } ret = app_info_get_localed_label(appid, lang, &temp_label); if (0 != ret || NULL == temp_label) { //LCOV_EXCL_START - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get localed label, ret(%d) appid(%s) lang(%s)", ret, appid, lang); //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get localed label, ret(%d) appid(%s) lang(%s)", ret, appid, lang); FREE(appid); FREE(lang); FREE(temp_label); @@ -1134,11 +1138,13 @@ static int __vc_get_invocation_name(char** invocation_name) *invocation_name = strdup(temp_label); if (NULL == *invocation_name) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); //LCOV_EXCL_LINE + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to allocate memory"); FREE(appid); FREE(lang); FREE(temp_label); return VC_ERROR_OUT_OF_MEMORY; + //LCOV_EXCL_STOP } FREE(appid); @@ -1180,8 +1186,6 @@ void __set_command(vc_cmd_type_e type) //LCOV_EXCL_STOP } } while (0 != ret); - - return; } int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) @@ -1207,7 +1211,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) /* check type */ if ((VC_COMMAND_TYPE_FOREGROUND != type) && (VC_COMMAND_TYPE_BACKGROUND != type)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid command type: input type is %d", type); //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid command type: input type is %d", type); return VC_ERROR_INVALID_PARAMETER; } @@ -1221,7 +1225,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type) ret = __vc_get_invocation_name(&invocation_name); if (0 != ret || NULL == invocation_name) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get invocation name, ret(%d)", ret); //LCOV_EXCL_LINE - return ret; + return ret;//LCOV_EXCL_LINE } } @@ -1302,7 +1306,7 @@ int vc_unset_command_list(int type) ret = vc_cmd_parser_delete_file(getpid(), (vc_cmd_type_e)type); if (0 != ret) { - ret = vc_config_convert_error_code((vc_config_error_e)ret); + ret = vc_config_convert_error_code((vc_config_error_e)ret); //LCOV_EXCL_LINE SLOG(LOG_ERROR, TAG_VCC, "[ERROR] cmd_type(%d), Fail to delete command list : %s", type, __vc_get_error_code(ret)); //LCOV_EXCL_LINE } @@ -1366,263 +1370,6 @@ int vc_set_command_list_from_file(const char* file_path, int type) return ret; } -#if 0 -int vc_get_exclusive_command_option(bool* value) -{ - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get exclusive command"); - - vc_state_e state; - if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - int ret = vc_client_get_exclusive_cmd(g_vc, value); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set exclusive option : %d", ret); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return ret; - } - - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - - return ret; -} - -int vc_set_exclusive_command_option(bool value) -{ - if (0 != __vc_get_feature_enabled()) { - return VC_ERROR_NOT_SUPPORTED; - } - if (0 != __vc_check_privilege()) { - return VC_ERROR_PERMISSION_DENIED; - } - - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Set exclusive command"); - - vc_state_e state; - if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - int ret = vc_client_set_exclusive_cmd(g_vc, value); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to set exclusive option : %d", ret); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return ret; - } - - int count = 0; - do { - ret = vc_dbus_request_set_exclusive_command(g_vc->handle, value); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request set exclusive command to daemon : %s", __vc_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] retry request set exclusive command : %s", __vc_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request"); - break; - } - } - } - } while (0 != ret); - - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - - return ret; -} -#endif - -#if 0 -int vc_request_start(bool stop_by_silence) -{ - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Request start"); - - vc_state_e state; - if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: client state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* Check service state */ - vc_service_state_e service_state = -1; - vc_client_get_service_state(g_vc, &service_state); - if (service_state != VC_SERVICE_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state is not 'READY'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - int ret; - int count = 0; - - /* Request */ - ret = -1; - count = 0; - while (0 != ret) { - ret = vc_dbus_request_start(g_vc->handle, stop_by_silence); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to start request start : %s", __vc_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] retry start request start : %s", __vc_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request"); - break; - } - } - } else { - SLOG(LOG_DEBUG, TAG_VCC, "[SUCCESS] start interrupt"); - } - } - - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - - return ret; -} - -int vc_request_stop(void) -{ - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Request stop"); - - vc_state_e state; - if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: client state is not 'Ready'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* Check service state */ - vc_service_state_e service_state = -1; - vc_client_get_service_state(g_vc, &service_state); - if (service_state != VC_SERVICE_STATE_RECORDING) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state is not 'RECORDING'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - int ret = -1; - int count = 0; - /* do request */ - while (0 != ret) { - ret = vc_dbus_request_stop(g_vc->handle); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_DEBUG, TAG_VCC, "[ERROR] Fail to stop request : %s", __vc_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] retry stop request : %s", __vc_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request"); - break; - } - } - } else { - SLOG(LOG_DEBUG, TAG_VCC, "[SUCCESS] Stop interrupt"); - } - } - - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - - return ret; -} - -int vc_request_cancel(void) -{ - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Request cancel Interrupt"); - - vc_state_e state; - if (0 != vc_client_get_client_state(g_vc, &state)) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not available"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* check state */ - if (state != VC_STATE_READY) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: Current state is not 'Ready'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - /* Check service state */ - vc_service_state_e service_state = -1; - vc_client_get_service_state(g_vc, &service_state); - if (service_state != VC_SERVICE_STATE_RECORDING && service_state != VC_SERVICE_STATE_PROCESSING) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Invalid State: service state is not 'RECORDING' or 'PROCESSING'"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - return VC_ERROR_INVALID_STATE; - } - - int ret = -1; - int count = 0; - while (0 != ret) { - ret = vc_dbus_request_cancel(g_vc->handle); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_DEBUG, TAG_VCC, "[ERROR] Fail to cancel request : %s", __vc_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCC, "[WARNING] retry cancel request : %s", __vc_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to request"); - break; - } - } - } else { - SLOG(LOG_DEBUG, TAG_VCC, "[SUCCESS] Cancel interrupt"); - } - } - - SLOG(LOG_DEBUG, TAG_VCC, "@@@"); - - return ret; -} -#endif - static void __vc_notify_error(void *data) { vc_error_cb callback = NULL; @@ -1728,8 +1475,6 @@ static Eina_Bool __vc_notify_result(void *data) void __vc_cb_result(void) { ecore_timer_add(0, __vc_notify_result, NULL); - - return; } //LCOV_EXCL_STOP @@ -1751,7 +1496,6 @@ int vc_get_result(vc_result_cb callback, void* user_data) RETVM_IF(NULL == callback, VC_ERROR_INVALID_PARAMETER, TAG_VCC, "[ERROR] Client result callback is NULL"); - SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get result"); char* temp_text = NULL; @@ -1760,15 +1504,16 @@ int vc_get_result(vc_result_cb callback, void* user_data) if (0 != vc_cmd_list_create(&vc_cmd_list)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to create command list"); //LCOV_EXCL_LINE - return VC_ERROR_INVALID_PARAMETER; + return VC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE } ret = vc_info_parser_get_result(&temp_text, &event, NULL, getpid(), vc_cmd_list, false); if (0 != ret || NULL == temp_text) { - SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get result, ret(%d) temp_text(%s)", ret, temp_text); //LCOV_EXCL_LINE + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] Fail to get result, ret(%d) temp_text(%s)", ret, temp_text); return ret; } + //LCOV_EXCL_START SLOG(LOG_DEBUG, TAG_VCC, "Result info : result text(%s) event(%d)", temp_text, event); //LCOV_EXCL_LINE vc_cmd_print_list(vc_cmd_list); @@ -1786,6 +1531,7 @@ int vc_get_result(vc_result_cb callback, void* user_data) SLOG(LOG_DEBUG, TAG_VCC, "@@@ [Client] Get result DONE"); return VC_ERROR_NONE; + //LCOV_EXCL_STOP } int vc_set_result_cb(vc_result_cb callback, void* user_data) @@ -1866,7 +1612,7 @@ int __vc_cb_service_state(int state) int __vc_cb_manager_pid(int manager_pid) { - SLOG(LOG_DEBUG, TAG_VCC, "Manager pid is changed : %d", manager_pid); //LCOV_EXCL_LINE + SLOG(LOG_DEBUG, TAG_VCC, "Manager pid is changed : %d", manager_pid); /* Save service state */ vc_client_set_mgr_pid(manager_pid); @@ -2057,13 +1803,12 @@ int vc_set_invocation_name(const char* name) if (VC_ERROR_NONE != ret) return ret; - vc_state_e state; SLOG(LOG_DEBUG, TAG_VCC, "@@@ Set invocation name"); - ret = vc_client_get_client_state(&state); - if (0 != ret) { + vc_state_e state; + if (0 != vc_client_get_client_state(&state)) { SLOG(LOG_ERROR, TAG_VCC, "[ERROR] A handle is not valid"); - return ret; + return VC_ERROR_INVALID_STATE; } /* check state */ @@ -2751,6 +2496,7 @@ int __vc_cb_tts_streaming(int utt_id, vc_tts_event_e event, char* buffer, int le return ret; } +//LCOV_EXCL_STOP int vc_tts_request(const char* text, const char* language, bool to_vc_manager, int* utt_id) { @@ -2785,6 +2531,7 @@ int vc_tts_request(const char* text, const char* language, bool to_vc_manager, i do { ret = vc_tidl_request_request_tts(pid, text, language, to_vc_manager, utt_id); if (0 != ret) { + //LCOV_EXCL_START if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { vc_client_set_client_state(VC_STATE_INITIALIZED); if (0 == vc_prepare_sync()) { @@ -2803,6 +2550,7 @@ int vc_tts_request(const char* text, const char* language, bool to_vc_manager, i break; } } + //LCOV_EXCL_STOP } } while (0 != ret); @@ -2849,6 +2597,7 @@ int vc_tts_cancel(int utt_id) do { ret = vc_tidl_request_cancel_tts(pid, utt_id); if (0 != ret) { + //LCOV_EXCL_START if (VC_ERROR_INVALID_PARAMETER == ret && false == is_prepared) { vc_client_set_client_state(VC_STATE_INITIALIZED); if (0 == vc_prepare_sync()) { @@ -2867,6 +2616,7 @@ int vc_tts_cancel(int utt_id) break; } } + //LCOV_EXCL_STOP } } while (0 != ret); @@ -2875,6 +2625,7 @@ int vc_tts_cancel(int utt_id) return ret; } +//LCOV_EXCL_START int vc_tts_get_synthesized_audio_details(int* rate, vc_audio_channel_e* channel, vc_audio_type_e* audio_type) { vc_state_e state; diff --git a/client/vc_client.c b/client/vc_client.c index 5ae8f29..f01c5bd 100644 --- a/client/vc_client.c +++ b/client/vc_client.c @@ -145,10 +145,10 @@ int vc_client_destroy(void) /* wait for release callback function */ usleep(10000); } - if (NULL != g_client->invocation_name) { - free(g_client->invocation_name); - g_client->invocation_name = NULL; - } + + free(g_client->invocation_name); + g_client->invocation_name = NULL; + free(g_client); g_client = NULL; @@ -253,7 +253,6 @@ int vc_client_set_current_lang_changed_cb(vc_current_language_changed_cb callbac return VC_ERROR_NONE; } -//LCOV_EXCL_START int vc_client_get_current_lang_changed_cb(vc_current_language_changed_cb* callback, void** user_data) { /* check handle */ @@ -265,7 +264,6 @@ int vc_client_get_current_lang_changed_cb(vc_current_language_changed_cb* callba return VC_ERROR_NONE; } -//LCOV_EXCL_STOP int vc_client_set_error_cb(vc_error_cb callback, void* user_data) { @@ -398,34 +396,6 @@ int vc_client_get_is_foreground(bool* value) return VC_ERROR_NONE; } - -#if 0 -int vc_client_set_exclusive_cmd(vc_h vc, bool value) -{ - vc_client_s* client = __client_get(vc); - - /* check handle */ - if (NULL == client) - return VC_ERROR_INVALID_PARAMETER; - - client->exclusive_cmd = value; - - return VC_ERROR_NONE; -} - -int vc_client_get_exclusive_cmd(vc_h vc, bool* value) -{ - vc_client_s* client = __client_get(vc); - - /* check handle */ - if (NULL == client) - return VC_ERROR_INVALID_PARAMETER; - - *value = client->exclusive_cmd; - - return VC_ERROR_NONE; -} -#endif //LCOV_EXCL_STOP int vc_client_set_error(int reason) @@ -450,7 +420,6 @@ int vc_client_get_error(int* reason) return VC_ERROR_NONE; } - /* utils */ int vc_client_use_callback(void) { diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 2fc2d44..73d5c6b 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -65,6 +65,7 @@ static pthread_mutex_t g_vc_tts_streaming_cb_mutex = PTHREAD_MUTEX_INITIALIZER; static Eina_Bool __vc_mgr_notify_state_changed(void *data); +//LCOV_EXCL_START static const char* __vc_mgr_get_error_code(vc_error_e err) { switch (err) { @@ -82,6 +83,7 @@ static const char* __vc_mgr_get_error_code(vc_error_e err) } return NULL; } +//LCOV_EXCL_STOP static void __vc_mgr_lang_changed_cb(const char* previous_lang, const char* current_lang) { @@ -100,29 +102,41 @@ static void __vc_mgr_lang_changed_cb(const char* previous_lang, const char* curr } else { SLOG(LOG_WARN, TAG_VCM, "[WARNING] Language changed callback is null"); } - - return; } static int __vc_mgr_get_feature_enabled() { if (0 == g_feature_enabled) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Voice control feature NOT supported"); return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } else if (-1 == g_feature_enabled) { - bool vc_supported = false; + bool vc_mgr_supported = false; bool mic_supported = false; - if (0 == system_info_get_platform_bool(VC_MGR_FEATURE_PATH, &vc_supported)) { - if (0 == system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { - if (false == vc_supported || false == mic_supported) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Voice control feature NOT supported"); - g_feature_enabled = 0; - return VC_ERROR_NOT_SUPPORTED; - } + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool(VC_MGR_FEATURE_PATH, &vc_mgr_supported)) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get feature value"); + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP + } - g_feature_enabled = 1; - } + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get feature value"); + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP + } + + if (false == vc_mgr_supported || false == mic_supported) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Voice control feature NOT supported"); + g_feature_enabled = 0; + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } + + g_feature_enabled = 1; } return VC_ERROR_NONE; @@ -132,7 +146,7 @@ static int __check_privilege_initialize() { int ret = cynara_initialize(&p_cynara, NULL); if (NULL == p_cynara || CYNARA_API_SUCCESS != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] fail to initialize(%d)", ret); + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] fail to initialize(%d)", ret); //LCOV_EXCL_LINE return ret; } @@ -161,8 +175,7 @@ static int __check_privilege(const char* uid, const char * privilege) pid_t pid = getpid(); char *session = cynara_session_from_pid(pid); int ret = cynara_check(p_cynara, smack_label, session, uid, privilege); - if (session) - free(session); + free(session); session = NULL; if (ret != CYNARA_API_ACCESS_ALLOWED) { @@ -194,10 +207,12 @@ static int __vc_mgr_check_privilege() bool ret = true; ret = __check_privilege_initialize(); if (false == ret) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCM, "[ERROR] privilege initialize is failed"); g_privilege_allowed = false; pthread_mutex_unlock(&g_cynara_mutex); return VC_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP } char uid[32]; @@ -205,20 +220,24 @@ static int __vc_mgr_check_privilege() ret = true; ret = __check_privilege(uid, VC_PRIVILEGE_RECORDER); if (false == ret) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE_RECORDER, uid); __check_privilege_deinitialize(); g_privilege_allowed = false; pthread_mutex_unlock(&g_cynara_mutex); return VC_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP } ret = __check_privilege(uid, VC_MGR_PRIVILEGE); if (false == ret) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Permission is denied(%s)(%s)", VC_MGR_PRIVILEGE, uid); __check_privilege_deinitialize(); g_privilege_allowed = false; pthread_mutex_unlock(&g_cynara_mutex); return VC_ERROR_PERMISSION_DENIED; + //LCOV_EXCL_STOP } __check_privilege_deinitialize(); @@ -312,7 +331,6 @@ static void __vc_mgr_internal_unprepare() } vc_mgr_client_set_internal_state(VC_INTERNAL_STATE_NONE); - return; } int vc_mgr_deinitialize(void) @@ -388,10 +406,12 @@ int vc_mgr_deinitialize(void) return VC_ERROR_NONE; } +//LCOV_EXCL_START static void __notify_error(void *data) { vc_mgr_core_notify_error(); } +//LCOV_EXCL_STOP static Eina_Bool __request_initialize(void *data) { @@ -418,6 +438,7 @@ static Eina_Bool __request_initialize(void *data) ret = vc_mgr_tidl_request_initialize(g_pid, (int)streaming_mode, &service_state, &foreground, &g_daemon_pid); if (VC_ERROR_ENGINE_NOT_FOUND == ret) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to initialize : %s", __vc_mgr_get_error_code(ret)); vc_mgr_client_set_error(VC_ERROR_ENGINE_NOT_FOUND); @@ -426,6 +447,7 @@ static Eina_Bool __request_initialize(void *data) SLOG(LOG_DEBUG, TAG_VCM, "@@@"); g_request_init_timer = NULL; return EINA_FALSE; + //LCOV_EXCL_STOP } else if (0 != ret) { SLOG(LOG_ERROR, TAG_VCM, "[WARNING] Fail to connection. Retry to connect : %s", __vc_mgr_get_error_code(ret)); @@ -661,7 +683,7 @@ int vc_mgr_get_state(vc_state_e* state) case VC_STATE_NONE: SLOG(LOG_INFO, TAG_VCM, "Current state is 'None'"); break; case VC_STATE_INITIALIZED: SLOG(LOG_INFO, TAG_VCM, "Current state is 'Created'"); break; case VC_STATE_READY: SLOG(LOG_INFO, TAG_VCM, "Current state is 'Ready'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] Get State DONE"); @@ -703,7 +725,7 @@ int vc_mgr_get_service_state(vc_service_state_e* state) case VC_SERVICE_STATE_READY: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Ready'"); break; case VC_SERVICE_STATE_RECORDING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Recording'"); break; case VC_SERVICE_STATE_PROCESSING: SLOG(LOG_DEBUG, TAG_VCM, "Current service state is 'Processing'"); break; - default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); + default: SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid state"); //LCOV_EXCL_LINE } SLOG(LOG_DEBUG, TAG_VCM, "@@@ [Manager] Get Service State DONE"); @@ -1195,7 +1217,7 @@ int vc_mgr_get_current_commands(vc_cmd_list_h* vc_cmd_list) vc_cmd_list_h temp_list = NULL; if (0 != vc_cmd_list_create(&temp_list)) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to create list"); - return VC_ERROR_INVALID_PARAMETER; + return VC_ERROR_OUT_OF_MEMORY; } *vc_cmd_list = temp_list; @@ -1242,6 +1264,7 @@ int vc_mgr_get_current_commands(vc_cmd_list_h* vc_cmd_list) return VC_ERROR_NONE; } + //LCOV_EXCL_START if (VC_NO_FOREGROUND_PID != fg_pid) { iter = g_slist_nth(client_info_list, 0); while (NULL != iter) { @@ -1289,9 +1312,7 @@ int vc_mgr_get_current_commands(vc_cmd_list_h* vc_cmd_list) while (NULL != iter) { client_info = iter->data; - if (NULL != client_info) { - free(client_info); - } + free(client_info); client_info_list = g_slist_remove_link(client_info_list, iter); iter = g_slist_nth(client_info_list, 0); } @@ -1334,6 +1355,7 @@ int vc_mgr_get_current_commands(vc_cmd_list_h* vc_cmd_list) // TODO: check return value correct or not return VC_ERROR_NONE; + //LCOV_EXCL_STOP } int vc_mgr_set_recognition_mode(vc_recognition_mode_e mode) @@ -1697,10 +1719,7 @@ int vc_mgr_stop(void) /* Check internal state for async */ vc_internal_state_e internal_state = -1; vc_mgr_client_get_internal_state(&internal_state); - if (VC_INTERNAL_STATE_STARTING == internal_state) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State : Internal state is STARTING"); - return VC_ERROR_IN_PROGRESS_TO_RECORDING; - } else if (VC_INTERNAL_STATE_STOPPING == internal_state) { + if (VC_INTERNAL_STATE_STOPPING == internal_state) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State : Internal state is STOPPING"); return VC_ERROR_IN_PROGRESS_TO_PROCESSING; } else if (VC_INTERNAL_STATE_CANCELING == internal_state) { @@ -2612,6 +2631,7 @@ int vc_mgr_unset_vc_tts_streaming_cb() return VC_ERROR_NONE; } +//LCOV_EXCL_START static void __tts_feedback_thread(void* data, Ecore_Thread* thread) { SLOG(LOG_INFO, TAG_VCM, "[SUCCESS] Start thread"); @@ -2714,6 +2734,7 @@ static void __cancel_tts_feedback_thread(void* data, Ecore_Thread* thread) SLOG(LOG_INFO, TAG_VCM, "[SUCCESS] Cancel thread"); g_feedback_thread = NULL; } +//LCOV_EXCL_STOP int vc_mgr_start_feedback(void) { @@ -2970,6 +2991,7 @@ int vc_mgr_set_audio_streaming_mode(vc_audio_streaming_mode_e mode) return VC_ERROR_NONE; } +//LCOV_EXCL_START //TODO it's internal api, so will remove it. int vc_mgr_change_system_volume(vc_system_volume_event_e event) { @@ -2981,6 +3003,7 @@ int vc_mgr_recover_system_volume(void) { return vc_mgr_reset_background_volume(); } +//LCOV_EXCL_STOP int vc_mgr_change_background_volume(vc_background_volume_event_e event) { @@ -3003,11 +3026,6 @@ int vc_mgr_change_background_volume(vc_background_volume_event_e event) return VC_ERROR_INVALID_STATE; } - if (state != VC_STATE_READY && state != VC_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY' and not 'INITIALIZED', state(%d)", state); - return VC_ERROR_INVALID_STATE; - } - double ratio = 0.0; if (VC_BACKGROUND_VOLUME_EVENT_CHANGE_FOR_FARFIELD == event) ratio = VC_MGR_DEFAULT_FARFIELD_DUCKING_RATIO; @@ -3043,11 +3061,6 @@ int vc_mgr_change_background_volume_by_ratio(double ratio) return VC_ERROR_INVALID_STATE; } - if (state != VC_STATE_READY && state != VC_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY' and not 'INITIALIZED', state(%d)", state); - return VC_ERROR_INVALID_STATE; - } - ret = vc_mgr_ducking_activate(ratio); if (VC_ERROR_NONE != ret) SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to set ratio"); @@ -3073,11 +3086,6 @@ int vc_mgr_reset_background_volume(void) return VC_ERROR_INVALID_STATE; } - if (state != VC_STATE_READY && state != VC_STATE_INITIALIZED) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Invalid State: Current state is not 'READY' and not 'INITIALIZED', state(%d)", state); - return VC_ERROR_INVALID_STATE; - } - ret = vc_mgr_ducking_deactivate(); if (VC_ERROR_NONE != ret) SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to recover volume"); diff --git a/client/vc_mgr_client.c b/client/vc_mgr_client.c index e590383..9739040 100644 --- a/client/vc_mgr_client.c +++ b/client/vc_mgr_client.c @@ -215,17 +215,14 @@ int vc_mgr_client_destroy() usleep(10000); } - if (NULL != g_mgr_client->audio_id) { - free(g_mgr_client->audio_id); - } + free(g_mgr_client->audio_id); + g_mgr_client->audio_id = NULL; - if (NULL != g_mgr_client->all_result_text) { - free(g_mgr_client->all_result_text); - } + free(g_mgr_client->all_result_text); + g_mgr_client->all_result_text = NULL; - if (NULL != g_mgr_client->err_msg) { - free(g_mgr_client->err_msg); - } + free(g_mgr_client->err_msg); + g_mgr_client->err_msg = NULL; free(g_mgr_client); g_mgr_client = NULL; @@ -317,6 +314,7 @@ int vc_mgr_client_set_pre_result_cb(vc_mgr_pre_result_cb callback, void* user_da return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_pre_result_cb(vc_mgr_pre_result_cb* callback, void** user_data) { /* check handle */ @@ -328,6 +326,7 @@ int vc_mgr_client_get_pre_result_cb(vc_mgr_pre_result_cb* callback, void** user_ return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_mgr_client_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* user_data) { @@ -461,6 +460,7 @@ int vc_mgr_client_set_dialog_request_cb(vc_mgr_dialog_request_cb callback, void* return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_dialog_request_cb(vc_mgr_dialog_request_cb* callback, void** user_data) { /* check handle */ @@ -472,7 +472,7 @@ int vc_mgr_client_get_dialog_request_cb(vc_mgr_dialog_request_cb* callback, void return VC_ERROR_NONE; } - +//LCOV_EXCL_STOP int vc_mgr_client_set_private_data_set_cb(vc_mgr_private_data_set_cb callback, void* user_data) { @@ -486,6 +486,7 @@ int vc_mgr_client_set_private_data_set_cb(vc_mgr_private_data_set_cb callback, v return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_private_data_set_cb(vc_mgr_private_data_set_cb* callback, void** user_data) { /* check handle */ @@ -497,6 +498,7 @@ int vc_mgr_client_get_private_data_set_cb(vc_mgr_private_data_set_cb* callback, return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_mgr_client_set_private_data_requested_cb(vc_mgr_private_data_requested_cb callback, void* user_data) { @@ -510,6 +512,7 @@ int vc_mgr_client_set_private_data_requested_cb(vc_mgr_private_data_requested_cb return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_private_data_requested_cb(vc_mgr_private_data_requested_cb* callback, void** user_data) { /* check handle */ @@ -521,6 +524,7 @@ int vc_mgr_client_get_private_data_requested_cb(vc_mgr_private_data_requested_cb return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_mgr_client_set_feedback_audio_format_cb(vc_mgr_feedback_audio_format_cb callback, void* user_data) { @@ -534,6 +538,7 @@ int vc_mgr_client_set_feedback_audio_format_cb(vc_mgr_feedback_audio_format_cb c return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_feedback_audio_format_cb(vc_mgr_feedback_audio_format_cb* callback, void** user_data) { /* check handle */ @@ -545,6 +550,7 @@ int vc_mgr_client_get_feedback_audio_format_cb(vc_mgr_feedback_audio_format_cb* return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_mgr_client_set_feedback_streaming_cb(vc_mgr_feedback_streaming_cb callback, void* user_data) { @@ -558,6 +564,7 @@ int vc_mgr_client_set_feedback_streaming_cb(vc_mgr_feedback_streaming_cb callbac return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_feedback_streaming_cb(vc_mgr_feedback_streaming_cb* callback, void** user_data) { /* check handle */ @@ -569,6 +576,7 @@ int vc_mgr_client_get_feedback_streaming_cb(vc_mgr_feedback_streaming_cb* callba return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_mgr_client_set_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb callback, void* user_data) { @@ -582,6 +590,7 @@ int vc_mgr_client_set_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb callback, v return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb* callback, void** user_data) { /* check handle */ @@ -593,6 +602,7 @@ int vc_mgr_client_get_vc_tts_streaming_cb(vc_mgr_vc_tts_streaming_cb* callback, return VC_ERROR_NONE; } +//LCOV_EXCL_STOP /* set/get option */ int vc_mgr_client_set_service_state(vc_service_state_e state) @@ -702,10 +712,8 @@ int vc_mgr_client_set_error_message(const char* err_msg) if (NULL == g_mgr_client) return VC_ERROR_OPERATION_FAILED; - if (NULL != g_mgr_client->err_msg) { - free(g_mgr_client->err_msg); - g_mgr_client->err_msg = NULL; - } + free(g_mgr_client->err_msg); + g_mgr_client->err_msg = NULL; if (NULL != err_msg) { g_mgr_client->err_msg = strdup(err_msg); @@ -800,10 +808,9 @@ int vc_mgr_client_set_all_result(int event, const char* result_text) g_mgr_client->all_result_event = event; - if (NULL != g_mgr_client->all_result_text) { - free(g_mgr_client->all_result_text); - g_mgr_client->all_result_text = NULL; - } + free(g_mgr_client->all_result_text); + g_mgr_client->all_result_text = NULL; + if (NULL != result_text) { g_mgr_client->all_result_text = strdup(result_text); } @@ -835,10 +842,8 @@ int vc_mgr_client_unset_all_result() g_mgr_client->all_result_event = -1; - if (NULL != g_mgr_client->all_result_text) { - free(g_mgr_client->all_result_text); - g_mgr_client->all_result_text = NULL; - } + free(g_mgr_client->all_result_text); + g_mgr_client->all_result_text = NULL; return VC_ERROR_NONE; } @@ -850,10 +855,7 @@ int vc_mgr_client_set_audio_type(const char* audio_id) return VC_ERROR_OPERATION_FAILED; if (NULL != audio_id) { - if (NULL != g_mgr_client->audio_id) { - free(g_mgr_client->audio_id); - g_mgr_client->audio_id = NULL; - } + free(g_mgr_client->audio_id); g_mgr_client->audio_id = strdup(audio_id); } @@ -951,6 +953,7 @@ int vc_mgr_client_not_use_callback() return VC_ERROR_NONE; } +//LCOV_EXCL_START /* Authority */ int vc_mgr_client_add_authorized_client(int pid) { @@ -1078,6 +1081,7 @@ int vc_mgr_client_set_start_by_client(bool option) return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_mgr_client_get_start_by_client(bool* option) { @@ -1102,6 +1106,7 @@ int vc_mgr_client_set_specific_engine_result_cb(vc_mgr_specific_engine_result_cb return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_client_get_specific_engine_result_cb(vc_mgr_specific_engine_result_cb* callback, void** user_data) { /* check handle */ @@ -1113,6 +1118,7 @@ int vc_mgr_client_get_specific_engine_result_cb(vc_mgr_specific_engine_result_cb return VC_ERROR_NONE; } +//LCOV_EXCL_STOP int vc_mgr_client_set_audio_streaming_mode(vc_audio_streaming_mode_e streaming_mode) { diff --git a/client/vc_mgr_core.c b/client/vc_mgr_core.c index 3fe5d06..e016ef1 100644 --- a/client/vc_mgr_core.c +++ b/client/vc_mgr_core.c @@ -69,12 +69,14 @@ static Eina_Bool __vc_mgr_core_set_volume_timer_cb(void* data) return EINA_TRUE; } +//LCOV_EXCL_START static Eina_Bool __vc_mgr_core_set_select_result(void *data) { // TODO: remove vc_mgr dependency by separate vc_mgr_set_selected_results core logic to core layer vc_mgr_set_selected_results(NULL); return EINA_FALSE; } +//LCOV_EXCL_STOP static void __vc_mgr_core_notify_all_result(vc_result_type_e result_type) { @@ -110,6 +112,7 @@ static void __vc_mgr_core_notify_all_result(vc_result_type_e result_type) vc_mgr_client_not_use_callback(); if (true == vc_mgr_client_get_exclusive_command()) { + //LCOV_EXCL_START /* exclusive */ vc_result_cb callback = NULL; void* user_data = NULL; @@ -123,14 +126,11 @@ static void __vc_mgr_core_notify_all_result(vc_result_type_e result_type) SLOG(LOG_DEBUG, TAG_VCM, "Exclusive result callback called"); /* Release result */ - if (NULL != temp_text) { - free(temp_text); - temp_text = NULL; - } - if (NULL != temp_message) { - free(temp_message); - temp_message = NULL; - } + free(temp_text); + temp_text = NULL; + + free(temp_message); + temp_message = NULL; /* Release list */ if (vc_cmd_list) @@ -140,6 +140,7 @@ static void __vc_mgr_core_notify_all_result(vc_result_type_e result_type) vc_mgr_client_set_exclusive_command(false); return; + //LCOV_EXCL_STOP } int count = 0; @@ -162,21 +163,16 @@ static void __vc_mgr_core_notify_all_result(vc_result_type_e result_type) } /* Release result */ - if (NULL != temp_text) { - free(temp_text); - temp_text = NULL; - } - if (NULL != temp_message) { - free(temp_message); - temp_message = NULL; - } + free(temp_text); + temp_text = NULL; + + free(temp_message); + temp_message = NULL; /* Release list */ if (vc_cmd_list) vc_cmd_list_destroy(vc_cmd_list, true); vc_cmd_list = NULL; - - return; } static void __vc_mgr_core_notify_result() @@ -212,8 +208,7 @@ static void __vc_mgr_core_notify_result() vc_cmd_list = NULL; /* Release result */ - if (temp_text) - free(temp_text); + free(temp_text); temp_text = NULL; } @@ -224,10 +219,9 @@ void vc_mgr_core_send_all_result(vc_result_type_e type) } else { __vc_mgr_core_notify_result(); } - - return; } +//LCOV_EXCL_START void vc_mgr_core_send_pre_result(vc_pre_result_event_e event, const char* pre_result) { vc_mgr_pre_result_cb callback = NULL; @@ -240,14 +234,12 @@ void vc_mgr_core_send_pre_result(vc_pre_result_event_e event, const char* pre_re callback(event, pre_result, user_data); vc_mgr_client_not_use_callback(); SLOG(LOG_INFO, TAG_VCM, "Pre result callback is called"); - - return; } +//LCOV_EXCL_STOP void vc_mgr_core_send_system_result() { __vc_mgr_core_notify_result(); - return; } void vc_mgr_core_send_speech_detected() @@ -262,9 +254,6 @@ void vc_mgr_core_send_speech_detected() callback(user_data); vc_mgr_client_not_use_callback(); SLOG(LOG_INFO, TAG_VCM, "Speech detected callback called"); - - - return; } void vc_mgr_core_notify_error() @@ -298,10 +287,8 @@ int vc_mgr_core_set_selected_results(vc_cmd_list_h vc_cmd_list, int pid) vc_info_parser_set_result(result_text, event, NULL, vc_cmd_list, false); - if (NULL != result_text) { - free(result_text); - result_text = NULL; - } + free(result_text); + result_text = NULL; } /* Request */ @@ -400,8 +387,6 @@ int vc_mgr_core_get_error_message(char** err_msg) return ret; } - - int vc_mgr_core_send_service_state(int state) { vc_service_state_e current_state = (vc_service_state_e)state; @@ -449,6 +434,7 @@ int vc_mgr_core_send_service_state(int state) return VC_ERROR_NONE; } +//LCOV_EXCL_START int vc_mgr_core_send_dialog(int pid, const char* disp_text, const char* utt_text, bool continuous) { vc_mgr_dialog_request_cb callback = NULL; @@ -520,9 +506,8 @@ void vc_mgr_core_send_specific_engine_result(const char* engine_app_id, const ch callback(engine_app_id, event, result, user_data); vc_mgr_client_not_use_callback(); SLOG(LOG_INFO, TAG_VCM, "Specific engine result callback is called, engine app id(%s), event(%s), result(%s)", engine_app_id, event, result); - - return; } +//LCOV_EXCL_STOP int vc_mgr_core_send_set_volume(float volume) { @@ -558,6 +543,7 @@ void vc_mgr_core_initialize_volume_variable() g_cur_volume_db = 0; } +//LCOV_EXCL_START int vc_mgr_core_send_set_foreground(int pid, bool value) { vc_mgr_client_set_foreground(pid, value); @@ -655,14 +641,11 @@ int vc_mgr_core_send_feedback_streaming(int pid, int utt_id, vc_feedback_event_e int ret = vc_mgr_data_add_feedback_data(temp_feedback_data); if (VC_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to add feedback data"); - if (NULL != temp_feedback_data->data) { - free(temp_feedback_data->data); - temp_feedback_data->data = NULL; - } - if (NULL != temp_feedback_data) { - free(temp_feedback_data); - temp_feedback_data = NULL; - } + free(temp_feedback_data->data); + temp_feedback_data->data = NULL; + + free(temp_feedback_data); + temp_feedback_data = NULL; } return ret; @@ -865,4 +848,5 @@ int vc_mgr_core_request_auth_cancel(int pid) ecore_timer_add(0, __request_auth_cancel, NULL); return VC_ERROR_NONE; -} \ No newline at end of file +} +//LCOV_EXCL_STOP diff --git a/common/vc_command.c b/common/vc_command.c index e6b5767..edff3b4 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -63,28 +63,36 @@ static int g_data_eidx; static int __vc_cmd_get_feature_enabled() { if (0 == g_feature_enabled) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Voice control feature NOT supported"); return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } else if (-1 == g_feature_enabled) { bool vc_supported = false; bool mic_supported = false; - if (0 == system_info_get_platform_bool(VC_FEATURE_PATH, &vc_supported)) { - if (0 == system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { - if (false == vc_supported || false == mic_supported) { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Voice control feature NOT supported"); - g_feature_enabled = 0; - return VC_ERROR_NOT_SUPPORTED; - } - - g_feature_enabled = 1; - } else { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get feature value"); - return VC_ERROR_NOT_SUPPORTED; - } - } else { + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool(VC_FEATURE_PATH, &vc_supported)) { + //LCOV_EXCL_START SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get feature value"); return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP } + + if (SYSTEM_INFO_ERROR_NONE != system_info_get_platform_bool(VC_MIC_FEATURE_PATH, &mic_supported)) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Fail to get feature value"); + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP + } + + if (false == vc_supported || false == mic_supported) { + //LCOV_EXCL_START + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Voice control feature NOT supported"); + g_feature_enabled = 0; + return VC_ERROR_NOT_SUPPORTED; + //LCOV_EXCL_STOP + } + + g_feature_enabled = 1; } return VC_ERROR_NONE; diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 115ab4e..ff9c2fb 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -160,20 +160,20 @@ rm -rf %{buildroot} builddir=$(basename $PWD) gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir" mkdir -p "$gcno_obj_dir" -find ./client/CMakeFiles/vc_* -name '*.gcno' -exec rm {} \; find ./server/ -name '*.gcno' -exec rm {} \; find ./audio-manager/ -name '*.gcno' -exec rm {} \; find ./tests/ -name '*.gcno' -exec rm {} \; find ./engine-parser/ -name '*.gcno' -exec rm {} \; -find . -name '*_dbus.c.gcno' -exec rm {} \; find . -name '*_cmd_db.c.gcno' -exec rm {} \; find . -name '*_config_*.gcno' -exec rm {} \; find . -name '*_parser.c.gcno' -exec rm {} \; -find . -name 'vc_mgr*.gcno' -exec rm {} \; find . -name 'vc_setting*.gcno' -exec rm {} \; find . -name 'vc_widget*.gcno' -exec rm {} \; -find . -name 'vc_proxy*.gcno' -exec rm {} \; +find . -name '*tidl*.gcno' -exec rm {} \; +find . -name '*proxy*.gcno' -exec rm {} \; +find . -name '*stub*.gcno' -exec rm {} \; find . -name 'vc_command_util*.gcno' -exec rm {} \; +find . -name 'VoiceControl*.gcno' -exec rm {} \; find . -name '*_data*.gcno' -exec rm {} \; find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';' %endif -- 2.7.4 From ed211d4d6269fe852e8b0d8e2de5aa0439f217eb Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 18 Jul 2023 17:54:13 +0900 Subject: [PATCH 10/16] Fix typo in function and variable names Change-Id: I7a1c67d688c0903064ccb539e72477a4205b9b04 Signed-off-by: Suyeon Hwang --- tests/src/vc_common_test_util.cpp | 8 ++++---- tests/src/vc_common_test_util.h | 2 +- tests/src/vc_mgr_test_util.cpp | 20 ++++++++++---------- tests/src/vc_mgr_test_util.h | 2 +- tests/src/vc_test_util.cpp | 16 ++++++++-------- tests/src/vc_test_util.h | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/src/vc_common_test_util.cpp b/tests/src/vc_common_test_util.cpp index a230eba..4ab7867 100644 --- a/tests/src/vc_common_test_util.cpp +++ b/tests/src/vc_common_test_util.cpp @@ -104,7 +104,7 @@ void VcCommonTestUtility::WaitUntilEngineTerminated(int duration) return !is_running; }; - WaitCondtion(engineChcker, duration); + WaitCondition(engineChcker, duration); } bool VcCommonTestUtility::IsVcFeatureSupported() @@ -161,7 +161,7 @@ void VcCommonTestUtility::EnableAutoLanguageSelection() vc_setting_deinitialize(); } -bool VcCommonTestUtility::WaitCondtion(std::function checker, int duration) +bool VcCommonTestUtility::WaitCondition(std::function checker, int duration) { auto mainLoopQuitTimer = ecore_timer_add(static_cast(duration), [](void *data) -> Eina_Bool { ecore_main_loop_quit(); @@ -169,8 +169,8 @@ bool VcCommonTestUtility::WaitCondtion(std::function checker, int du }, nullptr); auto checkerTimer = ecore_timer_add(0.0, [](void *data) -> Eina_Bool { - auto &checker = *reinterpret_cast *>(data); - if (false == checker()) { + auto &IsConditionSatisfied = *reinterpret_cast *>(data); + if (false == IsConditionSatisfied()) { return EINA_TRUE; } diff --git a/tests/src/vc_common_test_util.h b/tests/src/vc_common_test_util.h index c37c1ac..70fac59 100644 --- a/tests/src/vc_common_test_util.h +++ b/tests/src/vc_common_test_util.h @@ -39,7 +39,7 @@ public: static void SetCurrentLanguage(const char *language); static void EnableAutoLanguageSelection(); - static bool WaitCondtion(std::function checker, int duration); + static bool WaitCondition(std::function checker, int duration); }; diff --git a/tests/src/vc_mgr_test_util.cpp b/tests/src/vc_mgr_test_util.cpp index db17219..009f342 100644 --- a/tests/src/vc_mgr_test_util.cpp +++ b/tests/src/vc_mgr_test_util.cpp @@ -28,7 +28,7 @@ VcMgrTestUtility::VcMgrTestUtility() mCurrentServiceState = VC_SERVICE_STATE_NONE; mDefaultCommandList = nullptr; - mErrorOccured = false; + mErrorOccurred = false; mGetErrorMessageReturn = VC_ERROR_OPERATION_FAILED; mAllResultReceived = false; mSetSelectedResultReturn = VC_ERROR_OPERATION_FAILED; @@ -72,7 +72,7 @@ void VcMgrTestUtility::ServiceStateChangedCallback(vc_service_state_e previous, void VcMgrTestUtility::ErrorCallback(vc_error_e reason, void *user_data) { auto instance = reinterpret_cast(user_data); - instance->mErrorOccured = true; + instance->mErrorOccurred = true; char *error = nullptr; instance->mGetErrorMessageReturn = vc_mgr_get_error_message(&error); @@ -165,7 +165,7 @@ bool VcMgrTestUtility::IsStateChanged(vc_state_e targetState, int duration) return target == instance->mCurrentState; }, this, targetState); - return VcCommonTestUtility::WaitCondtion(stateChecker, duration); + return VcCommonTestUtility::WaitCondition(stateChecker, duration); } bool VcMgrTestUtility::IsServiceStateChanged(vc_service_state_e targetState, int duration) @@ -174,16 +174,16 @@ bool VcMgrTestUtility::IsServiceStateChanged(vc_service_state_e targetState, int return target == instance->mCurrentServiceState; }, this, targetState); - return VcCommonTestUtility::WaitCondtion(serviceStateChecker, duration); + return VcCommonTestUtility::WaitCondition(serviceStateChecker, duration); } bool VcMgrTestUtility::IsErrorOccurring(int duration) { auto errorChecker = std::bind([](VcMgrTestUtility *instance) { - return instance->mErrorOccured; + return instance->mErrorOccurred; }, this); - return VcCommonTestUtility::WaitCondtion(errorChecker, duration); + return VcCommonTestUtility::WaitCondition(errorChecker, duration); } bool VcMgrTestUtility::IsAllResultReceived(int duration) @@ -192,7 +192,7 @@ bool VcMgrTestUtility::IsAllResultReceived(int duration) return instance->mAllResultReceived; }, this); - return VcCommonTestUtility::WaitCondtion(resultChecker, duration); + return VcCommonTestUtility::WaitCondition(resultChecker, duration); } bool VcMgrTestUtility::IsResultReceived(int duration) @@ -201,7 +201,7 @@ bool VcMgrTestUtility::IsResultReceived(int duration) return instance->mResultReceived; }, this); - return VcCommonTestUtility::WaitCondtion(resultChecker, duration); + return VcCommonTestUtility::WaitCondition(resultChecker, duration); } bool VcMgrTestUtility::IsSpeechDetected(int duration) @@ -210,7 +210,7 @@ bool VcMgrTestUtility::IsSpeechDetected(int duration) return instance->mSpeechDetected; }, this); - return VcCommonTestUtility::WaitCondtion(resultChecker, duration); + return VcCommonTestUtility::WaitCondition(resultChecker, duration); } bool VcMgrTestUtility::IsLanguageChanged(int duration) @@ -219,7 +219,7 @@ bool VcMgrTestUtility::IsLanguageChanged(int duration) return instance->mLanguageChanged; }, this); - return VcCommonTestUtility::WaitCondtion(resultChecker, duration); + return VcCommonTestUtility::WaitCondition(resultChecker, duration); } bool VcMgrTestUtility::Prepare() diff --git a/tests/src/vc_mgr_test_util.h b/tests/src/vc_mgr_test_util.h index c0db4ad..5dc2267 100644 --- a/tests/src/vc_mgr_test_util.h +++ b/tests/src/vc_mgr_test_util.h @@ -66,7 +66,7 @@ public: vc_service_state_e mCurrentServiceState; vc_cmd_list_h mDefaultCommandList; - bool mErrorOccured; + bool mErrorOccurred; int mGetErrorMessageReturn; bool mAllResultReceived; int mSetSelectedResultReturn; diff --git a/tests/src/vc_test_util.cpp b/tests/src/vc_test_util.cpp index b150f73..ed836b5 100644 --- a/tests/src/vc_test_util.cpp +++ b/tests/src/vc_test_util.cpp @@ -25,7 +25,7 @@ VcTestUtility::VcTestUtility() { mCurrentState = VC_STATE_NONE; mCurrentServiceState = VC_SERVICE_STATE_NONE; - mErrorOccured = false; + mErrorOccurred = false; mResultReceived = false; mLanguageChanged = false; @@ -60,7 +60,7 @@ void VcTestUtility::ServiceStateChangedCallback(vc_service_state_e previous, vc_ void VcTestUtility::ErrorCallback(vc_error_e reason, void *user_data) { auto instance = reinterpret_cast(user_data); - instance->mErrorOccured = true; + instance->mErrorOccurred = true; } void VcTestUtility::ResultCallback(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, void *user_data) @@ -99,7 +99,7 @@ bool VcTestUtility::IsStateChanged(vc_state_e targetState, int duration) return target == instance->mCurrentState; }, this, targetState); - return VcCommonTestUtility::WaitCondtion(stateChecker, duration); + return VcCommonTestUtility::WaitCondition(stateChecker, duration); } bool VcTestUtility::IsServiceStateChanged(vc_service_state_e targetState, int duration) @@ -108,16 +108,16 @@ bool VcTestUtility::IsServiceStateChanged(vc_service_state_e targetState, int du return target == instance->mCurrentServiceState; }, this, targetState); - return VcCommonTestUtility::WaitCondtion(serviceStateChecker, duration); + return VcCommonTestUtility::WaitCondition(serviceStateChecker, duration); } bool VcTestUtility::IsErrorOccurring(int duration) { auto errorChecker = std::bind([](VcTestUtility *instance) { - return instance->mErrorOccured; + return instance->mErrorOccurred; }, this); - return VcCommonTestUtility::WaitCondtion(errorChecker, duration); + return VcCommonTestUtility::WaitCondition(errorChecker, duration); } bool VcTestUtility::IsResultReceived(int duration) @@ -126,7 +126,7 @@ bool VcTestUtility::IsResultReceived(int duration) return instance->mResultReceived; }, this); - return VcCommonTestUtility::WaitCondtion(resultChecker, duration); + return VcCommonTestUtility::WaitCondition(resultChecker, duration); } bool VcTestUtility::IsLanguageChanged(int duration) @@ -135,7 +135,7 @@ bool VcTestUtility::IsLanguageChanged(int duration) return instance->mLanguageChanged; }, this); - return VcCommonTestUtility::WaitCondtion(resultChecker, duration); + return VcCommonTestUtility::WaitCondition(resultChecker, duration); } bool VcTestUtility::Prepare() diff --git a/tests/src/vc_test_util.h b/tests/src/vc_test_util.h index 4de8dc8..7ca3e5f 100644 --- a/tests/src/vc_test_util.h +++ b/tests/src/vc_test_util.h @@ -51,7 +51,7 @@ public: vc_state_e mCurrentState; vc_service_state_e mCurrentServiceState; - bool mErrorOccured; + bool mErrorOccurred; bool mResultReceived; bool mLanguageChanged; -- 2.7.4 From c48f4b2c52de7f8e34af4baa657aee8e3c7f7987 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 3 Aug 2023 11:10:37 +0900 Subject: [PATCH 11/16] Update version (1.80.2) Change-Id: I4525a0a5222338f3e15717559a0c4a4da1611fb7 Signed-off-by: Suyeon Hwang --- packaging/voice-control.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index ff9c2fb..0cf4dbf 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.80.1 +Version: 1.80.2 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From ae4e8885a5d8a5b3e372092eb5b40349c7cee250 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Mon, 28 Aug 2023 20:23:39 +0900 Subject: [PATCH 12/16] Connect to widget client from server by on-demand - Issue: By the change of IPC to TIDL, app can receive unknown app launch request. - Solution: This patch postpones the server-to-client connection. TIDL does not support bi-directional call, so voice control widget client has stub implementation for receiving some special message from the server. However, this implementation causes unknown app launch requests for connection. Through this change, server will not connect to client immediately when the client requests to connect. It will try to connect when it actually needs to send some message to client. Change-Id: Ie3f13e0a58d80a973715c4c86e71ffa14722de3e Signed-off-by: Suyeon Hwang --- server/vcd_tidl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index bef79d8..22dcb6f 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -108,14 +108,18 @@ static void __request_tidl_connect(vcd_client_type_e type, int pid) return; } - if (widget_tidl_info->connection_requesting) { + if (widget_tidl_info->connected) { + SLOG(LOG_INFO, TAG_VCD, "[TIDL] widget is already connected"); return; } - ret = rpc_port_proxy_vcd_widget_proxy_vcd_widget_connect(widget_tidl_info->rpc_h); + if (widget_tidl_info->connection_requesting) { + return; + } + ret = rpc_port_proxy_vcd_widget_proxy_vcd_widget_connect_sync(widget_tidl_info->rpc_h); if (0 == ret) { - SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); + SLOG(LOG_ERROR, TAG_VCD, "[TIDL] tidl proxy info not allocated"); widget_tidl_info->connection_requesting = true; } type_str = "widget"; @@ -1541,8 +1545,6 @@ static void __vc_widget_register_cb_cb(rpc_port_stub_vcd_widget_stub_vc_widget_ pthread_mutex_unlock(&g_widget_tidl_info_mutex); - __request_tidl_connect(VCD_CLIENT_TYPE_WIDGET, pid); - SLOG(LOG_DEBUG, TAG_VCD, "@@@ VC WIDGET REGISTER CALLBACK DONE"); } @@ -2722,12 +2724,14 @@ int vcdc_send_asr_result(int pid, int event, const char* asr_result, int cmd_typ SLOG(LOG_DEBUG, TAG_VCD, "[TIDL] Send asr result"); widget_tidl_info_s* widget_tidl_info = vcd_client_widget_get_tidl_info(pid); - if (NULL == widget_tidl_info) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to get tidl info"); return VC_ERROR_OPERATION_FAILED; } + // FIXME: This is temproray fix for avoiding app launch in client side. + __request_tidl_connect(VCD_CLIENT_TYPE_WIDGET, pid); + if (!widget_tidl_info->connected) { SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Not Connected"); return VC_ERROR_OPERATION_FAILED; -- 2.7.4 From 94d67dea40ec3c25a46ae18a5d5ae8593d3bdcf7 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Wed, 6 Sep 2023 12:03:23 +0900 Subject: [PATCH 13/16] Update version (1.80.3) Change-Id: I13c7aa078b5985a1c0a0653899b7362d185f9b5e Signed-off-by: Suyeon Hwang --- packaging/voice-control.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 0cf4dbf..4d9a7cf 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.80.2 +Version: 1.80.3 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From 3230e822a26d2f26a9b9d2524c1194248656cb71 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 7 Nov 2023 17:57:35 +0900 Subject: [PATCH 14/16] Except system volume from ducking - Requirement: In some uses cases, the system type audio stream should play. - Solution: This patch removes the code for ducking the system type volume. Through this change, voice control no longer reduces the system type volume. Change-Id: Ia1ec372b40301fbb8b683418943963d2266033be Signed-off-by: Suyeon Hwang --- client/vc_mgr_ducking.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/client/vc_mgr_ducking.cpp b/client/vc_mgr_ducking.cpp index bbec1d7..810997a 100644 --- a/client/vc_mgr_ducking.cpp +++ b/client/vc_mgr_ducking.cpp @@ -157,10 +157,6 @@ int vc_mgr_ducking_activate(double ratio) if (SOUND_MANAGER_ERROR_NONE != ret) return ret; - ret = activate_ducking_sound_stream(SOUND_STREAM_TYPE_SYSTEM, g_system_stream_h, ratio); - if (SOUND_MANAGER_ERROR_NONE != ret) - return ret; - ret = activate_ducking_sound_stream(SOUND_STREAM_TYPE_NOTIFICATION, g_notification_stream_h, ratio); if (SOUND_MANAGER_ERROR_NONE != ret) return ret; @@ -201,10 +197,6 @@ int vc_mgr_ducking_deactivate(void) if (SOUND_MANAGER_ERROR_NONE != ret) return ret; - ret = deactivate_ducking_sound_stream(SOUND_STREAM_TYPE_SYSTEM, g_system_stream_h); - if (SOUND_MANAGER_ERROR_NONE != ret) - return ret; - ret = deactivate_ducking_sound_stream(SOUND_STREAM_TYPE_NOTIFICATION, g_notification_stream_h); if (SOUND_MANAGER_ERROR_NONE != ret) return ret; -- 2.7.4 From 4595061d714ad062ca890dd78b9c54275bdf5cb1 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Tue, 7 Nov 2023 18:00:57 +0900 Subject: [PATCH 15/16] Update version (1.80.4) Change-Id: Ia5a3bb7cd2edc9286b2ce726898aaffb1326331a Signed-off-by: Suyeon Hwang --- packaging/voice-control.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/voice-control.spec b/packaging/voice-control.spec index 4d9a7cf..4168fb4 100644 --- a/packaging/voice-control.spec +++ b/packaging/voice-control.spec @@ -1,6 +1,6 @@ Name: voice-control Summary: Voice control client library and daemon -Version: 1.80.3 +Version: 1.80.4 Release: 1 Group: Graphics & UI Framework/Voice Framework License: Apache-2.0 -- 2.7.4 From b1a3e5227b6b66768248d79cfe67baff5ed614a9 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Wed, 6 Dec 2023 11:31:01 +0900 Subject: [PATCH 16/16] Update since_tizen in header files Change-Id: Ibff82d907547295702a0b1167ca29f58bbd4eba5 Signed-off-by: sooyeon --- client/vc.c | 2 +- common/vc_command.h | 4 +- include/vce.h | 130 ++++++++++++++++----------------- include/voice_control.h | 44 +++++------ include/voice_control_command.h | 40 +++++----- include/voice_control_command_expand.h | 6 +- include/voice_control_common.h | 20 ++--- include/voice_control_setting.h | 4 +- include/voice_control_widget.h | 2 +- 9 files changed, 126 insertions(+), 126 deletions(-) diff --git a/client/vc.c b/client/vc.c index 6695e1a..c514b81 100644 --- a/client/vc.c +++ b/client/vc.c @@ -1042,7 +1042,7 @@ int vc_get_system_command_list(vc_cmd_list_h* vc_sys_cmd_list) //LCOV_EXCL_START /** * @brief Checks whether the command format is supported. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] format The command format * @param[out] support The result status @c true = supported, @c false = not supported diff --git a/common/vc_command.h b/common/vc_command.h index b772774..4e2b583 100644 --- a/common/vc_command.h +++ b/common/vc_command.h @@ -62,7 +62,7 @@ typedef struct { /** * @brief Enumerations of command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ typedef enum { VC_COMMAND_TYPE_NONE = 0, /**< No command position */ @@ -91,7 +91,7 @@ int vc_cmd_print_list(vc_cmd_list_h vc_cmd_list); /** * @brief Remove all commands from command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, diff --git a/include/vce.h b/include/vce.h index 1f4036e..6f798b6 100644 --- a/include/vce.h +++ b/include/vce.h @@ -31,7 +31,7 @@ extern "C" { /** * @brief Enumerations of error codes. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ @@ -51,7 +51,7 @@ typedef enum { /** * @brief Enumerations of audio type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_AUDIO_TYPE_PCM_S16_LE = 0, /**< Signed 16bit audio type, Little endian */ @@ -60,7 +60,7 @@ typedef enum { /** * @brief Enumerations of callback event. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_RESULT_EVENT_SUCCESS = 0, /**< Event when the recognition full result is ready */ @@ -70,7 +70,7 @@ typedef enum { /** * @brief Enumerations of command type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_COMMAND_FORMAT_FIXED = 0, /**< Fixed command */ @@ -84,7 +84,7 @@ typedef enum { /** * @brief Enumerations of speech detect. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_SPEECH_DETECT_NONE = 0, /**< No event */ @@ -94,7 +94,7 @@ typedef enum { /** * @brief Enumerations of ASR result events. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_ASR_RESULT_EVENT_FINAL_RESULT = 0, /**< Event when the ASR result is last data or ASR result is only one result */ @@ -104,7 +104,7 @@ typedef enum { /** * @brief Enumerations of audio channels. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_AUDIO_CHANNEL_MONO = 0, /**< 1 channel, mono */ @@ -113,7 +113,7 @@ typedef enum { /** * @brief Enumeration for TTS feedback events. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef enum { VCE_FEEDBACK_EVENT_FAIL = -1, /**< Failed */ @@ -124,74 +124,74 @@ typedef enum { /** * @brief A structure of handle for VC command. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ typedef struct vce_cmd_s* vce_cmd_h; /** * @brief Definition for foreground command type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definition for background command type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_BACKGROUND 2 /** * @brief Definition for widget command type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_WIDGET 3 /** * @brief Definition for system command type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_SYSTEM 4 /** * @brief Definition for system background command type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_SYSTEM_BACKGROUND 5 /** * @brief Definitions for exclusive command type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_COMMAND_TYPE_EXCLUSIVE 6 /** * @brief Definition of bluetooth audio id. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_AUDIO_ID_BLUETOOTH "VC_AUDIO_ID_BLUETOOTH" /**< Bluetooth audio id */ /** * @brief Definition of Wi-Fi audio id. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VCE_AUDIO_ID_WIFI "VC_AUDIO_ID_WIFI" /**< Wi-Fi audio id */ /** * @brief Definition for none message. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VC_RESULT_MESSAGE_NONE "vc.result.message.none" /** * @brief Definition for failed recognition because the speech is too loud to listen. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 */ #define VC_RESULT_MESSAGE_ERROR_TOO_LOUD "vc.result.message.error.too.loud" /** * @brief Called when VC engine informs the engine service user about whole supported languages. * @details This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is called by vce_foreach_supported_languages_cb() to retrieve the whole supported language list. * The @a user_data must be transferred from vce_foreach_supported_languages_cb(). * The @a language can be used only in the callback. To use outside, make a copy. @@ -206,7 +206,7 @@ typedef bool (*vce_supported_language_cb)(const char* language, void* user_data) /** * @brief Called when the engine service user initializes Voice Control (VC) engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -219,7 +219,7 @@ typedef int (*vce_initialize_cb)(void); /** * @brief Called when the engine service user deinitializes VC engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -230,7 +230,7 @@ typedef int (*vce_deinitialize_cb)(void); /** * @brief Called when the engine service user requests the recording format of VC engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * The @a audio_id can be used only in the callback. To use outside, make a copy. * The @a types is managed by the platform and will be released when this callback function is completed. @@ -248,7 +248,7 @@ typedef int (*vce_get_recording_format_cb)(const char* audio_id, vce_audio_type_ /** * @brief Called when the engine service user retrieves all supported languages of VC engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @param[in] callback a callback function * @param[in] user_data The user data to be passed to the callback function @@ -264,7 +264,7 @@ typedef int (*vce_foreach_supported_languages_cb)(vce_supported_language_cb call /** * @brief Called when the engine service user checks whether a language is supported or not. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * The @a language can be used only in the callback. To use outside, make a copy. * @param[in] language A language @@ -274,7 +274,7 @@ typedef bool (*vce_is_language_supported_cb)(const char* language); /** * @brief Called when the engine service user sets language. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a language can be used only in the callback. To use outside, make a copy. * @param[in] language A language. * @return 0 on success, otherwise a negative error value @@ -287,7 +287,7 @@ typedef int (*vce_set_language_cb)(const char* language); /** * @brief Called when the engine service user sets command list before recognition. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This function should set commands via vcd_foreach_command(). * The @a vc_command should not be released. * The @a vc_command can be used only in the callback. To use outside, make a copy. @@ -308,7 +308,7 @@ typedef int (*vce_set_commands_cb)(vce_cmd_h vc_command); /** * @brief Called when the engine service user unsets command list for reset. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_PARAMETER Invalid parameter @@ -321,7 +321,7 @@ typedef int (*vce_unset_commands_cb)(void); /** * @brief Called when the engine service user starts recognition. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * @param[in] stop_by_silence Silence detection option. * @c true to detect the silence, @@ -342,7 +342,7 @@ typedef int (*vce_start_cb)(bool stop_by_silence); /** * @brief Called when the engine service user sets recording data for speech recognition from recorder. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This function should be returned immediately after recording data copy. * The @a data can be used only in the callback. To use outside, make a copy. * The @a speech_detected should not be released. This is managed by the platform. @@ -363,7 +363,7 @@ typedef int(*vce_set_recording_data_cb)(const void* data, unsigned int length, v /** * @brief Called when the engine service user stops to get the result of recognition. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful * @retval #VCE_ERROR_INVALID_STATE Invalid state @@ -379,7 +379,7 @@ typedef int (*vce_stop_cb)(void); /** * @brief Called when the engine service user cancels the recognition process. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @return 0 on success, otherwise a negative error value. * @retval #VCE_ERROR_NONE Successful. * @retval #VCE_ERROR_INVALID_STATE Invalid state. @@ -391,7 +391,7 @@ typedef int (*vce_cancel_cb)(void); /** * @brief Called when the engine service user sets audio recording type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a audio_type can be used only in the callback. To use outside, make a copy. * @param[in] audio_type Current audio type (e.g. #VCE_AUDIO_ID_BLUETOOTH or #VCE_AUDIO_ID_WIFI) * @return 0 on success, otherwise a negative error value. @@ -402,7 +402,7 @@ typedef int (*vce_set_audio_type_cb)(const char* audio_type); /** * @brief Called when the engine service user sets app id which is want to ask server dialog. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a app_id and @a credential can be used only in the callback. To use outside, make a copy. * @param[in] app_id App id which is to want to ask server dialog. * @param[in] credential Credential key. @@ -415,7 +415,7 @@ typedef int (*vce_set_server_dialog_cb)(const char* app_id, const char* credenti /** * @brief Called when the engine service user sets domain (agent or device type). - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a domain can be used only in the callback. To use outside, make a copy. * @param[in] domain Agent (e.g. "music", "news", etc) or device type (e.g. "tv", "mobile", etc) corresponding to the command * @return 0 on success, otherwise a negative error value. @@ -426,7 +426,7 @@ typedef int (*vce_set_domain_cb)(const char* domain); /** * @brief Called when the engine service user requests essential value from NLU result. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a key can be used only in the callback. To use outside, make a copy. * The @a value is managed by the platform and will be released when this callback function is completed. * @param[in] key NLU base info key. @@ -439,7 +439,7 @@ typedef int (*vce_nlu_base_info_requested_cb)(const char* key, char** value); /** * @brief Called when client gets the specific engine's request from the engine service user. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a engine_app_id is managed by the platform and will be released when this callback function is completed. * The @a event is managed by the platform and will be released when this callback function is completed. * The @a request is managed by the platform and will be released when this callback function is completed. @@ -462,7 +462,7 @@ typedef int (*vce_specific_engine_request_cb)(const char* engine_app_id, const c /** * @brief Called when the engine service user sets private data between app and engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a key, @a data can be used only in the callback. To use outside, make a copy. * @param[in] key Private key. * @param[in] data Private data. @@ -474,7 +474,7 @@ typedef int (*vce_private_data_set_cb)(const char* key, const char* data); /** * @brief Called when the engine service user requests private data between app and engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a key can be used only in the callback. To use outside, make a copy. * The @a data is managed by the platform and will be released when this callback function is completed. * @param[in] key Private key. @@ -487,7 +487,7 @@ typedef int (*vce_private_data_requested_cb)(const char* key, char** data); /** * @brief Called when the engine service user requests process text. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a text can be used only in the callback. To use outside, make a copy. * @param[in] text Requested text * @return 0 on success, otherwise a negative error value. @@ -498,7 +498,7 @@ typedef int (*vce_process_text_cb)(const char* text); /** * @brief Called when the engine service user requests list event. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a event can be used only in the callback. To use outside, make a copy. * @param[in] event Requested list event * @return 0 on success, otherwise a negative error value. @@ -509,7 +509,7 @@ typedef int (*vce_process_list_event_cb)(const char* event); /** * @brief Called when the engine service user requests haptic event. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a event can be used only in the callback. To use outside, make a copy. * @param[in] event Requested haptic event * @return 0 on success, otherwise a negative error value. @@ -520,7 +520,7 @@ typedef int (*vce_process_haptic_event_cb)(const char* event); /** * @brief Called when the engine service user requests the base information of VC engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks This callback function is mandatory and must be registered using vce_main(). * The @a engine_uuid is managed by the platform and will be released when this callback function is completed. * The @a engine_name is managed by the platform and will be released when this callback function is completed. @@ -542,7 +542,7 @@ typedef int (*vce_get_info_cb)(char** engine_uuid, char** engine_name, char** en /** * @brief Called to retrieve the commands. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The @a command, @a param can be used only in the callback. To use outside, make a copy. * @param[in] id command id * @param[in] type command type @@ -627,7 +627,7 @@ typedef int (*vce_tts_audio_format_request_cb)(int* rate, int* channel, int* aud /** * @brief A structure for the VC engine functions. * @details This structure contains essential callback functions for operating VC engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks You must register all callbacks except optional callbacks for operating VC engine.\n * The following callbacks are optional callbacks : \n * - vce_private_data_set_cb() \n @@ -683,7 +683,7 @@ typedef struct { /** * @brief Starts the main function for Voice Control (VC) engine. * @details This function is the main function for operating VC engine. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder \n * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n @@ -796,7 +796,7 @@ int vce_main(int argc, char** argv, vce_request_callback_s* callback); /** * @brief Sends the results to the engine service user. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) @@ -827,7 +827,7 @@ int vce_send_result(vce_result_event_e event, int* result_id, int count, const c /** * @brief Sends the ASR result to the engine service user. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) @@ -850,7 +850,7 @@ int vce_send_asr_result(vce_asr_result_event_e event, const char* asr_result, vo /** * @brief Sends the NLG (Natural Language Generation) result to the engine service user. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) @@ -872,7 +872,7 @@ int vce_send_nlg_result(const char* nlg_result, void* user_data); /** * @brief Sends the specific engine result to the engine service user. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) @@ -910,7 +910,7 @@ int vce_send_specific_engine_result(const char* engine_app_id, const char* event * #VCE_ERROR_PERMISSION_DENIED, \n * #VCE_ERROR_NOT_SUPPORTED_FEATURE \n * #VCE_ERROR_TTS_FAILED. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) @@ -932,7 +932,7 @@ int vce_send_error(vce_error_e error, const char* msg, void* user_data); /** * @brief Sets a callback function for setting the private data to the engine service. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The vce_private_data_set_cb() function is called when the engine service user sets the private data to the engine service. @@ -952,7 +952,7 @@ int vce_set_private_data_set_cb(vce_private_data_set_cb callback_func); /** * @brief Sets a callback function for requesting the private data to the engine service. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The vce_private_data_requested_cb() function is called when the engine service user requests the private data to the engine service. @@ -970,7 +970,7 @@ int vce_set_private_data_requested_cb(vce_private_data_requested_cb callback_fun /** * @brief Sets a callback function for requesting the NLU base information to the engine service. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @remarks The vce_nlu_base_info_requested_cb() function is called when the engine service user requests the NLU base information to the engine service. * @param[in] callback_func vce_nlu_base_info_requested event callback function * @return @c 0 on success, otherwise a negative error value @@ -985,7 +985,7 @@ int vce_set_nlu_base_info_requested_cb(vce_nlu_base_info_requested_cb callback_f /** * @brief Sets a callback function for getting the engine service request. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * * @param[in] callback_func Callback function to register * @@ -1000,7 +1000,7 @@ int vce_set_specific_engine_request_cb(vce_specific_engine_request_cb callback_f /** * @brief Unsets the engine service request callback function. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * * @return 0 on success, otherwise a negative error value * @retval #VCE_ERROR_NONE Successful @@ -1012,7 +1012,7 @@ int vce_unset_specific_engine_request_cb(void); /** * @brief Retrieves all commands using callback function. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * * @param[in] vce_command The handle to be passed to the vce_set_commands_cb() function * @param[in] callback The callback function to invoke @@ -1032,7 +1032,7 @@ int vce_get_foreach_command(vce_cmd_h vce_command, vce_command_cb callback, void /** * @brief Gets command length. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * * @param[in] vce_command The handle to be passed to the vce_set_commands_cb() function * @param[out] count The command count value @@ -1048,7 +1048,7 @@ int vce_get_command_count(vce_cmd_h vce_command, int* count); /** * @brief Gets current audio type. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The @a audio_type must be released using free() when it is no longer required. @@ -1064,7 +1064,7 @@ int vce_get_audio_type(char** audio_type); /** * @brief Sets private data to a voice manager client. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder \n * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n @@ -1086,7 +1086,7 @@ int vce_set_private_data(const char* key, const char* data); /** * @brief Gets private data from a voice manager client. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder \n * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n @@ -1109,7 +1109,7 @@ int vce_get_private_data(const char* key, char** data); /** * @brief Starts recording voice. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder \n * %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n @@ -1127,7 +1127,7 @@ int vce_start_recording(void); /** * @brief Stops recording voice. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @@ -1141,7 +1141,7 @@ int vce_stop_recording(void); /** * @brief Sends audio formats necessary for playing TTS feedback. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) @@ -1163,7 +1163,7 @@ int vce_send_feedback_audio_format(int rate, vce_audio_channel_e channel, vce_au /** * @brief Sends audio streaming necessary for playing TTS feedback. - * @since_tizen @if MOBILE 4.0 @elseif WEARABLE 5.0 @endif + * @since_tizen 4.0 * @privlevel public * @privilege %http://tizen.org/privilege/appmanager.launch (Since 7.0) \n * %http://tizen.org/privilege/datasharing (Since 7.0) diff --git a/include/voice_control.h b/include/voice_control.h index b4939e9..64973c8 100644 --- a/include/voice_control.h +++ b/include/voice_control.h @@ -55,14 +55,14 @@ extern "C" /** * @brief Definition for foreground command type. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ #define VC_COMMAND_TYPE_FOREGROUND 1 /** * @brief Definition for background command type. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ #define VC_COMMAND_TYPE_BACKGROUND 2 @@ -83,7 +83,7 @@ extern "C" /** * @brief Initializes voice control. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks If the function succeeds, vc must be released with vc_deinitialize(). @@ -102,7 +102,7 @@ int vc_initialize(void); /** * @brief Deinitializes voice control. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, @@ -119,7 +119,7 @@ int vc_deinitialize(void); /** * @brief Connects the voice control service. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, @@ -138,7 +138,7 @@ int vc_prepare(void); /** * @brief Disconnects the voice control service. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, @@ -156,7 +156,7 @@ int vc_unprepare(void); /** * @brief Retrieves all supported languages using callback function. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] callback Callback function to invoke @@ -179,7 +179,7 @@ int vc_foreach_supported_languages(vc_supported_language_cb callback, void* user /** * @brief Gets current language. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks If the function succeeds, @a language must be released with free() by you when you no longer need it. @@ -203,7 +203,7 @@ int vc_get_current_language(char** language); /** * @brief Gets current state of voice control client. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[out] state The current state @@ -221,7 +221,7 @@ int vc_get_state(vc_state_e* state); /** * @brief Gets current state of voice control service. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[out] state The current state @@ -363,7 +363,7 @@ int vc_request_dialog(const char* disp_text, const char* utt_text, bool auto_sta /** * @brief Sets command list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @remarks The command type is valid for #VC_COMMAND_TYPE_FOREGROUND or #VC_COMMAND_TYPE_BACKGROUND. @@ -385,7 +385,7 @@ int vc_set_command_list(vc_cmd_list_h vc_cmd_list, int type); /** * @brief Unsets command list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] type Command type @@ -424,7 +424,7 @@ int vc_get_result(vc_result_cb callback, void* user_data); /** * @brief Sets a callback function for getting recognition result. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] callback Callback function to register @@ -445,7 +445,7 @@ int vc_set_result_cb(vc_result_cb callback, void* user_data); /** * @brief Unsets the callback function. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, @@ -462,7 +462,7 @@ int vc_unset_result_cb(void); /** * @brief Sets a callback function to be called when service state is changed. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] callback Callback function to register @@ -483,7 +483,7 @@ int vc_set_service_state_changed_cb(vc_service_state_changed_cb callback, void* /** * @brief Unsets the callback function. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, @@ -500,7 +500,7 @@ int vc_unset_service_state_changed_cb(void); /** * @brief Sets a callback function to be called when state is changed. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] callback Callback function to register @@ -521,7 +521,7 @@ int vc_set_state_changed_cb(vc_state_changed_cb callback, void* user_data); /** * @brief Unsets the callback function. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, @@ -538,7 +538,7 @@ int vc_unset_state_changed_cb(void); /** * @brief Sets a callback function to be called when current language is changed. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] callback Callback function to register @@ -559,7 +559,7 @@ int vc_set_current_language_changed_cb(vc_current_language_changed_cb callback, /** * @brief Unsets the callback function. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, @@ -576,7 +576,7 @@ int vc_unset_current_language_changed_cb(void); /** * @brief Sets a callback function to be called when an error occurred. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @param[in] callback Callback function to register @@ -597,7 +597,7 @@ int vc_set_error_cb(vc_error_cb callback, void* user_data); /** * @brief Unsets the callback function. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @privlevel public * @privilege %http://tizen.org/privilege/recorder * @return @c 0 on success, diff --git a/include/voice_control_command.h b/include/voice_control_command.h index e1f64af..cc09250 100644 --- a/include/voice_control_command.h +++ b/include/voice_control_command.h @@ -73,21 +73,21 @@ extern "C" /** * @brief The voice command handle. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ typedef struct vc_cmd_s* vc_cmd_h; /** * @brief The voice command list handle. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ typedef struct vc_cmd_list_s* vc_cmd_list_h; /** * @brief Called to retrieve The commands in list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @remarks @a vc_command should not be released. It is managed by the framework and will be released when invoking this callback is finished. * @param[in] vc_command The command handle * @param[in] user_data The user data passed from the foreach function @@ -101,7 +101,7 @@ typedef bool (*vc_cmd_list_cb)(vc_cmd_h vc_command, void* user_data); /** * @brief Creates a handle for command list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @remarks If the function succeeds, @a vc_cmd_list must be released with vc_cmd_list_destroy(). * @param[out] vc_cmd_list The command list handle * @return @c 0 on success, @@ -117,7 +117,7 @@ int vc_cmd_list_create(vc_cmd_list_h* vc_cmd_list); /** * @brief Destroys the handle for command list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, * @c false = remove command from list @@ -133,7 +133,7 @@ int vc_cmd_list_destroy(vc_cmd_list_h vc_cmd_list, bool free_command); /** * @brief Gets command count of list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @param[out] count The count * @return @c 0 on success, @@ -147,7 +147,7 @@ int vc_cmd_list_get_count(vc_cmd_list_h vc_cmd_list, int* count); /** * @brief Adds command to command list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle * @return @c 0 on success, @@ -162,7 +162,7 @@ int vc_cmd_list_add(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Removes command from command list. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @param[in] vc_command The command handle * @return @c 0 on success, @@ -177,7 +177,7 @@ int vc_cmd_list_remove(vc_cmd_list_h vc_cmd_list, vc_cmd_h vc_command); /** * @brief Retrieves all commands of command list using callback function. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @param[in] callback Callback function to invoke * @param[in] user_data The user data to be passed to the callback function @@ -194,7 +194,7 @@ int vc_cmd_list_foreach_commands(vc_cmd_list_h vc_cmd_list, vc_cmd_list_cb callb /** * @brief Moves index to first command. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @return @c 0 on success, * otherwise a negative error value @@ -209,7 +209,7 @@ int vc_cmd_list_first(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to last command. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @return @c 0 on success, * otherwise a negative error value @@ -224,7 +224,7 @@ int vc_cmd_list_last(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to next command. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @return @c 0 on success, * otherwise a negative error value @@ -240,7 +240,7 @@ int vc_cmd_list_next(vc_cmd_list_h vc_cmd_list); /** * @brief Moves index to previous command. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_cmd_list The command list handle * @return @c 0 on success, * otherwise a negative error value @@ -256,7 +256,7 @@ int vc_cmd_list_prev(vc_cmd_list_h vc_cmd_list); /** * @brief Gets current command from command list by index. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @remarks @a vc_command should be released after removing it from @a vc_cmd_list with vc_cmd_list_remove(). * @param[in] vc_cmd_list The command list handle * @param[out] vc_command The command handle @@ -276,7 +276,7 @@ int vc_cmd_list_get_current(vc_cmd_list_h vc_cmd_list, vc_cmd_h* vc_command); /** * @brief Creates a handle for command. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @remarks If the function succeeds, @a vc_command must be released with vc_cmd_destroy() or vc_cmd_list_destroy(). * You should set command and type if command is valid. * The command format is set to #VC_COMMAND_FORMAT_FIXED by default and can be changed with vc_cmd_set_format(). @@ -294,7 +294,7 @@ int vc_cmd_create(vc_cmd_h* vc_command); /** * @brief Destroys the handle. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_command The command handle * @return @c 0 on success, * otherwise a negative error value @@ -308,7 +308,7 @@ int vc_cmd_destroy(vc_cmd_h vc_command); /** * @brief Sets command or action. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_command The command handle * @param[in] command The command or action text * @return @c 0 on success, @@ -323,7 +323,7 @@ int vc_cmd_set_command(vc_cmd_h vc_command, const char* command); /** * @brief Gets command. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @remarks If the function succeeds, @a command must be released with free() by you if they are not NULL. * @param[in] vc_command The command handle * @param[out] command The command text @@ -356,7 +356,7 @@ int vc_cmd_get_unfixed_command(vc_cmd_h vc_command, char** command); /** * @brief Sets command type. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @remarks If you do not set the command type, the default value is @c -1. * You should set type if command is valid * @param[in] vc_command The command handle @@ -373,7 +373,7 @@ int vc_cmd_set_type(vc_cmd_h vc_command, int type); /** * @brief Gets command type. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] vc_command The command handle * @param[out] type The command type * @return @c 0 on success, diff --git a/include/voice_control_command_expand.h b/include/voice_control_command_expand.h index ca353e7..2b00752 100644 --- a/include/voice_control_command_expand.h +++ b/include/voice_control_command_expand.h @@ -50,7 +50,7 @@ typedef enum { /** * @brief Sets command domain -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[in] domain The domain @@ -67,7 +67,7 @@ int vc_cmd_set_domain(vc_cmd_h vc_command, int domain); /** * @brief Gets command domain. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_command The command handle * @param[out] domain The domain @@ -84,7 +84,7 @@ int vc_cmd_get_domain(vc_cmd_h vc_command, int* domain); /** * @brief Remove all commands from command list. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] vc_cmd_list The command list handle * @param[in] free_command The command free option @c true = release each commands in list, diff --git a/include/voice_control_common.h b/include/voice_control_common.h index 400dce9..a2b4c53 100644 --- a/include/voice_control_common.h +++ b/include/voice_control_common.h @@ -35,7 +35,7 @@ extern "C" /** * @brief Enumeration for error codes. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ typedef enum { VC_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ @@ -64,7 +64,7 @@ typedef enum { /** * @brief Enumeration for result event. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ typedef enum { VC_RESULT_EVENT_RESULT_SUCCESS = 0, /**< Normal result */ @@ -74,7 +74,7 @@ typedef enum { /** * @brief Enumeration for service state. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ typedef enum { VC_SERVICE_STATE_NONE = 0, /**< 'None' state */ @@ -86,7 +86,7 @@ typedef enum { /** * @brief Enumeration for client state. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 */ typedef enum { VC_STATE_NONE = 0, /**< 'None' state */ @@ -147,7 +147,7 @@ typedef enum { /** * @brief Called when client gets the recognition result. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @remarks If the duplicated commands are recognized, the event(e.g. #VC_RESULT_EVENT_REJECTED) of command may be rejected * for selecting command as priority. If you set similar or same commands or the recognized results are multi-results, * vc_cmd_list has the multi commands. @@ -163,7 +163,7 @@ typedef void (*vc_result_cb)(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, /** * @brief Called when default language is changed. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] previous Previous language * @param[in] current Current language * @param[in] user_data The user data passed from the callback registration function @@ -175,7 +175,7 @@ typedef void (*vc_current_language_changed_cb)(const char* previous, const char* /** * @brief Called to retrieve supported language. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code * followed by ISO 639-1 for the two-letter language code. * For example, "ko_KR" for Korean, "en_US" for American English @@ -189,7 +189,7 @@ typedef bool (*vc_supported_language_cb)(const char* language, void* user_data); /** * @brief Called when the state of voice control client is changed. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] previous A previous state * @param[in] current A current state * @param[in] user_data The user data passed from the callback registration function @@ -201,7 +201,7 @@ typedef void (*vc_state_changed_cb)(vc_state_e previous, vc_state_e current, voi /** * @brief Called when the state of voice control service is changed. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] previous A previous state * @param[in] current A current state * @param[in] user_data The user data passed from the callback registration function @@ -213,7 +213,7 @@ typedef void (*vc_service_state_changed_cb)(vc_service_state_e previous, vc_serv /** * @brief Called when error occurred. - * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif + * @since_tizen 2.4 * @param[in] reason The error type (e.g. #VC_ERROR_OUT_OF_MEMORY, #VC_ERROR_TIMED_OUT) * @param[in] user_data The user data passed from the callback registration function * @pre An application registers this callback to detect error. diff --git a/include/voice_control_setting.h b/include/voice_control_setting.h index 89ae6fa..89b9bd7 100644 --- a/include/voice_control_setting.h +++ b/include/voice_control_setting.h @@ -79,7 +79,7 @@ typedef void (*vc_setting_engine_changed_cb)(const char* engine_id, void *user_d /** * @brief Called to retrieve supported language. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] language A language is specified as an ISO 3166 alpha-2 two letter country-code \n * followed by ISO 639-1 for the two-letter language code. \n @@ -94,7 +94,7 @@ typedef bool(*vc_setting_supported_language_cb)(const char* language, void* user /** * @brief Called when default language is changed. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 * * @param[in] previous Previous language * @param[in] current Current language diff --git a/include/voice_control_widget.h b/include/voice_control_widget.h index 93c3e4c..8766f6b 100644 --- a/include/voice_control_widget.h +++ b/include/voice_control_widget.h @@ -37,7 +37,7 @@ extern "C" /** * @brief Definitions for widget command type. -* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif +* @since_tizen 2.4 */ #define VC_COMMAND_TYPE_WIDGET 3 -- 2.7.4