tizen 2.3 release
[framework/api/url-download.git] / TC / testcase / utc_download_get_notification_bundle_positive.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_notification_bundle_positive1(void);
27
28 struct tet_testlist tet_testlist[] = {
29         {utc_download_get_notification_bundle_positive1, 1},
30         {NULL, 0},
31 };
32
33 static void startup(void)
34 {
35
36 }
37
38 static void cleanup(void)
39 {
40         /* end of TC */
41 }
42
43 void utc_download_get_notification_bundle_positive1(void)
44 {
45         const char *TC_NAME = __FUNCTION__;
46         int retcode = 0;
47         char *input = "ongoing";
48         char *output = NULL;
49         int id = 0;
50         bundle *b = bundle_create();
51         bundle *b_db = NULL;
52         bundle_add(b, "key", input);
53
54         download_create(&id);
55         download_set_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, b);
56         retcode = download_get_notification_bundle(id, DOWNLOAD_NOTIFICATION_BUNDLE_TYPE_ONGOING, &b_db);
57         output = bundle_get_val(b_db, "key");
58         download_destroy(id);
59         if (retcode == DOWNLOAD_ERROR_NONE && !strcmp(input, output))
60                 dts_pass(TC_NAME, "retcode has no error and the bundle of set API is same to bundle of get API ");
61         else
62                 dts_fail(TC_NAME, "retcode has error or the bundle of set API is not same to bundle of get API");
63         bundle_free(b);
64         bundle_free(b_db);
65 }
66