From: Jinkun Jang Date: Wed, 13 Mar 2013 00:17:35 +0000 (+0900) Subject: sync X-Git-Tag: 2.1b_release~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f6b760eeed19b012d1a40c7d8d8beecd2e0bcee;p=platform%2Fcore%2Fappfw%2Fheynoti.git sync --- diff --git a/TC/unit/utc_ApplicationFW_heynoti_subscribe_file_func.c b/TC/unit/utc_ApplicationFW_heynoti_subscribe_file_func.c deleted file mode 100644 index 16b290f..0000000 --- a/TC/unit/utc_ApplicationFW_heynoti_subscribe_file_func.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * heynoti - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_ApplicationFW_heynoti_subscribe_file_func_01(void); -static void utc_ApplicationFW_heynoti_subscribe_file_func_02(void); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -struct tet_testlist tet_testlist[] = { - { utc_ApplicationFW_heynoti_subscribe_file_func_01, POSITIVE_TC_IDX }, - { utc_ApplicationFW_heynoti_subscribe_file_func_02, NEGATIVE_TC_IDX }, - { NULL, 0}, -}; - -int fd; - -void callback(void *data) -{ - -} - -static void startup(void) -{ - char *err; - - fd = heynoti_init(); - - if (fd < 0) { - err = "Error init heynoti"; - tet_infoline(err); - tet_delete(POSITIVE_TC_IDX, err); - tet_delete(NEGATIVE_TC_IDX, err); - } -} - -static void cleanup(void) -{ - heynoti_unsubscribe_file(fd, "/home/root/noti_test_file", callback); - heynoti_close(fd); -} - -/** - * @brief Positive test case of heynoti_subscribe_file() - */ -static void utc_ApplicationFW_heynoti_subscribe_file_func_01(void) -{ - int r = 0; - - r = heynoti_subscribe_file(fd, "/home/root/noti_test_file", callback, NULL, IN_CLOSE_WRITE | IN_DELETE_SELF); - - if (r) { - tet_infoline("heynoti_subscribe_file() failed in positive test case"); - tet_result(TET_FAIL); - return; - } - tet_result(TET_PASS); -} - -/** - * @brief Negative test case of ug_init heynoti_subscribe_file() - */ -static void utc_ApplicationFW_heynoti_subscribe_file_func_02(void) -{ - int r = 0; - - r = heynoti_subscribe_file(-1, "/home/root/noti_test_file", callback, NULL, IN_CLOSE_WRITE | IN_DELETE_SELF); - - if (!r) { - tet_infoline("heynoti_subscribe_file() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - tet_result(TET_PASS); -} diff --git a/TC/unit/utc_ApplicationFW_heynoti_unsubscribe_file_func.c b/TC/unit/utc_ApplicationFW_heynoti_unsubscribe_file_func.c deleted file mode 100644 index b4547aa..0000000 --- a/TC/unit/utc_ApplicationFW_heynoti_unsubscribe_file_func.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * heynoti - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ -#include -#include - -static void startup(void); -static void cleanup(void); - -void (*tet_startup)(void) = startup; -void (*tet_cleanup)(void) = cleanup; - -static void utc_ApplicationFW_heynoti_unsubscribe_file_func_01(void); -static void utc_ApplicationFW_heynoti_unsubscribe_file_func_02(void); - -enum { - POSITIVE_TC_IDX = 0x01, - NEGATIVE_TC_IDX, -}; - -struct tet_testlist tet_testlist[] = { - { utc_ApplicationFW_heynoti_unsubscribe_file_func_01, POSITIVE_TC_IDX }, - { utc_ApplicationFW_heynoti_unsubscribe_file_func_02, NEGATIVE_TC_IDX }, - { NULL, 0}, -}; - -int fd; - -void callback(void *data) -{ - -} - -static void startup(void) -{ - char *err; - int r = 0; - - fd = heynoti_init(); - - if (fd < 0) { - err = "Error init heynoti"; - tet_infoline(err); - tet_delete(POSITIVE_TC_IDX, err); - tet_delete(NEGATIVE_TC_IDX, err); - } - - r = heynoti_subscribe_file(fd, "/home/root/noti_test_file", callback, NULL, IN_CLOSE_WRITE | IN_DELETE_SELF); - - if (r) { - err = "Error subscribe file"; - tet_infoline(err); - tet_delete(POSITIVE_TC_IDX, err); - tet_delete(NEGATIVE_TC_IDX, err); - } - -} - -static void cleanup(void) -{ - heynoti_close(fd); -} - -/** - * @brief Positive test case of heynoti_unsubscribe_file() - */ -static void utc_ApplicationFW_heynoti_unsubscribe_file_func_01(void) -{ - int r = 0; - - r = heynoti_unsubscribe_file(fd, "/home/root/noti_test_file", callback); - - if (r) { - tet_infoline("heynoti_unsubscribe_file() failed in positive test case"); - tet_result(TET_FAIL); - return; - } - tet_result(TET_PASS); -} - -/** - * @brief Negative test case of ug_init heynoti_unsubscribe_file() - */ -static void utc_ApplicationFW_heynoti_unsubscribe_file_func_02(void) -{ - int r = 0; - - r = heynoti_unsubscribe_file(-1, "/home/root/noti_test_file", callback); - - if (!r) { - tet_infoline("heynoti_unsubscribe_file() failed in negative test case"); - tet_result(TET_FAIL); - return; - } - tet_result(TET_PASS); -} diff --git a/test/tst_subscribe_file_mask.c b/test/tst_subscribe_file_mask.c deleted file mode 100755 index 8ffc80b..0000000 --- a/test/tst_subscribe_file_mask.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * heynoti - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - -#include -#include -#include -#include -#include - -#include "heynoti.h" - -#define NOTI_DIRECT "/tmp/noti/direct" - -int flag; -int fd; -Ecore_Event_Handler *handler; - -#define NOTI_CB(n) callback##n - -Eina_Bool exit_func(void *data, int ev_type, void *ev) -{ - Ecore_Event_Signal_Exit *e; - - e = (Ecore_Event_Signal_Exit *) ev; - if (e->interrupt) - printf("Exit: interrupt\n"); - else if (e->quit) - printf("Exit: quit\n"); - else if (e->terminate) - printf("Exit: terminate\n"); - - ecore_main_loop_quit(); - - return ECORE_CALLBACK_PASS_ON; -} - -void in_access(void *data) -{ - printf("%s\n", __func__); -} - -void in_modify(void *data) -{ - printf("%s\n", __func__); -} - -void in_close_write(void *data) -{ - printf("%s\n", __func__); -} - -void in_close_nowrite(void *data) -{ - printf("%s\n", __func__); -} - -void in_open(void *data) -{ - printf("%s\n", __func__); -} - -void term(int signo) -{ - flag = 1; -} - -void step(int signo) -{ - static int step_cnt = 0; - int r; - - printf("%s\n", __func__); - - switch (step_cnt) { - case 0: - r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_access); - printf("noti del: in_access : %d\n", r); - break; - case 1: - r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_modify); - printf("noti del: in_modify : %d\n", r); - break; - case 2: - r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_close_write); - printf("noti del: in_close_write : %d\n", r); - break; - case 3: - r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_close_nowrite); - printf("noti del: in_close_nowrite : %d\n", r); - break; - case 4: - r = heynoti_unsubscribe_file(fd, NOTI_DIRECT, in_open); - printf("noti del: in_open : %d\n", r); - break; - } - - step_cnt++; -} - -int main(int argc, const char *argv[]) -{ - int ret; - - ecore_init(); - ecore_app_args_set(argc, argv); - - fd = heynoti_init(); - printf("Noti init: %d\n", fd); - if (fd == -1) - return -1; - - handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); - - ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_access, NULL, IN_ACCESS); - printf("noti add: in_access : %d\n", ret); - - ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_modify, NULL, IN_MODIFY); - printf("noti add: in_modify : %d\n", ret); - - ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_close_write, NULL, IN_CLOSE_WRITE); - printf("noti add: in_close_write : %d\n", ret); - - ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_close_nowrite, NULL, IN_CLOSE_NOWRITE); - printf("noti add: in_close_nowrite : %d\n", ret); - - ret = heynoti_subscribe_file(fd, NOTI_DIRECT, in_open, NULL, IN_OPEN); - printf("noti add: in_open : %d\n", ret); - - ret = heynoti_attach_handler(fd); - printf("add main: %d\n", ret); - if (ret == -1) - goto err; - - while (!flag) { - sleep(1); - } - - ecore_main_loop_begin(); - err: - heynoti_close(fd); - ecore_shutdown(); - - return 0; -} -