tizen 2.3 release
[framework/api/url-download.git] / TC / testcase / utc_download_get_content_size_negative.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <tet_api.h>
18 #include <download.h>
19
20 static void startup(void);
21 static void cleanup(void);
22
23 void (*tet_startup)(void) = startup;
24 void (*tet_cleanup)(void) = cleanup;
25
26 static void utc_download_get_content_size_negative1(void);
27 static void utc_download_get_content_size_negative2(void);
28 static void utc_download_get_content_size_negative3(void);
29
30 struct tet_testlist tet_testlist[] = {
31         {utc_download_get_content_size_negative1, 1},
32         {utc_download_get_content_size_negative2, 2},
33         {utc_download_get_content_size_negative3, 3},
34         {NULL, 0},
35 };
36
37 static void startup(void)
38 {
39
40 }
41
42 static void cleanup(void)
43 {
44         /* end of TC */
45 }
46
47 void utc_download_get_content_size_negative1(void)
48 {
49         const char *TC_NAME = __FUNCTION__;
50         int retcode = 0;
51         unsigned long long output = 0;
52
53         retcode = download_get_content_size(-1, &output);
54
55         if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER)
56                 dts_pass(TC_NAME, "retcode has invalid parameter");
57         else
58                 dts_fail(TC_NAME, "retcode does not have invalid parameter");
59 }
60
61 void utc_download_get_content_size_negative2(void)
62 {
63         const char *TC_NAME = __FUNCTION__;
64         int retcode = 0;
65         int id = 0;
66         
67         download_create(&id);
68         retcode = download_get_content_size(id, NULL);
69         download_destroy(id);
70
71         if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER)
72                 dts_pass(TC_NAME, "retcode has invalid parameter");
73         else
74                 dts_fail(TC_NAME, "retcode does not have invalid parameter");
75 }
76
77 void utc_download_get_content_size_negative3(void)
78 {
79         const char *TC_NAME = __FUNCTION__;
80         int retcode = 0;
81
82         retcode = download_get_content_size(-1, NULL);
83
84         if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER)
85                 dts_pass(TC_NAME, "retcode has invalid parameter");
86         else
87                 dts_fail(TC_NAME, "retcode does not have invalid parameter");
88 }
89