Add test case for checking callback invocation 80/286180/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Mon, 14 Nov 2022 12:07:00 +0000 (21:07 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Fri, 30 Dec 2022 01:31:53 +0000 (10:31 +0900)
- Issue:
There is no test case for checking whether the callbacks which are set
by manager is invoked.

- Solution:
The voice control framework provides manager API for sending pcm data as
recording data. Using this APIs, we can simulate the situation that the
user says something. Thus, we can make new test case in this situation.
And also, using app manager framework, we can make situation that the
engine is suddenly terminate.
Using these simulation, this patch creates new test cases for checking
whether the callback is invoked. Through this patch, developer can check
some callbacks are properly invoked in proper situation.

Change-Id: I42d4167c1d6dc33b67858e309264a542032f5f3e
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
tests/CMakeLists.txt
tests/org.tizen.vc-unittests.xml
tests/res/test_pcm.dat [new file with mode: 0644]
tests/src/vc_mgr_unittests.cpp

index 36c8d35..bec7880 100644 (file)
@@ -31,6 +31,7 @@ ADD_EXECUTABLE(${UNITTEST_VC}
 
 TARGET_LINK_LIBRARIES(${UNITTEST_VC} vc -ldl ${pkgs_LDFLAGS})
 TARGET_LINK_LIBRARIES(${UNITTEST_VC} vc_manager -ldl ${pkgs_LDFLAGS})
+TARGET_LINK_LIBRARIES(${UNITTEST_VC} vc_setting -ldl ${pkgs_LDFLAGS})
 TARGET_LINK_LIBRARIES(${UNITTEST_VC} ${GTEST_LIBRARIES} ${pkgs_LDFLAGS} ${EXTRA_LDFLAGS})
 SET_TARGET_PROPERTIES(${UNITTEST_VC} PROPERTIES
        COMPILE_FLAGS "-fPIE"
@@ -46,4 +47,5 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/tests/${PKGNAME}.xml DESTINATION ${TZ_SYS_RO_P
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/tests/res/test_command.json DESTINATION ${RESDIR})
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/tests/res/test_demandable_list.xml DESTINATION ${RESDIR})
 INSTALL(FILES ${CMAKE_SOURCE_DIR}/tests/res/empty_file DESTINATION ${RESDIR})
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/tests/res/test_pcm.dat DESTINATION ${RESDIR})
 INSTALL(TARGETS ${UNITTEST_VC} DESTINATION ${BINDIR})
index 18556d0..8c69747 100644 (file)
@@ -12,6 +12,7 @@
             <privilege>http://tizen.org/privilege/recorder</privilege>
             <privilege>http://tizen.org/privilege/voicecontrol.manager</privilege>
             <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+            <privilege>http://tizen.org/privilege/appmanager.kill</privilege>
             <privilege>http://tizen.org/privilege/datasharing</privilege>
             <privilege>http://tizen.org/privilege/volume.set</privilege>
         </privileges>
diff --git a/tests/res/test_pcm.dat b/tests/res/test_pcm.dat
new file mode 100644 (file)
index 0000000..44231cd
Binary files /dev/null and b/tests/res/test_pcm.dat differ
index ae804c2..8711dbd 100644 (file)
 #include <Ecore.h>
 #include <system_info.h>
 #include <tzplatform_config.h>
+#include <vconf.h>
+#include <app_manager_extension.h>
 
 #include <voice_control_manager.h>
 #include <voice_control_manager_internal.h>
+#include <voice_control_setting.h>
 #include "system_info_mock.h"
 #include "cynara_mock.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)
 {
@@ -74,7 +89,9 @@ static void __vc_mgr_specific_engine_result_cb(const char* engine_app_id, const
 
 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;
+       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)
@@ -83,10 +100,12 @@ static void __vc_mgr_pre_result_cb(vc_pre_result_event_e event, const char *resu
 
 static void __vc_mgr_result_cb(vc_result_event_e event, vc_cmd_list_h vc_cmd_list, const char* result, 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)
@@ -132,6 +151,11 @@ static void __vc_mgr_service_state_changed_cb(vc_service_state_e previous, vc_se
 
 static void __vc_mgr_error_cb(vc_error_e reason, 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)
@@ -153,17 +177,6 @@ static vc_cmd_list_h __create_test_command_list()
        return commands;
 }
 
-static void __initialize_ecore()
-{
-       ecore_init();
-       ecore_main_loop_glib_integrate();
-}
-
-static void __shutdown_ecore()
-{
-       ecore_shutdown();
-}
-
 static bool __is_vc_mgr_supported()
 {
        bool is_vc_supported = false;
@@ -186,22 +199,169 @@ static bool __is_vc_mgr_supported()
        return false;
 }
 
+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++;
+       }
+
+       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++;
+       }
+
+       return g_result_cb_invoked;
+}
+
+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++;
+       }
+
+       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++;
+       }
+
+       return g_error_cb_invoked;
+}
+
+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;
+       }
+
+       fseek(fp_in, 0, SEEK_END);
+       long size = ftell(fp_in);
+       fseek(fp_in, 0, SEEK_SET);
+       if (size <= 0) {
+               fclose(fp_in);
+               return;
+       }
+
+       unsigned char* data = (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);
+
+       if (read_size <= 0) {
+               free(data);
+               return;
+       }
+
+       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);
+
+       __get_test_PCM_data();
+       ASSERT_NE(g_pcm_data, nullptr);
+       ASSERT_GT(g_pcm_size, 0);
+
+       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);
+               }
+       }
+
+       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_ecore();
-                       g_vc_mgr_state = VC_STATE_NONE;
-                       g_vc_mgr_service_state = VC_SERVICE_STATE_NONE;
+                       __initialize_test_environment();
                        __is_feature_supported = __is_vc_mgr_supported();
                }
 
                virtual void TearDown()
                {
                        vc_mgr_deinitialize();
-                       __shutdown_ecore();
+                       __shutdown_test_environment();
                }
 
        public:
