bool g_bDataControlCreation;
bool g_bCallbackHit;
bool g_bIsInsertDataCheck;
+bool g_bDataChangeCallbackHit;
+bool g_bAddCallbackResult;
bool g_bIsRemoveDataCheck;
char g_szWordDesc[DUMMYVALUELENGTH];
GMainLoop *g_pDataControlMainLoop;
if ( nRet != DATA_CONTROL_ERROR_NONE )
{
- return false;
+ return false;
}
else
{
static void DataControlProviderSqlInsertCb(int request_id, data_control_h provider, bundle *insert_data, void *user_data)
{
#if DEBUG
- FPRINTF("[Line : %d][%s] DataControlProviderSqlInsertCb callback called\\n", __LINE__, API_NAMESPACE);
+FPRINTF("[Line : %d][%s] DataControlProviderSqlInsertCb callback called\\n", __LINE__, API_NAMESPACE);
#endif
g_nRequestId = request_id;
return;
}
+
+
+/**
+* @function DataControlAddCallbackResultCB
+* @description Called when the consumer receives the result of the data change callback adding operation.
+* @parameter data_control_h provider, data_control_error_e result, int callback_id, void *user_data
+* @return NA
+*/
+static void DataControlAddCallbackResultCB( data_control_h provider, data_control_error_e result, int callback_id, void *user_data)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] DataControlAddCallbackResultCB callback called\\n", __LINE__, API_NAMESPACE);
+#endif
+FPRINTF("[Line : %d][%s] DataControlAddCallbackResultCB callback called\\n", __LINE__, API_NAMESPACE);
+ g_bAddCallbackResult = true;
+
+ if ( g_pDataControlMainLoop )
+ {
+ g_main_loop_quit(g_pDataControlMainLoop);
+ }
+ return;
+}
+/**
+* @function DataControlDataChangeCB
+* @description Called when received data changed notification from provider application.
+* @parameter data_control_h provider, data_control_data_change_type_e type, bundle *data, void *user_data
+* @return NA
+*/
+static void DataControlDataChangeCB(data_control_h provider, data_control_data_change_type_e type, bundle *data, void *user_data)
+{
+#if DEBUG
+ FPRINTF("[Line : %d][%s] DataControlDataChangeCB callback called\\n", __LINE__, API_NAMESPACE);
+#endif
+FPRINTF("[Line : %d][%s] DataControlDataChangeCB callback called\\n", __LINE__, API_NAMESPACE);
+ g_bDataChangeCallbackHit = true;
+
+ if ( g_pDataControlMainLoop )
+ {
+ g_main_loop_quit(g_pDataControlMainLoop);
+ }
+ return;
+}
+
/**
* @function DataControlProviderMapRemoveCb
* @description Called when record is removed
return 0;
}
+/**
+* @testcase CTc_DataControl_PrivilegeDataControlprovider_add_cb
+* @since_tizen 3.0
+* @author SRID(manoj.g2)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sends a data change notification to consumer applications which have successfully added a data change callback.
+* @scenario Call data_control_provider_send_data_change_noti
+* @apicovered data_control_provider_send_data_change_noti
+* @passcase When data_control_provider_send_data_change_noti is successful
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+//& purpose: API to test data_control_provider_match_provider_id
+//& type: auto
+int CTc_DataControl_PrivilegeDataControlprovider_add_cb(void)
+{
+ START_TEST;
+
+ int pCallbackId = -1;
+ int nTimeoutId = 0 ;
+ g_bDataChangeCallbackHit = false;
+ g_bAddCallbackResult = false;
+
+ bundle *pBundleData = bundle_create();
+ if ( pBundleData == NULL )
+ {
+ FPRINTF("[Line : %d][%s] bundle_create failed\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+ // Target API
+ int nRet = data_control_add_data_change_cb(g_stSqlProvider, DataControlDataChangeCB, NULL, DataControlAddCallbackResultCB, NULL, &pCallbackId);
+ PRINT_RESULT_CLEANUP(TIZEN_ERROR_PERMISSION_DENIED, nRet, "data_control_add_data_change_cb", DataControlGetError(nRet),bundle_free(pBundleData));
+ bundle_free(pBundleData);
+ return 0;
+}
+/**
+* @testcase CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti
+* @since_tizen 3.0
+* @author SRID(manoj.g2)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Sends a data change notification to consumer applications which have successfully added a data change callback.
+* @scenario Call data_control_provider_send_data_change_noti
+* @apicovered data_control_provider_send_data_change_noti
+* @passcase When data_control_provider_send_data_change_noti is successful
+* @failcase If target API fails or any precondition API fails
+* @precondition None
+* @postcondition None
+*/
+//& purpose: API to test data_control_provider_match_provider_id
+//& type: auto
+int CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti(void)
+{
+ START_TEST;
+
+ int pCallbackId = -1;
+ int nTimeoutId = 0 ;
+ g_bDataChangeCallbackHit = false;
+ int nRequestId = 0;
+
+ if ( DataControlInitiateSqlHandle(&g_stSqlProvider) == true )
+ {
+ if ( DataControlInitiateMapHandle(&g_stMapProvider) == true )
+ {
+ g_bDataControlCreation = true;
+ }
+ }
+ bundle *pstData = bundle_create();
+ if ( pstData == NULL )
+ {
+ FPRINTF("[Line : %d][%s] bundle_create failed\\n", __LINE__, API_NAMESPACE);
+ return 1;
+ }
+
+
+ bundle_add_str(pstData, DUMMYKEY, DUMMYVALUE);
+ memset(g_szWhere, 0, QUERYSIZE);
+ sprintf(g_szWhere, "rowid=1");
+ g_bAddCallbackResult = false;
+
+
+ int nRet = data_control_provider_send_data_change_noti( g_stSqlProvider, DATA_CONTROL_DATA_CHANGE_SQL_INSERT, pstData);
+ PRINT_RESULT_CLEANUP(TIZEN_ERROR_PERMISSION_DENIED, nRet, "data_control_provider_send_data_change_noti", DataControlGetError(nRet),bundle_free(pstData));
+ bundle_free(pstData);
+ return 0;
+}
extern int CTc_DataControl_PrivilegeDataControlConsumer_sql_insert_cb(void);
extern int CTc_DataControl_PrivilegeDataControlConsumer_data_control_sql_update(void);
extern int CTc_DataControl_PrivilegeDataControlConsumer_provider_sql_register_cb(void);
+extern int CTc_DataControl_PrivilegeDataControlprovider_add_cb(void);
+extern int CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti(void);
extern int CTc_Device_PrivilegeDisplay_get_numbers(void);
extern int CTc_Device_PrivilegePower_wakeup(void);
extern int CTc_Device_PrivilegeDisplay_state_change(void);
{"CTc_DataControl_PrivilegeDataControlConsumer_sql_insert_cb", CTc_DataControl_PrivilegeDataControlConsumer_sql_insert_cb, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
{"CTc_DataControl_PrivilegeDataControlConsumer_data_control_sql_update", CTc_DataControl_PrivilegeDataControlConsumer_data_control_sql_update, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
{"CTc_DataControl_PrivilegeDataControlConsumer_provider_sql_register_cb", CTc_DataControl_PrivilegeDataControlConsumer_provider_sql_register_cb, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
+ {"CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti", CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
+ {"CTc_DataControl_PrivilegeDataControlprovider_add_cb", CTc_DataControl_PrivilegeDataControlprovider_add_cb, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
{"CTc_Device_PrivilegeDisplay_get_numbers", CTc_Device_PrivilegeDisplay_get_numbers, CTs_platform_permission_device_startup, CTs_platform_permission_device_cleanup},
{"CTc_Device_PrivilegePower_wakeup", CTc_Device_PrivilegePower_wakeup, CTs_platform_permission_device_startup, CTs_platform_permission_device_cleanup},
{"CTc_Device_PrivilegeDisplay_state_change", CTc_Device_PrivilegeDisplay_state_change, CTs_platform_permission_device_startup, CTs_platform_permission_device_cleanup},
extern int CTc_DataControl_PrivilegeDataControlConsumer_sql_insert_cb(void);
extern int CTc_DataControl_PrivilegeDataControlConsumer_data_control_sql_update(void);
extern int CTc_DataControl_PrivilegeDataControlConsumer_provider_sql_register_cb(void);
+extern int CTc_DataControl_PrivilegeDataControlprovider_add_cb(void);
+extern int CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti(void);
extern int CTc_Device_PrivilegeDisplay_get_numbers(void);
extern int CTc_Device_PrivilegePower_wakeup(void);
extern int CTc_Device_PrivilegeDisplay_state_change(void);
{"CTc_DataControl_PrivilegeDataControlConsumer_sql_insert_cb", CTc_DataControl_PrivilegeDataControlConsumer_sql_insert_cb, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
{"CTc_DataControl_PrivilegeDataControlConsumer_data_control_sql_update", CTc_DataControl_PrivilegeDataControlConsumer_data_control_sql_update, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
{"CTc_DataControl_PrivilegeDataControlConsumer_provider_sql_register_cb", CTc_DataControl_PrivilegeDataControlConsumer_provider_sql_register_cb, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
+ {"CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti", CTc_DataControl_PrivilegeDataControlprovider_send_data_change_noti, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
+ {"CTc_DataControl_PrivilegeDataControlprovider_add_cb", CTc_DataControl_PrivilegeDataControlprovider_add_cb, CTs_platform_permission_datacontrol_startup, CTs_platform_permission_datacontrol_cleanup},
{"CTc_Device_PrivilegeDisplay_get_numbers", CTc_Device_PrivilegeDisplay_get_numbers, CTs_platform_permission_device_startup, CTs_platform_permission_device_cleanup},
{"CTc_Device_PrivilegePower_wakeup", CTc_Device_PrivilegePower_wakeup, CTs_platform_permission_device_startup, CTs_platform_permission_device_cleanup},
{"CTc_Device_PrivilegeDisplay_state_change", CTc_Device_PrivilegeDisplay_state_change, CTs_platform_permission_device_startup, CTs_platform_permission_device_cleanup},