From: Suyeon Hwang Date: Thu, 13 Jul 2023 09:04:44 +0000 (+0900) Subject: Refactor unit tests with utility class X-Git-Tag: accepted/tizen/unified/20230803.174839~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=37cebfaf189cd591b2805ce51a57d2c40a2a47b4;p=platform%2Fcore%2Fuifw%2Fvoice-control.git 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 --- 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); }