diff options
author | Cedric Bail <cedric@osg.samsung.com> | 2017-09-13 15:52:40 -0700 |
---|---|---|
committer | Cedric Bail <cedric@osg.samsung.com> | 2017-09-13 15:53:00 -0700 |
commit | b9ef9af74a4cc401c02468f20a68659b9b2a1235 (patch) | |
tree | 09740386a9da902389c689d0b96524bf09dd3d73 /src/tests/eio/eio_test_manager.c | |
parent | ba34b998eb6920fe0dbccd1037e8344c028754ec (diff) | |
download | efl-b9ef9af74a4cc401c02468f20a68659b9b2a1235.tar.gz |
eio: migrate efl.io.manager.open to use Eina_Future.
Diffstat (limited to 'src/tests/eio/eio_test_manager.c')
-rw-r--r-- | src/tests/eio/eio_test_manager.c | 32 |
1 files changed, 22 insertions, 10 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) ecore_main_loop_quit(); } -static void -_open_done_cb(void *data, const Efl_Event *ev) +static Eina_Value +_open_done_cb(void *data, + const Eina_Value file, + const Eina_Future *dead EINA_UNUSED) { - Efl_Future_Event_Success *success = ev->info; - Eina_Bool *opened = (Eina_Bool *)data; - Eina_File* file = eina_file_dup(success->value); - eina_file_close(file); - - *opened = EINA_TRUE; + if (file.type == EINA_VALUE_TYPE_ERROR) + { + Eina_Error err; + + eina_value_get(&file, &err); + fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err)); + abort(); + } + if (file.type == EINA_VALUE_TYPE_FILE) + { + Eina_Bool *opened = (Eina_Bool *)data; + + *opened = EINA_TRUE; + } ecore_main_loop_quit(); + + return file; } static void @@ -221,7 +233,7 @@ START_TEST(efl_io_manager_test_open) Eina_Tmpstr *nested_dirname; Eina_Tmpstr *nested_filename; Efl_Io_Manager *job; - Efl_Future *f; + Eina_Future *f; Eina_Bool opened_file = EINA_FALSE; int ret; @@ -241,7 +253,7 @@ START_TEST(efl_io_manager_test_open) job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get()); f = efl_io_manager_open(job, nested_filename, EINA_FALSE); - efl_future_then(f, &_open_done_cb, &_error_cb, NULL, &opened_file); + eina_future_then(f, _open_done_cb, &opened_file); ecore_main_loop_begin(); fail_if(!opened_file); |