@@ -212,9 +372,7 @@ class VcMgrTestInInitializedState : public testing::Test {
        public:
                virtual void SetUp()
                {
-                       __initialize_ecore();
-                       g_vc_mgr_state = VC_STATE_NONE;
-                       g_vc_mgr_service_state = VC_SERVICE_STATE_NONE;
+                       __initialize_test_environment();
                        __is_feature_supported = __is_vc_mgr_supported();
 
                        EXPECT_EQ(vc_mgr_initialize(), VC_ERROR_NONE);
@@ -229,7 +387,7 @@ class VcMgrTestInInitializedState : public testing::Test {
                        EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_NONE);
                        EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE);
 
-                       __shutdown_ecore();
+                       __shutdown_test_environment();
                }
 
        public:
@@ -240,14 +398,13 @@ class VcMgrTestInReadyState : public testing::Test {
        public:
                virtual void SetUp()
                {
-                       __initialize_ecore();
-                       g_vc_mgr_state = VC_STATE_NONE;
-                       g_vc_mgr_service_state = VC_SERVICE_STATE_NONE;
+                       __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));
@@ -260,7 +417,7 @@ class VcMgrTestInReadyState : public testing::Test {
                        EXPECT_EQ(vc_mgr_unset_service_state_changed_cb(), VC_ERROR_NONE);
                        EXPECT_EQ(vc_mgr_deinitialize(), VC_ERROR_NONE);
 
-                       __shutdown_ecore();
+                       __shutdown_test_environment();
                }
 
        public:
@@ -900,7 +1057,7 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_current_commands_n2)
  * @since_tizen                5.0
  * @description                Positive UTC for set audio type
  */
