2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file libprivilege-control_test_db.h
19 * @author Lukasz Wojciechowski (l.wojciechow@partner.samsung.com)
21 * @brief libprivilege-control tests database record check functions
24 #ifndef LIBPRIVILEGE_CONTROL_TEST_DB_H_
25 #define LIBPRIVILEGE_CONTROL_TEST_DB_H_
27 #include <privilege-control.h>
28 #include "libprivilege-control_test_common.h"
29 #include "db_sqlite.h"
32 * @class TestLibPrivilegeControlDatabase
33 * @brief Class containing methods for testing libprivlege database.
35 class TestLibPrivilegeControlDatabase
39 * @brief A constructor
41 TestLibPrivilegeControlDatabase();
46 ~TestLibPrivilegeControlDatabase() = default;
49 * @brief Method for testing database after "perm_app_install" was run.
51 * It checks existence of proper: label, app records and permission for ALL_APPS for installed app.
53 * @param name name of installed app
55 void test_db_after__perm_app_install(const char* name);
58 * @brief Method for testing database after "perm_app_uninstall" was run.
60 * It checks absence of proper: label for installed app.
62 * @param name name of uninstalled app
64 void test_db_after__perm_app_uninstall(const char* name);
67 * @brief Method for testing database after "perm_app_enable_permissions" was run.
69 * It checks existence of proper permissions from perm_list and main permission for whole app_type.
71 * @param name name of application
72 * @param app_type type of application (EFL, WRT, etc. )
73 * @param perm_list list of permission to enable
74 * @param persistent persistence or volatileness of permissions
76 void test_db_after__perm_app_enable_permissions(const char* name, app_type_t app_type,
77 const char** perm_list, bool persistent);
82 * @brief Sqlite3DBase object giving simple access to database
84 * Connection to database is open first time it is needed
85 * and closed in destructor of TestLibPrivilegeControlDatabase.
90 * @brief Check existence of label related records for given app.
92 * @param app_name name of application
94 void app_label(const std::string& app_name);
97 * @brief Check absence of label record for given app.
99 * @param app_name name of application
101 void app_not_label(const std::string& app_name);
104 * @brief It checks existence of single permission.
106 * @param app_name name of application
107 * @param permission_name name of permission
108 * @param permission_type_name name of permission type
109 * @param is_volatile persistence or volatileness of permissions
110 * @param is_enabled permission enable flag
112 void app_permission(const std::string& app_name, const std::string& permission_name,
113 const std::string& permission_type_name, int is_volatile, int is_enabled);
116 #endif /* LIBPRIVILEGE_CONTROL_TEST_DB_H_ */