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