/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2016 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.
m_uid.second = uid;
}
+void InstallRequest::setAuthorId(const char *authorId, lib_retcode expectedResult)
+{
+ m_authorId.clear();
+ if(authorId)
+ m_authorId.assign(authorId);
+
+ int result = security_manager_app_inst_req_set_author_id(m_req, authorId);
+ RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
+ "setting author id returned wrong value."
+ << " Author id: " << m_authorId << ";"
+ << " Result: " << result << ";"
+ << " Expected result: " << expectedResult);
+
+}
+
std::ostream& operator<<(std::ostream &os, const InstallRequest &request)
{
if (request.m_appId != nullptr)
}
if (request.m_uid.first)
os << "uid: " << request.m_uid.second << "; ";
+ if (!request.m_authorId.empty()) {
+ os << "author id: " << request.m_authorId << "; ";
+ }
return os;
}
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2016 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.
void addPath(const char *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(const char *authorId, lib_retcode expectedResult= SECURITY_MANAGER_SUCCESS);
std::string getAppTizenVersion() const { return m_tizenVer; }
const app_inst_req *get() const { return m_req; }
std::string m_tizenVer;
const char *m_appId;
const char *m_pkgId;
+ std::string m_authorId;
std::vector<std::string> m_privileges;
std::vector<std::pair<std::string, app_install_path_type> > m_paths;
std::pair<bool, uid_t> m_uid;
};
}
+RUNNER_TEST(security_manager_27a_set_wrong_author_id)
+{
+ InstallRequest requestInst;
+ requestInst.setAuthorId(NULL, SECURITY_MANAGER_ERROR_INPUT_PARAM);
+ requestInst.setAuthorId("", SECURITY_MANAGER_ERROR_INPUT_PARAM);
+}
+
+RUNNER_TEST(security_manager_27b_set_author_id_multiple_times)
+{
+ for(unsigned int i=0; i<10; ++i) {
+ std::string authorId = "some-author-id" + std::to_string(i);
+
+ InstallRequest requestInst;
+ requestInst.setAuthorId(authorId.c_str());
+ }
+}
+
int main(int argc, char *argv[])
{
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);