Add test case for APP_CONTROL_OPERATION_MEDIA_CONTROLLER 50/177350/1
authorhj kim <backto.kim@samsung.com>
Fri, 27 Apr 2018 08:30:41 +0000 (17:30 +0900)
committerhj kim <backto.kim@samsung.com>
Fri, 27 Apr 2018 08:30:41 +0000 (17:30 +0900)
Change-Id: I77474a80eb41f5c4181b7684baa0d2ee9a1d3c38

packaging/capi-media-controller.spec
test/client_test/CMakeLists.txt
test/client_test/media_controller_client_test.c

index fe48134..7eca7f9 100755 (executable)
@@ -22,6 +22,7 @@ BuildRequires:  pkgconfig(libsystemd-login)
 BuildRequires:  pkgconfig(libtzplatform-config)
 BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(cynara-session)
+BuildRequires:  pkgconfig(capi-appfw-app-control)
 
 %define upgrade_script_path /usr/share/upgrade/scripts
 
index 938cd60..139494a 100755 (executable)
@@ -1,7 +1,7 @@
 SET(fw_test "media-controller-client-test")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED glib-2.0)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0 capi-appfw-app-control)
 
 FOREACH(flag ${${fw_test}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index aaccbdb..b41a24f 100755 (executable)
@@ -22,6 +22,7 @@
 #include <glib.h>
 #include <glib/gprintf.h>
 
+#include <app_control.h>
 #include <media_controller_client.h>
 #include "media_controller_private.h"
 
@@ -472,7 +473,47 @@ static gboolean _destroy()
        return TRUE;
 }
 
+#if 0
+static int _test_app_launch()
+{
+       int ret = APP_CONTROL_ERROR_NONE;
+
+       app_control_h app_control;
+
+       g_print("== _test_app_launch \n");
+
+       ret = app_control_create(&app_control);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               g_print("Fail to app_control_create \n");
+
+       ret = app_control_set_operation(app_control, APP_CONTROL_OPERATION_MEDIA_CONTROLLER);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               g_print("Fail to app_control_set_operation \n");
+
+       ret = app_control_add_extra_data(app_control, APP_CONTROL_DATA_TYPE, "server"); //or app_control_add_extra_data(service, APP_CONTROL_DATA_TYPE, "client");
+       if (ret != APP_CONTROL_ERROR_NONE)
+               g_print("Fail to app_control_add_extra_data \n");
 
+       ret = app_control_set_uri(app_control, "test-path");
+       if (ret != APP_CONTROL_ERROR_NONE)
+               g_print("Fail to app_control_set_uri \n");
+
+       ret = app_control_set_app_id(app_control, "org.example.musicplayerui");
+       if (ret != APP_CONTROL_ERROR_NONE)
+               g_print("Fail to app_control_set_app_id \n");
+
+       ret = app_control_send_launch_request(app_control, NULL, NULL);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               g_print("Fail to app_control_send_launch_request \n");
+
+       ret = app_control_destroy(app_control);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               g_print("Fail to app_control_destroy \n");
+
+       g_print("== _test_app_launch end \n");
+       return 0;
+}
+#endif
 /***************************************************************/
 /**  Testsuite */
 /***************************************************************/
@@ -738,6 +779,7 @@ int main(int argc, char **argv)
 
        mainloop = g_main_loop_new(NULL, FALSE);
 
+       //_test_app_launch();
        display_menu();
 
        g_main_loop_run(mainloop);