4 #include <privilege_information.h>
8 #define LOG_TAG "PRIVILEGE_INFO_TEST_APP"
12 static int fail_cnt = 0;
13 static int success_cnt = 0;
15 static const char *__get_result_string(privilege_info_error_e ret)
17 if (ret == PRVINFO_ERROR_NONE)
18 return "PRVINFO_ERROR_NONE";
19 else if (ret == PRVINFO_ERROR_INVALID_PARAMETER)
20 return "PRVINFO_ERROR_INVALID_PARAMETER";
21 else if (ret == PRVINFO_ERROR_INTERNAL_ERROR)
22 return "PRVINFO_ERROR_INTERNAL_ERROR";
23 else if (ret == PRVINFO_ERROR_OUT_OF_MEMORY)
24 return "PRVINFO_ERROR_UNDECLARED_PRIVILEGE";
29 static void __check_result(privilege_info_error_e expected_result, privilege_info_error_e result, bool expected_status, bool status)
31 LOGD("expected result = %s, result = %s", __get_result_string(expected_result), __get_result_string(result));
32 LOGD("expected status = %s, status = %s", expected_status ? "true" : "false", status ? "true" : "false");
34 if (expected_result != result) {
38 if (expected_status != status) {
48 static void __test_privilege_info_get_privacy_privilege_status()
50 int ret = PRVINFO_ERROR_NONE;
53 LOGD("-----------------------------------------------------------");
54 LOGD("privilege : http://tizen.org/privilege/account.read");
55 LOGD("expected result : PRVINFO_ERROR_NONE");
56 ret = privilege_info_get_privacy_privilege_status("http://tizen.org/privilege/account.read", &status);
57 __check_result(PRVINFO_ERROR_NONE, ret, true, status);
58 LOGD("-----------------------------------------------------------");
60 LOGD("privilege : http://tizen.org/privilege/contact.read");
61 LOGD("expected result : PRVINFO_ERROR_NONE");
62 ret = privilege_info_get_privacy_privilege_status("http://tizen.org/privilege/contact.read", &status);
63 __check_result(PRVINFO_ERROR_NONE, ret, false, status);
64 LOGD("-----------------------------------------------------------");
66 LOGD("privilege : http://tizen.org/privilege/aaaaa");
67 LOGD("expected result : PRVINFO_ERROR_INVALID_PARAMETER");
68 ret = privilege_info_get_privacy_privilege_status("http://tizen.org/privilege/aaaaa", &status);
69 __check_result(PRVINFO_ERROR_INVALID_PARAMETER, ret, true, status);
70 LOGD("-----------------------------------------------------------");
76 LOGD("Test function : privilege_info_get_privacy_privilege_status");
77 __test_privilege_info_get_privacy_privilege_status();
79 LOGD("====================================");
80 LOGD("Test Complete");
81 LOGD("success : %d, ", success_cnt);
82 LOGD("fail : %d", fail_cnt);
83 LOGD("====================================");