}
/**
+* @function AppManagerGetStaus
+* @description Maps enums to string values
+* @parameter nStatus : enum returned
+* @return enum string
+*/
+char* AppManagerGetStaus(int nStatus)
+{
+ char *szStatusVal = NULL;
+ switch ( nStatus )
+ {
+ case APP_MANAGER_EVENT_STATUS_TYPE_ALL: szStatusVal = "APP_MANAGER_EVENT_STATUS_TYPE_ALL"; break;
+ case APP_MANAGER_EVENT_STATUS_TYPE_ENABLE: szStatusVal = "APP_MANAGER_EVENT_STATUS_TYPE_ENABLE"; break;
+ case APP_MANAGER_EVENT_STATUS_TYPE_DISABLE: szStatusVal = "APP_MANAGER_EVENT_STATUS_TYPE_DISABLE"; break;
+
+ }
+ return szStatusVal;
+}
+
+/**
* @function AppManagerCallbackTimeout
* @description callback function to terminate g_main loop
* @parameter data : user data sent to callback
g_bAppManagerCallback = true;
return g_bAppManagerCallback;
}
+/**
+* @function app_manager_event_callback
+* @description Callback function for app_manager_set_event_cb
+* @parameter const char * :type, const char *: app_id,app_manager_event_type_e :event_type,app_manager_event_state_e :event_state,
+ app_manager_event_h :handle, void *user_data
+
+* @return NA
+*/
+bool AppManagerEventCallback(const char *type, const char *app_id,app_manager_event_type_e event_type,app_manager_event_state_e event_state,
+ app_manager_event_h handle, void *user_data)
+{
+ #if DEGUG
+ FPRINTF("[Line : %d][%s] Callback AppManagerEventCallback is called\\n", __LINE__, API_NAMESPACE);
+#endif
+ g_bAppManagerCallback = true;
+ return g_bAppManagerCallback;
+
+}
/** @} */
char *AppManagerGetError(int nRet);
char* AppControlGetError(int nRet);
+char* AppManagerGetStaus(int nStatus);
gboolean AppManagerCallbackTimeout(gpointer data);
void AppManagerAppContextChangeCallback(app_context_h app_context, app_context_event_e event, void *user_data);
void* AppManagerCreateEventLoop(void* pArg);
bool AppInfoMetaDataFilterForeachCallback (app_info_h app_info, void *user_data);
bool AppInfoMetaDataCallback(const char *metadata_key, const char *metadata_value, void *user_data);
bool AppManagerAppContextCallback(app_context_h app_context, void *user_data);
+bool AppManagerEventCallback(const char *type, const char *app_id,app_manager_event_type_e event_type,app_manager_event_state_e event_state,
+ app_manager_event_h handle, void *user_data);
/** @} */
#endif //_ITS_APP_MANAGER_COMMON_H_
return 0;
}
+//& type: auto
+//& purpose: To create and destroy the app manager event handle
+/**
+* @testcase ITc_app_manager_event_create_destroy_p
+* @author SRID(shilpa.j)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @since_tizen 3.0
+* @description Create the app manager event handle
+* @scenario Create the app manager event handle
+* Destroy the event handle
+* @apicovered app_manager_event_create,app_manager_event_destroy
+* @passcase If app_manager_event_create and app_manager_event_destroy returns success
+* @failcase If app_manager_event_create or app_manager_event_destroy fails
+* @precondition app manager instance should be created
+* @postcondition app should be closed and app manager instance should be destroyed
+*/
+int ITc_app_manager_event_create_destroy_p(void)
+{
+ START_TEST;
+
+ app_manager_event_h hEventHandle = NULL;
+
+ int nRet = app_manager_event_create(&hEventHandle);
+ PRINT_RESULT(APP_MANAGER_ERROR_NONE, nRet, "app_manager_event_create", AppManagerGetError(nRet));
+ CHECK_HANDLE(hEventHandle, "app_manager_event_create");
+
+ nRet = app_manager_event_destroy(hEventHandle);
+ PRINT_RESULT(APP_MANAGER_ERROR_NONE, nRet, "app_manager_event_destroy", AppManagerGetError(nRet));
+
+ return 0;
+}
+//& type: auto
+//& purpose: Sets the event to handle to listen
+/**
+* @testcase ITc_app_manager_event_set_status_p
+* @author SRID(shilpa.j)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @since_tizen 3.0
+* @description Sets the event to handle to listen
+* @scenario Create the app manager event handle
+ Sets the event to handle to listen
+* Destroy the event handle
+* @apicovered app_manager_event_create,app_manager_event_set_status
+* @passcase If app_manager_event_set_status returns success
+* @failcase If app_manager_event_set_status fails
+* @precondition app manager instance should be created
+* @postcondition app should be closed and app manager instance should be destroyed
+*/
+int ITc_app_manager_event_set_status_p(void)
+{
+ START_TEST;
+
+ app_manager_event_h hEventHandle = NULL;
+ int nEnumStartCount;
+
+ int nStatusOption[] = {
+ APP_MANAGER_EVENT_STATUS_TYPE_ALL ,
+ APP_MANAGER_EVENT_STATUS_TYPE_ENABLE,
+ APP_MANAGER_EVENT_STATUS_TYPE_DISABLE,
+ };
+ int nStatusOptionCount = sizeof(nStatusOption) / sizeof(nStatusOption[0]);
+
+ int nRet = app_manager_event_create(&hEventHandle);
+ PRINT_RESULT(APP_MANAGER_ERROR_NONE, nRet, "app_manager_event_create", AppManagerGetError(nRet));
+ CHECK_HANDLE(hEventHandle, "app_manager_event_create");
+
+ for(nEnumStartCount = 0 ; nEnumStartCount < nStatusOptionCount ; nEnumStartCount++ )
+ {
+ FPRINTF("Status = [%s] \\n" ,AppManagerGetStaus(nStatusOption[nEnumStartCount]));
+ //Target API
+ nRet = app_manager_event_set_status(hEventHandle,nStatusOption[nEnumStartCount]);
+ PRINT_RESULT_CLEANUP(APP_MANAGER_ERROR_NONE, nRet, "app_manager_event_set_status", AppManagerGetError(nRet), app_manager_event_destroy(hEventHandle));
+ }
+
+
+ nRet = app_manager_event_destroy(hEventHandle);
+ PRINT_RESULT_NORETURN(APP_MANAGER_ERROR_NONE, nRet, "app_manager_event_destroy", AppManagerGetError(nRet));
+
+ return 0;
+}
+
+
+//& type: auto
+//& purpose: Sets the event to handle to listen
+/**
+* @testcase ITc_app_manager_set_unset_event_cb_p
+* @author SRID(shilpa.j)
+* @reviewer SRID(a.pandia1)
+* @type auto
+* @since_tizen 3.0
+* @description Sets the event to handle to listen
+* @scenario Create the app manager event handle
+ Sets the event to handle to listen
+* Destroy the event handle
+* @apicovered app_manager_event_create,app_manager_event_set_status,app_manager_unset_event_cb
+* @passcase If app_manager_set_event_cb or app_manager_unset_event_cb returns success
+* @failcase If app_manager_unset_event_cb or app_manager_set_event_cb fails
+* @precondition app manager instance should be created
+* @postcondition app should be closed and app manager instance should be destroyed
+*/
+int ITc_app_manager_set_unset_event_cb_p(void)
+{
+ START_TEST;
+ int nTimeoutId = 0;
+ app_manager_event_h hEventHandle = NULL;
+ g_bAppManagerCallback = false;
+
+ int nRet = app_manager_event_create(&hEventHandle);
+ PRINT_RESULT(APP_MANAGER_ERROR_NONE, nRet, "app_manager_event_create", AppManagerGetError(nRet));
+ CHECK_HANDLE(hEventHandle, "app_manager_event_create");
+ //Target API
+ nRet = app_manager_set_event_cb(hEventHandle,AppManagerEventCallback,NULL);
+ PRINT_RESULT_CLEANUP(APP_MANAGER_ERROR_NONE, nRet, "app_manager_set_event_cb", AppManagerGetError(nRet), app_manager_event_destroy(hEventHandle));
+
+
+ //Callback hit is not checked as there is no way or such APIs to check invocation of callback registered - discussed with developer
+
+ /*RUN_POLLING_LOOP;
+ if ( g_bAppManagerCallback == false )
+ {
+ FPRINTF("[Line : %d][%s] app_manager_set_event_cb failed, error returned = Callback Not Invoked\\n", __LINE__, API_NAMESPACE);
+ app_manager_event_destroy(hEventHandle);
+ return 1;
+ }*/
+ //Target API
+ nRet = app_manager_unset_event_cb(hEventHandle);
+ PRINT_RESULT_CLEANUP(APP_MANAGER_ERROR_NONE, nRet, "app_manager_unset_event_cb", AppManagerGetError(nRet), app_manager_event_destroy(hEventHandle));
+
+ nRet = app_manager_event_destroy(hEventHandle);
+ PRINT_RESULT_NORETURN(APP_MANAGER_ERROR_NONE, nRet, "app_manager_event_destroy", AppManagerGetError(nRet));
+
+ return 0;
+}
+
/** @} */
/** @} */
extern int ITc_app_manager_get_shared_trusted_path_p(void);
extern int ITc_app_manager_get_shared_data_path_p(void);
extern int ITc_app_manager_get_external_shared_data_path_p(void);
+extern int ITc_app_manager_event_create_destroy_p(void);
+extern int ITc_app_manager_event_set_status_p(void);
+extern int ITc_app_manager_set_unset_event_cb_p(void);
+
testcase tc_array[] = {
{"ITc_app_manager_app_context_clone_destroy_p", ITc_app_manager_app_context_clone_destroy_p, ITs_app_manager_context_startup, ITs_app_manager_context_cleanup},
{"ITc_app_manager_get_shared_trusted_path_p", ITc_app_manager_get_shared_trusted_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_shared_data_path_p", ITc_app_manager_get_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_external_shared_data_path_p", ITc_app_manager_get_external_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
- {NULL, NULL}
+ {"ITc_app_manager_event_create_destroy_p", ITc_app_manager_event_create_destroy_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_event_set_status_p", ITc_app_manager_event_set_status_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_set_unset_event_cb_p", ITc_app_manager_set_unset_event_cb_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {NULL, NULL}
};
#endif // __TCT_APP_MANAGER_NATIVE_H__
extern int ITc_app_manager_get_shared_trusted_path_p(void);
extern int ITc_app_manager_get_shared_data_path_p(void);
extern int ITc_app_manager_get_external_shared_data_path_p(void);
+extern int ITc_app_manager_event_create_destroy_p(void);
+extern int ITc_app_manager_event_set_status_p(void);
+extern int ITc_app_manager_set_unset_event_cb_p(void);
testcase tc_array[] = {
{"ITc_app_manager_app_context_clone_destroy_p", ITc_app_manager_app_context_clone_destroy_p, ITs_app_manager_context_startup, ITs_app_manager_context_cleanup},
{"ITc_app_manager_get_shared_trusted_path_p", ITc_app_manager_get_shared_trusted_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_shared_data_path_p", ITc_app_manager_get_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_external_shared_data_path_p", ITc_app_manager_get_external_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
- {NULL, NULL}
+ {"ITc_app_manager_event_create_destroy_p", ITc_app_manager_event_create_destroy_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_event_set_status_p", ITc_app_manager_event_set_status_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_set_unset_event_cb_p", ITc_app_manager_set_unset_event_cb_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {NULL, NULL}
};
#endif // __TCT_APP_MANAGER_NATIVE_H__
extern int ITc_app_manager_get_shared_trusted_path_p(void);
extern int ITc_app_manager_get_shared_data_path_p(void);
extern int ITc_app_manager_get_external_shared_data_path_p(void);
+extern int ITc_app_manager_event_create_destroy_p(void);
+extern int ITc_app_manager_event_set_status_p(void);
+extern int ITc_app_manager_set_unset_event_cb_p(void);
+
testcase tc_array[] = {
{"ITc_app_manager_app_context_clone_destroy_p", ITc_app_manager_app_context_clone_destroy_p, ITs_app_manager_context_startup, ITs_app_manager_context_cleanup},
{"ITc_app_manager_get_shared_trusted_path_p", ITc_app_manager_get_shared_trusted_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_shared_data_path_p", ITc_app_manager_get_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_external_shared_data_path_p", ITc_app_manager_get_external_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_event_create_destroy_p", ITc_app_manager_event_create_destroy_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_event_set_status_p", ITc_app_manager_event_set_status_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_set_unset_event_cb_p", ITc_app_manager_set_unset_event_cb_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+
{NULL, NULL}
};
extern int ITc_app_manager_get_shared_trusted_path_p(void);
extern int ITc_app_manager_get_shared_data_path_p(void);
extern int ITc_app_manager_get_external_shared_data_path_p(void);
+extern int ITc_app_manager_event_create_destroy_p(void);
+extern int ITc_app_manager_event_set_status_p(void);
+extern int ITc_app_manager_set_unset_event_cb_p(void);
+
testcase tc_array[] = {
{"ITc_app_manager_app_context_clone_destroy_p", ITc_app_manager_app_context_clone_destroy_p, ITs_app_manager_context_startup, ITs_app_manager_context_cleanup},
{"ITc_app_manager_get_shared_resource_path_p", ITc_app_manager_get_shared_resource_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_shared_trusted_path_p", ITc_app_manager_get_shared_trusted_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
{"ITc_app_manager_get_shared_data_path_p", ITc_app_manager_get_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
- {"ITc_app_manager_get_external_shared_data_path_p", ITc_app_manager_get_external_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
- {NULL, NULL}
+ {"ITc_app_manager_get_external_shared_data_path_p", ITc_app_manager_get_external_shared_data_path_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_event_create_destroy_p", ITc_app_manager_event_create_destroy_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_event_set_status_p", ITc_app_manager_event_set_status_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {"ITc_app_manager_set_unset_event_cb_p", ITc_app_manager_set_unset_event_cb_p, ITs_app_manager_startup, ITs_app_manager_cleanup},
+ {NULL, NULL}
};
#endif // __TCT_APP_MANAGER_NATIVE_H__