cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=398378bf9009e1c479407f18e683f888d22227c3

commit 398378bf9009e1c479407f18e683f888d22227c3
Author: kabeer khan <kabeer.k...@samsung.com>
Date:   Wed Apr 15 14:15:38 2015 +0200

    ecore_file: improved Ecore_File_Download test.
    
    Summary: Signed-off-by: kabeer khan <kabeer.k...@samsung.com>
    
    Reviewers: cedric
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D2338
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/tests/ecore/ecore_test_ecore_file.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/tests/ecore/ecore_test_ecore_file.c 
b/src/tests/ecore/ecore_test_ecore_file.c
index a340baa..81e105a 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");
 

-- 


Reply via email to