const char g_szPorttest[] = "porttest";
const char g_szPort_Name[] = "Message";
static char g_szProxygetporttest[] = "proxygetporttest";
+const char g_szSharingArraytest[] = "sharingarraytest";
+const char g_szSetSharingtest[] = "setsharingtest";
+const char g_szUnsetSharingttest[] = "unsetsharingtest";
+
+static int nRet;
+
+
/**
* @function Rpc_Message_On_Connected_cb
* @description Callback function for rpc_port_proxy_add_connected_event_cb.
g_bCallbackCalled = true;
char *pszWrite = NULL;
+
if (data == g_szDisconnecttest) {
FPRINTF("[Line : %d][%s] connected to test disconnect %s\\n", __LINE__, API_NAMESPACE,endpoint);
pszWrite = "disconnect";
FPRINTF("[Line : %d][%s] connected to test read and write data %s\\n", __LINE__, API_NAMESPACE,endpoint);
pszWrite = "write";
}
- if ((data == g_szDisconnecttest) || (data == g_szPorttest) || (data == g_szReceivetest))
+ if ((data == g_szDisconnecttest) || (data == g_szPorttest) || (data == g_szReceivetest))
{
rpc_port_parcel_h hParcel;
g_hReceivedPort = port;
normal_exit(0);
FPRINTF("[Line : %d][%s] Leaving Callback Rpc_Message_On_Connected_cb \\n", __LINE__, API_NAMESPACE);
return;
- }
- if (data == g_szProxygetporttest)
+ }
+ if (data == g_szProxygetporttest)
{
rpc_port_h callback_port;
int ret;
ret = rpc_port_proxy_get_port(g_hproxyhandle, RPC_PORT_PORT_CALLBACK, &callback_port);
- if (ret != RPC_PORT_ERROR_NONE)
+ if (ret != RPC_PORT_ERROR_NONE)
{
FPRINTF("[Line : %d][%s] rpc_port_proxy_get_port fail %s\\n", __LINE__, API_NAMESPACE,endpoint);
normal_exit(1);
return;
- }
- else
+ }
+ else
{
normal_exit(0);
return;
}
}
+ if (data == g_szSharingArraytest)
+ {
+ char pszFile1[PATH_LEN];
+ char pszFile2[PATH_LEN];
+ const char *pszFiles[3] = { NULL, };
+ int nCount = 2;
+
+ GetFilePath("file_name1.txt", pszFile1, sizeof(pszFile1));
+ GetFilePath("file_name2.txt", pszFile2, sizeof(pszFile2));
+ CreateFile(pszFile1, "test1");
+ CreateFile(pszFile2, "test2");
+
+ pszFiles[0] = pszFile1;
+ pszFiles[1] = pszFile2;
+ nRet = rpc_port_set_private_sharing_array(port, pszFiles, nCount);
+ }
+ if (data == g_szSetSharingtest)
+ {
+ char pszFile[PATH_LEN];
+ GetFilePath("file_name.txt", pszFile, sizeof(pszFile));
+ CreateFile(pszFile, "test");
+ nRet = rpc_port_set_private_sharing(port, pszFile);
+ }
+ if (data == g_szUnsetSharingttest)
+ {
+ nRet = rpc_port_unset_private_sharing(port);
+ }
if (strncmp(endpoint, g_szService_App_Id,strlen(endpoint))) {
FPRINTF("[Line : %d][%s] Mismatch App Id \\n", __LINE__, API_NAMESPACE);
FPRINTF("[Line : %d][%s] connected to test read and write data %s\\n", __LINE__, API_NAMESPACE,endpoint);
pszWrite = "write";
}
- if ((data == g_szDisconnecttest) || (data == g_szPorttest) || (data == g_szReceivetest))
+ if ((data == g_szDisconnecttest) || (data == g_szPorttest) || (data == g_szReceivetest))
{
rpc_port_parcel_h hParcel;
g_hReceivedPort = port;
rpc_port_parcel_destroy(hParcel);
g_main_loop_quit(g_pMainLoop);
return;
- }
+ }
if (data == g_szProxygetporttest) {
rpc_port_h callback_port;
int ret;
int nRet = -1;
int nRetRead;
-
+
nRetRead = rpc_port_proxy_get_port(g_hproxyhandle, RPC_PORT_PORT_CALLBACK, &hreceivedport);
if ( nRetRead != RPC_PORT_ERROR_NONE )
{
normal_exit(1);
return;
}
-
+
nRetRead = rpc_port_parcel_create_from_port(&parcel_received, hreceivedport);
if(nRetRead != RPC_PORT_ERROR_NONE)
{
rpc_port_h *hPort = NULL;
g_bCallbackCalled = false;
int nTimeoutId = -1;
- rpc_port_port_type_e ePortType[]= {
+ rpc_port_port_type_e ePortType[]= {
RPC_PORT_PORT_MAIN, /**< Main channel */
RPC_PORT_PORT_CALLBACK, /**< The channel for callbacks */
};
int ITc_rpc_port_proxy_add_received_event_cb_p(void)
{
START_TEST;
-
+
rpc_port_proxy_h hPortProxy = NULL;
g_bCallbackCalled = false;
g_callbackMsgreceived = false;
return 0;
}
+/**
+* @testcase ITc_rpc_port_proxy_connect_sync_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Connects to rpc port synchronously.
+* @scenario Check whether the result is RPC_PORT_ERROR_NONE or NOT
+* and check if connected callback is called.
+* @apicovered rpc_port_proxy_connect_sync
+* @passcase When rpc_port_proxy_connect_sync is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_proxy_connect_sync_p(void)
+{
+ START_TEST;
+
+ int nRetVal = -1;
+ g_bCallbackCalled = false;
+
+ nRetVal = rpc_port_proxy_add_connected_event_cb(g_hproxyhandle,Rpc_Message_On_Connected_cb, NULL);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_connected_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_connect_sync(g_hproxyhandle,g_szService_App_Id, g_szPort_Name);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_connect_sync", RpcPortGetError(nRetVal));
+ PRINT_RESULT(true, g_bCallbackCalled, "rpc_port_proxy_connect_sync", RpcPortGetError(nRetVal));
+
+ return 0;
+}
+
+/**
+* @testcase ITc_rpc_port_set_private_sharing_array_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Shares files for the stub application.
+* @scenario Check whether the result is RPC_PORT_ERROR_NONE or NOT
+* Sets the paths of private sharing files.
+* @apicovered rpc_port_set_private_sharing_array
+* @passcase When rpc_port_set_private_sharing_array is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_set_private_sharing_array_p(void)
+{
+ START_TEST;
+
+ int nRetVal = -1;
+ nRet = -1;
+ g_bCallbackCalled = false;
+
+ nRetVal = rpc_port_proxy_add_connected_event_cb(g_hproxyhandle,Rpc_Message_On_Connected_cb, g_szSharingArraytest);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_connected_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_connect_sync(g_hproxyhandle,g_szService_App_Id, g_szPort_Name);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_connect_sync", RpcPortGetError(nRetVal));
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRet, "rpc_port_set_private_sharing_array", RpcPortGetError(nRetVal));
+ PRINT_RESULT(true, g_bCallbackCalled, "rpc_port_set_private_sharing_array", RpcPortGetError(nRetVal));
+
+ return 0;
+}
+
+/**
+* @testcase ITc_rpc_port_set_private_sharing_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Shares a file for the stub application.
+* @scenario Check whether the result is RPC_PORT_ERROR_NONE or NOT
+* Sets the path of the private sharing file.
+* @apicovered rpc_port_set_private_sharing
+* @passcase When rpc_port_set_private_sharing is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_set_private_sharing_p(void)
+{
+ START_TEST;
+
+ int nRetVal = -1;
+ nRet = -1;
+ g_bCallbackCalled = false;
+
+
+ nRetVal = rpc_port_proxy_add_connected_event_cb(g_hproxyhandle,Rpc_Message_On_Connected_cb, g_szSetSharingtest);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_connected_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_connect_sync(g_hproxyhandle,g_szService_App_Id, g_szPort_Name);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_connect_sync", RpcPortGetError(nRetVal));
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRet, "rpc_port_set_private_sharing", RpcPortGetError(nRetVal));
+ PRINT_RESULT(true, g_bCallbackCalled, "rpc_port_set_private_sharing", RpcPortGetError(nRetVal));
+
+ return 0;
+}
+
+/**
+* @testcase ITc_rpc_port_unset_private_sharing_p
+* @since_tizen 6.0
+* @author SRID(priya.kohli)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Unshares the file.
+* @scenario Check whether the result is RPC_PORT_ERROR_NONE or NOT
+* Unsets the private sharing.
+* @apicovered rpc_port_unset_private_sharing
+* @passcase When rpc_port_unset_private_sharing is successful.
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+int ITc_rpc_port_unset_private_sharing_p(void)
+{
+ START_TEST;
+
+ int nRetVal = -1;
+ nRet = -1;
+ g_bCallbackCalled = false;
+
+ nRetVal = rpc_port_proxy_add_connected_event_cb(g_hproxyhandle,Rpc_Message_On_Connected_cb, g_szUnsetSharingttest);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_add_connected_event_cb", RpcPortGetError(nRetVal));
+
+ nRetVal = rpc_port_proxy_connect_sync(g_hproxyhandle,g_szService_App_Id, g_szPort_Name);
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRetVal, "rpc_port_proxy_connect_sync", RpcPortGetError(nRetVal));
+ PRINT_RESULT(RPC_PORT_ERROR_NONE, nRet, "rpc_port_unset_private_sharing", RpcPortGetError(nRetVal));
+ PRINT_RESULT(true, g_bCallbackCalled, "rpc_port_unset_private_sharing", RpcPortGetError(nRetVal));
+
+ return 0;
+}
+
+/** @} */
/** @} */
-/** @} */
\ No newline at end of file