Correction additional about "Removed system controller." 79/30479/1
authorRyota Okubi <ryota.okubi@mail.toyota-td.jp>
Wed, 19 Nov 2014 02:34:00 +0000 (11:34 +0900)
committerRyota Okubi <ryota.okubi@mail.toyota-td.jp>
Wed, 19 Nov 2014 02:41:06 +0000 (11:41 +0900)
Deletion junk files and add test programs accompanying
"Removed system controller."

Change-Id: Idbda45186c09ed55f855acf228ce26c59e3f7b38
Signed-off-by: Ryota Okubi <ryota.okubi@mail.toyota-td.jp>
20 files changed:
configure.ac
data/share/applications/org.tizen.ico.homescreen.desktop_bk [deleted file]
lib/Makefile.am
lib/common/Makefile.am
lib/notification/Makefile.am
tests/Makefile.am
tests/apps-framework/Makefile.am [new file with mode: 0644]
tests/apps-framework/data/test.ico.res.app.desktop [new file with mode: 0644]
tests/apps-framework/run_test.sh [new file with mode: 0755]
tests/apps-framework/tst_appresctl.c [new file with mode: 0644]
tests/apps-framework/tst_appresctl_main.c [new file with mode: 0644]
tests/apps-framework/tst_common.c [new file with mode: 0644]
tests/apps-framework/tst_common.h [new file with mode: 0644]
tests/apps-framework/tst_inputctl.c [new file with mode: 0644]
tests/apps-framework/tst_server.c [new file with mode: 0644]
tests/apps-framework/tst_userctl.c [new file with mode: 0644]
tests/apps-framework/tst_winctl.c [new file with mode: 0644]
tool/kill_syscond.sh
tool/rm_autogen-file.sh
tool/start_syscond.sh [deleted file]

index 9a200ce..4412fc4 100644 (file)
@@ -32,6 +32,7 @@ PKG_CHECK_MODULES([EGL], [egl])
 PKG_CHECK_MODULES([EINA], [eina])
 PKG_CHECK_MODULES([EVAS], [evas])
 PKG_CHECK_MODULES([ECORE], [ecore])
+PKG_CHECK_MODULES([ECOREEVAS], [ecore-evas])
 PKG_CHECK_MODULES([GLIB], [glib-2.0])
 PKG_CHECK_MODULES([JSONGLIB], [json-glib-1.0])
 PKG_CHECK_MODULES([AIL], [ail])
@@ -41,22 +42,15 @@ PKG_CHECK_MODULES([PKGMGR], [pkgmgr])
 PKG_CHECK_MODULES([WAYLANDCLIENT], [wayland-client])
 PKG_CHECK_MODULES([NOTIFICATION], [notification])
 PKG_CHECK_MODULES([APPSVC], [appsvc])
+PKG_CHECK_MODULES([DLOG], [dlog])
+PKG_CHECK_MODULES([CAPIAPPFWAPPLICATION], [capi-appfw-application])
+PKG_CHECK_MODULES([LIBWEBSOCKETS], [libwebsockets]);
 
 # libraries for homescreen.
 PKG_CHECK_MODULES([EDJE], [edje])
 PKG_CHECK_MODULES([ECOREWAYLAND], [ecore-wayland])
 PKG_CHECK_MODULES([WAYLANDCURSOR], [wayland-cursor])
 
-# libraries for system-controller.
-PKG_CHECK_MODULES([DLOG], [dlog])
-PKG_CHECK_MODULES([CAPIAPPFWAPPLICATION], [capi-appfw-application])
-PKG_CHECK_MODULES([MURPHYCOMMON], [murphy-common]);
-PKG_CHECK_MODULES([MURPHYDOMAINCONTROLLER], [murphy-domain-controller]);
-PKG_CHECK_MODULES([MURPHYECORE], [murphy-ecore]);
-PKG_CHECK_MODULES([MURPHYRESOURCE], [murphy-resource]);
-PKG_CHECK_MODULES([LIBWEBSOCKETS], [libwebsockets]);
-PKG_CHECK_MODULES([ECOREEVAS], [ecore-evas])
-
 # Set flags
 EFL_CFLAGS="$EINA_CFLAGS $EVAS_CFLAGS $ECORE_CFLAGS $EDJE_CFLAGS $ECOREWAYLAND_CFLAGS"
 EFL_LIBS="$EINA_LIBS $EVAS_LIBS $ECORE_LIBS $EDJE_LIBS $ECOREWAYLAND_LIBS $ECOREX_LIBS"
@@ -129,13 +123,13 @@ AC_CONFIG_FILES([Makefile
                  lib/common/Makefile
                  lib/notification/Makefile
                  lib/apps-framework/Makefile
-                 lib/misc/Makefile
                  src/Makefile
                  src/homescreen/Makefile
                  src/statusbar/Makefile
                  src/onscreen/Makefile
                  tool/Makefile
                  tool/notification/Makefile
-                 tests/Makefile])
+                 tests/Makefile
+                 tests/apps-framework/Makefile])
 AC_PROG_RANLIB([ranlib])
 AC_OUTPUT
diff --git a/data/share/applications/org.tizen.ico.homescreen.desktop_bk b/data/share/applications/org.tizen.ico.homescreen.desktop_bk
deleted file mode 100644 (file)
index 2c79d9c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-Name=HomeScreen
-Type=menu
-Exec=/opt/apps/org.tizen.ico.homescreen/bin/HomeScreen
-Icon=org.tizen.ico.homescreen.png
-NoDisplay=false
-Version=0.1.0
-Comment=home screen app
-Categories=Menu;HomeScreen;run=Center;noauto
index d92d603..b9b7b7a 100644 (file)
@@ -1,5 +1,4 @@
 SUBDIRS=\
        common \
        notification \
-       apps-framework  \
-       misc
+       apps-framework
index cd74b11..e5dcc49 100644 (file)
@@ -3,9 +3,6 @@ AM_CPPFLAGS = $(GCC_CXXFLAGS)
 noinst_LTLIBRARIES =\
        libico-common.la
 
-#lib_LTLIBRARIES =\
-#      libico-system-controller.la
-
 libico_common_la_LDFLAGS = -version-info 0:9:0 
 libico_common_la_SOURCES =     \
        CicoEFLApp.cpp                  \
index 57908c9..87552f6 100644 (file)
@@ -3,9 +3,6 @@ AM_CPPFLAGS = $(GCC_CXXFLAGS)
 noinst_LTLIBRARIES =\
        libico-notification.la
 
-#lib_LTLIBRARIES =\
-#      libico-system-controller.la
-
 libico_notification_la_LDFLAGS = -version-info 0:9:0 
 libico_notification_la_SOURCES =       \
        CicoNotification.cpp                    \
