extern int utc_application_app_event_publish_trusted_app_event_n5(void);
extern int utc_application_app_event_keep_last_event_data_p(void);
extern int utc_application_app_event_keep_last_event_data_n(void);
+extern int utc_application_app_control_send_launch_request_async_p1(void);
+extern int utc_application_app_control_send_launch_request_async_p2(void);
+extern int utc_application_app_control_send_launch_request_async_p3(void);
+extern int utc_application_app_control_send_launch_request_async_p4(void);
+extern int utc_application_app_control_send_launch_request_async_n1(void);
+extern int utc_application_app_control_send_launch_request_async_n2(void);
+extern int utc_application_app_control_send_launch_request_async_n3(void);
+extern int utc_application_app_control_send_launch_request_async_n4(void);
testcase tc_array[] = {
{"utc_application_app_get_name_p",utc_application_app_get_name_p,NULL,NULL},
{"utc_application_app_control_get_launch_mode_n1",utc_application_app_control_get_launch_mode_n1,utc_application_app_control_startup,NULL},
{"utc_application_app_control_enable_app_started_result_event_p1",utc_application_app_control_enable_app_started_result_event_p1,utc_application_app_control_startup,NULL},
{"utc_application_app_control_enable_app_started_result_event_n1",utc_application_app_control_enable_app_started_result_event_n1,utc_application_app_control_startup,NULL},
+ {"utc_application_app_control_send_launch_request_async_p1", utc_application_app_control_send_launch_request_async_p1, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p2", utc_application_app_control_send_launch_request_async_p2, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p3", utc_application_app_control_send_launch_request_async_p3, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p4", utc_application_app_control_send_launch_request_async_p4, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n1", utc_application_app_control_send_launch_request_async_n1, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n2", utc_application_app_control_send_launch_request_async_n2, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n3", utc_application_app_control_send_launch_request_async_n3, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n4", utc_application_app_control_send_launch_request_async_n4, NULL, NULL},
{"utc_application_app_resource_manager_get_p1",utc_application_app_resource_manager_get_p1,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
{"utc_application_app_resource_manager_get_p2",utc_application_app_resource_manager_get_p2,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
{"utc_application_app_resource_manager_get_p3",utc_application_app_resource_manager_get_p3,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
extern int utc_application_app_event_publish_trusted_app_event_n5(void);
extern int utc_application_app_event_keep_last_event_data_p(void);
extern int utc_application_app_event_keep_last_event_data_n(void);
+extern int utc_application_app_control_send_launch_request_async_p1(void);
+extern int utc_application_app_control_send_launch_request_async_p2(void);
+extern int utc_application_app_control_send_launch_request_async_p3(void);
+extern int utc_application_app_control_send_launch_request_async_p4(void);
+extern int utc_application_app_control_send_launch_request_async_n1(void);
+extern int utc_application_app_control_send_launch_request_async_n2(void);
+extern int utc_application_app_control_send_launch_request_async_n3(void);
+extern int utc_application_app_control_send_launch_request_async_n4(void);
testcase tc_array[] = {
{"utc_application_app_get_name_p",utc_application_app_get_name_p,NULL,NULL},
{"utc_application_app_control_get_launch_mode_n1",utc_application_app_control_get_launch_mode_n1,utc_application_app_control_startup,NULL},
{"utc_application_app_control_enable_app_started_result_event_p1",utc_application_app_control_enable_app_started_result_event_p1,utc_application_app_control_startup,NULL},
{"utc_application_app_control_enable_app_started_result_event_n1",utc_application_app_control_enable_app_started_result_event_n1,utc_application_app_control_startup,NULL},
+ {"utc_application_app_control_send_launch_request_async_p1", utc_application_app_control_send_launch_request_async_p1, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p2", utc_application_app_control_send_launch_request_async_p2, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p3", utc_application_app_control_send_launch_request_async_p3, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p4", utc_application_app_control_send_launch_request_async_p4, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n1", utc_application_app_control_send_launch_request_async_n1, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n2", utc_application_app_control_send_launch_request_async_n2, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n3", utc_application_app_control_send_launch_request_async_n3, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n4", utc_application_app_control_send_launch_request_async_n4, NULL, NULL},
{"utc_application_app_resource_manager_get_p1",utc_application_app_resource_manager_get_p1,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
{"utc_application_app_resource_manager_get_p2",utc_application_app_resource_manager_get_p2,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
{"utc_application_app_resource_manager_get_p3",utc_application_app_resource_manager_get_p3,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
extern int utc_application_app_event_publish_trusted_app_event_n5(void);
extern int utc_application_app_event_keep_last_event_data_p(void);
extern int utc_application_app_event_keep_last_event_data_n(void);
+extern int utc_application_app_control_send_launch_request_async_p1(void);
+extern int utc_application_app_control_send_launch_request_async_p2(void);
+extern int utc_application_app_control_send_launch_request_async_p3(void);
+extern int utc_application_app_control_send_launch_request_async_p4(void);
+extern int utc_application_app_control_send_launch_request_async_n1(void);
+extern int utc_application_app_control_send_launch_request_async_n2(void);
+extern int utc_application_app_control_send_launch_request_async_n3(void);
+extern int utc_application_app_control_send_launch_request_async_n4(void);
testcase tc_array[] = {
{"utc_application_app_get_name_p",utc_application_app_get_name_p,NULL,NULL},
{"utc_application_app_control_get_launch_mode_n1",utc_application_app_control_get_launch_mode_n1,utc_application_app_control_startup,NULL},
{"utc_application_app_control_enable_app_started_result_event_p1",utc_application_app_control_enable_app_started_result_event_p1,utc_application_app_control_startup,NULL},
{"utc_application_app_control_enable_app_started_result_event_n1",utc_application_app_control_enable_app_started_result_event_n1,utc_application_app_control_startup,NULL},
+ {"utc_application_app_control_send_launch_request_async_p1", utc_application_app_control_send_launch_request_async_p1, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p2", utc_application_app_control_send_launch_request_async_p2, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p3", utc_application_app_control_send_launch_request_async_p3, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_p4", utc_application_app_control_send_launch_request_async_p4, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n1", utc_application_app_control_send_launch_request_async_n1, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n2", utc_application_app_control_send_launch_request_async_n2, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n3", utc_application_app_control_send_launch_request_async_n3, NULL, NULL},
+ {"utc_application_app_control_send_launch_request_async_n4", utc_application_app_control_send_launch_request_async_n4, NULL, NULL},
{"utc_application_app_resource_manager_get_p1",utc_application_app_resource_manager_get_p1,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
{"utc_application_app_resource_manager_get_p2",utc_application_app_resource_manager_get_p2,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
{"utc_application_app_resource_manager_get_p3",utc_application_app_resource_manager_get_p3,utc_application_app_resource_manager_startup,utc_application_app_resource_manager_cleanup},
// See the License for the specific language governing permissions and
// limitations under the License.
//
-#include "assert.h"
-#include "assert_common.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <app.h>
#include <bundle.h>
+#include <dlog.h>
+
#include "tct_app_common.h"
+#include "assert.h"
+#include "assert_common.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "NativeTCT"
/**
* @function utc_application_app_control_startup
return 0;
}
+
+static void __app_control_result_cb(app_control_h request,
+ app_control_error_e result, void *user_data)
+{
+ dlog_print(DLOG_INFO, LOG_TAG, "Result: %d", result);
+ if (result == APP_CONTROL_ERROR_NONE)
+ normal_exit(0);
+ else
+ normal_exit(1);
+}
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_p1
+ * @since_tizen 5.0
+ * @type Positive
+ * @description Sends the launch request asynchronously.
+ * @scenario Sends the launch request asynchronously.
+ */
+int utc_application_app_control_send_launch_request_async_p1(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_set_operation(handle,
+ APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_set_app_id(handle, "org.tizen.helloworld");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
+ NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
+ normal_exit(1);
+ }
+
+end:
+ app_control_destroy(handle);
+
+ return ret;
+}
+
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_p2
+ * @since_tizen 5.0
+ * @type Positive
+ * @description Sends the launch request asynchronously.
+ * @scenario Sends the launch request asynchronously with the reply callback.
+ */
+int utc_application_app_control_send_launch_request_async_p2(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_set_operation(handle,
+ APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_set_app_id(handle, "org.tizen.helloworld");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
+ dts_app_control_reply_cb, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
+ normal_exit(1);
+ }
+
+end:
+ app_control_destroy(handle);
+
+ return ret;
+}
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_p3
+ * @since_tizen 5.0
+ * @type Positive
+ * @description Sends the launch request asynchronously..
+ * @scenario Sets the operation, the mime and the appid,
+ * and then sends the launch request asynchronously.
+ */
+int utc_application_app_control_send_launch_request_async_p3(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_set_operation(handle,
+ APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_set_mime(handle, "type/custom");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set MIME-Type");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_set_app_id(handle, "org.tizen.helloworld");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
+ NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
+ normal_exit(1);
+ }
+
+end:
+ app_control_destroy(handle);
+
+ return ret;
+}
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_p4
+ * @since_tizen 5.0
+ * @type Positive
+ * @description Sends the launch request asynchronously.
+ * @scenario Sets the operation, the appid, and then sends the
+ * launch request asynchronously. This target application requires
+ * privilege(http://tizen.org/privilege/alarm.get) to
+ * send app_control.
+ */
+int utc_application_app_control_send_launch_request_async_p4(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_set_operation(handle,
+ APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_set_app_id(handle, "org.example.appcontrolprivilegetest");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
+ NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to send launch request async");
+ normal_exit(1);
+ }
+
+end:
+ app_control_destroy(handle);
+
+ return ret;
+}
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_n1
+ * @since_tizen 5.0
+ * @type Negative
+ * @description Sends the launch request asynchronously.
+ * @scenario Calls the app_control_send_launch_request() with the invalid parameters.
+ */
+int utc_application_app_control_send_launch_request_async_n1(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_send_launch_request_async(NULL, NULL, NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle, NULL, NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_INVALID_PARAMETER) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
+ normal_exit(1);
+ goto end;
+ }
+
+ normal_exit(0);
+
+end:
+ app_control_destroy(handle);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_n2
+ * @since_tizen 5.0
+ * @type Negative
+ * @description Sends the launch request asynchronously.
+ * @scenario Sends the launch request without the given appid.
+ * If the operation is APP_CONTROL_OPERATION_DEFAULT,
+ * the app_control requires the appid for sending the launch request asynchronously.
+ */
+int utc_application_app_control_send_launch_request_async_n2(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_set_operation(handle,
+ APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle, __app_control_result_cb,
+ NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_APP_NOT_FOUND) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
+ normal_exit(1);
+ }
+ normal_exit(0);
+
+end:
+ app_control_destroy(handle);
+
+ return 0;
+}
+
+static void __app_control_result_cb_n3(app_control_h request,
+ app_control_error_e result, void *user_data)
+{
+ dlog_print(DLOG_INFO, LOG_TAG, "Result: %d", result);
+ if (result == APP_CONTROL_ERROR_APP_NOT_FOUND)
+ normal_exit(0);
+ else
+ normal_exit(1);
+}
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_n3
+ * @since_tizen 5.0
+ * @type Negative
+ * @description Sends the launch request asynchronously.
+ * @scenario Sends the launch request asynchronously with the invalid appid.
+ */
+int utc_application_app_control_send_launch_request_async_n3(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_set_operation(handle,
+ APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_set_app_id(handle, "org.tizen.hellohelloworld");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle,
+ __app_control_result_cb_n3,
+ NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_APP_NOT_FOUND) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
+ normal_exit(1);
+ }
+
+end:
+ app_control_destroy(handle);
+
+ return 0;
+}
+
+static void __app_control_result_cb_n4(app_control_h request,
+ app_control_error_e result, void *user_data)
+{
+ dlog_print(DLOG_INFO, LOG_TAG, "Result: %d", result);
+ if (result == APP_CONTROL_ERROR_PERMISSION_DENIED)
+ normal_exit(0);
+ else
+ normal_exit(1);
+}
+
+/**
+ * @testcase utc_application_app_control_send_launch_request_async_n4
+ * @since_tizen 5.0
+ * @type Negative
+ * @description Sends the launch request asynchronously.
+ * @scenario Sends the launch request asynchronously to application which requires
+ * privilege(http://tizen.org/privilege/notification).
+ */
+int utc_application_app_control_send_launch_request_async_n4(void)
+{
+ app_control_h handle;
+ int ret;
+
+ ret = app_control_create(&handle);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to create app control handle");
+ normal_exit(1);
+ return -1;
+ }
+
+ ret = app_control_set_operation(handle,
+ APP_CONTROL_OPERATION_DEFAULT);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set operation");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_set_app_id(handle, "org.example.appcontrolprivilegetest2");
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "Failed to set application ID");
+ normal_exit(1);
+ goto end;
+ }
+
+ ret = app_control_send_launch_request_async(handle,
+ __app_control_result_cb_n4,
+ NULL, NULL);
+ if (ret != APP_CONTROL_ERROR_PERMISSION_DENIED) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "error: %d", ret);
+ normal_exit(1);
+ }
+
+end:
+ app_control_destroy(handle);
+
+ return 0;
+}