aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkabeer khan <kabeer.khan@samsung.com>2015-04-15 14:15:38 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-04-15 14:15:48 +0200
commit398378bf9009e1c479407f18e683f888d22227c3 (patch)
tree4bae3c49aac1eafb4b0ef4c6bb85a3a613ca75e3
parentevas: fix compilation in the Evas 3D examples. (diff)
downloadefl-398378bf9009e1c479407f18e683f888d22227c3.tar.gz
ecore_file: improved Ecore_File_Download test.
Summary: Signed-off-by: kabeer khan <kabeer.khan@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2338 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/tests/ecore/ecore_test_ecore_file.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/tests/ecore/ecore_test_ecore_file.c b/src/tests/ecore/ecore_test_ecore_file.c
index a340baa43f..81e105a950 100644
--- a/src/tests/ecore/ecore_test_ecore_file.c
+++ b/src/tests/ecore/ecore_test_ecore_file.c
@@ -96,6 +96,13 @@ completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status)
ecore_main_loop_quit();
}
+void
+err_completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status)
+{
+ fail_if(status != 1);
+ ecore_main_loop_quit();
+}
+
int
progress_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED,
long int dltotal, long int dlnow,
@@ -357,6 +364,7 @@ START_TEST(ecore_test_ecore_file_download)
char dest_name[MAXSIZE] = {'\0'};
Eina_Bool res;
Eina_Hash *headers;
+ Ecore_File_Download_Job *job = NULL;
int ret;
ret = ecore_file_init();
@@ -366,12 +374,14 @@ START_TEST(ecore_test_ecore_file_download)
fail_if(!download_dir);
download_file = ecore_file_file_get(download_url);
fail_if(!download_file);
+ fail_if(!ecore_file_download_protocol_available("http://"));
strcat(dest_name, download_dir);
strcat(dest_name, "/");
strcat(dest_name, download_file);
res = ecore_file_download(download_url, dest_name, completion_cb,
- progress_cb, NULL, NULL);
+ progress_cb, NULL, &job);
fail_if(res != EINA_TRUE);
+ fail_if(!job);
ecore_main_loop_begin();
fprintf(stderr, "Downloaded %lld bytes\n", ecore_file_size(dest_name));
res = ecore_file_exists(dest_name);
@@ -379,6 +389,19 @@ START_TEST(ecore_test_ecore_file_download)
res = ecore_file_unlink(dest_name);
fail_if(res != EINA_TRUE);
+ res = ecore_file_download("xxyyzz", dest_name, completion_cb,
+ progress_cb, &job, NULL);
+ fail_if(res != EINA_FALSE);
+
+ res = ecore_file_download(download_url, dest_name, err_completion_cb,
+ progress_cb, &job, NULL);
+ fail_if(res != EINA_TRUE);
+ fail_if(!job);
+ ecore_file_download_abort(job);
+ ecore_main_loop_begin();
+ res = ecore_file_remove(dest_name);
+ fail_if(res != EINA_TRUE);
+
headers = eina_hash_string_small_new(NULL);
eina_hash_add(headers, "Content-type", "text/xml");