index 1a1fb62..5e3205d 100644 (file)
@@ -1,3 +1,2 @@
-#SUBDIRS=\
-#   system-controller    \
-#   homescreen
+SUBDIRS=\
+       apps-framework
diff --git a/tests/apps-framework/Makefile.am b/tests/apps-framework/Makefile.am
new file mode 100644 (file)
index 0000000..a169d8b
--- /dev/null
@@ -0,0 +1,56 @@
+TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/apps-framework/run_test.sh
+
+export abs_builddir
+
+AM_CFLAGS = $(GCC_CFLAGS)
+AM_CPPFLAGS = $(GCC_CFLAGS)
+
+noinst_PROGRAMS =              \
+       tst_common              \
+       tst_appresctl           \
+       tst_appresctl_main  \
+       tst_inputctl            \
+       tst_userctl             \
+    tst_winctl                 \
+       tst_server
+
+check_LTLIBRARIES = $(TESTS)
+check_PROGRAMS = tst_common tst_appresctl tst_appresctl_main tst_inputctl tst_userctl tst_winctl tst_server
+
+test_target_flag = -I../../include $(AIL_CFLAGS) $(OPT_CFLAGS) \
+                   @ECORE_CFLAGS@ @EINA_CFLAGS@ \
+                   -I/usr/include/ico-uxf-weston-plugin     \
+                   -I/usr/include/ico-util
+test_target_lib = ../../lib/apps-framework/.libs/libico-appfw.so \
+                   @ECORE_LIBS@ @EINA_LIBS@ \
+                  $(UWS_LIBS) $(OPT_LIBS) $(AIL_LIBS)
+
+tst_common_SOURCES = tst_common.c
+tst_common_CFLAGS = $(test_target_flag)
+tst_common_LDADD = $(test_target_lib)
+
+tst_appresctl_main_SOURCES = tst_appresctl_main.c
+tst_appresctl_main_CFLAGS = $(AIL_CFLAGS)
+tst_appresctl_main_LDADD = $(AIL_LIBS)
+
+tst_appresctl_SOURCES = tst_appresctl.c
+tst_appresctl_CFLAGS = $(test_target_flag)
+tst_appresctl_LDADD = $(test_target_lib)
+
+tst_inputctl_SOURCES = tst_inputctl.c
+tst_inputctl_CFLAGS = $(test_target_flag)
+tst_inputctl_LDADD = $(test_target_lib)
+
+tst_userctl_SOURCES = tst_userctl.c
+tst_userctl_CFLAGS = $(test_target_flag)
+tst_userctl_LDADD = $(test_target_lib)
+
+tst_winctl_SOURCES = tst_winctl.c
+tst_winctl_CFLAGS = $(test_target_flag)
+tst_winctl_LDADD = $(test_target_lib)
+
+tst_server_SOURCES = tst_server.c
+tst_server_CFLAGS = $(test_target_flag)
+tst_server_LDADD = $(test_target_lib)
+
+EXTRA_DIST = run_test.sh
diff --git a/tests/apps-framework/data/test.ico.res.app.desktop b/tests/apps-framework/data/test.ico.res.app.desktop
new file mode 100644 (file)
index 0000000..dd56e07
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=test.ico.res.app
+Type=Application
+Exec=/opt/usr/apps/test.ico.res.app/bin/tst_appresctl
+Icon=
+Categories=Test
+Version=1.0.0
+NoDisplay=true
+X-TIZEN-Removable=False
diff --git a/tests/apps-framework/run_test.sh b/tests/apps-framework/run_test.sh
new file mode 100755 (executable)
index 0000000..5296cfd
--- /dev/null
@@ -0,0 +1,129 @@
+#!/bin/sh
+
+########################
+#
+# Setting value
+#
+########################
+# directory to put result
+log_dir="./result"
+# test log tag
+test_tag="TestCase"
+
+# log file name
+date_str=`date '+%Y%m%d'`
+time_str=`date '+%H%M'`
+file_str="${date_str}_${time_str}.txt"
+
+# sample app dir
+app_dir="/opt/usr/apps/test.ico.res.app"
+
+########################
+#
+# Initialize
+#
+########################
+cd ../../../
+curpath=`pwd`;
+export LD_LIBRARY_PATH=$curpath/lib/apps-framework/.libs:$LD_LIBRARY_PATH
+#/usr/bin/launchpad_preloading_preinitializing_daemon &
+cd ./tests/apps-framework/
+
+# set library path & reboot launchpad
+pids=(`ps -ef | grep launchpad | grep -v grep | awk '{ print $2 }'`)
+for pid in ${pids[*]}
+do
+       kill -9 ${pid}
+done
+
+# setting for appresctl test
+cp ./data/* /opt/share/applications
+if [ ! -e ${app_dir} ]; then
+       mkdir ${app_dir}
+       mkdir ${app_dir}/bin
+fi
+cp tst_appresctl ${app_dir}/bin/
+
+# make directory to put result
+if [ ! -e ${log_dir} ]; then
+       mkdir ${log_dir}
+fi
+
+########################
+#
+# Function
+#
+########################
+print_result()
+{
+       local l_test="$1"
+       local l_log="$2"
+
+       # count OK/NG
+       l_cnt_ok=`grep ${test_tag} ${l_log} | grep " OK" | wc -l`
+       l_cnt_ng=`grep ${test_tag} ${l_log} | grep " NG" | wc -l`
+       echo "## ${l_test}  OK: ${l_cnt_ok}, NG: ${l_cnt_ng}"
+}
+
+kill_server()
+{
+    pids=(`ps -ef | grep tst_server | grep -v grep | awk '{ print $2 }'`)
+    for pid in ${pids[*]}
+    do
+           kill -9 ${pid}
+    done
+    sleep 1
+}
+
+########################
+#
+# Test
+#
+########################
+# kill test server
+kill_server
+
+echo "===== System Controller API Test ====="
+log_server="${log_dir}/server_${file_str}"
+./tst_server >> ${log_server}&
+sleep 2
+
+log_common="${log_dir}/common_${file_str}"
+./tst_common 2>&1 | tee ${log_common}
+sleep 1
+
+log_winctl="${log_dir}/winctl_${file_str}"
+./tst_winctl 2>&1 | tee ${log_winctl}
+sleep 1
+
+log_inputctl="${log_dir}/inputctl_${file_str}"
+./tst_inputctl 2>&1 | tee ${log_inputctl}
+sleep 1
+
+log_userctl="${log_dir}/userctl_${file_str}"
+./tst_userctl 2>&1 | tee ${log_userctl}
+sleep 1
+
+log_appresctl="${log_dir}/appresctl_${file_str}"
+./tst_appresctl_main -add
+${app_dir}/bin/tst_appresctl 2>&1 | tee ${log_appresctl}
+./tst_appresctl_main -del
+sleep 2
+
+echo ""
+echo ""
+echo "<<Results of System Controller API Test>>"
+print_result "Common          API" ${log_common}
+print_result "WindowControl   API" ${log_winctl}
+print_result "InputControl    API" ${log_inputctl}
+print_result "UserControl     API" ${log_userctl}
+print_result "ResourceControl API" ${log_appresctl}
+echo ""
+echo ""
+
+# kill test server
+kill_server
+
+# remove test application
+rm -fr /opt/share/applications/test.ico.*
+rm -fr /opt/apps/test.ico.res.app
diff --git a/tests/apps-framework/tst_appresctl.c b/tests/apps-framework/tst_appresctl.c
new file mode 100644 (file)
index 0000000..b4df4a9
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   test suite for App Resource Control API
+ *
+ * @date    Aug-6-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_appresctl.h"
+#include "ico_syc_common.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+static struct ico_syc_res_context *res_context  = NULL;
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void _check_res_info(const char *ev_name, ico_syc_res_info_t *info);
+static void _check_input_region(const char *ev_name,
+                                ico_syc_input_region_t *region);
+static void _syc_callback(const ico_syc_ev_e event,
+                          const void *detail, void *user_data);
+static void tst_acquire_res(const ico_syc_res_window_t *window,
+                            const ico_syc_res_sound_t *sound,
+                            const ico_syc_res_input_t *input,
+                            int type);
+static void tst_release_res(void);
+static void tst_set_input_region(const ico_syc_input_region_t *region, int attr);
+static void tst_unset_input_region(const ico_syc_input_region_t *region);
+static Eina_Bool ico_syc_appresctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+static void
+_check_res_info(const char *ev_name, ico_syc_res_info_t *info)
+{
+    ico_syc_res_window_t *window = NULL;
+    ico_syc_res_sound_t *sound   = NULL;
+    ico_syc_res_input_t *input   = NULL;
+    int check_flag = 0;
+
+    printf("--- %s\n", ev_name);
+
+    window = info->window;
+    sound = info->sound;
+    input = info->input;
+    if (window != NULL) {
+        ico_syc_res_window_t *w = window;
+        printf("\t(window ECU[%s].display[%s].layer[%s].layout[%s].area[%s], app[%s], role[%s], resId[%d]",
+               w->ECU, w->display, w->layer, w->layout, w->area,
+               w->dispatchApp, w->role, w->resourceId);
+
+        if ((0 != strcmp(w->ECU,         TST_ECU)) ||
+            (0 != strcmp(w->display,     TST_display)) ||
+            (0 != strcmp(w->layer,       TST_layer)) ||
+            (0 != strcmp(w->layout,      TST_layout)) ||
+            (0 != strcmp(w->area,        TST_area)) ||
+            (0 != strcmp(w->dispatchApp, TST_dispatchApp)) ||
+            (0 != strcmp(w->role,        TST_role)) ||
+            (w->resourceId != TST_resourceId)) {
+            check_flag = 1;
+        }
+    }
+    if (sound != NULL) {
+        printf("\t sound zone[%s], name[%s], id[%s], adjust[%d]\n",
+               sound->zone, sound->name, sound->id, sound->adjust);
+        if (strcmp(sound->zone, TST_ZONE_B) != 0
+            || strcmp(sound->name, TST_NAME_B) != 0
+            || strcmp(sound->id, TST_ID_B) != 0
+            || sound->adjust != TST_ADJUST) {
+            check_flag = 1;
+        }
+    }
+    if (input != NULL) {
+        printf("\t input name[%s], event[%d])\n", input->name, input->event);
+        if (strcmp(input->name, TST_NAME_C) != 0
+            || input->event != TST_INPUT_EV) {
+            check_flag = 1;
+        }
+    }
+
+    if (check_flag == 0) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_check_input_region(const char *ev_name, ico_syc_input_region_t *region)
+{
+    printf("--- %s\n", ev_name);
+    printf("\t(winname[%s], (x,y)[%d, %d], width[%d], height[%d], hot[%d,%d], "
+           "cursor[%d.%d-%d,%d], attr[%d])\n",
+           region->winname, region->pos_x, region->pos_y,
+           region->width, region->height, region->hotspot_x, region->hotspot_y,
+           region->cursor_x, region->cursor_y, region->cursor_width,
+           region->cursor_height, region->attr);
+
+    if ((strcmp(region->winname, TST_WIN_NAME) == 0)
+        && region->pos_x == TST_POS_X && region->pos_y == TST_POS_Y
+        && region->width == TST_REG_WIDTH && region->height == TST_REG_HEIGHT
+        && region->hotspot_x == TST_REG_HOT_X && region->hotspot_y == TST_REG_HOT_Y
+        && region->cursor_x == TST_REG_CUR_X && region->cursor_y == TST_REG_CUR_Y
+        && region->cursor_width == TST_REG_CUR_WIDTH
+        && region->cursor_height == TST_REG_CUR_HEIGHT
+        && region->attr == TST_REG_ATTR)    {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_syc_callback(const ico_syc_ev_e event,
+              const void *detail, void *user_data)
+{
+    switch (event) {
+    case ICO_SYC_EV_RES_ACQUIRE:
+        _check_res_info("ICO_SYC_EV_RES_ACQUIRE", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_DEPRIVE:
+        _check_res_info("ICO_SYC_EV_RES_DEPRIVE", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_WAITING:
+        _check_res_info("ICO_SYC_EV_RES_WAITING", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_REVERT:
+        _check_res_info("ICO_SYC_EV_RES_REVERT", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_RES_RELEASE:
+        _check_res_info("ICO_SYC_EV_RES_RELEASE", (ico_syc_res_info_t *)detail);
+        break;
+    case ICO_SYC_EV_INPUT_SET:
+        _check_input_region("ICO_SYC_EV_INPUT_SET",
+                            (ico_syc_input_region_t *)detail);
+        break;
+    case ICO_SYC_EV_INPUT_UNSET:
+        _check_input_region("ICO_SYC_EV_INPUT_UNSET",
+                            (ico_syc_input_region_t *)detail);
+        break;
+    default:
+        break;
+    }
+
+    return;
+}
+
+/* test acquire resource */
+static void
+tst_acquire_res(const ico_syc_res_window_t *window,
+                const ico_syc_res_sound_t *sound,
+                const ico_syc_res_input_t *input,
+                int type)
+{
+    char *func = "ico_syc_acquire_res";
+
+    res_context = ico_syc_acquire_res(window, sound, input, type);
+    if (res_context == NULL) {
+        print_ng("%s (context is NULL)", func);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test release resource */
+static void
+tst_release_res(void)
+{
+    int ret;
+    char *func = "ico_syc_release_res";
+
+    ret = ico_syc_release_res(res_context);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test set input region */
+static void
+tst_set_input_region(const ico_syc_input_region_t *region, int attr)
+{
+    int ret;
+    char *func = "ico_syc_set_input_region";
+
+    ret = ico_syc_set_input_region(region, attr);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test unset input region */
+static void
+tst_unset_input_region(const ico_syc_input_region_t *region)
+{
+    int ret;
+    char *func = "ico_syc_unset_input_region";
+
+    ret = ico_syc_unset_input_region(region);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* ------------------------ */
+/* test main                */
+/* ------------------------ */
+static 
+Eina_Bool ico_syc_appresctl_test(void *data)
+{
+    printf("\n");
+    printf("##### ico_syc_appresctl API Test Start #####\n");
+
+    /* window/sound resource */
+    ico_syc_res_window_t window;
+    ico_syc_res_sound_t sound;
+    int type            = ICO_SYC_RES_BASIC;
+    /* input resource */
+    ico_syc_res_input_t input;
+    /* input region */
+    ico_syc_input_region_t region;
+    int attr            = 1;
+
+    /* set window resource info */
+    window.ECU         = "Center";
+    window.display     = "Center";
+    window.layer       = "OnScreen";
+    window.layout      = "Full";
+    window.area        = "Full";
+    window.dispatchApp = "zzzzzzzz";
+    window.role        = "Message";
+    window.resourceId  = 8888;
+    /* set sound resource info */
+    sound.zone          = "all";
+    sound.name          = "sound B";
+    sound.id            = "id B";
+    sound.adjust        = ICO_SYC_SOUND_MUTE;
+    /* set sound resource info */
+    input.name          = "input C";
+    input.event         = 100;
+    /* set input region info */
+    strcpy(region.winname, TST_WIN_NAME);
+    region.pos_x        = 10;
+    region.pos_y        = 10;
+    region.width        = 200;
+    region.height       = 100;
+    region.hotspot_x    = 28;
+    region.hotspot_y    = 16;
+    region.cursor_x     = 35;
+    region.cursor_y     = 25;
+    region.cursor_width = 150;
+    region.cursor_height= 80;
+    region.attr         = 98765432;
+
+    /* acquire window/sound/input */
+    tst_acquire_res((const ico_syc_res_window_t *)&window,
+                    (const ico_syc_res_sound_t *)&sound,
+                    (const ico_syc_res_input_t *)&input,
+                    type);
+    usleep(5000);
+    /* set input region */
+    tst_set_input_region(&region, attr);
+
+    sleep(2);
+
+    /* release window/sound/input */
+    tst_release_res();
+    usleep(5000);
+    /* unset input region */
+    tst_unset_input_region(&region);
+
+    sleep(3);
+
+    printf("##### ico_syc_appresctl API Test End #####\n");
+    printf("\n");
+
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(_syc_callback, NULL);
+
+    ecore_timer_add(1, ico_syc_appresctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/apps-framework/tst_appresctl_main.c b/tests/apps-framework/tst_appresctl_main.c
new file mode 100644 (file)
index 0000000..a03df62
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   test suite for App Resource Control API
+ *
+ * @date    July-31-2013
+ */
+
+#include<string.h>
+
+#include <ail.h>
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+int
+main(int argc, char **argv)
+{
+    int id;
+
+    for (id = 0; id < argc; id++) {
+        if (strcmp(argv[id], "-add") == 0) {
+            ail_desktop_add("test.ico.res.app");
+        }
+        else if (strcmp(argv[id], "-del") == 0) {
+            ail_desktop_remove("test.ico.res.app");
+        }
+    }
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/apps-framework/tst_common.c b/tests/apps-framework/tst_common.c
new file mode 100644 (file)
index 0000000..1f3ae23
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   test suite for Connect/Disconnect to System Controller API
+ *
+ * @date    Aug-19-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+
+#include "ico_syc_common.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void tst_connect(void);
+static void tst_disconnect(void);
+static int ico_syc_common_test(void);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+/* test connect */
+static void
+tst_connect(void)
+{
+    int ret;
+    char *func = "ico_syc_connect";
+
+    ret = ico_syc_connect(NULL, NULL);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test disconnect */
+static void
+tst_disconnect(void)
+{
+    (void)ico_syc_disconnect();
+    print_ok("(void)ico_syc_disconnect");
+
+    return;
+}
+
+/* test main */
+static int
+ico_syc_common_test()
+{
+    tst_connect();
+    sleep(1);
+    tst_disconnect();
+
+    sleep(3);
+
+    return 1;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+static GMainLoop *g_mainloop = NULL;
+
+static gboolean
+exit_program(gpointer data)
+{
+    g_main_loop_quit(g_mainloop);
+
+    return FALSE;
+}
+
+/* main */
+int
+main(int argc, char **argv)
+{
+    g_setenv("PKG_NAME", "org.test.ico.syc_common", 1);
+    g_mainloop = g_main_loop_new(NULL, 0);
+
+    printf("\n");
+    printf("##### ico_syc_common API Test Start #####\n");
+    ico_syc_common_test();
+    printf("##### ico_syc_common API Test End #####\n");
+    printf("\n");
+
+    g_timeout_add_seconds(1, exit_program, NULL);
+    g_main_loop_run(g_mainloop);
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/apps-framework/tst_common.h b/tests/apps-framework/tst_common.h
new file mode 100644 (file)
index 0000000..ed8242a
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+#ifndef __TST_COMMON_H__
+#define __TST_COMMON_H__
+
+#include "ico_syc_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* log macro */
+#define print_ok(fmt, arg...)                   \
+    do {                                        \
+        fprintf(stdout,                         \
+                "[TestCase] " fmt " : OK\n",    \
+                ##arg);                         \
+    } while (0)
+
+#define print_ng(fmt, arg...)                   \
+    do {                                        \
+        fprintf(stdout,                         \
+                "[TestCase] " fmt " : NG\n",    \
+                ##arg);                         \
+    } while (0)
+
+
+/* test server uri */
+#define SRV_URI ":18081"
+
+/* return value */
+#define TST_APPID       (char *)"org.test.syc.app"
+#define TST_WIN_NAME    (char *)"surface A"
+
+#define TST_SURFACE     100
+#define TST_NODE        1
+#define TST_LAYER       2
+#define TST_POS_X       10
+#define TST_POS_Y       20
+#define TST_WIDTH       1024
+#define TST_HEIGHT      768
+#define TST_RAISE       ICO_SYC_WIN_RAISE_RAISE
+#define TST_VISIBLE     ICO_SYC_WIN_VISIBLE_SHOW
+#define TST_INVISIBLE   ICO_SYC_WIN_VISIBLE_HIDE
+#define TST_ACTIVE      ICO_SYC_WIN_ACTIVE_NONE
+#define TST_STRIDE      1
+#define TST_FORMAT      ICO_SYC_THUMB_FORMAT_ARGB
+
+#define TST_ZONE_A      (char *)"zone A"
+#define TST_ZONE_B      (char *)"zone B"
+#define TST_NAME_A      (char *)"name A"
+#define TST_NAME_B      (char *)"name B"
+#define TST_NAME_C      (char *)"name C"
+#define TST_ID_A        (char *)"id A"
+#define TST_ID_B        (char *)"id B"
+
+#define TST_ECU         (char *)"ECU A"
+#define TST_display     (char *)"display A"
+#define TST_layer       (char *)"layer A"
+#define TST_layout      (char *)"layout A"
+#define TST_area        (char *)"area A"
+#define TST_dispatchApp (char *)"dispatchApp A"
+#define TST_role        (char *)"role A"
+#define TST_resourceId  55555
+
+
+#define TST_ADJUST      1
+#define TST_INPUT_EV    2
+#define TST_RES_TYPE    0
+#define TST_REG_WIDTH   200
+#define TST_REG_HEIGHT  100
+#define TST_REG_HOT_X   120
+#define TST_REG_HOT_Y   80
+#define TST_REG_CUR_X   40
+#define TST_REG_CUR_Y   30
+#define TST_REG_CUR_WIDTH  160
+#define TST_REG_CUR_HEIGHT 100
+#define TST_REG_ATTR    12345678
+
+#define TST_USER_A      (char *)"user A"
+#define TST_USER_B      (char *)"User B"
+#define TST_USER_C      (char *)"user c"
+
+#define TST_LASTINFO    (char *)"{\"page\": \"last page\", \"time\": 5}"
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TST_COMMON_H__ */
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/apps-framework/tst_inputctl.c b/tests/apps-framework/tst_inputctl.c
new file mode 100644 (file)
index 0000000..764fcb1
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   test suite for Input Control API
+ *
+ * @date    July-31-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_inputctl.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void tst_add_input(const char *appid, const char *device,
+                          int input, int fix, int keycode);
+static void tst_delete_input(const char *appid, const char *device,
+                             int input);
+static void tst_send_input(const char *appid, int surface, int ev_type,
+                           int deviceno, int ev_time, int ev_code, int ev_value);
+static Eina_Bool ico_syc_inputctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+/* test add input */
+static void
+tst_add_input(const char *appid, const char *device,
+              int input, int fix, int keycode)
+{
+    int ret;
+    char *func = "ico_syc_add_input";
+
+    ret = ico_syc_add_input(appid, device, input, fix, keycode);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test delete input */
+static void
+tst_delete_input(const char *appid, const char *device, int input)
+{
+    int ret;
+    char *func = "ico_syc_delete_input";
+
+    ret = ico_syc_delete_input(appid, device, input);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test send input */
+static void
+tst_send_input(const char *appid, int surface, int ev_type,
+               int deviceno, int ev_time, int ev_code, int ev_value)
+{
+#if 0           /* SystemController 0.9.21(with GENIVI ivi-shell) not support send_input */
+    int ret;
+    char *func = "ico_syc_send_input";
+
+    ret = ico_syc_send_input(appid, surface, ev_type, deviceno,
+                             ev_time, ev_code, ev_value);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    }
+    print_ok("%s", func);
+#endif
+    return;
+}
+
+/* test main */
+static Eina_Bool
+ico_syc_inputctl_test(void *data)
+{
+    const char *appid   = "org.test.app.testapp";
+    const char *device  = "input.dev";
+    int input           = 100;
+    int fix             = ICO_SYC_INPUT_ALLOC_FIX;
+    int keycode         = 10;
+    int surface         = 12345;
+    int ev_type         = ICO_SYC_INPUT_TYPE_POINTER;
+    int deviceno        = 123;
+    int ev_time         = 2345;
+    int ev_code         = 1;
+    int ev_value        = 1;
+
+    printf("\n");
+    printf("##### ico_syc_inputctl API Test Start #####\n");
+
+    tst_add_input(appid, device, input, fix, keycode);
+    usleep(5000);
+    tst_delete_input(appid, device, input);
+    usleep(5000);
+    tst_send_input(appid, surface, ev_type, deviceno, ev_time, ev_code, ev_value);
+
+    printf("##### ico_syc_inputctl API Test End #####\n");
+    printf("\n");
+
+    return ECORE_CALLBACK_CANCEL;
+}
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(NULL, NULL);
+
+    ecore_timer_add(1, ico_syc_inputctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/apps-framework/tst_server.c b/tests/apps-framework/tst_server.c
new file mode 100644 (file)
index 0000000..f096b5e
--- /dev/null
@@ -0,0 +1,625 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   test server
+ *
+ * @date    Aug-19-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <glib.h>
+#include <ico_uws.h>
+
+#include "ico_syc_msg_cmd_def.h"
+#include "ico_syc_msg.h"
+#include "ico_syc_private.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Define of static variable                       */
+/* ----------------------------------------------- */
+#define ZONE_EXIST      0
+#define ZONE_NO_EXIST   1
+
+static int num_close    = 0;
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static int _get_command(const void *data, size_t len);
+static int _check_zone(const void *data, size_t len);
+static msg_t _create_winctl_msg(int cmd);
+static msg_t _create_winctl_attr_msg(int cmd, const char *type);
+static msg_t _create_winctl_move_msg(const void *data, size_t len);
+static msg_t _create_winctl_layer_msg(int cmd);
+static msg_t _create_userctl_msg(int cmd);
+static msg_t _create_resctl_msg(int cmd);
+static msg_t _create_resctl_region_msg(int cmd);
+static msg_t _create_msg(const void *data, size_t len);
+static void tst_uws_callback(const struct ico_uws_context *context,
+                             const ico_uws_evt_e event,
+                             const void *id,
+                             const ico_uws_detail *detail,
+                             void *user_data);
+static int test_server(void);
+
+/* ----------------------------------------------- */
+/* Static function                                 */
+/* ----------------------------------------------- */
+static int
+_get_command(const void *data, size_t len)
+{
+    /* get command from receive data */
+    JsonParser *parser  = NULL;
+    GError *error       = NULL;
+    gboolean gbool      = FALSE;
+    JsonNode *r_root    = NULL;
+    JsonObject *r_obj   = NULL;
+    int cmd             = -1;
+
+    /* get command */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        return -1;
+    }
+    r_root = json_parser_get_root(parser);
+    if (r_root == NULL) {
+        g_object_unref(parser);
+        return -1;
+    }
+    r_obj = json_node_get_object(r_root);
+    cmd = json_object_get_int_member(r_obj, MSG_PRMKEY_CMD);
+    g_object_unref(parser); 
+
+    return cmd;
+}
+
+static int
+_check_zone(const void *data, size_t len)
+{
+    /* get command from receive data */
+    JsonParser *parser  = NULL;
+    GError *error       = NULL;
+    gboolean gbool      = FALSE;
+    JsonNode *r_root    = NULL;
+    JsonObject *r_obj   = NULL;
+    JsonObject *arg_obj = NULL;
+    int ret             = -1;
+
+    /* get command */
+    parser = json_parser_new();
+    gbool = json_parser_load_from_data(parser, data, len, &error);
+    if (gbool == FALSE) {
+        g_object_unref(parser);
+        return -1;
+    }
+    r_root = json_parser_get_root(parser);
+    if (r_root == NULL) {
+        g_object_unref(parser);
+        return -1;
+    }
+
+    r_obj = json_node_get_object(r_root);
+    arg_obj = json_object_get_object_member(r_obj, MSG_PRMKEY_ARG);
+    if (json_object_has_member(arg_obj, MSG_PRMKEY_ZONE) == TRUE) {
+        ret = ZONE_EXIST;
+    }
+    else {
+        ret = ZONE_NO_EXIST;
+    }
+    g_object_unref(parser); 
+
+    return ret;
+}
+
+static msg_t
+_create_winctl_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_string_member(argobj, MSG_PRMKEY_WINNAME, TST_WIN_NAME);
+    json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, TST_SURFACE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_NODE, TST_NODE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, TST_POS_X);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, TST_POS_Y);
+    json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, TST_WIDTH);
+    json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, TST_HEIGHT);
+    json_object_set_int_member(argobj, MSG_PRMKEY_RAISE, TST_RAISE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_ACTIVE, TST_ACTIVE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_STRIDE, TST_STRIDE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_FORMAT, TST_FORMAT);
+
+    json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+static msg_t
+_create_winctl_attr_msg(int cmd, const char *type)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_string_member(argobj, MSG_PRMKEY_WINNAME, type);
+    json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, TST_SURFACE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_NODE, TST_NODE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, TST_POS_X);
+    json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, TST_POS_Y);
+    json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, TST_WIDTH);
+    json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, TST_HEIGHT);
+    json_object_set_int_member(argobj, MSG_PRMKEY_RAISE, TST_RAISE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_ACTIVE, TST_ACTIVE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_STRIDE, TST_STRIDE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_FORMAT, TST_FORMAT);
+
+    json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+static msg_t
+_create_winctl_move_msg(const void *data, size_t len)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_CHANGE_ATTR);
+    json_object_set_string_member(argobj, MSG_PRMKEY_WINNAME, "move");
+    json_object_set_int_member(argobj, MSG_PRMKEY_SURFACE, TST_SURFACE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_NODE, TST_NODE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    if (_check_zone(data, len) == ZONE_EXIST) {
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, 0);
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, 0);
+    }
+    else {
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_X, 10);
+        json_object_set_int_member(argobj, MSG_PRMKEY_POS_Y, 10);
+    }
+    json_object_set_int_member(argobj, MSG_PRMKEY_WIDTH, TST_WIDTH);
+    json_object_set_int_member(argobj, MSG_PRMKEY_HEIGHT, TST_HEIGHT);
+    json_object_set_int_member(argobj, MSG_PRMKEY_RAISE, TST_RAISE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_ACTIVE, TST_ACTIVE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_STRIDE, TST_STRIDE);
+    json_object_set_int_member(argobj, MSG_PRMKEY_FORMAT, TST_FORMAT);
+
+    json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+static msg_t
+_create_winctl_layer_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    if (obj == NULL || argobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, MSG_CMD_CHANGE_LAYER_ATTR);
+    json_object_set_int_member(argobj, MSG_PRMKEY_LAYER, TST_LAYER);
+    if (cmd == MSG_CMD_SHOW_LAYER) {
+        json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_VISIBLE);
+    }
+    else {
+        json_object_set_int_member(argobj, MSG_PRMKEY_VISIBLE, TST_INVISIBLE);
+    }
+
+    json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+
+static msg_t
+_create_userctl_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *argobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+    JsonArray *array    = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    argobj = json_object_new();
+    array = json_array_new();
+    if (obj == NULL || argobj == NULL || array == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+    json_object_set_int_member(argobj, MSG_PRMKEY_USER_NUM, 3);
+
+    json_array_add_string_element(array, TST_USER_A);
+    json_array_add_string_element(array, TST_USER_B);
+    json_array_add_string_element(array, TST_USER_C);
+    json_object_set_array_member(argobj, MSG_PRMKEY_USER_LIST, array);
+
+    json_object_set_string_member(argobj, MSG_PRMKEY_USER_LOGIN, TST_USER_A);
+    json_object_set_string_member(argobj, MSG_PRMKEY_LASTINFO, TST_LASTINFO);
+
+    json_object_set_object_member(obj, MSG_PRMKEY_ARG, argobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+static msg_t
+_create_resctl_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonObject *window_obj  = NULL;
+    JsonObject *sound_obj  = NULL;
+    JsonObject *input_obj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    resobj = json_object_new();
+    window_obj = json_object_new();
+    sound_obj = json_object_new();
+    input_obj = json_object_new();
+    if (obj == NULL || resobj == NULL || window_obj == NULL
+        || sound_obj == NULL || input_obj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+
+    /* window */
+    json_object_set_string_member(window_obj, MSG_PRMKEY_RES_ZONE, TST_ZONE_A);
+    json_object_set_string_member(window_obj, MSG_PRMKEY_RES_NAME, TST_NAME_A);
+    json_object_set_string_member(window_obj, MSG_PRMKEY_RES_ID, TST_ID_A);
+    /* sound */
+    json_object_set_string_member(sound_obj, MSG_PRMKEY_RES_ZONE, TST_ZONE_B);
+    json_object_set_string_member(sound_obj, MSG_PRMKEY_RES_NAME, TST_NAME_B);
+    json_object_set_string_member(sound_obj, MSG_PRMKEY_RES_ID, TST_ID_B);
+    json_object_set_int_member(sound_obj, MSG_PRMKEY_RES_ADJUST, TST_ADJUST);
+    /* input */
+    json_object_set_string_member(input_obj, MSG_PRMKEY_RES_NAME, TST_NAME_C);
+    json_object_set_int_member(input_obj, MSG_PRMKEY_RES_EV, TST_INPUT_EV);
+    /* type */
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_TYPE, TST_RES_TYPE);
+
+    /* set object */
+    json_object_set_object_member(resobj, MSG_PRMKEY_RES_WINDOW, window_obj);
+    json_object_set_object_member(resobj, MSG_PRMKEY_RES_SOUND, sound_obj);
+    json_object_set_object_member(resobj, MSG_PRMKEY_RES_INPUT, input_obj);
+    json_object_set_object_member(obj, MSG_PRMKEY_RES, resobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+static msg_t
+_create_resctl_region_msg(int cmd)
+{
+    JsonObject *obj     = NULL;
+    JsonObject *resobj  = NULL;
+    JsonGenerator *gen  = NULL;
+    JsonNode *root      = NULL;
+
+    /* create json object and array */
+    obj = json_object_new();
+    resobj = json_object_new();
+    if (obj == NULL || resobj == NULL) {
+        return NULL;
+    }
+
+    /* set message */
+    json_object_set_string_member(obj, MSG_PRMKEY_APPID, TST_APPID);
+    json_object_set_int_member(obj, MSG_PRMKEY_CMD, cmd);
+
+    /* region */
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_SURFACE, TST_SURFACE);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_X, TST_POS_X);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_POS_Y, TST_POS_Y);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_WIDTH, TST_REG_WIDTH);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HEIGHT, TST_REG_HEIGHT);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HOT_X, TST_REG_HOT_X);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_HOT_Y, TST_REG_HOT_Y);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_X, TST_REG_CUR_X);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_Y, TST_REG_CUR_Y);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_WIDTH, TST_REG_CUR_WIDTH);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_CUR_HEIGHT, TST_REG_CUR_HEIGHT);
+    json_object_set_int_member(resobj, MSG_PRMKEY_RES_ATTR, TST_REG_ATTR);
+
+    /* set object */
+    json_object_set_object_member(obj, MSG_PRMKEY_REGION, resobj);
+
+    /* create root object */
+    root = json_node_new(JSON_NODE_OBJECT);
+    json_node_take_object(root, obj);
+
+    /* create generator object */
+    gen = json_generator_new();
+    json_generator_set_root(gen, root);
+
+    return gen;
+}
+
+static msg_t
+_create_msg(const void *data, size_t len)
+{
+    int cmd             = -1;
+    JsonGenerator *gen  = NULL;
+
+    /* get command */
+    cmd = _get_command(data, len);
+    if (cmd < 0) {
+        return NULL;
+    }
+
+    switch (cmd) {
+    case MSG_CMD_CREATE:
+    case MSG_CMD_DESTROY:
+    case MSG_CMD_CHANGE_ACTIVE:
+        gen = _create_winctl_msg(cmd);
+        break;
+    case MSG_CMD_SHOW:
+        gen = _create_winctl_attr_msg(MSG_CMD_CHANGE_ATTR, "show");
+        break;
+    case MSG_CMD_HIDE:
+        gen = _create_winctl_attr_msg(MSG_CMD_CHANGE_ATTR, "hide");
+        break;
+    case MSG_CMD_MOVE:
+        gen = _create_winctl_move_msg(data, len);
+        break;
+    case MSG_CMD_CHANGE_LAYER:
+        gen = _create_winctl_attr_msg(MSG_CMD_CHANGE_ATTR, "change layer");
+        break;
+    case MSG_CMD_MAP_THUMB:
+    case MSG_CMD_UNMAP_THUMB:
+        gen = _create_winctl_msg(cmd);
+        break;
+    case MSG_CMD_SHOW_LAYER:
+    case MSG_CMD_HIDE_LAYER:
+        gen = _create_winctl_layer_msg(cmd);
+        break;
+    case MSG_CMD_ADD_INPUT:
+    case MSG_CMD_DEL_INPUT:
+#if 0           /* SystemController 0.9.21(with GENIVI ivi-shell) not support send_input */
+    case MSG_CMD_SEND_INPUT:
+#endif
+        gen = NULL;
+        break;
+    case MSG_CMD_CHANGE_USER:
+    case MSG_CMD_GET_USERLIST:
+        gen = _create_userctl_msg(cmd);
+        break;
+    case MSG_CMD_ACQUIRE_RES:
+    case MSG_CMD_RELEASE_RES:
+    case MSG_CMD_DEPRIVE_RES:
+    case MSG_CMD_WAITING_RES:
+    case MSG_CMD_REVERT_RES:
+        gen = _create_resctl_msg(cmd);
+        break;
+    case MSG_CMD_SET_REGION:
+    case MSG_CMD_UNSET_REGION:
+        gen = _create_resctl_region_msg(cmd);
+        break;
+    default:
+        gen = NULL;
+        break;
+    }
+
+    return gen;
+}
+
+/* event callback */
+static void
+tst_uws_callback(const struct ico_uws_context *context,
+                 const ico_uws_evt_e event,
+                 const void *id,
+                 const ico_uws_detail *detail,
+                 void *user_data)
+{
+    JsonNode *node  = NULL;
+    msg_t msg       = NULL;
+    msg_str_t data  = NULL;
+    size_t  len     = 0;
+
+    switch (event) {
+    case ICO_UWS_EVT_RECEIVE:
+        msg = _create_msg((const void *)detail->_ico_uws_message.recv_data,
+                          detail->_ico_uws_message.recv_len);
+        if (msg == NULL) break;
+        data = json_generator_to_data(msg, &len);
+        if (data == NULL) break;
+
+        /* send return message */
+        ico_uws_send((struct ico_uws_context *)context,
+                     (void *)id,
+                     (unsigned char *)data, len);
+        printf("send: %s\n", (char *)data);
+        /* free */
+        g_free(data);
+        node = json_generator_get_root(msg);
+        json_object_unref(json_node_get_object(node));
+        json_node_free(node);
+        usleep(50);
+        break;
+    case ICO_UWS_EVT_CLOSE:
+        num_close++;
+        break;
+    case ICO_UWS_EVT_OPEN:
+    case ICO_UWS_EVT_ERROR:
+    case ICO_UWS_EVT_ADD_FD:
+    case ICO_UWS_EVT_DEL_FD:
+    default:
+        /* other event is not test */
+        break;
+    }
+
+    return;
+}
+
+/* test main (server) */
+static int
+test_server(void)
+{
+    struct ico_uws_context *context;
+
+    /* create context */
+    context = ico_uws_create_context(SRV_URI, ICO_SYC_PROTOCOL);
+
+    if (context) {
+        (void)ico_uws_set_event_cb(context, tst_uws_callback, NULL);
+
+        /* service (loop) */
+        while (num_close < 5) {
+            ico_uws_service(context);
+            usleep(50);
+        }
+
+        /* close */
+        ico_uws_close(context);
+    }
+
+    return 1;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+static GMainLoop *g_mainloop = NULL;
+
+static gboolean
+exit_program(gpointer data)
+{
+    g_main_loop_quit(g_mainloop);
+
+    return FALSE;
+}
+
+/* main */
+int
+main(int argc, char **argv)
+{
+    g_setenv("PKG_NAME", "org.test.ico.tst_server", 1);
+    g_mainloop = g_main_loop_new(NULL, 0);
+
+    test_server();
+
+    g_timeout_add_seconds(2, exit_program, NULL);
+    g_main_loop_run(g_mainloop);
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/apps-framework/tst_userctl.c b/tests/apps-framework/tst_userctl.c
new file mode 100644 (file)
index 0000000..9d33767
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   test suite for User Control API
+ *
+ * @date    Sep-5-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_userctl.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void _check_userlist(const char *ev_name, ico_syc_userlist_t *list);
+static void _syc_callback(const ico_syc_ev_e event,
+                          const void *detail, void *user_data);
+static void tst_change_user(void);
+static void tst_get_userlist(void);
+static void tst_get_lastinfo(void);
+static void tst_set_lastinfo(void);
+static Eina_Bool  ico_syc_userctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+static void
+_check_userlist(const char *ev_name, ico_syc_userlist_t *list)
+{
+    int check_flag = 0;
+    char *name;
+    int id;
+
+    printf("--- %s userlist[%d] (", ev_name, list->user_num);
+    for (id = 0; id < list->user_num; id++) {
+        if (id > 0) printf(", ");
+        name = *(list->userlist);
+        printf("%s", name);
+        if (strcmp(name, TST_USER_A) != 0 && strcmp(name, TST_USER_B) != 0
+            && strcmp(name, TST_USER_C) != 0) {
+            check_flag++;
+        }
+        list->userlist++;
+    }
+    printf("), login[%s]\n", list->user_login);
+
+    if (strcmp(list->user_login, TST_USER_A) != 0) {
+        check_flag++;
+    }
+
+    if (check_flag == 0) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_syc_callback(const ico_syc_ev_e event,
+              const void *detail, void *user_data)
+{
+    switch (event) {
+    case ICO_SYC_EV_USERLIST:
+        _check_userlist("ICO_SYC_EV_USERLIST", (ico_syc_userlist_t *)detail);
+        break;
+    case ICO_SYC_EV_AUTH_FAIL:
+        if (detail == NULL) {
+            printf("--- ICO_SYC_EV_AUTH_FAIL (detail is NULL)\n");
+            print_ok("callback (ICO_SYC_EV_AUTH_FAIL)");
+        }
+        else {
+            printf("--- ICO_SYC_EV_AUTH_FAIL (detail is not NULL)\n");
+            print_ng("callback (ICO_SYC_EV_AUTH_FAIL)");
+        }
+        break;
+    case ICO_SYC_EV_LASTINFO:
+        printf("--- lastinfo: %s\n", (char *)detail);
+        if (strcmp((char *)detail, TST_LASTINFO) == 0) {
+            print_ok("callback (ICO_SYC_EV_LASTINFO)");
+        }
+        else {
+            print_ng("callback (ICO_SYC_EV_LASTINFO)");
+        }
+        break;
+    default:
+        break;
+    }
+
+    return;
+}
+
+/* test change user */
+static void
+tst_change_user(void)
+{
+    (void)ico_syc_change_user("Alice", "");
+    print_ok("(void)ico_syc_change_user");
+
+    return;
+}
+
+/* test get userlist */
+static void
+tst_get_userlist(void)
+{
+    (void)ico_syc_get_userlist();
+    print_ok("(void)ico_syc_get_userlist");
+
+    return;
+}
+
+/* test get lastinfo */
+static void
+tst_get_lastinfo(void)
+{
+    (void)ico_syc_get_lastinfo();
+    print_ok("(void)ico_syc_get_lastinfo");
+
+    return;
+}
+
+/* test set lastinfo */
+static void
+tst_set_lastinfo(void)
+{
+    (void)ico_syc_set_lastinfo(TST_LASTINFO);
+    print_ok("(void)ico_syc_set_lastinfo");
+
+    return;
+}
+
+/* test main */
+static Eina_Bool 
+ico_syc_userctl_test(void *data)
+{
+    printf("\n");
+    printf("##### ico_syc_userctl API Test Start #####\n");
+
+    tst_change_user();
+    usleep(5000);
+    tst_get_userlist();
+    usleep(5000);
+    tst_set_lastinfo();
+    usleep(5000);
+    tst_get_lastinfo();
+
+    printf("##### ico_syc_userctl API Test End #####\n");
+    printf("\n");
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(_syc_callback, NULL);
+
+    ecore_timer_add(1, ico_syc_userctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
diff --git a/tests/apps-framework/tst_winctl.c b/tests/apps-framework/tst_winctl.c
new file mode 100644 (file)
index 0000000..3ed3999
--- /dev/null
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0.  The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+/**
+ * @brief   test suite for Window Control API
+ *
+ * @date    Aug-19-2013
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <Ecore.h>
+#include <Eina.h>
+
+#include "ico_syc_common.h"
+#include "ico_syc_winctl.h"
+
+#include "tst_common.h"
+
+/* ----------------------------------------------- */
+/* Variable                                        */
+/* ----------------------------------------------- */
+
+
+/* ----------------------------------------------- */
+/* Define of static function                       */
+/* ----------------------------------------------- */
+static void _check_win_info(const char *ev_name, ico_syc_win_info_t *info);
+static void _check_win_attr(const char *ev_name, ico_syc_win_attr_t *attr);
+static void _check_thumb_info(const char *ev_name, ico_syc_thumb_info_t *info);
+static void _check_layer_attr(const char *ev_name, ico_syc_layer_attr_t *attr);
+/* callback */
+static void _syc_callback(const ico_syc_ev_e event,
+                          const void *detail, void *user_data);
+/* window */
+static void tst_show(const char *appid, int surface,
+                     ico_syc_animation_t *animation);
+static void tst_hide(const char *appid, int surface,
+                     ico_syc_animation_t *animation);
+static void tst_move(const char *appid, int surface,
+                     ico_syc_win_move_t *move,
+                     ico_syc_animation_t *animation, const char *type);
+static void tst_change_active(const char *appid, int surface);
+static void tst_change_layer(const char *appid, int surface, int layer);
+/* thumbnail */
+static void tst_map_thumb(int surface, int framerate);
+static void tst_unmap_thumb(int surface);
+/* layer */
+static void tst_show_layer(int layer);
+static void tst_hide_layer(int layer);
+/* test main */
+static Eina_Bool ico_syc_winctl_test(void *data);
+
+/* ----------------------------------------------- */
+/* Public API Test                                 */
+/* ----------------------------------------------- */
+static void 
+_check_win_info(const char *ev_name, ico_syc_win_info_t *info)
+{
+    printf("--- %s ", ev_name);
+    printf("(appid[%s], name[%s], surface[%d])\n",
+           info->appid, info->name, info->surface);
+
+    if (strcmp(info->appid, TST_APPID) == 0
+        && strcmp(info->name, TST_WIN_NAME) == 0
+        && info->surface == TST_SURFACE) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_check_win_attr(const char *ev_name, ico_syc_win_attr_t *attr)
+{
+    printf("--- %s\n", ev_name);
+    printf("\t(appid[%s], name[%s], surface[%d], node[%d], layer[%d],\n",
+           attr->appid, attr->name, attr->surface, attr->nodeid, attr->layer);
+    printf("\t (x,y)[%d, %d], width[%d], height[%d], ",
+           attr->pos_x, attr->pos_y, attr->width, attr->height);
+    printf("raise[%d], visible[%d], active[%d])\n",
+           attr->raise, attr->visible, attr->active);
+
+    // move
+    if (strcmp(attr->name, "move") == 0) {
+        if ((attr->pos_x > 0) && (attr->pos_y > 0)) {
+            print_ok("callback (%s move (pos))", ev_name);
+        }
+        else {
+            print_ok("callback (%s move (zone))", ev_name);
+        }
+        return;
+    }
+
+    // not move
+    if (strcmp(attr->appid, TST_APPID) == 0
+        && attr->surface == TST_SURFACE && attr->nodeid == TST_NODE
+        && attr->layer == TST_LAYER && attr->pos_x == TST_POS_X
+        && attr->pos_y == TST_POS_Y && attr->width == TST_WIDTH
+        && attr->height == TST_HEIGHT && attr->raise == TST_RAISE
+        && attr->visible == TST_VISIBLE && attr->active == TST_ACTIVE) {
+        print_ok("callback (%s %s)", ev_name, attr->name);
+    }
+    else {
+        print_ng("callback (%s %s)", ev_name, attr->name);
+    }
+
+    return;
+}
+
+static void 
+_check_thumb_info(const char *ev_name, ico_syc_thumb_info_t *info)
+{
+    printf("--- %s ", ev_name);
+    printf("\t(appid[%s], surface[%d], width[%d], height[%d], ",
+           info->appid, info->surface, info->width, info->height);
+    printf("stride[%d], format[%d])\n",
+           info->stride, info->format);
+
+    if (strcmp(info->appid, TST_APPID) == 0
+        && info->surface == TST_SURFACE
+        && info->width == TST_WIDTH && info->height == TST_HEIGHT
+        && info->stride == TST_STRIDE && info->format == TST_FORMAT) {
+        print_ok("callback (%s)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void 
+_check_layer_attr(const char *ev_name, ico_syc_layer_attr_t *attr)
+{
+    printf("--- %s ", ev_name);
+    printf("(layer[%d], visible[%d])\n",
+           attr->layer, attr->visible);
+
+    if (attr->layer == TST_LAYER && attr->visible == TST_VISIBLE) {
+        print_ok("callback (%s show)", ev_name);
+    }
+    else if (attr->layer == TST_LAYER && attr->visible == TST_INVISIBLE) {
+        print_ok("callback (%s hide)", ev_name);
+    }
+    else {
+        print_ng("callback (%s)", ev_name);
+    }
+
+    return;
+}
+
+static void
+_syc_callback(const ico_syc_ev_e event,
+              const void *detail, void *user_data)
+{
+
+    switch (event) {
+    case ICO_SYC_EV_WIN_CREATE:
+        _check_win_info("ICO_SYC_EV_WIN_CREATE", (ico_syc_win_info_t *)detail);
+        break;
+    case ICO_SYC_EV_WIN_DESTROY:
+        _check_win_info("ICO_SYC_EV_WIN_DESTROY", (ico_syc_win_info_t *)detail);
+        break;
+    case ICO_SYC_EV_WIN_ACTIVE:
+        _check_win_info("ICO_SYC_EV_WIN_ACTIVE", (ico_syc_win_info_t *)detail);
+        break;
+    case ICO_SYC_EV_WIN_ATTR_CHANGE:
+        _check_win_attr("ICO_SYC_EV_WIN_ATTR_CHANGE",
+                        (ico_syc_win_attr_t *)detail);
+        break;
+    case ICO_SYC_EV_THUMB_ERROR:
+        _check_thumb_info("ICO_SYC_EV_THUMB_ERROR",
+                          (ico_syc_thumb_info_t *)detail);
+        break;
+    case ICO_SYC_EV_THUMB_CHANGE:
+        _check_thumb_info("ICO_SYC_EV_THUMB_CHANGE",
+                          (ico_syc_thumb_info_t *)detail);
+        break;
+    case ICO_SYC_EV_THUMB_UNMAP:
+        _check_thumb_info("ICO_SYC_EV_THUMB_UNMAP",
+                          (ico_syc_thumb_info_t *)detail);
+        break;
+    case ICO_SYC_EV_LAYER_ATTR_CHANGE:
+        _check_layer_attr("ICO_SYC_EV_LAYER_ATTR_CHANGE",
+                          (ico_syc_layer_attr_t *)detail);
+        break;
+    default:
+        break;
+    }
+
+    return;
+}
+
+/* test show window */
+static void
+tst_show(const char *appid, int surface, ico_syc_animation_t *animation)
+{
+    int ret;
+    char *func = "ico_syc_show";
+
+    ret = ico_syc_show(appid, surface, animation);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test hide window */
+static void
+tst_hide(const char *appid, int surface, ico_syc_animation_t *animation)
+{
+    int ret;
+    char *func = "ico_syc_hide";
+
+    ret = ico_syc_hide(appid, surface, animation);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test move window */
+static void
+tst_move(const char *appid, int surface,
+         ico_syc_win_move_t *move,
+         ico_syc_animation_t *animation, const char *type)
+{
+    int ret;
+    char *func = "ico_syc_move";
+
+    ret = ico_syc_move(appid, surface, move, animation);
+    if (ret != 0) {
+        print_ng("%s (%s) (ret: %d)", func, type, ret);
+        return;
+    } 
+    print_ok("%s (%s)", func, type);
+
+    return;
+}
+
+/* test change active window */
+static void
+tst_change_active(const char *appid, int surface)
+{
+    int ret;
+    char *func = "ico_syc_change_active";
+
+    ret = ico_syc_change_active(appid, surface);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test change window layer */
+static void
+tst_change_layer(const char *appid, int surface, int layer)
+{
+    int ret;
+    char *func = "ico_syc_change_layer";
+
+    ret = ico_syc_change_layer(appid, surface, layer);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test map thumbnail */
+static void
+tst_map_thumb(int surface, int framerate)
+{
+    int ret;
+    char *func = "ico_syc_map_thumb";
+
+    ret = ico_syc_map_thumb(surface, framerate, " ");
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test unmap thumbnail */
+static void
+tst_unmap_thumb(int surface)
+{
+    int ret;
+    char *func = "ico_syc_unmap_thumb";
+
+    ret = ico_syc_unmap_thumb(surface);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test show layer */
+static void
+tst_show_layer(int layer)
+{
+    int ret;
+    char *func = "ico_syc_show_layer";
+
+    ret = ico_syc_show_layer(layer);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* test hide layer */
+static void
+tst_hide_layer(int layer)
+{
+    int ret;
+    char *func = "ico_syc_hide_layer";
+
+    ret = ico_syc_hide_layer(layer);
+    if (ret != 0) {
+        print_ng("%s (ret: %d)", func, ret);
+        return;
+    } 
+    print_ok("%s", func);
+
+    return;
+}
+
+/* ------------------------------- */
+/* test main                       */
+/* ------------------------------- */
+static Eina_Bool
+ico_syc_winctl_test(void *data)
+{
+    const char *appid   = "org.test.app.testapp";
+    int surface         = 98765;
+    int layer           = 5;
+    ico_syc_win_move_t move, move_pos;
+    ico_syc_animation_t animation;
+
+    printf("\n");
+    printf("##### ico_syc_winctl API Test Start #####\n");
+
+    /* set move info (zone) */
+    move.zone = "center:bottom";
+    move.width = ICO_SYC_WIN_NOCHANGE;
+    move.height = 600;
+    /* set move info (position) */
+    move_pos.zone = NULL;
+    move_pos.pos_x = 10;
+    move_pos.pos_y = 20;
+    move_pos.width = 1024;
+    move_pos.height = ICO_SYC_WIN_NOCHANGE;
+
+    /* set animation data */
+    animation.name = "fade";
+    animation.time = 200;
+
+    /* window */
+    tst_show(appid, surface, &animation);
+    usleep(5000);
+    tst_hide(appid, surface, NULL);
+    usleep(5000);
+    tst_move(appid, surface, &move, &animation, "zone");
+    usleep(5000);
+    tst_move(appid, surface, &move_pos, NULL, "pos");
+    usleep(5000);
+    tst_change_active(appid, surface);
+    usleep(5000);
+    tst_change_layer(appid, surface, layer);
+
+    sleep(1);
+
+    /* thumbnail */
+    tst_map_thumb(surface, 200);
+    usleep(5000);
+    tst_unmap_thumb(surface);
+
+    sleep(1);
+
+    /* layer */
+    tst_show_layer(layer);
+    usleep(5000);
+    tst_hide_layer(layer);
+
+    printf("##### ico_syc_winctl API Test End #####\n");
+    printf("\n");
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ------------------------ */
+/* quit test callback       */
+/* ------------------------ */
+static Eina_Bool
+quit_test(void *data)
+{
+    ico_syc_disconnect();
+    ecore_main_loop_quit();
+
+    return ECORE_CALLBACK_CANCEL;
+}
+
+/* ----------------------------------------------- */
+/* Main                                            */
+/* ----------------------------------------------- */
+/* main */
+int
+main(int argc, char **argv)
+{
+    ecore_init();
+
+    ico_syc_connect(_syc_callback, NULL);
+
+    ecore_timer_add(1, ico_syc_winctl_test, NULL);
+    ecore_timer_add(5, quit_test, NULL);
+
+    ecore_main_loop_begin();
+    ecore_shutdown();
+
+    return 0;
+}
+/* vim: set expandtab ts=4 sw=4: */
index 79f0f0e..4d022a5 100755 (executable)
@@ -4,7 +4,6 @@ killall ico-vic-carsim 2> /dev/null
 killall weekeyboard 2> /dev/null
 killall weston 2> /dev/null
 killall pulseaudio 2> /dev/null
-killall IcoSysconDaemon 2> /dev/null
 killall MeterApp 2> /dev/null
 
 killall GV3ySIINq7.GhostCluster 2> /dev/null
@@ -29,7 +28,6 @@ killall  2> /dev/null
 sleep 1
 
 killall -9 HomeScreen 2> /dev/null
-killall -9 IcoSysconDaemon 2> /dev/null
 killall -9 MeterApp 2> /dev/null
 killall -9 weekeyboard 2> /dev/null
 killall -9 weston 2> /dev/null
index a3eb075..036a104 100755 (executable)
@@ -25,26 +25,14 @@ stamp-h1 \
 ./lib/common/.deps \
 ./lib/common/Makefile \
 ./lib/common/Makefile.in \
-./lib/system-controller/.deps \
-./lib/system-controller/Makefile \
-./lib/system-controller/Makefile.in \
 ./lib/notification/.deps \
 ./lib/notification/Makefile \
 ./lib/notification/Makefile.in \
 ./lib/apps-framework/.deps \
 ./lib/apps-framework/Makefile \
 ./lib/apps-framework/Makefile.in \
-./lib/misc/Makefile \
-./lib/misc/Makefile.in \
-./lib/misc/state-machine/.deps \
-./lib/misc/state-machine/Makefile \
-./lib/misc/state-machine/Makefile.in \
-./lib/misc/log/.deps \
-./lib/misc/log/Makefile \
-./lib/misc/log/Makefile.in \
 ./src/Makefile \
 ./src/Makefile.in \
-./src/system-controller/.deps \
 ./src/homescreen/.deps \
 ./src/homescreen/Makefile \
 ./src/homescreen/Makefile.in \
@@ -54,26 +42,12 @@ stamp-h1 \
 ./src/onscreen/.deps \
 ./src/onscreen/Makefile \
 ./src/onscreen/Makefile.in \
-./src/syscond/.deps \
-./src/syscond/Makefile \
-./src/syscond/Makefile.in \
 ./tests/Makefile \
 ./tests/Makefile.in \
-./tests/statusbar/.deps \
-./tests/statusbar/Makefile \
-./tests/statusbar/Makefile.in \
-./tests/system-controller/Makefile \
-./tests/system-controller/Makefile.in \
-./tests/system-controller/apps-framework/result \
-./tests/system-controller/apps-framework/.deps \
-./tests/system-controller/apps-framework/Makefile \
-./tests/system-controller/apps-framework/Makefile.in \
-./tests/system-controller/system-controller/.deps \
-./tests/system-controller/system-controller/Makefile \
-./tests/system-controller/system-controller/Makefile.in \
-./tests/system-controller/test-dummy-hs/.deps \
-./tests/system-controller/test-dummy-hs/Makefile \
-./tests/system-controller/test-dummy-hs/Makefile.in \
+./tests/apps-framework/result \
+./tests/apps-framework/.deps \
+./tests/apps-framework/Makefile \
+./tests/apps-framework/Makefile.in \
 ./tool/.deps \
 ./tool/Makefile \
 ./tool/Makefile.in \
diff --git a/tool/start_syscond.sh b/tool/start_syscond.sh
deleted file mode 100755 (executable)
index 1dc755a..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-# 1. Delete log file
-/bin/mkdir /var/log/ico > /dev/null 2>&1
-/bin/chmod -R 0777 /var/log/ico > /dev/null 2>&1
-/bin/chmod -R 0777 /tmp/ico > /dev/null 2>&1
-/bin/rm -f /var/log/ico/* /var/log/weston.log > /dev/null 2>&1
-/bin/rm -f /opt/share/crash/core.* > /dev/null 2>&1
-/bin/rm -f /opt/share/crash/info/* > /dev/null 2>&1
-
-# 2. Setup Environment Valiables
-export XDG_RUNTIME_DIR=/run/user/5000
-/bin/mkdir /run/user/5000 > /dev/null 2>&1
-/usr/bin/chown 5000 /run/user/5000
-/usr/bin/chgrp 5000 /run/user/5000
-/bin/rm -f /run/user/5000/wayland*
-
-# 3. Start Weston
-echo "export XDG_RUNTIME_DIR=/run/user/5000" > /etc/profile.d/start_syscond.sh
-/usr/bin/weston-launch --user app -- -i0 $WESTON_BACKEND --log=/var/log/ico/weston.log &
-/usr/bin/sync;/usr/bin/sync
-/usr/bin/sleep 0.2
-/usr/bin/ico_dic-gtforce -d &
-
-# 4. Start MeterApp
-/usr/bin/MeterApp > /dev/null 2>&1 &
-/usr/bin/sleep 0.3
-
-# 5. Start System Controller
-/usr/apps/org.tizen.ico.system-controller/bin/IcoSysconDaemon &
-
-# 6. End of shell
-/usr/bin/sleep 2
-/bin/rm -f /etc/profile.d/start_syscond.sh
-