[Release] wrt-installer_0.1.9
authorJihoon Chung <jihoon.chung@samsung.com>
Thu, 7 Mar 2013 00:33:41 +0000 (09:33 +0900)
committerJihoon Chung <jihoon.chung@samsung.com>
Thu, 7 Mar 2013 00:33:41 +0000 (09:33 +0900)
92 files changed:
debian/changelog
packaging/wrt-installer.spec
src/configuration_parser/widget_parser.cpp
src/configuration_parser/widget_parser.h
src/jobs/job.cpp
src/jobs/plugin_install/plugin_install_task.cpp
src/jobs/plugin_install/plugin_installer_errors.h
src/jobs/widget_install/ace_registration.cpp
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/languages.def
src/jobs/widget_install/task_certificates.cpp
src/jobs/widget_install/task_certify.cpp
src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/task_encrypt_resource.cpp
src/jobs/widget_install/task_file_manipulation.cpp
src/jobs/widget_install/task_install_ospsvc.cpp
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/task_plugins_copy.cpp
src/jobs/widget_install/task_recovery.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_install/task_update_files.cpp
src/jobs/widget_install/task_widget_config.cpp
src/jobs/widget_install/task_widget_config.h
src/jobs/widget_install/widget_install_errors.h
src/jobs/widget_uninstall/task_check.cpp
src/jobs/widget_uninstall/task_delete_certificates.cpp
src/jobs/widget_uninstall/task_remove_files.cpp
src/jobs/widget_uninstall/task_smack.cpp
src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp
src/misc/widget_location.cpp
src/misc/widget_location.h
src/pkg-manager/pkgmgr_signal_dummy.h
src/wrt-installer/installer_callbacks_translate.cpp
src/wrt-installer/installer_callbacks_translate.h
src/wrt-installer/wrt_installer.cpp
src/wrt-installer/wrt_installer_api.cpp
src/wrt-installer/wrt_installer_api.h
src/wrt-installer/wrt_type.h
tests/general/BackgroundPageTests.cpp [new file with mode: 0644]
tests/general/CMakeLists.txt
tests/general/CMakeUtils.txt [deleted file]
tests/general/InstallerWrapper.cpp [moved from tests/general/common/src/InstallerWrapper.cpp with 94% similarity]
tests/general/InstallerWrapper.h [moved from tests/general/common/include/InstallerWrapper.h with 73% similarity]
tests/general/ManifestFile.cpp [moved from tests/general/common/src/ManifestFile.cpp with 100% similarity]
tests/general/ManifestFile.h [moved from tests/general/common/include/ManifestFile.h with 87% similarity]
tests/general/ManifestTests.cpp [moved from tests/general/TestCases.cpp with 52% similarity]
tests/general/NPluginsInstallTests.cpp [new file with mode: 0644]
tests/general/NonRootUserTests.cpp [new file with mode: 0644]
tests/general/ParsingTizenAppserviceTests.cpp [new file with mode: 0644]
tests/general/TestInit.cpp
tests/general/common/CMakeLists.txt [deleted file]
tests/general/widgets/appservice_dispos.wgt [new file with mode: 0644]
tests/general/widgets/content_listener.wgt [deleted file]
tests/general/widgets/content_listener/config.xml [deleted file]
tests/general/widgets/content_listener/hook.js [deleted file]
tests/general/widgets/content_listener/index.html [deleted file]
tests/general/widgets/content_listener/test.html [deleted file]
tests/general/widgets/content_listener2.wgt [deleted file]
tests/general/widgets/content_listener2/config.xml [deleted file]
tests/general/widgets/content_listener2/hook.js [deleted file]
tests/general/widgets/content_listener2/index.html [deleted file]
tests/general/widgets/content_listener2/test.html [deleted file]
tests/general/widgets/minimal.wgt [deleted file]
tests/general/widgets/protocol_listener.wgt [deleted file]
tests/general/widgets/protocol_listener/config.xml [deleted file]
tests/general/widgets/protocol_listener/hook.js [deleted file]
tests/general/widgets/protocol_listener/index.html [deleted file]
tests/general/widgets/protocol_listener/news.html [deleted file]
tests/general/widgets/protocol_listener2.wgt [deleted file]
tests/general/widgets/protocol_listener2/config.xml [deleted file]
tests/general/widgets/protocol_listener2/hook.js [deleted file]
tests/general/widgets/protocol_listener2/index.html [deleted file]
tests/general/widgets/protocol_listener2/news.html [deleted file]
tests/general/widgets/register_content.wgt [deleted file]
tests/general/widgets/register_content/config.xml [deleted file]
tests/general/widgets/register_content/hook.js [deleted file]
tests/general/widgets/register_content/index.html [deleted file]
tests/general/widgets/register_content_fail.wgt [deleted file]
tests/general/widgets/register_content_fail/config.xml [deleted file]
tests/general/widgets/register_content_fail/hook.js [deleted file]
tests/general/widgets/register_content_fail/index.html [deleted file]
tests/general/widgets/register_protocol.wgt [deleted file]
tests/general/widgets/register_protocol/config.xml [deleted file]
tests/general/widgets/register_protocol/hook.js [deleted file]
tests/general/widgets/register_protocol/index.html [deleted file]
tests/general/widgets/register_protocol_fail.wgt [deleted file]
tests/general/widgets/register_protocol_fail/config.xml [deleted file]
tests/general/widgets/register_protocol_fail/hook.js [deleted file]
tests/general/widgets/register_protocol_fail/index.html [deleted file]
tests/general/widgets/tizen_appservice_disposition/config.xml [new file with mode: 0755]
tests/general/widgets/tizen_appservice_disposition/icon.png [new file with mode: 0755]
tests/general/widgets/tizen_appservice_disposition/index.htm [new file with mode: 0755]

