+wrt-installer (0.1.9) unstable; urgency=low
+
+ * Installer errors handling clean up
+ * Installer tests sources modification
+ * Content-Security-Policy-Report-Only xml tag support
+ * Remove web storage & filesystem usage code
+ * Fix App-control Supports : Some parser related app-control was changed
+
+ -- Jihoon Chung <jihoon.chung@samsung.com> Thu, 07 Mar 2013 09:11:07 +0900
+
+wrt-installer (0.1.8) unstable; urgency=low
+
+ * Release
+
+ -- Leerang Song <leerang.song@samsung.com> Thu, 28 Feb 2013 11:13:19 +0900
+
+wrt-installer (0.1.7) unstable; urgency=low
+
+ * Removing warnings reported by cppcheck tool.
+ * Removing compilation warnings in wrt-installer repo
+ * Fixed language tag map for pkg labels
+
+ -- Leerang Song <leerang.song@samsung.com> Wed, 27 Feb 2013 15:53:56 +0900
+
wrt-installer (0.1.6) unstable; urgency=low
* code clean up - src/configuration_parser/WidgetConfigurationManager
-#git:framework/web/wrt-installer wrt-installer 0.1.6
+#git:framework/web/wrt-installer wrt-installer 0.1.9
Name: wrt-installer
Summary: Installer for tizen Webruntime
-Version: 0.1.6
+Version: 0.1.9
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
%{_libdir}/systemd/user/wrt-preinstall-widgets.service
%if %{with_tests}
%attr(755,root,root) %{_bindir}/wrt-installer-tests-*
+ /opt/share/widget/tests/installer/widgets/*
%endif
break;
default:
Assert(false);
+ break;
}
}
} // namespace Unicode
break;
default:
LogError("Error in Access tag - unknown standard.");
+ break;
}
}
ConfigParserData::AccessInfo accessInfo(m_strIRIOrigin,
m_bSubDomainAccess);
- std::pair <ConfigParserData::AccessInfoSet::iterator, bool> ret =
+ //std::pair <ConfigParserData::AccessInfoSet::iterator, bool> ret =
m_data.accessInfoSet.insert(accessInfo);
}
break;
default:
LogError("Error in Access tag - unknown standard.");
+ break;
}
}
m_scheme = attribute.value;
} else if (attribute.name == L"mime") {
m_mime = attribute.value;
+ } else if (attribute.name == L"disposition") {
+ if (attribute.value == L"inline")
+ m_disposition =
+ ConfigParserData::ServiceInfo::Disposition::INLINE;
}
}
NormalizeString(m_scheme);
NormalizeString(m_mime);
+ // exception
+ DPL::String ignoreUri(L"file");
+
+ if (!m_scheme.IsNull() && *m_scheme == ignoreUri)
+ {
+ LogInfo("exception : '" << *m_scheme << "' scheme will be ignored.");
+ m_scheme = DPL::OptionalString::Null;
+ }
+
// verify duplicate element
DPL::String wildString(L"*/*");
DPL::String nullString(L"");
m_src.IsNull() ? nullString : *m_src,
m_operation.IsNull() ? nullString : *m_operation,
m_scheme.IsNull() ? nullString : *m_scheme,
- m_mime.IsNull() ? nullString : *m_mime);
+ m_mime.IsNull() ? nullString : *m_mime,
+ m_disposition);
FOREACH(iterator, m_data.appServiceList) {
if (iterator->m_operation == serviceInfo.m_operation &&
m_operation(DPL::OptionalString::Null),
m_scheme(DPL::OptionalString::Null),
m_mime(DPL::OptionalString::Null),
+ m_disposition(ConfigParserData::ServiceInfo::Disposition::WINDOW),
m_data(data)
{}
DPL::OptionalString m_operation;
DPL::OptionalString m_scheme;
DPL::OptionalString m_mime;
+ ConfigParserData::ServiceInfo::Disposition m_disposition;
ConfigParserData& m_data;
};
virtual void Verify()
{
+ // exception
+ DPL::String ignoreUri(L"file");
+
+ if (!m_value.IsNull() && *m_value == ignoreUri)
+ {
+ LogInfo("exception : '" << *m_value << "' scheme will be ignored.");
+ m_value = DPL::OptionalString::Null;
+ }
+
if (m_value.IsNull() || *m_value == L"") {
return;
}
DPL::String wildString(L"*/*");
- if ((m_data.m_uriList.find(wildString) ==
- m_data.m_uriList.end())
- && (m_data.m_uriList.find(*m_value) ==
- m_data.m_uriList.end()))
+ if ((m_data.m_uriList.find(wildString) == m_data.m_uriList.end())
+ && (m_data.m_uriList.find(*m_value) == m_data.m_uriList.end()))
{
m_data.m_uriList.insert(*m_value);
} else {
}
}
- virtual void Accept(const XmlAttribute& attribute)
+ virtual void Accept(const XmlAttribute& /*attribute*/)
{}
virtual void Accept(const Element& element)
return;
}
- FOREACH(iterator, m_data.appControlList) {
- if (iterator->m_src == m_appControl.m_src &&
- iterator->m_operation == m_appControl.m_operation)
- {
- ThrowMsg(Exception::ParseError,
- "app control element is duplicated " +
- DPL::ToUTF8String(m_appControl.m_src) + ", " +
- DPL::ToUTF8String(m_appControl.m_operation));
- }
- }
m_data.appControlList.push_back(m_appControl);
}
return &IgnoringParser::Create;
}
- virtual void Accept(const Text& text)
+ virtual void Accept(const Text& /*text*/)
{
if (m_properNamespace) {
LogDebug("text");
}
}
- virtual void Accept(const Element& element)
+ virtual void Accept(const Element& /*element*/)
{}
virtual void Accept(const Text& /*text*/)
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
return &IgnoringParser::Create;
}
- virtual void Accept(const XmlAttribute& attribute)
+ virtual void Accept(const XmlAttribute& /*attribute*/)
{}
virtual void Accept(const Element& element)
explicit BoxSizeParser(
ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
ElementParser(),
+ m_properNamespace(false),
m_data(data)
{}
struct PdParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
class CspParser : public ElementParser
{
public:
- virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name)
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
}
}
- virtual void Accept(const XmlAttribute& attribute)
+ virtual void Accept(const XmlAttribute& /*attribute*/)
{}
virtual void Accept(const Text& text)
DPL::OptionalString m_policy;
};
+class CspReportOnlyParser : public ElementParser
+{
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ CspReportOnlyParser(ConfigParserData& data) :
+ ElementParser(),
+ m_data(data),
+ m_properNamespace(false)
+ {}
+
+ virtual void Accept(const Element& element)
+ {
+ if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
+ m_properNamespace = true;
+ }
+ }
+
+ virtual void Accept(const XmlAttribute& /*attribute*/)
+ {}
+
+ virtual void Accept(const Text& text)
+ {
+ if (m_properNamespace) {
+ m_policy = text.value;
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (!m_policy.IsNull()) {
+ m_data.cspPolicyReportOnly = *m_policy;
+ }
+ }
+
+ private:
+ ConfigParserData& m_data;
+ bool m_properNamespace;
+ DPL::OptionalString m_policy;
+};
+
ElementParser::ActionFunc WidgetParser::GetElementParser(
const DPL::String& /*ns*/,
const DPL::String&
this,
&WidgetParser::
OnCspElement);
+ m_map[L"Content-Security-Policy-Report-Only"] = DPL::MakeDelegate(
+ this,
+ &WidgetParser::
+ OnCspReportOnlyElement);
#endif
}
return ElementParserPtr(new CspParser(m_data));
}
+ElementParserPtr WidgetParser::OnCspReportOnlyElement()
+{
+ return ElementParserPtr(new CspReportOnlyParser(m_data));
+}
+
void WidgetParser::Accept(const Element& element)
{
if (element.ns != ConfigurationNamespace::W3CWidgetNamespaceName &&
ElementParserPtr OnCategoryElement();
ElementParserPtr OnLiveboxElement();
ElementParserPtr OnCspElement();
+ ElementParserPtr OnCspReportOnlyElement();
virtual ActionFunc GetElementParser(const DPL::String& ns,
const DPL::String& name);
namespace Jobs {
Job::Job(InstallationType installType) :
+ m_handle(0),
m_installationType(installType),
m_UndoType(false),
m_paused(false)
void Job::SendFinishedFailure()
{}
-void Job::SendProgressIconPath(const std::string &path)
+void Job::SendProgressIconPath(const std::string &/*path*/)
{}
void Job::SaveExceptionData(const Jobs::JobExceptionBase&)
PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) :
DPL::TaskDecl<PluginInstallTask>(this),
m_context(inCont),
+ m_pluginHandle(0),
m_dataFromConfigXML(true)
{
AddStep(&PluginInstallTask::stepCheckPluginPath);
{
Success, ///< Success
- WrongPluginPath, ///< ?
- MetafileError, ///< ?
- AlreadyInstalled, ///< ?
+ WrongPluginPath, ///< Wrong plugin path
+ MetafileError, ///< Metafile parse error
+ AlreadyInstalled, ///< Plugin already installed
LoadingLibraryError, ///< Loading library by dlopen failed.
/// It may be caused by missing symbols
InstallationWaiting, /// Installation failed due to dependencies
default:
LogDebug("Unknown owner type of cert");
certData[i]->owner = UNKNOWN;
+ break;
}
switch (it->type) {
case WrtDB::WidgetCertificateData::ENDENTITY:
default:
LogError("Unknown type of cert");
certData[i]->type = ENDENTITY;
+ break;
}
certData[i]->chain_id = it->chainId;
}
LogDebug("Registerign widget in ace");
- ace_return_t retval = ACE_ACE_UNKNOWN_ERROR;
- retval = ace_register_widget(
+ ace_return_t retval = ace_register_widget(
static_cast<ace_widget_handle_t>(widgetHandle), &wi, certData);
//clean up - WidgetInfo
JobContextBase<WidgetInstallationStruct>(installerStruct),
m_exceptionCaught(Exceptions::Success)
{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- srand(time(NULL) + tv.tv_usec);
-
m_installerContext.m_quiet = m_jobStruct.m_quiet;
ConfigureResult result = PrePareInstallation(widgetPath);
// TODO : generate name move to wrt-commons
std::string allowedString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
std::ostringstream genName;
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ unsigned int seed = time(NULL) + tv.tv_usec;
- genName << "_" << allowedString[rand() % allowedString.length()];
+ genName << "_" << allowedString[rand_r(&seed) % allowedString.length()];
name = DPL::FromUTF8String(genName.str());
LogDebug("name was generated by WRT");
}
LogInfo("Widget model exists. tizen app id: " << tzAppid);
// Check running state
- int retval = APP_MANAGER_ERROR_NONE;
bool isRunning = false;
- retval = app_manager_is_running(DPL::ToUTF8String(
+ int retval = app_manager_is_running(DPL::ToUTF8String(
tzAppid).c_str(), &isRunning);
if (APP_MANAGER_ERROR_NONE != retval) {
LogError("Fail to get running state");
-ADD(de, de_DE)
-ADD(el, el_GR)
-ADD(en, en_US)
-ADD(es, es_ES)
-ADD(fr, fr_FR)
-ADD(it, it_IT)
-ADD(ja, ja_JP)
-ADD(ko, ko_KR)
-ADD(nl, nl_NL)
-ADD(pt, pt_PT)
-ADD(ru, ru_RU)
-ADD(tr, tr_TR)
-ADD(zh, zh_CN)
-ADD(zh, zh_HK)
-ADD(zh, zh_TW)
+ADD(de, de-de)
+ADD(el, el-gr)
+ADD(en, en-us)
+ADD(es, es-es)
+ADD(fr, fr-fr)
+ADD(it, it-it)
+ADD(ja, ja-jp)
+ADD(ko, ko-kr)
+ADD(nl, nl-nl)
+ADD(pt, pt-pt)
+ADD(ru, ru-ru)
+ADD(tr, tr-tr)
+ADD(zh, zh-cn)
+ADD(zh, zh-hk)
+ADD(zh, zh-tw)
namespace WidgetInstall {
TaskCertificates::TaskCertificates(InstallerContext& context) :
DPL::TaskDecl<TaskCertificates>(this),
- m_context(context)
+ m_context(context),
+ m_pkgHandle(NULL)
{
AddStep(&TaskCertificates::StepSetCertiInfo);
AddAbortStep(&TaskCertificates::StepAbortCertiInfo);
#include <widget_install/widget_install_errors.h>
#include <widget_install/widget_install_context.h>
#include <dpl/log/log.h>
-#include <wrt_error.h>
#include <dpl/wrt-dao-ro/global_config.h>
#include "wac_widget_id.h"
namespace WidgetInstall {
TaskCertify::TaskCertify(InstallerContext &inCont) :
DPL::TaskDecl<TaskCertify>(this),
- m_contextData(inCont),
- WidgetInstallPopup(inCont)
+ WidgetInstallPopup(inCont),
+ m_contextData(inCont)
{
AddStep(&TaskCertify::stepSignature);
WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
vconfData[
- WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
- m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
- vconfData[
- WrtDB::VconfConfig::GetVconfKeyFilesystemUsage(
- m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_ON;
- vconfData[
WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
m_context.widgetConfig.tzAppid)] = WrtDB::SETTINGS_TYPE_OFF;
namespace WidgetInstall {
TaskEncryptResource::TaskEncryptResource(InstallerContext& context) :
DPL::TaskDecl<TaskEncryptResource>(this),
- m_context(context)
+ m_context(context),
+ m_resEnc(NULL)
{
AddStep(&TaskEncryptResource::StepEncryptResource);
}
<< " with error: "
<< strerror(ftsent->fts_errno));
ThrowMsg(Exceptions::InternalError, "Error reading file");
+ break;
}
}
LogDebug("Encrypt file: " << fileName);
std::string encFile = fileName + ".enc";
- struct stat info = {0};
+ struct stat info;
+ memset(&info, 0, sizeof(info));
if (stat(fileName.c_str(), &info) != 0)
{
int error = errno;
return false;
}
- struct dirent* dEntry = NULL;
+ struct dirent dEntry;
+ struct dirent *dEntryResult;
+ int return_code;
+
do {
struct stat statInfo;
- if (dEntry = readdir(dir)) {
- std::string fileName = dEntry->d_name;
+ return_code = readdir_r(dir, &dEntry, &dEntryResult);
+ if (dEntryResult != NULL && return_code == 0) {
+ std::string fileName = dEntry.d_name;
std::string fullName = source + "/" + fileName;
if (stat(fullName.c_str(), &statInfo) != 0) {
outfile.close();
infile.close();
}
- } while (dEntry);
+ } while (dEntryResult != NULL && return_code == 0);
closedir(dir);
return true;
}
namespace WidgetInstall {
TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
DPL::TaskDecl<TaskFileManipulation>(this),
- m_context(context)
+ m_context(context),
+ m_extHandle(NULL)
{
if (INSTALL_LOCATION_TYPE_EXTERNAL !=
m_context.locationType)
"Error occurs during\
install osp service");
}
- fgets(readBuf, MAX_BUF_SIZE, fd);
+
+ if (fgets(readBuf, MAX_BUF_SIZE, fd) == NULL)
+ {
+ LogError("Failed to installtion osp service.\
+ Inability of reading file.");
+ ThrowMsg(Exceptions::InstallOspsvcFailed,
+ "Error occurs during\
+ install osp service");
+ }
LogDebug("return value : " << readBuf);
int result = atoi(readBuf);
TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
DPL::TaskDecl<TaskManifestFile>(this),
- m_context(inCont)
+ m_context(inCont),
+ writer(NULL)
{
if (false == m_context.existingWidgetInfo.isExist) {
AddStep(&TaskManifestFile::stepCopyIconFiles);
std::string clientExeStr = GlobalConfig::GetWrtClientExec();
LogInfo("link -s " << clientExeStr << " " << exec);
- symlink(clientExeStr.c_str(), exec.c_str());
+ errno = 0;
+ if (symlink(clientExeStr.c_str(), exec.c_str()) != 0)
+ {
+ int error = errno;
+ if(error)
+ LogPedantic("Failed to make a symbolic name for a file "
+ << "[" << DPL::GetErrnoString(error) << "]");
+ ThrowMsg(Exceptions::InstallationFailed,
+ "Symbolic link creating is not done.");
+ }
m_context.job->UpdateProgress(
- InstallerContext::INSTALL_CREATE_EXECFILE,
- "Widget execfile creation Finished");
+ InstallerContext::INSTALL_CREATE_EXECFILE,
+ "Widget execfile creation Finished");
}
void TaskManifestFile::stepCopyIconFiles()
for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
icon = icons.rbegin();
icon != icons.rend();
- icon++)
+ ++icon)
{
FOREACH(locale, icon->availableLocales)
{
ail_appinfo_h ai = NULL;
ail_error_e ret;
- ret = ail_package_get_appinfo(appid, &ai);
+ ret = ail_get_appinfo(appid, &ai);
if (ai) {
- ail_package_destroy_appinfo(ai);
+ ail_destroy_appinfo(ai);
}
if (AIL_ERROR_NO_DATA == ret) {
ThrowMsg(Exceptions::InternalError, path);
}
- struct dirent* d_ent;
- do {
- if ((d_ent = readdir(dir))) {
- if (strcmp(d_ent->d_name, ".") == 0 ||
- strcmp(d_ent->d_name, "..") == 0)
- {
- continue;
- }
- std::string file_name = d_ent->d_name;
- list.push_back(file_name);
+ struct dirent entry;
+ struct dirent *result;
+ int return_code;
+ errno = 0;
+ for (return_code = readdir_r(dir, &entry, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(dir, &entry, &result))
+ {
+ if (strcmp(entry.d_name, ".") == 0 ||
+ strcmp(entry.d_name, "..") == 0)
+ {
+ continue;
}
- } while (d_ent);
+ std::string file_name = entry.d_name;
+ list.push_back(file_name);
+ }
+
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << path << " with error: "
<< DPL::GetErrnoString());
for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
icon = icons.rbegin();
icon != icons.rend();
- icon++)
+ ++icon)
{
FOREACH(locale, icon->availableLocales)
{
LiveBoxInfo liveBox;
DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
DPL::String appid = m_context.widgetConfig.tzAppid;
- size_t found;
if (ConfigInfo->m_liveboxId != L"") {
- found = ConfigInfo->m_liveboxId.find_last_of(L".");
+ size_t found = ConfigInfo->m_liveboxId.find_last_of(L".");
if (found != std::string::npos) {
if (0 == ConfigInfo->m_liveboxId.compare(0, found, appid)) {
liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
/* Find all .so files and store their names in list */
DIR *dir;
- struct dirent *entry;
struct stat st;
LogDebug("Opening plugins directory");
dir = opendir(m_npsource.c_str());
ThrowMsg(Exceptions::InternalError, "Unable to read plugins directory");
}
std::string tempname;
+ struct dirent entry;
+ struct dirent *result;
+ int return_code;
+ errno = 0;
const std::string ext(".so");
/* Listing directory and checking entries found inside */
- while ((entry = readdir(dir)) != NULL) {
- tempname = m_npsource + "/" + entry->d_name;
+ for (return_code = readdir_r(dir, &entry, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(dir, &entry, &result))
+ {
+ tempname = m_npsource + "/" + entry.d_name;
if (lstat(tempname.c_str(), &st) != 0) {
LogWarning(
"Failed to call \"lstat\" (errno:" << errno
}
/* Directories other than "." and ".." should not be found*/
if (S_ISDIR(st.st_mode)) {
- if (strncmp(entry->d_name, "..", 2) != 0
- && strncmp(entry->d_name, ".", 1) != 0)
+ if (strncmp(entry.d_name, "..", 2) != 0
+ && strncmp(entry.d_name, ".", 1) != 0)
{
LogError("Directory detected instead of plugin file: "
- << entry->d_name);
+ << entry.d_name);
/* Subdirectories inside plugins/ARCH are not supported */
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError(
}
}
- tempname = std::string(entry->d_name);
+ tempname = std::string(entry.d_name);
/* Check whether file extension is ".so" */
if (tempname.compare(tempname.size() - ext.size(), ext.size(),
ext) == 0)
LogWarning("Non-plugin file found: " << tempname);
}
}
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+ errno = 0;
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << m_npsource << " with error: "
<< DPL::GetErrnoString());
/* Copy plugins from widget package into
* .netscape/plugins in widget's target directory */
for (std::list<std::string>::const_iterator it = m_nplugins.begin();
- it != m_nplugins.end(); it++)
+ it != m_nplugins.end(); ++it)
{
LogDebug("Copying plugin file: " << (*it));
source = m_npsource + "/" + (*it);
FILE *temp = fopen(infoPath.str().c_str(), "w+");
if (temp != NULL) {
fputs(m_context.locations->getWidgetSource().c_str(), temp);
- if (-1 == fsync(temp->_fileno)) {
- fclose(temp);
+ int ret = fsync(temp->_fileno);
+ fclose(temp);
+ if (-1 == ret) {
ThrowMsg(Exceptions::InternalError, "Fail to fsync for recovery.");
}
- fclose(temp);
m_context.installInfo = infoPath.str();
"Widget SMACK Enabled");
#endif
}
+
} //namespace WidgetInstall
} //namespace Jobs
void TaskUpdateFiles::StepCreateBackupFolder()
{
LogDebug("StepCreateBackupFolder");
- std::ostringstream backDirPath;
std::string srcBuPath = m_context.locations->getBackupSourceDir();
LogDebug("backup resource directory path : " << srcBuPath);
directory");
}
- struct dirent* dirent;
struct stat statInfo;
- do {
- if ((dirent = readdir(pkgDir))) {
- std::string dirName = dirent->d_name;
- std::string absFileName = dirPath + "/" + dirName;
- if (stat(absFileName.c_str(), &statInfo) != 0) {
- ThrowMsg(Exceptions::InternalError, "Error occurs read file");
- }
+ struct dirent dirent;
+ struct dirent *result;
+ int return_code;
+ errno = 0;
+ for (return_code = readdir_r(pkgDir, &dirent, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(pkgDir, &dirent, &result))
+ {
+ std::string dirName = dirent.d_name;
+ std::string absFileName = dirPath + "/" + dirName;
+ if (stat(absFileName.c_str(), &statInfo) != 0) {
+ ThrowMsg(Exceptions::InternalError, "Error occurs read file");
+ }
- if (S_ISDIR(statInfo.st_mode)) {
- if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name,
- "..") == 0)
- {
- continue;
- }
- ReadDirList(absFileName, list, subLen);
+ if (S_ISDIR(statInfo.st_mode)) {
+ if (strcmp(dirent.d_name, ".") == 0 || strcmp(dirent.d_name,
+ "..") == 0)
+ {
+ continue;
}
-
- list.insert(absFileName.substr(subLen));
+ ReadDirList(absFileName, list, subLen);
}
- } while (dirent);
+
+ list.insert(absFileName.substr(subLen));
+ }
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+ errno = 0;
//closing the directory
if (-1 == TEMP_FAILURE_RETRY(closedir(pkgDir))) {
LogError("Failed to close dir: " << dirPath << " with error: "
std::string clientPath = GlobalConfig::GetWrtClientExec();
LogInfo("link -s " << clientPath << " " << execFile);
- symlink(clientPath.c_str(), execFile.c_str());
+ errno = 0;
+ if( symlink(clientPath.c_str(), execFile.c_str()) != 0 )
+ {
+ int error = errno;
+ if(error)
+ LogPedantic("Failed to make a symbolic name for a file "
+ << "[" << DPL::GetErrnoString(error) << "]");
+ ThrowMsg(Exceptions::BackupFailed,
+ "Error occurs during rename file");
+ }
m_context.job->UpdateProgress(
InstallerContext::INSTALL_BACKUP_EXEC,
"Backup execution file for update");
#include <widget_install/widget_install_context.h>
#include <widget_install/widget_install_errors.h>
#include <widget_parser.h>
-#include <wrt_error.h>
namespace { // anonymous
const DPL::String BR = DPL::FromUTF8String("<br>");
return;
}
- struct dirent* dirent;
+
+
struct stat statStruct;
- do {
- errno = 0;
- if ((dirent = readdir(localeDir))) {
- DPL::String dirName = DPL::FromUTF8String(dirent->d_name);
- std::string absoluteDirName = localePath + "/";
- absoluteDirName += dirent->d_name;
-
- if (stat(absoluteDirName.c_str(), &statStruct) != 0) {
- LogError("stat() failed with " << DPL::GetErrnoString());
- continue;
- }
+ struct dirent dirent;
+ struct dirent *result;
+ int return_code;
+ errno = 0;
+ for (return_code = readdir_r(localeDir, &dirent, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(localeDir, &dirent, &result))
+ {
+ DPL::String dirName = DPL::FromUTF8String(dirent.d_name);
+ std::string absoluteDirName = localePath + "/";
+ absoluteDirName += dirent.d_name;
- if (S_ISDIR(statStruct.st_mode)) {
- //Yes, we ignore current, parent & hidden directories
- if (dirName[0] != L'.') {
- LogDebug("Adding locale directory \"" << dirName << "\"");
- m_localeFolders.insert(dirName);
- }
+ if (stat(absoluteDirName.c_str(), &statStruct) != 0) {
+ LogError("stat() failed with " << DPL::GetErrnoString());
+ continue;
+ }
+
+ if (S_ISDIR(statStruct.st_mode)) {
+ //Yes, we ignore current, parent & hidden directories
+ if (dirName[0] != L'.') {
+ LogDebug("Adding locale directory \"" << dirName << "\"");
+ m_localeFolders.insert(dirName);
}
}
- } while (dirent);
+ }
- if (errno != 0) {
- LogError("readdir() failed with " << DPL::GetErrnoString());
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
}
if (-1 == TEMP_FAILURE_RETRY(closedir(localeDir))) {
bool TaskWidgetConfig::parseConfigurationFileBrowser(
WrtDB::ConfigParserData& configInfo,
- const std::string&
- _currentPath,
- int* pErrCode)
+ const std::string& _currentPath)
{
ParserRunner parser;
Try
Catch(ElementParser::Exception::Base)
{
LogError("Invalid widget configuration file!");
- *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
return false;
}
return true;
bool TaskWidgetConfig::parseConfigurationFileWidget(
WrtDB::ConfigParserData& configInfo,
- const std::string&
- _currentPath,
- int* pErrCode)
+ const std::string& _currentPath)
{
ParserRunner parser;
//TODO: rewrite this madness
std::string cfgAbsPath;
DIR* dir = NULL;
- struct dirent* ptr = NULL;
dir = opendir(_currentPath.c_str());
if (dir == NULL) {
- *pErrCode = WRT_ERR_UNKNOWN;
return false;
}
bool has_config_xml = false;
+ struct dirent ptr;
+ struct dirent *result;
+ int return_code;
errno = 0;
- while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on
- // its name
- if (ptr->d_type == DT_REG) {
- if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
- std::string dName(ptr->d_name);
+
+ //Find configuration file, based on its name
+ for (return_code = readdir_r(dir, &ptr, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(dir, &ptr, &result))
+ {
+ if (ptr.d_type == DT_REG) {
+ if (!strcmp(ptr.d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
+ std::string dName(ptr.d_name);
WrtUtilJoinPaths(cfgAbsPath, _currentPath, dName);
//Parse widget configuration file
Catch(ElementParser::Exception::Base)
{
LogError("Invalid widget configuration file!");
- // _rethrown_exception.Dump();
- *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError(
"Failed to close dir: " << _currentPath <<
}
}
}
+ if (errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+ errno = 0;
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << _currentPath << " with error: "
<< DPL::GetErrnoString());
//We must have config.xml so leaveing if we doesn't
if (!has_config_xml) {
LogError("Invalid archive");
- *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
return false;
}
return true;
bool TaskWidgetConfig::locateAndParseConfigurationFile(
const std::string& _currentPath,
WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode)
+ const std::string& baseFolder)
{
using namespace WrtDB;
- if (!pErrCode) {
- return false;
- }
-
ConfigParserData& configInfo = pWidgetConfigInfo.configInfo;
// check if this installation from browser, or not.
if (infoPath.str() != WRT_WIDGET_CONFIG_FILE_NAME) {
if (_currentPath.empty() || baseFolder.empty()) {
- *pErrCode = WRT_ERR_INVALID_ARG;
return false;
}
// in case of general installation using wgt archive
- if (!parseConfigurationFileWidget(configInfo, _currentPath,
- pErrCode))
+ if (!parseConfigurationFileWidget(configInfo, _currentPath))
{
return false;
}
} else {
// in case of browser installation
- if (!parseConfigurationFileBrowser(configInfo, _currentPath,
- pErrCode))
+ if (!parseConfigurationFileBrowser(configInfo, _currentPath))
{
return false;
}
}
if (!fillWidgetConfig(pWidgetConfigInfo, configInfo)) {
- *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
return false;
}
return true;
WrtDB::WidgetRegisterInfo &
widgetConfiguration)
{
- int pErrCode;
-
if (!locateAndParseConfigurationFile(path, widgetConfiguration,
- DEFAULT_LANGUAGE, &pErrCode))
+ DEFAULT_LANGUAGE))
{
LogWarning("Widget archive: Failed while parsing config file");
ThrowMsg(Exception::ConfigParseFailed, path);
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/wrt-dao-ro/global_config.h>
-#include <wrt_error.h>
#include <wrt_common_types.h>
#include <widget_install/widget_install_popup.h>
const std::string& currentPath,
WrtDB::WidgetRegisterInfo&
pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode);
+ const std::string& baseFolder);
bool parseConfigurationFileBrowser(WrtDB::ConfigParserData& configInfo,
- const std::string& _currentPath,
- int* pErrCode);
+ const std::string& _currentPath);
bool parseConfigurationFileWidget(WrtDB::ConfigParserData& configInfo,
- const std::string& _currentPath,
- int* pErrCode);
+ const std::string& _currentPath);
bool fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
WrtDB::ConfigParserData& configInfo);
{
Success, ///< Success
- ErrorInvalidWidgetPackage, ///< ?
- ErrorWidgetDoesNotExist, ///< ?
+ ErrorInvalidWidgetPackage, ///< invalid widget package
+ ErrorWidgetDoesNotExist, ///< given tizenAppId is invalid, no app
ErrorAreadyUninstalling, ///< Widget is already being uninstalled
- ErrorOutOfDiskSpace, ///< ?
ErrorInvalidPackage, ///< Widget signature is invalid.
- ErrorAlreadyInstalled, ///< ?
- ErrorInternal, ///< ?
+ ErrorInternal, ///< Internal error due to inconsistency
ErrorNotAllowed, ///< Widget installation or update not
// allowed
///< because violation of policy ocurred
// PREPARE
DECLARE_JOB_EXCEPTION(Base, NotAllowed, ErrorNotAllowed)
DECLARE_JOB_EXCEPTION(Base, Deferred, ErrorDeferred)
-DECLARE_JOB_EXCEPTION(Base, InvalidWidgetUrl, ErrorInvalidWidgetPackage)
//UNZIP
DECLARE_JOB_EXCEPTION(Base, OpenZipFailed, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, GetZipGlobalInfoFailed, ErrorInvalidWidgetPackage)
DECLARE_JOB_EXCEPTION(Base, ZipEmpty, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, GetZippedFileInfoFailed, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, ZippedFileVersionTooNew, ErrorInvalidWidgetPackage)
DECLARE_JOB_EXCEPTION(Base, ExtractFileFailed, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, OutOfDiskSpace, ErrorOutOfDiskSpace)
DECLARE_JOB_EXCEPTION(Base, InternalError, ErrorInternal)
//CERTIFY
//WCONFIG
DECLARE_JOB_EXCEPTION(Base, WidgetConfigFileInvalid, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, NotInstalled, ErrorInvalidWidgetPackage)
DECLARE_JOB_EXCEPTION(Base, InstallationFailed, ErrorInvalidWidgetPackage)
-DECLARE_JOB_EXCEPTION(Base, AlreadyInstalled, ErrorAlreadyInstalled)
DECLARE_JOB_EXCEPTION(Base, UnknownError, ErrorUnknown)
DECLARE_JOB_EXCEPTION(Base, DatabaseFailure, ErrorDatabaseFailure)
DECLARE_JOB_EXCEPTION(Base, RemovingFolderFailure, ErrorRemovingFolderFailure)
DECLARE_JOB_EXCEPTION(Base, ErrorExternalInstallingFailure, ErrorInstallToExt)
// Installation osp service
-DECLARE_JOB_EXCEPTION(Base, RequestInstallOspsvc, ErrorInstallOspServcie)
DECLARE_JOB_EXCEPTION(Base, InstallOspsvcFailed, ErrorInstallOspServcie)
//UPDATE
DECLARE_JOB_EXCEPTION(Base, BackupFailed, ErrorUpdateWidget)
//check if deferred
//TODO if widget to be updated, then remove it from Deferred list?
- int ret = APP_MANAGER_ERROR_NONE;
bool isRunning = false;
- ret = app_manager_is_running(m_context.tzAppid.c_str(), &isRunning);
+ int ret = app_manager_is_running(m_context.tzAppid.c_str(), &isRunning);
if (APP_MANAGER_ERROR_NONE != ret) {
LogError("Fail to get running state");
ThrowMsg(Exceptions::PlatformAPIFailure,
void TaskDeleteCertificates::StepDeleteCertificates()
{
- pkgmgr_instcertinfo_h handle;
-
if ((pkgmgr_installer_delete_certinfo(
- const_cast<char*>((
- m_context.tzAppid).c_str()))) < 0)
+ const_cast<char*>((m_context.tzAppid).c_str()))) < 0)
{
LogError("pkgmgr_installer_delete_certinfo fail");
}
const char* package = m_context.tzAppid.c_str();
LogDebug("ail delete : " << package);
- ret = ail_package_get_appinfo(package, &ai);
+ ret = ail_get_appinfo(package, &ai);
if (ai) {
- ail_package_destroy_appinfo(ai);
+ ail_destroy_appinfo(ai);
}
if (AIL_ERROR_OK == ret) {
try {
WrtDB::WidgetDAOReadOnly dao(m_context.widgetConfig.tzAppid);
TizenAppId tzAppid = dao.getTizenAppId();
- const char *devCap = "";
int result = handle_access_control_conf_forWAC(
DPL::ToUTF8String(tzAppid).c_str(),
NULL,
"Error occurs during\
uninstall osp service");
}
- fgets(readBuf, MAX_BUF_SIZE, fd);
+
+ if(fgets(readBuf, MAX_BUF_SIZE, fd) == NULL)
+ {
+ LogError("Failed to uninstalltion osp service\
+ Inability of reading file.");
+ ThrowMsg(Exceptions::UninstallOspSvcFailed,
+ "Error occurs during\
+ uninstall osp service");
+ }
LogDebug("return value : " << readBuf);
int result = atoi(readBuf);
#include <widget_install/task_commons.h>
-WidgetLocation::DirectoryDeletor::DirectoryDeletor()
-{
- m_dirpath = Jobs::WidgetInstall::createTempPath();
-}
+WidgetLocation::DirectoryDeletor::DirectoryDeletor() :
+ m_dirpath(Jobs::WidgetInstall::createTempPath())
+{}
-WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath)
-{
- m_dirpath = tempPath;
-}
+WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath) :
+ m_dirpath(tempPath)
+{}
WidgetLocation::DirectoryDeletor::~DirectoryDeletor()
{
{
if (m_type == WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
std::string path = ".";
- int index = m_widgetSource.find_last_of("\\/");
+ std::size_t index = m_widgetSource.find_last_of("\\/");
if (index != std::string::npos) {
path = m_widgetSource.substr(0, index);
}
void registerAppid(const std::string & appid);
private:
+ std::string m_pkgid; //id of package
std::string m_widgetSource; // Source widget zip
// file/widget url
std::string m_appid; //id of app
- std::string m_pkgid; //id of package
std::string m_iconPath; //installed icon path
WrtDB::PackagingType m_type;
std::shared_ptr<DirectoryDeletor> m_temp; //directory
virtual ~PkgmgrSignalDummy()
{}
- bool setPkgname(const std::string& name)
+ bool setPkgname(const std::string& /*name*/)
{
return false;
}
- bool sendSignal(const std::string& key, const std::string& value) const
+ bool sendSignal(const std::string& /*key*/, const std::string& /*value*/) const
{
return false;
}
#include <dpl/log/log.h>
namespace InstallerCallbacksTranslate {
-WrtErrStatus TranslateError(CommonError::Type status)
-{
- switch (status) {
- case CommonError::WrtSuccess:
- return WRT_SUCCESS;
-
- case CommonError::HandleNotFound:
- return WRT_ERROR_HANDLE_NOT_FOUND;
-
- case CommonError::AlreadyRunning:
- return WRT_ERROR_ALREADY_RUNNING;
-
- case CommonError::InvalidLanguage:
- return WRT_ERROR_INVALID_LANGUAGE;
-
- case CommonError::AlreadyStopped:
- return WRT_ERROR_ALREADY_STOPPED;
-
- case CommonError::StillAuthorizing:
- return WRT_ERROR_STILL_AUTHORIZING;
-
- case CommonError::EarlyKilled:
- return WRT_ERROR_EARLY_KILLED;
-
- case CommonError::AccessDenied:
- return WRT_ERROR_ACCESS_DENIED;
-
- default:
- LogError("Untranslatable error: " << status);
- return WRT_ERROR_INTERNAL;
- }
-}
-
-void StatusCallback(std::string tizenId,
- CommonError::Type result,
- void *data)
-{
- LogDebug("StatusCallback called " << tizenId << " | " << result);
- Assert(data != NULL);
-
- WrtErrStatus error = TranslateError(result);
- StatusCallbackStruct* statusCallbackStruct =
- static_cast<StatusCallbackStruct*>(data);
-
- if (statusCallbackStruct->status_callback) {
- statusCallbackStruct->status_callback(tizenId,
- error,
- statusCallbackStruct->userdata);
- } else {
- LogInfo("StatusCallback: ignoring NULL callback pointer");
- }
-
- delete statusCallbackStruct;
-}
// callback for finished install
void installFinishedCallback(void *userParam,
errorStatus = WRT_SUCCESS;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorInvalidWidgetPackage:
- errorStatus = WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE;
- break;
-
case Jobs::WidgetInstall::Exceptions::ErrorWidgetDoesNotExist:
errorStatus = WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST;
break;
errorStatus = WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorOutOfDiskSpace:
- errorStatus = WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE;
- break;
-
case Jobs::WidgetInstall::Exceptions::ErrorInvalidPackage:
errorStatus = WRT_INSTALLER_ERROR_INVALID_CERTIFICATE;
break;
- case Jobs::WidgetInstall::Exceptions::ErrorAlreadyInstalled:
- errorStatus = WRT_INSTALLER_ERROR_ALREADY_INSTALLED;
- break;
-
case Jobs::WidgetInstall::Exceptions::ErrorInternal:
errorStatus = WRT_INSTALLER_ERROR_INTERNAL;
break;
{}
};
-void StatusCallback(std::string tizenId,
- CommonError::Type result,
- void *data);
-
void installFinishedCallback(void *userParam,
std::string tizenId,
Jobs::WidgetInstall::Exceptions::Type status);
WrtInstaller::WrtInstaller(int argc, char **argv) :
Application(argc, argv, "backend", false),
DPL::TaskDecl<WrtInstaller>(this),
+ m_installPolicy(WRT_WIM_NOT_INSTALLED),
m_packagePath(),
m_handle(-1),
m_initialized(false),
fprintf(stderr,
"===========================================================\n");
fprintf(stderr, "# wrt-installer #\n");
- fprintf(stderr, "# argc [%ld]\n", m_argc);
+ fprintf(stderr, "# argc [%d]\n", m_argc);
fprintf(stderr, "# argv[0] = [%s]\n", m_argv[0]);
fprintf(stderr, "# argv[1] = [%s]\n", m_argv[1]);
fprintf(stderr, "# argv[2] = [%s]\n", m_argv[2]);
}
LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
- struct dirent* libdir;
-
- errno = 0;
std::list<std::string> pluginsPaths;
-
- while ((libdir = readdir(dir)) != 0) {
- if (strcmp(libdir->d_name, ".") == 0 ||
- strcmp(libdir->d_name, "..") == 0)
+ struct dirent libdir;
+ struct dirent *result;
+ int return_code;
+ errno = 0;
+ for (return_code = readdir_r(dir, &libdir, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(dir, &libdir, &result))
+ {
+ if (strcmp(libdir.d_name, ".") == 0 ||
+ strcmp(libdir.d_name, "..") == 0)
{
continue;
}
std::string path = PLUGIN_PATH;
path += "/";
- path += libdir->d_name;
+ path += libdir.d_name;
struct stat tmp;
pluginsPaths.push_back(path);
}
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+
//set nb of plugins to install
//this value indicate how many callbacks are expected
m_numPluginsToInstall = pluginsPaths.size();
}
switch (status) {
- case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
- This->m_returnStatus = 1; //this status is specific
- fprintf(
- stderr,
- "## wrt-installer : %s %s has failed - invalid widget package\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
- fprintf(
- stderr,
- "## wrt-installer : %s %s has failed - widget package does not exist\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
- fprintf(
- stderr,
- "## wrt-installer : %s %s has failed - already uninstalling\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE:
- fprintf(stderr,
- "## wrt-installer : %s %s has failed - out of disk space\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
- fprintf(
- stderr,
- "## wrt-installer : %s %s has failed - invalid certificate\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
- fprintf(stderr,
- "## wrt-installer : %s %s has failed - already installed\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_INTERNAL:
- fprintf(stderr,
- "## wrt-installer : %s %s has failed - internal error\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_NOT_ALLOWED:
- fprintf(
- stderr,
- "## wrt-installer : %s %s has failed - installation or update not allowed; invalid"
- " mode\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_DEFERRED:
- fprintf(
- stderr,
- "## wrt-installer : deferred: widget update will continue after the widget"
- " has been stopped\n");
- break;
-
- case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
- fprintf(stderr,
- "## wrt-installer : %s %s has failed - database failure\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_OSPSVC:
- fprintf(
- stderr,
- "## wrt-installer : %s %s has failed - during installation or"
- " uninstallation osp service\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- case WRT_INSTALLER_ERROR_UNKNOWN:
- fprintf(stderr,
- "## wrt-installer : %s %s has failed - unknown error\n",
- tizenId.c_str(),
- printMsg.c_str());
- break;
-
- default:
- break;
+ case WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE:
+ This->m_returnStatus = 1; //this status is specific
+ fprintf(stderr, "## wrt-installer : %s %s has failed - invalid widget package\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - widget package does not exist\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING:
+ fprintf(stderr, "## wrt-installer : %s %s has failed - already uninstalling\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_INVALID_CERTIFICATE:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - invalid certificate\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_ALREADY_INSTALLED:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - already installed\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_INTERNAL:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - internal error\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_NOT_ALLOWED:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - installation or update not allowed; invalid"
+ " mode\n", tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_DEFERRED:
+ fprintf(stderr,"## wrt-installer : deferred: widget update will continue after the widget"
+ " has been stopped\n");
+ break;
+
+ case WRT_INSTALLER_ERROR_DATABASE_FAILURE:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - database failure\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_OSPSVC:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - during installation or"
+ " uninstallation osp service\n", tizenId.c_str(),
+ printMsg.c_str());
+ break;
+
+ case WRT_INSTALLER_ERROR_UNKNOWN:
+ fprintf(stderr,"## wrt-installer : %s %s has failed - unknown error\n",
+ tizenId.c_str(), printMsg.c_str());
+ break;
+
+ default:
+ break;
}
} else {
fprintf(stderr,
void* userdata)
{
WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
- std::stringstream percentStr;
LogInfo(" progress: " << percent <<
" description: " << description);
void* userdata)
{
WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
- std::stringstream percentStr;
LogInfo(" progress: " << percent <<
" description: " << description);
}
LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH);
- struct dirent* libdir;
+ struct dirent libdir;
+ struct dirent *result;
+ int return_code;
errno = 0;
std::list<std::string> pluginsPaths;
- while ((libdir = readdir(dir)) != 0) {
- if (strcmp(libdir->d_name, ".") == 0 ||
- strcmp(libdir->d_name, "..") == 0)
+ for (return_code = readdir_r(dir, &libdir, &result);
+ result != NULL && return_code == 0;
+ return_code = readdir_r(dir, &libdir, &result))
+ {
+ if (strcmp(libdir.d_name, ".") == 0 ||
+ strcmp(libdir.d_name, "..") == 0)
{
continue;
}
std::string path = PLUGIN_PATH;
path += "/";
- path += libdir->d_name;
+ path += libdir.d_name;
struct stat tmp;
plugin_install_progress_cb);
}
+ if (return_code != 0 || errno != 0) {
+ LogError("readdir_r() failed with " << DPL::GetErrnoString());
+ }
+
+ errno = 0;
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << PLUGIN_PATH << " with error: "
<< DPL::GetErrnoString());
}
EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & tzAppid,
- const std::string guid)
+ const std::string & guid)
{
try {
LogInfo("[WRT-API] GETTING WIDGET PACKAGE NAME BY WidgetID : "
WrtDB::WidgetDAOReadOnly dao(widget_guid);
tzAppid = DPL::ToUTF8String(dao.getTzAppId());
return WRT_SUCCESS;
- } catch (WidgetDAOReadOnly::Exception::WidgetNotExist) {
+ } catch (WidgetDAOReadOnly::Exception::WidgetNotExist&) {
LogError("Error package name is not found");
return WRT_ERROR_PKGNAME_NOT_FOUND;
} catch (const DPL::Exception& ex) {
* @return error code
*/
WrtErrStatus wrt_get_widget_by_guid(std::string &tzAppid,
- const std::string guid);
+ const std::string &guid);
#ifdef __cplusplus
}
#endif
{
/* Generic success */
WRT_SUCCESS = 0, /*< Success*/
- WRT_ALREADY_INIT, /*< Wrt already initialized*/
- WRT_UPDATE_NEED, /*< Widget data has been updated*/
- WRT_SHUTDOWN, /*<WRT daemon has been closed*/
-
- /* Version result */
- WRT_VERSION_OLD = 128, /*< widget's version is older*/
- WRT_VERSION_NEW, /*< widget's version is latest*/
- WRT_VERSION_EXACT, /*< widget's version the same as in arg*/
- WRT_VERSION_NOT_COMPARABLE, /*< widget's version are not comparable */
/* Error result */
WRT_ERROR_INTERNAL = -128, /*< Internal library error.
* Should never occur */
- WRT_ERROR_INVALID_PARAMETER, /*< Invalid parameter value was given
- * (eg. NULL) */
- WRT_ERROR_HANDLE_NOT_FOUND, /*< Widget handle was not found */
- WRT_ERROR_ID_NOT_FOUND, /*< Widget id was not found */
+
WRT_ERROR_PKGNAME_NOT_FOUND, /*< package name was not found */
- WRT_ERROR_ALREADY_RUNNING, /*< Widget is already running */
- WRT_ERROR_ALREADY_STOPPED, /*< Widget is already stopped */
- WRT_ERROR_STILL_AUTHORIZING, /*< Widget is still autorizing and has not
- * yet finished it */
- WRT_ERROR_EARLY_KILLED, /*< Widget was early killed during launch */
- WRT_ERROR_ACCESS_DENIED, /*< Access denied from ACE */
- WRT_ERROR_NOT_INITIALIZED, /*<Occur if wrt initialization fails*/
- WRT_ERROR_INIT, /*<Occur if wrt initialization fails*/
- WRT_ERROR_CONNECTION, /*<Connectiond error occured*/
WRT_ERROR_NO_PATH, /*<One of specific directory does not
* exist*/
/* Installer Errors*/
- WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE, /*< */
- WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST, /*< */
+ WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE, /*< package is malformed */
+ WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST, /*< given tizenAppId is invalid */
WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING, /*< Widget is already being
* uninstalled */
- WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE, /*< */
WRT_INSTALLER_ERROR_INVALID_CERTIFICATE, /*< */
WRT_INSTALLER_ERROR_ALREADY_INSTALLED, /*< Widget is already installed
*/
- WRT_INSTALLER_ERROR_INTERNAL, /*< */
+ WRT_INSTALLER_ERROR_INTERNAL, /*< Internal error due to inconsistency */
WRT_INSTALLER_ERROR_NOT_ALLOWED, /*< Widget installation or
* update not allowed */
/*< because violation of policy
WRT_INSTALLER_ERROR_DATABASE_FAILURE, /*< Failure in database */
WRT_INSTALLER_ERROR_UNKNOWN, /*< Temporary error. Try to not
* use this. */
- WRT_INSTALLER_ERROR_OSPSVC, /*< */
- WRT_ERROR_INVALID_LANGUAGE, /*< Widget is not valid in
- * current locales*/
-
+ WRT_INSTALLER_ERROR_OSPSVC, /*< Error of installation
+ * of osp service */
/* Plugin Installer Errors */
WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH, /*< Wrong Path to plugin Dir */
WRT_PLUGIN_INSTALLER_ERROR_METAFILE, /*< Plugin metafile error */
WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN /*< Unknown error*/
} WrtErrStatus;
-typedef struct
-{
- char* id; /**< the widget's id
- * (read from its config.xml during installation)*/
- char* name; /**< the widget's name
- * (read from its config.xml during installation)*/
- char* version; /**< the widget's varsion
- * (read from its config.xml during installation)*/
- char* icon_path; /**< the widget's icon_path
- * (read from its config.xml during installation)*/
- char* pkg_name; /**< the widget's pkg name */
-
- /**< the widget's application storage size */
- size_t application_size;
- /**< the widget's data storage size */
- size_t data_size;
-} wrt_widget_info;
-
-typedef struct
-{
- char *src; /**< valid path to widget's icon*/
- int width; /**< the width of the icon in pixels*/
- int height; /**< the height of the icon in pixels*/
-} wrt_widget_icon;
-
-typedef struct
-{
- int width; /**< the width of the widget in pixels*/
- int height; /**< the height of the widget in pixels*/
-} wrt_widget_size;
-
-typedef struct
-{
- char *widget_name; /**< the widget's name*/
- wrt_widget_icon *widget_icon; /**< the widget's icon data*/
- wrt_widget_size widget_size; /**< the widget's size data*/
- wrt_widget_info *widget_info; /**< the widget's info data*/
-} wrt_widget_info_data;
-
-/**
- * @fn inline bool wrt_has_succeded(WrtErrStatus err)
- * @brief Checks whether call succeded
- *
- * This function checks whether call succeded.
- * If call succeded it returns TRUE.
- *
- * @param [in] err WrtErrStatus to check
- *
- * @return Result of the test
- * @retval TRUE - the call was successful
- * @retval FALSE - the call failed
- *
- * Sample code:
- * @code
- * static void InitCallback(WrtErrStatus status, void *data)
- * {
- * MyApplication *This = (MyApplication *)(data);
- *
- * printf("[LAUNCH-WIDGET] init callback");
- *
- * if (wrt_has_succeded(status) && status!=WRT_UPDATE_NEED)
- * {
- * This->InstallAllPlugins();
- *
- * if (This->m_argc == 2)
- * wrt_install_widget(This->m_argv[1], This, InstallCallback);
- * }
- * else if(wrt_has_failed(status))
- * printf("[LAUNCH-WIDGET] INITIALIZATION HAS FAILED");
- * }
- * @endcode
- *
- * @see wrt_has_failed
- */
-inline bool wrt_has_succeded(WrtErrStatus err)
-{
- return (err >= 0);
-}
-
-/**
- * @fn inline bool wrt_has_failed(WrtErrStatus err)
- * @brief Checks whether call failed
- *
- * This function checks whether call failed.
- * If call failed it returns TRUE.
- *
- * @param [in] err WrtErrStatus to check
- *
- * @return Result of the test
- * @retval TRUE - the call failed
- * @retval FALSE - the call was successful
- *
- * Sample code:
- * @code
- * static void InitCallback(WrtErrStatus status, void *data)
- * {
- * MyApplication *This = (MyApplication *)(data);
- *
- * printf("[LAUNCH-WIDGET] init callback");
- *
- * if (wrt_has_succeded(status) && status!=WRT_UPDATE_NEED)
- * {
- * This->InstallAllPlugins();
- *
- * if (This->m_argc == 2)
- * wrt_install_widget(This->m_argv[1], This, InstallCallback);
- * }
- * else if(wrt_has_failed(status))
- * printf("[LAUNCH-WIDGET] INITIALIZATION HAS FAILED");
- * }
- * @endcode
- *
- * @see wrt_has_succeded
- */
-inline bool wrt_has_failed(WrtErrStatus err)
-{
- return (err < 0);
-}
-
-namespace CommonError {
-enum Type
-{
- WrtSuccess, ///< Success
-
- HandleNotFound, ///< Widget handle was not found
- AlreadyRunning, ///< Widget is already running
- AlreadyStopped, ///< Widget is already stopped
- InvalidLanguage, ///< Widget is invalid in current locales
- StillAuthorizing, ///< Widget is still autorizing and has not yet
- // finished it
- EarlyKilled, ///< Widget was early killed during launch
- AccessDenied, ///< Access denied from ACE
- CertificateRevoked, ///< Some certificate was revoked.
- /// Widget is not allowed to run.
-
- Unknown ///< Temporary error. Try to not use this.
-};
-}
-
#ifdef __cplusplus
}
#endif
--- /dev/null
+/*
+ * Copyright (c) 2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file TestCases.cpp
+ * @author Karol Pawlowski (k.pawlowski@samsung.com)
+ * @author Tomasz Iwanek (t.iwanek@samsung.com)
+ * @version 1.0
+ * @brief Background page installation test's bodies
+ */
+
+#include <string>
+#include <dpl/test/test_runner.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(BackgroundPage)
+
+/*
+Name: widgetWithBackgroundPage
+Description: Tests if widget with background page is installed correctly
+Expected: widget should be installed correctly
+*/
+RUNNER_TEST(widgetWithBackgroundPage)
+{
+ std::string tizenId;
+ RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/bg-00-with_bg.wgt",
+ tizenId) == InstallerWrapper::Success);
+ uninstall(tizenId);
+}
+
+/*
+Name: missingBackgroundFile
+Description: Tests if widget with declared in conifg background page
+ but missing background file will be installed correctly.
+Expected: widget should NOT be installed
+*/
+RUNNER_TEST(missingBackgroundFile)
+{
+ std::string tizenId;
+ if(install(miscWidgetsStuff + "widgets/bg-01-missing_file.wgt",
+ tizenId) == InstallerWrapper::Success) {
+ uninstall(tizenId);
+ RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
+ }
+}
+
+/*
+Name: widgetWithoutBackgroundPage
+Description: Complementary test to check if normal widget\
+ without background page is successfully installed
+Expected: widget should be installed
+*/
+RUNNER_TEST(widgetWithoutBackgroundPage)
+{
+ std::string tizenId;
+ RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/bg-02-without_bg.wgt",
+ tizenId) == InstallerWrapper::Success);
+ uninstall(tizenId);
+}
# @author Karol Pawlowski (k.pawlowski@samsung.com)
#
-
-# TODO cleanup dependencies
PKG_CHECK_MODULES(COMMON_LIB_PKGS
dbus-1
libpcrecpp
dpl-utils-efl
dpl-wrt-dao-ro
dpl-event-efl
- glib-2.0
- gthread-2.0
- edje
- ecore
- ecore-x
- ecore-imf
- ecore-ipc
- ecore-evas
- ecore-file
- ecore-input
- evas
- eina
- elementary
- vconf
- aul
- libidn
xmlsec1
libiri
REQUIRED
)
-INCLUDE(CMakeUtils.txt)
-
pkg_search_module(dpl REQUIRED dpl-efl)
pkg_search_module(dpl-test REQUIRED dpl-test-efl)
include_directories(
${dpl_INCLUDE_DIRS}
${dpl-test_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/common
)
-ADD_SUBDIRECTORY(common)
+SET(COMMON_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}")
+
+SET_PROPERTY(GLOBAL APPEND PROPERTY COMMON_TESTS_LIBRARY ${WRT_TEST_LIBRARY})
+
+SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_INCLUDE_DIRS ${COMMON_LIB_PKGS_INCLUDE_DIRS})
+
+SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_LIBRARY_DIRS ${COMMON_LIB_PKGS_LIBRARY_DIRS})
+
+SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_LIBRARIES ${COMMON_LIB_PKGS_LIBRARIES})
+
+SET(WRT_DETAIL_SOURCES
+ ${CMAKE_CURRENT_SOURCE_DIR}/InstallerWrapper.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/ManifestFile.cpp
+)
+
+INCLUDE_DIRECTORIES(${COMMON_INCLUDES})
+INCLUDE_DIRECTORIES(${COMMON_LIB_PKGS_INCLUDE_DIRS})
+
+ADD_LIBRARY(${WRT_TEST_LIBRARY} STATIC ${WRT_DETAIL_SOURCES})
SET(INSTALLER_TESTS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/TestInit.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/TestCases.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/ManifestTests.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/BackgroundPageTests.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/NonRootUserTests.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/NPluginsInstallTests.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/ParsingTizenAppserviceTests.cpp
)
SET(INSTALLER_TESTS_TARGET "wrt-installer-tests-general")
+# Functions used to build test targets (proper sources, includes, libs are
+# added automatically)
+FUNCTION(WRT_TEST_BUILD TARGET_NAME)
+ SET(SOURCES "${ARGN}")
+ ADD_EXECUTABLE("${TARGET_NAME}" ${SOURCES})
+
+ # get include dirs global property
+ GET_PROPERTY(INCLUDE_DIRS GLOBAL PROPERTY TESTS_INCLUDE_DIRS)
+ GET_PROPERTY(TEST_INCLUDE_DIRS GLOBAL PROPERTY ${TARGET_NAME}_INCLUDE_DIRS)
+ INCLUDE_DIRECTORIES(
+ ${INCLUDE_DIRS}
+ ${TEST_INCLUDE_DIRS}
+ )
+
+ # get library dirs global property
+ GET_PROPERTY(LIBRARY_DIRS GLOBAL PROPERTY TESTS_LIBRARY_DIRS)
+ GET_PROPERTY(TEST_LIBRARY_DIRS GLOBAL PROPERTY ${TARGET_NAME}_LIBRARY_DIRS)
+ LINK_DIRECTORIES(
+ ${LIBRARY_DIRS}
+ ${TEST_LIBRARY_DIRS}
+ )
+
+ # get link libraries global property
+ GET_PROPERTY(LINK_LIBRARIES GLOBAL PROPERTY TESTS_LIBRARIES)
+ GET_PROPERTY(TEST_LIBRARIES GLOBAL PROPERTY ${TARGET_NAME}_LIBRARIES)
+ TARGET_LINK_LIBRARIES("${TARGET_NAME}"
+ ${LINK_LIBRARIES}
+ ${TEST_LIBRARIES}
+ )
+ENDFUNCTION(WRT_TEST_BUILD)
+
+FUNCTION(WRT_TEST_INSTALL)
+ SET_TARGET_PROPERTIES(${ARGV} PROPERTIES
+ BUILD_WITH_INSTALL_RPATH ON
+ INSTALL_RPATH_USE_LINK_PATH ON
+ )
+ INSTALL(TARGETS ${ARGV}
+ DESTINATION bin
+ PERMISSIONS OWNER_READ
+ OWNER_WRITE
+ OWNER_EXECUTE
+ GROUP_READ
+ GROUP_EXECUTE
+ WORLD_READ
+ WORLD_EXECUTE
+ )
+ENDFUNCTION(WRT_TEST_INSTALL)
+
WRT_TEST_BUILD(${INSTALLER_TESTS_TARGET} ${INSTALLER_TESTS_SOURCES})
WRT_TEST_INSTALL(${INSTALLER_TESTS_TARGET})
target_link_libraries(${INSTALLER_TESTS_TARGET}
${TARGET_CORE_MODULE_LIB}
${COMMON_LIB_PKGS_LIBRARIES}
)
+
+#widgets
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/manifest.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/bg-00-with_bg.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/bg-01-missing_file.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/bg-02-without_bg.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/nonroot.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/inst_nplug_1.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/inst_nplug_2.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/inst_nplug_3.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/inst_nplug_4.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/appservice_dispos.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
+++ /dev/null
-# @file CMakeUtils.txt
-# @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
-# @author Pawel Sikorski (p.sikorski@samsung.com)
-# @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
-# @version 1.0
-# @brief
-#
-
-#
-# Discovers target's INCLUDE_DIRECTORIES and LINK_DIRECTORIES.
-# This is done by retrieving the directory target was built in and
-# fetching appropriate properties of that directory.
-FUNCTION(WRT_INTROSPECT_TARGET PREFIX TARGET_NAME)
- GET_TARGET_PROPERTY(LOCATION ${TARGET_NAME} LOCATION)
- IF(${LOCATION} STREQUAL "LOCATION-NOTFOUND")
- MESSAGE(FATAL_ERROR "Target '${TARGET_NAME}' introspection failed")
- ELSE(${LOCATION} STREQUAL "LOCATION-NOTFOUND")
- STRING(FIND ${LOCATION} "/" LAST_SLASH_POSITION REVERSE)
- STRING(SUBSTRING ${LOCATION} 0 ${LAST_SLASH_POSITION} LOCATION)
-
- GET_DIRECTORY_PROPERTY(INCLUDE_DIRS DIRECTORY ${LOCATION} INCLUDE_DIRECTORIES)
- SET("${PREFIX}_INCLUDE_DIRS" ${INCLUDE_DIRS} PARENT_SCOPE)
-
- GET_DIRECTORY_PROPERTY(LIBRARY_DIRS DIRECTORY ${LOCATION} LINK_DIRECTORIES)
- SET("${PREFIX}_LIBRARY_DIRS" ${LIBRARY_DIRS} PARENT_SCOPE)
- ENDIF(${LOCATION} STREQUAL "LOCATION-NOTFOUND")
-ENDFUNCTION(WRT_INTROSPECT_TARGET)
-
-FUNCTION(WRT_TEST_LIBRARY)
- SET_PROPERTY(GLOBAL APPEND PROPERTY COMMON_TESTS_LIBRARY ${ARGV})
-ENDFUNCTION(WRT_TEST_LIBRARY)
-
-#
-# Replacement functions for standard (w/o "WRT_" prefix) CMake functions.
-# They store supplied arguments in global properties to assign them to tests.
-# Anything added with this functions is used by all targets that are built with
-# WRT_TEST_BUILD function.
-
-#
-# Appends directories to global property TESTS_INCLUDE_DIRS which is
-# then read by WRT_TEST_BUILD and its content is forwarded to
-# command INCLUDE_DIRECTORIES() (for all targets).
-FUNCTION(WRT_INCLUDE_DIRECTORIES)
- SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_INCLUDE_DIRS ${ARGV})
-ENDFUNCTION(WRT_INCLUDE_DIRECTORIES)
-
-#
-# Appends directories to global property TESTS_LIBRARY_DIRS which is
-# then read by WRT_TEST_BUILD and its content is forwarded to
-# command LINK_DIRECTORIES() (for all targets).
-FUNCTION(WRT_LINK_DIRECTORIES)
- SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_LIBRARY_DIRS ${ARGV})
-ENDFUNCTION(WRT_LINK_DIRECTORIES)
-
-#
-# Appends directories to global property TESTS_LIBRARIES which is
-# then read by WRT_TEST_BUILD and its content is forwarded to
-# command TARGET_LINK_LIBRARIES() (for all targets).
-FUNCTION(WRT_TARGET_LINK_LIBRARIES)
- SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_LIBRARIES ${ARGV})
-ENDFUNCTION(WRT_TARGET_LINK_LIBRARIES)
-
-#
-# Convenience method that fills TESTS_INCLUDE_DIRS, TESTS_LIBRARY_DIRS
-# and TESTS_LIBRARIES with values discovered from introspecting supplied
-# targets.
-# Function takes arbitrary number of targets.
-FUNCTION(WRT_ADD_INTERNAL_DEPENDENCIES)
- FOREACH(DEPENDENCY ${ARGV})
- WRT_INTROSPECT_TARGET(prefix ${DEPENDENCY})
- WRT_INCLUDE_DIRECTORIES(${prefix_INCLUDE_DIRS})
- WRT_LINK_DIRECTORIES(${prefix_LIBRARY_DIRS})
- WRT_TARGET_LINK_LIBRARIES(${DEPENDENCY})
- ENDFOREACH(DEPENDENCY)
-ENDFUNCTION(WRT_ADD_INTERNAL_DEPENDENCIES)
-
-
-#
-# Replacement functions for standard (w/o "WRT_" prefix) CMake functions.
-# They store supplied arguments in global properties to assign them to specific
-# tests. Properties names are based on the test target name.
-# Anything added with this functions is used only by the specified target that
-# is built with WRT_TEST_BUILD function.
-
-#
-# Appends directories to global property ${TARGET_NAME}_INCLUDE_DIRS
-# which is then read by WRT_TEST_BUILD and its content is forwarded to
-# command INCLUDE_DIRECTORIES() (for specified target).
-FUNCTION(WRT_TEST_INCLUDE_DIRECTORIES TARGET_NAME)
- SET_PROPERTY(GLOBAL APPEND PROPERTY ${TARGET_NAME}_INCLUDE_DIRS ${ARGN})
-ENDFUNCTION(WRT_TEST_INCLUDE_DIRECTORIES)
-
-#
-# Appends directories to global property ${TARGET_NAME}_LIBRARY_DIRS
-# which is then read by WRT_TEST_BUILD and its content is forwarded to
-# command LINK_DIRECTORIES() (for specified target).
-FUNCTION(WRT_TEST_LINK_DIRECTORIES TARGET_NAME)
- SET_PROPERTY(GLOBAL APPEND PROPERTY ${TARGET_NAME}_LIBRARY_DIRS ${ARGN})
-ENDFUNCTION(WRT_TEST_LINK_DIRECTORIES)
-
-#
-# Appends directories to global property ${TARGET_NAME}_LIBRARIES
-# which is then read by WRT_TEST_BUILD and its content is forwarded to
-# command TARGET_LINK_LIBRARIES() (for specified target).
-FUNCTION(WRT_TEST_TARGET_LINK_LIBRARIES TARGET_NAME)
- SET_PROPERTY(GLOBAL APPEND PROPERTY ${TARGET_NAME}_LIBRARIES ${ARGN})
-ENDFUNCTION(WRT_TEST_TARGET_LINK_LIBRARIES)
-
-#
-# Convenience method that fills ${TARGET_NAME}_INCLUDE_DIRS,
-# ${TARGET_NAME}_LIBRARY_DIRS and ${TARGET_NAME}_LIBRARIES with
-# values discovered from introspecting supplied targets.
-# Function takes arbitrary number of targets.
-FUNCTION(WRT_TEST_ADD_INTERNAL_DEPENDENCIES TARGET_NAME)
- FOREACH(DEPENDENCY ${ARGN})
- WRT_INTROSPECT_TARGET(prefix ${DEPENDENCY})
- WRT_TEST_INCLUDE_DIRECTORIES(${TARGET_NAME} ${prefix_INCLUDE_DIRS})
- WRT_TEST_LINK_DIRECTORIES(${TARGET_NAME} ${prefix_LIBRARY_DIRS})
- WRT_TEST_TARGET_LINK_LIBRARIES(${TARGET_NAME} ${DEPENDENCY})
- ENDFOREACH(DEPENDENCY)
-ENDFUNCTION(WRT_TEST_ADD_INTERNAL_DEPENDENCIES)
-
-# Functions used to build test targets (proper sources, includes, libs are
-# added automatically)
-FUNCTION(WRT_TEST_BUILD TARGET_NAME)
- SET(SOURCES "${ARGN}")
- ADD_EXECUTABLE("${TARGET_NAME}" ${SOURCES})
-
- # get include dirs global property
- GET_PROPERTY(INCLUDE_DIRS GLOBAL PROPERTY TESTS_INCLUDE_DIRS)
- GET_PROPERTY(TEST_INCLUDE_DIRS GLOBAL PROPERTY ${TARGET_NAME}_INCLUDE_DIRS)
- INCLUDE_DIRECTORIES(
- ${INCLUDE_DIRS}
- ${TEST_INCLUDE_DIRS}
- )
-
- # get library dirs global property
- GET_PROPERTY(LIBRARY_DIRS GLOBAL PROPERTY TESTS_LIBRARY_DIRS)
- GET_PROPERTY(TEST_LIBRARY_DIRS GLOBAL PROPERTY ${TARGET_NAME}_LIBRARY_DIRS)
- LINK_DIRECTORIES(
- ${LIBRARY_DIRS}
- ${TEST_LIBRARY_DIRS}
- )
-
- # get link libraries global property
- GET_PROPERTY(LINK_LIBRARIES GLOBAL PROPERTY TESTS_LIBRARIES)
- GET_PROPERTY(TEST_LIBRARIES GLOBAL PROPERTY ${TARGET_NAME}_LIBRARIES)
- TARGET_LINK_LIBRARIES("${TARGET_NAME}"
- ${LINK_LIBRARIES}
- ${TEST_LIBRARIES}
- )
-ENDFUNCTION(WRT_TEST_BUILD)
-
-FUNCTION(WRT_TEST_INSTALL)
- SET_TARGET_PROPERTIES(${ARGV} PROPERTIES
- BUILD_WITH_INSTALL_RPATH ON
- INSTALL_RPATH_USE_LINK_PATH ON
- )
- INSTALL(TARGETS ${ARGV}
- DESTINATION bin
- PERMISSIONS OWNER_READ
- OWNER_WRITE
- OWNER_EXECUTE
- GROUP_READ
- GROUP_EXECUTE
- WORLD_READ
- WORLD_EXECUTE
- )
-ENDFUNCTION(WRT_TEST_INSTALL)
-
-# Takes arbitrary number of arguments and concatenates them using ':' character.
-# Rationale:
-# CMake list when converted to a string is joined with ';' character. However,
-# GCC takes strings with multiple elements separated with ':' (e.g. list of
-# paths). Used typically when generating DB schemas with ORM mechanism.
-FUNCTION(WRT_CONVERT_TO_GCC_LIST OUTPUT_VARIABLE)
- FOREACH(ITEM ${ARGN})
- LIST(APPEND ITEMS ${ITEM})
- ENDFOREACH(ITEM)
- STRING(REPLACE ";" ":" OUTPUT "${ITEMS}")
- SET("${OUTPUT_VARIABLE}" "${OUTPUT}" PARENT_SCOPE)
-ENDFUNCTION(WRT_CONVERT_TO_GCC_LIST)
}
char buffer[1024] = "";
- int ret;
- while ((ret = fread_unlocked(buffer,
- sizeof(char),
- sizeof(buffer)/sizeof(char),
- filehandle)) > 0)
+ while ( fread_unlocked(buffer, sizeof(char),
+ sizeof(buffer)/sizeof(char), filehandle) > 0 )
{
msg += buffer;
}
* limitations under the License.
*/
-#ifndef WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_INSTALLER_WRAPPER_H
-#define WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_INSTALLER_WRAPPER_H
+#ifndef WRT_INSTALLER_TESTS_GENERAL_INSTALLER_WRAPPER_H
+#define WRT_INSTALLER_TESTS_GENERAL_INSTALLER_WRAPPER_H
#include <string>
const InstallResult OtherError = -1;
const InstallResult Success = 0;
+const std::string miscWidgetsStuff = "/opt/share/widget/tests/installer/";
+
+struct Result {
+ bool m_exc;
+ bool m_exd;
+ bool m_exs;
+ std::string message;
+ Result(bool exc = false, bool exd = false, bool exs = false)
+ : m_exc(exc), m_exd(exd), m_exs(exs) {}
+};
+
InstallResult install(
const std::string& path,
std::string& tizenId,
}
-#endif//WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_INSTALLER_WRAPPER_H
+#endif//WRT_INSTALLER_TESTS_GENERAL_INSTALLER_WRAPPER_H
* @brief Manifest file reading
*/
-#ifndef WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H
-#define WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H
+#ifndef WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H
+#define WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H
#include <string>
};
-#endif //WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H
+#endif //WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H
* @author Karol Pawlowski (k.pawlowski@samsung.com)
* @author Tomasz Iwanek (t.iwanek@samsung.com)
* @version 1.0
- * @brief Miscellaneous test's bodies
+ * @brief Manifest installation test's bodies
*/
#include <string>
#include <dpl/utils/wrt_utility.h>
#include <dpl/test/test_runner.h>
-#include <dpl/log/log.h>
#include <InstallerWrapper.h>
#include <ManifestFile.h>
using namespace InstallerWrapper;
-namespace {
-
-const std::string miscWidgetsStuff = "/opt/share/widget/tests/misc/";
-
-struct Result {
- bool m_exc;
- bool m_exd;
- bool m_exs;
- std::string message;
- Result(bool exc = false, bool exd = false, bool exs = false)
- : m_exc(exc), m_exd(exd), m_exs(exs) {}
-};
-
-}
-
////////////////////////////////////////////////////////////////////////////////
RUNNER_TEST_GROUP_INIT(Manifest)
/* If test finished sucessfully than uninstall test widget */
uninstall(tizenId);
}
-
-////////////////////////////////////////////////////////////////////////////////
-
-RUNNER_TEST_GROUP_INIT(BackgroundPage)
-
-/*
-Name: widgetWithBackgroundPage
-Description: Tests if widget with background page is installed correctly
-Expected: widget should be installed correctly
-*/
-RUNNER_TEST(widgetWithBackgroundPage)
-{
- std::string tizenId;
- RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/bg-00-with_bg.wgt",
- tizenId) == InstallerWrapper::Success);
- uninstall(tizenId);
-}
-
-/*
-Name: missingBackgroundFile
-Description: Tests if widget with declared in conifg background page
- but missing background file will be installed correctly.
-Expected: widget should NOT be installed
-*/
-RUNNER_TEST(missingBackgroundFile)
-{
- std::string tizenId;
- if(install(miscWidgetsStuff + "widgets/bg-01-missing_file.wgt",
- tizenId) == InstallerWrapper::Success) {
- uninstall(tizenId);
- RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
- }
-}
-
-/*
-Name: widgetWithoutBackgroundPage
-Description: Complementary test to check if normal widget\
- without background page is successfully installed
-Expected: widget should be installed
-*/
-RUNNER_TEST(widgetWithoutBackgroundPage)
-{
- std::string tizenId;
- RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/bg-02-without_bg.wgt",
- tizenId) == InstallerWrapper::Success);
- uninstall(tizenId);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-RUNNER_TEST_GROUP_INIT(NonRootUser)
-
-/*
-Name: widgetNonRootInstallation
-Description: Check installation from other user than root
-Expected: widget should be installed
-*/
-RUNNER_TEST(widgetNonRootInstallation)
-{
- std::string tizenId;
- RUNNER_ASSERT(install(
- miscWidgetsStuff + "widgets/nonroot.wgt",
- tizenId,
- "app") == InstallerWrapper::Success);
- uninstall(tizenId);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
-RUNNER_TEST_GROUP_INIT(NPluginsInstall)
-
-/*
-Name: pluginFilesAdded
-Description: Tests installation of plugins attached to widget
-Expected: widget should be succesfully installed
-*/
-RUNNER_TEST(pluginFilesAdded)
-{
- std::string tizenId;
- RUNNER_ASSERT(install(miscWidgetsStuff
- + "widgets/inst_nplug_1.wgt", tizenId) == InstallerWrapper::Success);
- uninstall(tizenId);
-}
-
-/*
-Name: emptyPluginsDir
-Description: Tests installation with empty 'plugins' directory
-Expected: widget should be not installed
-*/
-RUNNER_TEST(emptyPluginsDir)
-{
- std::string tizenId;
- if(install(miscWidgetsStuff + "widgets/inst_nplug_2.wgt",
- tizenId) == InstallerWrapper::Success) {
- uninstall(tizenId);
- RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
- }
-}
-
-/*
-Name: pluginFileAndOtherFile
-Description: Tests installation with plugins directory and data files
-Expected: widget should be installed
-*/
-RUNNER_TEST(pluginFileAndOtherFile)
-{
- std::string tizenId;
- RUNNER_ASSERT(install(miscWidgetsStuff
- + "widgets/inst_nplug_3.wgt", tizenId) == InstallerWrapper::Success);
- uninstall(tizenId);
-}
-
-/*
-Name: pluginFileAndSubdir
-Description: Tests installation with 'plugins' directory and subdirectories
- inside plugin directory
-Expected: widget should be not installed
-*/
-RUNNER_TEST(pluginFileAndSubdir)
-{
- std::string tizenId;
- if(install(miscWidgetsStuff + "widgets/inst_nplug_4.wgt",
- tizenId) == InstallerWrapper::Success) {
- uninstall(tizenId);
- RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
- }
-}
--- /dev/null
+/*
+ * Copyright (c) 2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file TestCases.cpp
+ * @author Karol Pawlowski (k.pawlowski@samsung.com)
+ * @author Tomasz Iwanek (t.iwanek@samsung.com)
+ * @version 1.0
+ * @brief NPlugins installation test's bodies
+ */
+
+#include <string>
+#include <dpl/test/test_runner.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(NPluginsInstall)
+
+/*
+Name: pluginFilesAdded
+Description: Tests installation of plugins attached to widget
+Expected: widget should be succesfully installed
+*/
+RUNNER_TEST(pluginFilesAdded)
+{
+ std::string tizenId;
+ RUNNER_ASSERT(install(miscWidgetsStuff
+ + "widgets/inst_nplug_1.wgt", tizenId) == InstallerWrapper::Success);
+ uninstall(tizenId);
+}
+
+/*
+Name: emptyPluginsDir
+Description: Tests installation with empty 'plugins' directory
+Expected: widget should be not installed
+*/
+RUNNER_TEST(emptyPluginsDir)
+{
+ std::string tizenId;
+ if(install(miscWidgetsStuff + "widgets/inst_nplug_2.wgt",
+ tizenId) == InstallerWrapper::Success) {
+ uninstall(tizenId);
+ RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
+ }
+}
+
+/*
+Name: pluginFileAndOtherFile
+Description: Tests installation with plugins directory and data files
+Expected: widget should be installed
+*/
+RUNNER_TEST(pluginFileAndOtherFile)
+{
+ std::string tizenId;
+ RUNNER_ASSERT(install(miscWidgetsStuff
+ + "widgets/inst_nplug_3.wgt", tizenId) == InstallerWrapper::Success);
+ uninstall(tizenId);
+}
+
+/*
+Name: pluginFileAndSubdir
+Description: Tests installation with 'plugins' directory and subdirectories
+ inside plugin directory
+Expected: widget should be not installed
+*/
+RUNNER_TEST(pluginFileAndSubdir)
+{
+ std::string tizenId;
+ if(install(miscWidgetsStuff + "widgets/inst_nplug_4.wgt",
+ tizenId) == InstallerWrapper::Success) {
+ uninstall(tizenId);
+ RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file TestCases.cpp
+ * @author Karol Pawlowski (k.pawlowski@samsung.com)
+ * @author Tomasz Iwanek (t.iwanek@samsung.com)
+ * @version 1.0
+ * @brief Non root user installation test's bodies
+ */
+
+#include <string>
+#include <dpl/test/test_runner.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(NonRootUser)
+
+/*
+Name: widgetNonRootInstallation
+Description: Check installation from other user than root
+Expected: widget should be installed
+*/
+RUNNER_TEST(widgetNonRootInstallation)
+{
+ std::string tizenId;
+ RUNNER_ASSERT(install(
+ miscWidgetsStuff + "widgets/nonroot.wgt",
+ tizenId,
+ "app") == InstallerWrapper::Success);
+ uninstall(tizenId);
+}
--- /dev/null
+/*
+ * Copyright (c) 2013 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file TestCases.cpp
+ * @author Karol Pawlowski (k.pawlowski@samsung.com)
+ * @author Andrzej Surdej (a.surdej@samsung.com)
+ * @version 1.0
+ * @brief Parsing Tizen Appservice test's bodies
+ */
+
+#include <string>
+#include <algorithm>
+#include <dpl/test/test_runner.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(ParsingTizenAppservice)
+
+/*
+Name: correct_csp_policy
+Description: Tests if widget policy is correctly parsed from config file
+ and stored into database
+Expected: widget should be installed and policy should mach
+*/
+RUNNER_TEST(tizen_appservice_disposition)
+{
+ std::string tizenId;
+ RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/appservice_dispos.wgt",
+ tizenId) == InstallerWrapper::Success);
+
+ WrtDB::WidgetDAOReadOnly dao(DPL::FromASCIIString(tizenId));
+ WidgetApplicationServiceList appsvcList;
+ dao.getAppServiceList(appsvcList);
+ uninstall(tizenId);
+
+ RUNNER_ASSERT_MSG(appsvcList.size() == 4, "Incorrect list size");
+ WidgetApplicationService s;
+ s.src = DPL::FromUTF8String("edit1.html");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/edit");
+ s.mime = DPL::FromUTF8String("image/jpg"); /* mime type */
+ s.disposition = WidgetApplicationService::Disposition::WINDOW;
+ RUNNER_ASSERT_MSG(
+ std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ "Unable to find service #");
+
+ s.src = DPL::FromUTF8String("edit2.html");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/view");
+ s.mime = DPL::FromUTF8String("audio/ogg"); /* mime type */
+ s.disposition = WidgetApplicationService::Disposition::WINDOW;
+ RUNNER_ASSERT_MSG(
+ std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ "Unable to find service ##");
+
+ s.src = DPL::FromUTF8String("edit3.html");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/call");
+ s.mime = DPL::FromUTF8String("image/png"); /* mime type */
+ s.disposition = WidgetApplicationService::Disposition::INLINE;
+ RUNNER_ASSERT_MSG(
+ std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ "Unable to find service ###");
+
+ s.src = DPL::FromUTF8String("edit4.html");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/send");
+ s.mime = DPL::FromUTF8String("text/css"); /* mime type */
+ s.disposition = WidgetApplicationService::Disposition::WINDOW;
+ RUNNER_ASSERT_MSG(
+ std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ "Unable to find service ####");
+}
* @file TestInit.cpp
* @author Tomasz Iwanek (t.iwanek@samsung.com)
* @version 1.0
- * @brief main for misc tests
+ * @brief Main for wrt-installer general tests
*/
#include <dpl/test/test_runner.h>
+++ /dev/null
-# Copyright (c) 2013 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.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# @file CMakeLists.txt
-# @author Tomasz Iwanek (t.iwanek@samsung.com)
-# @author Karol Pawlowski (k.pawlowski@samsung.com)
-# @version 1.0
-# @brief
-#
-
-SET(COMMON_INCLUDES "${CMAKE_CURRENT_SOURCE_DIR}/include")
-
-WRT_TEST_LIBRARY(${WRT_TEST_LIBRARY})
-
-WRT_INCLUDE_DIRECTORIES(
- ${COMMON_LIB_PKGS_INCLUDE_DIRS}
- ${COMMON_INCLUDES}
- )
-WRT_LINK_DIRECTORIES(${COMMON_LIB_PKGS_LIBRARY_DIRS})
-WRT_TARGET_LINK_LIBRARIES(${COMMON_LIB_PKGS_LIBRARIES})
-
-SET(WRT_DETAIL_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/src/InstallerWrapper.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/src/ManifestFile.cpp
-)
-
-INCLUDE_DIRECTORIES(${COMMON_INCLUDES})
-INCLUDE_DIRECTORIES(${COMMON_LIB_PKGS_INCLUDE_DIRS})
-
-ADD_LIBRARY(${WRT_TEST_LIBRARY} STATIC ${WRT_DETAIL_SOURCES})
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers6">
- <tizen:application id="listener02" required_version="1.0"/>
- <name>listener02</name>
-</widget>
-
+++ /dev/null
-var id = "listener02";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerContentHandler("application/test", "test.html?uri=%s", "Example content");
- if (navigator.isContentHandlerRegistered("application/test", "test.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } else {
- hook(id, 'fail', 'content handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers8">
- <tizen:application id="listener04" required_version="1.0"/>
- <name>listener04</name>
-</widget>
-
+++ /dev/null
-var id = "listener02";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerContentHandler("application/test", "test.html?uri=%s", "Example content");
- if (navigator.isContentHandlerRegistered("application/test", "test.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } else {
- hook(id, 'fail', 'content handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers5">
- <tizen:application id="listener01" required_version="1.0"/>
- <name>listener01</name>
-</widget>
-
+++ /dev/null
-var id = "listener01";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerProtocolHandler("news", "news.html?uri=%s", "Example news");
- if (navigator.isProtocolHandlerRegistered("news", "news.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } else {
- hook(id, 'fail', 'protocol handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers7">
- <tizen:application id="listener03" required_version="1.0"/>
- <name>listener03</name>
-</widget>
-
+++ /dev/null
-var id = "listener01";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerProtocolHandler("news", "news.html?uri=%s", "Example news");
- if (navigator.isProtocolHandlerRegistered("news", "news.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } else {
- hook(id, 'fail', 'protocol handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers3">
- <tizen:application id="register03" required_version="1.0"/>
- <name>register03</name>
-</widget>
-
+++ /dev/null
-var id = "register03";
-
-function hook(id, result, message){};
-
-try {
- navigator.registerContentHandler("application/test", "?uri=%s", "Example content");
- if (navigator.isContentHandlerRegistered("application/test", "?uri=%s") === 'registered') {
- navigator.unregisterContentHandler("application/test", "?uri=%s");
- if (navigator.isContentHandlerRegistered("application/test", "?uri=%s") === 'new') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } else {
- hook(id, 'fail', 'content handler registered (tried to unregister)');
- }
- } else {
- hook(id, 'fail', 'content handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers4">
- <tizen:application id="register04" required_version="1.0"/>
- <name>register04</name>
-</widget>
-
+++ /dev/null
-var id = "register04";
-
-function hook(id, result, message){};
-
-try {
- try {
- navigator.registerContentHandler("text/html", "?uri=%s", "Example http");
- throw new Error("Exception not thrown!");
- } catch (e) {
- if (!(e instanceof DOMException) || e.code != 18 || e.name != "SECURITY_ERR") {
- throw e;
- }
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers1">
- <tizen:application id="register01" required_version="1.0"/>
- <name>register01</name>
-</widget>
-
+++ /dev/null
-var id = "register01";
-
-function hook(id, result, message){};
-
-try {
- navigator.registerProtocolHandler("news", "?uri=%s", "Example magnet");
- if (navigator.isProtocolHandlerRegistered("news", "?uri=%s") === 'registered') {
- navigator.unregisterProtocolHandler("news", "?uri=%s");
- if (navigator.isProtocolHandlerRegistered("news", "?uri=%s") === 'new') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } else {
- hook(id, 'fail', 'protocol handler registered (tried to unregister)');
- }
- } else {
- hook(id, 'fail', 'protocol handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers2">
- <tizen:application id="register02" required_version="1.0"/>
- <name>register02</name>
-</widget>
-
+++ /dev/null
-var id = "register02";
-
-function hook(id, result, message){};
-
-try {
- try {
- navigator.registerProtocolHandler("http", "?uri=%s", "Example http");
- throw new Error("Exception not thrown!");
- } catch (e) {
- if (!(e instanceof DOMException) || e.code != 18 || e.name != "SECURITY_ERR") {
- throw e;
- }
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
--- /dev/null
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
+ id="http://test.samsung.com/widget/wac/tizen_appservice"
+ version="1.0.0"
+ min-version="1.0">
+ <name short="Disposition">Disposition_attribute</name>
+ <icon src="icon.png" height="75" width="75"/>
+ <tizen:appservice src="edit1.html" operation="http://tizen.org/appsvc/operation/edit" mime="image/jpg" />
+ <tizen:appservice src="edit2.html" operation="http://tizen.org/appsvc/operation/view" mime="audio/ogg" disposition="window"/>
+ <tizen:appservice src="edit3.html" operation="http://tizen.org/appsvc/operation/call" mime="image/png" disposition="inline"/>
+ <tizen:appservice src="edit4.html" operation="http://tizen.org/appsvc/operation/send" mime="text/css" disposition="wrongone"/>
+ <content src="index.html" />
+</widget>
--- /dev/null
+<html>
+ <head>
+ <title>Disposition attribute</title>
+ </head>
+ <body style="background-color:gray">
+ <h1>Check database.</h1>
+ </body>
+</html>