From 183fd943d2a39ee7cc7e10387ed75d6c0c274266 Mon Sep 17 00:00:00 2001 From: "jk7744.park" Date: Sun, 1 Feb 2015 13:32:37 +0900 Subject: [PATCH] tizen 2.3 release --- CMakeLists.txt | 7 +- TC/_export_env.sh | 8 + TC/_export_target_env.sh | 8 + TC/build.sh | 16 + TC/clean.sh | 11 + TC/config | 3 + TC/execute.sh | 15 + TC/testcase/Makefile | 27 + TC/testcase/tslist | 84 ++ .../utc_download_add_http_header_field_negative.c | 91 ++ .../utc_download_add_http_header_field_positive.c | 58 + TC/testcase/utc_download_create_negative.c | 55 + TC/testcase/utc_download_create_positive.c | 58 + TC/testcase/utc_download_destroy_negative.c | 53 + TC/testcase/utc_download_destroy_positive.c | 63 + .../utc_download_get_auto_download_negative.c | 89 ++ .../utc_download_get_auto_download_positive.c | 61 + .../utc_download_get_content_name_negative.c | 89 ++ .../utc_download_get_content_name_positive.c | 107 ++ .../utc_download_get_content_size_negative.c | 89 ++ .../utc_download_get_content_size_positive.c | 112 ++ .../utc_download_get_destination_negative.c | 92 ++ .../utc_download_get_destination_positive.c | 61 + ...tc_download_get_downloaded_file_path_negative.c | 90 ++ ...tc_download_get_downloaded_file_path_positive.c | 111 ++ TC/testcase/utc_download_get_error_negative.c | 89 ++ TC/testcase/utc_download_get_error_positive.c | 59 + TC/testcase/utc_download_get_etag_negative.c | 74 + TC/testcase/utc_download_get_etag_positive.c | 102 ++ TC/testcase/utc_download_get_file_name_negative.c | 74 + TC/testcase/utc_download_get_file_name_positive.c | 61 + ..._download_get_http_header_field_list_negative.c | 101 ++ ..._download_get_http_header_field_list_positive.c | 61 + .../utc_download_get_http_header_field_negative.c | 105 ++ .../utc_download_get_http_header_field_positive.c | 62 + .../utc_download_get_http_status_negative.c | 89 ++ .../utc_download_get_http_status_positive.c | 107 ++ TC/testcase/utc_download_get_mime_type_negative.c | 89 ++ TC/testcase/utc_download_get_mime_type_positive.c | 110 ++ .../utc_download_get_network_bonding_negative.c | 89 ++ .../utc_download_get_network_bonding_positive.c | 61 + .../utc_download_get_network_type_negative.c | 74 + .../utc_download_get_network_type_positive.c | 60 + ...utc_download_get_notification_bundle_negative.c | 92 ++ ...utc_download_get_notification_bundle_positive.c | 66 + ...ownload_get_notification_description_negative.c | 89 ++ ...ownload_get_notification_description_positive.c | 61 + .../utc_download_get_notification_title_negative.c | 89 ++ .../utc_download_get_notification_title_positive.c | 61 + .../utc_download_get_notification_type_negative.c | 73 + .../utc_download_get_notification_type_positive.c | 60 + TC/testcase/utc_download_get_state_negative.c | 74 + TC/testcase/utc_download_get_state_positive.c | 59 + TC/testcase/utc_download_get_temp_path_negative.c | 89 ++ TC/testcase/utc_download_get_temp_path_positive.c | 109 ++ TC/testcase/utc_download_get_url_negative.c | 91 ++ TC/testcase/utc_download_get_url_positive.c | 61 + TC/testcase/utc_download_pause_negative.c | 55 + TC/testcase/utc_download_pause_positive.c | 131 ++ ...tc_download_remove_http_header_field_negative.c | 98 ++ ...tc_download_remove_http_header_field_positive.c | 61 + .../utc_download_set_auto_download_negative.c | 56 + .../utc_download_set_auto_download_positive.c | 59 + .../utc_download_set_destination_negative.c | 70 + .../utc_download_set_destination_positive.c | 57 + TC/testcase/utc_download_set_file_name_negative.c | 73 + TC/testcase/utc_download_set_file_name_positive.c | 58 + .../utc_download_set_network_bonding_negative.c | 56 + .../utc_download_set_network_bonding_positive.c | 59 + .../utc_download_set_network_type_negative.c | 73 + .../utc_download_set_network_type_positive.c | 58 + ...utc_download_set_notification_bundle_negative.c | 96 ++ ...utc_download_set_notification_bundle_positive.c | 61 + ...ownload_set_notification_description_negative.c | 90 ++ ...ownload_set_notification_description_positive.c | 58 + .../utc_download_set_notification_title_negative.c | 90 ++ .../utc_download_set_notification_title_positive.c | 58 + .../utc_download_set_notification_type_negative.c | 72 + .../utc_download_set_notification_type_positive.c | 58 + .../utc_download_set_progress_cb_negative.c | 60 + .../utc_download_set_progress_cb_positive.c | 63 + .../utc_download_set_state_changed_cb_negative.c | 60 + .../utc_download_set_state_changed_cb_positive.c | 63 + .../utc_download_set_temp_file_path_negative.c | 70 + .../utc_download_set_temp_file_path_positive.c | 58 + TC/testcase/utc_download_set_url_negative.c | 73 + TC/testcase/utc_download_set_url_positive.c | 58 + TC/testcase/utc_download_start_negative.c | 107 ++ TC/testcase/utc_download_start_positive.c | 117 ++ .../utc_download_unset_progress_cb_negative.c | 55 + .../utc_download_unset_progress_cb_positive.c | 64 + .../utc_download_unset_state_changed_cb_negative.c | 56 + .../utc_download_unset_state_changed_cb_positive.c | 64 + TC/tet_scen | 7 + TC/tetbuild.cfg | 5 + TC/tetclean.cfg | 5 + TC/tetexec.cfg | 5 + doc/download_doc.h | 54 + include/download.h | 1525 ++++++++++++-------- include/download_doc.h | 40 - packaging/capi-web-url-download.spec | 30 +- script/commit-template | 11 + src/download-wrapping.c | 129 +- 103 files changed, 7640 insertions(+), 685 deletions(-) create mode 100644 TC/_export_env.sh create mode 100644 TC/_export_target_env.sh create mode 100644 TC/build.sh create mode 100644 TC/clean.sh create mode 100644 TC/config create mode 100644 TC/execute.sh create mode 100644 TC/testcase/Makefile create mode 100644 TC/testcase/tslist create mode 100644 TC/testcase/utc_download_add_http_header_field_negative.c create mode 100644 TC/testcase/utc_download_add_http_header_field_positive.c create mode 100644 TC/testcase/utc_download_create_negative.c create mode 100644 TC/testcase/utc_download_create_positive.c create mode 100644 TC/testcase/utc_download_destroy_negative.c create mode 100644 TC/testcase/utc_download_destroy_positive.c create mode 100644 TC/testcase/utc_download_get_auto_download_negative.c create mode 100644 TC/testcase/utc_download_get_auto_download_positive.c create mode 100644 TC/testcase/utc_download_get_content_name_negative.c create mode 100644 TC/testcase/utc_download_get_content_name_positive.c create mode 100644 TC/testcase/utc_download_get_content_size_negative.c create mode 100644 TC/testcase/utc_download_get_content_size_positive.c create mode 100644 TC/testcase/utc_download_get_destination_negative.c create mode 100644 TC/testcase/utc_download_get_destination_positive.c create mode 100644 TC/testcase/utc_download_get_downloaded_file_path_negative.c create mode 100644 TC/testcase/utc_download_get_downloaded_file_path_positive.c create mode 100644 TC/testcase/utc_download_get_error_negative.c create mode 100644 TC/testcase/utc_download_get_error_positive.c create mode 100644 TC/testcase/utc_download_get_etag_negative.c create mode 100644 TC/testcase/utc_download_get_etag_positive.c create mode 100644 TC/testcase/utc_download_get_file_name_negative.c create mode 100644 TC/testcase/utc_download_get_file_name_positive.c create mode 100644 TC/testcase/utc_download_get_http_header_field_list_negative.c create mode 100644 TC/testcase/utc_download_get_http_header_field_list_positive.c create mode 100644 TC/testcase/utc_download_get_http_header_field_negative.c create mode 100644 TC/testcase/utc_download_get_http_header_field_positive.c create mode 100644 TC/testcase/utc_download_get_http_status_negative.c create mode 100644 TC/testcase/utc_download_get_http_status_positive.c create mode 100644 TC/testcase/utc_download_get_mime_type_negative.c create mode 100644 TC/testcase/utc_download_get_mime_type_positive.c create mode 100644 TC/testcase/utc_download_get_network_bonding_negative.c create mode 100644 TC/testcase/utc_download_get_network_bonding_positive.c create mode 100644 TC/testcase/utc_download_get_network_type_negative.c create mode 100644 TC/testcase/utc_download_get_network_type_positive.c create mode 100644 TC/testcase/utc_download_get_notification_bundle_negative.c create mode 100644 TC/testcase/utc_download_get_notification_bundle_positive.c create mode 100644 TC/testcase/utc_download_get_notification_description_negative.c create mode 100644 TC/testcase/utc_download_get_notification_description_positive.c create mode 100644 TC/testcase/utc_download_get_notification_title_negative.c create mode 100644 TC/testcase/utc_download_get_notification_title_positive.c create mode 100644 TC/testcase/utc_download_get_notification_type_negative.c create mode 100644 TC/testcase/utc_download_get_notification_type_positive.c create mode 100644 TC/testcase/utc_download_get_state_negative.c create mode 100644 TC/testcase/utc_download_get_state_positive.c create mode 100644 TC/testcase/utc_download_get_temp_path_negative.c create mode 100644 TC/testcase/utc_download_get_temp_path_positive.c create mode 100644 TC/testcase/utc_download_get_url_negative.c create mode 100644 TC/testcase/utc_download_get_url_positive.c create mode 100644 TC/testcase/utc_download_pause_negative.c create mode 100644 TC/testcase/utc_download_pause_positive.c create mode 100644 TC/testcase/utc_download_remove_http_header_field_negative.c create mode 100644 TC/testcase/utc_download_remove_http_header_field_positive.c create mode 100644 TC/testcase/utc_download_set_auto_download_negative.c create mode 100644 TC/testcase/utc_download_set_auto_download_positive.c create mode 100644 TC/testcase/utc_download_set_destination_negative.c create mode 100644 TC/testcase/utc_download_set_destination_positive.c create mode 100644 TC/testcase/utc_download_set_file_name_negative.c create mode 100644 TC/testcase/utc_download_set_file_name_positive.c create mode 100644 TC/testcase/utc_download_set_network_bonding_negative.c create mode 100644 TC/testcase/utc_download_set_network_bonding_positive.c create mode 100644 TC/testcase/utc_download_set_network_type_negative.c create mode 100644 TC/testcase/utc_download_set_network_type_positive.c create mode 100644 TC/testcase/utc_download_set_notification_bundle_negative.c create mode 100644 TC/testcase/utc_download_set_notification_bundle_positive.c create mode 100644 TC/testcase/utc_download_set_notification_description_negative.c create mode 100644 TC/testcase/utc_download_set_notification_description_positive.c create mode 100644 TC/testcase/utc_download_set_notification_title_negative.c create mode 100644 TC/testcase/utc_download_set_notification_title_positive.c create mode 100644 TC/testcase/utc_download_set_notification_type_negative.c create mode 100644 TC/testcase/utc_download_set_notification_type_positive.c create mode 100644 TC/testcase/utc_download_set_progress_cb_negative.c create mode 100644 TC/testcase/utc_download_set_progress_cb_positive.c create mode 100644 TC/testcase/utc_download_set_state_changed_cb_negative.c create mode 100644 TC/testcase/utc_download_set_state_changed_cb_positive.c create mode 100644 TC/testcase/utc_download_set_temp_file_path_negative.c create mode 100644 TC/testcase/utc_download_set_temp_file_path_positive.c create mode 100644 TC/testcase/utc_download_set_url_negative.c create mode 100644 TC/testcase/utc_download_set_url_positive.c create mode 100644 TC/testcase/utc_download_start_negative.c create mode 100644 TC/testcase/utc_download_start_positive.c create mode 100644 TC/testcase/utc_download_unset_progress_cb_negative.c create mode 100644 TC/testcase/utc_download_unset_progress_cb_positive.c create mode 100644 TC/testcase/utc_download_unset_state_changed_cb_negative.c create mode 100644 TC/testcase/utc_download_unset_state_changed_cb_positive.c create mode 100644 TC/tet_scen create mode 100644 TC/tetbuild.cfg create mode 100644 TC/tetclean.cfg create mode 100644 TC/tetexec.cfg create mode 100644 doc/download_doc.h delete mode 100755 include/download_doc.h create mode 100644 script/commit-template diff --git a/CMakeLists.txt b/CMakeLists.txt index 585606f..67cc49e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,11 +10,12 @@ SET(VERSION_MAJOR 0) SET(VERSION "${VERSION_MAJOR}.1.0") SET(INC_DIR include) +SET(DOC_DIR doc) INCLUDE_DIRECTORIES(${INC_DIR}) -SET(requires "dlog capi-base-common download-provider-interface") +SET(requires "dlog capi-base-common capi-appfw-application download-provider-interface") MESSAGE(STATUS "PACKAGES : ${requires}") -SET(pc_requires "capi-base-common bundle") +SET(pc_requires "capi-base-common capi-appfw-application") INCLUDE(FindPkgConfig) pkg_check_modules(${fw_name} REQUIRED ${requires}) @@ -45,7 +46,7 @@ SET_TARGET_PROPERTIES(${fw_name} PROPERTIES SOVERSION ${VERSION_MAJOR}) INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR}) INSTALL(FILES ${INC_DIR}/download.h DESTINATION include/web/) -INSTALL(FILES ${INC_DIR}/download_doc.h DESTINATION include/web/) +INSTALL(FILES ${DOC_DIR}/download_doc.h DESTINATION include/web/) SET(PC_NAME ${fw_name}) SET(PC_REQUIRED ${pc_requires}) diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100644 index 0000000..b8d2ea9 --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,8 @@ +# Customize below path information +TET_INSTALL_PATH=/home/warmtree/git_private/DTS/TETware +TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target + +export ARCH=target +export TET_ROOT=$TET_TARGET_PATH +export PATH=$TET_ROOT/bin:$PATH +export LD_LIBRARY_PATH=$TET_ROOT/lib/tet3:$LD_LIBRARY_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100644 index 0000000..b48c54b --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,8 @@ +# Customize below path information +TET_INSTALL_PATH=/mnt/dts/TETware +TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target + +export ARCH=target +export TET_ROOT=$TET_TARGET_PATH +export PATH=$TET_ROOT/bin:$PATH +export LD_LIBRARY_PATH=$TET_ROOT/lib/tet3:$LD_LIBRARY_PATH diff --git a/TC/build.sh b/TC/build.sh new file mode 100644 index 0000000..72aad6c --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh new file mode 100644 index 0000000..29743e0 --- /dev/null +++ b/TC/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +RESULT_DIR=results + +tcc -c -p ./ # executing tcc, with clean option (-c) +rm -r $RESULT_DIR +rm -r tet_tmp_dir +rm testcase/tet_captured diff --git a/TC/config b/TC/config new file mode 100644 index 0000000..f3e2091 --- /dev/null +++ b/TC/config @@ -0,0 +1,3 @@ +PKG_NAME=capi-web-url-download +TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TC/TETware +TET_INSTALL_TARGET_PATH=/opt/home/$PKG_NAME/TETware diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100644 index 0000000..a4f6095 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. ./_export_target_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile new file mode 100644 index 0000000..97e14c4 --- /dev/null +++ b/TC/testcase/Makefile @@ -0,0 +1,27 @@ +include ../config + +CC ?= gcc + +C_FILES = $(shell ls *.c) + +PKGS = $(PKG_NAME) +PKGS += glib-2.0 +PKGS += gobject-2.0 +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +TCS := $(shell ls -1 *.c | cut -d. -f1) + +all: $(TCS) + +%: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist new file mode 100644 index 0000000..1fc0d45 --- /dev/null +++ b/TC/testcase/tslist @@ -0,0 +1,84 @@ +/testcase/utc_download_set_auto_download_negative +/testcase/utc_download_set_auto_download_positive +/testcase/utc_download_get_auto_download_negative +/testcase/utc_download_get_auto_download_positive +/testcase/utc_download_get_http_header_field_list_negative +/testcase/utc_download_get_http_header_field_list_positive +/testcase/utc_download_get_mime_type_negative +/testcase/utc_download_get_mime_type_positive +/testcase/utc_download_get_downloaded_file_path_negative +/testcase/utc_download_get_downloaded_file_path_positive +/testcase/utc_download_get_file_name_negative +/testcase/utc_download_get_file_name_positive +/testcase/utc_download_set_file_name_negative +/testcase/utc_download_set_file_name_positive +/testcase/utc_download_get_temp_path_negative +/testcase/utc_download_get_temp_path_positive +/testcase/utc_download_get_content_name_negative +/testcase/utc_download_get_content_name_positive +/testcase/utc_download_get_content_size_negative +/testcase/utc_download_get_content_size_positive +/testcase/utc_download_get_error_negative +/testcase/utc_download_get_error_positive +/testcase/utc_download_get_http_status_negative +/testcase/utc_download_get_http_status_positive +/testcase/utc_download_set_network_type_negative +/testcase/utc_download_set_network_type_positive +/testcase/utc_download_get_network_type_negative +/testcase/utc_download_get_network_type_positive +/testcase/utc_download_set_network_bonding_negative +/testcase/utc_download_set_network_bonding_positive +/testcase/utc_download_get_network_bonding_negative +/testcase/utc_download_get_network_bonding_positive +/testcase/utc_download_start_negative +/testcase/utc_download_start_positive +/testcase/utc_download_create_negative +/testcase/utc_download_create_positive +/testcase/utc_download_destroy_negative +/testcase/utc_download_destroy_positive +/testcase/utc_download_add_http_header_field_negative +/testcase/utc_download_add_http_header_field_positive +/testcase/utc_download_get_destination_negative +/testcase/utc_download_get_destination_positive +/testcase/utc_download_get_http_header_field_negative +/testcase/utc_download_get_http_header_field_positive +/testcase/utc_download_get_state_negative +/testcase/utc_download_get_state_positive +/testcase/utc_download_get_url_negative +/testcase/utc_download_get_url_positive +/testcase/utc_download_pause_negative +/testcase/utc_download_pause_positive +/testcase/utc_download_remove_http_header_field_negative +/testcase/utc_download_remove_http_header_field_positive +/testcase/utc_download_set_destination_negative +/testcase/utc_download_set_destination_positive +/testcase/utc_download_set_url_negative +/testcase/utc_download_set_url_positive +/testcase/utc_download_set_notification_title_negative +/testcase/utc_download_set_notification_title_positive +/testcase/utc_download_get_notification_title_negative +/testcase/utc_download_get_notification_title_positive +/testcase/utc_download_set_notification_description_negative +/testcase/utc_download_set_notification_description_positive +/testcase/utc_download_get_notification_description_negative +/testcase/utc_download_get_notification_description_positive +/testcase/utc_download_set_notification_type_negative +/testcase/utc_download_set_notification_type_positive +/testcase/utc_download_get_notification_type_negative +/testcase/utc_download_get_notification_type_positive +/testcase/utc_download_set_notification_bundle_negative +/testcase/utc_download_set_notification_bundle_positive +/testcase/utc_download_get_notification_bundle_negative +/testcase/utc_download_get_notification_bundle_positive +/testcase/utc_download_set_state_changed_cb_negative +/testcase/utc_download_set_state_changed_cb_positive +/testcase/utc_download_set_progress_cb_negative +/testcase/utc_download_set_progress_cb_positive +/testcase/utc_download_unset_state_changed_cb_negative +/testcase/utc_download_unset_state_changed_cb_positive +/testcase/utc_download_unset_progress_cb_negative +/testcase/utc_download_unset_progress_cb_positive +/testcase/utc_download_get_etag_positive +/testcase/utc_download_get_etag_negative +/testcase/utc_download_set_temp_file_path_negative +/testcase/utc_download_set_temp_file_path_positive diff --git a/TC/testcase/utc_download_add_http_header_field_negative.c b/TC/testcase/utc_download_add_http_header_field_negative.c new file mode 100644 index 0000000..f854ba6 --- /dev/null +++ b/TC/testcase/utc_download_add_http_header_field_negative.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_add_http_header_field_negative1(void); +static void utc_download_add_http_header_field_negative2(void); +static void utc_download_add_http_header_field_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_add_http_header_field_negative1, 1}, + {utc_download_add_http_header_field_negative2, 2}, + {utc_download_add_http_header_field_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_add_http_header_field_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_add_http_header_field(-1, "field", "value"); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_add_http_header_field_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_add_http_header_field(id, NULL, "value"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_add_http_header_field_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_add_http_header_field(id, "field", NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_add_http_header_field_positive.c b/TC/testcase/utc_download_add_http_header_field_positive.c new file mode 100644 index 0000000..c9dbe58 --- /dev/null +++ b/TC/testcase/utc_download_add_http_header_field_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_add_http_header_field_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_add_http_header_field_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_add_http_header_field_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_add_http_header_field(id, "field", "value"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_create_negative.c b/TC/testcase/utc_download_create_negative.c new file mode 100644 index 0000000..16b34ad --- /dev/null +++ b/TC/testcase/utc_download_create_negative.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_create_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_create_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_create_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_create(NULL); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_create_positive.c b/TC/testcase/utc_download_create_positive.c new file mode 100644 index 0000000..6965efc --- /dev/null +++ b/TC/testcase/utc_download_create_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_create_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_create_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_create_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + retcode = download_create(&id); + + if (retcode == DOWNLOAD_ERROR_NONE) { + download_destroy(id); + dts_pass(TC_NAME, "retcode has no error"); + } + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_destroy_negative.c b/TC/testcase/utc_download_destroy_negative.c new file mode 100644 index 0000000..a7194ec --- /dev/null +++ b/TC/testcase/utc_download_destroy_negative.c @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_destroy_negative1(void); +struct tet_testlist tet_testlist[] = { + {utc_download_destroy_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_destroy_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + retcode = download_destroy(-1); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_destroy_positive.c b/TC/testcase/utc_download_destroy_positive.c new file mode 100644 index 0000000..166eedf --- /dev/null +++ b/TC/testcase/utc_download_destroy_positive.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_destroy_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_destroy_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_destroy_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + retcode = download_create(&id); + + if (retcode == DOWNLOAD_ERROR_NONE) + retcode = download_destroy(id); + else { + dts_fail(TC_NAME, "create failed"); + return; + } + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_get_auto_download_negative.c b/TC/testcase/utc_download_get_auto_download_negative.c new file mode 100644 index 0000000..4c033a2 --- /dev/null +++ b/TC/testcase/utc_download_get_auto_download_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_auto_download_negative1(void); +static void utc_download_get_auto_download_negative2(void); +static void utc_download_get_auto_download_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_auto_download_negative1, 1}, + {utc_download_get_auto_download_negative2, 2}, + {utc_download_get_auto_download_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_auto_download_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bool get_enable = false; + + retcode = download_get_auto_download(-1, &get_enable); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_auto_download_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_auto_download(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_auto_download_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_auto_download(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_auto_download_positive.c b/TC/testcase/utc_download_get_auto_download_positive.c new file mode 100644 index 0000000..d1823f5 --- /dev/null +++ b/TC/testcase/utc_download_get_auto_download_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_auto_download_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_auto_download_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_auto_download_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bool enable = true; + bool getenable = false; + int id = 0; + + download_create(&id); + download_set_auto_download(id, enable); + retcode = download_get_auto_download(id, &getenable); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && (enable == getenable)) + dts_pass(TC_NAME, "retcode has no error and the auto nofication status of set API is same as of get API "); + else + dts_fail(TC_NAME, "retcode has error or the auto notification status of set API is not same as of get API"); +} + diff --git a/TC/testcase/utc_download_get_content_name_negative.c b/TC/testcase/utc_download_get_content_name_negative.c new file mode 100644 index 0000000..c6f9717 --- /dev/null +++ b/TC/testcase/utc_download_get_content_name_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_content_name_negative1(void); +static void utc_download_get_content_name_negative2(void); +static void utc_download_get_content_name_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_content_name_negative1, 1}, + {utc_download_get_content_name_negative2, 2}, + {utc_download_get_content_name_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_content_name_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_content_name(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_content_name_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_content_name(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_content_name_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_content_name(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_content_name_positive.c b/TC/testcase/utc_download_get_content_name_positive.c new file mode 100644 index 0000000..9a850ea --- /dev/null +++ b/TC/testcase/utc_download_get_content_name_positive.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_content_name_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_content_name_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +#define TEST_URL "http://static.campaign.naver.com/0/hangeul/2011/img/img_family.gif" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_DOWNLOADING) + g_main_loop_quit(gloop); + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); +} + +static void cleanup(void) +{ + g_main_loop_unref(gloop); + gloop = NULL; +} + +void utc_download_get_content_name_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_get_content_name(id, &output); + + download_unset_state_changed_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && output) + dts_pass(TC_NAME, "retcode has no error and content exists"); + else + dts_fail(TC_NAME, "retcode has error or content does not exists"); +} + diff --git a/TC/testcase/utc_download_get_content_size_negative.c b/TC/testcase/utc_download_get_content_size_negative.c new file mode 100644 index 0000000..8e8ba46 --- /dev/null +++ b/TC/testcase/utc_download_get_content_size_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_content_size_negative1(void); +static void utc_download_get_content_size_negative2(void); +static void utc_download_get_content_size_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_content_size_negative1, 1}, + {utc_download_get_content_size_negative2, 2}, + {utc_download_get_content_size_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_content_size_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + unsigned long long output = 0; + + retcode = download_get_content_size(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_content_size_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_content_size(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_content_size_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_content_size(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_content_size_positive.c b/TC/testcase/utc_download_get_content_size_positive.c new file mode 100644 index 0000000..b0cdd1e --- /dev/null +++ b/TC/testcase/utc_download_get_content_size_positive.c @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_content_size_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_content_size_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +#define TEST_URL "http://static.campaign.naver.com/0/hangeul/2011/img/img_family.gif" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_DOWNLOADING) + g_main_loop_quit(gloop); + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); +} + +static void cleanup(void) +{ + g_main_loop_unref(gloop); + gloop = NULL; +} + +void utc_download_get_content_size_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + unsigned long long output = 0; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_get_content_size(id, &output); + if ( retcode != DOWNLOAD_ERROR_NONE ) + dts_message(TC_NAME,"Fail to get content name"); + + retcode = download_unset_state_changed_cb(id); + if ( retcode != DOWNLOAD_ERROR_NONE ) + dts_message(TC_NAME,"Fail to unset callback"); + + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && (output > 0)) + dts_pass(TC_NAME, "retcode has no error and size is valid"); + else + dts_fail(TC_NAME, "retcode has error or size not valid"); +} + diff --git a/TC/testcase/utc_download_get_destination_negative.c b/TC/testcase/utc_download_get_destination_negative.c new file mode 100644 index 0000000..28b28dc --- /dev/null +++ b/TC/testcase/utc_download_get_destination_negative.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_destination_negative1(void); +static void utc_download_get_destination_negative2(void); +static void utc_download_get_destination_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_destination_negative1, 1}, + {utc_download_get_destination_negative2, 2}, + {utc_download_get_destination_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_destination_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_destination(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_destination_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *input = "URL"; + int id = 0; + + download_create(&id); + download_set_destination(id, input); + retcode = download_get_destination(id, NULL); + + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_destination_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_destination(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_destination_positive.c b/TC/testcase/utc_download_get_destination_positive.c new file mode 100644 index 0000000..52f4b88 --- /dev/null +++ b/TC/testcase/utc_download_get_destination_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_destination_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_destination_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_destination_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *input = "/opt/usr/media/Downloads"; + char *output = NULL; + int id = 0; + + download_create(&id); + download_set_destination(id, input); + retcode = download_get_destination(id, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(input, output)) + dts_pass(TC_NAME, "retcode has no error and the destination of set API is same to destination of get API "); + else + dts_fail(TC_NAME, "retcode has error or the destination of set API is not same to destination of get API"); +} + diff --git a/TC/testcase/utc_download_get_downloaded_file_path_negative.c b/TC/testcase/utc_download_get_downloaded_file_path_negative.c new file mode 100644 index 0000000..c2151da --- /dev/null +++ b/TC/testcase/utc_download_get_downloaded_file_path_negative.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_downloaded_file_path_negative1(void); +static void utc_download_get_downloaded_file_path_negative2(void); +static void utc_download_get_downloaded_file_path_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_downloaded_file_path_negative1, 1}, + {utc_download_get_downloaded_file_path_negative2, 2}, + {utc_download_get_downloaded_file_path_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_downloaded_file_path_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_downloaded_file_path(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_downloaded_file_path_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_downloaded_file_path(id, NULL); + + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_downloaded_file_path_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_downloaded_file_path(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_downloaded_file_path_positive.c b/TC/testcase/utc_download_get_downloaded_file_path_positive.c new file mode 100644 index 0000000..b510776 --- /dev/null +++ b/TC/testcase/utc_download_get_downloaded_file_path_positive.c @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_downloaded_file_path_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_downloaded_file_path_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +#define TEST_URL "http://static.campaign.naver.com/0/hangeul/2011/img/img_family.gif" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_COMPLETED) + g_main_loop_quit(gloop); + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); +} + +static void cleanup(void) +{ + g_main_loop_unref(gloop); + gloop = NULL; +} + + +void utc_download_get_downloaded_file_path_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_get_downloaded_file_path(id, &output); + if ( retcode != DOWNLOAD_ERROR_NONE ) + dts_message(TC_NAME,"Fail to get content name"); + + download_unset_state_changed_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_get_error_negative.c b/TC/testcase/utc_download_get_error_negative.c new file mode 100644 index 0000000..90ef410 --- /dev/null +++ b/TC/testcase/utc_download_get_error_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_error_negative1(void); +static void utc_download_get_error_negative2(void); +static void utc_download_get_error_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_error_negative1, 1}, + {utc_download_get_error_negative2, 2}, + {utc_download_get_error_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_error_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + + retcode = download_get_error(-1, &err); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_error_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_error(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_error_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_error(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_error_positive.c b/TC/testcase/utc_download_get_error_positive.c new file mode 100644 index 0000000..39064d0 --- /dev/null +++ b/TC/testcase/utc_download_get_error_positive.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_error_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_error_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_error_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + int id = 0; + + download_create(&id); + retcode = download_get_error(id, &err); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error and temp path exists"); + else + dts_fail(TC_NAME, "retcode has error or temp path does not exists"); +} + diff --git a/TC/testcase/utc_download_get_etag_negative.c b/TC/testcase/utc_download_get_etag_negative.c new file mode 100644 index 0000000..510ff32 --- /dev/null +++ b/TC/testcase/utc_download_get_etag_negative.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_etag_negative1(void); +static void utc_download_get_etag_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_etag_negative1, 1}, + {utc_download_get_etag_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_etag_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *etag = NULL; + + retcode = download_get_etag(-1,&etag); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_etag_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_etag(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_etag_positive.c b/TC/testcase/utc_download_get_etag_positive.c new file mode 100644 index 0000000..5f70d41 --- /dev/null +++ b/TC/testcase/utc_download_get_etag_positive.c @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_etag_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_etag_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +#define TEST_URL "http://download.tizen.org/sdk/InstallManager/tizen-sdk-2.2.1/tizen-sdk-ubuntu32-v2.2.71.bin" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_DOWNLOADING) + g_main_loop_quit(gloop); + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); +} + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); +} + +static void cleanup(void) +{ + g_main_loop_unref(gloop); + gloop = NULL; + /* end of TC */ +} + +void utc_download_get_etag_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *etag = NULL; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_get_etag(id, &etag); + download_cancel(id); + download_unset_state_changed_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_get_file_name_negative.c b/TC/testcase/utc_download_get_file_name_negative.c new file mode 100644 index 0000000..cfe4011 --- /dev/null +++ b/TC/testcase/utc_download_get_file_name_negative.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_file_name_negative1(void); +static void utc_download_get_file_name_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_file_name_negative1, 1}, + {utc_download_get_file_name_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_file_name_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *file_name = NULL; + + retcode = download_get_file_name(-1,&file_name); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_file_name_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_file_name(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_file_name_positive.c b/TC/testcase/utc_download_get_file_name_positive.c new file mode 100644 index 0000000..085872e --- /dev/null +++ b/TC/testcase/utc_download_get_file_name_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_file_name_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_file_name_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_file_name_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *file_name1 = "file"; + char *file_name2 = NULL; + int id = 0; + + download_create(&id); + download_set_file_name(id, file_name1); + retcode = download_get_file_name(id, &file_name2); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(file_name1,file_name2)) + dts_pass(TC_NAME, "retcode has no error and file name of set API is same as file name of get API"); + else + dts_fail(TC_NAME, "retcode has error or file_name of set API and get API are not same"); +} + diff --git a/TC/testcase/utc_download_get_http_header_field_list_negative.c b/TC/testcase/utc_download_get_http_header_field_list_negative.c new file mode 100644 index 0000000..ed45176 --- /dev/null +++ b/TC/testcase/utc_download_get_http_header_field_list_negative.c @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_http_header_field_list_negative1(void); +static void utc_download_get_http_header_field_list_negative2(void); +static void utc_download_get_http_header_field_list_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_http_header_field_list_negative1, 1}, + {utc_download_get_http_header_field_list_negative2, 2}, + {utc_download_get_http_header_field_list_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_http_header_field_list_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + int length=0; + + download_create(&id); + download_add_http_header_field(id, "field1","value1"); + retcode = download_get_http_header_field_list(id, NULL, &length); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_http_header_field_list_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + char **fields = NULL; + + download_create(&id); + download_add_http_header_field(id, "field1","value1"); + retcode = download_get_http_header_field_list(id, &fields, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_http_header_field_list_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char **fields = NULL; + int length = 0; + int id = 0; + + download_create(&id); + download_add_http_header_field(id, "field1","value1"); + retcode = download_get_http_header_field_list(-1, &fields, &length); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_http_header_field_list_positive.c b/TC/testcase/utc_download_get_http_header_field_list_positive.c new file mode 100644 index 0000000..763d5c4 --- /dev/null +++ b/TC/testcase/utc_download_get_http_header_field_list_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_http_header_field_list_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_http_header_field_list_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_http_header_field_list_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char **fields = NULL; + int length = 0; + int id = 0; + + download_create(&id); + download_add_http_header_field(id, "field1","value1"); + download_add_http_header_field(id, "field2","value2"); + retcode =download_get_http_header_field_list(id, &fields,&length); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} diff --git a/TC/testcase/utc_download_get_http_header_field_negative.c b/TC/testcase/utc_download_get_http_header_field_negative.c new file mode 100644 index 0000000..fd39560 --- /dev/null +++ b/TC/testcase/utc_download_get_http_header_field_negative.c @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_http_header_field_negative1(void); +static void utc_download_get_http_header_field_negative2(void); +static void utc_download_get_http_header_field_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_http_header_field_negative1, 1}, + {utc_download_get_http_header_field_negative2, 2}, + {utc_download_get_http_header_field_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_http_header_field_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *field = "field"; + char *input = "input"; + char *output = NULL; + int id = 0; + + download_create(&id); + download_add_http_header_field(id, field, input); + retcode = download_get_http_header_field(id, NULL, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_http_header_field_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *field = "field"; + char *input = "input"; + int id = 0; + + download_create(&id); + download_add_http_header_field(id, field, input); + retcode = download_get_http_header_field(id, field, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_http_header_field_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *field = "field"; + char *input = "input"; + char *output = NULL; + int id = 0; + + download_create(&id); + download_add_http_header_field(id, field, input); + retcode = download_get_http_header_field(-1, field, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_http_header_field_positive.c b/TC/testcase/utc_download_get_http_header_field_positive.c new file mode 100644 index 0000000..1b46816 --- /dev/null +++ b/TC/testcase/utc_download_get_http_header_field_positive.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_http_header_field_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_http_header_field_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_http_header_field_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *field = "field"; + char *input = "input"; + char *output = NULL; + int id = 0; + + download_create(&id); + download_add_http_header_field(id, field, input); + retcode = download_get_http_header_field(id, field, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(input, output)) + dts_pass(TC_NAME, "retcode has no error and the http header of set API is same to http header of get API "); + else + dts_fail(TC_NAME, "retcode has error or the http header of set API is not same to http header of get API"); +} + diff --git a/TC/testcase/utc_download_get_http_status_negative.c b/TC/testcase/utc_download_get_http_status_negative.c new file mode 100644 index 0000000..4ebb88e --- /dev/null +++ b/TC/testcase/utc_download_get_http_status_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_http_status_negative1(void); +static void utc_download_get_http_status_negative2(void); +static void utc_download_get_http_status_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_http_status_negative1, 1}, + {utc_download_get_http_status_negative2, 2}, + {utc_download_get_http_status_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_http_status_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int status = 0; + + retcode = download_get_http_status(-1, &status); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_http_status_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_http_status(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_http_status_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_http_status(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_http_status_positive.c b/TC/testcase/utc_download_get_http_status_positive.c new file mode 100644 index 0000000..cccde62 --- /dev/null +++ b/TC/testcase/utc_download_get_http_status_positive.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_http_status_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_http_status_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +#define TEST_URL "http://static.campaign.naver.com/0/hangeul/2011/img/img_family.gif" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_DOWNLOADING) + g_main_loop_quit(gloop); + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); +} + +static void cleanup(void) +{ + g_main_loop_unref(gloop); + gloop = NULL; +} + +void utc_download_get_http_status_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int status = 0; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_get_http_status(id, &status); + + download_unset_state_changed_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_get_mime_type_negative.c b/TC/testcase/utc_download_get_mime_type_negative.c new file mode 100644 index 0000000..77e3059 --- /dev/null +++ b/TC/testcase/utc_download_get_mime_type_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_mime_type_negative1(void); +static void utc_download_get_mime_type_negative2(void); +static void utc_download_get_mime_type_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_mime_type_negative1, 1}, + {utc_download_get_mime_type_negative2, 2}, + {utc_download_get_mime_type_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_mime_type_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_mime_type(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_mime_type_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_mime_type(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_mime_type_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_mime_type(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_mime_type_positive.c b/TC/testcase/utc_download_get_mime_type_positive.c new file mode 100644 index 0000000..5cebbfc --- /dev/null +++ b/TC/testcase/utc_download_get_mime_type_positive.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_mime_type_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_mime_type_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +#define TEST_URL "http://static.campaign.naver.com/0/hangeul/2011/img/img_family.gif" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_DOWNLOADING) + g_main_loop_quit(gloop); + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); +} + +static void cleanup(void) +{ + g_main_loop_unref(gloop); + gloop = NULL; +} + +void utc_download_get_mime_type_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_get_mime_type(id, &output); + if ( retcode != DOWNLOAD_ERROR_NONE ) + dts_message(TC_NAME,"Fail to get content name"); + + download_unset_state_changed_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_get_network_bonding_negative.c b/TC/testcase/utc_download_get_network_bonding_negative.c new file mode 100644 index 0000000..90c0802 --- /dev/null +++ b/TC/testcase/utc_download_get_network_bonding_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_network_bonding_negative1(void); +static void utc_download_get_network_bonding_negative2(void); +static void utc_download_get_network_bonding_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_network_bonding_negative1, 1}, + {utc_download_get_network_bonding_negative2, 2}, + {utc_download_get_network_bonding_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_network_bonding_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bool get_enable = false; + + retcode = download_get_network_bonding(-1, &get_enable); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_network_bonding_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_network_bonding(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_network_bonding_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_network_bonding(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_network_bonding_positive.c b/TC/testcase/utc_download_get_network_bonding_positive.c new file mode 100644 index 0000000..3084072 --- /dev/null +++ b/TC/testcase/utc_download_get_network_bonding_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_network_bonding_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_network_bonding_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_network_bonding_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bool enable = true; + bool getenable = false; + int id = 0; + + download_create(&id); + download_set_network_bonding(id, enable); + retcode = download_get_network_bonding(id, &getenable); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && (enable == getenable)) + dts_pass(TC_NAME, "retcode has no error and the network bonding status of set API is same as of get API "); + else + dts_fail(TC_NAME, "retcode has error or the network bonding status of set API is not same as of get API"); +} + diff --git a/TC/testcase/utc_download_get_network_type_negative.c b/TC/testcase/utc_download_get_network_type_negative.c new file mode 100644 index 0000000..97874dc --- /dev/null +++ b/TC/testcase/utc_download_get_network_type_negative.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_network_type_negative1(void); +static void utc_download_get_network_type_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_network_type_negative1, 1}, + {utc_download_get_network_type_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_network_type_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_network_type_e type = DOWNLOAD_NETWORK_DATA_NETWORK; + + retcode = download_get_network_type(-1, &type); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_network_type_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_network_type(id, NULL); + download_destroy(id); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has error"); + else + dts_fail(TC_NAME, "retcode does not have error"); +} + diff --git a/TC/testcase/utc_download_get_network_type_positive.c b/TC/testcase/utc_download_get_network_type_positive.c new file mode 100644 index 0000000..517233d --- /dev/null +++ b/TC/testcase/utc_download_get_network_type_positive.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_network_type_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_network_type_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_network_type_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_network_type_e output; + int id = 0; + + download_create(&id); + download_set_network_type(id, DOWNLOAD_NETWORK_DATA_NETWORK); + retcode = download_get_network_type(id, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && (output == DOWNLOAD_NETWORK_DATA_NETWORK)) + dts_pass(TC_NAME, "retcode has no error and the type of set API is same to type of get API "); + else + dts_fail(TC_NAME, "retcode has error or the type of set API is not same to type of get API"); +} + diff --git a/TC/testcase/utc_download_get_notification_bundle_negative.c b/TC/testcase/utc_download_get_notification_bundle_negative.c new file mode 100644 index 0000000..0524418 --- /dev/null +++ b/TC/testcase/utc_download_get_notification_bundle_negative.c @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_bundle_negative1(void); +static void utc_download_get_notification_bundle_negative2(void); +static void utc_download_get_notification_bundle_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_bundle_negative1, 1}, + {utc_download_get_notification_bundle_negative2, 2}, + {utc_download_get_notification_bundle_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_bundle_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bundle *b = NULL; + + retcode = download_get_notification_bundle(-1, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, &b); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_notification_bundle_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_notification_bundle_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + bundle *b = NULL; + + download_create(&id); + retcode = download_get_notification_bundle(id, 4, &b); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has error"); + else + dts_fail(TC_NAME, "retcode does not have error"); +} + diff --git a/TC/testcase/utc_download_get_notification_bundle_positive.c b/TC/testcase/utc_download_get_notification_bundle_positive.c new file mode 100644 index 0000000..a3b41b6 --- /dev/null +++ b/TC/testcase/utc_download_get_notification_bundle_positive.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_bundle_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_bundle_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_bundle_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *input = "ongoing"; + char *output = NULL; + int id = 0; + bundle *b = bundle_create(); + bundle *b_db = NULL; + bundle_add(b, "key", input); + + download_create(&id); + download_set_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, b); + retcode = download_get_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, &b_db); + output = bundle_get_val(b_db, "key"); + download_destroy(id); + if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(input, output)) + dts_pass(TC_NAME, "retcode has no error and the bundle of set API is same to bundle of get API "); + else + dts_fail(TC_NAME, "retcode has error or the bundle of set API is not same to bundle of get API"); + bundle_free(b); + bundle_free(b_db); +} + diff --git a/TC/testcase/utc_download_get_notification_description_negative.c b/TC/testcase/utc_download_get_notification_description_negative.c new file mode 100644 index 0000000..c4f566a --- /dev/null +++ b/TC/testcase/utc_download_get_notification_description_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_description_negative1(void); +static void utc_download_get_notification_description_negative2(void); +static void utc_download_get_notification_description_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_description_negative1, 1}, + {utc_download_get_notification_description_negative2, 2}, + {utc_download_get_notification_description_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_description_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_notification_description(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_notification_description_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_notification_description(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_notification_description_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_notification_description(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_notification_description_positive.c b/TC/testcase/utc_download_get_notification_description_positive.c new file mode 100644 index 0000000..c1f34ba --- /dev/null +++ b/TC/testcase/utc_download_get_notification_description_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_description_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_description_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_description_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *input = "description"; + char *output = NULL; + int id = 0; + + download_create(&id); + download_set_notification_description(id, input); + retcode = download_get_notification_description(id, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(input, output)) + dts_pass(TC_NAME, "retcode has no error and the description of set API is same to description of get API "); + else + dts_fail(TC_NAME, "retcode has error or the description of set API is not same to description of get API"); +} + diff --git a/TC/testcase/utc_download_get_notification_title_negative.c b/TC/testcase/utc_download_get_notification_title_negative.c new file mode 100644 index 0000000..e5c7a41 --- /dev/null +++ b/TC/testcase/utc_download_get_notification_title_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_title_negative1(void); +static void utc_download_get_notification_title_negative2(void); +static void utc_download_get_notification_title_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_title_negative1, 1}, + {utc_download_get_notification_title_negative2, 2}, + {utc_download_get_notification_title_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_title_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_notification_title(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_notification_title_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_notification_title(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_notification_title_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_notification_title(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_notification_title_positive.c b/TC/testcase/utc_download_get_notification_title_positive.c new file mode 100644 index 0000000..8dd15ce --- /dev/null +++ b/TC/testcase/utc_download_get_notification_title_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_title_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_title_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_title_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *input = "title"; + char *output = NULL; + int id = 0; + + download_create(&id); + download_set_notification_title(id, input); + retcode = download_get_notification_title(id, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(input, output)) + dts_pass(TC_NAME, "retcode has no error and the title of set API is same to title of get API "); + else + dts_fail(TC_NAME, "retcode has error or the title of set API is not same to title of get API"); +} + diff --git a/TC/testcase/utc_download_get_notification_type_negative.c b/TC/testcase/utc_download_get_notification_type_negative.c new file mode 100644 index 0000000..470fc0e --- /dev/null +++ b/TC/testcase/utc_download_get_notification_type_negative.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_type_negative1(void); +static void utc_download_get_notification_type_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_type_negative1, 1}, + {utc_download_get_notification_type_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_type_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_notification_type_e *type = NULL; + + retcode = download_get_notification_type(-1, &type); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_notification_type_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_notification_type(id, NULL); + download_destroy(id); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has error"); + else + dts_fail(TC_NAME, "retcode does not have error"); +} diff --git a/TC/testcase/utc_download_get_notification_type_positive.c b/TC/testcase/utc_download_get_notification_type_positive.c new file mode 100644 index 0000000..8522edf --- /dev/null +++ b/TC/testcase/utc_download_get_notification_type_positive.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_notification_type_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_notification_type_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_notification_type_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_notification_type_e output; + int id = 0; + + download_create(&id); + download_set_notification_type(id, DOWNLOAD_NOTIFICATION_TYPE_NONE); + retcode = download_get_notification_type(id, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && (output == DOWNLOAD_NOTIFICATION_TYPE_NONE)) + dts_pass(TC_NAME, "retcode has no error and the type of set API is same to type of get API "); + else + dts_fail(TC_NAME, "retcode has error or the type of set API is not same to type of get API"); +} + diff --git a/TC/testcase/utc_download_get_state_negative.c b/TC/testcase/utc_download_get_state_negative.c new file mode 100644 index 0000000..dfbc8f7 --- /dev/null +++ b/TC/testcase/utc_download_get_state_negative.c @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_state_negative1(void); +static void utc_download_get_state_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_state_negative1, 1}, + {utc_download_get_state_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void utc_download_get_state_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_state_e state = 0; + + retcode = download_get_state(-1, &state); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +static void utc_download_get_state_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_state(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_state_positive.c b/TC/testcase/utc_download_get_state_positive.c new file mode 100644 index 0000000..d6351d3 --- /dev/null +++ b/TC/testcase/utc_download_get_state_positive.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_state_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_state_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void utc_download_get_state_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + download_state_e state = 0; + + download_create(&id); + retcode = download_get_state(id, &state); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && state == DOWNLOAD_STATE_READY) + dts_pass(TC_NAME, "retcode has no error and the url of set API is same to url of get API"); + else + dts_fail(TC_NAME, "retcode has error or the url of set API is not same to url of get API"); +} + diff --git a/TC/testcase/utc_download_get_temp_path_negative.c b/TC/testcase/utc_download_get_temp_path_negative.c new file mode 100644 index 0000000..7a3eadb --- /dev/null +++ b/TC/testcase/utc_download_get_temp_path_negative.c @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_temp_path_negative1(void); +static void utc_download_get_temp_path_negative2(void); +static void utc_download_get_temp_path_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_temp_path_negative1, 1}, + {utc_download_get_temp_path_negative2, 2}, + {utc_download_get_temp_path_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_temp_path_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_temp_path(-1, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_temp_path_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_get_temp_path(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_temp_path_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_temp_path(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_temp_path_positive.c b/TC/testcase/utc_download_get_temp_path_positive.c new file mode 100644 index 0000000..394975d --- /dev/null +++ b/TC/testcase/utc_download_get_temp_path_positive.c @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_temp_path_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_temp_path_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +#define TEST_URL "http://static.campaign.naver.com/0/hangeul/2011/img/img_family.gif" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_DOWNLOADING) + g_main_loop_quit(gloop); + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); +} + +static void cleanup(void) +{ + g_main_loop_unref(gloop); + gloop = NULL; +} + + +void utc_download_get_temp_path_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_get_temp_path(id, &output); + + download_unset_state_changed_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_get_url_negative.c b/TC/testcase/utc_download_get_url_negative.c new file mode 100644 index 0000000..4f1575a --- /dev/null +++ b/TC/testcase/utc_download_get_url_negative.c @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_url_negative1(void); +static void utc_download_get_url_negative2(void); +static void utc_download_get_url_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_url_negative1, 1}, + {utc_download_get_url_negative2, 2}, + {utc_download_get_url_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_url_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *output = NULL; + + retcode = download_get_url(NULL, &output); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_url_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *input = "URL"; + int id = 0; + + download_create(&id); + download_set_url(id, input); + retcode = download_get_url(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_get_url_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_get_url(NULL, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_get_url_positive.c b/TC/testcase/utc_download_get_url_positive.c new file mode 100644 index 0000000..d46fffe --- /dev/null +++ b/TC/testcase/utc_download_get_url_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_get_url_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_get_url_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_get_url_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *input = "URL"; + char *output = NULL; + int id = 0; + + download_create(&id); + download_set_url(id, input); + retcode = download_get_url(id, &output); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(input, output)) + dts_pass(TC_NAME, "retcode has no error and the url of set API is same to url of get API "); + else + dts_fail(TC_NAME, "retcode has error or the url of set API is not same to url of get API"); +} + diff --git a/TC/testcase/utc_download_pause_negative.c b/TC/testcase/utc_download_pause_negative.c new file mode 100644 index 0000000..9ce109b --- /dev/null +++ b/TC/testcase/utc_download_pause_negative.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_pause_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_pause_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void utc_download_pause_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_pause(-1); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_pause_positive.c b/TC/testcase/utc_download_pause_positive.c new file mode 100644 index 0000000..ce918e3 --- /dev/null +++ b/TC/testcase/utc_download_pause_positive.c @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_pause_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_pause_positive1, 1}, + {NULL, 0}, +}; + +static GMainLoop* gloop = NULL; +static int is_pause_success = false; +static int is_started = false; + +#define TEST_URL "http://cdn.naver.com/naver/NanumFont/setup/NanumFontSetup_TTF_GOTHIC_hangeulcamp.exe" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_COMPLETED) + g_main_loop_quit(gloop); + else if(state == DOWNLOAD_STATE_PAUSED) { + is_pause_success = true; + g_main_loop_quit(gloop); + } else if(state == DOWNLOAD_STATE_DOWNLOADING) + is_started = true; + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); + is_pause_success = true; +} + +static void cleanup(void) +{ + is_pause_success = false; + g_main_loop_unref(gloop); + gloop = NULL; +} + +static void utc_download_pause_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_message(TC_NAME,"Fail to start download"); + is_started = false; + } + + if (is_started) { + sleep(1); + retcode = download_pause(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + else { + dts_message(TC_NAME,"Fail to pause download"); + is_pause_success = false; + } + } + + retcode = download_unset_state_changed_cb(id); + if ( retcode != DOWNLOAD_ERROR_NONE ) + dts_message(TC_NAME,"Fail to unset callback"); + + download_destroy(id); + + if (is_pause_success) + dts_pass(TC_NAME, "It is success to pause download content"); + else + dts_fail(TC_NAME, "It is not success to pause download content"); +} + diff --git a/TC/testcase/utc_download_remove_http_header_field_negative.c b/TC/testcase/utc_download_remove_http_header_field_negative.c new file mode 100644 index 0000000..e85c021 --- /dev/null +++ b/TC/testcase/utc_download_remove_http_header_field_negative.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_remove_http_header_field_negative1(void); +static void utc_download_remove_http_header_field_negative2(void); +static void utc_download_remove_http_header_field_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_remove_http_header_field_negative1, 1}, + {utc_download_remove_http_header_field_negative2, 2}, + {utc_download_remove_http_header_field_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_remove_http_header_field_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *field = "negativefield1"; + int id = 0; + + download_create(&id); + retcode = download_remove_http_header_field(id, field); + download_destroy(id); + + dts_message(TC_NAME, "retcode[%d]",retcode); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has error about no found field"); + else + dts_fail(TC_NAME, "retcode does not have error about no found field"); +} + +void utc_download_remove_http_header_field_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *field = "negativefield2"; + int id = 0; + + download_create(&id); + retcode = download_remove_http_header_field(-1, field); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_remove_http_header_field_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_remove_http_header_field(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + + diff --git a/TC/testcase/utc_download_remove_http_header_field_positive.c b/TC/testcase/utc_download_remove_http_header_field_positive.c new file mode 100644 index 0000000..8d5cd3e --- /dev/null +++ b/TC/testcase/utc_download_remove_http_header_field_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_remove_http_header_field_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_remove_http_header_field_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_remove_http_header_field_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + char *field = "field"; + char *input = "input"; + int id = 0; + + download_create(&id); + download_add_http_header_field(id, field, input); + retcode = download_remove_http_header_field(id, field); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_auto_download_negative.c b/TC/testcase/utc_download_set_auto_download_negative.c new file mode 100644 index 0000000..8e3358d --- /dev/null +++ b/TC/testcase/utc_download_set_auto_download_negative.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_auto_download_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_auto_download_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_auto_download_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bool enable = false; + + retcode = download_set_auto_download(-1,enable ); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_set_auto_download_positive.c b/TC/testcase/utc_download_set_auto_download_positive.c new file mode 100644 index 0000000..7b127c5 --- /dev/null +++ b/TC/testcase/utc_download_set_auto_download_positive.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_auto_download_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_auto_download_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_auto_download_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + bool enable = true; + + download_create(&id); + retcode = download_set_auto_download(id, enable); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_destination_negative.c b/TC/testcase/utc_download_set_destination_negative.c new file mode 100644 index 0000000..71c9761 --- /dev/null +++ b/TC/testcase/utc_download_set_destination_negative.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_destination_negative1(void); +static void utc_download_set_destination_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_destination_negative1, 1}, + {utc_download_set_destination_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_destination_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_destination(-1, "destination"); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_destination_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_destination(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_set_destination_positive.c b/TC/testcase/utc_download_set_destination_positive.c new file mode 100644 index 0000000..d84d47f --- /dev/null +++ b/TC/testcase/utc_download_set_destination_positive.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_destination_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_destination_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_destination_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_destination(id, "/opt/usr/media/Downloads"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} diff --git a/TC/testcase/utc_download_set_file_name_negative.c b/TC/testcase/utc_download_set_file_name_negative.c new file mode 100644 index 0000000..bdeaf76 --- /dev/null +++ b/TC/testcase/utc_download_set_file_name_negative.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_file_name_negative1(void); +static void utc_download_set_file_name_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_file_name_negative1, 1}, + {utc_download_set_file_name_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_file_name_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_file_name(-1, "file1"); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_file_name_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_file_name(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_set_file_name_positive.c b/TC/testcase/utc_download_set_file_name_positive.c new file mode 100644 index 0000000..556f5b3 --- /dev/null +++ b/TC/testcase/utc_download_set_file_name_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_file_name_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_file_name_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_file_name_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_file_name(id, "file1"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_network_bonding_negative.c b/TC/testcase/utc_download_set_network_bonding_negative.c new file mode 100644 index 0000000..66cc77d --- /dev/null +++ b/TC/testcase/utc_download_set_network_bonding_negative.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_network_bonding_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_network_bonding_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_network_bonding_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bool enable = false; + + retcode = download_set_network_bonding(-1,enable ); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_set_network_bonding_positive.c b/TC/testcase/utc_download_set_network_bonding_positive.c new file mode 100644 index 0000000..cadbef9 --- /dev/null +++ b/TC/testcase/utc_download_set_network_bonding_positive.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_network_bonding_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_network_bonding_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_network_bonding_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + bool enable = true; + + download_create(&id); + retcode = download_set_network_bonding(id, enable); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_network_type_negative.c b/TC/testcase/utc_download_set_network_type_negative.c new file mode 100644 index 0000000..677b159 --- /dev/null +++ b/TC/testcase/utc_download_set_network_type_negative.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_network_type_negative1(void); +static void utc_download_set_network_type_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_network_type_negative1, 1}, + {utc_download_set_network_type_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_network_type_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_network_type(-1, DOWNLOAD_NETWORK_DATA_NETWORK); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_network_type_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_network_type(id, 10); + download_destroy(id); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has error"); + else + dts_fail(TC_NAME, "retcode does not have error"); +} + diff --git a/TC/testcase/utc_download_set_network_type_positive.c b/TC/testcase/utc_download_set_network_type_positive.c new file mode 100644 index 0000000..f0df3f9 --- /dev/null +++ b/TC/testcase/utc_download_set_network_type_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_network_type_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_network_type_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_network_type_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_network_type(id, DOWNLOAD_NETWORK_DATA_NETWORK); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_notification_bundle_negative.c b/TC/testcase/utc_download_set_notification_bundle_negative.c new file mode 100644 index 0000000..bdba4dd --- /dev/null +++ b/TC/testcase/utc_download_set_notification_bundle_negative.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_bundle_negative1(void); +static void utc_download_set_notification_bundle_negative2(void); +static void utc_download_set_notification_bundle_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_bundle_negative1, 1}, + {utc_download_set_notification_bundle_negative2, 2}, + {utc_download_set_notification_bundle_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_bundle_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + bundle *b = bundle_create(); + + bundle_add(b, "key", "ongoing"); + retcode = download_set_notification_bundle(-1, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, b); + bundle_free(b); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_notification_bundle_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_notification_bundle_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + bundle *b = bundle_create(); + bundle_add(b, "key", "ongoing"); + + download_create(&id); + retcode = download_set_notification_bundle(id, 4, b); + download_destroy(id); + bundle_free(b); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} diff --git a/TC/testcase/utc_download_set_notification_bundle_positive.c b/TC/testcase/utc_download_set_notification_bundle_positive.c new file mode 100644 index 0000000..2d73537 --- /dev/null +++ b/TC/testcase/utc_download_set_notification_bundle_positive.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_bundle_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_bundle_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_bundle_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + bundle *b = bundle_create(); + bundle_add(b, "key", "ongoing"); + + download_create(&id); + retcode = download_set_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, b); + download_destroy(id); + bundle_free(b); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_notification_description_negative.c b/TC/testcase/utc_download_set_notification_description_negative.c new file mode 100644 index 0000000..fdf51df --- /dev/null +++ b/TC/testcase/utc_download_set_notification_description_negative.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_description_negative1(void); +static void utc_download_set_notification_description_negative2(void); +static void utc_download_set_notification_description_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_description_negative1, 1}, + {utc_download_set_notification_description_negative2, 2}, + {utc_download_set_notification_description_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_description_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_notification_description(-1, "description"); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_notification_description_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_description(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_notification_description_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_description(id, ""); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} diff --git a/TC/testcase/utc_download_set_notification_description_positive.c b/TC/testcase/utc_download_set_notification_description_positive.c new file mode 100644 index 0000000..890426e --- /dev/null +++ b/TC/testcase/utc_download_set_notification_description_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_description_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_description_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_description_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_title(id, "description"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_notification_title_negative.c b/TC/testcase/utc_download_set_notification_title_negative.c new file mode 100644 index 0000000..6f493c7 --- /dev/null +++ b/TC/testcase/utc_download_set_notification_title_negative.c @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_title_negative1(void); +static void utc_download_set_notification_title_negative2(void); +static void utc_download_set_notification_title_negative3(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_title_negative1, 1}, + {utc_download_set_notification_title_negative2, 2}, + {utc_download_set_notification_title_negative3, 3}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_title_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_notification_title(-1, "title"); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_notification_title_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_title(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_notification_title_negative3(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_title(id, ""); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} diff --git a/TC/testcase/utc_download_set_notification_title_positive.c b/TC/testcase/utc_download_set_notification_title_positive.c new file mode 100644 index 0000000..8996d9d --- /dev/null +++ b/TC/testcase/utc_download_set_notification_title_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_title_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_title_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_title_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_title(id, "title"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_notification_type_negative.c b/TC/testcase/utc_download_set_notification_type_negative.c new file mode 100644 index 0000000..6f57ec2 --- /dev/null +++ b/TC/testcase/utc_download_set_notification_type_negative.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_type_negative1(void); +static void utc_download_set_notification_type_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_type_negative1, 1}, + {utc_download_set_notification_type_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_type_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_notification_type(-1, DOWNLOAD_NOTIFICATION_TYPE_NONE); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_notification_type_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_type(id, 5); + download_destroy(id); + + if (retcode != DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has error"); + else + dts_fail(TC_NAME, "retcode does not have error"); +} diff --git a/TC/testcase/utc_download_set_notification_type_positive.c b/TC/testcase/utc_download_set_notification_type_positive.c new file mode 100644 index 0000000..505aadd --- /dev/null +++ b/TC/testcase/utc_download_set_notification_type_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_notification_type_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_notification_type_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_notification_type_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_notification_type(id, DOWNLOAD_NOTIFICATION_TYPE_NONE); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_progress_cb_negative.c b/TC/testcase/utc_download_set_progress_cb_negative.c new file mode 100644 index 0000000..b6520d1 --- /dev/null +++ b/TC/testcase/utc_download_set_progress_cb_negative.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_progress_cb_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_progress_cb_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void on_url_download_progess(int id, unsigned long long received, unsigned long long total, void *user_data) +{ + +} + +static void utc_download_set_progress_cb_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_progress_cb(-1, on_url_download_progess, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_set_progress_cb_positive.c b/TC/testcase/utc_download_set_progress_cb_positive.c new file mode 100644 index 0000000..e7f0d9e --- /dev/null +++ b/TC/testcase/utc_download_set_progress_cb_positive.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_progress_cb_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_progress_cb_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void on_url_download_progess(int id, unsigned long long received, unsigned long long total, void *user_data) +{ + +} + +static void utc_download_set_progress_cb_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_progress_cb(id, on_url_download_progess, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_state_changed_cb_negative.c b/TC/testcase/utc_download_set_state_changed_cb_negative.c new file mode 100644 index 0000000..070fce8 --- /dev/null +++ b/TC/testcase/utc_download_set_state_changed_cb_negative.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_state_changed_cb_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_state_changed_cb_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void on_url_download_state_changed(int download_id, download_state_e state, void *user_data) +{ + +} + +static void utc_download_set_state_changed_cb_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_state_changed_cb(-1, on_url_download_state_changed, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); + +} diff --git a/TC/testcase/utc_download_set_state_changed_cb_positive.c b/TC/testcase/utc_download_set_state_changed_cb_positive.c new file mode 100644 index 0000000..e05e598 --- /dev/null +++ b/TC/testcase/utc_download_set_state_changed_cb_positive.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_state_changed_cb_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_state_changed_cb_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void on_url_download_state_changed(int download_id, download_state_e state, void *user_data) +{ + +} + +static void utc_download_set_state_changed_cb_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_state_changed_cb(id, on_url_download_state_changed, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_set_temp_file_path_negative.c b/TC/testcase/utc_download_set_temp_file_path_negative.c new file mode 100644 index 0000000..2f1f21a --- /dev/null +++ b/TC/testcase/utc_download_set_temp_file_path_negative.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_temp_file_path_negative1(void); +static void utc_download_set_temp_file_path_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_temp_file_path_negative1, 1}, + {utc_download_set_temp_file_path_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_temp_file_path_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_temp_file_path(-1, "temp_file"); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_temp_file_path_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_temp_file_path(-1, NULL); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_set_temp_file_path_positive.c b/TC/testcase/utc_download_set_temp_file_path_positive.c new file mode 100644 index 0000000..cf442a7 --- /dev/null +++ b/TC/testcase/utc_download_set_temp_file_path_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_temp_file_path_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_temp_file_path_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_temp_file_path_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_temp_file_path(id, + "/opt/usr/media/Downloads/.temp_download/abc.txt"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} diff --git a/TC/testcase/utc_download_set_url_negative.c b/TC/testcase/utc_download_set_url_negative.c new file mode 100644 index 0000000..0f3e24c --- /dev/null +++ b/TC/testcase/utc_download_set_url_negative.c @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_url_negative1(void); +static void utc_download_set_url_negative2(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_url_negative1, 1}, + {utc_download_set_url_negative2, 2}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_url_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_set_url(-1, "URL"); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + +void utc_download_set_url_negative2(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_url(id, NULL); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_set_url_positive.c b/TC/testcase/utc_download_set_url_positive.c new file mode 100644 index 0000000..e448e54 --- /dev/null +++ b/TC/testcase/utc_download_set_url_positive.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_set_url_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_set_url_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +void utc_download_set_url_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + retcode = download_set_url(id, "URL"); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_start_negative.c b/TC/testcase/utc_download_start_negative.c new file mode 100644 index 0000000..a0af182 --- /dev/null +++ b/TC/testcase/utc_download_start_negative.c @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_start_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_start_negative1, 1}, + {NULL, 0}, +}; + +static GMainLoop *gloop = NULL; +static int is_download_failed = 0; + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); + is_download_failed = false; +} + +static void cleanup(void) +{ + /* end of TC */ + is_download_failed = false; + g_main_loop_quit(gloop); + g_main_loop_unref(gloop); + gloop = NULL; +} +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_FAILED || state == DOWNLOAD_STATE_CANCELED) { + is_download_failed = true; + g_main_loop_quit(gloop); + } + else + is_download_failed = false; + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + +static void utc_download_start_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to create download id"); + retcode = download_set_url(id, "abc.com"); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set url"); + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + + retcode = download_unset_state_changed_cb(id); + if ( retcode != DOWNLOAD_ERROR_NONE ) + dts_message(TC_NAME,"Fail to unset callback"); + download_destroy(id); + + if (is_download_failed) + dts_pass(TC_NAME, "retcode has invalid url"); + else + dts_fail(TC_NAME, "retcode does not have invalid url"); +} + diff --git a/TC/testcase/utc_download_start_positive.c b/TC/testcase/utc_download_start_positive.c new file mode 100644 index 0000000..ff7ee76 --- /dev/null +++ b/TC/testcase/utc_download_start_positive.c @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_start_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_start_positive1, 1}, + {NULL, 0}, +}; + +//static url_download_h handle = NULL; +static GMainLoop* gloop = NULL; +static int is_download_success = true; + +#define TEST_URL "http://static.campaign.naver.com/0/hangeul/2011/img/img_family.gif" +//#define TEST_URL "http://cdn.naver.com/naver/NanumFont/setup/NanumFontSetup_TTF_GOTHICLIGHT_hangeulcamp.exe" + +static void state_cb (int download_id, download_state_e state, void *user_data) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + download_error_e err = DOWNLOAD_ERROR_NONE; + if (state == DOWNLOAD_STATE_COMPLETED || state == DOWNLOAD_STATE_DOWNLOADING) { + is_download_success = true; + g_main_loop_quit(gloop); + } else + is_download_success = false; + + retcode = download_get_error(download_id, &err); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME, "Fail to get error"); + g_main_loop_quit(gloop); + return; + } + dts_message(TC_NAME, "err[%d]", err); + if (err == DOWNLOAD_ERROR_INVALID_URL) + dts_message(TC_NAME, "invaild url err"); + else + dts_message(TC_NAME, "another error[%d]", err); +} + +static void startup(void) +{ + g_type_init(); + gloop = g_main_loop_new (NULL, 0); + is_download_success = true; +} + +static void cleanup(void) +{ + is_download_success = false; + g_main_loop_unref(gloop); + gloop = NULL; +} + +static void utc_download_start_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + retcode = download_create(&id); + if (retcode != DOWNLOAD_ERROR_NONE) { + dts_fail(TC_NAME,"Fail to create download handle"); + return; + } + retcode = download_set_url(id, TEST_URL); + if ( retcode != DOWNLOAD_ERROR_NONE ) { + dts_fail(TC_NAME,"Fail to set url"); + return; + } + retcode = download_set_state_changed_cb(id, state_cb, NULL); + if (retcode != DOWNLOAD_ERROR_NONE) + dts_fail(TC_NAME, "Fail to set callback"); + + retcode = download_start(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + g_main_loop_run(gloop); + else + is_download_success = false; + + retcode = download_unset_state_changed_cb(id); + if ( retcode != DOWNLOAD_ERROR_NONE ) + dts_message(TC_NAME,"Fail to unset callback"); + download_destroy(id); + + if (is_download_success) + dts_pass(TC_NAME, "download content is success"); + else + dts_fail(TC_NAME, "download content is not success"); +} + diff --git a/TC/testcase/utc_download_unset_progress_cb_negative.c b/TC/testcase/utc_download_unset_progress_cb_negative.c new file mode 100644 index 0000000..6cf7c00 --- /dev/null +++ b/TC/testcase/utc_download_unset_progress_cb_negative.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_unset_progress_cb_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_unset_progress_cb_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void utc_download_unset_progress_cb_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_unset_progress_cb(-1); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); +} + diff --git a/TC/testcase/utc_download_unset_progress_cb_positive.c b/TC/testcase/utc_download_unset_progress_cb_positive.c new file mode 100644 index 0000000..4b4e0f5 --- /dev/null +++ b/TC/testcase/utc_download_unset_progress_cb_positive.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_download_unset_progress_cb_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_download_unset_progress_cb_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void on_url_download_progess(int id, unsigned long long received, unsigned long long total, void *user_data) +{ + +} + +static void utc_download_unset_progress_cb_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + download_set_progress_cb(id, on_url_download_progess, NULL); + retcode = download_unset_progress_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/testcase/utc_download_unset_state_changed_cb_negative.c b/TC/testcase/utc_download_unset_state_changed_cb_negative.c new file mode 100644 index 0000000..7d82c65 --- /dev/null +++ b/TC/testcase/utc_download_unset_state_changed_cb_negative.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_url_download_unset_state_changed_cb_negative1(void); + +struct tet_testlist tet_testlist[] = { + {utc_url_download_unset_state_changed_cb_negative1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void utc_url_download_unset_state_changed_cb_negative1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + + retcode = download_unset_state_changed_cb(-1); + + if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER) + dts_pass(TC_NAME, "retcode has invalid parameter"); + else + dts_fail(TC_NAME, "retcode does not have invalid parameter"); + +} + diff --git a/TC/testcase/utc_download_unset_state_changed_cb_positive.c b/TC/testcase/utc_download_unset_state_changed_cb_positive.c new file mode 100644 index 0000000..be578dd --- /dev/null +++ b/TC/testcase/utc_download_unset_state_changed_cb_positive.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_url_download_unset_state_changed_cb_positive1(void); + +struct tet_testlist tet_testlist[] = { + {utc_url_download_unset_state_changed_cb_positive1, 1}, + {NULL, 0}, +}; + +static void startup(void) +{ + +} + +static void cleanup(void) +{ + /* end of TC */ +} + +static void on_url_download_state_changed(int download_id, download_state_e state, void *user_data) +{ + +} + +static void utc_url_download_unset_state_changed_cb_positive1(void) +{ + const char *TC_NAME = __FUNCTION__; + int retcode = 0; + int id = 0; + + download_create(&id); + download_set_state_changed_cb(id, on_url_download_state_changed, NULL); + retcode = download_unset_state_changed_cb(id); + download_destroy(id); + + if (retcode == DOWNLOAD_ERROR_NONE) + dts_pass(TC_NAME, "retcode has no error"); + else + dts_fail(TC_NAME, "retcode has error"); +} + diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100644 index 0000000..03f029a --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL= make clean # clean tool +TET_CLEAN_FILE= Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/doc/download_doc.h b/doc/download_doc.h new file mode 100644 index 0000000..03b06ce --- /dev/null +++ b/doc/download_doc.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __TIZEN_WEB_DOWNLOAD_DOC_H__ +#define __TIZEN_WEB_DOWNLOAD_DOC_H__ + +/** + * @ingroup CAPI_CONTENT_FRAMEWORK + * @defgroup CAPI_WEB_DOWNLOAD_MODULE Download + * @brief The DOWNLOAD API provides functions to create and manage one or more download requests. + * + * @section CAPI_WEB_DOWNLOAD_MODULE_HEADER Required Header + * \#include + * + * @section CAPI_WEB_DOWNLOAD_MODULE_OVERVIEW Overview + * The DOWNLOAD API provides functions to create and manage one or more download requests. + * + * Major features : + * - After getting @a download_id from download_create(), other APIs use @a download_id as parameter. + * - Even if the device is off, @a download_id is available for 48 hours if the user does not call download_destroy(). + * - Supports the callback that is called whenever the status of download changes. + * - Even if the client process is terminated, download is going on. + * If you want to stop a download, download_cancel() or download_destroy() should be called. + * + * @section CAPI_WEB_DOWNLOAD_MODULE_FEATURE Related Features + * This API is related with the following features:\n + * - http://tizen.org/feature/network.telephony\n + * - http://tizen.org/feature/network.wifi\n + * - http://tizen.org/feature/network.wifi.direct\n + * + * It is recommended to design feature related codes in your application for reliability.\n + * + * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n + * + * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n + * + * More details on featuring your application can be found from Feature Element. + * + */ + +#endif /* __TIZEN_WEB_DOWNLOAD_DOC_H__ */ diff --git a/include/download.h b/include/download.h index ebd9171..453bfb1 100755 --- a/include/download.h +++ b/include/download.h @@ -18,7 +18,7 @@ #define __TIZEN_WEB_DOWNLOAD_H__ #include -#include +#include #ifndef DEPRECATED #define DEPRECATED __attribute__((deprecated)) @@ -29,118 +29,139 @@ extern "C" { #endif +/** + * @file download.h + */ + /** * @addtogroup CAPI_WEB_DOWNLOAD_MODULE * @{ */ /** - * @brief Enumeration of error code for URL download + * @brief Enumeration for error codes of URL download. + * @since_tizen 2.3 */ typedef enum { - DOWNLOAD_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - DOWNLOAD_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - DOWNLOAD_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - DOWNLOAD_ERROR_NETWORK_UNREACHABLE = TIZEN_ERROR_NETWORK_UNREACHABLE, /**< Network is unreachable */ - DOWNLOAD_ERROR_CONNECTION_TIMED_OUT = TIZEN_ERROR_CONNECTION_TIME_OUT, /**< Http session time-out */ - DOWNLOAD_ERROR_NO_SPACE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on device */ - DOWNLOAD_ERROR_FIELD_NOT_FOUND = TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Specified field not found */ - DOWNLOAD_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - DOWNLOAD_ERROR_INVALID_STATE = TIZEN_ERROR_WEB_CLASS | 0x21, /**< Invalid state */ - DOWNLOAD_ERROR_CONNECTION_FAILED = TIZEN_ERROR_WEB_CLASS | 0x22, /**< Connection failed */ - DOWNLOAD_ERROR_INVALID_URL = TIZEN_ERROR_WEB_CLASS | 0x24, /**< Invalid URL */ - DOWNLOAD_ERROR_INVALID_DESTINATION = TIZEN_ERROR_WEB_CLASS | 0x25, /**< Invalid destination */ - DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS = TIZEN_ERROR_WEB_CLASS | 0x26, /**< Full of available simultaneous downloads */ - DOWNLOAD_ERROR_QUEUE_FULL = TIZEN_ERROR_WEB_CLASS | 0x27, /**< Full of available downloading items from server*/ - DOWNLOAD_ERROR_ALREADY_COMPLETED = TIZEN_ERROR_WEB_CLASS | 0x28, /**< The download is already completed */ - DOWNLOAD_ERROR_FILE_ALREADY_EXISTS = TIZEN_ERROR_WEB_CLASS | 0x29, /**< It is failed to rename the downloaded file */ - DOWNLOAD_ERROR_CANNOT_RESUME = TIZEN_ERROR_WEB_CLASS | 0x2a, /**< It cannot resume */ - DOWNLOAD_ERROR_TOO_MANY_REDIRECTS = TIZEN_ERROR_WEB_CLASS | 0x30, /**< In case of too may redirects from http response header*/ - DOWNLOAD_ERROR_UNHANDLED_HTTP_CODE = TIZEN_ERROR_WEB_CLASS | 0x31, /**< The download cannot handle the http status value */ - DOWNLOAD_ERROR_REQUEST_TIMEOUT = TIZEN_ERROR_WEB_CLASS | 0x32, /**< There are no action after client create a download id*/ - DOWNLOAD_ERROR_RESPONSE_TIMEOUT = TIZEN_ERROR_WEB_CLASS | 0x33, /**< It does not call start API in some time although the download is created*/ - DOWNLOAD_ERROR_SYSTEM_DOWN = TIZEN_ERROR_WEB_CLASS | 0x34, /**< There are no response from client after rebooting download daemon*/ - DOWNLOAD_ERROR_ID_NOT_FOUND = TIZEN_ERROR_WEB_CLASS | 0x35, /**< The download id is not existed in download service module*/ - DOWNLOAD_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data because the set API is not called */ - DOWNLOAD_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR , /**< Internal I/O error */ + DOWNLOAD_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + DOWNLOAD_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + DOWNLOAD_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + DOWNLOAD_ERROR_NETWORK_UNREACHABLE = TIZEN_ERROR_NETWORK_UNREACHABLE, /**< Network is unreachable */ + DOWNLOAD_ERROR_CONNECTION_TIMED_OUT = TIZEN_ERROR_CONNECTION_TIME_OUT, /**< HTTP session time-out */ + DOWNLOAD_ERROR_NO_SPACE = TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on device */ + DOWNLOAD_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + DOWNLOAD_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ + DOWNLOAD_ERROR_INVALID_STATE = TIZEN_ERROR_DOWNLOAD | 0x21, /**< Invalid state */ + DOWNLOAD_ERROR_CONNECTION_FAILED = TIZEN_ERROR_DOWNLOAD | 0x22, /**< Connection failed */ + DOWNLOAD_ERROR_INVALID_URL = TIZEN_ERROR_DOWNLOAD | 0x24, /**< Invalid URL */ + DOWNLOAD_ERROR_INVALID_DESTINATION = TIZEN_ERROR_DOWNLOAD | 0x25, /**< Invalid destination */ + DOWNLOAD_ERROR_TOO_MANY_DOWNLOADS = TIZEN_ERROR_DOWNLOAD | 0x26, /**< Too many simultaneous downloads */ + DOWNLOAD_ERROR_QUEUE_FULL = TIZEN_ERROR_DOWNLOAD | 0x27, /**< Download server queue is full*/ + DOWNLOAD_ERROR_ALREADY_COMPLETED = TIZEN_ERROR_DOWNLOAD | 0x28, /**< The download is already completed */ + DOWNLOAD_ERROR_FILE_ALREADY_EXISTS = TIZEN_ERROR_DOWNLOAD | 0x29, /**< Failed to rename the downloaded file */ + DOWNLOAD_ERROR_CANNOT_RESUME = TIZEN_ERROR_DOWNLOAD | 0x2a, /**< Cannot resume */ + DOWNLOAD_ERROR_FIELD_NOT_FOUND = TIZEN_ERROR_DOWNLOAD | 0x2b, /**< Specified field not found */ + DOWNLOAD_ERROR_TOO_MANY_REDIRECTS = TIZEN_ERROR_DOWNLOAD | 0x30, /**< Too many redirects from HTTP response header*/ + DOWNLOAD_ERROR_UNHANDLED_HTTP_CODE = TIZEN_ERROR_DOWNLOAD | 0x31, /**< The download cannot handle the HTTP status value */ + DOWNLOAD_ERROR_REQUEST_TIMEOUT = TIZEN_ERROR_DOWNLOAD | 0x32, /**< No action after client creates a download ID*/ + DOWNLOAD_ERROR_RESPONSE_TIMEOUT = TIZEN_ERROR_DOWNLOAD | 0x33, /**< No call to start API for some time although the download is created*/ + DOWNLOAD_ERROR_SYSTEM_DOWN = TIZEN_ERROR_DOWNLOAD | 0x34, /**< No response from client after rebooting download daemon*/ + DOWNLOAD_ERROR_ID_NOT_FOUND = TIZEN_ERROR_DOWNLOAD | 0x35, /**< Download ID does not exist in download service module*/ + DOWNLOAD_ERROR_INVALID_NETWORK_TYPE = TIZEN_ERROR_DOWNLOAD | 0x36, /**< Network bonding is set but network type is not set as DOWNLOAD_NETWORK_ALL*/ + DOWNLOAD_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data because the set API is not called */ + DOWNLOAD_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR , /**< Internal I/O error */ } download_error_e; /** - * @brief Enumerations of state of download + * @brief Enumeration for download states. + * @since_tizen 2.3 */ typedef enum { - DOWNLOAD_STATE_NONE, /**< It is ready to download */ - DOWNLOAD_STATE_READY, /**< It is ready to download */ - DOWNLOAD_STATE_QUEUED, /**< It is queued to start downloading */ - DOWNLOAD_STATE_DOWNLOADING, /**< The download is currently running */ - DOWNLOAD_STATE_PAUSED, /**< The download is waiting to resume */ - DOWNLOAD_STATE_COMPLETED, /**< The download is completed. */ - DOWNLOAD_STATE_FAILED, /**< The download failed. */ - DOWNLOAD_STATE_CANCELED, /**< User cancel the download item. */ + DOWNLOAD_STATE_NONE, /**< Unhandled exception */ + DOWNLOAD_STATE_READY, /**< Ready to download */ + DOWNLOAD_STATE_QUEUED, /**< Queued to start downloading */ + DOWNLOAD_STATE_DOWNLOADING, /**< Currently downloading */ + DOWNLOAD_STATE_PAUSED, /**< The download is waiting to resume */ + DOWNLOAD_STATE_COMPLETED, /**< The download is completed */ + DOWNLOAD_STATE_FAILED, /**< The download failed */ + DOWNLOAD_STATE_CANCELED, /**< User canceled the download item */ } download_state_e; /** - * @brief Enumerations of network type for download + * @brief Enumeration for network type for downloading. + * @since_tizen 2.3 */ typedef enum { - DOWNLOAD_NETWORK_DATA_NETWORK, /**< Download is available through data network */ - DOWNLOAD_NETWORK_WIFI, /**< Download is available through WiFi */ - DOWNLOAD_NETWORK_WIFI_DIRECT, /**< Download is available through WiFi-Direct */ - DOWNLOAD_NETWORK_ALL /**< Download is available through either data network or WiFi */ -} download_network_type_e ; + DOWNLOAD_NETWORK_DATA_NETWORK, /**< Download is available through data network */ + DOWNLOAD_NETWORK_WIFI, /**< Download is available through WiFi */ + DOWNLOAD_NETWORK_WIFI_DIRECT, /**< Download is available through WiFi-Direct */ + DOWNLOAD_NETWORK_ALL /**< Download is available through either data network or WiFi */ +} download_network_type_e; /** - * @brief Enumerations of notification type when client want to register - * @see #download_set_notification_type() - * @see #download_get_notification_type() + * @brief Enumeration for notification types when a client wants to register. + * @since_tizen 2.3 + * + * @see download_set_notification_type() + * @see download_get_notification_type() */ typedef enum { - DOWNLOAD_NOTIFICATION_TYPE_NONE = 0, /**< Do not register notification */ - DOWNLOAD_NOTIFICATION_TYPE_COMPLETE_ONLY, /**< For success state and failed state */ - DOWNLOAD_NOTIFICATION_TYPE_ALL /**< For ongoing state, success state and failed state */ + DOWNLOAD_NOTIFICATION_TYPE_NONE = 0, /**< Do not register notification */ + DOWNLOAD_NOTIFICATION_TYPE_COMPLETE_ONLY, /**< Completion notification for success state and failed state */ + DOWNLOAD_NOTIFICATION_TYPE_ALL /**< All download notifications for ongoing state, success state and failed state */ } download_notification_type_e; /** - * @brief Enumerations of the type about notification bundle which client want to set when registering notification - * @see #download_set_notification_bundle() - * @see #download_get_notification_bundle() + * @brief Enumeration for the type of notification app control action which the client wants to set when registering notification. + * @since_tizen 2.3 + * + * @see download_set_notification_app_control() + * @see download_get_notification_app_control() */ typedef enum { - DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING = 0, /**< For bundle for failed and ongoing notification */ - DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_COMPLETE, /**< For bundle for completed notification */ - DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_FAILED /**< For bundle for failed notification*/ -} download_notification_bundle_type_e; - + DOWNLOAD_NOTIFICATION_APP_CONTROL_TYPE_ONGOING = 0, /**< App control action for failed and ongoing notification */ + DOWNLOAD_NOTIFICATION_APP_CONTROL_TYPE_COMPLETE, /**< App control action for completed notification */ + DOWNLOAD_NOTIFICATION_APP_CONTROL_TYPE_FAILED /**< App control action for failed notification*/ +} download_notification_app_control_type_e; /** - * @brief Called when the download status is changed. + * @brief Called when a download state is changed. + * + * @since_tizen 2.3 + * + * @param[in] download_id The download ID + * @param[in] state The state of download + * @param[in] user_data The user data passed from download_set_state_changed_cb() + * + * @pre download_start() will invoke this callback if you register this callback using download_set_state_changed_cb(). * - * @param [in] download The download id - * @param [in] state The state of download - * @param [in] user_data The user data passed from download_set_state_changed_cb() - * @pre download_start() will cause this callback if you register this callback using download_set_state_changed_cb() * @see download_set_state_changed_cb() * @see download_unset_state_changed_cb() */ typedef void (*download_state_changed_cb) (int download_id, - download_state_e state, void *user_data); + download_state_e state, void *user_data); /** * @brief Called when the progress of download changes. * + * @since_tizen 2.3 + * * @remarks This callback function is only invoked in the downloading state. - * @param [in] download The download id - * @param [in] received The size of the data received in bytes - * @param [in] user_data The user data passed from download_set_progress_cb() + * + * @param[in] download_id The download ID + * @param[in] received The size of the data received in bytes + * @param[in] user_data The user data passed from download_set_progress_cb() + * * @pre This callback function is invoked if you register this callback using download_set_progress_cb(). + * * @see download_cancel() * @see download_set_progress_cb() * @see download_unset_progress_cb() @@ -148,33 +169,56 @@ typedef void (*download_state_changed_cb) (int download_id, typedef void (*download_progress_cb) (int download_id, unsigned long long received, void *user_data); /** - * @brief Creates a download id. + * @brief Creates a new download request and return its download ID. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks The @a download_id is released with download_destroy() by client. + * + * @param[out] download_id The download ID that is newly created on success * - * @remarks The @a download is released with download_destroy() by client.\n - * @param [out] download A download id to be newly created on success - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error - * @retval #DOWNLOAD_ERROR_QUEUE_FULL Full of queue from download server - * @post The download state will be #DOWNLOAD_STATE_READY + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error + * @retval #DOWNLOAD_ERROR_QUEUE_FULL Download server queue is full + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @post The download state will be #DOWNLOAD_STATE_READY. + * * @see download_destroy() */ int download_create(int *download_id); /** - * @brief Unload all data concerning a download id from memory. + * @brief Unloads all data concerning a download ID from memory. + * + * @details After calling this API, a download ID is existed at DB in certain time. + * Within that time, it is able to use the other API with the download ID. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * + * @remarks If #DOWNLOAD_ERROR_ID_NOT_FOUND is returned, it means that the download ID is completely removed from DB. + * + * @param[in] download_id The download ID * - * @detail After calling this API, a download ID is existed at DB in certain time.\n - * Within that time, it is able to use the other API with the download ID. - * @remark If #DOWNLOAD_ERROR_ID_NOT_FOUND is returned, it means that the download ID is completely removed from DB. - * @param [in] download The download id - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_create() */ int download_destroy(int download_id); @@ -183,17 +227,28 @@ int download_destroy(int download_id); /** * @brief Sets the URL to download. * - * @remarks This function should be called before downloading (See download_start()) - * @param [in] download The download id - * @param [in] url The URL to download \n - * If the @a url is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * + * @param[in] download_id The download ID + * @param[in] url The URL to download \n + * If @a url is @c NULL, it clears the previous value. + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_get_url() */ int download_set_url(int download_id, const char *url); @@ -202,33 +257,55 @@ int download_set_url(int download_id, const char *url); /** * @brief Gets the URL to download. * - * @remarks The @a url must be released with free() by you. - * @param [in] download The download id - * @param [out] url The URL to download - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks You must release @a url using free(). + * + * @param[in] download_id The download ID + * @param[out] url The URL to download + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_url() */ int download_get_url(int download_id, char **url); /** - * @brief Sets the allowed network type for the downloaded file + * @brief Sets the allowed network type for the downloaded file. * * @details The file can be downloaded only under the allowed network. * - * @remarks This function should be called before downloading (see download_start()) - * @param [in] download The download id - * @param [in] net_type The network type which the client prefer - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * + * @param[in] download_id The download ID + * @param[in] net_type The network type that the client prefers + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * @retval #DOWNLOAD_ERROR_NOT_SUPPORTED Not supported + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_get_network_type() * @see #download_network_type_e */ @@ -236,54 +313,83 @@ int download_set_network_type(int download_id, download_network_type_e net_type) /** - * @brief Gets the network type for the downloaded file + * @brief Gets the network type for the downloaded file. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @param[in] download_id The download ID + * @param[out] net_type The network type that is defined by client + * + * @return @c 0 on success, + * otherwise a negative error value * - * @param [in] download The download id - * @param [out] net_type The network type which is defined by client. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_network_type() * @see #download_network_type_e */ int download_get_network_type(int download_id, download_network_type_e *net_type); - /** * @brief Sets the destination for the downloaded file. * * @details The file will be downloaded to the specified destination. - * The downloaded file is saved to an auto-generated file name in the destination. - * If the destination is not specified, the file will be downloaded to default storage. (See the @ref CAPI_STORAGE_MODULE API) - * - * @remarks This function should be called before downloading (see download_start()) - * @param [in] download The download id - * @param [in] path The absolute path to the downloaded file - * If the @a path is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * The downloaded file is saved to an auto-generated file name in the destination. + * If the destination is not specified, the file will be downloaded to default storage (see the @ref CAPI_SYSTEM_STORAGE_MODULE API). + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * + * @param[in] download_id The download ID + * @param[in] path The absolute path to the downloaded file \n + * If @a path is @c NULL, it clears the previous value. + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_get_destination() */ int download_set_destination(int download_id, const char *path); /** - * @brief Gets the destination for the downloaded file. + * @brief Gets the destination path for the downloaded file. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks You must release @a path using free(). + * + * @param[in] download_id The download ID + * @param[out] path The absolute path to the downloaded file * - * @remarks The @a path must be released with free() by you. - * @param [in] download The download id - * @param [out] path The absolute path to the downloaded file - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_destination() */ int download_get_destination(int download_id, char **path); @@ -292,173 +398,87 @@ int download_get_destination(int download_id, char **path); /** * @brief Sets the name for the downloaded file. * - * @details The file will be downloaded to the specified destination as the given file name. - * If the file name is not specified, the downloaded file is saved to an auto-generated file name in the destination. + * @details The file will be saved in the specified destination with the given file name. + * If the file name is not specified, the downloaded file will be saved with an auto-generated file name in the destination. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * + * @param[in] download_id The download ID + * @param[in] file_name The file name for the downloaded file \n + * If @a name is @c NULL it clears the previous value. * - * @remarks This function should be called before downloading (see download_start()) - * @param [in] download The download id - * @param [in] file_name The file name for the downloaded file - * If the @a name is NULL, it clears the previous value. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_get_file_name() */ int download_set_file_name(int download_id, const char *file_name); - /** - * @brief Gets the name which is set by user. + * @brief Gets the name of the downloaded file set previously by download_set_file_name(). * - * @details If user do not set any name, it returns NULL. + * @details If the name is not set, @c NULL is returned. * - * @remarks The @a file_name must be released with free() by you. - * @param [in] download The download id - * @param [out] file_name The file name which is set by user. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks You must release @a file_name using free(). + * + * @param[in] download_id The download ID + * @param[out] file_name The file name which is set by user + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_file_name() */ int download_get_file_name(int download_id, char **file_name); /** - * @brief Sets the option value to register notification messages by download service module. - * @details The three types of notification message can be posted. Those are completion, failed and ongoing type. - * When the notification message of failed and ongoing types from the notification tray, \n - * the client application which call this API will be launched. \n - * - * @remarks The extra param should be set together (See download_set_notification_extra_param()). \n - * The downloading and failed notification can be registered only if the extra param for notification message is set. \n - * If it is not, the client application can not know who request to launch itself. \n - * It should be necessary to understand the action operation of notification click event. - * @remarks If the competition notification message is selected from the notification tray,\n - * the proper player application is launched automatically. - * @remarks The default value is false. So if the client don't enable it, any notification messages are not registered. - * @remarks This function should be called before downloading (See download_start()) - * @param[in] download The download id - * @param[in] enable The boolean type. The true or false value is available. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED - * @see download_get_notification() - * @see service_get_operation() - * @deprecated This API can be replaced with download_set_notification_type() - @code - int ret = 0; - //ret = download_set_notification(id, true); - ret = download_set_notificationo_type(id, DOWNLOAD_NOTIFICATION_TYPE_ALL); - //ret = download_set_notification(id, false); - ret = download_set_notificationo_type(id, DOWNLOAD_NOTIFICATION_TYPE_NONE); - @endcode - */ -DEPRECATED int download_set_notification(int download_id, bool enable); - -/** - * @brief Gets the option value to register notification messages by download service module. - * @param[in] download The download id - * @param[out] enable The boolean type. The true or false value is returned - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @see download_set_notification() - * @deprecated This API can be replaced with download_get_notification_type() - @code - int ret = 0; - bool val = 0; - download_notification_type_e type; - //ret = download_get_notification(id, &val); - ret = download_get_notification_type(id, &type); - @endcode - */ -DEPRECATED int download_get_notification(int download_id, bool *enable); - -/** - * @brief Sets the extra param data which pass by application service data when notification message is clicked - * @details When client set the extra param data for ongoing notification action, \n - * it can get the data through service_get_extra_data() when client application is launched by notification action. - * - * @remarks This function should be called before downloading (See download_start()) - * - * @param[in] download The download id - * @param[in] key The character pointer type. The extra param has a pair of key and value - * @param[in] values The character pointer array type. The extra param has a pair of key and value array - * @param[in] length The length of value array - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @see download_get_notification_extra_param() - * @see download_remove_notification_extra_param() - * @deprecated This API can be replaced with download_set_notification_bundle() - @code - #include - int ret = 0; - // char *value[1] = ("12345",}; - //ret = download_add_notification_extra_param(id, "specific_id", value[0], 1); - bundle *b = bundle_create(); - char buff[MAX_BUF_LEN] = {0,}; - appsvc_set_pkgname(b, "com.samsung.test-app"); - appsvc_add_data(b, "specific_id", "12345"); - ret = download_set_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ALL, b); - bundle_free(b); - @endcode - */ -DEPRECATED int download_add_notification_extra_param(int download_id, const char *key, const char **values, const unsigned int length); - -/** - * @brief Remove the extra param data which pass by application service data when notification message is clicked - * - * @remarks This function should be called before downloading (See download_start()) - * - * @param[in] download The download id - * @param[in] key The character pointer type. The extra param has a pair of key and value - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @see download_add_notification_extra_param() - * @see download_get_notification_extra_param() - */ -DEPRECATED int download_remove_notification_extra_param(int download_id, const char *key); - -/** - * @brief Gets the extra param value to set by download_set_notification_extra_param - * @param[in] download The download id - * @param[out] key The character pointer type. The extra param has a pair of key and value - * @param[out] values param The character pointer array type. The extra param has a pair of key and value array - * @param[out] length The length of value array - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @see download_set_notification_extra_param() - */ -DEPRECATED int download_get_notification_extra_param(int download_id, const char *key, char ***values, unsigned int *length); - -/** - * @brief Gets the absolute path to save the downloaded file + * @brief Gets the absolute path to save the downloaded file. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function returns #DOWNLOAD_ERROR_INVALID_STATE if the download is not completed. + * You must release @a path using free(). + * + * @param[in] download_id The download ID + * @param[out] path The absolute path to the downloaded file + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied * - * @remarks This function returns #DOWNLOAD_ERROR_INVALID_STATE if the download is not completed. \n - * The @a path must be released with free() by you. - * @param [in] download The download id - * @param [out] path The absolute path to the downloaded file - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID * @pre The download state must be #DOWNLOAD_STATE_COMPLETED. + * * @see download_set_file_name() * @see download_set_destination() */ @@ -466,17 +486,27 @@ int download_get_downloaded_file_path(int download_id, char **path); /** - * @brief Gets the mime type for downloading a content. + * @brief Gets the MIME type of the downloaded content. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @remarks This function returns #DOWNLOAD_ERROR_INVALID_STATE if the download has not been started. \n - * The @a mime_type must be released with free() by you. - * @param [in] download The download id - * @param [out] mime_type The MIME type of the downloaded file - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @remarks This function returns #DOWNLOAD_ERROR_INVALID_STATE if the download has not been started. + * You must release @a mime_type using free(). + * + * @param[in] download_id The download ID + * @param[out] mime_type The MIME type of the downloaded file + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_file_name() * @see download_set_destination() * @see download_get_downloaded_file_path() @@ -485,20 +515,33 @@ int download_get_mime_type(int download_id, char **mime_type); /** - * @brief Sets the option for auto download. - * @details If this option is enabled, \n - * the previous downloading item is restarted automatically as soon as the download daemon is restarted. \n - * And the download progress keep going after the client process is terminated. \n - * @remarks The client should call download_set_notification() and download_set_notification_extra_param() after call this API. \n - * If it is not, user do not receive the download result in case the client process is not alive. - * @remarks The default value is false. - * @param[in] download The download id - * @param[in] enable The boolean value for auto download which is defined by client. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @brief Enables or disables auto download. + * @details If this option is enabled, + * the previous downloading item is restarted automatically as soon as the download daemon is restarted. + * The download progress continues after the client process is terminated. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks The client should call download_set_notification() and download_set_notification_extra_param() after calling this API. + * If it is not done, the user will not receive the download result in case the client process is not alive. \n + * The default value is @c false. + * + * @param[in] download_id The download ID + * @param[in] enable Set @c true to enable auto download, + * otherwise set @c false to disable auto download + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_get_auto_download() * @see download_set_notification() * @see download_set_notification_extra_param() @@ -508,38 +551,60 @@ int download_set_auto_download(int download_id, bool enable); /** - * @brief Gets the value of option for auto download. + * @brief Checks whether auto download is enabled. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @param[in] download_id The download ID + * @param[out] enable @c true if auto download is enabled, + * otherwise @c false if auto download is disabled + * + * @return @c 0 on success, + * otherwise a negative error value * - * @param [in] download The download id - * @param [out] enable The boolean value for auto download which is defined by client. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_auto_download() */ int download_get_auto_download(int download_id, bool *enable); /** - * @brief Adds an HTTP header field to the download request + * @brief Adds a HTTP header field to the download request. + * + * @details The given HTTP header field will be included with the HTTP request of the download request. + * For more information, see HTTP/1.1: HTTP Message Headers. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * This function replaces any existing value for the given key. + * This function returns #DOWNLOAD_ERROR_INVALID_PARAMETER if @a field or @a value is a zero-length string. * - * @details The given HTTP header field will be included with the HTTP request of the download request. \n - * Refer to the HTTP/1.1: HTTP Message Headers - * @remarks This function should be called before downloading (see download_start()) \n - * This function replaces any existing value for the given key. \n - * This function returns #DOWNLOAD_ERROR_INVALID_PARAMETER if field or value is zero-length string. - * @param [in] download The download id - * @param [in] field The name of the HTTP header field - * @param [in] value The value associated with given field - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[in] field The name of the HTTP header field + * @param[in] value The value associated with given field + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_get_http_header_field() * @see download_remove_http_header_field() */ @@ -547,59 +612,90 @@ int download_add_http_header_field(int download_id, const char *field, const cha /** - * @brief Gets the value associated with given HTTP header field from the download + * @brief Gets a value associated with a given HTTP header field from the download. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @remarks This function returns #DOWNLOAD_ERROR_INVALID_PARAMETER if field is zero-length string. \n - * The @a value must be released with free() by you. - * @param [in] download The download id - * @param [in] field The name of the HTTP header field - * @param [out] value The value associated with given field - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @remarks This function returns #DOWNLOAD_ERROR_INVALID_PARAMETER if @a field is zero-length string. + * You must release @a value using free(). + * + * @param[in] download_id The download ID + * @param[in] field The name of the HTTP header field + * @param[out] value The value associated with given field + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_FIELD_NOT_FOUND Specified field not found - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_FIELD_NOT_FOUND Specified field not found + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_add_http_header_field() * @see download_remove_http_header_field() */ int download_get_http_header_field(int download_id, const char *field, char **value); /** - * @brief Gets all of the field added to the download request + * @brief Gets all the HTTP header fields added to the download request. * - * @remarks The @a value must be released with free() by you. - * @param [in] download The download id - * @param [out] the array of the HTTP header fields - * @param [out] the number of the HTTP header fields - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks You must release @a value using free(). + * + * @param[in] download_id The download ID + * @param[out] fields The array of the HTTP header fields + * @param[out] length The number of the HTTP header fields + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_add_http_header_field() * @see download_remove_http_header_field() */ int download_get_http_header_field_list(int download_id, char ***fields, int *length); /** - * @brief Removes the given HTTP header field from the download + * @brief Removes a given HTTP header field from the download. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * This function returns #DOWNLOAD_ERROR_INVALID_PARAMETER if field is zero-length string. + * + * @param[in] download_id The download ID + * @param[in] field The name of the HTTP header field + * + * @return @c 0 on success, + * otherwise a negative error value * - * @remarks This function should be called before downloading (see download_start()) \n - * This function returns #DOWNLOAD_ERROR_INVALID_PARAMETER if field is zero-length string. - * @param [in] download The download id - * @param [in] field The name of the HTTP header field - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_FIELD_NOT_FOUND Specified field not found - * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_FIELD_NOT_FOUND Specified field not found + * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_add_http_header_field() * @see download_get_http_header_field() */ @@ -607,17 +703,28 @@ int download_remove_http_header_field(int download_id, const char *field); /** - * @brief Registers a callback function to be invoked when the download state is changed. + * @brief Registers a callback function to be invoked when a download state is changed. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). * - * @remarks This function should be called before downloading (see download_start()) - * @param [in] download The download id - * @param [in] callback The callback function to register - * @param [in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @post download_state_changed_cb() will be invoked. + * * @see download_unset_state_changed_cb() * @see download_state_changed_cb() */ @@ -625,14 +732,24 @@ int download_set_state_changed_cb(int download_id, download_state_changed_cb cal /** - * @brief Unregisters the callback function. + * @brief Unregisters the download state change callback function. * - * @remarks This function should be called before downloading (see download_start()) - * @param [in] download The download id - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * + * @param[in] download_id The download ID + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_state_changed_cb() * @see download_state_changed_cb() */ @@ -640,18 +757,29 @@ int download_unset_state_changed_cb(int download_id); /** - * @brief Registers a callback function to be invoked when progress of the download changes + * @brief Registers a callback function to be invoked when progress of the download changes. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * + * @param[in] download_id The download ID + * @param[in] callback The callback function to register + * @param[in] user_data The user data to be passed to the callback function + * + * @return @c 0 on success, + * otherwise a negative error value * - * @remarks This function should be called before downloading (see download_start()) - * @param [in] download The download id - * @param [in] callback The callback function to register - * @param [in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @post download_progress_cb() will be invoked. + * * @see download_unset_progress_cb() * @see download_progress_cb() */ @@ -659,15 +787,25 @@ int download_set_progress_cb(int download_id, download_progress_cb callback, voi /** - * @brief Unregisters the callback function. + * @brief Unregisters the download progress change callback function. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks This function should be called before downloading (see download_start()). + * + * @param[in] download_id The download ID * - * @remarks This function should be called before downloading (see download_start()) - * @param [in] download The download id - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_progress_cb() * @see download_progress_cb() */ @@ -679,22 +817,33 @@ int download_unset_progress_cb(int download_id); * * @details This function starts to download the current URL, or resumes the download if paused. * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * * @remarks The URL is the mandatory information to start the download. - * @remarks It should call download_set_progress_cb() and download_set_state_changed_cb() again \n - * after the client process is restarted or download_destry() is called - * @param [in] download The download id - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful - * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error - * @retval #DOWNLOAD_ERROR_URL Invalid URL - * @retval #DOWNLOAD_ERROR_DESTINATION Invalid destination - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @retval #DOWNLOAD_ERROR_QUEUE_FULL Full of queue from download server - * @pre The download state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_PAUSED, #DOWNLOAD_STATE_CANCELED, #DOWNLOAD_STATE_FAILED. - * @post The download state will be #DOWNLOAD_STATE_QUEUED or #DOWNLOAD_STATE_DOWNLOADING + * @remarks It should call download_set_progress_cb() and download_set_state_changed_cb() again + * after the client process is restarted or download_destroy() is called. + * + * @param[in] download_id The download ID + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error + * @retval #DOWNLOAD_ERROR_INVALID_URL Invalid URL + * @retval #DOWNLOAD_ERROR_INVALID_DESTINATION Invalid destination + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_QUEUE_FULL Download server queue is full + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The download state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_PAUSED, #DOWNLOAD_STATE_CANCELED, or #DOWNLOAD_STATE_FAILED. + * @post The download state will be #DOWNLOAD_STATE_QUEUED or #DOWNLOAD_STATE_DOWNLOADING. + * * @see download_set_url() * @see download_pause() * @see download_cancel() @@ -705,17 +854,28 @@ int download_start(int download_id); /** * @brief Pauses the download, asynchronously. * - * @remarks The paused download can be restarted with download_start() or canceled with download_cancel() - * @param [in] download The download id - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks The paused download can be restarted with download_start() or cancelled with download_cancel(). + * + * @param[in] download_id The download ID + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The download state must be #DOWNLOAD_STATE_DOWNLOADING. + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The download state must be #DOWNLOAD_STATE_DOWNLOADING. * @post The download state will be #DOWNLOAD_STATE_PAUSED. + * * @see download_start() * @see download_cancel() */ @@ -723,108 +883,199 @@ int download_pause(int download_id); /** - * @brief Cancel the download, asynchronously. + * @brief Cancels the download, asynchronously. + * + * @details This function cancels the running download and its state will be #DOWNLOAD_STATE_READY. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @details This function cancels the running download and its state will be #DOWNLOAD_STATE_READY * @remarks The canceled download can be restarted with download_start(). - * @param [in] download The download id - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * + * @param[in] download_id The download ID + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory - * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state - * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The download state must be #DOWNLOAD_STATE_QUEUED, #DOWNLOAD_STATE_DOWNLOADING, #DOWNLOAD_STATE_PAUSED. + * @retval #DOWNLOAD_ERROR_OUT_OF_MEMORY Out of memory + * @retval #DOWNLOAD_ERROR_INVALID_STATE Invalid state + * @retval #DOWNLOAD_ERROR_IO_ERROR Internal I/O error + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The download state must be #DOWNLOAD_STATE_QUEUED, #DOWNLOAD_STATE_DOWNLOADING, or #DOWNLOAD_STATE_PAUSED. * @post The download state will be #DOWNLOAD_STATE_CANCELED. + * * @see download_start() */ int download_cancel(int download_id); /** - * @brief Gets the download's current state. + * @brief Gets the current state of the download. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @param[in] download_id The download ID + * @param[out] state The current state of the download * - * @param [in] download The download id - * @param [out] state The current state of the download - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see #download_state_e */ int download_get_state(int download_id, download_state_e *state); /** - * @brief Gets the full path of temporary file for downloading a content. + * @brief Gets the full path of the temporary file to store downloaded content. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @param[in] download_id The download ID + * @param[out] temp_path The full path of temporary file * - * @param [in] download The download id - * @param [out] temp_path The full path of temporary file - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The download state must be one of state after #DOWNLOAD_STATE_DOWNLOADING. - * @see #download_set_state_changed_cb() - * @see #download_unset_state_changed_cb() + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The download state must be one of the states after #DOWNLOAD_STATE_DOWNLOADING. + * + * @see download_set_state_changed_cb() + * @see download_unset_state_changed_cb() * @see download_start() */ int download_get_temp_path(int download_id, char **temp_path); /** - * @brief Gets the content name for downloading a file. + * @brief Sets the directory path of the temporary file used in the previous download request. + * @details This is only useful when resuming download to make HTTP request header at the client side. + * Otherwise, the path should be ignored internally. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks If the etag value is not present in the download database, it is useless to set the temporary path. \n + * When resuming download, the data is attached at the end of this temporary file. + * + * @param[in] download_id The download ID + * @param[out] path The full path of temporary file + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * + * @see download_get_etag() + */ +int download_set_temp_file_path(int download_id, char *path); + + +/** + * @brief Gets the content name of downloaded file. * * @details This can be defined with reference of HTTP response header data. - * The content name can be received when HTTP response header is received. + * The content name can be received when HTTP response header is received. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @param [in] download The download id - * @param [out] content_name The content name for displaying to user - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[out] content_name The content name for displaying to user + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The download state must be one of state after #DOWNLOAD_STATE_DOWNLOADING. - * @see #download_set_state_changed_cb() - * @see #download_unset_state_changed_cb() + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The download state must be one of the states after #DOWNLOAD_STATE_DOWNLOADING. + * + * @see download_set_state_changed_cb() + * @see download_unset_state_changed_cb() * @see download_start() */ int download_get_content_name(int download_id, char **content_name); /** - * @brief Gets the total size for downloading a content. + * @brief Gets the total size of downloaded content. + * + * @details This information is received from the server. If the server does not send the total size of the content, @a content_size is set to zero. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @param[in] download_id The download ID + * @param[out] content_size The content size for displaying to user * - * @details This data receive from content server. If the content sever don't send total size of the content, the value set as zero. + * @return @c 0 on success, + * otherwise a negative error value * - * @param [in] download The download id - * @param [out] content_size The content size for displaying to user - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The download state must be one of state after #DOWNLOAD_STATE_DOWNLOADING. - * @see #download_set_state_changed_cb() - * @see #download_unset_state_changed_cb() + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The download state must be one of the states after #DOWNLOAD_STATE_DOWNLOADING. + * + * @see download_set_state_changed_cb() + * @see download_unset_state_changed_cb() * @see download_start() */ int download_get_content_size(int download_id, unsigned long long *content_size); /** - * @brief Gets the error value when the download is failed. + * @brief Gets an error value when the download fails. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @param [in] download The download id - * @param [out] error The error value - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[out] error The error value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @pre The download state must be #DOWNLOAD_STATE_FAILED. * @pre The download state must be #DOWNLOAD_STATE_CANCELED. - * @see #download_set_state_changed_cb() - * @see #download_unset_state_changed_cb() + * + * @see download_set_state_changed_cb() + * @see download_unset_state_changed_cb() * @see download_start() * @see download_error_e */ @@ -832,166 +1083,296 @@ int download_get_error(int download_id, download_error_e *error); /** - * @brief Gets the http status code when the download error is happened. + * @brief Gets a HTTP status code when a download error occurs. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @param[in] download_id The download ID + * @param[out] HTTP_status The HTTP status code defined in RFC 2616 + * + * @return @c 0 on success, + * otherwise a negative error value * - * @param [in] download The download id - * @param [out] http_status The http status code which is defined in RFC 2616 - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @pre The download state must be #DOWNLOAD_STATE_FAILED. - * @see #download_set_download_status_cb() - * @see #download_unset_download_status_cb() + * + * @see download_set_download_status_cb() + * @see download_unset_download_status_cb() * @see download_start() */ -int download_get_http_status(int download_id, int *http_status); +int download_get_http_status(int download_id, int *HTTP_status); + /** - * @brief Sets bundle data to register notification messages. - * @details The three types of notification message can be posted. Those are completion, failed and ongoing type. + * @brief Sets an app control handle to register notification messages. + * @details Three types of notification message can be posted: completion, failed and ongoing type. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @remarks When the notification message is clicked, the action is decided by bundle data. \n - * If the bundle data is not set, the following default operation is executed when the notification message is clicked. \n - * 1) Download completed state : The viewer application is executed according to extension name of downloaded content. \n - * 2) Download failed state and ongoing state : The client application is executed. \n - * @remarks This function should be called before starting download. - * @remarks The bundle data MUST BE FREED by client when it is not used any more. - * @param[in] download The download id - * @param[in] type The enumeration type. See #download_notification_bundle_type_e. - * @param[in] bundle The bundle pointer value. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @remarks When the notification message is clicked, the action to take is decided by the app control handle. \n + * If the app control handle is not set, the following default operation is executed when the notification message is clicked: \n + * 1) download completed state - the viewer application is executed according to extension name of downloaded content, \n + * 2) download failed state and ongoing state - the client application is executed. \n + * This function should be called before starting the download. \n + * The app control handle MUST BE FREED by the client when it is not used any more. + * + * @param[in] download_id The download ID + * @param[in] type The enumeration type \n + * See #download_notification_app_control_type_e. + * @param[in] handle The app control handle pointer value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * * @see download_set_notification_type() - * @see download_get_notification_bundle() + * @see download_get_notification_app_control() */ -int download_set_notification_bundle(int download_id, download_notification_bundle_type_e type, bundle *b); +int download_set_notification_app_control(int download_id, download_notification_app_control_type_e type, app_control_h handle); + /** - * @brief Get the bundle data to register notification messages which is set in download_set_notification_bundle(). + * @brief Gets the app control handle (used previously to register notification messages) which is set by download_set_notification_app_control(). + * + * @details When the notification message is clicked, the action is decided by the app control handle. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks The app control handle MUST BE FREED by the client when it is not used any more. * - * @details When the notification message is clicked, the action is decided by bundle data. \n - * @param[in] download The download id - * @param[in] type The enumeration type. See #download_notification_bundle_type_e. - * @param[out] bundle The bundle pointer value. - * @remarks The bundle data MUST BE FREED by client when it is not used any more. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[in] type The enumeration type \n + * See #download_notification_app_control_type_e. + * @param[out] handle The app control handle pointer value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @retval #DOWNLOAD_ERROR_NO_DATA the bundle have not been set - * @see download_set_notification_bundle() + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_NO_DATA The app control handle has not been set + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @see download_set_notification_app_control() */ -int download_get_notification_bundle(int download_id, download_notification_bundle_type_e type, bundle **b); +int download_get_notification_app_control(int download_id, download_notification_app_control_type_e type, app_control_h *handle); + /** - * @brief Set the title of notification. + * @brief Sets the title of a notification. + * + * @details When registering a notification, the title is displayed in the title area of the notification message. * - * @details When registering notification, the title is displayed at title area of notification message + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @param [in] download The download id - * @param [in] title The title for displaying to user - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[in] title The title for displaying to user + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre If the notification option is not enable, this title is not shown to user - * @see #download_set_notification_type() - * @see #download_get_notification_title() - */ + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre If a notification option is not enabled, this title is not shown to user. + * + * @see download_set_notification_type() + * @see download_get_notification_title() + */ int download_set_notification_title(int download_id, const char *title); + /** - * @brief Gets the title of notification when set in #download_set_notification_title() + * @brief Gets the title of the notification set by download_set_notification_title(). + * + * @details When registering a notification, the title is displayed in the title area of the notification message. * - * @details When registering notification, the title is displayed at title area of notification message + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @param [in] download The download id - * @param [out] title The title for displaying to user - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[out] title The title for displaying to user + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @retval #DOWNLOAD_ERROR_NO_DATA the title have not been set + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_NO_DATA The title has not been set + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @pre It can get the title value before calling this API. - * @see #download_set_notification_title() + * + * @see download_set_notification_title() */ int download_get_notification_title(int download_id, char **title); + /** - * @brief Set the description of notification. + * @brief Sets the description of a notification. + * + * @details When registering a notification, the description is displayed in the description area of the notification message. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @details When registering notification, the description is displayed at description area of notification message + * @param[in] download_id The download ID + * @param[in] description The description for displaying to user * - * @param [in] download The download id - * @param [in] description The description for displaying to user - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre If the notification option is not enable, this description is not shown to user - * @see #download_set_notification_type() - * @see #download_get_notification_description() + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre If the notification option is not enabled, this description is not shown to user. + * + * @see download_set_notification_type() + * @see download_get_notification_description() */ int download_set_notification_description(int download_id, const char *description); + /** - * @brief Gets the description of notification when set in #download_set_notification_description() + * @brief Gets the description of a notification set by download_set_notification_description(). + * + * @details When registering a notification, the description is displayed in the description area of the notification message. * - * @details When registering notification, the description is displayed at description area of notification message + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download * - * @param [in] download The download id - * @param [out] description The description for displaying to user - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[out] description The description for displaying to user + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @retval #DOWNLOAD_ERROR_NO_DATA the description have not been set + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_NO_DATA The description has not been set + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @pre It can get the title value before calling this API. - * @see #download_set_notification_description() + * + * @see download_set_notification_description() */ int download_get_notification_description(int download_id, char **description); + /** - * @brief Sets the option value to register notification messages. - * @details The three types of notification message can be posted. Those are completion, failed and ongoing type. + * @brief Sets an option value to register notification messages. + * @details Three types of notification message can be posted: completion, failed and ongoing type. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks When the notification message is clicked, the action to take is decided by the app control handle (set by download_set_notification_app_control()). \n + * If the app control is not set, the following default operation is executed when the notification message is clicked: \n + * 1) download completed state - the viewer application is executed according to extension name of downloaded content, \n + * 2) download failed state and ongoing state - the client application is executed. \n + * The default type is #DOWNLOAD_NOTIFICATION_TYPE_NONE. \n + * This function should be called before starting the download. + * + * @param[in] download_id The download ID + * @param[in] type The enumeration type \n + * See #download_notification_type_e. + * + * @return @c 0 on success, + * otherwise a negative error value * - * @remarks When the notification message is clicked, the action is decided by bundle data from download_set_notification_bundle(). \n - * If the bundle data is not set, the following default operation is executed when the notification message is clicked. \n - * 1) Download completed state : The viewer application is executed according to extension name of downloaded content. \n - * 2) Download failed state and ongoing state : The client application is executed. \n - * @remarks The default type is #DOWNLOAD_NOTIFICATION_TYPE_NONE. - * @remarks This function should be called before starting download. - * @param[in] download The download id - * @param[in] type The enumeration type. See #download_notification_type_e. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID - * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, #DOWNLOAD_STATE_CANCELED - * @see download_set_notification_bundle() + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @pre The state must be #DOWNLOAD_STATE_READY, #DOWNLOAD_STATE_FAILED, or #DOWNLOAD_STATE_CANCELED. + * + * @see download_set_notification_app_control() * @see download_get_notification_type() */ int download_set_notification_type(int download_id, download_notification_type_e type); + /** - * @brief Get the option value to register notification messages which is set in download_set_notification_type(). + * @brief Gets an option value to register notification messages set by download_set_notification_type(). + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks When the notification message is clicked, the action is decided by the app control from download_set_notification_app_control(). \n + * The default type is #DOWNLOAD_NOTIFICATION_TYPE_NONE. * - * @remarks When the notification message is clicked, the action is decided by bundle data from download_set_notification_bundle(). \n - * @remarks The default type is #DOWNLOAD_NOTIFICATION_TYPE_NONE. - * @param[in] download The download id - * @param[out] type The enumeration type. See #download_notification_type_e. - * @return 0 on success, otherwise a negative error value. - * @retval #DOWNLOAD_ERROR_NONE Successful + * @param[in] download_id The download ID + * @param[out] type The enumeration type \n + * See #download_notification_type_e. + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No Download ID + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * * @see download_set_notification_type() */ int download_get_notification_type(int download_id, download_notification_type_e *type); + +/** + * @brief Gets an etag value from the HTTP response header when making a HTTP request for resume. + * + * @since_tizen 2.3 + * @privlevel public + * @privilege %http://tizen.org/privilege/download + * + * @remarks The etag value is available or not depending on the web server. \n + * After download is started, it can get the etag value. + * + * @param[in] download_id The download ID + * @param[out] etag The etag value + * + * @return @c 0 on success, + * otherwise a negative error value + * + * @retval #DOWNLOAD_ERROR_NONE Successful + * @retval #DOWNLOAD_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DOWNLOAD_ERROR_ID_NOT_FOUND No download ID + * @retval #DOWNLOAD_ERROR_PERMISSION_DENIED Permission denied + * + * @see download_set_temp_file_path() + */ +int download_get_etag(int download_id, char **etag); /** * @} */ diff --git a/include/download_doc.h b/include/download_doc.h deleted file mode 100755 index 13ab995..0000000 --- a/include/download_doc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __TIZEN_WEB_DOWNLOAD_DOC_H__ -#define __TIZEN_WEB_DOWNLOAD_DOC_H__ - -/** - * @ingroup CAPI_WEB_FRAMEWORK - * @defgroup CAPI_WEB_DOWNLOAD_MODULE Download - * @brief The DOWNLOAD API provides functions to create and manage one or more download requests. - * - * @section CAPI_WEB_DOWNLOAD_MODULE_HEADER Required Header - * \#include - * - * @section CAPI_WEB_DOWNLOAD_MODULE_OVERVIEW Overview - * The DOWNLOAD API provides functions to create and manage one or more download requests. - * - * Major features : - * - After getting download_id from download_create(), other APIs use download_id as parameter. - * - Even if the device is off, download_id is available for 48 hours if user did't call download_destroy(). - * - support the callback that called whenever changed the status of download. - * - Even if the client process is terminated, download is going on. - * If wanna stop a download, download_cancel() or download_destroy() should be called. - * - */ - -#endif /* __TIZEN_WEB_DOWNLOAD_DOC_H__ */ diff --git a/packaging/capi-web-url-download.spec b/packaging/capi-web-url-download.spec index 1ebf1ad..60147cb 100755 --- a/packaging/capi-web-url-download.spec +++ b/packaging/capi-web-url-download.spec @@ -1,7 +1,7 @@ Name: capi-web-url-download Summary: CAPI for content download with web url -Version: 1.1.1 +Version: 1.2.6 Release: 0 Group: Development/Libraries License: Apache License, Version 2.0 @@ -9,7 +9,7 @@ URL: N/A Source0: %{name}-%{version}.tar.gz BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(dlog) -BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(capi-appfw-application) BuildRequires: pkgconfig(download-provider-interface) BuildRequires: cmake @@ -28,11 +28,9 @@ CAPI for content downloading with web url (developement files) %setup -q %build -%if 0%{?tizen_build_binary_release_type_eng} -export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" -export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" -export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" -%endif +export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" +export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" +export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" %cmake . make %{?jobs:-j%jobs} @@ -60,21 +58,3 @@ mkdir -p %{buildroot}/usr/share/license %{_includedir}/web/download.h %{_includedir}/web/download_doc.h -%changelog -* Thu Sep 26 2013 Jungki Kwak -- Add error exception code for invalid parameter -- Add a missed deprecate API - -* Wed Sep 11 2013 Jungki Kwak -- Add missed code to set manifest file -- Deprecate old APIs for notification -- Add new APIs for notification and bundle data - -* Tue Jul 03 2013 Jungki Kwak -- Add enum error about smack deny - -* Wed Jun 12 2013 Jungki Kwak -- Remove the define of download service operation -- Update doxygen comments -- Remove unused file - diff --git a/script/commit-template b/script/commit-template new file mode 100644 index 0000000..f642dd2 --- /dev/null +++ b/script/commit-template @@ -0,0 +1,11 @@ +Title + +[Title] +[Issue#] N/A +[Problem] N/A +[Cause] N/A +[Solution] N/A + +# please fill the each items. +# If this is the commit to fix issue, please replace N/A to the number of issue. + diff --git a/src/download-wrapping.c b/src/download-wrapping.c index d309120..fcb4d33 100755 --- a/src/download-wrapping.c +++ b/src/download-wrapping.c @@ -40,6 +40,8 @@ LOGI(format, ##ARG); \ int download_create(int *download_id) { TRACE_INFO(""); + if (download_id == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_create(download_id); } @@ -71,6 +73,8 @@ int download_cancel(int download_id) int download_set_url(int download_id, const char *url) { TRACE_INFO(""); + if (url == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_set_url(download_id, url); } @@ -78,6 +82,8 @@ int download_set_url(int download_id, const char *url) int download_get_url(int download_id, char **url) { TRACE_INFO(""); + if (url == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_url(download_id, url); } @@ -104,38 +110,13 @@ int download_get_network_type(int download_id, return ret; } -int download_set_destination(int download_id, const char *path) +int download_set_network_bonding(int download_id, bool enable) { TRACE_INFO(""); - return dp_interface_set_destination(download_id, path); + return dp_interface_set_network_bonding(download_id, (int)enable); } - -int download_get_destination(int download_id, char **path) -{ - TRACE_INFO(""); - return dp_interface_get_destination(download_id, path); -} - -int download_set_file_name(int download_id, const char *file_name) -{ - TRACE_INFO(""); - return dp_interface_set_file_name(download_id, file_name); -} - -int download_get_file_name(int download_id, char **file_name) -{ - TRACE_INFO(""); - return dp_interface_get_file_name(download_id, file_name); -} - -int download_set_notification(int download_id, bool enable) -{ - TRACE_INFO(""); - return dp_interface_set_notification(download_id, (int)enable); -} - -int download_get_notification(int download_id, bool *enable) +int download_get_network_bonding(int download_id, bool *enable) { int is_set = 0; TRACE_INFO(""); @@ -143,44 +124,59 @@ int download_get_notification(int download_id, bool *enable) TRACE_ERROR("Parameter NULL Check"); return DOWNLOAD_ERROR_INVALID_PARAMETER; } - int ret = dp_interface_get_notification(download_id, &is_set); + int ret = dp_interface_get_network_bonding(download_id, &is_set); if (ret == DOWNLOAD_ADAPTOR_ERROR_NONE) *enable = (bool)is_set; return ret; } -int download_get_downloaded_file_path(int download_id, char **path) +int download_set_destination(int download_id, const char *path) { TRACE_INFO(""); - return dp_interface_get_downloaded_file_path(download_id, path); + if (path == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_set_destination(download_id, path); +} + + +int download_get_destination(int download_id, char **path) +{ + TRACE_INFO(""); + if (path == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_get_destination(download_id, path); } -int download_add_notification_extra_param( - int download_id, const char *key, - const char **value, const unsigned int length) +int download_set_file_name(int download_id, const char *file_name) { TRACE_INFO(""); - return dp_interface_add_noti_extra(download_id, key, value, length); + if (file_name == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_set_file_name(download_id, file_name); } -int download_remove_notification_extra_param(int download_id, const char *key) +int download_get_file_name(int download_id, char **file_name) { TRACE_INFO(""); - return dp_interface_remove_noti_extra_key(download_id, key); + if (file_name == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_get_file_name(download_id, file_name); } -int download_get_notification_extra_param( - int download_id, const char *key, - char ***values, unsigned int *length) +int download_get_downloaded_file_path(int download_id, char **path) { TRACE_INFO(""); - return dp_interface_get_noti_extra_values(download_id, key, values, length); + if (path == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_get_downloaded_file_path(download_id, path); } int download_add_http_header_field(int download_id, const char *field, const char *value) { TRACE_INFO(""); + if (field == NULL || value == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_add_http_header_field(download_id, field, value); } @@ -189,6 +185,8 @@ int download_get_http_header_field(int download_id, const char *field, char **value) { TRACE_INFO(""); + if (field == NULL || value == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_http_header_field(download_id, field, value); } @@ -197,6 +195,8 @@ int download_get_http_header_field_list(int download_id, char ***fields, int *length) { TRACE_INFO(""); + if (fields == NULL || length == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_http_header_field_list(download_id, fields, length); } @@ -205,6 +205,8 @@ int download_remove_http_header_field(int download_id, const char *field) { TRACE_INFO(""); + if (field == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_remove_http_header_field(download_id, field); } @@ -255,12 +257,16 @@ int download_get_state(int download_id, download_state_e *state) int download_get_temp_path(int download_id, char **temp_path) { TRACE_INFO(""); + if (temp_path == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_temp_path(download_id, temp_path); } int download_get_content_name(int download_id, char **content_name) { TRACE_INFO(""); + if (content_name == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_content_name(download_id, content_name); } @@ -268,12 +274,16 @@ int download_get_content_size(int download_id, unsigned long long *content_size) { TRACE_INFO(""); + if (content_size == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_content_size(download_id, content_size); } int download_get_mime_type(int download_id, char **mime_type) { TRACE_INFO(""); + if (mime_type == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_mime_type(download_id, mime_type); } @@ -314,42 +324,56 @@ int download_get_error(int download_id, download_error_e *error) int download_get_http_status(int download_id, int *http_status) { TRACE_INFO(""); + if (http_status == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_http_status(download_id, http_status); } -int download_set_notification_bundle(int download_id, download_notification_bundle_type_e type, bundle *b) +int download_set_notification_app_control(int download_id, download_notification_app_control_type_e type, app_control_h handle) { TRACE_INFO(""); - return dp_interface_set_notification_bundle(download_id, (int)type, b); + if (handle == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_set_notification_service_handle(download_id, (int)type, handle); } -int download_get_notification_bundle(int download_id, download_notification_bundle_type_e type, bundle **b) +int download_get_notification_app_control(int download_id, download_notification_app_control_type_e type, app_control_h *handle) { TRACE_INFO(""); - return dp_interface_get_notification_bundle(download_id, (int)type, b); + if (handle == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_get_notification_service_handle(download_id, (int)type, handle); } int download_set_notification_title(int download_id, const char *title) { TRACE_INFO(""); + if (title == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_set_notification_title(download_id, title); } int download_get_notification_title(int download_id, char **title) { TRACE_INFO(""); + if (title == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_notification_title(download_id, title); } int download_set_notification_description(int download_id, const char *description) { TRACE_INFO(""); + if (description == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_set_notification_description(download_id, description); } int download_get_notification_description(int download_id, char **description) { TRACE_INFO(""); + if (description == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; return dp_interface_get_notification_description(download_id, description); } @@ -373,3 +397,18 @@ int download_get_notification_type(int download_id, download_notification_type_e return ret; } +int download_get_etag(int download_id, char **etag) +{ + TRACE_INFO(""); + if (etag == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_get_etag(download_id, etag); +} + +int download_set_temp_file_path(int download_id, char *path) +{ + TRACE_INFO(""); + if (path == NULL) + return DOWNLOAD_ERROR_INVALID_PARAMETER; + return dp_interface_set_temp_file_path(download_id, path); +} -- 2.7.4