forked from enlightenment/efl
ecore: Fix download test.
Summary: After ecore_main_loop_quit() changes, calling it from outside the main loop does not make the next iteration of the main loop quit, causing the original version of the test to deadlock. Also update the function documentation about it. Reviewers: zmike Reviewed By: zmike Subscribers: cedric, #reviewers, felipealmeida, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9448
This commit is contained in:
parent
a345880efa
commit
587bf58dec
|
@ -317,8 +317,10 @@ EAPI void ecore_main_loop_begin(void);
|
|||
* Quits the main loop once all the events currently on the queue have
|
||||
* been processed.
|
||||
*
|
||||
* This function returns immediately, but will mark the ecore_main_loop_begin()
|
||||
* function to return at the end of the current main loop iteration.
|
||||
* This function returns immediately, but if called inside the main loop
|
||||
* it will mark the ecore_main_loop_begin() function to return at the
|
||||
* end of the current main loop iteration.
|
||||
*
|
||||
*/
|
||||
EAPI void ecore_main_loop_quit(void);
|
||||
|
||||
|
|
|
@ -100,9 +100,13 @@ completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status)
|
|||
}
|
||||
|
||||
void
|
||||
err_completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status)
|
||||
err_completion_cb(void *data, const char *file EINA_UNUSED, int status)
|
||||
{
|
||||
if (data)
|
||||
*((int*) data) = status;
|
||||
fail_if(status != 1);
|
||||
// NOP if called from outside main loop. Keep it here if abort fails and
|
||||
// we get called from there.
|
||||
ecore_main_loop_quit();
|
||||
}
|
||||
|
||||
|
@ -517,12 +521,15 @@ EFL_START_TEST(ecore_test_ecore_file_download)
|
|||
progress_cb, NULL, &job);
|
||||
fail_if(res != EINA_FALSE);
|
||||
|
||||
int status = 0;
|
||||
res = ecore_file_download(download_url, dest_name, err_completion_cb,
|
||||
progress_cb, NULL, &job);
|
||||
progress_cb, &status, &job);
|
||||
fail_if(res != EINA_TRUE);
|
||||
fail_if(!job);
|
||||
ecore_file_download_abort(job);
|
||||
ecore_main_loop_begin();
|
||||
fail_if(status != 1);
|
||||
if (!status)
|
||||
ecore_main_loop_begin();
|
||||
if (timeout_reached) goto end;
|
||||
res = ecore_file_remove(dest_name);
|
||||
fail_if(res != EINA_TRUE);
|
||||
|
|
Loading…
Reference in New Issue