X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fsecurity-manager-tests%2Fcommon%2Fsm_request.h;h=7d74f64b4d64f6923596d30ac5b1306d44021053;hb=80c0352db8c0790140e35994e72cbf2dfb6634cb;hp=0bd08783b3d20656bca572351b7da3788b647b46;hpb=9f4a36d7c674bcac2f60271556fbab5ddd5615c2;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git diff --git a/src/security-manager-tests/common/sm_request.h b/src/security-manager-tests/common/sm_request.h index 0bd0878..7d74f64 100644 --- a/src/security-manager-tests/common/sm_request.h +++ b/src/security-manager-tests/common/sm_request.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2014-2017 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,39 +24,97 @@ #include #include +#include namespace SecurityManagerTest { - +class InstallRequest; +void prepare_request(InstallRequest &request, + const std::string &app_id, + const std::string &pkg_id, + app_install_path_type pathType, + const std::string &path, + uid_t uid); class InstallRequest { public: InstallRequest(); InstallRequest(const InstallRequest&) = delete; InstallRequest& operator=(const InstallRequest&) = delete; + InstallRequest(InstallRequest &&other) + : m_req(std::move(other.m_req)), + m_appId(std::move(other.m_appId)), + m_pkgId(std::move(other.m_pkgId)), + m_authorId(std::move(other.m_authorId)), + m_privileges(std::move(other.m_privileges)), + m_paths(std::move(other.m_paths)), + m_uid(std::move(other.m_uid)) + { + other.m_req = nullptr; + other.m_uid.first = false; + other.m_uid.second = 0; + } ~InstallRequest(); - void setAppId(const char *appId, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); - void setPkgId(const char *pkgId, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); - void addPrivilege(const char *privilege, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); - void addPath(const char *path, app_install_path_type pathType, + void setAppTizenVersion(std::string tizenVer, + lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); + void setAppId(std::string appId, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); + void setPkgId(std::string pkgId, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); + void addPrivilege(Privilege privilege, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); + void addAppDefinedPrivilege(Privilege privilege, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS); + void addPath(std::string path, app_install_path_type pathType, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS); void setUid(const uid_t uid, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); - + void setAuthorId(std::string authorId, lib_retcode expectedResult= SECURITY_MANAGER_SUCCESS); + void setInstallType(const enum app_install_type &type, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS); + void setHybrid(lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS); + std::string getAppTizenVersion() const { return m_tizenVer; } + app_inst_req *get() { return m_req; } const app_inst_req *get() const { return m_req; } friend std::ostream& operator<<(std::ostream &, const InstallRequest&); private: app_inst_req *m_req; - const char *m_appId; - const char *m_pkgId; - std::vector m_privileges; + std::string m_tizenVer; + std::string m_appId; + std::string m_pkgId; + std::string m_authorId; + PrivilegeVector m_privileges; + PrivilegeVector m_appDefinedPrivileges; std::vector > m_paths; std::pair m_uid; }; std::ostream& operator<<(std::ostream &os, const SecurityManagerTest::InstallRequest &request); +class PathsRequest +{ +public: + PathsRequest(); + PathsRequest(const PathsRequest&) = delete; + PathsRequest& operator=(const PathsRequest&) = delete; + ~PathsRequest(); + + void setPkgId(std::string pkgId, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); + void addPath(std::string path, app_install_path_type pathType, + lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS); + void setUid(const uid_t uid, lib_retcode expectedresult = SECURITY_MANAGER_SUCCESS); + void setInstallType(const enum app_install_type &type, lib_retcode expectedResult = SECURITY_MANAGER_SUCCESS); + + //app_inst_req *get() { return m_req; } + const path_req *get() const { return m_req; } + friend std::ostream& operator<<(std::ostream &, const PathsRequest&); + +private: + path_req *m_req; + + std::string m_pkgId; + std::vector > m_paths; + std::pair m_uid; +}; + +std::ostream& operator<<(std::ostream &os, const SecurityManagerTest::PathsRequest &request); + } // namespace SecurityManagerTest #endif // SECURITY_MANAGER_TEST_INSTALLREQUEST