/*
- * 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.
#include <vector>
#include <security-manager.h>
+#include <app_def_privilege.h>
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<std::string> 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<std::pair<std::string, app_install_path_type> > m_paths;
std::pair<bool, uid_t> 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<std::pair<std::string, app_install_path_type> > m_paths;
+ std::pair<bool, uid_t> m_uid;
+};
+
+std::ostream& operator<<(std::ostream &os, const SecurityManagerTest::PathsRequest &request);
+
} // namespace SecurityManagerTest
#endif // SECURITY_MANAGER_TEST_INSTALLREQUEST