From 798f0b3eb7612487f0e771c03df7a2c9460fbb0a Mon Sep 17 00:00:00 2001 From: leerang song Date: Fri, 22 Feb 2013 16:10:35 +0900 Subject: [PATCH] [Release]wrt-installer_0.1.6 --- CMakeLists.txt | 6 + debian/changelog | 18 ++ packaging/wrt-installer.spec | 20 +- src/CMakeLists.txt | 1 + .../WidgetConfigurationManager.cpp | 239 -------------------- .../WidgetConfigurationManager.h | 67 ------ src/jobs/widget_install/job_widget_install.cpp | 2 +- src/jobs/widget_install/task_certify.cpp | 20 +- src/jobs/widget_install/task_database.cpp | 19 ++ src/jobs/widget_install/task_database.h | 1 + src/jobs/widget_install/task_widget_config.cpp | 4 +- src/pkg-manager/backendlib.cpp | 21 +- tests/CMakeLists.txt | 20 ++ tests/general/CMakeLists.txt | 80 +++++++ tests/general/CMakeUtils.txt | 182 +++++++++++++++ tests/general/TestCases.cpp | 246 +++++++++++++++++++++ tests/general/TestInit.cpp | 37 ++++ tests/general/common/CMakeLists.txt | 41 ++++ tests/general/common/include/InstallerWrapper.h | 44 ++++ tests/general/common/include/ManifestFile.h | 54 +++++ tests/general/common/src/InstallerWrapper.cpp | 141 ++++++++++++ tests/general/common/src/ManifestFile.cpp | 109 +++++++++ tests/general/widgets/bg-00-with_bg.wgt | Bin 0 -> 736 bytes tests/general/widgets/bg-01-missing_file.wgt | Bin 0 -> 583 bytes tests/general/widgets/bg-02-without_bg.wgt | Bin 0 -> 567 bytes tests/general/widgets/content_listener.wgt | Bin 0 -> 1658 bytes tests/general/widgets/content_listener/config.xml | 6 + tests/general/widgets/content_listener/hook.js | 3 + tests/general/widgets/content_listener/index.html | 25 +++ tests/general/widgets/content_listener/test.html | 20 ++ tests/general/widgets/content_listener2.wgt | Bin 0 -> 1657 bytes tests/general/widgets/content_listener2/config.xml | 6 + tests/general/widgets/content_listener2/hook.js | 3 + tests/general/widgets/content_listener2/index.html | 25 +++ tests/general/widgets/content_listener2/test.html | 20 ++ tests/general/widgets/inst_nplug_1.wgt | Bin 0 -> 1610 bytes tests/general/widgets/inst_nplug_2.wgt | Bin 0 -> 1079 bytes tests/general/widgets/inst_nplug_3.wgt | Bin 0 -> 1425 bytes tests/general/widgets/inst_nplug_4.wgt | Bin 0 -> 1420 bytes tests/general/widgets/manifest.wgt | Bin 0 -> 1386 bytes tests/general/widgets/minimal.wgt | Bin 0 -> 1768 bytes tests/general/widgets/nonroot.wgt | Bin 0 -> 5563 bytes tests/general/widgets/protocol_listener.wgt | Bin 0 -> 1652 bytes tests/general/widgets/protocol_listener/config.xml | 6 + tests/general/widgets/protocol_listener/hook.js | 3 + tests/general/widgets/protocol_listener/index.html | 25 +++ tests/general/widgets/protocol_listener/news.html | 20 ++ tests/general/widgets/protocol_listener2.wgt | Bin 0 -> 1652 bytes .../general/widgets/protocol_listener2/config.xml | 6 + tests/general/widgets/protocol_listener2/hook.js | 3 + .../general/widgets/protocol_listener2/index.html | 25 +++ tests/general/widgets/protocol_listener2/news.html | 20 ++ tests/general/widgets/register_content.wgt | Bin 0 -> 1184 bytes tests/general/widgets/register_content/config.xml | 6 + tests/general/widgets/register_content/hook.js | 21 ++ tests/general/widgets/register_content/index.html | 11 + tests/general/widgets/register_content_fail.wgt | Bin 0 -> 1201 bytes .../widgets/register_content_fail/config.xml | 6 + .../general/widgets/register_content_fail/hook.js | 19 ++ .../widgets/register_content_fail/index.html | 11 + tests/general/widgets/register_protocol.wgt | Bin 0 -> 1179 bytes tests/general/widgets/register_protocol/config.xml | 6 + tests/general/widgets/register_protocol/hook.js | 21 ++ tests/general/widgets/register_protocol/index.html | 11 + tests/general/widgets/register_protocol_fail.wgt | Bin 0 -> 1194 bytes .../widgets/register_protocol_fail/config.xml | 6 + .../general/widgets/register_protocol_fail/hook.js | 19 ++ .../widgets/register_protocol_fail/index.html | 11 + 68 files changed, 1412 insertions(+), 324 deletions(-) delete mode 100644 src/configuration_parser/WidgetConfigurationManager.cpp delete mode 100644 src/configuration_parser/WidgetConfigurationManager.h create mode 100644 tests/CMakeLists.txt create mode 100644 tests/general/CMakeLists.txt create mode 100644 tests/general/CMakeUtils.txt create mode 100644 tests/general/TestCases.cpp create mode 100644 tests/general/TestInit.cpp create mode 100644 tests/general/common/CMakeLists.txt create mode 100644 tests/general/common/include/InstallerWrapper.h create mode 100644 tests/general/common/include/ManifestFile.h create mode 100644 tests/general/common/src/InstallerWrapper.cpp create mode 100644 tests/general/common/src/ManifestFile.cpp create mode 100644 tests/general/widgets/bg-00-with_bg.wgt create mode 100644 tests/general/widgets/bg-01-missing_file.wgt create mode 100644 tests/general/widgets/bg-02-without_bg.wgt create mode 100644 tests/general/widgets/content_listener.wgt create mode 100644 tests/general/widgets/content_listener/config.xml create mode 100644 tests/general/widgets/content_listener/hook.js create mode 100644 tests/general/widgets/content_listener/index.html create mode 100644 tests/general/widgets/content_listener/test.html create mode 100644 tests/general/widgets/content_listener2.wgt create mode 100644 tests/general/widgets/content_listener2/config.xml create mode 100644 tests/general/widgets/content_listener2/hook.js create mode 100644 tests/general/widgets/content_listener2/index.html create mode 100644 tests/general/widgets/content_listener2/test.html create mode 100644 tests/general/widgets/inst_nplug_1.wgt create mode 100644 tests/general/widgets/inst_nplug_2.wgt create mode 100644 tests/general/widgets/inst_nplug_3.wgt create mode 100644 tests/general/widgets/inst_nplug_4.wgt create mode 100644 tests/general/widgets/manifest.wgt create mode 100644 tests/general/widgets/minimal.wgt create mode 100644 tests/general/widgets/nonroot.wgt create mode 100644 tests/general/widgets/protocol_listener.wgt create mode 100644 tests/general/widgets/protocol_listener/config.xml create mode 100644 tests/general/widgets/protocol_listener/hook.js create mode 100644 tests/general/widgets/protocol_listener/index.html create mode 100644 tests/general/widgets/protocol_listener/news.html create mode 100644 tests/general/widgets/protocol_listener2.wgt create mode 100644 tests/general/widgets/protocol_listener2/config.xml create mode 100644 tests/general/widgets/protocol_listener2/hook.js create mode 100644 tests/general/widgets/protocol_listener2/index.html create mode 100644 tests/general/widgets/protocol_listener2/news.html create mode 100644 tests/general/widgets/register_content.wgt create mode 100644 tests/general/widgets/register_content/config.xml create mode 100644 tests/general/widgets/register_content/hook.js create mode 100644 tests/general/widgets/register_content/index.html create mode 100644 tests/general/widgets/register_content_fail.wgt create mode 100644 tests/general/widgets/register_content_fail/config.xml create mode 100644 tests/general/widgets/register_content_fail/hook.js create mode 100644 tests/general/widgets/register_content_fail/index.html create mode 100644 tests/general/widgets/register_protocol.wgt create mode 100644 tests/general/widgets/register_protocol/config.xml create mode 100644 tests/general/widgets/register_protocol/hook.js create mode 100644 tests/general/widgets/register_protocol/index.html create mode 100644 tests/general/widgets/register_protocol_fail.wgt create mode 100644 tests/general/widgets/register_protocol_fail/config.xml create mode 100644 tests/general/widgets/register_protocol_fail/hook.js create mode 100644 tests/general/widgets/register_protocol_fail/index.html diff --git a/CMakeLists.txt b/CMakeLists.txt index ce03d83..78004ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,12 +53,14 @@ SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x -g") SET(CMAKE_CXX_FLAGS_CCOV "-O0 -std=c++0x -g --coverage") OPTION(DPL_LOG "DPL logs status" ON) +OPTION(WITH_TESTS "Build tests" OFF) IF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") MESSAGE(STATUS "Logging enabled for DPL") ADD_DEFINITIONS("-DDPL_LOGS_ENABLED") ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") MESSAGE(STATUS "Logging disabled for DPL") ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") +MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS}) # If supported for the target machine, emit position-independent code,suitable # for dynamic linking and avoiding any limit on the size of the global offset @@ -102,3 +104,7 @@ INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/widget_install_popup.edj ############################# subdirectories ################################## ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(etc) + +IF(WITH_TESTS) + ADD_SUBDIRECTORY(tests) +ENDIF(WITH_TESTS) diff --git a/debian/changelog b/debian/changelog index 799cee0..d4da580 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,21 @@ +wrt-installer (0.1.6) unstable; urgency=low + + * code clean up - src/configuration_parser/WidgetConfigurationManager + * Implement tizen privilege for w3c API + * Fixed can't uninstall using pkgid from pkgcmd + * Fixed required version issue + * Renaming tests binaries + * Move installer test suites to installer repository + + -- leerang Song Fri, 22 Feb 2013 15:35:49 +0900 + +wrt-installer (0.1.5) unstable; urgency=low + + * REG_NOERROR value is not defined for function regexec. + * Fixed skip to validate a signature + + -- Soyoung Kim Thu, 14 Feb 2013 19:17:48 +0900 + wrt-installer (0.1.4) unstable; urgency=low * Fixed uninstallation using pkgid and installation without pkgid in config.xml diff --git a/packaging/wrt-installer.spec b/packaging/wrt-installer.spec index 44a5a04..40c9333 100644 --- a/packaging/wrt-installer.spec +++ b/packaging/wrt-installer.spec @@ -1,7 +1,7 @@ -#git:framework/web/wrt-installer wrt-installer 0.1.4 +#git:framework/web/wrt-installer wrt-installer 0.1.6 Name: wrt-installer Summary: Installer for tizen Webruntime -Version: 0.1.4 +Version: 0.1.6 Release: 1 Group: Development/Libraries License: Apache License, Version 2.0 @@ -39,6 +39,7 @@ BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(drm-service-core-intel) BuildRequires: pkgconfig(app2sd) BuildRequires: pkgconfig(web-provider-svc) +BuildRequires: pkgconfig(libprivilege-control) Requires: xmlsec1 %description @@ -47,6 +48,11 @@ Description: Wrt Installer for Tizen apps and Wac apps %prep %setup -q +%define with_tests 0 +%if "%{WITH_TESTS}" == "ON" || "%{WITH_TESTS}" == "Y" || "%{WITH_TESTS}" == "YES" || "%{WITH_TESTS}" == "TRUE" || "%{WITH_TESTS}" == "1" + %define with_tests 1 +%endif + %build export LDFLAGS+="-Wl,--rpath=/usr/lib -Wl,--hash-style=both -Wl,--as-needed" @@ -55,7 +61,8 @@ LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=/usr \ -DDPL_LOG=ON \ -DCMAKE_PACKAGE_VERSION=%{version} \ - -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} + -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \ + %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS} make %{?jobs:-j%jobs} %install @@ -85,6 +92,10 @@ ln -sf /usr/bin/wrt-installer /usr/etc/package-manager/backend/wgt #for booting recovery mkdir -p /opt/share/widget/temp_info +[ -h /etc/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh ] && rm /etc/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh +[ -h /etc/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh ] && rm /etc/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh +ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc3.d/S46lwrt_preinstall_widgets.sh +ln -s /etc/rc.d/init.d/wrt_preinstall_widgets.sh /etc/rc.d/rc5.d/S46lwrt_preinstall_widgets.sh # for downloadable Application icons path mkdir -p /opt/share/icons/default/small @@ -100,3 +111,6 @@ mkdir -p /opt/share/icons/default/small %{_datadir}/license/%{name} %{_libdir}/systemd/user/tizen-mobile-session.target.wants/wrt-preinstall-widgets.service %{_libdir}/systemd/user/wrt-preinstall-widgets.service +%if %{with_tests} + %attr(755,root,root) %{_bindir}/wrt-installer-tests-* +%endif diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 75d2d4b..75cc5b2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -119,6 +119,7 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP dpl-wrt-dao-ro dpl-wrt-dao-rw wrt-commons-custom-handler-dao-rw + wrt-commons-security-origin-dao dpl-encryption wrt-plugins-types pkgmgr-installer diff --git a/src/configuration_parser/WidgetConfigurationManager.cpp b/src/configuration_parser/WidgetConfigurationManager.cpp deleted file mode 100644 index 6044a5f..0000000 --- a/src/configuration_parser/WidgetConfigurationManager.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* - * Copyright (c) 2011 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 WidgetConfigurationManager.cpp - * @author Piotr Fatyga (p.fatyga@samsung.com) - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - * @version 0.1 - * @brief - */ -#include "WidgetConfigurationManager.h" -#include -#include -#include "root_parser.h" -#include "parser_runner.h" -#include "widget_parser.h" -#include -#include -#include -#include -#include -IMPLEMENT_SINGLETON(WidgetConfigurationManager) - -//TODO Rewrite this as steps/tasks -namespace // anonymous -{ -const char *const DEFAULT_LANGUAGE = "default"; -const size_t MAX_WIDGET_PATH_SIZE = 1024; - -//#define WRT_WIDGET_DEFAULT_ICON_WIDTH 80 -//#define WRT_WIDGET_DEFAULT_ICON_HEIGHT 80 - -//#define WRT_WIDGET_CONFIG_BASE_LOCALE "locales" -const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml"; -} - -bool WidgetConfigurationManager::locateAndParseConfigurationFile( - const std::string& _currentPath, - WrtDB::WidgetRegisterInfo& pWidgetConfigInfo, - const std::string& baseFolder, - int* pErrCode) -{ - using namespace WrtDB; - - if (!pErrCode) { - return false; - } - - ConfigParserData& configInfo = pWidgetConfigInfo.configInfo; - - // check if this installation from browser, or not. - size_t pos = _currentPath.rfind("/"); - std::ostringstream infoPath; - infoPath << _currentPath.substr(pos + 1); - - ParserRunner parser; - std::string language = ""; - - if (infoPath.str() != WRT_WIDGET_CONFIG_FILE_NAME) { - // in case of general installation using wgt archive - //TODO: use DPL::String in the caller to this function too. - DPL::String currentPath = DPL::FromUTF8String(_currentPath); - - if (currentPath.empty() || baseFolder.empty()) { - *pErrCode = WRT_ERR_INVALID_ARG; - return false; - } - - //TODO: rewrite this madness - char cfgAbsPath[MAX_WIDGET_PATH_SIZE + 1] = { 0 }; - DIR* dir = NULL; - struct dirent* ptr = NULL; - - dir = opendir(_currentPath.c_str()); - if (dir == NULL) { - *pErrCode = WRT_ERR_UNKNOWN; - return false; - } - - //TODO why don't we use fopen here - bool has_config_xml = false; - 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)) { - _WrtUtilSetAbsolutePath(cfgAbsPath, - _currentPath.c_str(), ptr->d_name); - //Parse widget configuration file - LogDebug("Found config: " << cfgAbsPath); - - Try - { - parser.Parse(cfgAbsPath, ElementParserPtr(new - RootParser< - WidgetParser>( - configInfo, - DPL - :: - FromUTF32String( - L"widget")))); - } - Catch(ElementParser::Exception::Base) - { - LogDebug("Invalid widget configuration file!"); - // _rethrown_exception.Dump(); - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - closedir(dir); - return false; - } - - // - // WidgetConfigurationParser & parser = - // WidgetConfigurationParserSingleton::Instance(); - // if - // (!parser.parseConfigurationFile(cfgAbsPath, configInfo, - // baseFolder.c_str(), pWidgetConfigInfo.signature_type)) { - // LogDebug("Invalid widget configuration - // file!"); - // *pErrCode = - // WRT_WM_ERR_INVALID_ARCHIVE; - // closedir(dir); - // return false; - // } - - has_config_xml = true; - break; - } - } - } - closedir(dir); - - //We must have config.xml so leaveing if we doesn't - if (!has_config_xml) { - LogDebug("Invalid archive"); - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - return false; - } - } else { - // in case of browser installation - Try - { - parser.Parse(_currentPath, ElementParserPtr(new - RootParser< - WidgetParser>( - configInfo, - DPL:: - FromUTF32String( - L"widget")))); - } - Catch(ElementParser::Exception::Base) - { - LogDebug("Invalid widget configuration file!"); - // _rethrown_exception.Dump(); - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - return false; - } - } - - char *tmp_language; - if (!_WrtUtilStringToLower(baseFolder.c_str(), &tmp_language)) { - *pErrCode = WRT_ERR_UNKNOWN; - return false; - } - - if (!tmp_language) { - *pErrCode = WRT_ERR_UNKNOWN; - return false; - } - language = tmp_language; - free(tmp_language); - - if (!!configInfo.widget_id) { - if (!pWidgetConfigInfo.guid) { - pWidgetConfigInfo.guid = configInfo.widget_id; - } else { - if (pWidgetConfigInfo.guid != configInfo.widget_id) { - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - LogDebug("Invalid archive"); - return false; - } - } - } - - if (!!configInfo.tizenId) { - if (pWidgetConfigInfo.pkgName != *configInfo.tizenId) { - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - LogDebug("Invalid archive - Tizen ID not same error"); - return false; - } - } - - if (!!configInfo.version) { - if (!pWidgetConfigInfo.version) { - pWidgetConfigInfo.version = configInfo.version; - } else { - if (pWidgetConfigInfo.version != configInfo.version) { - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - LogDebug("Invalid archive"); - return false; - } - } - } - - if (!!configInfo.minVersionRequired) { - pWidgetConfigInfo.minVersion = configInfo.minVersionRequired; - } else if (!!configInfo.tizenMinVersionRequired) { - pWidgetConfigInfo.minVersion = configInfo.tizenMinVersionRequired; - } - - return true; -} - -void WidgetConfigurationManager::processFile( - const std::string& path, - WrtDB::WidgetRegisterInfo & - widgetConfiguration) -{ - int pErrCode; - - if (!locateAndParseConfigurationFile(path, widgetConfiguration, - DEFAULT_LANGUAGE, &pErrCode)) - { - LogWarning("Widget archive: Failed while parsing config file"); - ThrowMsg(Exception::ProcessFailed, path); - } -} diff --git a/src/configuration_parser/WidgetConfigurationManager.h b/src/configuration_parser/WidgetConfigurationManager.h deleted file mode 100644 index 7bda14f..0000000 --- a/src/configuration_parser/WidgetConfigurationManager.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 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 WidgetConfigurationManager.h - * @author Piotr Fatyga (p.fatyga@samsung.com) - * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com) - * @version 0.1 - * @brief - */ -#ifndef _WIDGETCONFIGURATIONMANAGER_H -#define _WIDGETCONFIGURATIONMANAGER_H - -#include -#include -#include -#include -#include -#include - -class WidgetConfigurationManager -{ - public: - class Exception - { - public: - DECLARE_EXCEPTION_TYPE(DPL::Exception, Base) - DECLARE_EXCEPTION_TYPE(Base, ProcessFailed) - }; - - /** - * This method is used to process the config.xml of widget, get - * the corresponding configuration to pWidgetConfigInfo - * - * @param[in] path Specified the widget archive file path (absolute path). - * @return Configuration information of widget - */ - void processFile(const std::string& path, - WrtDB::WidgetRegisterInfo &wConfig); - - private: - typedef std::list > StringPairList; - - bool locateAndParseConfigurationFile( - const std::string& currentPath, - WrtDB::WidgetRegisterInfo& - pWidgetConfigInfo, - const std::string& baseFolder, - int* pErrCode); -}; - -typedef DPL::Singleton -WidgetConfigurationManagerSingleton; - -#endif // _WIDGETCONFIGURATIONMANAGER_H diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index 3e80871..a1150f8 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -470,7 +470,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( if ((regexec(®, DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid). c_str(), - static_cast(0), NULL, 0) != REG_NOERROR) || + static_cast(0), NULL, 0) == REG_NOMATCH) || (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig .tzPkgid)) && result != ConfigureResult::Updated)) diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp index 9b2d1b9..342b5f4 100644 --- a/src/jobs/widget_install/task_certify.cpp +++ b/src/jobs/widget_install/task_certify.cpp @@ -229,22 +229,22 @@ void TaskCertify::stepSignature() WrtSignatureValidator::Result result; + WrtSignatureValidator validator( + appType, + !GlobalSettings:: + OCSPTestModeEnabled(), + !GlobalSettings:: + CrlTestModeEnabled(), + complianceMode); + + result = validator.check(data, widgetPath); + if (m_contextData.widgetConfig.packagingType == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP) { // In directory installation mode, the validation is skipped. result = WrtSignatureValidator::SIGNATURE_VERIFIED; - } else { - WrtSignatureValidator validator( - appType, - !GlobalSettings:: - OCSPTestModeEnabled(), - !GlobalSettings:: - CrlTestModeEnabled(), - complianceMode); - - result = validator.check(data, widgetPath); } if (result == WrtSignatureValidator::SIGNATURE_REVOKED) { diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp index cc931a0..072a9f9 100644 --- a/src/jobs/widget_install/task_database.cpp +++ b/src/jobs/widget_install/task_database.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ TaskDatabase::TaskDatabase(InstallerContext& context) : AddStep(&TaskDatabase::StepRegisterExternalFiles); AddStep(&TaskDatabase::StepWrtDBInsert); AddStep(&TaskDatabase::StepAceDBInsert); + AddStep(&TaskDatabase::StepSecurityOriginDBInsert); AddStep(&TaskDatabase::StepRemoveExternalFiles); AddStep(&TaskDatabase::StepCreateVconf); AddStep(&TaskDatabase::StepLiveboxDBInsert); @@ -143,6 +145,23 @@ void TaskDatabase::StepAceDBInsert() "Update failure. ace_register_widget failed"); } LogDebug("Ace data inserted"); +} + +void TaskDatabase::StepSecurityOriginDBInsert() +{ + LogDebug("Create Security origin database"); + // automatically create security origin database + using namespace SecurityOriginDB; + SecurityOriginDAO dao(m_context.locations->getPkgId()); + + // Checking privilege list for setting security origin exception data + FOREACH(it, m_context.widgetConfig.configInfo.privilegeList) { + std::map::const_iterator result = + g_W3CPrivilegeTextMap.find(DPL::ToUTF8String(it->name)); + if (result != g_W3CPrivilegeTextMap.end()) { + dao.setPrivilegeSecurityOriginData(result->second); + } + } m_context.job->UpdateProgress( InstallerContext::INSTALL_NEW_DB_INSERT, diff --git a/src/jobs/widget_install/task_database.h b/src/jobs/widget_install/task_database.h index 608dbfe..3e0beba 100644 --- a/src/jobs/widget_install/task_database.h +++ b/src/jobs/widget_install/task_database.h @@ -47,6 +47,7 @@ class TaskDatabase : void StepRegisterExternalFiles(); void StepWrtDBInsert(); void StepAceDBInsert(); + void StepSecurityOriginDBInsert(); void StepRemoveExternalFiles(); void StepCreateVconf(); void StepLiveboxDBInsert(); diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index 13fa549..54462a6 100644 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -586,7 +586,7 @@ bool TaskWidgetConfig::isMinVersionCompatible( if (widgetVersion.IsNull() || (*widgetVersion).empty()) { LogWarning("minVersion attribute is empty. WRT assumes platform " "supports this widget."); - return true; + return false; } //Parse widget version @@ -595,7 +595,7 @@ bool TaskWidgetConfig::isMinVersionCompatible( minorWidget, microWidget)) { LogWarning("Invalid format of widget version string."); - return true; + return false; } //Parse supported version diff --git a/src/pkg-manager/backendlib.cpp b/src/pkg-manager/backendlib.cpp index 3eed3f9..37952c1 100644 --- a/src/pkg-manager/backendlib.cpp +++ b/src/pkg-manager/backendlib.cpp @@ -23,6 +23,7 @@ * to package manager */ #include "package-manager-plugin.h" +#include #include #include #include @@ -72,12 +73,28 @@ static void pkg_native_plugin_on_unload() static int pkg_plugin_app_is_installed(const char *pkg_name) { + const char* REG_PKGID_PATTERN = "^[a-zA-Z0-9]{10}$"; LogDebug("pkg_plugin_app_is_installed() is called"); WrtDB::WrtDatabase::attachToThreadRO(); - bool result = WidgetDAOReadOnly::isWidgetInstalled( - DPL::FromUTF8String(pkg_name)); + regex_t reg; + if (regcomp(®, REG_PKGID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) { + LogDebug("Regcomp failed"); + } + + WrtDB::TizenAppId appid; + + if ((regexec(®, pkg_name, + static_cast(0), NULL, 0) == 0)) + { + WrtDB::TizenPkgId pkgid(DPL::FromUTF8String(pkg_name)); + appid = WidgetDAOReadOnly::getTzAppId(pkgid); + } else { + appid = DPL::FromUTF8String(pkg_name); + } + + bool result = WidgetDAOReadOnly::isWidgetInstalled(appid); WrtDB::WrtDatabase::detachFromThread(); if (result) { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..5951524 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,20 @@ +# 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 Karol Pawlowski (k.pawlowski@samsung.com) +# + + +ADD_SUBDIRECTORY(general) diff --git a/tests/general/CMakeLists.txt b/tests/general/CMakeLists.txt new file mode 100644 index 0000000..e72a998 --- /dev/null +++ b/tests/general/CMakeLists.txt @@ -0,0 +1,80 @@ +# 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 Karol Pawlowski (k.pawlowski@samsung.com) +# + + +# TODO cleanup dependencies +PKG_CHECK_MODULES(COMMON_LIB_PKGS + dbus-1 + libpcrecpp + dpl-efl + dpl-test-efl + 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) + +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(INSTALLER_TESTS_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/TestInit.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/TestCases.cpp +) + +SET(INSTALLER_TESTS_TARGET "wrt-installer-tests-general") + +WRT_TEST_BUILD(${INSTALLER_TESTS_TARGET} ${INSTALLER_TESTS_SOURCES}) +WRT_TEST_INSTALL(${INSTALLER_TESTS_TARGET}) +target_link_libraries(${INSTALLER_TESTS_TARGET} + ${dpl_LIBRARIES} + ${dpl-test_LIBRARIES} + ${WRT_TEST_LIBRARY} + ${TARGET_CORE_MODULE_LIB} + ${COMMON_LIB_PKGS_LIBRARIES} +) diff --git a/tests/general/CMakeUtils.txt b/tests/general/CMakeUtils.txt new file mode 100644 index 0000000..265869f --- /dev/null +++ b/tests/general/CMakeUtils.txt @@ -0,0 +1,182 @@ +# @file CMakeUtils.txt +# @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com) +# @author Pawel Sikorski (p.sikorski@samsung.com) +# @author Krzysztof Jackiewicz (k.jackiewicz@samsung.com) +# @version 1.0 +# @brief +# + +# +# Discovers target's INCLUDE_DIRECTORIES and LINK_DIRECTORIES. +# This is done by retrieving the directory target was built in and +# fetching appropriate properties of that directory. +FUNCTION(WRT_INTROSPECT_TARGET PREFIX TARGET_NAME) + GET_TARGET_PROPERTY(LOCATION ${TARGET_NAME} LOCATION) + IF(${LOCATION} STREQUAL "LOCATION-NOTFOUND") + MESSAGE(FATAL_ERROR "Target '${TARGET_NAME}' introspection failed") + ELSE(${LOCATION} STREQUAL "LOCATION-NOTFOUND") + STRING(FIND ${LOCATION} "/" LAST_SLASH_POSITION REVERSE) + STRING(SUBSTRING ${LOCATION} 0 ${LAST_SLASH_POSITION} LOCATION) + + GET_DIRECTORY_PROPERTY(INCLUDE_DIRS DIRECTORY ${LOCATION} INCLUDE_DIRECTORIES) + SET("${PREFIX}_INCLUDE_DIRS" ${INCLUDE_DIRS} PARENT_SCOPE) + + GET_DIRECTORY_PROPERTY(LIBRARY_DIRS DIRECTORY ${LOCATION} LINK_DIRECTORIES) + SET("${PREFIX}_LIBRARY_DIRS" ${LIBRARY_DIRS} PARENT_SCOPE) + ENDIF(${LOCATION} STREQUAL "LOCATION-NOTFOUND") +ENDFUNCTION(WRT_INTROSPECT_TARGET) + +FUNCTION(WRT_TEST_LIBRARY) + SET_PROPERTY(GLOBAL APPEND PROPERTY COMMON_TESTS_LIBRARY ${ARGV}) +ENDFUNCTION(WRT_TEST_LIBRARY) + +# +# Replacement functions for standard (w/o "WRT_" prefix) CMake functions. +# They store supplied arguments in global properties to assign them to tests. +# Anything added with this functions is used by all targets that are built with +# WRT_TEST_BUILD function. + +# +# Appends directories to global property TESTS_INCLUDE_DIRS which is +# then read by WRT_TEST_BUILD and its content is forwarded to +# command INCLUDE_DIRECTORIES() (for all targets). +FUNCTION(WRT_INCLUDE_DIRECTORIES) + SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_INCLUDE_DIRS ${ARGV}) +ENDFUNCTION(WRT_INCLUDE_DIRECTORIES) + +# +# Appends directories to global property TESTS_LIBRARY_DIRS which is +# then read by WRT_TEST_BUILD and its content is forwarded to +# command LINK_DIRECTORIES() (for all targets). +FUNCTION(WRT_LINK_DIRECTORIES) + SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_LIBRARY_DIRS ${ARGV}) +ENDFUNCTION(WRT_LINK_DIRECTORIES) + +# +# Appends directories to global property TESTS_LIBRARIES which is +# then read by WRT_TEST_BUILD and its content is forwarded to +# command TARGET_LINK_LIBRARIES() (for all targets). +FUNCTION(WRT_TARGET_LINK_LIBRARIES) + SET_PROPERTY(GLOBAL APPEND PROPERTY TESTS_LIBRARIES ${ARGV}) +ENDFUNCTION(WRT_TARGET_LINK_LIBRARIES) + +# +# Convenience method that fills TESTS_INCLUDE_DIRS, TESTS_LIBRARY_DIRS +# and TESTS_LIBRARIES with values discovered from introspecting supplied +# targets. +# Function takes arbitrary number of targets. +FUNCTION(WRT_ADD_INTERNAL_DEPENDENCIES) + FOREACH(DEPENDENCY ${ARGV}) + WRT_INTROSPECT_TARGET(prefix ${DEPENDENCY}) + WRT_INCLUDE_DIRECTORIES(${prefix_INCLUDE_DIRS}) + WRT_LINK_DIRECTORIES(${prefix_LIBRARY_DIRS}) + WRT_TARGET_LINK_LIBRARIES(${DEPENDENCY}) + ENDFOREACH(DEPENDENCY) +ENDFUNCTION(WRT_ADD_INTERNAL_DEPENDENCIES) + + +# +# Replacement functions for standard (w/o "WRT_" prefix) CMake functions. +# They store supplied arguments in global properties to assign them to specific +# tests. Properties names are based on the test target name. +# Anything added with this functions is used only by the specified target that +# is built with WRT_TEST_BUILD function. + +# +# Appends directories to global property ${TARGET_NAME}_INCLUDE_DIRS +# which is then read by WRT_TEST_BUILD and its content is forwarded to +# command INCLUDE_DIRECTORIES() (for specified target). +FUNCTION(WRT_TEST_INCLUDE_DIRECTORIES TARGET_NAME) + SET_PROPERTY(GLOBAL APPEND PROPERTY ${TARGET_NAME}_INCLUDE_DIRS ${ARGN}) +ENDFUNCTION(WRT_TEST_INCLUDE_DIRECTORIES) + +# +# Appends directories to global property ${TARGET_NAME}_LIBRARY_DIRS +# which is then read by WRT_TEST_BUILD and its content is forwarded to +# command LINK_DIRECTORIES() (for specified target). +FUNCTION(WRT_TEST_LINK_DIRECTORIES TARGET_NAME) + SET_PROPERTY(GLOBAL APPEND PROPERTY ${TARGET_NAME}_LIBRARY_DIRS ${ARGN}) +ENDFUNCTION(WRT_TEST_LINK_DIRECTORIES) + +# +# Appends directories to global property ${TARGET_NAME}_LIBRARIES +# which is then read by WRT_TEST_BUILD and its content is forwarded to +# command TARGET_LINK_LIBRARIES() (for specified target). +FUNCTION(WRT_TEST_TARGET_LINK_LIBRARIES TARGET_NAME) + SET_PROPERTY(GLOBAL APPEND PROPERTY ${TARGET_NAME}_LIBRARIES ${ARGN}) +ENDFUNCTION(WRT_TEST_TARGET_LINK_LIBRARIES) + +# +# Convenience method that fills ${TARGET_NAME}_INCLUDE_DIRS, +# ${TARGET_NAME}_LIBRARY_DIRS and ${TARGET_NAME}_LIBRARIES with +# values discovered from introspecting supplied targets. +# Function takes arbitrary number of targets. +FUNCTION(WRT_TEST_ADD_INTERNAL_DEPENDENCIES TARGET_NAME) + FOREACH(DEPENDENCY ${ARGN}) + WRT_INTROSPECT_TARGET(prefix ${DEPENDENCY}) + WRT_TEST_INCLUDE_DIRECTORIES(${TARGET_NAME} ${prefix_INCLUDE_DIRS}) + WRT_TEST_LINK_DIRECTORIES(${TARGET_NAME} ${prefix_LIBRARY_DIRS}) + WRT_TEST_TARGET_LINK_LIBRARIES(${TARGET_NAME} ${DEPENDENCY}) + ENDFOREACH(DEPENDENCY) +ENDFUNCTION(WRT_TEST_ADD_INTERNAL_DEPENDENCIES) + +# Functions used to build test targets (proper sources, includes, libs are +# added automatically) +FUNCTION(WRT_TEST_BUILD TARGET_NAME) + SET(SOURCES "${ARGN}") + ADD_EXECUTABLE("${TARGET_NAME}" ${SOURCES}) + + # get include dirs global property + GET_PROPERTY(INCLUDE_DIRS GLOBAL PROPERTY TESTS_INCLUDE_DIRS) + GET_PROPERTY(TEST_INCLUDE_DIRS GLOBAL PROPERTY ${TARGET_NAME}_INCLUDE_DIRS) + INCLUDE_DIRECTORIES( + ${INCLUDE_DIRS} + ${TEST_INCLUDE_DIRS} + ) + + # get library dirs global property + GET_PROPERTY(LIBRARY_DIRS GLOBAL PROPERTY TESTS_LIBRARY_DIRS) + GET_PROPERTY(TEST_LIBRARY_DIRS GLOBAL PROPERTY ${TARGET_NAME}_LIBRARY_DIRS) + LINK_DIRECTORIES( + ${LIBRARY_DIRS} + ${TEST_LIBRARY_DIRS} + ) + + # get link libraries global property + GET_PROPERTY(LINK_LIBRARIES GLOBAL PROPERTY TESTS_LIBRARIES) + GET_PROPERTY(TEST_LIBRARIES GLOBAL PROPERTY ${TARGET_NAME}_LIBRARIES) + TARGET_LINK_LIBRARIES("${TARGET_NAME}" + ${LINK_LIBRARIES} + ${TEST_LIBRARIES} + ) +ENDFUNCTION(WRT_TEST_BUILD) + +FUNCTION(WRT_TEST_INSTALL) + SET_TARGET_PROPERTIES(${ARGV} PROPERTIES + BUILD_WITH_INSTALL_RPATH ON + INSTALL_RPATH_USE_LINK_PATH ON + ) + INSTALL(TARGETS ${ARGV} + DESTINATION bin + PERMISSIONS OWNER_READ + OWNER_WRITE + OWNER_EXECUTE + GROUP_READ + GROUP_EXECUTE + WORLD_READ + WORLD_EXECUTE + ) +ENDFUNCTION(WRT_TEST_INSTALL) + +# Takes arbitrary number of arguments and concatenates them using ':' character. +# Rationale: +# CMake list when converted to a string is joined with ';' character. However, +# GCC takes strings with multiple elements separated with ':' (e.g. list of +# paths). Used typically when generating DB schemas with ORM mechanism. +FUNCTION(WRT_CONVERT_TO_GCC_LIST OUTPUT_VARIABLE) + FOREACH(ITEM ${ARGN}) + LIST(APPEND ITEMS ${ITEM}) + ENDFOREACH(ITEM) + STRING(REPLACE ";" ":" OUTPUT "${ITEMS}") + SET("${OUTPUT_VARIABLE}" "${OUTPUT}" PARENT_SCOPE) +ENDFUNCTION(WRT_CONVERT_TO_GCC_LIST) diff --git a/tests/general/TestCases.cpp b/tests/general/TestCases.cpp new file mode 100644 index 0000000..a0a978a --- /dev/null +++ b/tests/general/TestCases.cpp @@ -0,0 +1,246 @@ +/* + * 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 Miscellaneous test's bodies + */ + +#include +#include +#include +#include +#include +#include + +using namespace InstallerWrapper; + +namespace { + +const std::string miscWidgetsStuff = "/opt/share/widget/tests/misc/"; + +struct Result { + bool m_exc; + bool m_exd; + bool m_exs; + std::string message; + Result(bool exc = false, bool exd = false, bool exs = false) + : m_exc(exc), m_exd(exd), m_exs(exs) {} +}; + +} + +//////////////////////////////////////////////////////////////////////////////// + +RUNNER_TEST_GROUP_INIT(Manifest) + +/* +Name: creatingManifestFile +Description: Creation of manifest file by wrt-installer test +Expected: file should be created and installed by wrt-installer. Content should + match expected values +*/ +RUNNER_TEST(creatingManifestFile) +{ + const char * manifestPath = "/opt/share/packages/manifest01.xml"; + /* This widget removal should stay here in case previous test run failed + * (so widget has not been uninstalled) */ + uninstallByGuid("http://test.samsung.com/widget/manifestTest"); + std::string tizenId; + RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId) + == InstallerWrapper::Success); + RUNNER_ASSERT(WrtUtilFileExists(manifestPath)); + ManifestFile mf(manifestPath); + + Try + { + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@package") + == "manifest01"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@type") + == "wgt"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@version") + == "1.0"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:label") + == "Manifest Example"); + + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@email") + == "manifest@misc.test.create.desktop.com"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@href") + == "http://misc.test.create.desktop.com"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author") + == "Manifest"); + + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@appid") + == "manifest01"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay") + == "false"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@type") + == "webapp"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@extraid") + == "http://test.samsung.com/widget/manifestTest"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage") + == "true"); + + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:icon") + == "manifest01.png"); + + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[not(@xml:lang)]") + == "Manifest Example"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='de_DE']") + == "Manifest Beispiel"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='en_US']") + == "Manifest Example"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pl']") + == "Przykład Manifest"); + RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pt_PT']") + == "Exemplo manifesto"); + } + Catch(ManifestFile::ManifestParseError) + { + RUNNER_ASSERT_MSG(false,DPL::Exception::KnownExceptionToString(_rethrown_exception)); + } + /* 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/TestInit.cpp b/tests/general/TestInit.cpp new file mode 100644 index 0000000..2e1ac8f --- /dev/null +++ b/tests/general/TestInit.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2012 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 TestInit.cpp + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @version 1.0 + * @brief main for misc tests + */ + +#include +#include +#include + +int main (int argc, char *argv[]) +{ + LogInfo("Starting tests"); + + WrtDB::WrtDatabase::attachToThreadRW(); + int status = + DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv); + WrtDB::WrtDatabase::detachFromThread(); + + return status; +} diff --git a/tests/general/common/CMakeLists.txt b/tests/general/common/CMakeLists.txt new file mode 100644 index 0000000..7303b3c --- /dev/null +++ b/tests/general/common/CMakeLists.txt @@ -0,0 +1,41 @@ +# 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/common/include/InstallerWrapper.h b/tests/general/common/include/InstallerWrapper.h new file mode 100644 index 0000000..c8f68f8 --- /dev/null +++ b/tests/general/common/include/InstallerWrapper.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2011 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. + */ + +#ifndef WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_INSTALLER_WRAPPER_H +#define WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_INSTALLER_WRAPPER_H + +#include + +namespace InstallerWrapper +{ + +typedef int InstallResult; +const InstallResult WrongWidgetPackage = -2; +const InstallResult OtherError = -1; +const InstallResult Success = 0; + +InstallResult install( + const std::string& path, + std::string& tizenId, + const std::string& user = ""); +bool uninstall(const std::string& tizenId); +bool uninstallByGuid(const std::string& guid); +/** + * @brief killWrtClients kills processes that matches 'wrt-client' + * @return True if any client was killed + */ +bool sigintWrtClients(); + +} + +#endif//WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_INSTALLER_WRAPPER_H diff --git a/tests/general/common/include/ManifestFile.h b/tests/general/common/include/ManifestFile.h new file mode 100644 index 0000000..3bd67c5 --- /dev/null +++ b/tests/general/common/include/ManifestFile.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2012 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 ManifestFile.h + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @brief Manifest file reading + */ + +#ifndef WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H +#define WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H + +#include + +#include +#include + +#include + +/** + * @brief The ManifestFile class which serialize xml file to tree + */ +class ManifestFile +{ +public: + DECLARE_EXCEPTION_TYPE(DPL::Exception,Base) + DECLARE_EXCEPTION_TYPE(Base,ManifestParseError) + + ManifestFile(const std::string & file); + ~ManifestFile(); + + std::string getValueByXpath(const std::string & path) const; +private: + void parse(); + + std::string filename; + xmlDocPtr doc; + xmlXPathContextPtr xpathCtx; +}; + + +#endif //WRT_INSTALLER_TESTS_GENERAL_COMMON_INCLUDE_MANIFESTFILE_H diff --git a/tests/general/common/src/InstallerWrapper.cpp b/tests/general/common/src/InstallerWrapper.cpp new file mode 100644 index 0000000..a1f8917 --- /dev/null +++ b/tests/general/common/src/InstallerWrapper.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2011 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. + */ + +#include "InstallerWrapper.h" + +#include + +#include + +namespace +{ + +const std::string params = "DPL_USE_OLD_STYLE_LOGS=0 " + "DPL_USE_OLD_STYLE_PEDANTIC_LOGS=0 WRT_TEST_MODE=1 "; +const std::string installCmd = params + "wrt-installer -if "; +const std::string uninstallCmd = params + "wrt-installer -un "; +const std::string uninstallByGuidCmd = params + "wrt-installer -ug \""; +const std::string redirection = " 2>&1"; +const std::string INSTALLER_MESSAGE_ID_LINE = + "## wrt-installer : %s installation was successful.\n"; +const std::string INSTALLER_MESSSGE_START = "## wrt-installer : "; + +std::string getAndCutInstallerLogLine(std::string &src) +{ + size_t startIndex = src.find(INSTALLER_MESSSGE_START); + if (startIndex == std::string::npos) + { + LogWarning("Installer message can not be found"); + return std::string(); + } + size_t newLineIndex = src.find("\n", startIndex); + std::string line = src.substr(startIndex, newLineIndex - startIndex + 1); + src.erase(0, newLineIndex + 1); + return line; +} + +} + +namespace InstallerWrapper +{ + +InstallResult install( + const std::string& path, + std::string& tizenId, + const std::string& user) +{ + std::string msg; + + auto cmd = installCmd + path + redirection; + if(user.length()) //if other user should be used + { + cmd = "su " + user + " -c '" + cmd + "'"; + } + auto filehandle = popen(cmd.c_str(), "r"); + if (!filehandle) {; + return OtherError; + } + + char buffer[1024] = ""; + int ret; + while ((ret = fread_unlocked(buffer, + sizeof(char), + sizeof(buffer)/sizeof(char), + filehandle)) > 0) + { + msg += buffer; + } + LogDebug(msg); + auto err = pclose(filehandle); + if (!WIFEXITED(err)) { + return OtherError; + } + if (0 != WEXITSTATUS(err)) { + if (1 == WEXITSTATUS(err)) { + return WrongWidgetPackage; + } + return OtherError; + } + + char* id = NULL; + std::string line; + + while ((line = getAndCutInstallerLogLine(msg)) != "") + { + if (line.find("successful") != std::string::npos) + { + id = new char[line.length()]; + int nr = sscanf(line.c_str(), INSTALLER_MESSAGE_ID_LINE.c_str(), id); + + if (1 != nr) + { + LogWarning("Can not read widget ID from message: " << line); + delete[] id; + return OtherError; + } + tizenId = id; + delete[] id; + if (tizenId != "plugin") + { + return Success; + } + } + } + + return OtherError; +} + +bool uninstall(const std::string& tizenId) +{ + std::string cmd = uninstallCmd + tizenId + " > /dev/null 2>/dev/null"; + LogDebug("executing: " << cmd); + return (system(cmd.c_str()) == EXIT_SUCCESS); +} + +bool uninstallByGuid(const std::string& guid) +{ + std::string cmd = uninstallByGuidCmd + guid + "\" > /dev/null 2>/dev/null"; + LogDebug("executing: " << cmd); + return (system(cmd.c_str()) == EXIT_SUCCESS); +} + +bool sigintWrtClients() +{ + return (system("pkill -2 wrt-client") == 0); +} + +} + diff --git a/tests/general/common/src/ManifestFile.cpp b/tests/general/common/src/ManifestFile.cpp new file mode 100644 index 0000000..e88a507 --- /dev/null +++ b/tests/general/common/src/ManifestFile.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2012 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 ManifestFile.cpp + * @author Tomasz Iwanek (t.iwanek@samsung.com) + * @brief Manifest file reading + */ + +#include + +#include +#include + +#include + +//TODO: This file reads manifest file. This functionality is familiar with writing +// in wrt-installer but reading ws not necessary there. +// Maybe it should be changed in some way. + +ManifestFile::ManifestFile(const std::string & file) : filename(file) +{ + xmlInitParser(); + LIBXML_TEST_VERSION + xmlXPathInit(); + parse(); +} + +ManifestFile::~ManifestFile() +{ + xmlXPathFreeContext(xpathCtx); + xmlFreeDoc(doc); + xmlCleanupParser(); +} + +void ManifestFile::parse() +{ + doc = xmlReadFile(filename.c_str(), NULL, 0); + if (doc == NULL) + { + ThrowMsg(ManifestParseError,"File Problem"); + } + else + { + //context + xpathCtx = xmlXPathNewContext(doc); + if(xpathCtx == NULL) + { + ThrowMsg(ManifestParseError,"Error: unable to create new XPath context\n"); + } + xpathCtx->node = xmlDocGetRootElement(doc); + + if(xmlXPathRegisterNs(xpathCtx, BAD_CAST "p", BAD_CAST "http://tizen.org/ns/packages") != 0) + { + ThrowMsg(ManifestParseError,"Error: unable to register namespace\n"); + } + } +} + +std::string ManifestFile::getValueByXpath(const std::string & path) const +{ + std::string result; + xmlXPathObjectPtr xpathObject; + //get requested node's values + xpathObject = xmlXPathEvalExpression(BAD_CAST path.c_str(), xpathCtx); + if(xpathObject == NULL) + { + ThrowMsg(ManifestParseError,"XPath evaluation failure: " << path); + } + xmlNodeSetPtr nodes = xpathObject->nodesetval; + int size = (nodes) ? nodes->nodeNr : 0; + if(size != 1) + { + ThrowMsg(ManifestParseError,"Xpath does not point 1 element but " << size + << " for xpath: " << path); + } + else + { + if(nodes->nodeTab[0]->type == XML_ELEMENT_NODE) + { + xmlNodePtr cur = nodes->nodeTab[0]; + xmlChar * value = xmlNodeGetContent(cur); + result = std::string(reinterpret_cast(value)); //this cast should be safe... + xmlFree(value); + } + else if(nodes->nodeTab[0]->type == XML_ATTRIBUTE_NODE) + { + xmlNodePtr cur = nodes->nodeTab[0]; + xmlChar * value = xmlNodeGetContent(cur); + result = std::string(reinterpret_cast(value)); + xmlFree(value); + } + } + //Cleanup of XPath data + xmlXPathFreeObject(xpathObject); + return result; +} diff --git a/tests/general/widgets/bg-00-with_bg.wgt b/tests/general/widgets/bg-00-with_bg.wgt new file mode 100644 index 0000000000000000000000000000000000000000..36d2452edbe17dea14f9a0158a4354eb1c09ccc5 GIT binary patch literal 736 zcmWIWW@Zs#U|`^2SnML=IB(vb6gwc#8;H3WWEe8@Qc^4QGD>oDLPIzim<4Ye27qvB z1vdjD%L`@(1~9Stq{hj!8y^P+Z16ngzmmnU;S5i*_3|T6-h5f~=h7aL)`lZrLRu$X zc_h^O>CBWbSA?W%7ua~T+qrO0;5TDt2!OkwD?!C^*{`0N$AGr0F+yCBoS&DLnXXp> zb%Dwy*8mVkbAfN4Zyu8&kK6S#nrm*lyi#JEx{5<}^8*$gtx{Q|Kq1FEk!p_P`5A!+ zwQt|A-jvF{c{9uQ3eOcY)U~P=qq6tx{TwsbL*t)7$_439UAg7iZ1>ondu}}cmc7~F z|LT;97Oy(Ii|#!6vEk^++OJQnC)iuCg-07cS#qOo{Y{fKDVHw#vFDy!_e}My``b5e zUH5bS)4P|oImK2sE-2wD&{Pd?`u%X-o<(8l_gG5`R`Xx~x* literal 0 HcmV?d00001 diff --git a/tests/general/widgets/bg-01-missing_file.wgt b/tests/general/widgets/bg-01-missing_file.wgt new file mode 100644 index 0000000000000000000000000000000000000000..aca63a75b1e02afae1ed22964dca2ef4f33d20b3 GIT binary patch literal 583 zcmWIWW@Zs#U|`^2&~z1XoHuVziXD*W4a8gwG7On{DXA5D86~+np&^_M%zSqY133v4{v?OeDg@S8C+1i)ReG(p92`$=8q(?Hv`86hr6&d*EBOxLS` zx*+V5YXAtNxxlx7zaO(9PkZ`1%{9?VhAOOGD*}p`nWcr8^$X6rb{>7&pCteAqvyg! zUsHa6uidmpTJN4=&2iI-f{i_q3AKwgf|9^3^xyqp@@r9*K`(jkjob0gPDSWwL@nxC2UyN@1$A6wS z?fcE$)obgv+s4Y=>}uUz#OnA`ycwC~m~lmk1TbhA7=U5Ju%!{iLXIF-NCcq;4YGNd0gP;3 e6VN>5;0Bt9C8z_uS=m4~GXdcOAUzS}7zP0Og~CVx literal 0 HcmV?d00001 diff --git a/tests/general/widgets/bg-02-without_bg.wgt b/tests/general/widgets/bg-02-without_bg.wgt new file mode 100644 index 0000000000000000000000000000000000000000..ccbf1dffc0e14a53717ca413b66cc1272030eef2 GIT binary patch literal 567 zcmWIWW@Zs#U|`^2D0CHZoHuVziXD*W4a8gwG7On{DXA5D86~+np&^_M%+u}|27qvB z1vdjD%L`@(1~9Stq{hj!8y^P+Z16ngzmmnU;S5i*_3|T6-h5f~=h7aL)`lZrLRu$X zc_h^O>CBWbSA?W%7ua~T+qrO0;5TDt2!Oj_Yl4a+ zbwTM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|L(g|D0puUTL;$;`+6B8kfiNr)2BNX{B2$ryt6Cz0YC_w^)Yl`gzTh zSe3sVIrTn$dbn-UKKsvyR!(au(`}QEKK1TrTYnhaz0Rhq*X)*jpEtGA?AHCqR`(RQ zH`^c9;yG-->QPGUs|`W(F6g?S)H^06eC&3Z_Ce3c$-FQ95TnByy^?|4O4<+#JC|FVy++ZmiHXPfO1C?c?1e1AnzP@u%6u5~Y!mxx~SN{*g=_cmC~Ynpa#~R=nA&Up!yf$^G)e#V^%QJN(Oi{GRZOHDk&vE$&>+@Kp3_( zf>=o9CM%@eM9YTA#$je=WaHKVO-0VyK=ZIAm- h$c9M(^8<2T0GbEN3mE3HvVlT{1qf|`-qBzM@c@EnjXD4T literal 0 HcmV?d00001 diff --git a/tests/general/widgets/content_listener/config.xml b/tests/general/widgets/content_listener/config.xml new file mode 100644 index 0000000..40d861c --- /dev/null +++ b/tests/general/widgets/content_listener/config.xml @@ -0,0 +1,6 @@ + + + + listener02 + + diff --git a/tests/general/widgets/content_listener/hook.js b/tests/general/widgets/content_listener/hook.js new file mode 100644 index 0000000..959a8b0 --- /dev/null +++ b/tests/general/widgets/content_listener/hook.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..81c7f09 --- /dev/null +++ b/tests/general/widgets/content_listener/index.html @@ -0,0 +1,25 @@ + + + + + Custom handlers + + +

