From: Jihoon Chung Date: Thu, 7 Mar 2013 00:33:41 +0000 (+0900) Subject: [Release] wrt-installer_0.1.9 X-Git-Tag: accepted/tizen_2.1/20130425.023916~20^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f56543848daf0a8585b6023c11cb1738b42b5e1e;p=framework%2Fweb%2Fwrt-installer.git [Release] wrt-installer_0.1.9 --- diff --git a/debian/changelog b/debian/changelog index d4da580..c13e49f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,27 @@ +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 Thu, 07 Mar 2013 09:11:07 +0900 + +wrt-installer (0.1.8) unstable; urgency=low + + * Release + + -- Leerang Song 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 Wed, 27 Feb 2013 15:53:56 +0900 + wrt-installer (0.1.6) unstable; urgency=low * code clean up - src/configuration_parser/WidgetConfigurationManager diff --git a/packaging/wrt-installer.spec b/packaging/wrt-installer.spec index 40c9333..bd52e90 100644 --- a/packaging/wrt-installer.spec +++ b/packaging/wrt-installer.spec @@ -1,7 +1,7 @@ -#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 @@ -113,4 +113,5 @@ mkdir -p /opt/share/icons/default/small %{_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 diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index 5f0d6ca..3b0a0ec 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -88,6 +88,7 @@ void UpdateTextWithDirectionMark(Direction direction, break; default: Assert(false); + break; } } } // namespace Unicode @@ -275,6 +276,7 @@ class AccessParser : public ElementParser break; default: LogError("Error in Access tag - unknown standard."); + break; } } @@ -293,7 +295,7 @@ class AccessParser : public ElementParser ConfigParserData::AccessInfo accessInfo(m_strIRIOrigin, m_bSubDomainAccess); - std::pair ret = + //std::pair ret = m_data.accessInfoSet.insert(accessInfo); } @@ -305,6 +307,7 @@ class AccessParser : public ElementParser break; default: LogError("Error in Access tag - unknown standard."); + break; } } @@ -1055,6 +1058,10 @@ class AppServiceParser : public ElementParser 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; } } @@ -1086,6 +1093,15 @@ class AppServiceParser : public ElementParser 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""); @@ -1093,7 +1109,8 @@ class AppServiceParser : public ElementParser 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 && @@ -1128,6 +1145,7 @@ class AppServiceParser : public ElementParser m_operation(DPL::OptionalString::Null), m_scheme(DPL::OptionalString::Null), m_mime(DPL::OptionalString::Null), + m_disposition(ConfigParserData::ServiceInfo::Disposition::WINDOW), m_data(data) {} @@ -1136,6 +1154,7 @@ class AppServiceParser : public ElementParser DPL::OptionalString m_operation; DPL::OptionalString m_scheme; DPL::OptionalString m_mime; + ConfigParserData::ServiceInfo::Disposition m_disposition; ConfigParserData& m_data; }; @@ -1261,15 +1280,22 @@ class AppControlParser : public ElementParser 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 { @@ -1363,7 +1389,7 @@ class AppControlParser : public ElementParser } } - virtual void Accept(const XmlAttribute& attribute) + virtual void Accept(const XmlAttribute& /*attribute*/) {} virtual void Accept(const Element& element) @@ -1392,16 +1418,6 @@ class AppControlParser : public ElementParser 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); } @@ -1445,7 +1461,7 @@ class ApplicationParser : public ElementParser return &IgnoringParser::Create; } - virtual void Accept(const Text& text) + virtual void Accept(const Text& /*text*/) { if (m_properNamespace) { LogDebug("text"); @@ -1539,7 +1555,7 @@ class SplashParser : public ElementParser } } - virtual void Accept(const Element& element) + virtual void Accept(const Element& /*element*/) {} virtual void Accept(const Text& /*text*/) @@ -1614,7 +1630,7 @@ class PrivilegeParser : public ElementParser { public: virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& name) + const DPL::String& /*name*/) { return &IgnoringParser::Create; } @@ -1752,7 +1768,7 @@ class LiveboxParser : public ElementParser return &IgnoringParser::Create; } - virtual void Accept(const XmlAttribute& attribute) + virtual void Accept(const XmlAttribute& /*attribute*/) {} virtual void Accept(const Element& element) @@ -1880,6 +1896,7 @@ class LiveboxParser : public ElementParser explicit BoxSizeParser( ConfigParserData::LiveboxInfo::BoxContentInfo& data) : ElementParser(), + m_properNamespace(false), m_data(data) {} @@ -1893,7 +1910,7 @@ class LiveboxParser : public ElementParser struct PdParser : public ElementParser { virtual ActionFunc GetElementParser(const DPL::String& /*ns*/, - const DPL::String& name) + const DPL::String& /*name*/) { return &IgnoringParser::Create; } @@ -2108,8 +2125,8 @@ class LiveboxParser : public ElementParser 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; } @@ -2127,7 +2144,7 @@ class CspParser : public ElementParser } } - virtual void Accept(const XmlAttribute& attribute) + virtual void Accept(const XmlAttribute& /*attribute*/) {} virtual void Accept(const Text& text) @@ -2150,6 +2167,51 @@ class CspParser : public ElementParser 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& @@ -2208,6 +2270,10 @@ WidgetParser::WidgetParser(ConfigParserData& data) : this, &WidgetParser:: OnCspElement); + m_map[L"Content-Security-Policy-Report-Only"] = DPL::MakeDelegate( + this, + &WidgetParser:: + OnCspReportOnlyElement); #endif } @@ -2311,6 +2377,11 @@ ElementParserPtr WidgetParser::OnCspElement() 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 && diff --git a/src/configuration_parser/widget_parser.h b/src/configuration_parser/widget_parser.h index af39afd..c8c1a2b 100644 --- a/src/configuration_parser/widget_parser.h +++ b/src/configuration_parser/widget_parser.h @@ -84,6 +84,7 @@ class WidgetParser : public ElementParser ElementParserPtr OnCategoryElement(); ElementParserPtr OnLiveboxElement(); ElementParserPtr OnCspElement(); + ElementParserPtr OnCspReportOnlyElement(); virtual ActionFunc GetElementParser(const DPL::String& ns, const DPL::String& name); diff --git a/src/jobs/job.cpp b/src/jobs/job.cpp index ec56d3d..335ab76 100644 --- a/src/jobs/job.cpp +++ b/src/jobs/job.cpp @@ -18,6 +18,7 @@ namespace Jobs { Job::Job(InstallationType installType) : + m_handle(0), m_installationType(installType), m_UndoType(false), m_paused(false) @@ -95,7 +96,7 @@ void Job::SendFinishedSuccess() void Job::SendFinishedFailure() {} -void Job::SendProgressIconPath(const std::string &path) +void Job::SendProgressIconPath(const std::string &/*path*/) {} void Job::SaveExceptionData(const Jobs::JobExceptionBase&) diff --git a/src/jobs/plugin_install/plugin_install_task.cpp b/src/jobs/plugin_install/plugin_install_task.cpp index b4c30c3..2eccd38 100644 --- a/src/jobs/plugin_install/plugin_install_task.cpp +++ b/src/jobs/plugin_install/plugin_install_task.cpp @@ -64,6 +64,7 @@ namespace PluginInstall { PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) : DPL::TaskDecl(this), m_context(inCont), + m_pluginHandle(0), m_dataFromConfigXML(true) { AddStep(&PluginInstallTask::stepCheckPluginPath); diff --git a/src/jobs/plugin_install/plugin_installer_errors.h b/src/jobs/plugin_install/plugin_installer_errors.h index 73132f0..16ad13f 100644 --- a/src/jobs/plugin_install/plugin_installer_errors.h +++ b/src/jobs/plugin_install/plugin_installer_errors.h @@ -35,9 +35,9 @@ enum Type { 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 diff --git a/src/jobs/widget_install/ace_registration.cpp b/src/jobs/widget_install/ace_registration.cpp index faee3ea..e2077ef 100644 --- a/src/jobs/widget_install/ace_registration.cpp +++ b/src/jobs/widget_install/ace_registration.cpp @@ -92,6 +92,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, default: LogDebug("Unknown owner type of cert"); certData[i]->owner = UNKNOWN; + break; } switch (it->type) { case WrtDB::WidgetCertificateData::ENDENTITY: @@ -103,6 +104,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, default: LogError("Unknown type of cert"); certData[i]->type = ENDENTITY; + break; } certData[i]->chain_id = it->chainId; @@ -114,8 +116,7 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle, } 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(widgetHandle), &wi, certData); //clean up - WidgetInfo diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index a1150f8..e693422 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -167,10 +167,6 @@ JobWidgetInstall::JobWidgetInstall( JobContextBase(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); @@ -407,8 +403,11 @@ void JobWidgetInstall::setTizenId( // 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"); } @@ -529,9 +528,8 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate( 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"); diff --git a/src/jobs/widget_install/languages.def b/src/jobs/widget_install/languages.def index e26443f..e9439b6 100644 --- a/src/jobs/widget_install/languages.def +++ b/src/jobs/widget_install/languages.def @@ -1,15 +1,15 @@ -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) diff --git a/src/jobs/widget_install/task_certificates.cpp b/src/jobs/widget_install/task_certificates.cpp index b4a67f7..04247fa 100644 --- a/src/jobs/widget_install/task_certificates.cpp +++ b/src/jobs/widget_install/task_certificates.cpp @@ -39,7 +39,8 @@ namespace Jobs { namespace WidgetInstall { TaskCertificates::TaskCertificates(InstallerContext& context) : DPL::TaskDecl(this), - m_context(context) + m_context(context), + m_pkgHandle(NULL) { AddStep(&TaskCertificates::StepSetCertiInfo); AddAbortStep(&TaskCertificates::StepAbortCertiInfo); diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp index 342b5f4..6b0040f 100644 --- a/src/jobs/widget_install/task_certify.cpp +++ b/src/jobs/widget_install/task_certify.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "wac_widget_id.h" @@ -99,8 +98,8 @@ namespace Jobs { namespace WidgetInstall { TaskCertify::TaskCertify(InstallerContext &inCont) : DPL::TaskDecl(this), - m_contextData(inCont), - WidgetInstallPopup(inCont) + WidgetInstallPopup(inCont), + m_contextData(inCont) { AddStep(&TaskCertify::stepSignature); diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp index 072a9f9..874bad8 100644 --- a/src/jobs/widget_install/task_database.cpp +++ b/src/jobs/widget_install/task_database.cpp @@ -246,12 +246,6 @@ void TaskDatabase::StepCreateVconf() 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; diff --git a/src/jobs/widget_install/task_encrypt_resource.cpp b/src/jobs/widget_install/task_encrypt_resource.cpp index a7483f0..ae9cebb 100644 --- a/src/jobs/widget_install/task_encrypt_resource.cpp +++ b/src/jobs/widget_install/task_encrypt_resource.cpp @@ -163,7 +163,8 @@ namespace Jobs { namespace WidgetInstall { TaskEncryptResource::TaskEncryptResource(InstallerContext& context) : DPL::TaskDecl(this), - m_context(context) + m_context(context), + m_resEnc(NULL) { AddStep(&TaskEncryptResource::StepEncryptResource); } @@ -224,6 +225,7 @@ void TaskEncryptResource::EncryptDirectory(std::string path) << " with error: " << strerror(ftsent->fts_errno)); ThrowMsg(Exceptions::InternalError, "Error reading file"); + break; } } @@ -241,7 +243,8 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName) 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; diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index fddd770..db50d6b 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -56,11 +56,15 @@ bool _FolderCopy(std::string source, std::string dest) 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) { @@ -88,7 +92,7 @@ bool _FolderCopy(std::string source, std::string dest) outfile.close(); infile.close(); } - } while (dEntry); + } while (dEntryResult != NULL && return_code == 0); closedir(dir); return true; } @@ -98,7 +102,8 @@ namespace Jobs { namespace WidgetInstall { TaskFileManipulation::TaskFileManipulation(InstallerContext& context) : DPL::TaskDecl(this), - m_context(context) + m_context(context), + m_extHandle(NULL) { if (INSTALL_LOCATION_TYPE_EXTERNAL != m_context.locationType) diff --git a/src/jobs/widget_install/task_install_ospsvc.cpp b/src/jobs/widget_install/task_install_ospsvc.cpp index 3fe94ef..7909c26 100644 --- a/src/jobs/widget_install/task_install_ospsvc.cpp +++ b/src/jobs/widget_install/task_install_ospsvc.cpp @@ -69,7 +69,15 @@ void TaskInstallOspsvc::StepInstallOspService() "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); diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index 298a06d..135b252 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -102,7 +102,8 @@ const char * TaskManifestFile::encoding = "UTF-8"; TaskManifestFile::TaskManifestFile(InstallerContext &inCont) : DPL::TaskDecl(this), - m_context(inCont) + m_context(inCont), + writer(NULL) { if (false == m_context.existingWidgetInfo.isExist) { AddStep(&TaskManifestFile::stepCopyIconFiles); @@ -133,11 +134,20 @@ void TaskManifestFile::stepCreateExecFile() 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() @@ -161,7 +171,7 @@ void TaskManifestFile::stepCopyIconFiles() for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator icon = icons.rbegin(); icon != icons.rend(); - icon++) + ++icon) { FOREACH(locale, icon->availableLocales) { @@ -375,9 +385,9 @@ void TaskManifestFile::updateAilInfo() 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) { @@ -454,18 +464,27 @@ void TaskManifestFile::getFileList(const char* path, 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()); @@ -667,7 +686,7 @@ void TaskManifestFile::setWidgetIcons(UiApplication & uiApp) for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator icon = icons.rbegin(); icon != icons.rend(); - icon++) + ++icon) { FOREACH(locale, icon->availableLocales) { @@ -856,10 +875,9 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest) LiveBoxInfo liveBox; DPL::Optional 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); diff --git a/src/jobs/widget_install/task_plugins_copy.cpp b/src/jobs/widget_install/task_plugins_copy.cpp index 1b6d02e..bf295ea 100644 --- a/src/jobs/widget_install/task_plugins_copy.cpp +++ b/src/jobs/widget_install/task_plugins_copy.cpp @@ -85,7 +85,6 @@ void TaskPluginsCopy::StepFindPlugins() /* 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()); @@ -94,10 +93,17 @@ void TaskPluginsCopy::StepFindPlugins() 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 @@ -107,11 +113,11 @@ void TaskPluginsCopy::StepFindPlugins() } /* 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( @@ -127,7 +133,7 @@ void TaskPluginsCopy::StepFindPlugins() } } - 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) @@ -140,6 +146,10 @@ void TaskPluginsCopy::StepFindPlugins() 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()); @@ -171,7 +181,7 @@ void TaskPluginsCopy::StepCopyPlugins() /* Copy plugins from widget package into * .netscape/plugins in widget's target directory */ for (std::list::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); diff --git a/src/jobs/widget_install/task_recovery.cpp b/src/jobs/widget_install/task_recovery.cpp index bdf2e71..c6a5e9b 100644 --- a/src/jobs/widget_install/task_recovery.cpp +++ b/src/jobs/widget_install/task_recovery.cpp @@ -63,11 +63,11 @@ void TaskRecovery::StepCreateCheckFile() 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(); diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index 5bbb173..75d0fc8 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -65,5 +65,6 @@ void TaskSmack::Step() "Widget SMACK Enabled"); #endif } + } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_update_files.cpp b/src/jobs/widget_install/task_update_files.cpp index bcbd2f3..76ff014 100644 --- a/src/jobs/widget_install/task_update_files.cpp +++ b/src/jobs/widget_install/task_update_files.cpp @@ -69,7 +69,6 @@ TaskUpdateFiles::TaskUpdateFiles(InstallerContext& context) : void TaskUpdateFiles::StepCreateBackupFolder() { LogDebug("StepCreateBackupFolder"); - std::ostringstream backDirPath; std::string srcBuPath = m_context.locations->getBackupSourceDir(); LogDebug("backup resource directory path : " << srcBuPath); @@ -105,28 +104,36 @@ void TaskUpdateFiles::ReadDirList(std::string dirPath, ExistFileList &list, 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: " @@ -244,8 +251,17 @@ void TaskUpdateFiles::StepExecFileBackup() 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"); diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index 54462a6..74b006d 100644 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -44,7 +44,6 @@ #include #include #include -#include namespace { // anonymous const DPL::String BR = DPL::FromUTF8String("
"); @@ -126,32 +125,37 @@ void TaskWidgetConfig::ReadLocaleFolders() 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))) { @@ -642,9 +646,7 @@ bool TaskWidgetConfig::isTizenWebApp() const bool TaskWidgetConfig::parseConfigurationFileBrowser( WrtDB::ConfigParserData& configInfo, - const std::string& - _currentPath, - int* pErrCode) + const std::string& _currentPath) { ParserRunner parser; Try @@ -659,7 +661,6 @@ bool TaskWidgetConfig::parseConfigurationFileBrowser( Catch(ElementParser::Exception::Base) { LogError("Invalid widget configuration file!"); - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; return false; } return true; @@ -667,29 +668,32 @@ bool TaskWidgetConfig::parseConfigurationFileBrowser( 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 @@ -709,8 +713,6 @@ bool TaskWidgetConfig::parseConfigurationFileWidget( 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 << @@ -725,6 +727,10 @@ bool TaskWidgetConfig::parseConfigurationFileWidget( } } } + 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()); @@ -733,7 +739,6 @@ bool TaskWidgetConfig::parseConfigurationFileWidget( //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; @@ -742,15 +747,10 @@ bool TaskWidgetConfig::parseConfigurationFileWidget( 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. @@ -760,26 +760,22 @@ bool TaskWidgetConfig::locateAndParseConfigurationFile( 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; @@ -836,10 +832,8 @@ void TaskWidgetConfig::processFile( 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); diff --git a/src/jobs/widget_install/task_widget_config.h b/src/jobs/widget_install/task_widget_config.h index fe8309c..fdaf1e9 100644 --- a/src/jobs/widget_install/task_widget_config.h +++ b/src/jobs/widget_install/task_widget_config.h @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -120,14 +119,11 @@ class TaskWidgetConfig : 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); diff --git a/src/jobs/widget_install/widget_install_errors.h b/src/jobs/widget_install/widget_install_errors.h index 196ce64..79e8407 100644 --- a/src/jobs/widget_install/widget_install_errors.h +++ b/src/jobs/widget_install/widget_install_errors.h @@ -35,13 +35,11 @@ enum Type { 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 @@ -62,16 +60,11 @@ DECLARE_JOB_EXCEPTION_BASE(JobExceptionBase, Base, ErrorUnknown) // 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 @@ -79,9 +72,7 @@ DECLARE_JOB_EXCEPTION(Base, InvalidPackage, ErrorInvalidPackage) //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) @@ -93,7 +84,6 @@ DECLARE_JOB_EXCEPTION(Base, CopyIconFailed, ErrorUnknown) 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) diff --git a/src/jobs/widget_uninstall/task_check.cpp b/src/jobs/widget_uninstall/task_check.cpp index e87a50a..1a1f62b 100644 --- a/src/jobs/widget_uninstall/task_check.cpp +++ b/src/jobs/widget_uninstall/task_check.cpp @@ -46,9 +46,8 @@ void TaskCheck::StepUninstallPreCheck() //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, diff --git a/src/jobs/widget_uninstall/task_delete_certificates.cpp b/src/jobs/widget_uninstall/task_delete_certificates.cpp index 859bcc1..cb9b7e9 100644 --- a/src/jobs/widget_uninstall/task_delete_certificates.cpp +++ b/src/jobs/widget_uninstall/task_delete_certificates.cpp @@ -42,11 +42,8 @@ TaskDeleteCertificates::~TaskDeleteCertificates() void TaskDeleteCertificates::StepDeleteCertificates() { - pkgmgr_instcertinfo_h handle; - if ((pkgmgr_installer_delete_certinfo( - const_cast(( - m_context.tzAppid).c_str()))) < 0) + const_cast((m_context.tzAppid).c_str()))) < 0) { LogError("pkgmgr_installer_delete_certinfo fail"); } diff --git a/src/jobs/widget_uninstall/task_remove_files.cpp b/src/jobs/widget_uninstall/task_remove_files.cpp index 5f66122..ac26deb 100644 --- a/src/jobs/widget_uninstall/task_remove_files.cpp +++ b/src/jobs/widget_uninstall/task_remove_files.cpp @@ -106,9 +106,9 @@ void TaskRemoveFiles::StepRemoveDesktop() 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) { diff --git a/src/jobs/widget_uninstall/task_smack.cpp b/src/jobs/widget_uninstall/task_smack.cpp index e104bc4..7074dd6 100644 --- a/src/jobs/widget_uninstall/task_smack.cpp +++ b/src/jobs/widget_uninstall/task_smack.cpp @@ -45,7 +45,6 @@ void TaskSmack::Step() 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, diff --git a/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp b/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp index 5d99a11..572b130 100644 --- a/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp +++ b/src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp @@ -64,7 +64,15 @@ void TaskUninstallOspsvc::StepUninstallOspsvc() "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); diff --git a/src/misc/widget_location.cpp b/src/misc/widget_location.cpp index 4bd69f1..d6fff67 100644 --- a/src/misc/widget_location.cpp +++ b/src/misc/widget_location.cpp @@ -28,15 +28,13 @@ #include -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() { @@ -177,7 +175,7 @@ std::string WidgetLocation::getConfigurationDir() const { 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); } diff --git a/src/misc/widget_location.h b/src/misc/widget_location.h index 60028bf..ca98aa6 100644 --- a/src/misc/widget_location.h +++ b/src/misc/widget_location.h @@ -203,10 +203,10 @@ class WidgetLocation 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 m_temp; //directory diff --git a/src/pkg-manager/pkgmgr_signal_dummy.h b/src/pkg-manager/pkgmgr_signal_dummy.h index 34f5837..4c1b3e4 100644 --- a/src/pkg-manager/pkgmgr_signal_dummy.h +++ b/src/pkg-manager/pkgmgr_signal_dummy.h @@ -33,12 +33,12 @@ class PkgmgrSignalDummy : public IPkgmgrSignal 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; } diff --git a/src/wrt-installer/installer_callbacks_translate.cpp b/src/wrt-installer/installer_callbacks_translate.cpp index 3a15224..275c3fd 100644 --- a/src/wrt-installer/installer_callbacks_translate.cpp +++ b/src/wrt-installer/installer_callbacks_translate.cpp @@ -24,60 +24,6 @@ #include 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(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, @@ -98,10 +44,6 @@ 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; @@ -110,18 +52,10 @@ void installFinishedCallback(void *userParam, 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; diff --git a/src/wrt-installer/installer_callbacks_translate.h b/src/wrt-installer/installer_callbacks_translate.h index 9b3eb52..c98e448 100644 --- a/src/wrt-installer/installer_callbacks_translate.h +++ b/src/wrt-installer/installer_callbacks_translate.h @@ -61,10 +61,6 @@ struct PluginStatusCallbackStruct {} }; -void StatusCallback(std::string tizenId, - CommonError::Type result, - void *data); - void installFinishedCallback(void *userParam, std::string tizenId, Jobs::WidgetInstall::Exceptions::Type status); diff --git a/src/wrt-installer/wrt_installer.cpp b/src/wrt-installer/wrt_installer.cpp index 2a558a3..9037cff 100644 --- a/src/wrt-installer/wrt_installer.cpp +++ b/src/wrt-installer/wrt_installer.cpp @@ -82,6 +82,7 @@ struct PluginInstallerData WrtInstaller::WrtInstaller(int argc, char **argv) : Application(argc, argv, "backend", false), DPL::TaskDecl(this), + m_installPolicy(WRT_WIM_NOT_INSTALLED), m_packagePath(), m_handle(-1), m_initialized(false), @@ -114,7 +115,7 @@ void WrtInstaller::OnCreate() 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]); @@ -403,22 +404,25 @@ void WrtInstaller::installPluginsStep() } LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH); - struct dirent* libdir; - - errno = 0; std::list 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; @@ -435,6 +439,10 @@ void WrtInstaller::installPluginsStep() 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(); @@ -636,101 +644,65 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, } 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, @@ -866,7 +838,6 @@ void WrtInstaller::staticWrtInstallProgressCallback(float percent, void* userdata) { WrtInstaller *This = static_cast(userdata); - std::stringstream percentStr; LogInfo(" progress: " << percent << " description: " << description); @@ -881,7 +852,6 @@ void WrtInstaller::staticWrtUninstallProgressCallback(float percent, void* userdata) { WrtInstaller *This = static_cast(userdata); - std::stringstream percentStr; LogInfo(" progress: " << percent << " description: " << description); diff --git a/src/wrt-installer/wrt_installer_api.cpp b/src/wrt-installer/wrt_installer_api.cpp index 9ef38e9..f6bb4fb 100644 --- a/src/wrt-installer/wrt_installer_api.cpp +++ b/src/wrt-installer/wrt_installer_api.cpp @@ -451,22 +451,27 @@ EXPORT_API void wrt_install_all_plugins( } LogInfo("Plugin DIRECTORY IS" << PLUGIN_PATH); - struct dirent* libdir; + struct dirent libdir; + struct dirent *result; + int return_code; errno = 0; std::list 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; @@ -498,6 +503,11 @@ EXPORT_API void wrt_install_all_plugins( 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()); @@ -583,7 +593,7 @@ EXPORT_API void wrt_installer_shutdown_for_tests() } 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 : " @@ -593,7 +603,7 @@ EXPORT_API WrtErrStatus wrt_get_widget_by_guid(std::string & tzAppid, 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) { diff --git a/src/wrt-installer/wrt_installer_api.h b/src/wrt-installer/wrt_installer_api.h index 4710d17..c8a058c 100644 --- a/src/wrt-installer/wrt_installer_api.h +++ b/src/wrt-installer/wrt_installer_api.h @@ -352,7 +352,7 @@ void wrt_installer_shutdown_for_tests(); * @return error code */ WrtErrStatus wrt_get_widget_by_guid(std::string &tzAppid, - const std::string guid); + const std::string &guid); #ifdef __cplusplus } #endif diff --git a/src/wrt-installer/wrt_type.h b/src/wrt-installer/wrt_type.h index 2163cfe..f061805 100644 --- a/src/wrt-installer/wrt_type.h +++ b/src/wrt-installer/wrt_type.h @@ -42,47 +42,25 @@ typedef enum { /* Generic success */ WRT_SUCCESS = 0, /*< Success*/ - WRT_ALREADY_INIT, /*< Wrt already initialized*/ - WRT_UPDATE_NEED, /*< Widget data has been updated*/ - WRT_SHUTDOWN, /*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 diff --git a/tests/general/BackgroundPageTests.cpp b/tests/general/BackgroundPageTests.cpp new file mode 100644 index 0000000..b996cbe --- /dev/null +++ b/tests/general/BackgroundPageTests.cpp @@ -0,0 +1,75 @@ +/* + * 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 +#include +#include + +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); +} diff --git a/tests/general/CMakeLists.txt b/tests/general/CMakeLists.txt index e72a998..cf87bdf 100644 --- a/tests/general/CMakeLists.txt +++ b/tests/general/CMakeLists.txt @@ -16,8 +16,6 @@ # @author Karol Pawlowski (k.pawlowski@samsung.com) # - -# TODO cleanup dependencies PKG_CHECK_MODULES(COMMON_LIB_PKGS dbus-1 libpcrecpp @@ -26,29 +24,11 @@ PKG_CHECK_MODULES(COMMON_LIB_PKGS 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) @@ -57,18 +37,87 @@ SET(WRT_TEST_LIBRARY "wrt-tests-libs") 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} @@ -78,3 +127,15 @@ 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/) diff --git a/tests/general/CMakeUtils.txt b/tests/general/CMakeUtils.txt deleted file mode 100644 index 265869f..0000000 --- a/tests/general/CMakeUtils.txt +++ /dev/null @@ -1,182 +0,0 @@ -# @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) diff --git a/tests/general/common/src/InstallerWrapper.cpp b/tests/general/InstallerWrapper.cpp similarity index 94% rename from tests/general/common/src/InstallerWrapper.cpp rename to tests/general/InstallerWrapper.cpp index a1f8917..662f617 100644 --- a/tests/general/common/src/InstallerWrapper.cpp +++ b/tests/general/InstallerWrapper.cpp @@ -70,11 +70,8 @@ InstallResult install( } 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; } diff --git a/tests/general/common/include/InstallerWrapper.h b/tests/general/InstallerWrapper.h similarity index 73% rename from tests/general/common/include/InstallerWrapper.h rename to tests/general/InstallerWrapper.h index c8f68f8..ee3d0a8 100644 --- a/tests/general/common/include/InstallerWrapper.h +++ b/tests/general/InstallerWrapper.h @@ -14,8 +14,8 @@ * 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 @@ -27,6 +27,17 @@ const InstallResult WrongWidgetPackage = -2; 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, @@ -41,4 +52,4 @@ bool sigintWrtClients(); } -#endif//WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_INSTALLER_WRAPPER_H +#endif//WRT_INSTALLER_TESTS_GENERAL_INSTALLER_WRAPPER_H diff --git a/tests/general/common/src/ManifestFile.cpp b/tests/general/ManifestFile.cpp similarity index 100% rename from tests/general/common/src/ManifestFile.cpp rename to tests/general/ManifestFile.cpp diff --git a/tests/general/common/include/ManifestFile.h b/tests/general/ManifestFile.h similarity index 87% rename from tests/general/common/include/ManifestFile.h rename to tests/general/ManifestFile.h index 3bd67c5..ccb6a7b 100644 --- a/tests/general/common/include/ManifestFile.h +++ b/tests/general/ManifestFile.h @@ -19,8 +19,8 @@ * @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 @@ -51,4 +51,4 @@ private: }; -#endif //WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H +#endif //WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H diff --git a/tests/general/TestCases.cpp b/tests/general/ManifestTests.cpp similarity index 52% rename from tests/general/TestCases.cpp rename to tests/general/ManifestTests.cpp index a0a978a..769bfa3 100644 --- a/tests/general/TestCases.cpp +++ b/tests/general/ManifestTests.cpp @@ -18,33 +18,17 @@ * @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 #include #include -#include #include #include 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) @@ -117,130 +101,3 @@ RUNNER_TEST(creatingManifestFile) /* 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"); - } -} diff --git a/tests/general/NPluginsInstallTests.cpp b/tests/general/NPluginsInstallTests.cpp new file mode 100644 index 0000000..ae39eb4 --- /dev/null +++ b/tests/general/NPluginsInstallTests.cpp @@ -0,0 +1,89 @@ +/* + * 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 +#include +#include + +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"); + } +} diff --git a/tests/general/NonRootUserTests.cpp b/tests/general/NonRootUserTests.cpp new file mode 100644 index 0000000..bd01cc8 --- /dev/null +++ b/tests/general/NonRootUserTests.cpp @@ -0,0 +1,47 @@ +/* + * 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 +#include +#include + +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); +} diff --git a/tests/general/ParsingTizenAppserviceTests.cpp b/tests/general/ParsingTizenAppserviceTests.cpp new file mode 100644 index 0000000..0ac368b --- /dev/null +++ b/tests/general/ParsingTizenAppserviceTests.cpp @@ -0,0 +1,86 @@ +/* + * 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 +#include +#include +#include +#include + +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 ####"); +} diff --git a/tests/general/TestInit.cpp b/tests/general/TestInit.cpp index 2e1ac8f..62e30a4 100644 --- a/tests/general/TestInit.cpp +++ b/tests/general/TestInit.cpp @@ -17,7 +17,7 @@ * @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 diff --git a/tests/general/common/CMakeLists.txt b/tests/general/common/CMakeLists.txt deleted file mode 100644 index 7303b3c..0000000 --- a/tests/general/common/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -# 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}) diff --git a/tests/general/widgets/appservice_dispos.wgt b/tests/general/widgets/appservice_dispos.wgt new file mode 100644 index 0000000..9451a4f Binary files /dev/null and b/tests/general/widgets/appservice_dispos.wgt differ diff --git a/tests/general/widgets/content_listener.wgt b/tests/general/widgets/content_listener.wgt deleted file mode 100644 index b2e6fa2..0000000 Binary files a/tests/general/widgets/content_listener.wgt and /dev/null differ diff --git a/tests/general/widgets/content_listener/config.xml b/tests/general/widgets/content_listener/config.xml deleted file mode 100644 index 40d861c..0000000 --- a/tests/general/widgets/content_listener/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - listener02 - - diff --git a/tests/general/widgets/content_listener/hook.js b/tests/general/widgets/content_listener/hook.js deleted file mode 100644 index 959a8b0..0000000 --- a/tests/general/widgets/content_listener/hook.js +++ /dev/null @@ -1,3 +0,0 @@ -var id = "listener02"; - -function hook(id, result, message){}; \ No newline at end of file diff --git a/tests/general/widgets/content_listener/index.html b/tests/general/widgets/content_listener/index.html deleted file mode 100644 index 81c7f09..0000000 --- a/tests/general/widgets/content_listener/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/content_listener/test.html b/tests/general/widgets/content_listener/test.html deleted file mode 100644 index e0a0c10..0000000 --- a/tests/general/widgets/content_listener/test.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/content_listener2.wgt b/tests/general/widgets/content_listener2.wgt deleted file mode 100644 index 99b090c..0000000 Binary files a/tests/general/widgets/content_listener2.wgt and /dev/null differ diff --git a/tests/general/widgets/content_listener2/config.xml b/tests/general/widgets/content_listener2/config.xml deleted file mode 100644 index 6ab4a6b..0000000 --- a/tests/general/widgets/content_listener2/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - listener04 - - diff --git a/tests/general/widgets/content_listener2/hook.js b/tests/general/widgets/content_listener2/hook.js deleted file mode 100644 index 959a8b0..0000000 --- a/tests/general/widgets/content_listener2/hook.js +++ /dev/null @@ -1,3 +0,0 @@ -var id = "listener02"; - -function hook(id, result, message){}; \ No newline at end of file diff --git a/tests/general/widgets/content_listener2/index.html b/tests/general/widgets/content_listener2/index.html deleted file mode 100644 index 81c7f09..0000000 --- a/tests/general/widgets/content_listener2/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/content_listener2/test.html b/tests/general/widgets/content_listener2/test.html deleted file mode 100644 index e0a0c10..0000000 --- a/tests/general/widgets/content_listener2/test.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/minimal.wgt b/tests/general/widgets/minimal.wgt deleted file mode 100644 index e21996b..0000000 Binary files a/tests/general/widgets/minimal.wgt and /dev/null differ diff --git a/tests/general/widgets/protocol_listener.wgt b/tests/general/widgets/protocol_listener.wgt deleted file mode 100644 index 23d7a21..0000000 Binary files a/tests/general/widgets/protocol_listener.wgt and /dev/null differ diff --git a/tests/general/widgets/protocol_listener/config.xml b/tests/general/widgets/protocol_listener/config.xml deleted file mode 100644 index 0956e53..0000000 --- a/tests/general/widgets/protocol_listener/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - listener01 - - diff --git a/tests/general/widgets/protocol_listener/hook.js b/tests/general/widgets/protocol_listener/hook.js deleted file mode 100644 index 1300cac..0000000 --- a/tests/general/widgets/protocol_listener/hook.js +++ /dev/null @@ -1,3 +0,0 @@ -var id = "listener01"; - -function hook(id, result, message){}; \ No newline at end of file diff --git a/tests/general/widgets/protocol_listener/index.html b/tests/general/widgets/protocol_listener/index.html deleted file mode 100644 index f3687d9..0000000 --- a/tests/general/widgets/protocol_listener/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/protocol_listener/news.html b/tests/general/widgets/protocol_listener/news.html deleted file mode 100644 index 5fab155..0000000 --- a/tests/general/widgets/protocol_listener/news.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/protocol_listener2.wgt b/tests/general/widgets/protocol_listener2.wgt deleted file mode 100644 index b828faf..0000000 Binary files a/tests/general/widgets/protocol_listener2.wgt and /dev/null differ diff --git a/tests/general/widgets/protocol_listener2/config.xml b/tests/general/widgets/protocol_listener2/config.xml deleted file mode 100644 index a105a15..0000000 --- a/tests/general/widgets/protocol_listener2/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - listener03 - - diff --git a/tests/general/widgets/protocol_listener2/hook.js b/tests/general/widgets/protocol_listener2/hook.js deleted file mode 100644 index 1300cac..0000000 --- a/tests/general/widgets/protocol_listener2/hook.js +++ /dev/null @@ -1,3 +0,0 @@ -var id = "listener01"; - -function hook(id, result, message){}; \ No newline at end of file diff --git a/tests/general/widgets/protocol_listener2/index.html b/tests/general/widgets/protocol_listener2/index.html deleted file mode 100644 index f3687d9..0000000 --- a/tests/general/widgets/protocol_listener2/index.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/protocol_listener2/news.html b/tests/general/widgets/protocol_listener2/news.html deleted file mode 100644 index 5fab155..0000000 --- a/tests/general/widgets/protocol_listener2/news.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - - diff --git a/tests/general/widgets/register_content.wgt b/tests/general/widgets/register_content.wgt deleted file mode 100644 index 79cb173..0000000 Binary files a/tests/general/widgets/register_content.wgt and /dev/null differ diff --git a/tests/general/widgets/register_content/config.xml b/tests/general/widgets/register_content/config.xml deleted file mode 100644 index a1f2727..0000000 --- a/tests/general/widgets/register_content/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - register03 - - diff --git a/tests/general/widgets/register_content/hook.js b/tests/general/widgets/register_content/hook.js deleted file mode 100644 index 4866d86..0000000 --- a/tests/general/widgets/register_content/hook.js +++ /dev/null @@ -1,21 +0,0 @@ -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 diff --git a/tests/general/widgets/register_content/index.html b/tests/general/widgets/register_content/index.html deleted file mode 100644 index 5f572a9..0000000 --- a/tests/general/widgets/register_content/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - diff --git a/tests/general/widgets/register_content_fail.wgt b/tests/general/widgets/register_content_fail.wgt deleted file mode 100644 index 165c1b2..0000000 Binary files a/tests/general/widgets/register_content_fail.wgt and /dev/null differ diff --git a/tests/general/widgets/register_content_fail/config.xml b/tests/general/widgets/register_content_fail/config.xml deleted file mode 100644 index a037769..0000000 --- a/tests/general/widgets/register_content_fail/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - register04 - - diff --git a/tests/general/widgets/register_content_fail/hook.js b/tests/general/widgets/register_content_fail/hook.js deleted file mode 100644 index ffc4bc6..0000000 --- a/tests/general/widgets/register_content_fail/hook.js +++ /dev/null @@ -1,19 +0,0 @@ -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 diff --git a/tests/general/widgets/register_content_fail/index.html b/tests/general/widgets/register_content_fail/index.html deleted file mode 100644 index 5f572a9..0000000 --- a/tests/general/widgets/register_content_fail/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - diff --git a/tests/general/widgets/register_protocol.wgt b/tests/general/widgets/register_protocol.wgt deleted file mode 100644 index 36681e1..0000000 Binary files a/tests/general/widgets/register_protocol.wgt and /dev/null differ diff --git a/tests/general/widgets/register_protocol/config.xml b/tests/general/widgets/register_protocol/config.xml deleted file mode 100644 index 4291dfe..0000000 --- a/tests/general/widgets/register_protocol/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - register01 - - diff --git a/tests/general/widgets/register_protocol/hook.js b/tests/general/widgets/register_protocol/hook.js deleted file mode 100644 index 05fbb46..0000000 --- a/tests/general/widgets/register_protocol/hook.js +++ /dev/null @@ -1,21 +0,0 @@ -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 diff --git a/tests/general/widgets/register_protocol/index.html b/tests/general/widgets/register_protocol/index.html deleted file mode 100644 index 5f572a9..0000000 --- a/tests/general/widgets/register_protocol/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - diff --git a/tests/general/widgets/register_protocol_fail.wgt b/tests/general/widgets/register_protocol_fail.wgt deleted file mode 100644 index 81f651b..0000000 Binary files a/tests/general/widgets/register_protocol_fail.wgt and /dev/null differ diff --git a/tests/general/widgets/register_protocol_fail/config.xml b/tests/general/widgets/register_protocol_fail/config.xml deleted file mode 100644 index 49ebcb7..0000000 --- a/tests/general/widgets/register_protocol_fail/config.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - register02 - - diff --git a/tests/general/widgets/register_protocol_fail/hook.js b/tests/general/widgets/register_protocol_fail/hook.js deleted file mode 100644 index bc41257..0000000 --- a/tests/general/widgets/register_protocol_fail/hook.js +++ /dev/null @@ -1,19 +0,0 @@ -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 diff --git a/tests/general/widgets/register_protocol_fail/index.html b/tests/general/widgets/register_protocol_fail/index.html deleted file mode 100644 index 5f572a9..0000000 --- a/tests/general/widgets/register_protocol_fail/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - Custom handlers - - -

FAIL

- - - diff --git a/tests/general/widgets/tizen_appservice_disposition/config.xml b/tests/general/widgets/tizen_appservice_disposition/config.xml new file mode 100755 index 0000000..4544234 --- /dev/null +++ b/tests/general/widgets/tizen_appservice_disposition/config.xml @@ -0,0 +1,12 @@ + + Disposition_attribute + + + + + + + diff --git a/tests/general/widgets/tizen_appservice_disposition/icon.png b/tests/general/widgets/tizen_appservice_disposition/icon.png new file mode 100755 index 0000000..b835ed1 Binary files /dev/null and b/tests/general/widgets/tizen_appservice_disposition/icon.png differ diff --git a/tests/general/widgets/tizen_appservice_disposition/index.htm b/tests/general/widgets/tizen_appservice_disposition/index.htm new file mode 100755 index 0000000..5e7036c --- /dev/null +++ b/tests/general/widgets/tizen_appservice_disposition/index.htm @@ -0,0 +1,8 @@ + + + Disposition attribute + + +

Check database.

+ +