upload tizen1.0 source
[framework/appfw/app-checker.git] / TC / unit / utc_ApplicationFW_ac_unregister_launch_privilege_func.c
1 /*
2  *  app-checker
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7  * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  */
22 #include <tet_api.h>
23 #include <app-checker.h>
24 static void startup(void);
25 static void cleanup(void);
26
27 void (*tet_startup) (void) = startup;
28 void (*tet_cleanup) (void) = cleanup;
29
30 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_01(void);
31 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_02(void);
32 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_03(void);
33 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_04(void);
34
35 enum {
36         POSITIVE_TC_IDX = 0x01,
37         NEGATIVE_TC_IDX,
38 };
39
40 struct tet_testlist tet_testlist[] = {
41         {utc_ApplicationFW_ac_unregister_launch_privilege_func_01,
42          POSITIVE_TC_IDX},
43         {utc_ApplicationFW_ac_unregister_launch_privilege_func_02,
44          NEGATIVE_TC_IDX},
45         {utc_ApplicationFW_ac_unregister_launch_privilege_func_03,
46          NEGATIVE_TC_IDX},
47         {utc_ApplicationFW_ac_unregister_launch_privilege_func_04,
48          NEGATIVE_TC_IDX},
49         {NULL, 0},
50 };
51
52 static void startup(void)
53 {
54 }
55
56 static void cleanup(void)
57 {
58 }
59
60 /** API Prototype
61 *int ac_unregister_launch_privilege(const char *pkg_name,
62 *                               const char *pkg_type);
63 */
64
65
66 /**
67  * @brief Positive test case of ac_unregister_launch_privilege()
68  */
69 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_01(void)
70 {
71         int r = AC_R_ERROR;
72         r = ac_unregister_launch_privilege("org.tizen.calculator", "deb");
73         if (r < 0 && r != AC_R_ENOPULUGINS) {
74                 tet_infoline
75                     ("ac_unregister_launch_privilege()"
76                      " failed in positive test case");
77                 tet_result(TET_FAIL);
78                 return;
79         }
80         tet_result(TET_PASS);
81 }
82
83 /**
84  * @brief Negative test case 01 of ac_unregister_launch_privilege()
85  */
86 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_02(void)
87 {
88         int r = AC_R_ERROR;
89         r = ac_unregister_launch_privilege(NULL, "deb");
90         if (r != AC_R_EINVAL) {
91                 tet_infoline
92                     ("ac_unregister_launch_privilege()"
93                      " failed in negative test case");
94                 tet_result(TET_FAIL);
95                 return;
96         }
97         tet_result(TET_PASS);
98 }
99
100 /**
101  * @brief Negative test case 02 of ac_unregister_launch_privilege()
102  */
103 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_03(void)
104 {
105         int r = AC_R_ERROR;
106         r = ac_unregister_launch_privilege("org.tizen.calculator", NULL);
107         if (r != AC_R_EINVAL) {
108                 tet_infoline
109                     ("ac_unregister_launch_privilege()"
110                      " failed in negative test case");
111                 tet_result(TET_FAIL);
112                 return;
113         }
114         tet_result(TET_PASS);
115 }
116
117 /**
118  * @brief Negative test case 03 of ac_unregister_launch_privilege()
119  */
120 static void utc_ApplicationFW_ac_unregister_launch_privilege_func_04(void)
121 {
122         int r = AC_R_ERROR;
123         r = ac_unregister_launch_privilege(NULL, NULL);
124         if (r != AC_R_EINVAL) {
125                 tet_infoline
126                     ("ac_unregister_launch_privilege()"
127                      " failed in negative test case");
128                 tet_result(TET_FAIL);
129                 return;
130         }
131         tet_result(TET_PASS);
132 }