tizen 2.3 release
[framework/api/url-download.git] / TC / testcase / utc_download_remove_http_header_field_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_remove_http_header_field_negative1(void);
27 static void utc_download_remove_http_header_field_negative2(void);
28 static void utc_download_remove_http_header_field_negative3(void);
29
30 struct tet_testlist tet_testlist[] = {
31         {utc_download_remove_http_header_field_negative1, 1},
32         {utc_download_remove_http_header_field_negative2, 2},
33         {utc_download_remove_http_header_field_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_remove_http_header_field_negative1(void)
48 {
49         const char *TC_NAME = __FUNCTION__;
50         int retcode = 0;
51         char *field = "negativefield1";
52         int id = 0;
53
54         download_create(&id);
55         retcode = download_remove_http_header_field(id, field);
56         download_destroy(id);
57         
58         dts_message(TC_NAME, "retcode[%d]",retcode);
59         if (retcode != DOWNLOAD_ERROR_NONE)
60                 dts_pass(TC_NAME, "retcode has error about no found field");
61         else
62                 dts_fail(TC_NAME, "retcode does not have error about no found field");
63 }
64
65 void utc_download_remove_http_header_field_negative2(void)
66 {
67         const char *TC_NAME = __FUNCTION__;
68         int retcode = 0;
69         char *field = "negativefield2";
70         int id = 0;
71
72         download_create(&id);
73         retcode = download_remove_http_header_field(-1, field);
74         download_destroy(id);
75
76         if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER)
77                 dts_pass(TC_NAME, "retcode has invalid parameter");
78         else
79                 dts_fail(TC_NAME, "retcode does not have invalid parameter");
80 }
81
82 void utc_download_remove_http_header_field_negative3(void)
83 {
84         const char *TC_NAME = __FUNCTION__;
85         int retcode = 0;
86         int id = 0;
87
88         download_create(&id);
89         retcode = download_remove_http_header_field(id, NULL);
90         download_destroy(id);
91
92         if (retcode == DOWNLOAD_ERROR_INVALID_PARAMETER)
93                 dts_pass(TC_NAME, "retcode has invalid parameter");
94         else
95                 dts_fail(TC_NAME, "retcode does not have invalid parameter");
96 }
97
98