index d4da580..c13e49f 100644 (file)
@@ -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 <jihoon.chung@samsung.com>  Thu, 07 Mar 2013 09:11:07 +0900
+
+wrt-installer (0.1.8) unstable; urgency=low
+
+  * Release
+
+ -- Leerang Song <leerang.song@samsung.com>  Thu, 28 Feb 2013 11:13:19 +0900
+
+wrt-installer (0.1.7) unstable; urgency=low
+
+  * Removing warnings reported by cppcheck tool.
+  * Removing compilation warnings in wrt-installer repo
+  * Fixed language tag map for pkg labels
+
+ -- Leerang Song <leerang.song@samsung.com>  Wed, 27 Feb 2013 15:53:56 +0900
+
 wrt-installer (0.1.6) unstable; urgency=low
 
   * code clean up - src/configuration_parser/WidgetConfigurationManager
index 40c9333..bd52e90 100644 (file)
@@ -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
index 5f0d6ca..3b0a0ec 100644 (file)
@@ -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 <ConfigParserData::AccessInfoSet::iterator, bool> ret =
+        //std::pair <ConfigParserData::AccessInfoSet::iterator, bool> 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 &&
index af39afd..c8c1a2b 100644 (file)
@@ -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);
index ec56d3d..335ab76 100644 (file)
@@ -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&)
index b4c30c3..2eccd38 100644 (file)
@@ -64,6 +64,7 @@ namespace PluginInstall {
 PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) :
     DPL::TaskDecl<PluginInstallTask>(this),
     m_context(inCont),
+    m_pluginHandle(0),
     m_dataFromConfigXML(true)
 {
     AddStep(&PluginInstallTask::stepCheckPluginPath);
index 73132f0..16ad13f 100644 (file)
@@ -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
index faee3ea..e2077ef 100644 (file)
@@ -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<ace_widget_handle_t>(widgetHandle), &wi, certData);
 
     //clean up - WidgetInfo
