tizen beta release
[platform/core/appfw/app-checker.git] / TC / unit / utc_ApplicationFW_ac_register_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_register_launch_privilege_func_01(void);
31 static void utc_ApplicationFW_ac_register_launch_privilege_func_02(void);
32 static void utc_ApplicationFW_ac_register_launch_privilege_func_03(void);
33 static void utc_ApplicationFW_ac_register_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_register_launch_privilege_func_01,
42          POSITIVE_TC_IDX},
43         {utc_ApplicationFW_ac_register_launch_privilege_func_02,
44          NEGATIVE_TC_IDX},
45         {utc_ApplicationFW_ac_register_launch_privilege_func_03,
46          NEGATIVE_TC_IDX},
47         {utc_ApplicationFW_ac_register_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 /** API Prototype
60 *int ac_register_launch_privilege(const char *pkg_name,
61 *                                const char *pkg_type);
62 */
63
64 /**
65  * @brief Positive test case of ac_register_launch_privilege()
66  */
67 static void utc_ApplicationFW_ac_register_launch_privilege_func_01(void)
68 {
69         int r = AC_R_ERROR;
70         r = ac_register_launch_privilege("org.tizen.calculator", "deb");
71         if (r < 0 && r != AC_R_ENOPULUGINS) {
72                 tet_infoline
73                     ("ac_register_launch_privilege()"
74                      " failed in positive test case");
75                 tet_result(TET_FAIL);
76                 return;
77         }
78         tet_result(TET_PASS);
79 }
80
81 /**
82  * @brief Negative test case 01 of ac_register_launch_privilege()
83  */
84 static void utc_ApplicationFW_ac_register_launch_privilege_func_02(void)
85 {
86         int r = AC_R_ERROR;
87         r = ac_register_launch_privilege(NULL, "deb");
88         if (r != AC_R_EINVAL) {
89                 tet_infoline
90                     ("ac_register_launch_privilege()"
91                      " failed in negative test case");
92                 tet_result(TET_FAIL);
93                 return;
94         }
95         tet_result(TET_PASS);
96 }
97
98 /**
99  * @brief Negative test case 02 of ac_register_launch_privilege()
100  */
101 static void utc_ApplicationFW_ac_register_launch_privilege_func_03(void)
102 {
103         int r = AC_R_ERROR;
104         r = ac_register_launch_privilege("org.tizen.calculator", NULL);
105         if (r != AC_R_EINVAL) {
106                 tet_infoline
107                     ("ac_register_launch_privilege()"
108                      " failed in negative test case");
109                 tet_result(TET_FAIL);
110                 return;
111         }
112         tet_result(TET_PASS);
113 }
114
115 /**
116  * @brief Negative test case 03 of ac_register_launch_privilege()
117  */
118 static void utc_ApplicationFW_ac_register_launch_privilege_func_04(void)
119 {
120         int r = AC_R_ERROR;
121         r = ac_register_launch_privilege(NULL, NULL);
122         if (r != AC_R_EINVAL) {
123                 tet_infoline
124                     ("ac_register_launch_privilege()"
125                      " failed in negative test case");
126                 tet_result(TET_FAIL);
127                 return;
128         }
129         tet_result(TET_PASS);
130 }