From: Daehyeon Jung Date: Thu, 1 Aug 2019 10:59:54 +0000 (+0900) Subject: [ITC][capmgr][non-ACR][Fix app control reply] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08046779012e3c505eedd151c68c4e5ef05d8c07;p=test%2Ftct%2Fnative%2Fapi.git [ITC][capmgr][non-ACR][Fix app control reply] Change-Id: I97daab8be4e0ea1511aeb94e24986d8b3d4978ae --- diff --git a/src/itc/capmgr/ITs-capmgr-app-control.c b/src/itc/capmgr/ITs-capmgr-app-control.c index 01409cc4f..947fc19fa 100644 --- a/src/itc/capmgr/ITs-capmgr-app-control.c +++ b/src/itc/capmgr/ITs-capmgr-app-control.c @@ -86,6 +86,12 @@ int CapmgrAppControlReplyCallBack(const capmgr_app_control_h request, const capm #if DEBUG FPRINTF("[Line : %d][%s] %s Callback Invoked\\n", __LINE__, API_NAMESPACE, "CapmgrAppControlReplyCallBack"); #endif + if (g_pApplicationMainLoop) + { + g_main_loop_quit(g_pApplicationMainLoop); + g_pApplicationMainLoop = NULL; + } + g_CallBackHit = true; return 1; } @@ -538,6 +544,7 @@ int ITc_capmgr_app_control_send_p(void) START_TEST; int nRet = -1; + int nTimeoutId = 0; capmgr_app_control_h hAppControl = NULL; void *pszData = NULL; @@ -551,8 +558,11 @@ int ITc_capmgr_app_control_send_p(void) PRINT_RESULT_CLEANUP(true, g_CallBackHit, "CapmgrAppControlForeachAppCallBack", "CallBack Not Invoked", capmgr_app_control_destroy(hAppControl)); g_CallBackHit = false; + nRet = capmgr_app_control_set_appid(hAppControl, TEST_APP_ID); nRet = capmgr_app_control_send(hAppControl, CapmgrAppControlReplyCallBack, pszData); PRINT_RESULT_CLEANUP(CAPMGR_ERROR_NONE, nRet, "capmgr_app_control_send", CapMgrGetError(nRet), capmgr_app_control_destroy(hAppControl)); + + RUN_POLLING_LOOP; PRINT_RESULT_CLEANUP(true, g_CallBackHit, "CapmgrAppControlReplyCallBack", "CallBack Not Invoked", capmgr_app_control_destroy(hAppControl)); nRet = capmgr_app_control_destroy(hAppControl); diff --git a/src/itc/capmgr/ITs-capmgr-common.c b/src/itc/capmgr/ITs-capmgr-common.c index 94f08f049..1a970f0b3 100755 --- a/src/itc/capmgr/ITs-capmgr-common.c +++ b/src/itc/capmgr/ITs-capmgr-common.c @@ -62,4 +62,21 @@ char* CapMgrGetError(int nRet) 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); + } + return false; +} + /** @} */ diff --git a/src/itc/capmgr/ITs-capmgr-common.h b/src/itc/capmgr/ITs-capmgr-common.h index 2eac2a6db..7fb33146f 100755 --- a/src/itc/capmgr/ITs-capmgr-common.h +++ b/src/itc/capmgr/ITs-capmgr-common.h @@ -19,6 +19,7 @@ #include "tct_common.h" #include "tct_app_common.h" #include +#include /** @addtogroup itc-capmgr * @ingroup itc @@ -27,6 +28,7 @@ #define API_NAMESPACE "CAPMGR_ITC" +GMainLoop *g_pApplicationMainLoop; bool g_CallBackHit; //Add helper function declarations here @@ -40,7 +42,10 @@ int CapmgrDeviceForeachDeviceCallBack(const capmgr_device_h hDevice, void *user_ int CapmgrDeviceForeachAppCallBack(const capmgr_device_h hDevice, void *user_data); int CapmgrAppControlForeachAppCallBack(const capmgr_device_h hDevice, void *user_data); int CapmgrAppControlReplyCallBack(const capmgr_app_control_h request, const capmgr_app_control_h reply, capmgr_app_control_result_e result, void* user_data); +gboolean Timeout(gpointer data); +#define TEST_APP_ID "org.example.capmgrsample" +#define TIMEOUT_CB 10000 #define START_TEST {\ FPRINTF("[Line : %d][%s] Starting test : %s\\n", __LINE__, API_NAMESPACE, __FUNCTION__);\ @@ -70,5 +75,13 @@ int CapmgrAppControlReplyCallBack(const capmgr_app_control_h request, const capm StringVariable = NULL;\ } +#define RUN_POLLING_LOOP {\ + g_pApplicationMainLoop = g_main_loop_new(NULL, false);\ + nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_pApplicationMainLoop);\ + g_main_loop_run(g_pApplicationMainLoop);\ + g_source_remove(nTimeoutId);\ + g_pApplicationMainLoop = NULL;\ +} + /** @} */ #endif //_ITS_CAPMGR_COMMON_H_ diff --git a/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-arm.tpk b/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-arm.tpk index 72c3d1f47..64939b90c 100644 Binary files a/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-arm.tpk differ diff --git a/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-x86.tpk b/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-x86.tpk index edeb18e14..31101fce5 100644 Binary files a/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/mobile/org.example.capmgrsample-1.0.0-x86.tpk differ diff --git a/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-arm.tpk b/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-arm.tpk index 72c3d1f47..64939b90c 100644 Binary files a/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-arm.tpk differ diff --git a/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-x86.tpk b/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-x86.tpk index edeb18e14..31101fce5 100644 Binary files a/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/tizeniot/org.example.capmgrsample-1.0.0-x86.tpk differ diff --git a/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-arm.tpk b/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-arm.tpk index 72c3d1f47..64939b90c 100644 Binary files a/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-arm.tpk differ diff --git a/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-x86.tpk b/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-x86.tpk index edeb18e14..31101fce5 100644 Binary files a/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/tv/org.example.capmgrsample-1.0.0-x86.tpk differ diff --git a/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-arm.tpk b/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-arm.tpk index 72c3d1f47..64939b90c 100644 Binary files a/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-arm.tpk and b/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-arm.tpk differ diff --git a/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-x86.tpk b/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-x86.tpk index edeb18e14..31101fce5 100644 Binary files a/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-x86.tpk and b/src/itc/capmgr/res/wearable/org.example.capmgrsample-1.0.0-x86.tpk differ