index a1150f8..e693422 100644 (file)
@@ -167,10 +167,6 @@ JobWidgetInstall::JobWidgetInstall(
     JobContextBase<WidgetInstallationStruct>(installerStruct),
     m_exceptionCaught(Exceptions::Success)
 {
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    srand(time(NULL) + tv.tv_usec);
-
     m_installerContext.m_quiet = m_jobStruct.m_quiet;
 
     ConfigureResult result = PrePareInstallation(widgetPath);
@@ -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");
index e26443f..e9439b6 100644 (file)
@@ -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)
index b4a67f7..04247fa 100644 (file)
@@ -39,7 +39,8 @@ namespace Jobs {
 namespace WidgetInstall {
 TaskCertificates::TaskCertificates(InstallerContext& context) :
     DPL::TaskDecl<TaskCertificates>(this),
-    m_context(context)
+    m_context(context),
+    m_pkgHandle(NULL)
 {
     AddStep(&TaskCertificates::StepSetCertiInfo);
     AddAbortStep(&TaskCertificates::StepAbortCertiInfo);
index 342b5f4..6b0040f 100644 (file)
@@ -33,7 +33,6 @@
 #include <widget_install/widget_install_errors.h>
 #include <widget_install/widget_install_context.h>
 #include <dpl/log/log.h>
-#include <wrt_error.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 #include "wac_widget_id.h"
 
@@ -99,8 +98,8 @@ namespace Jobs {
 namespace WidgetInstall {
 TaskCertify::TaskCertify(InstallerContext &inCont) :
     DPL::TaskDecl<TaskCertify>(this),
-    m_contextData(inCont),
-    WidgetInstallPopup(inCont)
+    WidgetInstallPopup(inCont),
+    m_contextData(inCont)
 {
     AddStep(&TaskCertify::stepSignature);
 
index 072a9f9..874bad8 100644 (file)
@@ -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;
 
index a7483f0..ae9cebb 100644 (file)
@@ -163,7 +163,8 @@ namespace Jobs {
 namespace WidgetInstall {
 TaskEncryptResource::TaskEncryptResource(InstallerContext& context) :
     DPL::TaskDecl<TaskEncryptResource>(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;
index fddd770..db50d6b 100644 (file)
@@ -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<TaskFileManipulation>(this),
-    m_context(context)
+    m_context(context),
+    m_extHandle(NULL)
 {
     if (INSTALL_LOCATION_TYPE_EXTERNAL !=
         m_context.locationType)
index 3fe94ef..7909c26 100644 (file)
@@ -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);
index 298a06d..135b252 100644 (file)
@@ -102,7 +102,8 @@ const char * TaskManifestFile::encoding = "UTF-8";
 
 TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
     DPL::TaskDecl<TaskManifestFile>(this),
-    m_context(inCont)
+    m_context(inCont),
+    writer(NULL)
 {
     if (false == m_context.existingWidgetInfo.isExist) {
         AddStep(&TaskManifestFile::stepCopyIconFiles);
@@ -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<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
         DPL::String appid = m_context.widgetConfig.tzAppid;
-        size_t found;
 
         if (ConfigInfo->m_liveboxId != L"") {
-            found = ConfigInfo->m_liveboxId.find_last_of(L".");
+            size_t found = ConfigInfo->m_liveboxId.find_last_of(L".");
             if (found != std::string::npos) {
                 if (0 == ConfigInfo->m_liveboxId.compare(0, found, appid)) {
                     liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
index 1b6d02e..bf295ea 100644 (file)
@@ -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<std::string>::const_iterator it = m_nplugins.begin();
-         it != m_nplugins.end(); it++)
+         it != m_nplugins.end(); ++it)
     {
         LogDebug("Copying plugin file: " << (*it));
         source = m_npsource + "/" + (*it);
index bdf2e71..c6a5e9b 100644 (file)
@@ -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();
 
index 5bbb173..75d0fc8 100644 (file)
@@ -65,5 +65,6 @@ void TaskSmack::Step()
         "Widget SMACK Enabled");
 #endif
 }
+
 } //namespace WidgetInstall
 } //namespace Jobs
index bcbd2f3..76ff014 100644 (file)
@@ -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");
index 54462a6..74b006d 100644 (file)
@@ -44,7 +44,6 @@
 #include <widget_install/widget_install_context.h>
 #include <widget_install/widget_install_errors.h>
 #include <widget_parser.h>
-#include <wrt_error.h>
 
 namespace { // anonymous
 const DPL::String BR = DPL::FromUTF8String("<br>");
@@ -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);
index fe8309c..fdaf1e9 100644 (file)
@@ -33,7 +33,6 @@
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
 #include <dpl/wrt-dao-ro/global_config.h>
 
-#include <wrt_error.h>
 #include <wrt_common_types.h>
 #include <widget_install/widget_install_popup.h>
 
@@ -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);
 
index 196ce64..79e8407 100644 (file)
@@ -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)
index e87a50a..1a1f62b 100644 (file)
@@ -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,
index 859bcc1..cb9b7e9 100644 (file)
@@ -42,11 +42,8 @@ TaskDeleteCertificates::~TaskDeleteCertificates()
 
 void TaskDeleteCertificates::StepDeleteCertificates()
 {
-    pkgmgr_instcertinfo_h handle;
-
     if ((pkgmgr_installer_delete_certinfo(
-             const_cast<char*>((
-                                   m_context.tzAppid).c_str()))) < 0)
+             const_cast<char*>((m_context.tzAppid).c_str()))) < 0)
     {
         LogError("pkgmgr_installer_delete_certinfo fail");
     }
index 5f66122..ac26deb 100644 (file)
@@ -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) {
index e104bc4..7074dd6 100644 (file)
@@ -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,
index 5d99a11..572b130 100644 (file)
@@ -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);
index 4bd69f1..d6fff67 100644 (file)
 
 #include <widget_install/task_commons.h>
 
-WidgetLocation::DirectoryDeletor::DirectoryDeletor()
-{
-    m_dirpath = Jobs::WidgetInstall::createTempPath();
-}
+WidgetLocation::DirectoryDeletor::DirectoryDeletor() :
+    m_dirpath(Jobs::WidgetInstall::createTempPath())
+{}
 
-WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath)
-{
-    m_dirpath = tempPath;
-}
+WidgetLocation::DirectoryDeletor::DirectoryDeletor(std::string tempPath) :
+        m_dirpath(tempPath)
+{}
 
 WidgetLocation::DirectoryDeletor::~DirectoryDeletor()
 {
@@ -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);
         }
index 60028bf..ca98aa6 100644 (file)
@@ -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<DirectoryDeletor> m_temp;      //directory
index 34f5837..4c1b3e4 100644 (file)
@@ -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;
     }
index 3a15224..275c3fd 100644 (file)
 #include <dpl/log/log.h>
 
 namespace InstallerCallbacksTranslate {
-WrtErrStatus TranslateError(CommonError::Type status)
-{
-    switch (status) {
-    case CommonError::WrtSuccess:
-        return WRT_SUCCESS;
-
-    case CommonError::HandleNotFound:
-        return WRT_ERROR_HANDLE_NOT_FOUND;
-
-    case CommonError::AlreadyRunning:
-        return WRT_ERROR_ALREADY_RUNNING;
-
-    case CommonError::InvalidLanguage:
-        return WRT_ERROR_INVALID_LANGUAGE;
-
-    case CommonError::AlreadyStopped:
-        return WRT_ERROR_ALREADY_STOPPED;
-
-    case CommonError::StillAuthorizing:
-        return WRT_ERROR_STILL_AUTHORIZING;
-
-    case CommonError::EarlyKilled:
-        return WRT_ERROR_EARLY_KILLED;
-
-    case CommonError::AccessDenied:
-        return WRT_ERROR_ACCESS_DENIED;
-
-    default:
-        LogError("Untranslatable error: " << status);
-        return WRT_ERROR_INTERNAL;
-    }
-}
-
-void StatusCallback(std::string tizenId,
-                    CommonError::Type result,
-                    void *data)
-{
-    LogDebug("StatusCallback called  " << tizenId << " | " << result);
-    Assert(data != NULL);
-
-    WrtErrStatus error = TranslateError(result);
-    StatusCallbackStruct* statusCallbackStruct =
-        static_cast<StatusCallbackStruct*>(data);
-
-    if (statusCallbackStruct->status_callback) {
-        statusCallbackStruct->status_callback(tizenId,
-                                              error,
-                                              statusCallbackStruct->userdata);
-    } else {
-        LogInfo("StatusCallback: ignoring NULL callback pointer");
-    }
-
-    delete statusCallbackStruct;
-}
 
 // callback for finished install
 void installFinishedCallback(void *userParam,
@@ -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;
index 9b3eb52..c98e448 100644 (file)
@@ -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);
index 2a558a3..9037cff 100644 (file)
@@ -82,6 +82,7 @@ struct PluginInstallerData
 WrtInstaller::WrtInstaller(int argc, char **argv) :
     Application(argc, argv, "backend", false),
     DPL::TaskDecl<WrtInstaller>(this),
+    m_installPolicy(WRT_WIM_NOT_INSTALLED),
     m_packagePath(),
     m_handle(-1),
     m_initialized(false),
@@ -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<std::string> pluginsPaths;
-
-    while ((libdir = readdir(dir)) != 0) {
-        if (strcmp(libdir->d_name, ".") == 0 ||
-            strcmp(libdir->d_name, "..") == 0)
+    struct dirent libdir;
+    struct dirent *result;
+    int return_code;
+    errno = 0;
+    for (return_code = readdir_r(dir, &libdir, &result);
+            result != NULL && return_code == 0;
+            return_code = readdir_r(dir, &libdir, &result))
+    {
+        if (strcmp(libdir.d_name, ".") == 0 ||
+            strcmp(libdir.d_name, "..") == 0)
         {
             continue;
         }
 
         std::string path = PLUGIN_PATH;
         path += "/";
-        path += libdir->d_name;
+        path += libdir.d_name;
 
         struct stat tmp;
 
@@ -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<WrtInstaller*>(userdata);
-    std::stringstream percentStr;
     LogInfo(" progress: " << percent <<
             " description: " << description);
 
@@ -881,7 +852,6 @@ void WrtInstaller::staticWrtUninstallProgressCallback(float percent,
                                                       void* userdata)
 {
     WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
-    std::stringstream percentStr;
     LogInfo(" progress: " << percent <<
             " description: " << description);
 
index 9ef38e9..f6bb4fb 100644 (file)
@@ -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<std::string> pluginsPaths;
 
-        while ((libdir = readdir(dir)) != 0) {
-            if (strcmp(libdir->d_name, ".") == 0 ||
-                strcmp(libdir->d_name, "..") == 0)
+        for (return_code = readdir_r(dir, &libdir, &result);
+                    result != NULL && return_code == 0;
+                    return_code = readdir_r(dir, &libdir, &result))
+        {
+            if (strcmp(libdir.d_name, ".") == 0 ||
+                strcmp(libdir.d_name, "..") == 0)
             {
                 continue;
             }
 
             std::string path = PLUGIN_PATH;
             path += "/";
-            path += libdir->d_name;
+            path += libdir.d_name;
 
             struct stat tmp;
 
@@ -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) {
index 4710d17..c8a058c 100644 (file)
@@ -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
index 2163cfe..f061805 100644 (file)
@@ -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,                   /*<WRT daemon has been closed*/
-
-    /* Version result */
-    WRT_VERSION_OLD = 128,          /*< widget's version is older*/
-    WRT_VERSION_NEW,                /*< widget's version is latest*/
-    WRT_VERSION_EXACT,              /*< widget's version the same as in arg*/
-    WRT_VERSION_NOT_COMPARABLE,     /*< widget's version are not comparable */
 
     /* Error result */
     WRT_ERROR_INTERNAL = -128,      /*< Internal library error.
                                      * Should never occur */
-    WRT_ERROR_INVALID_PARAMETER,    /*< Invalid parameter value was given
-                                     * (eg. NULL) */
-    WRT_ERROR_HANDLE_NOT_FOUND,     /*< Widget handle was not found */
-    WRT_ERROR_ID_NOT_FOUND,         /*< Widget id was not found */
+
     WRT_ERROR_PKGNAME_NOT_FOUND,    /*< package name was not found */
-    WRT_ERROR_ALREADY_RUNNING,      /*< Widget is already running */
-    WRT_ERROR_ALREADY_STOPPED,      /*< Widget is already stopped */
-    WRT_ERROR_STILL_AUTHORIZING,    /*< Widget is still autorizing and has not
-                                     * yet finished it */
-    WRT_ERROR_EARLY_KILLED,         /*< Widget was early killed during launch */
-    WRT_ERROR_ACCESS_DENIED,        /*< Access denied from ACE */
-    WRT_ERROR_NOT_INITIALIZED,      /*<Occur if wrt initialization fails*/
-    WRT_ERROR_INIT,                 /*<Occur if wrt initialization fails*/
-    WRT_ERROR_CONNECTION,           /*<Connectiond error occured*/
     WRT_ERROR_NO_PATH,              /*<One of specific directory does not
                                      * exist*/
 
     /* Installer Errors*/
-    WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE, /*<  */
-    WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST,  /*<  */
+    WRT_INSTALLER_ERROR_INVALID_WIDGET_PACKAGE, /*< package is malformed */
+    WRT_INSTALLER_ERROR_WIDGET_DOES_NOT_EXIST,  /*< given tizenAppId is invalid */
 
     WRT_INSTALLER_ERROR_ALREADY_UNINSTALLING,   /*< Widget is already being
                                                  * uninstalled */
-    WRT_INSTALLER_ERROR_OUT_OUT_DISK_SPACE,     /*<  */
     WRT_INSTALLER_ERROR_INVALID_CERTIFICATE,    /*<  */
     WRT_INSTALLER_ERROR_ALREADY_INSTALLED,      /*< Widget is already installed
                                                  */
-    WRT_INSTALLER_ERROR_INTERNAL,               /*<  */
+    WRT_INSTALLER_ERROR_INTERNAL,               /*< Internal error due to inconsistency */
     WRT_INSTALLER_ERROR_NOT_ALLOWED,            /*< Widget installation or
                                                  * update not allowed */
                                                 /*< because violation of policy
@@ -92,10 +70,8 @@ typedef enum
     WRT_INSTALLER_ERROR_DATABASE_FAILURE,       /*< Failure in database */
     WRT_INSTALLER_ERROR_UNKNOWN,                /*< Temporary error. Try to not
                                                  * use this. */
-    WRT_INSTALLER_ERROR_OSPSVC,                 /*< */
-    WRT_ERROR_INVALID_LANGUAGE,                 /*< Widget is not valid in
-                                                 *  current locales*/
-
+    WRT_INSTALLER_ERROR_OSPSVC,                 /*< Error of installation
+                                                 * of osp service */
     /* Plugin Installer Errors */
     WRT_PLUGIN_INSTALLER_ERROR_WRONG_PATH,       /*< Wrong Path to plugin Dir */
     WRT_PLUGIN_INSTALLER_ERROR_METAFILE,         /*< Plugin metafile error */
@@ -108,145 +84,6 @@ typedef enum
     WRT_PLUGIN_INSTALLER_ERROR_UNKNOWN           /*< Unknown error*/
 } WrtErrStatus;
 
-typedef struct
-{
-    char* id;           /**< the widget's id
-                         * (read from its config.xml during installation)*/
-    char* name;         /**< the widget's name
-                         * (read from its config.xml during installation)*/
-    char* version;      /**< the widget's varsion
-                         * (read from its config.xml during installation)*/
-    char* icon_path;    /**< the widget's icon_path
-                         * (read from its config.xml during installation)*/
-    char* pkg_name;     /**< the widget's pkg name */
-
-    /**< the widget's application storage size */
-    size_t application_size;
-    /**< the widget's data storage size */
-    size_t data_size;
-} wrt_widget_info;
-
-typedef struct
-{
-    char *src; /**< valid path to widget's icon*/
-    int width;  /**< the width of the icon in pixels*/
-    int height;  /**< the height of the icon in pixels*/
-} wrt_widget_icon;
-
-typedef struct
-{
-    int width;      /**< the width of the widget in pixels*/
-    int height;     /**< the height of the widget in pixels*/
-} wrt_widget_size;
-
-typedef struct
-{
-    char *widget_name;              /**< the widget's name*/
-    wrt_widget_icon *widget_icon;   /**< the widget's icon data*/
-    wrt_widget_size widget_size;    /**< the widget's size data*/
-    wrt_widget_info *widget_info;   /**< the widget's info data*/
-} wrt_widget_info_data;
-
-/**
- * @fn inline bool wrt_has_succeded(WrtErrStatus err)
- * @brief Checks whether call succeded
- *
- * This function checks whether call succeded.
- * If call succeded it returns TRUE.
- *
- * @param [in] err WrtErrStatus to check
- *
- * @return Result of the test
- * @retval TRUE     - the call was successful
- * @retval FALSE    - the call failed
- *
- * Sample code:
- * @code
- *      static void InitCallback(WrtErrStatus status, void *data)
- *      {
- *          MyApplication *This = (MyApplication *)(data);
- *
- *          printf("[LAUNCH-WIDGET] init callback");
- *
- *          if (wrt_has_succeded(status) && status!=WRT_UPDATE_NEED)
- *          {
- *             This->InstallAllPlugins();
- *
- *             if (This->m_argc == 2)
- *                 wrt_install_widget(This->m_argv[1], This, InstallCallback);
- *          }
- *          else if(wrt_has_failed(status))
- *              printf("[LAUNCH-WIDGET] INITIALIZATION HAS FAILED");
- *      }
- * @endcode
- *
- * @see wrt_has_failed
- */
-inline bool wrt_has_succeded(WrtErrStatus err)
-{
-    return (err >= 0);
-}
-
-/**
- * @fn inline bool wrt_has_failed(WrtErrStatus err)
- * @brief Checks whether call failed
- *
- * This function checks whether call failed.
- * If call failed it returns TRUE.
- *
- * @param [in] err WrtErrStatus to check
- *
- * @return Result of the test
- * @retval TRUE     - the call failed
- * @retval FALSE    - the call was successful
- *
- * Sample code:
- * @code
- *      static void InitCallback(WrtErrStatus status, void *data)
- *      {
- *          MyApplication *This = (MyApplication *)(data);
- *
- *          printf("[LAUNCH-WIDGET] init callback");
- *
- *          if (wrt_has_succeded(status) && status!=WRT_UPDATE_NEED)
- *          {
- *             This->InstallAllPlugins();
- *
- *             if (This->m_argc == 2)
- *                 wrt_install_widget(This->m_argv[1], This, InstallCallback);
- *          }
- *          else if(wrt_has_failed(status))
- *              printf("[LAUNCH-WIDGET] INITIALIZATION HAS FAILED");
- *      }
- * @endcode
- *
- * @see wrt_has_succeded
- */
-inline bool wrt_has_failed(WrtErrStatus err)
-{
-    return (err < 0);
-}
-
-namespace CommonError {
-enum Type
-{
-    WrtSuccess,                ///< Success
-
-    HandleNotFound,         ///< Widget handle was not found
-    AlreadyRunning,         ///< Widget is already running
-    AlreadyStopped,         ///< Widget is already stopped
-    InvalidLanguage,        ///< Widget is invalid in current locales
-    StillAuthorizing,       ///< Widget is still autorizing and has not yet
-                            // finished it
-    EarlyKilled,            ///< Widget was early killed during launch
-    AccessDenied,           ///< Access denied from ACE
-    CertificateRevoked,     ///< Some certificate was revoked.
-                            ///  Widget is not allowed to run.
-
-    Unknown                 ///< Temporary error. Try to not use this.
-};
-}
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/tests/general/BackgroundPageTests.cpp b/tests/general/BackgroundPageTests.cpp
new file mode 100644 (file)
index 0000000..b996cbe
--- /dev/null
@@ -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 <string>
+#include <dpl/test/test_runner.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(BackgroundPage)
+
+/*
+Name: widgetWithBackgroundPage
+Description: Tests if widget with background page is installed correctly
+Expected: widget should be installed correctly
+*/
+RUNNER_TEST(widgetWithBackgroundPage)
+{
+    std::string tizenId;
+    RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/bg-00-with_bg.wgt",
+            tizenId) == InstallerWrapper::Success);
+    uninstall(tizenId);
+}
+
+/*
+Name: missingBackgroundFile
+Description: Tests if widget with declared in conifg background page
+ but missing background file will be installed correctly.
+Expected: widget should NOT be installed
+*/
+RUNNER_TEST(missingBackgroundFile)
+{
+    std::string tizenId;
+    if(install(miscWidgetsStuff + "widgets/bg-01-missing_file.wgt",
+            tizenId) == InstallerWrapper::Success) {
+        uninstall(tizenId);
+        RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
+    }
+}
+
+/*
+Name: widgetWithoutBackgroundPage
+Description: Complementary test to check if normal widget\
+ without background page is successfully installed
+Expected: widget should be installed
+*/
+RUNNER_TEST(widgetWithoutBackgroundPage)
+{
+    std::string tizenId;
+    RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/bg-02-without_bg.wgt",
+            tizenId) == InstallerWrapper::Success);
+    uninstall(tizenId);
+}
index e72a998..cf87bdf 100644 (file)
@@ -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 (file)
index 265869f..0000000
+++ /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)
similarity index 94%
rename from tests/general/common/src/InstallerWrapper.cpp
rename to tests/general/InstallerWrapper.cpp
index a1f8917..662f617 100644 (file)
@@ -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;
     }
similarity index 73%
rename from tests/general/common/include/InstallerWrapper.h
rename to tests/general/InstallerWrapper.h
index c8f68f8..ee3d0a8 100644 (file)
@@ -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 <string>
 
@@ -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
similarity index 87%
rename from tests/general/common/include/ManifestFile.h
rename to tests/general/ManifestFile.h
index 3bd67c5..ccb6a7b 100644 (file)
@@ -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 <string>
 
@@ -51,4 +51,4 @@ private:
 };
 
 
