3 #include <privilege_package_info.h>
6 static void __test_privilege_package_info()
11 gfree(privilege_list);
13 __tcinfo(goal, "set 5001, org.test.nativeapp privacy privilege set. api_version = 3.0");
14 __privinfo("http://tizen.org/privilege/internet", NULL, NULL);
15 __privinfo("http://tizen.org/privilege/call", NULL, NULL);
16 __privinfo("http://tizen.org/privilege/bookmark.admin", NULL, NULL);
17 __privinfo("http://tizen.org/privilege/keygrab", NULL, NULL);
18 __privinfo("http://tizen.org/privilege/account.read", NULL, NULL);
19 __privinfo("http://tizen.org/privilege/account.write", NULL, NULL);
20 __privinfo("http://tizen.org/privilege/display", NULL, NULL);
21 ret = privilege_package_info_set_privacy_privilege(5001, "org.test.nativeapp", PRVMGR_PACKAGE_TYPE_CORE, "3.0", privilege_list);
22 __tcinfo(expect, PRVMGR_ERR_NONE);
23 __print_result('m', ret);
24 gfree(privilege_list);
27 __tcinfo(goal, "set 5001, org.test.nativeapp critical privilege set. api_version = 3.0");
28 __privinfo("http://tizen.org/privilege/internet", NULL, NULL);
29 __privinfo("http://tizen.org/privilege/call", NULL, NULL);
30 __privinfo("http://tizen.org/privilege/account.read", NULL, NULL);
31 __privinfo("http://tizen.org/privilege/display", NULL, NULL);
32 ret = privilege_package_info_set_critical_privilege(5001, "org.test.nativeapp", PRVMGR_PACKAGE_TYPE_CORE, "3.0", privilege_list);
33 __tcinfo(expect, PRVMGR_ERR_NONE);
34 __print_result('m', ret);
35 gfree(privilege_list);
38 __tcinfo(goal, "set 5001, org.test.webapp's privacy privilege set. api_version = 4.0");
39 __privinfo("http://tizen.org/privilege/internet", NULL, NULL);
40 __privinfo("http://tizen.org/privilege/call", NULL, NULL);
41 __privinfo("http://tizen.org/privilege/bookmark.read", NULL, NULL);
42 __privinfo("http://tizen.org/privilege/mediacapture", NULL, NULL);
43 __privinfo("http://tizen.org/privilege/account.read", NULL, NULL);
44 __privinfo("http://tizen.org/privilege/download", NULL, NULL);
45 __privinfo("http://tizen.org/privilege/messaging.write", NULL, NULL);
46 ret = privilege_package_info_set_privacy_privilege(5001, "org.test.webapp", PRVMGR_PACKAGE_TYPE_WRT, "4.0", privilege_list);
47 __tcinfo(expect, PRVMGR_ERR_NONE);
48 __print_result('m', ret);
49 gfree(privilege_list);
52 __tcinfo(goal, "set 5001, org.test.webapp's critical privilege set. api_version = 4.0");
53 __privinfo("http://tizen.org/privilege/internet", NULL, NULL);
54 __privinfo("http://tizen.org/privilege/messaging.write", NULL, NULL);
55 __privinfo("http://tizen.org/privilege/mediacapture", NULL, NULL);
56 __privinfo("http://tizen.org/privilege/download", NULL, NULL);
57 ret = privilege_package_info_set_critical_privilege(5001, "org.test.webapp", PRVMGR_PACKAGE_TYPE_WRT, "4.0", privilege_list);
58 __tcinfo(expect, PRVMGR_ERR_NONE);
59 __print_result('m', ret);
60 gfree(privilege_list);
63 __tcinfo(goal, "see if http://tizen.org/privilege/message.read is critical for uid 5001, org.test.webapp");
64 ret = privilege_package_info_is_critical_privilege(5001, "org.test.webapp", "http://tizen.org/privilege/message.read", &is_requestable);
65 if (is_requestable && ret == PRVMGR_ERR_NONE) {
66 printf_green("\nis critical privilege. SUCCESS\n");
69 printf_red("\nFAIL\n");
74 __tcinfo(goal, "see if http://tizen.org/privilege/internet is critical for uid 5001, org.test.webapp");
75 ret = privilege_package_info_is_critical_privilege(5001, "org.test.webapp", "http://tizen.org/privilege/internet", &is_requestable);
76 if (!is_requestable && ret == PRVMGR_ERR_NONE) {
77 printf_green("\nis not critical privilege. SUCCESS\n");
80 printf_red("\nFAIL\n");
85 __tcinfo(goal, "see if uid 5001, org.test.nativeapp is privacy requestable");
86 ret = privilege_package_info_is_privacy_requestable(5001, "org.test.nativeapp", &is_requestable);
88 printf_red("\nFAIL\n");
90 } else if (ret == PRVMGR_ERR_NONE) {
91 printf_green("\nis old app. SUCCESS\n");
94 printf_red("\nFAIL\n");
99 __tcinfo(goal, "see if uid 5001, org.test.webapp is privacy requestable");
100 ret = privilege_package_info_is_privacy_requestable(5001, "org.test.webapp", &is_requestable);
101 if (is_requestable && ret == PRVMGR_ERR_NONE) {
102 printf_green("\nis privacy requestable app. SUCCESS\n");
105 printf_red("FAIL!!!!!!!!!!!!!!!!!!!!!!\n");
110 __tcinfo(goal, "get privacy list of org.test.nativeapp");
111 GList* tmp_list = NULL;
112 ret = privilege_package_info_get_privacy_list_by_pkgid(5001, "org.test.nativeapp", &tmp_list);
113 __tcinfo(expect, PRVMGR_ERR_NONE);
114 __print_result('m', ret);
115 if (tmp_list != NULL) {
116 __print_glist(tmp_list);
121 __tcinfo(goal, "get list of packaes with bookmark privacy");
122 ret = privilege_package_info_get_package_list_by_privacy(5001, "http://tizen.org/privacy/bookmark", &tmp_list);
123 __tcinfo(expect, PRVMGR_ERR_NONE);
124 __print_result('m', ret);
125 if (tmp_list != NULL) {
126 __print_glist(tmp_list);
131 __tcinfo(goal, "get list of packaes with camera privacy");
132 ret = privilege_package_info_get_package_list_by_privacy(5001, "http://tizen.org/privacy/camera", &tmp_list);
133 __tcinfo(expect, PRVMGR_ERR_NONE);
134 __print_result('m', ret);
135 if (tmp_list != NULL) {
136 __print_glist(tmp_list);
141 __tcinfo(goal, "get privilege list of org.test.nativeapp's account privacy");
142 ret = privilege_package_info_get_privilege_list_by_pkgid_and_privacy(5001, "org.test.nativeapp", "http://tizen.org/privacy/account", &tmp_list);
143 __tcinfo(expect, PRVMGR_ERR_NONE);
144 __print_result('m', ret);
145 if (tmp_list != NULL) {
146 __print_glist(tmp_list);
151 __tcinfo(goal, "get all privacy package list of uid 5001");
152 ret = privilege_package_info_get_all_privacy_package_list(5001, &tmp_list);
153 __tcinfo(expect, PRVMGR_ERR_NONE);
154 __print_result('m', ret);
155 if (tmp_list != NULL) {
156 __print_glist(tmp_list);
161 __tcinfo(goal, "unset 5001, org.test.nativeapp's package privilege info.");
162 ret = privilege_package_info_unset_package_privilege_info(5001, "org.test.nativeapp");
163 __tcinfo(expect, PRVMGR_ERR_NONE);
164 __print_result('m', ret);
167 __tcinfo(goal, "unset 5001, org.test.webapp's package privilege info.");
168 ret = privilege_package_info_unset_package_privilege_info(5001, "org.test.webapp");
169 __tcinfo(expect, PRVMGR_ERR_NONE);
170 __print_result('m', ret);
177 if (ENABLE_ASKUSER) {
178 __tcinfo(function, "privilege_package_info_set_privacy_privilege");
179 __tcinfo(function, "privilege_package_info_set_ciritical_privilege");
180 __tcinfo(function, "privilege_package_info_unset_package_privilege_info");
181 __tcinfo(function, "privilege_package_info_is_privacy_requestable");
182 __tcinfo(function, "privilege_package_info_is_privacy_requestable_api_version");
183 __tcinfo(function, "privilege_package_info_get_privacy_list_by_pkgid");
184 __tcinfo(function, "privilege_package_info_get_package_list_by_privacy");
185 __tcinfo(function, "privilege_package_info_get_privilege_list_by_pkgid_and_privacy");
186 __test_privilege_package_info();
189 printf_green("Test Complete\n");
190 printf_green("success : %d, ", success_cnt);
191 printf_red("fail : %d\n", fail_cnt);