summaryrefslogtreecommitdiff
path: root/src/tests/ecore
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-07-30 15:22:03 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-07-30 15:22:03 -0400
commitd0e10dd2734ce9d1cac6569e4c2c3975dbffcbe8 (patch)
tree2f8937d8f8f04ce48e4c556a9dec6a5f42f55966 /src/tests/ecore
parentc594c83a02cdd0000dd7ccefd6761ec613330278 (diff)
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
Diffstat (limited to 'src/tests/ecore')
-rw-r--r--src/tests/ecore/ecore_test_ecore_file.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c
index fe0e73f3a8..3b6fcffff7 100644
--- a/src/tests/ecore/ecore_test_ecore_file.c
+++ b/src/tests/ecore/ecore_test_ecore_file.c
@@ -104,9 +104,13 @@ completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status)
104} 104}
105 105
106void 106void
107err_completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status) 107err_completion_cb(void *data, const char *file EINA_UNUSED, int status)
108{ 108{
109 if (data)
110 *((int*) data) = status;
109 fail_if(status != 1); 111 fail_if(status != 1);
112 // NOP if called from outside main loop. Keep it here if abort fails and
113 // we get called from there.
110 ecore_main_loop_quit(); 114 ecore_main_loop_quit();
111} 115}
112 116
@@ -521,12 +525,15 @@ EFL_START_TEST(ecore_test_ecore_file_download)
521 progress_cb, NULL, &job); 525 progress_cb, NULL, &job);
522 fail_if(res != EINA_FALSE); 526 fail_if(res != EINA_FALSE);
523 527
528 int status = 0;
524 res = ecore_file_download(download_url, dest_name, err_completion_cb, 529 res = ecore_file_download(download_url, dest_name, err_completion_cb,
525 progress_cb, NULL, &job); 530 progress_cb, &status, &job);
526 fail_if(res != EINA_TRUE); 531 fail_if(res != EINA_TRUE);
527 fail_if(!job); 532 fail_if(!job);
528 ecore_file_download_abort(job); 533 ecore_file_download_abort(job);
529 ecore_main_loop_begin(); 534 fail_if(status != 1);
535 if (!status)
536 ecore_main_loop_begin();
530 if (timeout_reached) goto end; 537 if (timeout_reached) goto end;
531 res = ecore_file_remove(dest_name); 538 res = ecore_file_remove(dest_name);
532 fail_if(res != EINA_TRUE); 539 fail_if(res != EINA_TRUE);