-#endif //WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H
+#endif //WRT_INSTALLER_TESTS_GENERAL_MANIFESTFILE_H
similarity index 52%
rename from tests/general/TestCases.cpp
rename to tests/general/ManifestTests.cpp
index a0a978a..769bfa3 100644 (file)
  * @author  Karol Pawlowski (k.pawlowski@samsung.com)
  * @author  Tomasz Iwanek (t.iwanek@samsung.com)
  * @version 1.0
- * @brief   Miscellaneous test's bodies
+ * @brief   Manifest installation test's bodies
  */
 
 #include <string>
 #include <dpl/utils/wrt_utility.h>
 #include <dpl/test/test_runner.h>
-#include <dpl/log/log.h>
 #include <InstallerWrapper.h>
 #include <ManifestFile.h>
 
 using namespace InstallerWrapper;
 
-namespace {
-
-const std::string miscWidgetsStuff = "/opt/share/widget/tests/misc/";
-
-struct Result {
-    bool m_exc;
-    bool m_exd;
-    bool m_exs;
-    std::string message;
-    Result(bool exc = false, bool exd = false, bool exs = false)
-        : m_exc(exc), m_exd(exd), m_exs(exs) {}
-};
-
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 
 RUNNER_TEST_GROUP_INIT(Manifest)
@@ -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 (file)
index 0000000..ae39eb4
--- /dev/null
@@ -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 <string>
+#include <dpl/test/test_runner.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(NPluginsInstall)
+
+/*
+Name: pluginFilesAdded
+Description: Tests installation of plugins attached to widget
+Expected: widget should be succesfully installed
+*/
+RUNNER_TEST(pluginFilesAdded)
+{
+    std::string tizenId;
+    RUNNER_ASSERT(install(miscWidgetsStuff
+            + "widgets/inst_nplug_1.wgt", tizenId) == InstallerWrapper::Success);
+    uninstall(tizenId);
+}
+
+/*
+Name: emptyPluginsDir
+Description: Tests installation with empty 'plugins' directory
+Expected: widget should be not installed
+*/
+RUNNER_TEST(emptyPluginsDir)
+{
+    std::string tizenId;
+    if(install(miscWidgetsStuff + "widgets/inst_nplug_2.wgt",
+            tizenId) == InstallerWrapper::Success) {
+        uninstall(tizenId);
+        RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
+    }
+}
+
+/*
+Name: pluginFileAndOtherFile
+Description: Tests installation with plugins directory and data files
+Expected: widget should be installed
+*/
+RUNNER_TEST(pluginFileAndOtherFile)
+{
+    std::string tizenId;
+    RUNNER_ASSERT(install(miscWidgetsStuff
+            + "widgets/inst_nplug_3.wgt", tizenId) == InstallerWrapper::Success);
+    uninstall(tizenId);
+}
+
+/*
+Name: pluginFileAndSubdir
+Description: Tests installation with 'plugins' directory and subdirectories
+ inside plugin directory
+Expected: widget should be not installed
+*/
+RUNNER_TEST(pluginFileAndSubdir)
+{
+    std::string tizenId;
+    if(install(miscWidgetsStuff + "widgets/inst_nplug_4.wgt",
+            tizenId) == InstallerWrapper::Success) {
+        uninstall(tizenId);
+        RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
+    }
+}
diff --git a/tests/general/NonRootUserTests.cpp b/tests/general/NonRootUserTests.cpp
new file mode 100644 (file)
index 0000000..bd01cc8
--- /dev/null
@@ -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 <string>
+#include <dpl/test/test_runner.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(NonRootUser)
+
+/*
+Name: widgetNonRootInstallation
+Description: Check installation from other user than root
+Expected: widget should be installed
+*/
+RUNNER_TEST(widgetNonRootInstallation)
+{
+    std::string tizenId;
+    RUNNER_ASSERT(install(
+                miscWidgetsStuff + "widgets/nonroot.wgt",
+                tizenId,
+                "app") == InstallerWrapper::Success);
+    uninstall(tizenId);
+}
diff --git a/tests/general/ParsingTizenAppserviceTests.cpp b/tests/general/ParsingTizenAppserviceTests.cpp
new file mode 100644 (file)
index 0000000..0ac368b
--- /dev/null
@@ -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 <string>
+#include <algorithm>
+#include <dpl/test/test_runner.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
+#include <InstallerWrapper.h>
+
+using namespace InstallerWrapper;
+
+////////////////////////////////////////////////////////////////////////////////
+
+RUNNER_TEST_GROUP_INIT(ParsingTizenAppservice)
+
+/*
+Name: correct_csp_policy
+Description: Tests if widget policy is correctly parsed from config file
+             and stored into database
+Expected: widget should be installed and policy should mach
+*/
+RUNNER_TEST(tizen_appservice_disposition)
+{
+    std::string tizenId;
+    RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/appservice_dispos.wgt",
+            tizenId) == InstallerWrapper::Success);
+
+    WrtDB::WidgetDAOReadOnly dao(DPL::FromASCIIString(tizenId));
+    WidgetApplicationServiceList appsvcList;
+    dao.getAppServiceList(appsvcList);
+    uninstall(tizenId);
+
+    RUNNER_ASSERT_MSG(appsvcList.size() == 4, "Incorrect list size");
+    WidgetApplicationService s;
+    s.src = DPL::FromUTF8String("edit1.html");
+    s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/edit");
+    s.mime = DPL::FromUTF8String("image/jpg");      /* mime type */
+    s.disposition = WidgetApplicationService::Disposition::WINDOW;
+    RUNNER_ASSERT_MSG(
+        std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+        "Unable to find service #");
+
+    s.src = DPL::FromUTF8String("edit2.html");
+    s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/view");
+    s.mime = DPL::FromUTF8String("audio/ogg");      /* mime type */
+    s.disposition = WidgetApplicationService::Disposition::WINDOW;
+    RUNNER_ASSERT_MSG(
+        std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+        "Unable to find service ##");
+
+    s.src = DPL::FromUTF8String("edit3.html");
+    s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/call");
+    s.mime = DPL::FromUTF8String("image/png");      /* mime type */
+    s.disposition = WidgetApplicationService::Disposition::INLINE;
+    RUNNER_ASSERT_MSG(
+        std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+        "Unable to find service ###");
+
+    s.src = DPL::FromUTF8String("edit4.html");
+    s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/send");
+    s.mime = DPL::FromUTF8String("text/css");      /* mime type */
+    s.disposition = WidgetApplicationService::Disposition::WINDOW;
+    RUNNER_ASSERT_MSG(
+        std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+        "Unable to find service ####");
+}
index 2e1ac8f..62e30a4 100644 (file)
@@ -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 <dpl/test/test_runner.h>
diff --git a/tests/general/common/CMakeLists.txt b/tests/general/common/CMakeLists.txt
deleted file mode 100644 (file)
index 7303b3c..0000000
+++ /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 (file)
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 (file)
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 (file)
index 40d861c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers6">
-  <tizen:application id="listener02" required_version="1.0"/>
-  <name>listener02</name>
-</widget>
-
diff --git a/tests/general/widgets/content_listener/hook.js b/tests/general/widgets/content_listener/hook.js
deleted file mode 100644 (file)
index 959a8b0..0000000
+++ /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 (file)
index 81c7f09..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        navigator.registerContentHandler("application/test", "test.html?uri=%s", "Example content");
-        if (navigator.isContentHandlerRegistered("application/test", "test.html?uri=%s") === 'registered') {
-            document.getElementById('test').innerHTML = 'PASSED';
-            document.body.style.backgroundColor = 'green';
-            hook(id, 'pass', 'content handler registered');
-        } else {
-            hook(id, 'fail', 'content handler not registered');
-        }
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/content_listener/test.html b/tests/general/widgets/content_listener/test.html
deleted file mode 100644 (file)
index e0a0c10..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        document.getElementById('test').innerHTML = 'PASSED';
-        document.body.style.backgroundColor = 'green';
-        hook(id, 'pass', 'content handler registered');
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/content_listener2.wgt b/tests/general/widgets/content_listener2.wgt
deleted file mode 100644 (file)
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 (file)
index 6ab4a6b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers8">
-  <tizen:application id="listener04" required_version="1.0"/>
-  <name>listener04</name>
-</widget>
-
diff --git a/tests/general/widgets/content_listener2/hook.js b/tests/general/widgets/content_listener2/hook.js
deleted file mode 100644 (file)
index 959a8b0..0000000
+++ /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 (file)
index 81c7f09..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        navigator.registerContentHandler("application/test", "test.html?uri=%s", "Example content");
-        if (navigator.isContentHandlerRegistered("application/test", "test.html?uri=%s") === 'registered') {
-            document.getElementById('test').innerHTML = 'PASSED';
-            document.body.style.backgroundColor = 'green';
-            hook(id, 'pass', 'content handler registered');
-        } else {
-            hook(id, 'fail', 'content handler not registered');
-        }
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/content_listener2/test.html b/tests/general/widgets/content_listener2/test.html
deleted file mode 100644 (file)
index e0a0c10..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        document.getElementById('test').innerHTML = 'PASSED';
-        document.body.style.backgroundColor = 'green';
-        hook(id, 'pass', 'content handler registered');
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/minimal.wgt b/tests/general/widgets/minimal.wgt
deleted file mode 100644 (file)
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 (file)
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 (file)
index 0956e53..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers5">
-  <tizen:application id="listener01" required_version="1.0"/>
-  <name>listener01</name>
-</widget>
-
diff --git a/tests/general/widgets/protocol_listener/hook.js b/tests/general/widgets/protocol_listener/hook.js
deleted file mode 100644 (file)
index 1300cac..0000000
+++ /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 (file)
index f3687d9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        navigator.registerProtocolHandler("news", "news.html?uri=%s", "Example news");
-        if (navigator.isProtocolHandlerRegistered("news", "news.html?uri=%s") === 'registered') {
-            document.getElementById('test').innerHTML = 'PASSED';
-            document.body.style.backgroundColor = 'green';
-            hook(id, 'pass', 'protocol handler registered');
-        } else {
-            hook(id, 'fail', 'protocol handler not registered');
-        }
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/protocol_listener/news.html b/tests/general/widgets/protocol_listener/news.html
deleted file mode 100644 (file)
index 5fab155..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        document.getElementById('test').innerHTML = 'PASSED';
-        document.body.style.backgroundColor = 'green';
-        hook(id, 'pass', 'protocol handler registered');
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/protocol_listener2.wgt b/tests/general/widgets/protocol_listener2.wgt
deleted file mode 100644 (file)
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 (file)
index a105a15..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers7">
-  <tizen:application id="listener03" required_version="1.0"/>
-  <name>listener03</name>
-</widget>
-
diff --git a/tests/general/widgets/protocol_listener2/hook.js b/tests/general/widgets/protocol_listener2/hook.js
deleted file mode 100644 (file)
index 1300cac..0000000
+++ /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 (file)
index f3687d9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        navigator.registerProtocolHandler("news", "news.html?uri=%s", "Example news");
-        if (navigator.isProtocolHandlerRegistered("news", "news.html?uri=%s") === 'registered') {
-            document.getElementById('test').innerHTML = 'PASSED';
-            document.body.style.backgroundColor = 'green';
-            hook(id, 'pass', 'protocol handler registered');
-        } else {
-            hook(id, 'fail', 'protocol handler not registered');
-        }
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/protocol_listener2/news.html b/tests/general/widgets/protocol_listener2/news.html
deleted file mode 100644 (file)
index 5fab155..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-    <script type="text/javascript">
-    try {
-        document.getElementById('test').innerHTML = 'PASSED';
-        document.body.style.backgroundColor = 'green';
-        hook(id, 'pass', 'protocol handler registered');
-    } catch (e) {
-        hook(id, 'fail', 'widget failed because ' + e.message);
-    }
-</script>
-</body>
-</html>
diff --git a/tests/general/widgets/register_content.wgt b/tests/general/widgets/register_content.wgt
deleted file mode 100644 (file)
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 (file)
index a1f2727..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers3">
-  <tizen:application id="register03" required_version="1.0"/>
-  <name>register03</name>
-</widget>
-
diff --git a/tests/general/widgets/register_content/hook.js b/tests/general/widgets/register_content/hook.js
deleted file mode 100644 (file)
index 4866d86..0000000
+++ /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 (file)
index 5f572a9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
diff --git a/tests/general/widgets/register_content_fail.wgt b/tests/general/widgets/register_content_fail.wgt
deleted file mode 100644 (file)
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 (file)
index a037769..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers4">
-  <tizen:application id="register04" required_version="1.0"/>
-  <name>register04</name>
-</widget>
-
diff --git a/tests/general/widgets/register_content_fail/hook.js b/tests/general/widgets/register_content_fail/hook.js
deleted file mode 100644 (file)
index ffc4bc6..0000000
+++ /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 (file)
index 5f572a9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
diff --git a/tests/general/widgets/register_protocol.wgt b/tests/general/widgets/register_protocol.wgt
deleted file mode 100644 (file)
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 (file)
index 4291dfe..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers1">
-  <tizen:application id="register01" required_version="1.0"/>
-  <name>register01</name>
-</widget>
-
diff --git a/tests/general/widgets/register_protocol/hook.js b/tests/general/widgets/register_protocol/hook.js
deleted file mode 100644 (file)
index 05fbb46..0000000
+++ /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 (file)
index 5f572a9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
diff --git a/tests/general/widgets/register_protocol_fail.wgt b/tests/general/widgets/register_protocol_fail.wgt
deleted file mode 100644 (file)
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 (file)
index 49ebcb7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers2">
-  <tizen:application id="register02" required_version="1.0"/>
-  <name>register02</name>
-</widget>
-
diff --git a/tests/general/widgets/register_protocol_fail/hook.js b/tests/general/widgets/register_protocol_fail/hook.js
deleted file mode 100644 (file)
index bc41257..0000000
+++ /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 (file)
index 5f572a9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
-  <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
-    <h1 id="test">FAIL</h1>
-    <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
diff --git a/tests/general/widgets/tizen_appservice_disposition/config.xml b/tests/general/widgets/tizen_appservice_disposition/config.xml
new file mode 100755 (executable)
index 0000000..4544234
--- /dev/null
@@ -0,0 +1,12 @@
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
+    id="http://test.samsung.com/widget/wac/tizen_appservice"
+    version="1.0.0"
+    min-version="1.0">
+  <name short="Disposition">Disposition_attribute</name>
+  <icon src="icon.png" height="75" width="75"/>
+  <tizen:appservice src="edit1.html" operation="http://tizen.org/appsvc/operation/edit" mime="image/jpg" />
+  <tizen:appservice src="edit2.html" operation="http://tizen.org/appsvc/operation/view" mime="audio/ogg" disposition="window"/>
+  <tizen:appservice src="edit3.html" operation="http://tizen.org/appsvc/operation/call" mime="image/png" disposition="inline"/>
+  <tizen:appservice src="edit4.html" operation="http://tizen.org/appsvc/operation/send" mime="text/css" disposition="wrongone"/>
+  <content src="index.html" />
+</widget>
diff --git a/tests/general/widgets/tizen_appservice_disposition/icon.png b/tests/general/widgets/tizen_appservice_disposition/icon.png
new file mode 100755 (executable)
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 (executable)
index 0000000..5e7036c
--- /dev/null
@@ -0,0 +1,8 @@
+<html>
+  <head>
+    <title>Disposition attribute</title>
+  </head>
+  <body style="background-color:gray">
+    <h1>Check database.</h1>
+  </body>
+</html>