Merge branch 'tizen' into security-manager
[platform/core/test/security-tests.git] / src / security-manager-tests / common / sm_user_request.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef SECURITY_MANAGER_TEST_USERREQUEST
18 #define SECURITY_MANAGER_TEST_USERREQUEST
19
20 #include <iostream>
21 #include <sys/types.h>
22 #include <utility>
23
24 #include <security-manager.h>
25
26 namespace SecurityManagerTest {
27
28 class UserRequest
29 {
30 public:
31     UserRequest();
32     UserRequest(const UserRequest&) = delete;
33     UserRequest& operator=(const UserRequest&) = delete;
34     ~UserRequest();
35
36     void setUid(const uid_t uid, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS);
37     void setUserType(const security_manager_user_type utype,
38                      lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS);
39
40     const user_req *get() const { return m_req; }
41     friend std::ostream& operator<<(std::ostream &, const UserRequest&);
42
43 private:
44     user_req *m_req;
45
46     std::pair<bool, uid_t> m_uid;
47     std::pair<bool, security_manager_user_type> m_utype;
48 };
49
50 std::ostream& operator<<(std::ostream &os, const SecurityManagerTest::UserRequest &request);
51
52 } // namespace SecurityManagerTest
53
54 #endif // SECURITY_MANAGER_TEST_USERREQUEST