summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-09-13 15:52:40 -0700
committerCedric Bail <cedric@osg.samsung.com>2017-09-13 15:53:00 -0700
commitb9ef9af74a4cc401c02468f20a68659b9b2a1235 (patch)
tree09740386a9da902389c689d0b96524bf09dd3d73 /src/tests/eio
parentba34b998eb6920fe0dbccd1037e8344c028754ec (diff)
eio: migrate efl.io.manager.open to use Eina_Future.
Diffstat (limited to '')
-rw-r--r--src/tests/eio/eio_test_manager.c32
-rw-r--r--src/tests/eio/eio_test_manager_xattr.c2
2 files changed, 23 insertions, 11 deletions
diff --git a/src/tests/eio/eio_test_manager.c b/src/tests/eio/eio_test_manager.c
index ebfcc9edf7..e97310276c 100644
--- a/src/tests/eio/eio_test_manager.c
+++ b/src/tests/eio/eio_test_manager.c
@@ -51,16 +51,28 @@ _error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
51 ecore_main_loop_quit(); 51 ecore_main_loop_quit();
52} 52}
53 53
54static void 54static Eina_Value
55_open_done_cb(void *data, const Efl_Event *ev) 55_open_done_cb(void *data,
56 const Eina_Value file,
57 const Eina_Future *dead EINA_UNUSED)
56{ 58{
57 Efl_Future_Event_Success *success = ev->info; 59 if (file.type == EINA_VALUE_TYPE_ERROR)
58 Eina_Bool *opened = (Eina_Bool *)data; 60 {
59 Eina_File* file = eina_file_dup(success->value); 61 Eina_Error err;
60 eina_file_close(file); 62
61 63 eina_value_get(&file, &err);
62 *opened = EINA_TRUE; 64 fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err));
65 abort();
66 }
67 if (file.type == EINA_VALUE_TYPE_FILE)
68 {
69 Eina_Bool *opened = (Eina_Bool *)data;
70
71 *opened = EINA_TRUE;
72 }
63 ecore_main_loop_quit(); 73 ecore_main_loop_quit();
74
75 return file;
64} 76}
65 77
66static void 78static void
@@ -221,7 +233,7 @@ START_TEST(efl_io_manager_test_open)
221 Eina_Tmpstr *nested_dirname; 233 Eina_Tmpstr *nested_dirname;
222 Eina_Tmpstr *nested_filename; 234 Eina_Tmpstr *nested_filename;
223 Efl_Io_Manager *job; 235 Efl_Io_Manager *job;
224 Efl_Future *f; 236 Eina_Future *f;
225 Eina_Bool opened_file = EINA_FALSE; 237 Eina_Bool opened_file = EINA_FALSE;
226 int ret; 238 int ret;
227 239
@@ -241,7 +253,7 @@ START_TEST(efl_io_manager_test_open)
241 job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get()); 253 job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
242 254
243 f = efl_io_manager_open(job, nested_filename, EINA_FALSE); 255 f = efl_io_manager_open(job, nested_filename, EINA_FALSE);
244 efl_future_then(f, &_open_done_cb, &_error_cb, NULL, &opened_file); 256 eina_future_then(f, _open_done_cb, &opened_file);
245 ecore_main_loop_begin(); 257 ecore_main_loop_begin();
246 258
247 fail_if(!opened_file); 259 fail_if(!opened_file);
diff --git a/src/tests/eio/eio_test_manager_xattr.c b/src/tests/eio/eio_test_manager_xattr.c
index 3d41316f20..bb2ddece02 100644
--- a/src/tests/eio/eio_test_manager_xattr.c
+++ b/src/tests/eio/eio_test_manager_xattr.c
@@ -118,7 +118,7 @@ _error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
118} 118}
119 119
120static Eina_Value 120static Eina_Value
121_future_all_cb(const void *data, 121_future_all_cb(void *data,
122 const Eina_Value array, 122 const Eina_Value array,
123 const Eina_Future *dead EINA_UNUSED) 123 const Eina_Future *dead EINA_UNUSED)
124{ 124{