From: Nibha Sharma Date: Mon, 20 Sep 2021 11:02:47 +0000 (+0530) Subject: [ITC][webrtc][ACR-1637,ACR-1660][Added new module webrtc apis and callbacks in ITC] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=58a3de4dba14e3c177f4a5a7d7f7ada971eb65a4;p=test%2Ftct%2Fnative%2Fapi.git [ITC][webrtc][ACR-1637,ACR-1660][Added new module webrtc apis and callbacks in ITC] Change-Id: I9be7764282d514cce06db2375d6204c6e19b0d83 Signed-off-by: Nibha Sharma --- diff --git a/packaging/itc/native-webrtc-itc.xml b/packaging/itc/native-webrtc-itc.xml new file mode 100755 index 000000000..3bb52d4cc --- /dev/null +++ b/packaging/itc/native-webrtc-itc.xml @@ -0,0 +1,21 @@ + + + + test + Native API test Application + + + + + + + + + + http://tizen.org/privilege/externalstorage + http://tizen.org/privilege/mediastorage + http://tizen.org/privilege/internet + http://tizen.org/privilege/camera + http://tizen.org/privilege/recorder + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c4a73c410..d2bf41ef9 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -307,6 +307,8 @@ ELSE( DEFINED MODULE ) ADD_SUBDIRECTORY(itc/wav-player) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/webkit2") ADD_SUBDIRECTORY(itc/webkit2) + MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/webrtc") + ADD_SUBDIRECTORY(itc/webrtc) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/wifi-direct") ADD_SUBDIRECTORY(itc/wifi-direct) MESSAGE(STATUS "Building: ${CMAKE_CURRENT_SOURCE_DIR}/itc/wifi") diff --git a/src/itc/webrtc/CMakeLists.txt b/src/itc/webrtc/CMakeLists.txt new file mode 100755 index 000000000..cd72ae32f --- /dev/null +++ b/src/itc/webrtc/CMakeLists.txt @@ -0,0 +1,43 @@ +SET(PKG_NAME "webrtc") + +SET(EXEC_NAME "tct-${PKG_NAME}-native") +SET(RPM_NAME "native-${PKG_NAME}-itc") + +SET(CAPI_LIB "webrtc") +SET(TC_SOURCES + ITs-webrtc-common.c + ITs-webrtc.c + ITs-webrtc_callback.c +) + +PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED + ${CAPI_LIB} + capi-appfw-application + glib-2.0 + bundle + capi-system-info + dlog + elementary +) + +INCLUDE_DIRECTORIES( + ${${CAPI_LIB}_INCLUDE_DIRS} +) + +ADD_EXECUTABLE(${EXEC_NAME} ${EXEC_NAME}.c ${TC_SOURCES} ${COMMON_FILE}) +TARGET_LINK_LIBRARIES(${EXEC_NAME} + ${${CAPI_LIB}_LIBRARIES} + bundle +) + +INSTALL(PROGRAMS ${EXEC_NAME} + DESTINATION ${BIN_DIR}/${RPM_NAME}/bin +) + +IF( DEFINED ASAN ) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -pie -g -fsanitize=address -fsanitize-recover=address -U_FORTIFY_SOURCE -fno-omit-frame-pointer") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -Wl,-fsanitize=address") +ELSE() +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIE -Wall") +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib -pie") +ENDIF() diff --git a/src/itc/webrtc/ITs-webrtc-common.c b/src/itc/webrtc/ITs-webrtc-common.c new file mode 100755 index 000000000..ed2e16bf1 --- /dev/null +++ b/src/itc/webrtc/ITs-webrtc-common.c @@ -0,0 +1,68 @@ +// +// Copyright (c) 2021 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 "ITs-webrtc-common.h" + +/** @addtogroup itc-webrtc +* @ingroup itc +* @{ +*/ + +//Add helper function definitions here + +/** +* @function WebRtcGetError +* @description Maps webrtc_error_e enums +* @parameter error : error level +* @return error string +*/ +char* WebRtcGetError(int nErrorType) +{ + char *szErrorVal = "Unknown Error"; + switch ( nErrorType ) + { + case WEBRTC_ERROR_NONE: szErrorVal = "WEBRTC_ERROR_NONE"; break; + case WEBRTC_ERROR_NOT_SUPPORTED: szErrorVal = "WEBRTC_ERROR_NOT_SUPPORTED"; break; + case WEBRTC_ERROR_PERMISSION_DENIED: szErrorVal = "WEBRTC_ERROR_PERMISSION_DENIED"; break; + case WEBRTC_ERROR_INVALID_PARAMETER: szErrorVal = "WEBRTC_ERROR_INVALID_PARAMETER"; break; + case WEBRTC_ERROR_INVALID_OPERATION: szErrorVal = "WEBRTC_ERROR_INVALID_OPERATION"; break; + case WEBRTC_ERROR_INVALID_STATE: szErrorVal = "WEBRTC_ERROR_INVALID_STATE"; break; + case WEBRTC_ERROR_CONNECTION_FAILED: szErrorVal = "WEBRTC_ERROR_CONNECTION_FAILED"; break; + case WEBRTC_ERROR_STREAM_FAILED: szErrorVal = "WEBRTC_ERROR_STREAM_FAILED"; break; + case WEBRTC_ERROR_RESOURCE_FAILED: szErrorVal = "WEBRTC_ERROR_RESOURCE_FAILED"; break; + case WEBRTC_ERROR_RESOURCE_CONFLICT: szErrorVal = "WEBRTC_ERROR_RESOURCE_CONFLICT"; break; + } + + return szErrorVal; +} + +/** +* @function Timeout +* @description Called if some callback is not invoked for a particular timeout +* @parameter gpointer data +* @return gboolean +*/ +gboolean Timeout(gpointer data) +{ + GMainLoop *pMainLoop = NULL; + pMainLoop = (GMainLoop *)data; + if ( pMainLoop != NULL ) + { + g_main_loop_quit(pMainLoop); + } + FPRINTF("[Line : %d][%s] Callback Timeout\\n", __LINE__, API_NAMESPACE); + return false; +} +/** @} */ diff --git a/src/itc/webrtc/ITs-webrtc-common.h b/src/itc/webrtc/ITs-webrtc-common.h new file mode 100755 index 000000000..2ac1b7a36 --- /dev/null +++ b/src/itc/webrtc/ITs-webrtc-common.h @@ -0,0 +1,72 @@ +// +// Copyright (c) 2021 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 _ITS_WEBRTC_COMMON_H_ +#define _ITS_WEBRTC_COMMON_H_ + +//Add test package related includes here +#include "tct_common.h" +#include +#include +#include + +/** @addtogroup itc-%{MODULE_NAME} +* @ingroup itc +* @{ +*/ +//Add helper function defines here +#define API_NAMESPACE "WEBRTC_ITC" +#define TIMEOUT_CB 10000 +//Add helper function declarations here + +#define START_TEST {\ + FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\ + if ( !g_bWebRTCCreation )\ +{\ + FPRINTF("[Line : %d][%s] Precondition of webrtc failed so leaving test\\n", __LINE__, API_NAMESPACE);\ + return 1;\ +}\ +} + + +#define RUN_POLLING_LOOP {\ + if(g_bCallbackCalled == false)\ + {\ + g_pMainLoop = g_main_loop_new(NULL, false);\ + g_nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_pMainLoop);\ + g_main_loop_run(g_pMainLoop);\ + g_source_remove(g_nTimeoutId);\ + g_pMainLoop = NULL;\ + }\ +} + +#define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\ + if ( Handle == NULL )\ + {\ + FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ + FreeResource;\ + return 1;\ + }\ +} +bool g_bWebRTCCreation; +webrtc_h g_hWebRtcHandle; +int g_nTimeoutId; +static GMainLoop *g_pMainLoop = NULL; +bool g_bCallbackCalled; +bool g_bCallbackSessionCalled; +gboolean Timeout(gpointer data); +char* WebRtcGetError(int nErrorType); +/** @} */ +#endif //_ITS_WEBRTC_COMMON_H_ diff --git a/src/itc/webrtc/ITs-webrtc.c b/src/itc/webrtc/ITs-webrtc.c new file mode 100755 index 000000000..91309132a --- /dev/null +++ b/src/itc/webrtc/ITs-webrtc.c @@ -0,0 +1,1480 @@ +// +// Copyright (c) 2021 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. +// + +#define TEST_DATA_CHANNEL_LABEL "test data channel" +#define TEST_STRING_DATA "test string" +#define TEST_BUFFER_SIZE 16 +#include "ITs-webrtc-common.h" + +//& set: Webrtc + +/** @addtogroup itc-webrtc +* @ingroup itc +* @{ +*/ +#define TEST_ICE_CANDIDATE "{'ice':{'candidate':'candidate:3600539631 1 tcp 1518149375 192.168.0.127 9 typ host tcptype active generation 0 ufrag l4kk network-id 3 network-cost 10','sdpMid':'video0','sdpMLineIndex':0}}" + +/** +* @function webrtcSessionDescriptionCreatedCB +* @parameter webrtc_h webrtc, const char *description, void *user_data +* @return NA +*/ +static void webrtcSessionDescriptionCreatedCB(webrtc_h webrtc, const char *description, void *user_data) +{ + g_bCallbackSessionCalled = true; + FPRINTF("[Line : %d][%s] Callback webrtcSessionDescriptionCreatedCB called\\n", __LINE__, API_NAMESPACE); + if (g_pMainLoop ) + { + g_main_loop_quit(g_pMainLoop); + g_pMainLoop = NULL; + } +} + +/** +* @function webrtcMediaPacketSourceBufferStateChangedCB +* @parameter unsigned int source_id, webrtc_media_packet_source_buffer_state_e state, void *user_data +* @return NA +*/ +static void webrtcMediaPacketSourceBufferStateChangedCB(unsigned int source_id, webrtc_media_packet_source_buffer_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcMediaPacketSourceBufferStateChangedCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcIceCandidateCB +* @parameter webrtc_h webrtc, const char *candidate, void *user_data +* @return NA +*/ +static void webrtcIceCandidateCB(webrtc_h webrtc, const char *candidate, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcIceCandidateCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcStateChangedCB +* @parameter webrtc_h webrtc, webrtc_state_e previous, webrtc_state_e current, void *user_data +* @return NA +*/ +static void webrtcStateChangedCB(webrtc_h webrtc, webrtc_state_e previous, webrtc_state_e current, void *user_data) +{ + g_bCallbackCalled = true; + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB called\\n", __LINE__, API_NAMESPACE); + if (g_pMainLoop ) + { + g_main_loop_quit(g_pMainLoop); + g_pMainLoop = NULL; + } +} + +/** +* @function webrtcSignalingStateChangeCB +* @parameter webrtc_h webrtc, webrtc_signaling_state_e state, void *user_data +* @return NA +*/ +static void webrtcSignalingStateChangeCB(webrtc_h webrtc, webrtc_signaling_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcSignalingStateChangeCB called\\n", __LINE__, API_NAMESPACE); + if (g_pMainLoop ) + { + g_main_loop_quit(g_pMainLoop); + g_pMainLoop = NULL; + } +} + +/** +* @function webrtcTurnServerCB +* @parameter const char *turn_server, void *user_data +* @return NA +*/ +static bool webrtcTurnServerCB(const char *turn_server, void *user_data) +{ + int *nCount = (int*)user_data; + FPRINTF("[Line : %d][%s] Callback webrtcTurnServerCB called\\n", __LINE__, API_NAMESPACE); + (*nCount)--; + + return true; +} + +/** +* @function webrtcDataChannelOpenCB +* @parameter webrtc_data_channel_h channel, void *user_data +* @return NA +*/ +static void webrtcDataChannelOpenCB(webrtc_data_channel_h channel, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcDataChannelOpenCB called\\n", __LINE__, API_NAMESPACE); +} +/** + * @function ITs_webrtc_startup + * @description Called before each test + * @parameter NA + * @return NA + */ +void ITs_webrtc_startup(void) +{ + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } + g_bWebRTCCreation = false; + int nRet = webrtc_create(&g_hWebRtcHandle); + if( nRet != WEBRTC_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] webrtc_create api failed!!!\\n", __LINE__, API_NAMESPACE); + return; + } + if(g_hWebRtcHandle == NULL) + { + FPRINTF("[Line : %d][%s] g_hWebRtcHandle is NULL!!!\\n", __LINE__, API_NAMESPACE); + return; + } + g_bWebRTCCreation = true; + + return; +} + + +/** + * @function ITs_webrtc_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ +void ITs_webrtc_cleanup(void) +{ + if(g_hWebRtcHandle) + { + int nRet = webrtc_destroy(g_hWebRtcHandle); + if( nRet != WEBRTC_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] webrtc_destroy api failed!!!\\n", __LINE__, API_NAMESPACE); + } + } + return; +} + +//& purpose: Creates and Destroy an instance of WebRTC +//& type: auto +/** +* @testcase ITc_webrtc_create_destroy_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates and Destroy an instance of WebRTC +* @scenario Creates and Destroy an instance of WebRTC +* @apicovered webrtc_create,webrtc_destroy +* @passcase If webrtc_create,webrtc_destroy is successfull +* @failcase If webrtc_create,webrtc_destroy fails +* @precondition NA +* @postcondition NA +*/ +int ITc_webrtc_create_destroy_p(void) +{ + START_TEST; + + int nRet = webrtc_destroy(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy", WebRtcGetError(nRet)); + + nRet = webrtc_create(&g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create", WebRtcGetError(nRet)); + CHECK_HANDLE(g_hWebRtcHandle, "webrtc_create"); + + nRet = webrtc_destroy(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy", WebRtcGetError(nRet)); + + nRet = webrtc_create(&g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create", WebRtcGetError(nRet)); + CHECK_HANDLE(g_hWebRtcHandle, "webrtc_create"); + + return 0; +} + +//& purpose: Starts and Stops the WebRTC. +//& type: auto +/** +* @testcase ITc_webrtc_start_stop_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Starts and Stops the WebRTC. +* @scenario Starts and Stops the WebRTC. +* @apicovered webrtc_start,webrtc_stop +* @passcase If webrtc_start,webrtc_stop is successfull +* @failcase If webrtc_start,webrtc_stop fails +* @precondition NA +* @postcondition NA +*/ +int ITc_webrtc_start_stop_p(void) +{ + START_TEST; + + g_bCallbackCalled = false; + int nTimeoutId = -1; + + int nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "webrtc_set_state_changed_cb"); + webrtc_stop(g_hWebRtcHandle); + return 1; + } + + nRet = webrtc_stop(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Gets the WebRTC state. +//& type: auto +/** +* @testcase ITc_media_webrtc_get_state_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets the WebRTC state. +* @scenario Gets the WebRTC state. +* @apicovered webrtc_get_state +* @passcase If webrtc_get_state is successfull +* @failcase If webrtc_get_state fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_get_state_p(void) +{ + START_TEST; + webrtc_state_e eGetState; + + int nRet = webrtc_get_state(g_hWebRtcHandle, &eGetState); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_state", WebRtcGetError(nRet)); + if(eGetState != WEBRTC_STATE_IDLE) + { + FPRINTF("[Line : %d][%s] eGetState is not idle\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Adds and Removes a media source. +//& type: auto +/** +* @testcase ITc_media_webrtc_add_remove_media_source_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Adds and Removes a media source. +* @scenario Adds and Removes a media source. +* @apicovered webrtc_add_media_source, webrtc_remove_media_source +* @passcase If webrtc_add_media_source, webrtc_remove_media_source is successfull +* @failcase If webrtc_add_media_source,webrtc_remove_media_source fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_add_remove_media_source_p(void) +{ + START_TEST; + unsigned int nId; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_remove_media_source(g_hWebRtcHandle, nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_remove_media_source", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Gets the peer connection state. +//& type: auto +/** +* @testcase ITc_media_webrtc_get_peer_connection_state_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets the peer connection state. +* @scenario Gets the peer connection state. +* @apicovered webrtc_get_peer_connection_state +* @passcase If webrtc_get_peer_connection_state is successfull +* @failcase If webrtc_get_peer_connection_state fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_get_peer_connection_state_p(void) +{ + START_TEST; + webrtc_peer_connection_state_e eState; + + int nRet = webrtc_get_peer_connection_state(g_hWebRtcHandle, &eState); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_peer_connection_state", WebRtcGetError(nRet)); + if(eState != WEBRTC_PEER_CONNECTION_STATE_NEW) + { + FPRINTF("[Line : %d][%s] eState is not new\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Gets the signaling state. +//& type: auto +/** +* @testcase ITc_media_webrtc_get_signaling_state_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets the signaling state. +* @scenario Gets the signaling state. +* @apicovered webrtc_get_signaling_state +* @passcase If webrtc_get_signaling_state is successfull +* @failcase If webrtc_get_signaling_state fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_get_signaling_state_p(void) +{ + START_TEST; + webrtc_signaling_state_e eState; + + int nRet = webrtc_get_signaling_state(g_hWebRtcHandle, &eState); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_signaling_state", WebRtcGetError(nRet)); + if(eState != WEBRTC_SIGNALING_STATE_STABLE) + { + FPRINTF("[Line : %d][%s] eState is not stable\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Gets the ICE gathering state. +//& type: auto +/** +* @testcase ITc_media_webrtc_get_ice_gathering_state_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets the ICE gathering state. +* @scenario Gets the ICE gathering state. +* @apicovered webrtc_get_ice_gathering_state +* @passcase If webrtc_get_ice_gathering_state is successfull +* @failcase If webrtc_get_ice_gathering_state fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_get_ice_gathering_state_p(void) +{ + START_TEST; + webrtc_ice_gathering_state_e eState; + + int nRet = webrtc_get_ice_gathering_state(g_hWebRtcHandle, &eState); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_ice_gathering_state", WebRtcGetError(nRet)); + if(eState != WEBRTC_ICE_GATHERING_STATE_NEW) + { + FPRINTF("[Line : %d][%s] eState is not new\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Gets the ICE connection state +//& type: auto +/** +* @testcase ITc_media_webrtc_get_ice_connection_state_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets the ICE connection state +* @scenario Gets the ICE connection state +* @apicovered webrtc_get_ice_connection_state +* @passcase If webrtc_get_ice_connection_state is successfull +* @failcase If webrtc_get_ice_connection_state fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_get_ice_connection_state_p(void) +{ + START_TEST; + webrtc_ice_connection_state_e eState; + + int nRet = webrtc_get_ice_connection_state(g_hWebRtcHandle, &eState); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_ice_connection_state", WebRtcGetError(nRet)); + if(eState != WEBRTC_ICE_CONNECTION_STATE_NEW) + { + FPRINTF("[Line : %d][%s] eState is not new\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Sets and Gets the transceiver direction to the media source with specified media type. +//& type: auto +/** +* @testcase ITc_media_webrtc_media_source_set_get_transceiver_direction_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Gets the transceiver direction to the media source with specified media type. +* @scenario Sets and Gets the transceiver direction to the media source with specified media type. +* @apicovered webrtc_media_source_set_transceiver_direction,webrtc_media_source_get_transceiver_direction +* @passcase If webrtc_media_source_set_transceiver_direction,webrtc_media_source_get_transceiver_direction is successfull +* @failcase If webrtc_media_source_set_transceiver_direction,webrtc_media_source_get_transceiver_direction fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_media_source_set_get_transceiver_direction_p(void) +{ + START_TEST; + unsigned int nId; + webrtc_transceiver_direction_e eGetDirection; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_set_transceiver_direction(g_hWebRtcHandle, nId, WEBRTC_MEDIA_TYPE_AUDIO, WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_transceiver_direction", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_get_transceiver_direction(g_hWebRtcHandle, nId, WEBRTC_MEDIA_TYPE_AUDIO, &eGetDirection); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_get_transceiver_direction", WebRtcGetError(nRet)); + if(eGetDirection != WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY) + { + FPRINTF("[Line : %d][%s] direction set get mismatch\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Sets and Gets pause to the media source. +//& type: auto +/** +* @testcase ITc_media_webrtc_media_source_set_get_pause_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Gets pause to the media source. +* @scenario Sets and Gets pause to the media source. +* @apicovered webrtc_media_source_set_pause,webrtc_media_source_get_pause +* @passcase If webrtc_media_source_set_pause,webrtc_media_source_get_pause is successfull +* @failcase If webrtc_media_source_set_pause,webrtc_media_source_get_pause fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_media_source_set_get_pause_p(void) +{ + START_TEST; + unsigned int nId; + bool bGetPause, bSetPause = true; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_set_pause(g_hWebRtcHandle, nId, WEBRTC_MEDIA_TYPE_AUDIO, bSetPause); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_pause", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_get_pause(g_hWebRtcHandle, nId, WEBRTC_MEDIA_TYPE_AUDIO, &bGetPause); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_get_pause", WebRtcGetError(nRet)); + if(bSetPause != bGetPause) + { + FPRINTF("[Line : %d][%s] pause set get mismatch\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Sets and Gets mute to the media source. +//& type: auto +/** +* @testcase ITc_media_webrtc_media_source_set_get_mute_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Gets mute to the media source. +* @scenario Sets and Gets mute to the media source. +* @apicovered webrtc_media_source_set_mute,webrtc_media_source_get_mute +* @passcase If webrtc_media_source_set_mute,webrtc_media_source_get_mute is successfull +* @failcase If webrtc_media_source_set_mute,webrtc_media_source_get_mute fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_media_source_set_get_mute_p(void) +{ + START_TEST; + unsigned int nId; + bool bGetMute, bSetMute = true; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_set_mute(g_hWebRtcHandle, nId, WEBRTC_MEDIA_TYPE_VIDEO, bSetMute); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_mute", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_get_mute(g_hWebRtcHandle, nId, WEBRTC_MEDIA_TYPE_VIDEO, &bGetMute); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_get_mute", WebRtcGetError(nRet)); + if(bSetMute != bGetMute) + { + FPRINTF("[Line : %d][%s] mute set get mismatch\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Sets and Gets the video resolution of the media source. +//& type: auto +/** +* @testcase ITc_media_webrtc_media_source_set_get_video_resolution_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Gets the video resolution of the media source. +* @scenario Sets and Gets the video resolution of the media source. +* @apicovered webrtc_media_source_set_video_resolution,webrtc_media_source_get_video_resolution +* @passcase If webrtc_media_source_set_video_resolution,webrtc_media_source_get_video_resolution is successfull +* @failcase If webrtc_media_source_set_video_resolution,webrtc_media_source_get_video_resolution fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_media_source_set_get_video_resolution_p(void) +{ + START_TEST; + unsigned int nId; + int nSetWidth = 640, nSetHeight = 640; + int nGetHeight, nGetWidth; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_set_video_resolution(g_hWebRtcHandle, nId, nSetWidth, nSetHeight); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_resolution", WebRtcGetError(nRet)); + + nRet = webrtc_media_source_get_video_resolution(g_hWebRtcHandle, nId, &nGetWidth, &nGetHeight); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_get_video_resolution", WebRtcGetError(nRet)); + if(nSetWidth != nGetWidth) + { + FPRINTF("[Line : %d][%s] width set get mismatch\\n", __LINE__, API_NAMESPACE); + return 1; + } + if(nSetHeight != nGetHeight) + { + FPRINTF("[Line : %d][%s] height set get mismatch\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Sets the mic source's sound manager stream information. +//& type: auto +/** +* @testcase ITc_media_webrtc_mic_source_set_sound_stream_info_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets the mic source's sound manager stream information. +* @scenario Sets the mic source's sound manager stream information. +* @apicovered webrtc_mic_source_set_sound_stream_info +* @passcase If webrtc_mic_source_set_sound_stream_info is successfull +* @failcase If webrtc_mic_source_set_sound_stream_info fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_mic_source_set_sound_stream_info_p(void) +{ + START_TEST; + unsigned int nId; + sound_stream_info_h hStreamInfo; + + int nRet = sound_manager_create_stream_information(SOUND_STREAM_TYPE_MEDIA, NULL, NULL, &hStreamInfo); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "sound_manager_create_stream_information", WebRtcGetError(nRet)); + CHECK_HANDLE(hStreamInfo, "sound_manager_create_stream_information"); + + nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet),sound_manager_destroy_stream_information(hStreamInfo)); + + nRet = webrtc_mic_source_set_sound_stream_info(g_hWebRtcHandle, nId, hStreamInfo); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_mic_source_set_sound_stream_info", WebRtcGetError(nRet),sound_manager_destroy_stream_information(hStreamInfo)); + + nRet = sound_manager_destroy_stream_information(hStreamInfo); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "sound_manager_destroy_stream_information", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets media format to the media packet source. +//& type: auto +/** +* @testcase ITc_media_webrtc_media_packet_source_set_format_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets media format to the media packet source. +* @scenario Sets media format to the media packet source. +* @apicovered webrtc_media_packet_source_set_format +* @passcase If webrtc_media_packet_source_set_format is successfull +* @failcase If webrtc_media_packet_source_set_format fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_media_packet_source_set_format_p(void) +{ + START_TEST; + unsigned int nId; + media_format_h hMediaFormat; + int nChannel = 1, nSampleRate = 8000 , nAudioBit = 16; + + int nRet = media_format_create(&hMediaFormat); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "media_format_create", WebRtcGetError(nRet)); + CHECK_HANDLE(hMediaFormat, "media_format_create"); + + nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, &nId); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = media_format_set_audio_mime(hMediaFormat, MEDIA_FORMAT_PCM_S16LE); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_format_set_audio_mime", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet |= media_format_set_audio_channel(hMediaFormat, nChannel); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_format_set_audio_channel", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet |= media_format_set_audio_samplerate(hMediaFormat, nSampleRate); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_format_set_audio_samplerate", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet |= media_format_set_audio_bit(hMediaFormat, nAudioBit); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_format_set_audio_bit", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = webrtc_media_packet_source_set_format(g_hWebRtcHandle, nId, hMediaFormat); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_set_format", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = media_format_unref(hMediaFormat); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "media_format_unref", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Pushes media packet to the media packet source. +//& type: auto +/** +* @testcase ITc_media_webrtc_media_packet_source_push_packet_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Pushes media packet to the media packet source. +* @scenario Pushes media packet to the media packet source. +* @apicovered webrtc_media_packet_source_push_packet +* @passcase If webrtc_media_packet_source_push_packet is successfull +* @failcase If webrtc_media_packet_source_push_packet fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_media_packet_source_push_packet_p(void) +{ + START_TEST; + unsigned int nId; + media_format_h hMediaFormat; + media_packet_h hMediaPacket; + int setVideoHeight = 480, nSetVideoWidth = 640; + + int nRet = media_format_create(&hMediaFormat); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "media_format_create", WebRtcGetError(nRet)); + CHECK_HANDLE(hMediaFormat, "media_format_create"); + + nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, &nId); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = media_format_set_video_mime(hMediaFormat, MEDIA_FORMAT_I420); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_format_set_video_mime", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet |= media_format_set_video_width(hMediaFormat, nSetVideoWidth); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_format_set_video_width", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet |= media_format_set_video_height(hMediaFormat, setVideoHeight); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_format_set_video_height", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = webrtc_media_packet_source_set_format(g_hWebRtcHandle, nId, hMediaFormat); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_set_format", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = webrtc_media_packet_source_set_buffer_state_changed_cb(g_hWebRtcHandle, nId, webrtcMediaPacketSourceBufferStateChangedCB, NULL); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_set_buffer_state_changed_cb", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = media_packet_new_alloc(hMediaFormat, NULL, NULL, &hMediaPacket); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "media_packet_new_alloc", WebRtcGetError(nRet),media_format_unref(hMediaFormat)); + + nRet = webrtc_media_packet_source_push_packet(g_hWebRtcHandle, nId, hMediaPacket); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_push_packet", WebRtcGetError(nRet),media_packet_unref(hMediaPacket);media_format_unref(hMediaFormat)); + + nRet = media_packet_unref(hMediaPacket); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "media_packet_unref", WebRtcGetError(nRet)); + + nRet = media_format_unref(hMediaFormat); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "media_format_unref", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Gets the STUN server URL. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_get_stun_server_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Gets the STUN server URL. +* @scenario Sets and Gets the STUN server URL. +* @apicovered webrtc_set_stun_server,webrtc_get_stun_server +* @passcase If webrtc_set_stun_server,webrtc_get_stun_server is successfull +* @failcase If webrtc_set_stun_server,webrtc_get_stun_server fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_get_stun_server_p(void) +{ + START_TEST; + unsigned int nId; + char *pszSetServer= "stun://stun.testurl.com:19302" , *pszGetServer = NULL; + + int nRet = webrtc_set_stun_server(g_hWebRtcHandle, pszSetServer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_stun_server", WebRtcGetError(nRet)); + + nRet = webrtc_get_stun_server(g_hWebRtcHandle, &pszGetServer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_stun_server", WebRtcGetError(nRet)); + + if (strcmp(pszGetServer, pszSetServer)) + { + FPRINTF("[Line : %d][%s] set get server mismatch\\n", __LINE__, API_NAMESPACE); + FREE_MEMORY(pszGetServer); + return 1; + } + + FREE_MEMORY(pszGetServer); + + return 0; +} + +//& purpose: Adds a TURN server URL. +//& type: auto +/** +* @testcase ITc_media_webrtc_add_turn_server_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Adds a TURN server URL. +* @scenario Adds a TURN server URL. +* @apicovered webrtc_add_turn_server +* @passcase If webrtc_add_turn_server is successfull +* @failcase If webrtc_add_turn_server fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_add_turn_server_p(void) +{ + START_TEST; + char *pszSetServer= "turn://turn.testurl.com:19303"; + + int nRet = webrtc_add_turn_server(g_hWebRtcHandle, pszSetServer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_turn_server", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Retrieves all the TURN server URLs. +//& type: auto +/** +* @testcase ITc_media_webrtc_foreach_turn_server_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Retrieves all the TURN server URLs. +* @scenario Retrieves all the TURN server URLs. +* @apicovered webrtc_foreach_turn_server +* @passcase If webrtc_foreach_turn_server is successfull +* @failcase If webrtc_foreach_turn_server fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_foreach_turn_server_p(void) +{ + START_TEST; + int nCount = 0; + char *pszSetServer= "turn://turn.testurl.com:19303", *pszSetServer2 = "turn://turn2.testurl.com:19303"; + + int nRet = webrtc_add_turn_server(g_hWebRtcHandle, pszSetServer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_turn_server", WebRtcGetError(nRet)); + nCount++; + + nRet = webrtc_add_turn_server(g_hWebRtcHandle, pszSetServer2); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_turn_server", WebRtcGetError(nRet)); + nCount++; + + nRet = webrtc_foreach_turn_server(g_hWebRtcHandle, webrtcTurnServerCB, (void *)&nCount); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_foreach_turn_server", WebRtcGetError(nRet)); + if(nCount != 0) + { + FPRINTF("[Line : %d][%s] nCount is not 0\\n", __LINE__, API_NAMESPACE); + return 1; + } + + return 0; +} + +//& purpose: Creates SDP offer and answer to start a new WebRTC connection to a remote peer. +//& type: auto +/** +* @testcase ITc_media_webrtc_create_offer_answer_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates SDP offer and answer to start a new WebRTC connection to a remote peer. +* @scenario Creates SDP offer and answer to start a new WebRTC connection to a remote peer. +* @apicovered webrtc_create_offer,webrtc_create_answer +* @passcase If webrtc_create_offer,webrtc_create_answer is successfull +* @failcase If webrtc_create_offer,webrtc_create_answer fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_create_offer_answer_p(void) +{ + START_TEST; + unsigned int nId; + char *pszOffer, *pszAnswer; + webrtc_h hLocalWebRtcHandle,hWebRtcHandle; + g_bCallbackCalled = false; + int nTimeoutId = -1; + + int nRet = webrtc_create(&hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create", WebRtcGetError(nRet)); + CHECK_HANDLE(hWebRtcHandle, "webrtc_create"); + + nRet = webrtc_add_media_source(hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_SCREEN, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_set_ice_candidate_cb(hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_create_offer(hWebRtcHandle, NULL, &pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_offer", WebRtcGetError(nRet)); + + g_bCallbackCalled = false; + nRet = webrtc_create(&hLocalWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create", WebRtcGetError(nRet)); + CHECK_HANDLE(hLocalWebRtcHandle, "webrtc_create"); + + nRet = webrtc_set_ice_candidate_cb(hLocalWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(hLocalWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_signaling_state_change_cb(hLocalWebRtcHandle, webrtcSignalingStateChangeCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_signaling_state_change_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(hLocalWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + + nRet = webrtc_set_remote_description(hLocalWebRtcHandle, pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_remote_description", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + + nRet = webrtc_create_answer(hLocalWebRtcHandle, NULL, &pszAnswer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_answer", WebRtcGetError(nRet)); + + FREE_MEMORY(pszOffer); + FREE_MEMORY(pszAnswer); + +#if 0 + nRet = webrtc_stop(hWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + nRet = webrtc_destroy(hWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy", WebRtcGetError(nRet)); + + nRet = webrtc_stop(hLocalWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + nRet = webrtc_destroy(hLocalWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy", WebRtcGetError(nRet)); +#endif + + return 0; +} + +//& purpose: Sets the session description for a local peer associated with a WebRTC connection. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_local_description_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets the session description for a local peer associated with a WebRTC connection. +* @scenario Sets the session description for a local peer associated with a WebRTC connection. +* @apicovered webrtc_set_local_description +* @passcase If webrtc_set_local_description is successfull +* @failcase If webrtc_set_local_description fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_local_description_p(void) +{ + START_TEST; + unsigned int nId; + char *pszOffer; + g_bCallbackCalled = false; + int nTimeoutId = -1; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_create_offer(g_hWebRtcHandle, NULL, &pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_offer", WebRtcGetError(nRet)); + + nRet = webrtc_set_local_description(g_hWebRtcHandle, pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_local_description", WebRtcGetError(nRet)); + + FREE_MEMORY(pszOffer); + + nRet = webrtc_stop(g_hWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets the session description of the remote peer's current offer or answer. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_remote_description_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets the session description of the remote peer's current offer or answer. +* @scenario Sets the session description of the remote peer's current offer or answer. +* @apicovered webrtc_set_remote_description +* @passcase If webrtc_set_remote_description is successfull +* @failcase If webrtc_set_remote_description fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_remote_description_p(void) +{ + START_TEST; + g_bCallbackCalled = false; + int nTimeoutId = -1; + webrtc_h hLocalWebRtcHandle; + unsigned int nId; + char *pszOffer; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_create_offer(g_hWebRtcHandle, NULL, &pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_offer", WebRtcGetError(nRet)); + + g_bCallbackCalled = false; + nRet = webrtc_create(&hLocalWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create", WebRtcGetError(nRet)); + + nRet = webrtc_set_ice_candidate_cb(hLocalWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(hLocalWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(hLocalWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_set_remote_description(hLocalWebRtcHandle, pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_remote_description", WebRtcGetError(nRet)); + + FREE_MEMORY(pszOffer); + + nRet = webrtc_stop(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + nRet = webrtc_stop(hLocalWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + nRet = webrtc_destroy(hLocalWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Adds a new ICE candidate from the remote peer over its signaling channel. +//& type: auto +/** +* @testcase ITc_media_webrtc_add_ice_candidate_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Adds a new ICE candidate from the remote peer over its signaling channel. +* @scenario Adds a new ICE candidate from the remote peer over its signaling channel. +* @apicovered webrtc_add_ice_candidate +* @passcase If webrtc_add_ice_candidate is successfull +* @failcase If webrtc_add_ice_candidate fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_add_ice_candidate_p(void) +{ + START_TEST; + g_bCallbackCalled = false; + int nTimeoutId = -1; + + int nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_add_ice_candidate(g_hWebRtcHandle, TEST_ICE_CANDIDATE); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_ice_candidate", WebRtcGetError(nRet)); + + nRet = webrtc_stop(g_hWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Creates and Destroys the data channel. +//& type: auto +/** +* @testcase ITc_media_webrtc_create_destroy_data_channel_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates and Destroys the data channel. +* @scenario Creates and Destroys the data channel. +* @apicovered webrtc_create_data_channel,webrtc_destroy_data_channel +* @passcase If webrtc_create_data_channel,webrtc_destroy_data_channel is successfull +* @failcase If webrtc_create_data_channel,webrtc_destroy_data_channel fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_create_destroy_data_channel_p(void) +{ + START_TEST; + webrtc_data_channel_h hChannel; + char *pszChannel = "test channel"; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, pszChannel, NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel, "webrtc_create_data_channel"); + + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Gets data pointer and its size. +//& type: auto +/** +* @testcase ITc_media_webrtc_get_data_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets data pointer and its size. +* @scenario Gets data pointer and its size. +* @apicovered webrtc_get_data +* @passcase If webrtc_get_data is successfull +* @failcase If webrtc_get_data fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_get_data_p(void) +{ + START_TEST; + typedef struct _bytes_data_s + { + void *pszData; + unsigned long ulSize; + }bytesDataStruct; + char pszBufArr[] = {'a', 'b', 'c', 'd'}; + bytesDataStruct sBytes = {pszBufArr, sizeof(pszBufArr)}; + const char *pszData; + unsigned long ulSize; + + int nRet = webrtc_get_data((webrtc_bytes_data_h)&sBytes, &pszData, &ulSize); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_data", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sends a string data across the data channel to the remote peer. +//& type: auto +/** +* @testcase ITc_webrtc_data_channel_send_string_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sends a string data across the data channel to the remote peer. +* @scenario Sends a string data across the data channel to the remote peer. +* @apicovered webrtc_data_channel_send_string +* @passcase If webrtc_data_channel_send_string is successfull +* @failcase If webrtc_data_channel_send_string fails +* @precondition NA +* @postcondition NA +*/ +int ITc_webrtc_data_channel_send_string_p(void) +{ + START_TEST; + webrtc_data_channel_h hChannel; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, TEST_DATA_CHANNEL_LABEL, NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel,"webrtc_create_data_channel"); + + nRet = webrtc_data_channel_send_string(hChannel, TEST_STRING_DATA); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_INVALID_STATE, nRet, "webrtc_data_channel_send_string", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sends byte data across the data channel to the remote peer. +//& type: auto +/** +* @testcase ITc_webrtc_data_channel_send_bytes_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sends byte data across the data channel to the remote peer. +* @scenario Sends byte data across the data channel to the remote peer. +* @apicovered webrtc_data_channel_send_bytes +* @passcase If webrtc_data_channel_send_bytes is successfull +* @failcase If webrtc_data_channel_send_bytes fails +* @precondition NA +* @postcondition NA +*/ +int ITc_webrtc_data_channel_send_bytes_p(void) +{ + START_TEST; + webrtc_data_channel_h hChannel; + char pszData[TEST_BUFFER_SIZE] = {0, }; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, TEST_DATA_CHANNEL_LABEL, NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel,"webrtc_create_data_channel"); + + nRet = webrtc_data_channel_send_bytes(hChannel, pszData, TEST_BUFFER_SIZE); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_INVALID_STATE, nRet, "webrtc_data_channel_send_bytes", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Gets the channel label. +//& type: auto +/** +* @testcase ITc_webrtc_data_channel_get_label_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Gets the channel label. +* @scenario Gets the channel label. +* @apicovered webrtc_data_channel_get_label +* @passcase If webrtc_data_channel_get_label is successfull +* @failcase If webrtc_data_channel_get_label fails +* @precondition NA +* @postcondition NA +*/ +int ITc_webrtc_data_channel_get_label_p(void) +{ + START_TEST; + const char *pszData="test"; + webrtc_data_channel_h hChannel; + char *pszChannel = "test channel"; + char *pszGetLabel; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, pszChannel, NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel,"webrtc_create_data_channel"); + + nRet = webrtc_data_channel_get_label(hChannel, &pszGetLabel); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_get_label", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + FREE_MEMORY(pszGetLabel); + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer. +//& type: auto +/** +* @testcase ITc_media_webrtc_create_offer_async_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer. +* @scenario Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer. +* @apicovered webrtc_create_offer_async +* @passcase If webrtc_create_offer_async is successfull +* @failcase If webrtc_create_offer_async fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_create_offer_async_p(void) +{ + START_TEST; + unsigned int nId; + char *pszOffer, *pszAnswer; + webrtc_h hLocalWebRtcHandle; + g_bCallbackCalled = false; + g_bCallbackSessionCalled = false; + int nTimeoutId = -1; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_CAMERA, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_create_offer_async(g_hWebRtcHandle, NULL, webrtcSessionDescriptionCreatedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_offer_async", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + + nRet = webrtc_stop(g_hWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Creates SDP answer asynchronously to an offer received from a remote peer during the negotiation of a WebRTC connection. +//& type: auto +/** +* @testcase ITc_media_webrtc_create_answer_async_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Creates SDP answer asynchronously to an offer received from a remote peer during the negotiation of a WebRTC connection. +* @scenario Creates SDP answer asynchronously to an offer received from a remote peer during the negotiation of a WebRTC connection. +* @apicovered webrtc_create_answer_async +* @passcase If webrtc_create_answer_async is successfull +* @failcase If webrtc_create_answer_async fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_create_answer_async_p(void) +{ + START_TEST; + unsigned int nId; + char *pszOffer, *pszAnswer; + webrtc_h hLocalWebRtcHandle, hWebRtcHandle; + g_bCallbackCalled = false; + g_bCallbackSessionCalled = false; + int nTimeoutId = -1; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_create_offer(g_hWebRtcHandle, NULL, &pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_offer", WebRtcGetError(nRet)); + + g_bCallbackCalled = false; + nRet = webrtc_create(&hLocalWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create", WebRtcGetError(nRet)); + + nRet = webrtc_set_ice_candidate_cb(hLocalWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_set_state_changed_cb(hLocalWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_start(hLocalWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + if(g_bCallbackCalled != true) + { + + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "rpc_port_proxy_add_rejected_event_cb"); + return 1; + } + + nRet = webrtc_set_remote_description(hLocalWebRtcHandle, pszOffer); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_remote_description", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + + nRet = webrtc_create_answer_async(hLocalWebRtcHandle, NULL, webrtcSessionDescriptionCreatedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_answer_async", WebRtcGetError(nRet)); + + RUN_POLLING_LOOP; + + FREE_MEMORY(pszOffer); + + nRet = webrtc_stop(g_hWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + nRet = webrtc_stop(hLocalWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet)); + + nRet = webrtc_destroy(hLocalWebRtcHandle); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy", WebRtcGetError(nRet)); + + return 0; +} +/** @} */ +/** @} */ diff --git a/src/itc/webrtc/ITs-webrtc_callback.c b/src/itc/webrtc/ITs-webrtc_callback.c new file mode 100755 index 000000000..c83709278 --- /dev/null +++ b/src/itc/webrtc/ITs-webrtc_callback.c @@ -0,0 +1,764 @@ +// +// Copyright (c) 2021 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 "ITs-webrtc-common.h" + +//& set: Webrtc + +/** @addtogroup itc-webrtc +* @ingroup itc +* @{ +*/ +#define TEST_ICE_CANDIDATE "{'ice':{'candidate':'candidate:3600539631 1 tcp 1518149375 192.168.0.127 9 typ host tcptype active generation 0 ufrag l4kk network-id 3 network-cost 10','sdpMid':'video0','sdpMLineIndex':0}}" + +/** +* @function webrtcStateChangedCB +* @parameter webrtc_h webrtc, webrtc_state_e previous, webrtc_state_e current, void *user_data +* @return NA +*/ +static void webrtcStateChangedCB(webrtc_h webrtc, webrtc_state_e previous, webrtc_state_e current, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcErrorCB +* @parameter webrtc_h webrtc, webrtc_error_e error, webrtc_state_e state, void *user_data +* @return NA +*/ +static void webrtcErrorCB(webrtc_h webrtc, webrtc_error_e error, webrtc_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcErrorCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcIceCandidateCB +* @parameter webrtc_h webrtc, const char *candidate, void *user_data +* @return NA +*/ +static void webrtcIceCandidateCB(webrtc_h webrtc, const char *candidate, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcIceCandidateCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcNegotiationNeededCB +* @parameter webrtc_h webrtc, void *user_data +* @return NA +*/ +static void webrtcNegotiationNeededCB(webrtc_h webrtc, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcNegotiationNeededCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcPeerConnectionStateChangeCB +* @parameter webrtc_h webrtc, webrtc_peer_connection_state_e state, void *user_data +* @return NA +*/ +static void webrtcPeerConnectionStateChangeCB(webrtc_h webrtc, webrtc_peer_connection_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcPeerConnectionStateChangeCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcSignalingStateChangeCB +* @parameter webrtc_h webrtc, webrtc_signaling_state_e state, void *user_data) +* @return NA +*/ +static void webrtcSignalingStateChangeCB(webrtc_h webrtc, webrtc_signaling_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcSignalingStateChangeCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcIceGatheringStateChangeCB +* @parameter webrtc_h webrtc, webrtc_ice_gathering_state_e state, void *user_data +* @return NA +*/ +static void webrtcIceGatheringStateChangeCB(webrtc_h webrtc, webrtc_ice_gathering_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcIceGatheringStateChangeCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcIceConnectionStateChangeCB +* @parameter webrtc_h webrtc, webrtc_ice_connection_state_e state, void *user_data +* @return NA +*/ +static void webrtcIceConnectionStateChangeCB(webrtc_h webrtc, webrtc_ice_connection_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcIceConnectionStateChangeCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcEncodedFrameCB +* @parameter webrtc_h webrtc, webrtc_media_type_e type, unsigned int track_id, media_packet_h packet, void *user_data +* @return NA +*/ +static void webrtcEncodedFrameCB(webrtc_h webrtc, webrtc_media_type_e type, unsigned int track_id, media_packet_h packet, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcEncodedFrameCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcMediaPacketSourceBufferStateChangedCB +* @parameter unsigned int source_id, webrtc_media_packet_source_buffer_state_e state, void *user_data +* @return NA +*/ +static void webrtcMediaPacketSourceBufferStateChangedCB(unsigned int source_id, webrtc_media_packet_source_buffer_state_e state, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcMediaPacketSourceBufferStateChangedCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcDataChannelCB +* @parameter webrtc_h webrtc, webrtc_data_channel_h channel, void *user_data +* @return NA +*/ +static void webrtcDataChannelCB(webrtc_h webrtc, webrtc_data_channel_h channel, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcDataChannelCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcDataChannelOpenCB +* @parameter webrtc_data_channel_h channel, void *user_data +* @return NA +*/ +static void webrtcDataChannelOpenCB(webrtc_data_channel_h channel, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcDataChannelOpenCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcDataChannelMessageCB +* @parameter webrtc_data_channel_h channel, webrtc_data_channel_type_e type, void *message, void *user_data +* @return NA +*/ +static void webrtcDataChannelMessageCB(webrtc_data_channel_h channel, webrtc_data_channel_type_e type, void *message, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcDataChannelMessageCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcDataChannelErrorCB +* @parameter webrtc_data_channel_h channel, webrtc_error_e error, void *user_data +* @return NA +*/ +static void webrtcDataChannelErrorCB(webrtc_data_channel_h channel, webrtc_error_e error, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcDataChannelErrorCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcDataChannelCloseCB +* @parameter webrtc_data_channel_h channel, void *user_data +* @return NA +*/ +static void webrtcDataChannelCloseCB(webrtc_data_channel_h channel, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcDataChannelCloseCB called\\n", __LINE__, API_NAMESPACE); +} + +/** +* @function webrtcTrackAddedCB +* @parameter webrtc_h webrtc, webrtc_media_type_e type, unsigned int track_id, void *user_data +* @return NA +*/ +static void webrtcTrackAddedCB(webrtc_h webrtc, webrtc_media_type_e type, unsigned int track_id, void *user_data) +{ + FPRINTF("[Line : %d][%s] Callback webrtcTrackAddedCB called\\n", __LINE__, API_NAMESPACE); +} +/** + * @function ITs_webrtc_callback_startup + * @description Called before each test + * @parameter NA + * @return NA + */ +void ITs_webrtc_callback_startup(void) +{ + struct stat stBuff; + if ( stat(ERR_LOG, &stBuff) == 0 ) + { + remove(ERR_LOG); + } + g_bWebRTCCreation = false; + int nRet = webrtc_create(&g_hWebRtcHandle); + if( nRet != WEBRTC_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] webrtc_create api failed!!!\\n", __LINE__, API_NAMESPACE); + return; + } + if(g_hWebRtcHandle == NULL) + { + FPRINTF("[Line : %d][%s] g_hWebRtcHandle is NULL!!!\\n", __LINE__, API_NAMESPACE); + return; + } + g_bWebRTCCreation = true; + + return; +} + + +/** + * @function ITs_webrtc_callback_cleanup + * @description Called after each test + * @parameter NA + * @return NA + */ +void ITs_webrtc_callback_cleanup(void) +{ + if(g_hWebRtcHandle) + { + int nRet = webrtc_destroy(g_hWebRtcHandle); + if( nRet != WEBRTC_ERROR_NONE) + { + FPRINTF("[Line : %d][%s] webrtc_destroy api failed!!!\\n", __LINE__, API_NAMESPACE); + } + } + return; +} + +//& purpose: Sets ans Unsets a callback function to be invoked when the WebRTC state is changed. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_state_changed_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets ans Unsets a callback function to be invoked when the WebRTC state is changed. +* @scenario Sets ans Unsets a callback function to be invoked when the WebRTC state is changed. +* @apicovered webrtc_set_state_changed_cb,webrtc_unset_state_changed_cb +* @passcase If webrtc_set_state_changed_cb,webrtc_unset_state_changed_cb is successfull +* @failcase If webrtc_set_state_changed_cb,webrtc_unset_state_changed_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_state_changed_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_state_changed_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_state_changed_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a callback function to be invoked when an asynchronous operation error occurs. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_error_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a callback function to be invoked when an asynchronous operation error occurs. +* @scenario Sets and Unsets a callback function to be invoked when an asynchronous operation error occurs. +* @apicovered webrtc_set_error_cb,webrtc_unset_error_cb +* @passcase If webrtc_set_error_cb,webrtc_unset_error_cb is successfull +* @failcase If webrtc_set_error_cb,webrtc_unset_error_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_error_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_error_cb(g_hWebRtcHandle, webrtcErrorCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_error_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_error_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_error_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets an ICE candidate callback function to be invoked when the WebRTC needs to send the ICE candidate message to the remote peer. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_ice_candidate_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets an ICE candidate callback function to be invoked when the WebRTC needs to send the ICE candidate message to the remote peer. +* @scenario Sets and Unsets an ICE candidate callback function to be invoked when the WebRTC needs to send the ICE candidate message to the remote peer. +* @apicovered webrtc_set_ice_candidate_cb,webrtc_unset_ice_candidate_cb +* @passcase If webrtc_set_ice_candidate_cb,webrtc_unset_ice_candidate_cb is successfull +* @failcase If webrtc_set_ice_candidate_cb,webrtc_unset_ice_candidate_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_ice_candidate_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_candidate_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_ice_candidate_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_ice_candidate_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a negotiation needed callback function to be invoked when a change has occurred which requires session negotiation. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_negotiation_needed_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a negotiation needed callback function to be invoked when a change has occurred which requires session negotiation. +* @scenario Sets and Unsets a negotiation needed callback function to be invoked when a change has occurred which requires session negotiation. +* @apicovered webrtc_set_negotiation_needed_cb,webrtc_unset_negotiation_needed_cb +* @passcase If webrtc_set_negotiation_needed_cb,webrtc_unset_negotiation_needed_cb is successfull +* @failcase If webrtc_set_negotiation_needed_cb,webrtc_unset_negotiation_needed_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_negotiation_needed_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_negotiation_needed_cb(g_hWebRtcHandle, webrtcNegotiationNeededCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_negotiation_needed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_negotiation_needed_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_negotiation_needed_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a callback function to be invoked when the WebRTC peer connection state is changed. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a callback function to be invoked when the WebRTC peer connection state is changed. +* @scenario Sets and Unsets a callback function to be invoked when the WebRTC peer connection state is changed. +* @apicovered webrtc_set_peer_connection_state_change_cb,webrtc_unset_peer_connection_state_change_cb +* @passcase If webrtc_set_peer_connection_state_change_cb,webrtc_unset_peer_connection_state_change_cb is successfull +* @failcase If webrtc_set_peer_connection_state_change_cb,webrtc_unset_peer_connection_state_change_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_peer_connection_state_change_cb(g_hWebRtcHandle, webrtcPeerConnectionStateChangeCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_peer_connection_state_change_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_peer_connection_state_change_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_peer_connection_state_change_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets the signaling state change callback function. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_signaling_state_change_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets the signaling state change callback function. +* @scenario Sets and Unsets the signaling state change callback function. +* @apicovered webrtc_set_signaling_state_change_cb,webrtc_unset_signaling_state_change_cb +* @passcase If webrtc_set_signaling_state_change_cb,webrtc_unset_signaling_state_change_cb is successfull +* @failcase If webrtc_set_signaling_state_change_cb,webrtc_unset_signaling_state_change_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_signaling_state_change_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_signaling_state_change_cb(g_hWebRtcHandle, webrtcSignalingStateChangeCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_signaling_state_change_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_signaling_state_change_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_signaling_state_change_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a callback function to be invoked when the WebRTC ICE gathering state is changed. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a callback function to be invoked when the WebRTC ICE gathering state is changed. +* @scenario Sets and Unsets a callback function to be invoked when the WebRTC ICE gathering state is changed. +* @apicovered webrtc_set_ice_gathering_state_change_cb,webrtc_unset_signaling_state_change_cb +* @passcase If webrtc_set_ice_gathering_state_change_cb,webrtc_unset_signaling_state_change_cb is successfull +* @failcase If webrtc_set_ice_gathering_state_change_cb,webrtc_unset_signaling_state_change_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_ice_gathering_state_change_cb(g_hWebRtcHandle, webrtcIceGatheringStateChangeCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_gathering_state_change_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_ice_gathering_state_change_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_ice_gathering_state_change_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a callback function to be invoked when the WebRTC ICE connection state is changed. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a callback function to be invoked when the WebRTC ICE connection state is changed. +* @scenario Sets and Unsets a callback function to be invoked when the WebRTC ICE connection state is changed. +* @apicovered webrtc_set_ice_connection_state_change_cb,webrtc_unset_ice_connection_state_change_cb +* @passcase If webrtc_set_ice_connection_state_change_cb,webrtc_unset_ice_connection_state_change_cb is successfull +* @failcase If webrtc_set_ice_connection_state_change_cb,webrtc_unset_ice_connection_state_change_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_ice_connection_state_change_cb(g_hWebRtcHandle, webrtcIceConnectionStateChangeCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_connection_state_change_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_ice_connection_state_change_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_ice_connection_state_change_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets an encoded audio frame callback function to be invoked when each audio frame is ready to be rendered. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets an encoded audio frame callback function to be invoked when each audio frame is ready to be rendered. +* @scenario Sets and Unsets an encoded audio frame callback function to be invoked when each audio frame is ready to be rendered. +* @apicovered webrtc_set_encoded_audio_frame_cb,webrtc_unset_encoded_audio_frame_cb +* @passcase If webrtc_set_encoded_audio_frame_cb,webrtc_unset_encoded_audio_frame_cb is successfull +* @failcase If webrtc_set_encoded_audio_frame_cb,webrtc_unset_encoded_audio_frame_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_encoded_audio_frame_cb(g_hWebRtcHandle, webrtcEncodedFrameCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_encoded_audio_frame_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_encoded_audio_frame_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_encoded_audio_frame_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets an encoded video frame callback function to be invoked when each video frame is ready to be rendered. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_encoded_video_frame_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets an encoded video frame callback function to be invoked when each video frame is ready to be rendered. +* @scenario Sets and Unsets an encoded video frame callback function to be invoked when each video frame is ready to be rendered. +* @apicovered webrtc_set_encoded_video_frame_cb,webrtc_unset_encoded_video_frame_cb +* @passcase If webrtc_set_encoded_video_frame_cb,webrtc_unset_encoded_video_frame_cb is successfull +* @failcase If webrtc_set_encoded_video_frame_cb,webrtc_unset_encoded_video_frame_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_encoded_video_frame_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_encoded_video_frame_cb(g_hWebRtcHandle, webrtcEncodedFrameCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_encoded_video_frame_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_encoded_video_frame_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_encoded_video_frame_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a callback function to be invoked when the buffer state of media packet source is changed. +//& type: auto +/** +* @testcase ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a callback function to be invoked when the buffer state of media packet source is changed. +* @scenario Sets and Unsets a callback function to be invoked when the buffer state of media packet source is changed. +* @apicovered webrtc_media_packet_source_set_buffer_state_changed_cb,webrtc_media_packet_source_unset_buffer_state_changed_cb +* @passcase If webrtc_media_packet_source_set_buffer_state_changed_cb,webrtc_media_packet_source_unset_buffer_state_changed_cb is successfull +* @failcase If webrtc_media_packet_source_set_buffer_state_changed_cb,webrtc_media_packet_source_unset_buffer_state_changed_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p(void) +{ + START_TEST; + unsigned int nId; + + int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, &nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet)); + + nRet = webrtc_media_packet_source_set_buffer_state_changed_cb(g_hWebRtcHandle, nId, webrtcMediaPacketSourceBufferStateChangedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_set_buffer_state_changed_cb", WebRtcGetError(nRet)); + + nRet = webrtc_media_packet_source_unset_buffer_state_changed_cb(g_hWebRtcHandle, nId); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_packet_source_unset_buffer_state_changed_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a data channel callback function to be invoked when the data channel is created to the connection by the remote peer. +//& type: auto +/** +* @testcase ITc_media_webrtc_set_unset_data_channel_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a data channel callback function to be invoked when the data channel is created to the connection by the remote peer. +* @scenario Sets and Unsets a data channel callback function to be invoked when the data channel is created to the connection by the remote peer. +* @apicovered webrtc_set_data_channel_cb,webrtc_unset_data_channel_cb +* @passcase If webrtc_set_data_channel_cb,webrtc_unset_data_channel_cb is successfull +* @failcase If webrtc_set_data_channel_cb,webrtc_unset_data_channel_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_set_unset_data_channel_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_data_channel_cb(g_hWebRtcHandle, webrtcDataChannelCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_data_channel_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_data_channel_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_data_channel_cb", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a data channel open callback function to be invoked when the data channel's underlying data transport is established. +//& type: auto +/** +* @testcase ITc_media_webrtc_data_channel_set_unset_open_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a data channel open callback function to be invoked when the data channel's underlying data transport is established. +* @scenario Sets and Unsets a data channel open callback function to be invoked when the data channel's underlying data transport is established. +* @apicovered webrtc_data_channel_set_open_cb,webrtc_data_channel_unset_open_cb +* @passcase If webrtc_data_channel_set_open_cb,webrtc_data_channel_unset_open_cb is successfull +* @failcase If webrtc_data_channel_set_open_cb,webrtc_data_channel_unset_open_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_data_channel_set_unset_open_cb_p(void) +{ + START_TEST; + webrtc_data_channel_h hChannel; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, "test channel", NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel,"webrtc_create_data_channel"); + + nRet = webrtc_data_channel_set_open_cb(hChannel, webrtcDataChannelOpenCB, NULL); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_set_open_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_data_channel_unset_open_cb(hChannel); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_unset_open_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a data channel message callback function to be invoked when a message is received from the remote peer. +//& type: auto +/** +* @testcase ITc_media_webrtc_data_channel_set_unset_message_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a data channel message callback function to be invoked when a message is received from the remote peer. +* @scenario Sets and Unsets a data channel message callback function to be invoked when a message is received from the remote peer. +* @apicovered webrtc_data_channel_set_message_cb,webrtc_data_channel_unset_message_cb +* @passcase If webrtc_data_channel_set_message_cb,webrtc_data_channel_unset_message_cb is successfull +* @failcase If webrtc_data_channel_set_message_cb,webrtc_data_channel_unset_message_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_data_channel_set_unset_message_cb_p(void) +{ + START_TEST; + webrtc_data_channel_h hChannel; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, "test channel", NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel,"webrtc_create_data_channel"); + + nRet = webrtc_data_channel_set_message_cb(hChannel, webrtcDataChannelMessageCB, NULL); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_set_message_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_data_channel_unset_message_cb(hChannel); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_unset_message_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a data channel error callback function to be invoked when an error occurs on the data channel. +//& type: auto +/** +* @testcase ITc_media_webrtc_data_channel_set_unset_error_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a data channel error callback function to be invoked when an error occurs on the data channel. +* @scenario Sets and Unsets a data channel error callback function to be invoked when an error occurs on the data channel. +* @apicovered webrtc_data_channel_set_error_cb,webrtc_data_channel_unset_error_cb +* @passcase If webrtc_data_channel_set_error_cb,webrtc_data_channel_unset_error_cb is successfull +* @failcase If webrtc_data_channel_set_error_cb,webrtc_data_channel_unset_error_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_data_channel_set_unset_error_cb_p(void) +{ + START_TEST; + webrtc_data_channel_h hChannel; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, "test channel", NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel,"webrtc_create_data_channel"); + + nRet = webrtc_data_channel_set_error_cb(hChannel, webrtcDataChannelErrorCB, NULL); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_set_error_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_data_channel_unset_error_cb(hChannel); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_unset_error_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a data channel close callback function to be invoked when the data channel has closed down. +//& type: auto +/** +* @testcase ITc_media_webrtc_data_channel_set_unset_close_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a data channel close callback function to be invoked when the data channel has closed down. +* @scenario Sets and Unsets a data channel close callback function to be invoked when the data channel has closed down. +* @apicovered webrtc_data_channel_set_close_cb,webrtc_data_channel_unset_close_cb +* @passcase If webrtc_data_channel_set_close_cb,webrtc_data_channel_unset_close_cb is successfull +* @failcase If webrtc_data_channel_set_close_cb,webrtc_data_channel_unset_close_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_media_webrtc_data_channel_set_unset_close_cb_p(void) +{ + START_TEST; + webrtc_data_channel_h hChannel; + + int nRet = webrtc_create_data_channel(g_hWebRtcHandle, "test channel", NULL, &hChannel); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_data_channel", WebRtcGetError(nRet)); + CHECK_HANDLE(hChannel,"webrtc_create_data_channel"); + + nRet = webrtc_data_channel_set_close_cb(hChannel, webrtcDataChannelCloseCB, NULL); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_set_close_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_data_channel_unset_close_cb(hChannel); + PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_data_channel_unset_close_cb", WebRtcGetError(nRet),webrtc_destroy_data_channel(hChannel)); + + nRet = webrtc_destroy_data_channel(hChannel); + PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_destroy_data_channel", WebRtcGetError(nRet)); + + return 0; +} + +//& purpose: Sets and Unsets a track added callback function to be invoked when a new track has been added to the WebRTC. +//& type: auto +/** +* @testcase ITc_webrtc_set_unset_track_added_cb_p +* @since_tizen 6.5 +* @author SRID(nibha.sharma) +* @reviewer SRID(shobhit.v) +* @type auto +* @description Sets and Unsets a track added callback function to be invoked when a new track has been added to the WebRTC. +* @scenario Sets and Unsets a track added callback function to be invoked when a new track has been added to the WebRTC. +* @apicovered webrtc_set_track_added_cb,webrtc_unset_track_added_cb +* @passcase If webrtc_set_track_added_cb,webrtc_unset_track_added_cb is successfull +* @failcase If webrtc_set_track_added_cb,webrtc_unset_track_added_cb fails +* @precondition NA +* @postcondition NA +*/ +int ITc_webrtc_set_unset_track_added_cb_p(void) +{ + START_TEST; + + int nRet = webrtc_set_track_added_cb(g_hWebRtcHandle, webrtcTrackAddedCB, NULL); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_track_added_cb", WebRtcGetError(nRet)); + + nRet = webrtc_unset_track_added_cb(g_hWebRtcHandle); + PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_unset_track_added_cb", WebRtcGetError(nRet)); + + return 0; +} +/** @} */ +/** @} */ diff --git a/src/itc/webrtc/tct-webrtc-native.c b/src/itc/webrtc/tct-webrtc-native.c new file mode 100755 index 000000000..6f6eb386c --- /dev/null +++ b/src/itc/webrtc/tct-webrtc-native.c @@ -0,0 +1,143 @@ +// +// Copyright (c) 2021 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 "tct_common.h" + +#ifdef MOBILE //Starts MOBILE +#include "tct-webrtc-native_mobile.h" +#endif //MOBILE //End MOBILE + +#ifdef WEARABLE //Starts WEARABLE +#include "tct-webrtc-native_wearable.h" +#endif //WEARABLE //End WEARABLE + +#ifdef TV //Starts TV +#include "tct-webrtc-native_tv.h" +#endif //TV //End TV + +#ifdef TIZENIOT //Starts TIZENIOT +#include "tct-webrtc-native_tizeniot.h" +#endif //TIZENIOT //End TIZENIOT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +typedef struct appdata { + Evas_Object *win; + Evas_Object *conform; + Evas_Object *label; +} appdata_s; + +static bool app_create(void *data) +{ + return true; +} + +static void app_control(app_control_h app_control, void *data) +{ + char* pszGetTCName = NULL; + int i=0, result=0, nRet=0; + nRet = app_control_get_extra_data(app_control, "testcase_name", &pszGetTCName); + if(nRet != APP_CONTROL_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] app_control_get_extra_data returns error = %d", __FUNCTION__, __LINE__, nRet); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to fetch test case name: app_control_get_extra_data API call fails\\n", __FILE__, __LINE__); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Executing TC Name = %s", __FUNCTION__, __LINE__, pszGetTCName); + for ( i = 0; tc_array[i].name; i++ ) + { + if ( 0 == strncmp(pszGetTCName, tc_array[i].name, strlen(pszGetTCName)) ) + { + if ( tc_array[i].startup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Start up", pszGetTCName); + tc_array[i].startup(); + } + + dlog_print(DLOG_INFO, "NativeTCT", "%s : Body", pszGetTCName); + result = tc_array[i].function(); + dlog_print(DLOG_INFO, "NativeTCT", "%s returns value = %d", pszGetTCName, result); + + if ( tc_array[i].cleanup ) + { + dlog_print(DLOG_INFO, "NativeTCT", "%s : Clean up", pszGetTCName); + tc_array[i].cleanup(); + } + + PRINT_TC_RESULT("%d",result); + FREE_MEMORY_TC(pszGetTCName); + return; + } + } + + dlog_print(DLOG_ERROR, "NativeTCT", "[%s:%d] Unable to execute %s : Unknown Test Case Name", __FUNCTION__, __LINE__, pszGetTCName); + PRINT_UTC_LOG("\\n[%s][Line : %d]Unable to execute %s : Unknown Test Case Name\\n", __FILE__, __LINE__, pszGetTCName); + PRINT_TC_RESULT("%d",1); + FREE_MEMORY_TC(pszGetTCName); + return; +} + +static void app_terminate(void *data) +{ + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is now Terminating", __FUNCTION__, __LINE__); +} + +int main(int argc, char *argv[]) +{ + int ret = 0; + appdata_s ad = {0,}; + + ui_app_lifecycle_callback_s event_callback = {0,}; + event_callback.create = app_create; + event_callback.terminate = app_terminate; + event_callback.app_control = app_control; + + //setting gcda file location for coverage + setenv("GCOV_PREFIX","/tmp",1); + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Coverage *.gcda File location set to /tmp/home/abuild/rpmbuild/BUILD/ ", __FUNCTION__, __LINE__); + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Main Function is Invoked", __FUNCTION__, __LINE__); + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) + { + dlog_print(DLOG_ERROR, "NativeTCT", "Application ui_app_main call gets failed. err = %d", ret); + PRINT_UTC_LOG("\\n[%s][Line : %d]Application ui_app_main call gets failed. err = %d\\n", __FILE__, __LINE__, ret); + PRINT_TC_RESULT("%d",1); + return ret; + } + + dlog_print(DLOG_INFO, "NativeTCT", "[%s:%d] Application Package is Terminated", __FUNCTION__, __LINE__); + return ret; +} diff --git a/src/itc/webrtc/tct-webrtc-native_mobile.h b/src/itc/webrtc/tct-webrtc-native_mobile.h new file mode 100755 index 000000000..ed13605dd --- /dev/null +++ b/src/itc/webrtc/tct-webrtc-native_mobile.h @@ -0,0 +1,124 @@ +// +// Copyright (c) 2021 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 __TCT_WEBRTC_NATIVE_H__ +#define __TCT_WEBRTC_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +extern void ITs_webrtc_startup(void); +extern void ITs_webrtc_cleanup(void); +extern void ITs_webrtc_callback_startup(void); +extern void ITs_webrtc_callback_cleanup(void); + +extern int ITc_webrtc_create_destroy_p(void); +extern int ITc_webrtc_start_stop_p(void); +extern int ITc_media_webrtc_get_state_p(void); +extern int ITc_media_webrtc_add_remove_media_source_p(void); +extern int ITc_media_webrtc_get_peer_connection_state_p(void); +extern int ITc_media_webrtc_get_signaling_state_p(void); +extern int ITc_media_webrtc_get_ice_gathering_state_p(void); +extern int ITc_media_webrtc_get_ice_connection_state_p(void); +extern int ITc_media_webrtc_media_source_set_get_transceiver_direction_p(void); +extern int ITc_media_webrtc_media_source_set_get_pause_p(void); +extern int ITc_media_webrtc_media_source_set_get_mute_p(void); +extern int ITc_media_webrtc_media_source_set_get_video_resolution_p(void); +extern int ITc_media_webrtc_mic_source_set_sound_stream_info_p(void); +extern int ITc_media_webrtc_media_packet_source_set_format_p(void); +extern int ITc_media_webrtc_media_packet_source_push_packet_p(void); +extern int ITc_media_webrtc_set_get_stun_server_p(void); +extern int ITc_media_webrtc_add_turn_server_p(void); +extern int ITc_media_webrtc_foreach_turn_server_p(void); +extern int ITc_media_webrtc_create_offer_answer_p(void); +extern int ITc_media_webrtc_set_local_description_p(void); +extern int ITc_media_webrtc_set_remote_description_p(void); +extern int ITc_media_webrtc_add_ice_candidate_p(void); +extern int ITc_media_webrtc_create_destroy_data_channel_p(void); +extern int ITc_media_webrtc_get_data_p(void); +extern int ITc_webrtc_data_channel_send_string_p(void); +extern int ITc_media_webrtc_set_unset_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_candidate_cb_p(void); +extern int ITc_media_webrtc_set_unset_negotiation_needed_cb_p(void); +extern int ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_signaling_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_video_frame_cb_p(void); +extern int ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_data_channel_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_open_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_message_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_close_cb_p(void); +extern int ITc_webrtc_data_channel_get_label_p(void); +extern int ITc_webrtc_set_unset_track_added_cb_p(void); +extern int ITc_webrtc_data_channel_send_bytes_p(void); +extern int ITc_media_webrtc_create_offer_async_p(void); +extern int ITc_media_webrtc_create_answer_async_p(void); + +testcase tc_array[] = { + {"ITc_webrtc_create_destroy_p", ITc_webrtc_create_destroy_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_start_stop_p", ITc_webrtc_start_stop_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_get_label_p", ITc_webrtc_data_channel_get_label_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_bytes_p", ITc_webrtc_data_channel_send_bytes_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_state_p",ITc_media_webrtc_get_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_async_p", ITc_media_webrtc_create_offer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_answer_async_p", ITc_media_webrtc_create_answer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_remove_media_source_p",ITc_media_webrtc_add_remove_media_source_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_peer_connection_state_p",ITc_media_webrtc_get_peer_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_signaling_state_p",ITc_media_webrtc_get_signaling_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_gathering_state_p",ITc_media_webrtc_get_ice_gathering_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_connection_state_p",ITc_media_webrtc_get_ice_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_transceiver_direction_p",ITc_media_webrtc_media_source_set_get_transceiver_direction_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_pause_p",ITc_media_webrtc_media_source_set_get_pause_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_mute_p",ITc_media_webrtc_media_source_set_get_mute_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_video_resolution_p",ITc_media_webrtc_media_source_set_get_video_resolution_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_mic_source_set_sound_stream_info_p",ITc_media_webrtc_mic_source_set_sound_stream_info_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_format_p",ITc_media_webrtc_media_packet_source_set_format_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_push_packet_p",ITc_media_webrtc_media_packet_source_push_packet_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_get_stun_server_p",ITc_media_webrtc_set_get_stun_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_turn_server_p",ITc_media_webrtc_add_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_foreach_turn_server_p",ITc_media_webrtc_foreach_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_answer_p",ITc_media_webrtc_create_offer_answer_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_local_description_p",ITc_media_webrtc_set_local_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_remote_description_p",ITc_media_webrtc_set_remote_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_ice_candidate_p",ITc_media_webrtc_add_ice_candidate_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_destroy_data_channel_p",ITc_media_webrtc_create_destroy_data_channel_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_data_p",ITc_media_webrtc_get_data_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_string_p",ITc_webrtc_data_channel_send_string_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_unset_state_changed_cb_p",ITc_media_webrtc_set_unset_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_error_cb_p",ITc_media_webrtc_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_candidate_cb_p",ITc_media_webrtc_set_unset_ice_candidate_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_negotiation_needed_cb_p",ITc_media_webrtc_set_unset_negotiation_needed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p",ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_signaling_state_change_cb_p",ITc_media_webrtc_set_unset_signaling_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p",ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p",ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p",ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_video_frame_cb_p",ITc_media_webrtc_set_unset_encoded_video_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p",ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_data_channel_cb_p",ITc_media_webrtc_set_unset_data_channel_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_open_cb_p",ITc_media_webrtc_data_channel_set_unset_open_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_message_cb_p",ITc_media_webrtc_data_channel_set_unset_message_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_error_cb_p",ITc_media_webrtc_data_channel_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_close_cb_p",ITc_media_webrtc_data_channel_set_unset_close_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_webrtc_set_unset_track_added_cb_p",ITc_webrtc_set_unset_track_added_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_WEBRTC_NATIVE_H__ diff --git a/src/itc/webrtc/tct-webrtc-native_tizeniot.h b/src/itc/webrtc/tct-webrtc-native_tizeniot.h new file mode 100755 index 000000000..ed13605dd --- /dev/null +++ b/src/itc/webrtc/tct-webrtc-native_tizeniot.h @@ -0,0 +1,124 @@ +// +// Copyright (c) 2021 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 __TCT_WEBRTC_NATIVE_H__ +#define __TCT_WEBRTC_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +extern void ITs_webrtc_startup(void); +extern void ITs_webrtc_cleanup(void); +extern void ITs_webrtc_callback_startup(void); +extern void ITs_webrtc_callback_cleanup(void); + +extern int ITc_webrtc_create_destroy_p(void); +extern int ITc_webrtc_start_stop_p(void); +extern int ITc_media_webrtc_get_state_p(void); +extern int ITc_media_webrtc_add_remove_media_source_p(void); +extern int ITc_media_webrtc_get_peer_connection_state_p(void); +extern int ITc_media_webrtc_get_signaling_state_p(void); +extern int ITc_media_webrtc_get_ice_gathering_state_p(void); +extern int ITc_media_webrtc_get_ice_connection_state_p(void); +extern int ITc_media_webrtc_media_source_set_get_transceiver_direction_p(void); +extern int ITc_media_webrtc_media_source_set_get_pause_p(void); +extern int ITc_media_webrtc_media_source_set_get_mute_p(void); +extern int ITc_media_webrtc_media_source_set_get_video_resolution_p(void); +extern int ITc_media_webrtc_mic_source_set_sound_stream_info_p(void); +extern int ITc_media_webrtc_media_packet_source_set_format_p(void); +extern int ITc_media_webrtc_media_packet_source_push_packet_p(void); +extern int ITc_media_webrtc_set_get_stun_server_p(void); +extern int ITc_media_webrtc_add_turn_server_p(void); +extern int ITc_media_webrtc_foreach_turn_server_p(void); +extern int ITc_media_webrtc_create_offer_answer_p(void); +extern int ITc_media_webrtc_set_local_description_p(void); +extern int ITc_media_webrtc_set_remote_description_p(void); +extern int ITc_media_webrtc_add_ice_candidate_p(void); +extern int ITc_media_webrtc_create_destroy_data_channel_p(void); +extern int ITc_media_webrtc_get_data_p(void); +extern int ITc_webrtc_data_channel_send_string_p(void); +extern int ITc_media_webrtc_set_unset_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_candidate_cb_p(void); +extern int ITc_media_webrtc_set_unset_negotiation_needed_cb_p(void); +extern int ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_signaling_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_video_frame_cb_p(void); +extern int ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_data_channel_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_open_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_message_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_close_cb_p(void); +extern int ITc_webrtc_data_channel_get_label_p(void); +extern int ITc_webrtc_set_unset_track_added_cb_p(void); +extern int ITc_webrtc_data_channel_send_bytes_p(void); +extern int ITc_media_webrtc_create_offer_async_p(void); +extern int ITc_media_webrtc_create_answer_async_p(void); + +testcase tc_array[] = { + {"ITc_webrtc_create_destroy_p", ITc_webrtc_create_destroy_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_start_stop_p", ITc_webrtc_start_stop_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_get_label_p", ITc_webrtc_data_channel_get_label_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_bytes_p", ITc_webrtc_data_channel_send_bytes_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_state_p",ITc_media_webrtc_get_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_async_p", ITc_media_webrtc_create_offer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_answer_async_p", ITc_media_webrtc_create_answer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_remove_media_source_p",ITc_media_webrtc_add_remove_media_source_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_peer_connection_state_p",ITc_media_webrtc_get_peer_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_signaling_state_p",ITc_media_webrtc_get_signaling_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_gathering_state_p",ITc_media_webrtc_get_ice_gathering_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_connection_state_p",ITc_media_webrtc_get_ice_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_transceiver_direction_p",ITc_media_webrtc_media_source_set_get_transceiver_direction_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_pause_p",ITc_media_webrtc_media_source_set_get_pause_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_mute_p",ITc_media_webrtc_media_source_set_get_mute_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_video_resolution_p",ITc_media_webrtc_media_source_set_get_video_resolution_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_mic_source_set_sound_stream_info_p",ITc_media_webrtc_mic_source_set_sound_stream_info_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_format_p",ITc_media_webrtc_media_packet_source_set_format_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_push_packet_p",ITc_media_webrtc_media_packet_source_push_packet_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_get_stun_server_p",ITc_media_webrtc_set_get_stun_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_turn_server_p",ITc_media_webrtc_add_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_foreach_turn_server_p",ITc_media_webrtc_foreach_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_answer_p",ITc_media_webrtc_create_offer_answer_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_local_description_p",ITc_media_webrtc_set_local_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_remote_description_p",ITc_media_webrtc_set_remote_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_ice_candidate_p",ITc_media_webrtc_add_ice_candidate_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_destroy_data_channel_p",ITc_media_webrtc_create_destroy_data_channel_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_data_p",ITc_media_webrtc_get_data_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_string_p",ITc_webrtc_data_channel_send_string_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_unset_state_changed_cb_p",ITc_media_webrtc_set_unset_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_error_cb_p",ITc_media_webrtc_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_candidate_cb_p",ITc_media_webrtc_set_unset_ice_candidate_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_negotiation_needed_cb_p",ITc_media_webrtc_set_unset_negotiation_needed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p",ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_signaling_state_change_cb_p",ITc_media_webrtc_set_unset_signaling_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p",ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p",ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p",ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_video_frame_cb_p",ITc_media_webrtc_set_unset_encoded_video_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p",ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_data_channel_cb_p",ITc_media_webrtc_set_unset_data_channel_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_open_cb_p",ITc_media_webrtc_data_channel_set_unset_open_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_message_cb_p",ITc_media_webrtc_data_channel_set_unset_message_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_error_cb_p",ITc_media_webrtc_data_channel_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_close_cb_p",ITc_media_webrtc_data_channel_set_unset_close_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_webrtc_set_unset_track_added_cb_p",ITc_webrtc_set_unset_track_added_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_WEBRTC_NATIVE_H__ diff --git a/src/itc/webrtc/tct-webrtc-native_tv.h b/src/itc/webrtc/tct-webrtc-native_tv.h new file mode 100755 index 000000000..ed13605dd --- /dev/null +++ b/src/itc/webrtc/tct-webrtc-native_tv.h @@ -0,0 +1,124 @@ +// +// Copyright (c) 2021 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 __TCT_WEBRTC_NATIVE_H__ +#define __TCT_WEBRTC_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +extern void ITs_webrtc_startup(void); +extern void ITs_webrtc_cleanup(void); +extern void ITs_webrtc_callback_startup(void); +extern void ITs_webrtc_callback_cleanup(void); + +extern int ITc_webrtc_create_destroy_p(void); +extern int ITc_webrtc_start_stop_p(void); +extern int ITc_media_webrtc_get_state_p(void); +extern int ITc_media_webrtc_add_remove_media_source_p(void); +extern int ITc_media_webrtc_get_peer_connection_state_p(void); +extern int ITc_media_webrtc_get_signaling_state_p(void); +extern int ITc_media_webrtc_get_ice_gathering_state_p(void); +extern int ITc_media_webrtc_get_ice_connection_state_p(void); +extern int ITc_media_webrtc_media_source_set_get_transceiver_direction_p(void); +extern int ITc_media_webrtc_media_source_set_get_pause_p(void); +extern int ITc_media_webrtc_media_source_set_get_mute_p(void); +extern int ITc_media_webrtc_media_source_set_get_video_resolution_p(void); +extern int ITc_media_webrtc_mic_source_set_sound_stream_info_p(void); +extern int ITc_media_webrtc_media_packet_source_set_format_p(void); +extern int ITc_media_webrtc_media_packet_source_push_packet_p(void); +extern int ITc_media_webrtc_set_get_stun_server_p(void); +extern int ITc_media_webrtc_add_turn_server_p(void); +extern int ITc_media_webrtc_foreach_turn_server_p(void); +extern int ITc_media_webrtc_create_offer_answer_p(void); +extern int ITc_media_webrtc_set_local_description_p(void); +extern int ITc_media_webrtc_set_remote_description_p(void); +extern int ITc_media_webrtc_add_ice_candidate_p(void); +extern int ITc_media_webrtc_create_destroy_data_channel_p(void); +extern int ITc_media_webrtc_get_data_p(void); +extern int ITc_webrtc_data_channel_send_string_p(void); +extern int ITc_media_webrtc_set_unset_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_candidate_cb_p(void); +extern int ITc_media_webrtc_set_unset_negotiation_needed_cb_p(void); +extern int ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_signaling_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_video_frame_cb_p(void); +extern int ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_data_channel_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_open_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_message_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_close_cb_p(void); +extern int ITc_webrtc_data_channel_get_label_p(void); +extern int ITc_webrtc_set_unset_track_added_cb_p(void); +extern int ITc_webrtc_data_channel_send_bytes_p(void); +extern int ITc_media_webrtc_create_offer_async_p(void); +extern int ITc_media_webrtc_create_answer_async_p(void); + +testcase tc_array[] = { + {"ITc_webrtc_create_destroy_p", ITc_webrtc_create_destroy_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_start_stop_p", ITc_webrtc_start_stop_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_get_label_p", ITc_webrtc_data_channel_get_label_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_bytes_p", ITc_webrtc_data_channel_send_bytes_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_state_p",ITc_media_webrtc_get_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_async_p", ITc_media_webrtc_create_offer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_answer_async_p", ITc_media_webrtc_create_answer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_remove_media_source_p",ITc_media_webrtc_add_remove_media_source_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_peer_connection_state_p",ITc_media_webrtc_get_peer_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_signaling_state_p",ITc_media_webrtc_get_signaling_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_gathering_state_p",ITc_media_webrtc_get_ice_gathering_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_connection_state_p",ITc_media_webrtc_get_ice_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_transceiver_direction_p",ITc_media_webrtc_media_source_set_get_transceiver_direction_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_pause_p",ITc_media_webrtc_media_source_set_get_pause_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_mute_p",ITc_media_webrtc_media_source_set_get_mute_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_video_resolution_p",ITc_media_webrtc_media_source_set_get_video_resolution_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_mic_source_set_sound_stream_info_p",ITc_media_webrtc_mic_source_set_sound_stream_info_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_format_p",ITc_media_webrtc_media_packet_source_set_format_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_push_packet_p",ITc_media_webrtc_media_packet_source_push_packet_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_get_stun_server_p",ITc_media_webrtc_set_get_stun_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_turn_server_p",ITc_media_webrtc_add_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_foreach_turn_server_p",ITc_media_webrtc_foreach_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_answer_p",ITc_media_webrtc_create_offer_answer_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_local_description_p",ITc_media_webrtc_set_local_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_remote_description_p",ITc_media_webrtc_set_remote_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_ice_candidate_p",ITc_media_webrtc_add_ice_candidate_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_destroy_data_channel_p",ITc_media_webrtc_create_destroy_data_channel_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_data_p",ITc_media_webrtc_get_data_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_string_p",ITc_webrtc_data_channel_send_string_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_unset_state_changed_cb_p",ITc_media_webrtc_set_unset_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_error_cb_p",ITc_media_webrtc_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_candidate_cb_p",ITc_media_webrtc_set_unset_ice_candidate_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_negotiation_needed_cb_p",ITc_media_webrtc_set_unset_negotiation_needed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p",ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_signaling_state_change_cb_p",ITc_media_webrtc_set_unset_signaling_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p",ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p",ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p",ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_video_frame_cb_p",ITc_media_webrtc_set_unset_encoded_video_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p",ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_data_channel_cb_p",ITc_media_webrtc_set_unset_data_channel_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_open_cb_p",ITc_media_webrtc_data_channel_set_unset_open_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_message_cb_p",ITc_media_webrtc_data_channel_set_unset_message_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_error_cb_p",ITc_media_webrtc_data_channel_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_close_cb_p",ITc_media_webrtc_data_channel_set_unset_close_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_webrtc_set_unset_track_added_cb_p",ITc_webrtc_set_unset_track_added_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_WEBRTC_NATIVE_H__ diff --git a/src/itc/webrtc/tct-webrtc-native_wearable.h b/src/itc/webrtc/tct-webrtc-native_wearable.h new file mode 100755 index 000000000..ed13605dd --- /dev/null +++ b/src/itc/webrtc/tct-webrtc-native_wearable.h @@ -0,0 +1,124 @@ +// +// Copyright (c) 2021 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 __TCT_WEBRTC_NATIVE_H__ +#define __TCT_WEBRTC_NATIVE_H__ + +#include "testcase.h" +#include "tct_common.h" + +extern void ITs_webrtc_startup(void); +extern void ITs_webrtc_cleanup(void); +extern void ITs_webrtc_callback_startup(void); +extern void ITs_webrtc_callback_cleanup(void); + +extern int ITc_webrtc_create_destroy_p(void); +extern int ITc_webrtc_start_stop_p(void); +extern int ITc_media_webrtc_get_state_p(void); +extern int ITc_media_webrtc_add_remove_media_source_p(void); +extern int ITc_media_webrtc_get_peer_connection_state_p(void); +extern int ITc_media_webrtc_get_signaling_state_p(void); +extern int ITc_media_webrtc_get_ice_gathering_state_p(void); +extern int ITc_media_webrtc_get_ice_connection_state_p(void); +extern int ITc_media_webrtc_media_source_set_get_transceiver_direction_p(void); +extern int ITc_media_webrtc_media_source_set_get_pause_p(void); +extern int ITc_media_webrtc_media_source_set_get_mute_p(void); +extern int ITc_media_webrtc_media_source_set_get_video_resolution_p(void); +extern int ITc_media_webrtc_mic_source_set_sound_stream_info_p(void); +extern int ITc_media_webrtc_media_packet_source_set_format_p(void); +extern int ITc_media_webrtc_media_packet_source_push_packet_p(void); +extern int ITc_media_webrtc_set_get_stun_server_p(void); +extern int ITc_media_webrtc_add_turn_server_p(void); +extern int ITc_media_webrtc_foreach_turn_server_p(void); +extern int ITc_media_webrtc_create_offer_answer_p(void); +extern int ITc_media_webrtc_set_local_description_p(void); +extern int ITc_media_webrtc_set_remote_description_p(void); +extern int ITc_media_webrtc_add_ice_candidate_p(void); +extern int ITc_media_webrtc_create_destroy_data_channel_p(void); +extern int ITc_media_webrtc_get_data_p(void); +extern int ITc_webrtc_data_channel_send_string_p(void); +extern int ITc_media_webrtc_set_unset_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_candidate_cb_p(void); +extern int ITc_media_webrtc_set_unset_negotiation_needed_cb_p(void); +extern int ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_signaling_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p(void); +extern int ITc_media_webrtc_set_unset_encoded_video_frame_cb_p(void); +extern int ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p(void); +extern int ITc_media_webrtc_set_unset_data_channel_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_open_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_message_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_error_cb_p(void); +extern int ITc_media_webrtc_data_channel_set_unset_close_cb_p(void); +extern int ITc_webrtc_data_channel_get_label_p(void); +extern int ITc_webrtc_set_unset_track_added_cb_p(void); +extern int ITc_webrtc_data_channel_send_bytes_p(void); +extern int ITc_media_webrtc_create_offer_async_p(void); +extern int ITc_media_webrtc_create_answer_async_p(void); + +testcase tc_array[] = { + {"ITc_webrtc_create_destroy_p", ITc_webrtc_create_destroy_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_start_stop_p", ITc_webrtc_start_stop_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_get_label_p", ITc_webrtc_data_channel_get_label_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_bytes_p", ITc_webrtc_data_channel_send_bytes_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_state_p",ITc_media_webrtc_get_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_async_p", ITc_media_webrtc_create_offer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_answer_async_p", ITc_media_webrtc_create_answer_async_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_remove_media_source_p",ITc_media_webrtc_add_remove_media_source_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_peer_connection_state_p",ITc_media_webrtc_get_peer_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_signaling_state_p",ITc_media_webrtc_get_signaling_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_gathering_state_p",ITc_media_webrtc_get_ice_gathering_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_ice_connection_state_p",ITc_media_webrtc_get_ice_connection_state_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_transceiver_direction_p",ITc_media_webrtc_media_source_set_get_transceiver_direction_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_pause_p",ITc_media_webrtc_media_source_set_get_pause_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_mute_p",ITc_media_webrtc_media_source_set_get_mute_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_source_set_get_video_resolution_p",ITc_media_webrtc_media_source_set_get_video_resolution_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_mic_source_set_sound_stream_info_p",ITc_media_webrtc_mic_source_set_sound_stream_info_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_format_p",ITc_media_webrtc_media_packet_source_set_format_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_media_packet_source_push_packet_p",ITc_media_webrtc_media_packet_source_push_packet_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_get_stun_server_p",ITc_media_webrtc_set_get_stun_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_turn_server_p",ITc_media_webrtc_add_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_foreach_turn_server_p",ITc_media_webrtc_foreach_turn_server_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_offer_answer_p",ITc_media_webrtc_create_offer_answer_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_local_description_p",ITc_media_webrtc_set_local_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_remote_description_p",ITc_media_webrtc_set_remote_description_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_add_ice_candidate_p",ITc_media_webrtc_add_ice_candidate_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_create_destroy_data_channel_p",ITc_media_webrtc_create_destroy_data_channel_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_get_data_p",ITc_media_webrtc_get_data_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_webrtc_data_channel_send_string_p",ITc_webrtc_data_channel_send_string_p, ITs_webrtc_startup, ITs_webrtc_cleanup}, + {"ITc_media_webrtc_set_unset_state_changed_cb_p",ITc_media_webrtc_set_unset_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_error_cb_p",ITc_media_webrtc_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_candidate_cb_p",ITc_media_webrtc_set_unset_ice_candidate_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_negotiation_needed_cb_p",ITc_media_webrtc_set_unset_negotiation_needed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p",ITc_media_webrtc_set_unset_peer_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_signaling_state_change_cb_p",ITc_media_webrtc_set_unset_signaling_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p",ITc_media_webrtc_set_unset_ice_gathering_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p",ITc_media_webrtc_set_unset_ice_connection_state_change_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p",ITc_media_webrtc_set_unset_encoded_audio_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_encoded_video_frame_cb_p",ITc_media_webrtc_set_unset_encoded_video_frame_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p",ITc_media_webrtc_media_packet_source_set_unset_buffer_state_changed_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_set_unset_data_channel_cb_p",ITc_media_webrtc_set_unset_data_channel_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_open_cb_p",ITc_media_webrtc_data_channel_set_unset_open_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_message_cb_p",ITc_media_webrtc_data_channel_set_unset_message_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_error_cb_p",ITc_media_webrtc_data_channel_set_unset_error_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_media_webrtc_data_channel_set_unset_close_cb_p",ITc_media_webrtc_data_channel_set_unset_close_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {"ITc_webrtc_set_unset_track_added_cb_p",ITc_webrtc_set_unset_track_added_cb_p,ITs_webrtc_callback_startup, ITs_webrtc_callback_cleanup}, + {NULL, NULL} +}; + +#endif // __TCT_WEBRTC_NATIVE_H__