summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-12-14 16:42:23 -0800
committerCedric Bail <cedric@osg.samsung.com>2017-12-14 16:42:44 -0800
commit348c71e9ec16f1fca04261a1b8fd3da951a331ce (patch)
tree02a61c2dd51dfe0efadf6455885b647749ae7285 /src/tests/eio
parent2853f9c3b3cac3dc5c3d93a29198f7c58d1ed2b7 (diff)
eio: update efl_io_manager_xattr_ls test to use Eina_Future.
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_test_manager_xattr.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/src/tests/eio/eio_test_manager_xattr.c b/src/tests/eio/eio_test_manager_xattr.c
index 261d2e2c8b..2f41b1bc6c 100644
--- a/src/tests/eio/eio_test_manager_xattr.c
+++ b/src/tests/eio/eio_test_manager_xattr.c
@@ -36,17 +36,16 @@ static const char *attr_data[] =
36int total_attributes = sizeof(attribute)/sizeof(attribute[0]); 36int total_attributes = sizeof(attribute)/sizeof(attribute[0]);
37 37
38static void 38static void
39_main_cb(void *data, const Efl_Event *ev) 39_main_cb(void *data, Eina_Accessor *access)
40{ 40{
41 Efl_Future_Event_Progress *progress = ev->info;
42 const Eina_Array *attrs = progress->progress;
43 const char* attr; 41 const char* attr;
44 int *num_of_attr = (int *)data; 42 int *num_of_attr = (int *)data;
45 unsigned int i, j; 43 unsigned int count;
46 Eina_Array_Iterator it;
47 44
48 EINA_ARRAY_ITER_NEXT(attrs, j, attr, it) 45 EINA_ACCESSOR_FOREACH(access, count, attr)
49 { 46 {
47 unsigned int i;
48
50 for (i = 0; i < sizeof (attribute) / sizeof (attribute[0]); ++i) 49 for (i = 0; i < sizeof (attribute) / sizeof (attribute[0]); ++i)
51 { 50 {
52 if (strcmp(attr, attribute[i]) == 0) 51 if (strcmp(attr, attribute[i]) == 0)
@@ -58,28 +57,6 @@ _main_cb(void *data, const Efl_Event *ev)
58 } 57 }
59} 58}
60 59
61static void
62_done_cb(void *data, const Efl_Event *ev EINA_UNUSED)
63
64{
65 int *num_of_attr = (int *)data;
66
67 fail_if(*num_of_attr != total_attributes);
68
69 ecore_main_loop_quit();
70}
71
72static void
73_error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
74{
75 Efl_Future_Event_Failure *failure = ev->info;
76
77 fprintf(stderr, "Something has gone wrong:%s\n", eina_error_msg_get(failure->error));
78 abort();
79
80 ecore_main_loop_quit();
81}
82
83static Eina_Value 60static Eina_Value
84_future_done_cb(void *data EINA_UNUSED, 61_future_done_cb(void *data EINA_UNUSED,
85 const Eina_Value array, 62 const Eina_Value array,
@@ -147,7 +124,6 @@ START_TEST(eio_test_job_xattr_set)
147 int num_of_attr = 0, fd; 124 int num_of_attr = 0, fd;
148 unsigned int i; 125 unsigned int i;
149 Eo *job; 126 Eo *job;
150 Efl_Future *ls = NULL;
151 Eina_Future **futures = NULL; 127 Eina_Future **futures = NULL;
152 128
153 ecore_init(); 129 ecore_init();
@@ -199,8 +175,8 @@ START_TEST(eio_test_job_xattr_set)
199 175
200 num_of_attr = 0; 176 num_of_attr = 0;
201 177
202 efl_future_use(&ls, efl_io_manager_xattr_ls(job, test_file_path)); 178 eina_future_then(efl_io_manager_xattr_ls(job, test_file_path, &num_of_attr, _main_cb, NULL),
203 efl_future_then(ls, _done_cb, _error_cb, _main_cb, &num_of_attr); 179 _future_done_cb, &num_of_attr);
204 180
205 fail_if(num_of_attr != 0); 181 fail_if(num_of_attr != 0);
206 182