%{_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
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;
}
}
m_src.IsNull() ? nullString : *m_src,
m_operation.IsNull() ? nullString : *m_operation,
m_scheme.IsNull() ? nullString : *m_scheme,
- m_mime.IsNull() ? nullString : *m_mime);
+ m_mime.IsNull() ? nullString : *m_mime,
+ m_disposition);
FOREACH(iterator, m_data.appServiceList) {
if (iterator->m_operation == serviceInfo.m_operation &&
m_operation(DPL::OptionalString::Null),
m_scheme(DPL::OptionalString::Null),
m_mime(DPL::OptionalString::Null),
+ m_disposition(ConfigParserData::ServiceInfo::Disposition::WINDOW),
m_data(data)
{}
DPL::OptionalString m_operation;
DPL::OptionalString m_scheme;
DPL::OptionalString m_mime;
+ ConfigParserData::ServiceInfo::Disposition m_disposition;
ConfigParserData& m_data;
};
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
${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/)
\ No newline at end of file
*/
#include <string>
+#include <algorithm>
#include <dpl/utils/wrt_utility.h>
#include <dpl/test/test_runner.h>
+#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
#include <dpl/log/log.h>
#include <InstallerWrapper.h>
#include <ManifestFile.h>
namespace {
-const std::string miscWidgetsStuff = "/opt/share/widget/tests/misc/";
+const std::string miscWidgetsStuff = "/opt/share/widget/tests/installer/";
struct Result {
bool m_exc;
RUNNER_ASSERT_MSG(false, "Invalid widget package installed");
}
}
+
+RUNNER_TEST_GROUP_INIT(ParsingTizenAppservice)
+namespace {
+
+}
+
+/*
+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 ####");
+}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers6">
- <tizen:application id="listener02" required_version="1.0"/>
- <name>listener02</name>
-</widget>
-
+++ /dev/null
-var id = "listener02";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerContentHandler("application/test", "test.html?uri=%s", "Example content");
- if (navigator.isContentHandlerRegistered("application/test", "test.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } else {
- hook(id, 'fail', 'content handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers8">
- <tizen:application id="listener04" required_version="1.0"/>
- <name>listener04</name>
-</widget>
-
+++ /dev/null
-var id = "listener02";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerContentHandler("application/test", "test.html?uri=%s", "Example content");
- if (navigator.isContentHandlerRegistered("application/test", "test.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } else {
- hook(id, 'fail', 'content handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers5">
- <tizen:application id="listener01" required_version="1.0"/>
- <name>listener01</name>
-</widget>
-
+++ /dev/null
-var id = "listener01";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerProtocolHandler("news", "news.html?uri=%s", "Example news");
- if (navigator.isProtocolHandlerRegistered("news", "news.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } else {
- hook(id, 'fail', 'protocol handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers7">
- <tizen:application id="listener03" required_version="1.0"/>
- <name>listener03</name>
-</widget>
-
+++ /dev/null
-var id = "listener01";
-
-function hook(id, result, message){};
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- navigator.registerProtocolHandler("news", "news.html?uri=%s", "Example news");
- if (navigator.isProtocolHandlerRegistered("news", "news.html?uri=%s") === 'registered') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } else {
- hook(id, 'fail', 'protocol handler not registered');
- }
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
- <script type="text/javascript">
- try {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
- }
-</script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers3">
- <tizen:application id="register03" required_version="1.0"/>
- <name>register03</name>
-</widget>
-
+++ /dev/null
-var id = "register03";
-
-function hook(id, result, message){};
-
-try {
- navigator.registerContentHandler("application/test", "?uri=%s", "Example content");
- if (navigator.isContentHandlerRegistered("application/test", "?uri=%s") === 'registered') {
- navigator.unregisterContentHandler("application/test", "?uri=%s");
- if (navigator.isContentHandlerRegistered("application/test", "?uri=%s") === 'new') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler registered');
- } else {
- hook(id, 'fail', 'content handler registered (tried to unregister)');
- }
- } else {
- hook(id, 'fail', 'content handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers4">
- <tizen:application id="register04" required_version="1.0"/>
- <name>register04</name>
-</widget>
-
+++ /dev/null
-var id = "register04";
-
-function hook(id, result, message){};
-
-try {
- try {
- navigator.registerContentHandler("text/html", "?uri=%s", "Example http");
- throw new Error("Exception not thrown!");
- } catch (e) {
- if (!(e instanceof DOMException) || e.code != 18 || e.name != "SECURITY_ERR") {
- throw e;
- }
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'content handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers1">
- <tizen:application id="register01" required_version="1.0"/>
- <name>register01</name>
-</widget>
-
+++ /dev/null
-var id = "register01";
-
-function hook(id, result, message){};
-
-try {
- navigator.registerProtocolHandler("news", "?uri=%s", "Example magnet");
- if (navigator.isProtocolHandlerRegistered("news", "?uri=%s") === 'registered') {
- navigator.unregisterProtocolHandler("news", "?uri=%s");
- if (navigator.isProtocolHandlerRegistered("news", "?uri=%s") === 'new') {
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler registered');
- } else {
- hook(id, 'fail', 'protocol handler registered (tried to unregister)');
- }
- } else {
- hook(id, 'fail', 'protocol handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen = "http://tizen.org/ns/widgets" id="htpp://custom_handlers2">
- <tizen:application id="register02" required_version="1.0"/>
- <name>register02</name>
-</widget>
-
+++ /dev/null
-var id = "register02";
-
-function hook(id, result, message){};
-
-try {
- try {
- navigator.registerProtocolHandler("http", "?uri=%s", "Example http");
- throw new Error("Exception not thrown!");
- } catch (e) {
- if (!(e instanceof DOMException) || e.code != 18 || e.name != "SECURITY_ERR") {
- throw e;
- }
- document.getElementById('test').innerHTML = 'PASSED';
- document.body.style.backgroundColor = 'green';
- hook(id, 'pass', 'protocol handler not registered');
- }
-} catch (e) {
- hook(id, 'fail', 'widget failed because ' + e.message);
-}
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, width=device-width" />
- <title>Custom handlers</title>
-</head>
-<body style="background-color:red;">
- <h1 id="test">FAIL</h1>
- <script type="text/javascript" src="hook.js"></script>
-</body>
-</html>
--- /dev/null
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets"
+ id="http://test.samsung.com/widget/wac/tizen_appservice"
+ version="1.0.0"
+ min-version="1.0">
+ <name short="Disposition">Disposition_attribute</name>
+ <icon src="icon.png" height="75" width="75"/>
+ <tizen:appservice src="edit1.html" operation="http://tizen.org/appsvc/operation/edit" mime="image/jpg" />
+ <tizen:appservice src="edit2.html" operation="http://tizen.org/appsvc/operation/view" mime="audio/ogg" disposition="window"/>
+ <tizen:appservice src="edit3.html" operation="http://tizen.org/appsvc/operation/call" mime="image/png" disposition="inline"/>
+ <tizen:appservice src="edit4.html" operation="http://tizen.org/appsvc/operation/send" mime="text/css" disposition="wrongone"/>
+ <content src="index.html" />
+</widget>
--- /dev/null
+<html>
+ <head>
+ <title>Disposition attribute</title>
+ </head>
+ <body style="background-color:gray">
+ <h1>Check database.</h1>
+ </body>
+</html>