${CMAKE_CURRENT_SOURCE_DIR}/BackgroundPageTests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/NonRootUserTests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/NPluginsInstallTests.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/ParsingTizenAppserviceTests.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/ParsingTizenAppcontrolTests.cpp
)
SET(INSTALLER_TESTS_TARGET "wrt-installer-tests-general")
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/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/widgets/app-control.wgt DESTINATION /opt/share/widget/tests/installer/widgets/)
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 installCmd = params + "wrt-installer -i ";
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_MESSAGE_ID_LINE_FAIL =
+ "## wrt-installer : %s installation has failed - package already installed";
const std::string INSTALLER_MESSSGE_START = "## wrt-installer : ";
std::string getAndCutInstallerLogLine(std::string &src)
if (!WIFEXITED(err)) {
return OtherError;
}
+
+ char* id = NULL;
+ std::string line;
+
if (0 != WEXITSTATUS(err)) {
+ while ((line = getAndCutInstallerLogLine(msg)) != "")
+ {
+ if(line.find("failed") != std::string::npos)
+ {
+ id = new char[line.length()];
+ int nr = sscanf(line.c_str(), INSTALLER_MESSAGE_ID_LINE_FAIL.c_str(), id);
+ if (1 != nr)
+ {
+ LogWarning("Can not read widget ID from message: " << line);
+ delete[] id;
+ return OtherError;
+ }
+ tizenId = id;
+ delete[] id;
+ }
+ }
+
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)
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);
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
#include <dpl/test/test_runner.h>
#include <InstallerWrapper.h>
#include <ManifestFile.h>
+#include <dpl/log/log.h>
using namespace InstallerWrapper;
*/
RUNNER_TEST(creatingManifestFile)
{
- const char * manifestPath = "/opt/share/packages/manifest01.xml";
+ std::string manifestPath = "/opt/share/packages/";
/* 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));
+
+ if(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId)
+ != InstallerWrapper::Success)
+ {
+ uninstall(tizenId);
+ RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/manifest.wgt", tizenId)
+ == InstallerWrapper::Success);
+ }
+
+ RUNNER_ASSERT(WrtUtilFileExists(manifestPath.append(tizenId.substr(0,10)).append(".xml")));
ManifestFile mf(manifestPath);
Try
{
+ LogDebug("Package " << mf.getValueByXpath("/p:manifest/@package"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@package")
- == "manifest01");
+ == tizenId.substr(0,10));
+ LogDebug("type " << mf.getValueByXpath("/p:manifest/@type"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@type")
== "wgt");
+ LogDebug("version " << mf.getValueByXpath("/p:manifest/@version"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/@version")
== "1.0");
+ LogDebug("label " << mf.getValueByXpath("/p:manifest/p:label"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:label")
== "Manifest Example");
+ LogDebug("email " << mf.getValueByXpath("/p:manifest/p:author/@email"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@email")
== "manifest@misc.test.create.desktop.com");
+ LogDebug("href " << mf.getValueByXpath("/p:manifest/p:author/@href"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author/@href")
== "http://misc.test.create.desktop.com");
+ LogDebug("author " << mf.getValueByXpath("/p:manifest/p:author"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:author")
== "Manifest");
+ LogDebug("appid " << mf.getValueByXpath("/p:manifest/p:ui-application/@appid"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@appid")
- == "manifest01");
+ == tizenId);
+ LogDebug("nodisplay " << mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@nodisplay")
== "false");
+ LogDebug("type " << mf.getValueByXpath("/p:manifest/p:ui-application/@type"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@type")
== "webapp");
+ LogDebug("extraid " << mf.getValueByXpath("/p:manifest/p:ui-application/@extraid"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@extraid")
== "http://test.samsung.com/widget/manifestTest");
+ LogDebug("taskmanage " << mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/@taskmanage")
== "true");
+ LogDebug("icon " << mf.getValueByXpath("/p:manifest/p:ui-application/p:icon"));
RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:icon")
- == "manifest01.png");
+ == (tizenId + ".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']")
+ 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']")
+ 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']")
+ RUNNER_ASSERT(mf.getValueByXpath("/p:manifest/p:ui-application/p:label[@xml:lang='pt-pt']")
== "Exemplo manifesto");
}
Catch(ManifestFile::ManifestParseError)
}
/*
-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
+ "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");
- }
-}
* @author Karol Pawlowski (k.pawlowski@samsung.com)
* @author Andrzej Surdej (a.surdej@samsung.com)
* @version 1.0
- * @brief Parsing Tizen Appservice test's bodies
+ * @brief Parsing Tizen app-control test's bodies
*/
#include <string>
////////////////////////////////////////////////////////////////////////////////
-RUNNER_TEST_GROUP_INIT(ParsingTizenAppservice)
+RUNNER_TEST_GROUP_INIT(ParsingTizenAppcontrol)
/*
-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
+Name: tizen_app-contro
+Description: Tests if widget app-control tag is correctly parsed
+Expected: widget should be installed
*/
-RUNNER_TEST(tizen_appservice_disposition)
+RUNNER_TEST(tizen_app_control)
{
std::string tizenId;
- RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/appservice_dispos.wgt",
+ RUNNER_ASSERT(install(miscWidgetsStuff + "widgets/app-control.wgt",
tizenId) == InstallerWrapper::Success);
WrtDB::WidgetDAOReadOnly dao(DPL::FromASCIIString(tizenId));
- WrtDB::WidgetAppControlList appsvcList;
- dao.getAppControlList(appsvcList);
+ WrtDB::WidgetAppControlList appcontrolList;
+ dao.getAppControlList(appcontrolList);
uninstall(tizenId);
- LogDebug("Actual size" << appsvcList.size());
- RUNNER_ASSERT_MSG(appsvcList.size() == 4, "Incorrect list size");
+ LogDebug("Actual size" << appcontrolList.size());
+ RUNNER_ASSERT_MSG(appcontrolList.size() == 4, "Incorrect list size");
WrtDB::WidgetAppControl s;
s.src = DPL::FromUTF8String("edit1.html");
- s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/edit");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appcontrol/operation/edit");
s.mime = DPL::FromUTF8String("image/jpg"); /* mime type */
s.disposition = WrtDB::WidgetAppControl::Disposition::WINDOW;
+
RUNNER_ASSERT_MSG(
- std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ std::find(appcontrolList.begin(), appcontrolList.end(), s) != appcontrolList.end(),
"Unable to find service #");
s.src = DPL::FromUTF8String("edit2.html");
- s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/view");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appcontrol/operation/view");
s.mime = DPL::FromUTF8String("audio/ogg"); /* mime type */
s.disposition = WrtDB::WidgetAppControl::Disposition::WINDOW;
+
RUNNER_ASSERT_MSG(
- std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ std::find(appcontrolList.begin(), appcontrolList.end(), s) != appcontrolList.end(),
"Unable to find service ##");
s.src = DPL::FromUTF8String("edit3.html");
- s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/call");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appcontrol/operation/call");
s.mime = DPL::FromUTF8String("image/png"); /* mime type */
- s.disposition = WrtDB::WidgetAppControl::Disposition::INLINE;
+ s.disposition = WrtDB::WidgetAppControl::Disposition::WINDOW;
+
RUNNER_ASSERT_MSG(
- std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ std::find(appcontrolList.begin(), appcontrolList.end(), s) != appcontrolList.end(),
"Unable to find service ###");
s.src = DPL::FromUTF8String("edit4.html");
- s.operation = DPL::FromUTF8String("http://tizen.org/appsvc/operation/send");
+ s.operation = DPL::FromUTF8String("http://tizen.org/appcontrol/operation/send");
s.mime = DPL::FromUTF8String("text/css"); /* mime type */
s.disposition = WrtDB::WidgetAppControl::Disposition::WINDOW;
+
RUNNER_ASSERT_MSG(
- std::find(appsvcList.begin(), appsvcList.end(), s) != appsvcList.end(),
+ std::find(appcontrolList.begin(), appcontrolList.end(), s) != appcontrolList.end(),
"Unable to find service ####");
}
--- /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_appcontrol"
+ version="1.0.0"
+ min-version="1.0">
+ <name short="AppControl">app-control</name>
+ <icon src="icon.png" height="75" width="75"/>
+ <tizen:app-control>
+ <tizen:src name="edit1.html"/>
+ <tizen:operation name="http://tizen.org/appcontrol/operation/edit"/>
+ <tizen:mime name="image/jpg" />
+ </tizen:app-control>
+ <tizen:app-control>
+ <tizen:src name="edit2.html"/>
+ <tizen:operation name="http://tizen.org/appcontrol/operation/view"/>
+ <tizen:mime name="audio/ogg" />
+ </tizen:app-control>
+ <tizen:app-control>
+ <tizen:src name="edit3.html"/>
+ <tizen:operation name="http://tizen.org/appcontrol/operation/call"/>
+ <tizen:mime name="image/png" />
+ </tizen:app-control>
+ <tizen:app-control>
+ <tizen:src name="edit4.html"/>
+ <tizen:operation name="http://tizen.org/appcontrol/operation/send"/>
+ <tizen:mime name="text/css" />
+ </tizen:app-control>
+ <content src="index.html" />
+</widget>
+++ /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>