FAIL

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

FAIL

+ + + + diff --git a/tests/general/widgets/content_listener2.wgt b/tests/general/widgets/content_listener2.wgt new file mode 100644 index 0000000000000000000000000000000000000000..99b090c8a73c16648f82ee70c7e47839abfb7cc8 GIT binary patch literal 1657 zcmWIWW@h1H0D;vN6CEAmXKk8YC4wblVZ+eLtOae!@q_;%91GmH!j%YkNd0d3FBOG&NJ%P7gs!RLV9 z$$|N|6$Fmo|ErnjF>FPDRCEw>wtu(uJ|FP9Q#qG`ZhqZVPo3DD568maH(7X$} z?kDw*NeLgj9j1NIGjcNTOTR=9YhK(jEU6%*$8is?IEkySbFaO%J8 zqw97Cr^?x8I|Pad>=xf&Q4|y?aj9$FOXVe^m%NfA>TbuLQsG-uF-a@=LhPM?JDTPd z*OnD;w(1wp7j|;Lym0Z$jSEj-IR7Bp(&h6h(=Td)MO=la_xAs;)Ia&~?t#o_?)TLl z-hK>Kb-y7S{!4ep#xM2>CP~${uDqP{R(;XmUjJ@yl)yHP#NMXzS~J5MCLif9^TKze z+q)hQpPufx;2}HD|BsTW>7l@^VNxbAJ>)SlFmM9XLrH3J3E|`rbkOgx0ngs=+CF-B zk6hcNy=Ce#38u^r&w__DRF|E-rV{*!PwUA3%UgVAA8Cz|v99y4JAYE|-8}L2`L9(& zmb_Lv)yKF~N2$R_xzHdc`5YgY{kLm^%!#}U7tYaK?D4Vc73+G#`KsZ<7ybmlbelij zZpsp^=@kJ?%WDrQyuIle*n4!*#}w0$J13;(p1-tECiSI(+qR9HSp9R|PngBL@k*Cg zUViA>wOH#Z<~kcnYp(K4IU~7HJ?zeT`Ec2zZ@!=9UjB{c$~(i7nxI`z+3i9kE7Xg^ zB6oXln%;^Y}JXaAFkd%G%?I%SFwiX#A&8&uXBHExEIdQkyAeS`;uUPX z=vR{FrKXeRj7M*92Y53w$uZ+9C?$X%2YMZdw={xS@M4n{Qf#968e$l(au3 + + + listener04 + + diff --git a/tests/general/widgets/content_listener2/hook.js b/tests/general/widgets/content_listener2/hook.js new file mode 100644 index 0000000..959a8b0 --- /dev/null +++ b/tests/general/widgets/content_listener2/hook.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..81c7f09 --- /dev/null +++ b/tests/general/widgets/content_listener2/index.html @@ -0,0 +1,25 @@ + + + + + Custom handlers + + +

FAIL

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

FAIL

+ + + + diff --git a/tests/general/widgets/inst_nplug_1.wgt b/tests/general/widgets/inst_nplug_1.wgt new file mode 100644 index 0000000000000000000000000000000000000000..fc075cf088db12936ace1ebe6cb46a2539e65c80 GIT binary patch literal 1610 zcmWIWW@Zs#U|`^2INRXrXw=8nBg4qRuoZ~87-SeS^HNeP^fF3vb3#Kn8JH7a<^?1H zacKoN10%}|W(Ec@5gK^Vk6BT~W_$d{Lo01_IzJ}8d8c;k+7*|@?X!+4Z#v&Ph3U}Z zxBvF$TvwaQ@<~lHt!-gUeq8)3!zZEZ!ud}p+8nl>#Nhgb`;X_ZfQ_x2Tc&mSKA+eq z6L6Hn|A^?@vocGB6qQ2dXD@%$7n?azt@-P2&$ZhGKdB}5D7@7XaBDhwcFPmy%oB&& z4VWuxqU)TNoJ%;mujS6xgQ~YhE=h{NyWNnn`Fcjks@qkoXNz(6%@X-xZ!JIPc*3r3 zeKXbbSN^rVKmR=cMNCr%$C8p~-P`70NSnENmbhWkXZtd-sS=OZgg^ZEYNgf(?Immd zS*A#zz9>9#GtZn@3Egs0>#W;59{Wg%7aGkqw&0j-R9Je6ce2 zV*osSCp5Y`J~MP_SqBX5-#`os-{kzfw9It93TXIVc$F96_8KF6W6y2uJ7mDa_F$%6 z>(jYyU96#=?rCkiB}02db(ZFN-r?T0eEF6RMsGQt+Hd)@Z+>6$L83{e-TdlGGqvY2 z&yp>V-SaS#_S~^B>gW6?&evZ?o3ZMoE|p!evt?(x=Y}oY6t|pO+z=GBVojv$#?5y% zycSJJdOqRk<;8nm3J7@Yy14lZUw!?#-@>z|#~Hsao5fUq+x8n@>a9szoH|P8TTa^l zFVKg(AYv+eOX}@?^K-h?K|baJ`j3I3FT}+W%zzS-Kpz+6l%{9q73(J!75b0^rhmw_f+#b=6J zi!+KT97v{sO?cvy6Ci+@Ap^V_ndF#pWorp=bO3WW!*xzCf{}AnXb8|mP_n`kBAAH^*~H06CW1`^B{2-sSlK|)!w!V; MKp$QO>S16201Fh?H2?qr literal 0 HcmV?d00001 diff --git a/tests/general/widgets/inst_nplug_2.wgt b/tests/general/widgets/inst_nplug_2.wgt new file mode 100644 index 0000000000000000000000000000000000000000..95f3d692f6776747d3d926e093e65d20aee16176 GIT binary patch literal 1079 zcmWIWW@Zs#U|`^2xZB|BcyJDC$rgm2*Kyu%6tHtO*kpH7jHS@JE&blcKrfln{2vfa@x$GL`wi;?TK z&A)vXdAAfAC1#|iwHIC9v-eu^iN$x;%nv{Ojp@4wlS!b)huy~QUAlXfOF~SZH}E`Z z&~mF#T9=vsTw!Ym=gMC>ab50ZpT#6MMbzI|XR7BoPi2j0${yxJE(Sa2PpeVjjr)<1 z#?bx!ssKoe=d9LE0sxY-hD)OH_zpyVhI{rtqHOFg<#cS1y9WSHZ z>zaGGWf`CTD3X_*SkAL2I!d`*)LLr!pF*{@{uVRONy@amH7cw%Vo_o_w*KOm!Yhwu zEN{gDW4uagb-HG0b?5t_k6&8Y3=>W^FFpS+*ZB8Lk#DLVMHQiU ztCEY(<<{k1w~+Q+HmODQ>#2B^`Y$v7onF`&6n3n&t$4?I9Zs*;5{Fjo;nGlTJvYnQ z#J?=c)l(#Bj?AWtTeny1F*c?|*`9v$;qj+`f7+h8%g_9~Be!vRRsUY+n^}{}I40(m z_dT(f7YSzM^MA|jbaUH&f4;NkATM(PJ;=bIknG|JWvwW)K-&`xPa{lGL^Fj0$rP{&|9~d6Vl#n}Nsbv;5|;qG37Fa$wlsp6$O)bmlHk#z zA;2499%f`Bo0kSO7CCBx=3$9ehE`*qf8EVKT g&POsaGz4fGC=4-7V`T${3=0rC0DbfjsE2_80M~e2y8r+H literal 0 HcmV?d00001 diff --git a/tests/general/widgets/inst_nplug_3.wgt b/tests/general/widgets/inst_nplug_3.wgt new file mode 100644 index 0000000000000000000000000000000000000000..5d98267da5e6a7b432f502dbb1942157c523ae95 GIT binary patch literal 1425 zcmWIWW@Zs#U|`^2c-i3U$epaHD9y;guoZ~87-SeS^HNeP^fF3vb3#Kn8JMTO%nJbF z(h6<{MwS=M3=Ci*H1J>^lcI>t>+n4Vmkysg=p9^co_Y0{TJEi8-^t0IPP-njKs+rS0l^($*b6F307|itdwwutVQ^R50 zaD4k!ahF#-VQ->O#7f6(@>QH$_;4R@hgo&6+tOLr=kLm#_+W)+<4u{2%{n{xzOc?dWjuO5d09n=^NsKlQ#kIANA+R-ujWz#{&8B;o6PgWDSXIz)LIDdiM^RRRKzp@9w zgSWWR)lt9aoAo+iVE+bUQ1B+_=cQ$)>s3I5ch;-C01!qC-q>>+`wkiKusxV**ZOpB zTd;VDs_ab3cWEJ}VH>CHQZ3Z)SiXEq2cx%~PVKk+**Cv0DUfecX%D};(oF4n%(GQ8 z$@wZXdsXfPto@_#^FrybX}*l!k(umS=MvvV3hAuPt}Y&U3TDZS^r+=ncGy>3Mk!8>wBXAU*s~A z%)cq@EvdKn&Clsl2llNpN z(^rpIZh!!0`a&4_2AD>Xjg&w$vN%6CH7zqIRj;I?1Z?6QplM6+naBu?7Gx87&`boI zatLU`VSJ{zwK$`g!hvK8*n}rOIoN&1$Rx*%EB{G=9mWVGw={y7$hnafk{i*IN`N=Q zJj?`#Y+gLjSmfjfG!IMCgP4aaIw9tPT(+e#kck0bvML6MHfM9e5hHqi!HHp0?6*fdZAz%Y%K4HS56 OK=>CJ9d$rG3=9BbO|Sa^ literal 0 HcmV?d00001 diff --git a/tests/general/widgets/inst_nplug_4.wgt b/tests/general/widgets/inst_nplug_4.wgt new file mode 100644 index 0000000000000000000000000000000000000000..9275ccace14670cb80b1541b5f03647032e2b23f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_=2k4P*?>j&2>OQpyi?6@*C0|*SdZElI{o|4L_he>GtsmUY;6z z_1vqna~>Ssc+;6Z-ud4Dt?zs|T0cBl`GV0z$@G5lk&sWZ9tPcgvy;|E+|x_l7ALy- zF)-CIGRZOHDnBKlC8+?zUq=uVR+_RxN>jAN12GF%Sqd|YfniId1Kcc>l9jNrn575A zSYS#A8oLxoA(tgU^RT3GWM_iRL(MA4=5YWs55hcP#vyDVX6zyxxQqoDhDdP@G!GQl W7~#mu2J{aDD-ccrddZFz!~+0J9e%I? literal 0 HcmV?d00001 diff --git a/tests/general/widgets/nonroot.wgt b/tests/general/widgets/nonroot.wgt new file mode 100644 index 0000000000000000000000000000000000000000..641283f9f32d91acd9dc638f65abbd876ce82700 GIT binary patch literal 5563 zcmZ`-2Q*yW+CDQzCnOvh#HKj zL6jIZ61}^}{r+Sa_wzpQKJR*v8bmNU0077UrU#ehOszMgj=-mQ z2mnw3tbqL!Ya7p-kKCOc(R$NPIsMsT57I*L_-FN)`CgxKevnVMHONfy0-yWwC^acFWQX1JzaoWf^=8J1es z|BjcAb$_xc0KN33bYDtc_PvAdX3NaSDJQn;kehQy*A=4^41K zLDJ3?a=#A2+b56_Q}!WGC^tFm`IU({rG|Q>M|%k)r^%tz(wo3Cam`Q@*>&=M={sAQ z(84TNgnN3DJ^m8^(F-Wyx~Kj1=9S~^_qB%F69cY(5F|(+1xOeGkOY;;+UtLMeoPAh z=acN5J}c)ZH(j3C{gXVZgHEl3zmpe%)K;OUU_J+-R#R0%fme<5Nk#&mCAGa*zzf6; zrJ@K_^s_F559BVYMs5H=dHH-ofV2!o0HDoPQ&Q0LoLJ9z;X?Ne1i({eSD zlowZ$m8X=4#fAe-O`#CYR(?%e??SsnuiaRwDR)(2kzghEwUU+Yl5O|wUpi;g1b3pd znNa6>$(V=5)q-DI5>ad|;YS#XJ1~mg-tfp*DpfCp<`wb9vn`+zGcw)wLs2vASHY2v*%TylTr0t|XY z6aWyL<5>FMGv)D2%({4X?u?o=+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p61}OMoKd4%!Fy_suqNrUcePN3l+2ObZ6NeYy8aVuN@ZNn z!J?QrU%32Fq53Os4qpIvGDw%CYd_6JP8E+aLmg(C9=YZndP*F1W=SeOtduH)Y|-eu8zoLvKv7k3ml*T08GI7-G7>o z#DAHO|Ic{*3-5pVZ-3#PBdrI>fw2E}<3O}?H}1cp{VzTKXLP=o0N_8>3F4ir^S|Q# q72V(2`d4(cz`BAU_|d<(1Ch?T`x_GRxf=+;z(W#TiPL$Iz&`-6pcT*n literal 0 HcmV?d00001 diff --git a/tests/general/widgets/protocol_listener.wgt b/tests/general/widgets/protocol_listener.wgt new file mode 100644 index 0000000000000000000000000000000000000000..23d7a21ad0eec5478102ae1750864f4cbbc3a51d GIT binary patch literal 1652 zcmWIWW@Zs#U|`^2m>44BV!e!#+?>!5P6lSd59b0z zfVi}Rn}Lz#1v3K!nCJ~U?RVHfV9#@HvG_|}W(&hTl%@u;2yv)XJ$!M?`;pM?iF-9& zI_lN^Rz!7j?|XCDdhy(in>Wv1e)ZYcN?y^IyE-;GJLq+DC|vfC;kiCz^WH=K$E=bR z)+m}xF-{fHj61*gf$6jECrNCx>b35^x_qsDQpi)G?_LjTG$fWVTWhY`7_oKUnzkE^W)J2z}CozC}Elsm^Zek+4&vD=GI(e0;y zx6e!ZSpB>;n3u7Xx2@CPtGwp?aXseuF6Xqe?@yka?mDgS?|+Bml0~vLypa}{y28Hm zsj6Pub!FLwI)b{=A=G!&dvAk%?UanQl>qK9nvUg8kQb?>g`7r)3LjXLsB!RINdDcX8B{1$7ficDf zjIHGSytK@8y$Wb_8NELj0K#a|m3rQh>yUu}>xEiB!A;vYb||Q3md|szu4>{e?Xld@ zv$vw^c8Fl1<>B9lQWbZ>4%u<*p5cZ!!-lPBbK zTnwGFd`ee|hT8pNo*L!G+!bBVI6YMVKCt;8x%hf^9_wA1M<&~vopPt!xrYgRx%P#g zvdp#;oj%Dj$+x57!FScga(SCSF1S5kzrt^^)WUyB2R}D;lsC?rAP({@7tnhQ3>iSr z8edu1VGCq~Fgwt*8Tt9ydRfKbgn0z$OAto$X<1^CLS~ABt%6ccW^qYsUTTqnp^`Nh zS6XRaa!F=>o&v}Wjm#7sg`(8r(wq_7e+&FWffL{Jw4ZO?N%FzqNXm?r=e zJt(L%^HNeP5IN%((DJvK4(Od6m_OS<;Q0NYBIe%0ozo6{+Qkq&JuPdgU-z|rZ!T_J z|3EA!Mc(tmmG^c$nVp-q&5A!~_pWZv`+7gSn13;M|K3}(aKWlGO;2trOpj!k5aJ$v+?u40}Ah6 zE?IFT=cnGViB9}~BFYG(gc6sulzmwcdLe=x9D6jSYay$R+);TTv z);=@|idwvP*Y84R+4SPV>fQTzrmq*?QxK>hWAbX-r%gZa+);Y9IYj@U%Sp)=({jBp z-zrW%|JiW)((xzi2QEFl8R~Y+HvH*oliU}&Nd^V1>VXGX{C|JZ-!c33y7&kE8j0Oa z=CPKFHB3EPC4J8;QtVkDSEz2x543;v_waA-0B=SnIc8jCqy#8^G5}Ks!9$D6xWg07g}b>;M1& literal 0 HcmV?d00001 diff --git a/tests/general/widgets/protocol_listener/config.xml b/tests/general/widgets/protocol_listener/config.xml new file mode 100644 index 0000000..0956e53 --- /dev/null +++ b/tests/general/widgets/protocol_listener/config.xml @@ -0,0 +1,6 @@ + + + + listener01 + + diff --git a/tests/general/widgets/protocol_listener/hook.js b/tests/general/widgets/protocol_listener/hook.js new file mode 100644 index 0000000..1300cac --- /dev/null +++ b/tests/general/widgets/protocol_listener/hook.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..f3687d9 --- /dev/null +++ b/tests/general/widgets/protocol_listener/index.html @@ -0,0 +1,25 @@ + + + + + Custom handlers + + +

FAIL

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

FAIL

+ + + + diff --git a/tests/general/widgets/protocol_listener2.wgt b/tests/general/widgets/protocol_listener2.wgt new file mode 100644 index 0000000000000000000000000000000000000000..b828faf02d2c3b3b4e0280636244f4df769ba10e GIT binary patch literal 1652 zcmWIWW@Zs#U|`^2SY0vEQGeS9!E8nbhI}Rl22KVUhP>4BV!e!#+?>!5P6pV7MtI=T0~Ic&Xn?#9iVXD`3{>}w^j=*wLlo17i=x;Ydsd&uxypRsxGq5fl5 zNeXKeO{N&9ifG22-}}JyS@)A9wpsOBcVAt;);=lZsnBF-rubN;v<^Lv+bTG{s}&rNro*7x_n!*R(X*&5zRi%VT$ z-}zKkFYP)uA+G#;kx={DN12Oy9Lu*?)-=dGdj9nE>0fI5es%Nhn(SC!G-WT>D&}=1 z9nVECARY14oo`=jI9a4nBW4& zR%TvGY6aownjDxv+d$y>{huP{-ol;J4t(0h5Ij9CYpGxNwS8|cZe0IBEGI?Y^TL() zc08G#o3_o0KWF!@ZqEC9Kf9QJF?avoTeEP%sxwVbZYoTVWS9`*A!D-MAl16{_pOK| zg&wslQ;e31YQ~+L`#^PB_lwUwT6F=T!E<+g^9q{ibw{)D^S=WM?_MrhaU|!eg^{R8 z%xR&u-j5E-s(cJ^+hn?l)jgLzC0b9eI9p2h`JpMt>NaXjKXchCZX<(gu-l7{)cgAD z@~w_M`f-+Xbrw@r_7_3+F8LpQ{BdmOx~7O8vvK3^OZBw*@n5~PL-F>Z`E}2yKeL`% zY-F}+hPHc#`Lzizx%NrvStd$-?>oC-`^5LZt{+?VCHZ}{d`0MVj@mONKbu0o8%SO} zHP^9T_J8Xq**_weOj1vbQ7rIFX1+40U2Uz@nf6?DD`}Ml`2mKm}-A(4PmWnk@Jz6Dw z&nr^wSsz!ZZp;s~fA#n9Z*EXR-~wh_25`1DzOt~x7RUx+c3?ut$j{H#%PNLvTD_MT znYJvkNFg&t!B#;jC$qRDH7~Wuz);DWiz}@(FS#T$KTiQUl@L zLka?{7i^a+ywRPdXTp17uKI=2%TqkPo!YrVdX{frDwP~_?#bVi@`3hl-tQkY7i!#G zc*B_MhGp)C>2Inm-}|izb5U7b-BEH-LPa`hj@G$gFIO$@=hc0U`6?TDLoeDeu3REN z=ed3Mm#W+-NAva<$I>zaZ!bMRQPXMViH)n~s%7so(^D-zGE0E*;CpX3+dFBG9nJ0I zKg>B+#`5)O({onA_e@ + + + listener03 + + diff --git a/tests/general/widgets/protocol_listener2/hook.js b/tests/general/widgets/protocol_listener2/hook.js new file mode 100644 index 0000000..1300cac --- /dev/null +++ b/tests/general/widgets/protocol_listener2/hook.js @@ -0,0 +1,3 @@ +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 new file mode 100644 index 0000000..f3687d9 --- /dev/null +++ b/tests/general/widgets/protocol_listener2/index.html @@ -0,0 +1,25 @@ + + + + + Custom handlers + + +

FAIL

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

FAIL

+ + + + diff --git a/tests/general/widgets/register_content.wgt b/tests/general/widgets/register_content.wgt new file mode 100644 index 0000000000000000000000000000000000000000..79cb1733c6fe4768651379c1ae423628a0ae8d88 GIT binary patch literal 1184 zcmWIWW@Zs#U|`^2nAFS*zt$AjG>h@v zcyz+@6m<=ovraad#Xrwwc5E{{x%|(BlXj1iX4l3tpVLaw>UsO|<=5OWll_~MHocat zc$Il`$3~0Sf%zf}Qx+5h7BV$ zY?AZy(lXQaDxhK01PqrJ%&14s*`7w!-6E6 zy}DN=9v7*-_y4!youU5^K1Hc?OUp3Rg9+@*d#=uj(SLrpvxI45&Xl&6@Em3JWUqZo zO`gX*T~_26EdA0?>1N>UGr~I0el(x{liqu4-A`T~Z=bw(?wMD&e9P=`kk~Agz4ZHJ z$&@JXX&wx@NlgLfEbKdU)f!&a?^~dn`;_NVx1=ujk$bExPWlMHdI0?zUY7ef1nAFH zU=*_h(?Ldlezsm#F*p%i2YM1qB3L{5zSm&`kz?qDECJUO2xSz8`_J<|F(i=nxv!t?L7>hYTvvaz%?B{eVIz<2hm?;Q7whqRxygl)J| zHI>7Tsrj0>d6Q|Bx3^EZuf;PT-rXFB0!oyfc|>WhvtO`50sX2P#qnTq!3{TFI*DLi{^;c0!} z`F-5qqqXT@@4wZ$!&kGdIs4i5#u-yzs0rPETKo5e@FgRUS)5BR_}rg2-)Y&Cr+H?x zZ6^FNNnBSsH!|G&%(E$Ly%z6%l&rfoGuyj)MW5GxIp&oswyKoa27}j`g_= zOOG!0tGdy|RVl~TX{_Yq=PVy+HKD_g>#yFTE!GcrbxLtO+@Pvb(eXe%Tf3rz@m8*Z zxw~6!fO-Mv4B3C4a;EYD-i%Cg%($|r1TZlIlOqssX#}y5Gb<}3v!Z2GWb-hSG_rXz wKx2^;IM6&$0>@(>X0kyxkAsN;k%)kXff5mhVXSN*Z!iPlTOd6bnD!VL0Jbm1m;e9( literal 0 HcmV?d00001 diff --git a/tests/general/widgets/register_content/config.xml b/tests/general/widgets/register_content/config.xml new file mode 100644 index 0000000..a1f2727 --- /dev/null +++ b/tests/general/widgets/register_content/config.xml @@ -0,0 +1,6 @@ + + + + register03 + + diff --git a/tests/general/widgets/register_content/hook.js b/tests/general/widgets/register_content/hook.js new file mode 100644 index 0000000..4866d86 --- /dev/null +++ b/tests/general/widgets/register_content/hook.js @@ -0,0 +1,21 @@ +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 new file mode 100644 index 0000000..5f572a9 --- /dev/null +++ b/tests/general/widgets/register_content/index.html @@ -0,0 +1,11 @@ + + + + + Custom handlers + + +

FAIL

+ + + diff --git a/tests/general/widgets/register_content_fail.wgt b/tests/general/widgets/register_content_fail.wgt new file mode 100644 index 0000000000000000000000000000000000000000..165c1b2692dbfa4a708e4dc816b60ec215b56c41 GIT binary patch literal 1201 zcmWIWW@Zs#U|`^2nAF@#1rKMaik+R-uT{AF z>;2386D%U@a%}5TE5HA#`|;;jMPpxczV^>>kK5arCNxGkUuhKS>swcQswW{RrEARv z*W-S_cS*eUG~NBzmZi2hk>mfxtC8=fEWIeX>N=a_nzFJtD{XmNgB$$ZUu%kMn#Fi- zJUU@{in@l)Stpy!;-BX-JGPmfT>fXmNxMf$vuk6S&uOJ-^}PM~@@sCG$^Okrn_f#+ zyvn?}W243Ez!-f$W zHp%&UX_@JI70|HRefC@c2&08f>Ul@LLka?{7i^a+ywR1~ZNPhBuKI;i=Tj|{wlp{# zt*DA#Wq9nV&%OD765l3EeUx=FIagG);u}lz+qp(z#YKDPl&fFjIt$6pGJL*!HpTfQw7dJV)iFHu;!i4Z_lG{YbCf-TE zQ-B_gV`5-n2PTA!{QPXatYUB~cn(Yfx|pdTHRyEKVFQ6ZzqQTUl4i4QZ~1%Q(*C!I)gYt9D6f*75Z6Cl-Y( zEj-sMT&;TTZOGER?Mw!TWz=aQ9>3?WBxfqmky)|Iy;O7CWKQMWL(|F@i7s3u8LZ^| zcy|kXm51i}JBmBjFP-?LAhc@a58%qNnxu?(R~% zfBNUI=jKs*ceC%s$$x7)FDo=_dga#Y849kF*FOBU5Z~vXagy6AQaUTP)h9^+~o#AKTt}ajB5-+|1zfs%(L=y`?)VSvOx>?RQUwAyfF^(QRh3 zB5|+h6u*u=FKRsVYD~4}s?-H}fd|+uwRM}=zfX;S%Pwj8ygtC2kx7mjSALZMrcPk` z1mZ1?AQp1&WrgHkwA6`g9%dRxHctjKQN>mt* UV`T$*gBb|l0_k + + + register04 + + diff --git a/tests/general/widgets/register_content_fail/hook.js b/tests/general/widgets/register_content_fail/hook.js new file mode 100644 index 0000000..ffc4bc6 --- /dev/null +++ b/tests/general/widgets/register_content_fail/hook.js @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000..5f572a9 --- /dev/null +++ b/tests/general/widgets/register_content_fail/index.html @@ -0,0 +1,11 @@ + + + + + Custom handlers + + +

FAIL

+ + + diff --git a/tests/general/widgets/register_protocol.wgt b/tests/general/widgets/register_protocol.wgt new file mode 100644 index 0000000000000000000000000000000000000000..36681e102dc3060fa3b337c12a6f7332ee75e76c GIT binary patch literal 1179 zcmWIWW@Zs#U|`^2nAFsQn%HFKB-2_T$U1xnU;zHz#d+Em`p@ z^X86?7Ow;IMHZ$k-r)UmleKux(i=Y}C0g!Fi?sjD8~_g+_m)0K`$^&VRsh3>5gInh z`FUxX>3S8=u=(b8I^YKoqlHcCc}KoO3IePbY?mv%(apUxgYCsR;TO9UQ=L4c92O+m z?A5(0@wiCsz5l-r?+pEa@F_~ATV}4Bm9U{X_*jz+vn0YxL(%v?4vZ3nz zpjpN1K5Z;=43>WBr*t!L_8DQFXFr-x|4Hw?weBY`kGD_WJNL}1TfSv>I7n<3%3k_? zvSdn>_cRZN+@z)ea~Ad;x@rxt>h~>B&3(%As9RE(`^Y_37AJj#UoG1E95-xbuk;7{ z(;67X?7(!8k)NNfmsJc-1T{XV13G{h&7*54#bzHe5NUh=Tbr+S;xx~j>%1j@3&`Xs z6xS=59hdSE_Vg=t{dIr(uB>#?XGe=B^B2wgZd&&R^GJWLIe!ja zI^D8Uu=LT2uo-76_i3$JxuwGF)QxT1Hgr@4RGpc=c4zULxx1Go{Jbpsr|!(Y9gHD- z>}$VlVV(YpU&HHH8^6oW@1Y<&WIk`&jda#>Q>V)M}?~V@>4q4`CxB4^PT3c>@ zd`@`Wyo0(4ML+&#UZ?@4Jw_%uW?VT_0+ + + + register01 + + diff --git a/tests/general/widgets/register_protocol/hook.js b/tests/general/widgets/register_protocol/hook.js new file mode 100644 index 0000000..05fbb46 --- /dev/null +++ b/tests/general/widgets/register_protocol/hook.js @@ -0,0 +1,21 @@ +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 new file mode 100644 index 0000000..5f572a9 --- /dev/null +++ b/tests/general/widgets/register_protocol/index.html @@ -0,0 +1,11 @@ + + + + + Custom handlers + + +

FAIL

+ + + diff --git a/tests/general/widgets/register_protocol_fail.wgt b/tests/general/widgets/register_protocol_fail.wgt new file mode 100644 index 0000000000000000000000000000000000000000..81f651befe8d69c45c7236e727cc6156b91b6f19 GIT binary patch literal 1194 zcmWIWW@Zs#U|`^2nAF@#1rKMaik+R-uT{AF z>;2386D%U@a%}5TE5HA#`|;;jMPpxczV^>>kK5arCNxGkUuhKS>swcQswW{RrEARv z*W-S_cS*eUG~NBzmZi2hk>mfxtC8=fEWIeX>N=a_nzFJtD{XmNgB$$ZUu%kMn#Fi- zJUU@{in@l)Stpy!;-BX-JGPmfT>fXmNxMf$vuk6S&uOJ-^}PM~@@sCG$^Okrn_f#+ zyvn?}W243Ez%x-T4uUl1vG3<0mJ3=$#dvolX~8f?~sB3>jm583U73y%$G6l`pmK`&tqo5Br$;% z68`z#rpI>7Ir)3C{hC@I<$cZ_$0GgsuFgx?us8TvmfyPRpWnGeHAa|uIUnNQHgU3| z>ivLO#p^z8EOHE%e(9!kGhp%=VV!3`nos{p?~PjjQ}j!*Pu?rG%&R-Ttn74<*esO2 zPC6hp z4(QKlCI$v}U^>Xi&(GG&Dh4Nl_vg+9d;ns!M35Tfn|;VZVDIzrp2kTnUK!O|EShWC zM6^V=w$D4Y%UZ3w(7jB(Zo$9rYPVKAi2265`TfUlXVA zApOho^Qrvi|6x&gD+^40wkPe>67XBBv2#UXUM4e}`GhEMQS-ZAF>~KYKKguPi_|f} zB?&W~J1+Jr+qQ2IRmylAA<=2le((ARC6R*<86>=eIM(vn?4MVyJZ<^C`AhD;|CsRW z^X$Ik|JJ^{Dj&xyukSHYXL^Rkxe1qBIB~rj4ij`>d%@mfu4KnledVg ze19XkGWJbHc!G^^(Zoot-d916+n%M0UA%Ka&zd{z(9Q*R|1Y=yk@>H=JW1Xt9NC9%kZ3Hctjeic+A60K*;8C0Fx9vIROm=B_|BSSlK|{ QU + + + register02 + + diff --git a/tests/general/widgets/register_protocol_fail/hook.js b/tests/general/widgets/register_protocol_fail/hook.js new file mode 100644 index 0000000..bc41257 --- /dev/null +++ b/tests/general/widgets/register_protocol_fail/hook.js @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000..5f572a9 --- /dev/null +++ b/tests/general/widgets/register_protocol_fail/index.html @@ -0,0 +1,11 @@ + + + + + Custom handlers + + +

FAIL

+ + + -- 2.7.4