From: Sangchul Lee Date: Tue, 28 Dec 2021 05:07:44 +0000 (+0900) Subject: [ITC][webrtc][non-ACR] Add QUIT_LOOP macro X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F13%2F268613%2F3;p=test%2Ftct%2Fnative%2Fapi.git [ITC][webrtc][non-ACR] Add QUIT_LOOP macro Change-Id: I6fc3c6661c889fac822dbe39bc4a5b62d47e6101 Signed-off-by: Sangchul Lee --- diff --git a/src/itc/webrtc/ITs-webrtc-common.h b/src/itc/webrtc/ITs-webrtc-common.h index c3fa0f92c..787bfa2b9 100755 --- a/src/itc/webrtc/ITs-webrtc-common.h +++ b/src/itc/webrtc/ITs-webrtc-common.h @@ -33,17 +33,14 @@ #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;\ -}\ + 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)\ - {\ + if(!g_bCallbackCalled) {\ guint nTimeoutId;\ g_pMainLoop = g_main_loop_new(NULL, false);\ nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_pMainLoop);\ @@ -54,9 +51,15 @@ }\ } +#define QUIT_LOOP {\ + if (g_pMainLoop) {\ + dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_quit(), g_pMainLoop[%p]", __FUNCTION__, __LINE__, g_pMainLoop);\ + g_main_loop_quit(g_pMainLoop);\ + }\ +} + #define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\ - if ( Handle == NULL )\ - {\ + if (!Handle) {\ FPRINTF("[Line : %d][%s] %s failed, error returned = Handle returned is NULL\\n", __LINE__, API_NAMESPACE, API);\ FreeResource;\ return 1;\ diff --git a/src/itc/webrtc/ITs-webrtc.c b/src/itc/webrtc/ITs-webrtc.c index 878044856..b2880c5e5 100755 --- a/src/itc/webrtc/ITs-webrtc.c +++ b/src/itc/webrtc/ITs-webrtc.c @@ -67,12 +67,7 @@ static void webrtcSessionDescriptionCreatedCB(webrtc_h webrtc, const char *descr { g_bCallbackCalled = true; FPRINTF("[Line : %d][%s] Callback webrtcSessionDescriptionCreatedCB called\\n", __LINE__, API_NAMESPACE); - if (g_pMainLoop) - { - dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_quit(), g_pMainLoop[%p]", __FUNCTION__, __LINE__, g_pMainLoop); - g_main_loop_quit(g_pMainLoop); - g_pMainLoop = NULL; - } + QUIT_LOOP; } /** @@ -104,12 +99,7 @@ static void webrtcStateChangedCB(webrtc_h webrtc, webrtc_state_e previous, webrt { g_bCallbackCalled = true; FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB called\\n", __LINE__, API_NAMESPACE); - if (g_pMainLoop) - { - dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_quit(), g_pMainLoop[%p]", __FUNCTION__, __LINE__, g_pMainLoop); - g_main_loop_quit(g_pMainLoop); - g_pMainLoop = NULL; - } + QUIT_LOOP; } /** @@ -121,12 +111,7 @@ static void webrtcSignalingStateChangeCB(webrtc_h webrtc, webrtc_signaling_state { g_bCallbackCalled = true; FPRINTF("[Line : %d][%s] Callback webrtcSignalingStateChangeCB called\\n", __LINE__, API_NAMESPACE); - if (g_pMainLoop) - { - dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_quit(), g_pMainLoop[%p]", __FUNCTION__, __LINE__, g_pMainLoop); - g_main_loop_quit(g_pMainLoop); - g_pMainLoop = NULL; - } + QUIT_LOOP; } /**