#define TEST_STRING_DATA "test string"
#define TEST_BUFFER_SIZE 16
#include "ITs-webrtc-common.h"
+#include <Elementary.h>
+static Evas_Object *g_win = NULL;
+static void winDeleteCB(void *data, Evas_Object *obj, void *event)
+{
+ elm_exit();
+}
+
+static void createWindow()
+{
+ int w = 0;
+ int h = 0;
+
+ g_win = elm_win_util_standard_add("webrtc_itc", "webrtc_itc");
+ if (g_win) {
+ elm_win_borderless_set(g_win, EINA_TRUE);
+ evas_object_smart_callback_add(g_win, "delete,request", winDeleteCB, NULL);
+ elm_win_screen_size_get(g_win, NULL, NULL, &w, &h);
+ evas_object_resize(g_win, w, h);
+ elm_win_autodel_set(g_win, EINA_TRUE);
+ }
+
+}
+
+static void destroyWindow()
+{
+
+ if (g_win) {
+ evas_object_del(g_win);
+ g_win = NULL;
+ }
+}
//& set: Webrtc
return 0;
}
+
+//& purpose: Sets and Gets an audio loopback to render the audio frames of the media source.
+//& type: auto
+/**
+* @testcase ITc_media_webrtc_media_source_set_audio_loopback_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Gets an audio loopback to render the audio frames of the media source.
+* @scenario Sets and Gets an audio loopback to render the audio frames of the media source.
+* @apicovered webrtc_media_source_set_audio_loopback
+* @passcase If webrtc_media_source_set_audio_loopback is successfull
+* @failcase If webrtc_media_source_set_audio_loopback fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_media_webrtc_media_source_set_audio_loopback_p(void)
+{
+ START_TEST;
+ unsigned int nId;
+ sound_stream_info_h hStreamInfo;
+ g_bCallbackCalled = false;
+ int nTimeoutId = -1;
+
+ createWindow();
+ 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 = 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));
+
+ nRet = webrtc_media_source_set_audio_loopback(g_hWebRtcHandle, nId, hStreamInfo, NULL);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_audio_loopback", 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_stop(g_hWebRtcHandle);
+ PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));
+
+ nRet = sound_manager_destroy_stream_information(hStreamInfo);
+ PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "sound_manager_destroy_stream_information", WebRtcGetError(nRet));
+ destroyWindow();
+
+ return 0;
+}
+
+//& purpose: Sets a video loopback to render the video frames of the media source.
+//& type: auto
+/**
+* @testcase ITc_media_webrtc_media_source_set_video_loopback_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets a video loopback to render the video frames of the media source.
+* @scenario Sets a video loopback to render the video frames of the media source.
+* @apicovered webrtc_media_source_set_video_loopback
+* @passcase If webrtc_media_source_set_video_loopback is successfull
+* @failcase If webrtc_media_source_set_video_loopback fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_media_webrtc_media_source_set_video_loopback_p(void)
+{
+ START_TEST;
+ unsigned int nId;
+ sound_stream_info_h hStreamInfo;
+ g_bCallbackCalled = false;
+ int nTimeoutId = -1;
+
+ createWindow();
+ 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_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_media_source_set_video_loopback(g_hWebRtcHandle, nId, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, NULL);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", 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_stop(g_hWebRtcHandle);
+ PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));
+ destroyWindow();
+
+ return 0;
+}
+
+//& purpose: Sets and Gets the display mode of the video track.
+//& type: auto
+/**
+* @testcase ITc_media_webrtc_set_get_display_mode_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Gets the display mode of the video track.
+* @scenario Sets and Gets the display mode of the video track.
+* @apicovered webrtc_set_display_mode,webrtc_get_display_mode
+* @passcase If webrtc_set_display_mode,webrtc_get_display_mode is successfull
+* @failcase If webrtc_set_display_mode,webrtc_get_display_mode fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_media_webrtc_set_get_display_mode_p(void)
+{
+ START_TEST;
+ unsigned int nId,nTrackId;
+ sound_stream_info_h hStreamInfo;
+ g_bCallbackCalled = false;
+ int nTimeoutId = -1;
+ webrtc_display_mode_e eMode;
+
+ createWindow();
+ 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_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_media_source_set_video_loopback(g_hWebRtcHandle, nId, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &nTrackId);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", 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_set_display_mode(g_hWebRtcHandle, nTrackId, WEBRTC_DISPLAY_MODE_FULL);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_display_mode", WebRtcGetError(nRet));
+
+ nRet = webrtc_get_display_mode(g_hWebRtcHandle, nTrackId, &eMode);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_display_mode", WebRtcGetError(nRet));
+ PRINT_RESULT(WEBRTC_DISPLAY_MODE_FULL, eMode, "webrtc_get_display_mode", WebRtcGetError(nRet));
+
+ nRet = webrtc_stop(g_hWebRtcHandle);
+ PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));
+ destroyWindow();
+ return 0;
+}
+
+//& purpose: Sets and Gets the display visibleness of the video track.
+//& type: auto
+/**
+* @testcase ITc_media_webrtc_set_get_display_visible_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Gets the display visibleness of the video track.
+* @scenario Sets and Gets the display visibleness of the video track.
+* @apicovered webrtc_set_display_visible,webrtc_get_display_visible
+* @passcase If webrtc_set_display_visible,webrtc_get_display_visible is successfull
+* @failcase If webrtc_set_display_visible,webrtc_get_display_visible fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_media_webrtc_set_get_display_visible_p(void)
+{
+ START_TEST;
+ unsigned int nId,nTrackId;
+ sound_stream_info_h hStreamInfo;
+ g_bCallbackCalled = false;
+ int nTimeoutId = -1;
+ webrtc_display_mode_e eMode;
+ bool bGetVisible, bSetVisible = false;
+
+ createWindow();
+ 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_media_source_set_video_loopback(g_hWebRtcHandle, nId, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &nTrackId);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", 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_set_display_visible(g_hWebRtcHandle, nTrackId, bSetVisible);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_display_visible", WebRtcGetError(nRet));
+
+ nRet = webrtc_get_display_visible(g_hWebRtcHandle, nTrackId, &bGetVisible);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_display_visible", WebRtcGetError(nRet));
+ PRINT_RESULT(bGetVisible, bSetVisible, "webrtc_get_display_visible", WebRtcGetError(nRet));
+
+ nRet = webrtc_stop(g_hWebRtcHandle);
+ PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));
+ destroyWindow();
+ return 0;
+}
+
+//& purpose: Sets and Gets a ICE transport policy that represents which candidates the ICE Agent is allowed to use.
+//& type: auto
+/**
+* @testcase ITc_media_webrtc_set_get_ice_transport_policy_p
+* @since_tizen 6.5
+* @author SRID(nibha.sharma)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sets and Gets a ICE transport policy that represents which candidates the ICE Agent is allowed to use.
+* @scenario Sets and Gets a ICE transport policy that represents which candidates the ICE Agent is allowed to use.
+* @apicovered webrtc_set_ice_transport_policy,webrtc_get_ice_transport_policy
+* @passcase If webrtc_set_ice_transport_policy,webrtc_get_ice_transport_policy is successfull
+* @failcase If webrtc_set_ice_transport_policy,webrtc_get_ice_transport_policy fails
+* @precondition NA
+* @postcondition NA
+*/
+int ITc_media_webrtc_set_get_ice_transport_policy_p(void)
+{
+ START_TEST;
+ webrtc_ice_transport_policy_e eGetPolicy;
+ createWindow();
+
+ int nRet = webrtc_set_ice_transport_policy(g_hWebRtcHandle, WEBRTC_ICE_TRANSPORT_POLICY_RELAY);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_transport_policy", WebRtcGetError(nRet));
+
+ nRet = webrtc_get_ice_transport_policy(g_hWebRtcHandle, &eGetPolicy);
+ PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_ice_transport_policy", WebRtcGetError(nRet));
+ PRINT_RESULT(WEBRTC_ICE_TRANSPORT_POLICY_RELAY, eGetPolicy, "webrtc_get_ice_transport_policy", WebRtcGetError(nRet));
+ destroyWindow();
+ return 0;
+}
/** @} */
/** @} */