-TEST_F(VcMgrTestInReadyState, vc_set_result_cb_p)
+TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_audio_type_p)
 {
        const char *audioType = "audio_id";
        if (false == __is_feature_supported) {
@@ -1577,6 +1734,29 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_all_result_cb_p)
 }
 
 /**
+ * @testcase           utc_vc_mgr_set_all_result_cb_p2
+ * @since_tizen                5.0
+ * @description                Positive UTC for 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);
+               return;
+       }
+
+       EXPECT_EQ(vc_mgr_set_all_result_cb(__vc_mgr_all_result_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);
+
+       __test_voice_recording();
+
+       EXPECT_EQ(__is_all_result_cb_invoked(5), true);
+}
+
+/**
  * @testcase           utc_vc_mgr_set_all_result_cb_n1
  * @since_tizen                5.0
  * @description                Negative UTC for set all result callback
@@ -1802,6 +1982,31 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_result_cb_p)
 }
 
 /**
+ * @testcase           utc_vc_mgr_set_result_cb_p2
+ * @since_tizen                5.0
+ * @description                Positive UTC for 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);
+               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);
+
+       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);
+
+       __test_voice_recording();
+
+       EXPECT_EQ(__is_result_cb_invoked(5), true);
+}
+
+/**
  * @testcase           utc_vc_mgr_set_result_cb_n1
  * @since_tizen                5.0
  * @description                Negative UTC for set result callback
@@ -2027,6 +2232,29 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_speech_detected_cb_p)
 }
 
 /**
+ * @testcase           utc_vc_mgr_set_speech_detected_cb_p2
+ * @since_tizen                5.0
+ * @description                Positive UTC for 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);
+               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);
+
+       __test_voice_recording();
+
+       EXPECT_EQ(__is_speech_detected_cb_invoked(5), true);
+}
+
+/**
  * @testcase           utc_vc_mgr_set_speech_detected_cb_n1
  * @since_tizen                5.0
  * @description                Negative UTC for set speech detected callback
@@ -2162,6 +2390,38 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_unset_current_language_changed_cb_n)
 }
 
 /**
+ * @testcase           utc_vc_mgr_get_error_message_p
+ * @since_tizen                5.0
+ * @description                Positive UTC for get error message
+ */
+TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_get_error_message_p)
+{
+       if (false == __is_feature_supported) {
+               EXPECT_EQ(vc_mgr_set_error_cb(__vc_mgr_error_cb, nullptr), 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(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);
+}
+
+/**
  * @testcase           utc_vc_mgr_get_error_message_n1
  * @since_tizen                5.0
  * @description                Negative UTC for get error message
@@ -2224,6 +2484,37 @@ TEST_F(VcMgrTestInInitializedState, utc_vc_mgr_set_error_cb_p)
 }
 
 /**
+ * @testcase           utc_vc_mgr_set_error_cb_p2
+ * @since_tizen                5.0
+ * @description                Positive UTC for 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);
+               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(app_manager_terminate_app(context), APP_MANAGER_ERROR_NONE);
+       app_context_destroy(context);
+
+       EXPECT_EQ(__is_error_cb_invoked(5), true);
+}
+
+/**
  * @testcase           utc_vc_mgr_set_error_cb_n1
  * @since_tizen                5.0
  * @description                Negative UTC for set error callback
@@ -3183,6 +3474,24 @@ TEST_F(VcMgrTestInNoneState, utc_vc_mgr_reset_background_volume_n)
 }
 
 /**
+ * @testcase           utc_vc_mgr_set_selected_results_p
+ * @since_tizen                5.0
+ * @description                Positive UTC for set selected results
+ */
+TEST_F(VcMgrTestInReadyState, utc_vc_mgr_set_selected_results_p)
+{
+       if (false == __is_feature_supported) {
+               EXPECT_EQ(vc_mgr_set_selected_results(g_test_commands), VC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       __test_voice_recording();
+
+       EXPECT_EQ(__is_all_result_cb_invoked(5), true);
+       EXPECT_EQ(g_set_selected_result_return, VC_ERROR_NONE);
+}
+
+/**
  * @testcase           utc_vc_mgr_set_selected_results_n1
  * @since_tizen                5.0
  * @description                Negative UTC for set selected results