ENDIF(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling")
OPTION(WITH_TESTS "Build tests" OFF)
+OPTION(WITH_CHILD "Build additional test subdirectory. WITH_TEST must be ON" OFF)
# Compiler flags
SET(CMAKE_C_FLAGS_PROFILING "-O2")
MESSAGE(STATUS "CMAKE_AR: " ${CMAKE_AR})
MESSAGE(STATUS "CMAKE_RANLIB: " ${CMAKE_RANLIB})
MESSAGE(STATUS "WITH_TESTS: " ${WITH_TESTS})
+MESSAGE(STATUS "WITH_CHILD: " ${WITH_CHILD})
MESSAGE(STATUS "========================================")
# Compiler flags
DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
WrtDB::WidgetDAOReadOnlyPtr dao,
const DPL::String &url);
+std::string getFilePathInWidgetPackageFromUrl(const std::string &tzAppId, const std::string &url);
DPL::Optional<DPL::String> getFilePathInWidgetPackage(
WrtDB::DbWidgetHandle widgetHandle,
}
namespace W3CFileLocalization {
+static bool isExistFileCached(const std::string& path)
+{
+ static std::map<std::string, bool> pathCache;
+
+ // is cached?
+ if (pathCache.find(path) == pathCache.end())
+ {
+ struct stat buf;
+
+ if (0 == stat(path.c_str(), &buf))
+ {
+ pathCache[path] = true;
+
+ return true;
+ }
+ else
+ {
+ pathCache[path] = false;
+
+ return false;
+ }
+ }
+
+ return pathCache[path];
+}
+
+std::string getFilePathInWidgetPackageFromUrl(const std::string &tzAppId, const std::string &url)
+{
+ const std::string SCHEME_FILE = "file://";
+ const std::string SCHEME_WIDGET = "widget://";
+ const std::string SCHEM_APP = "app://";
+ const std::string LOCALE_PATH = "locales/";
+
+ static std::string lastTzAppId;
+ static WidgetDAOReadOnlyPtr dao;
+ static std::string srcPath;
+
+ std::string workingUrl = url;
+ bool found = false;
+
+ // Dao caching
+ if (lastTzAppId != tzAppId)
+ {
+ lastTzAppId = tzAppId;
+ dao.reset(new WidgetDAOReadOnly(DPL::FromUTF8String(tzAppId)));
+ srcPath = DPL::ToUTF8String(dao->getPath());
+ }
+
+ // backup suffix string
+ std::string backupSuffix;
+ size_t pos = workingUrl.find_first_of("#?");
+
+ if (pos != std::string::npos)
+ {
+ backupSuffix = workingUrl.substr(pos);
+ workingUrl.resize(pos);
+ }
+
+ // make basis path
+ if (workingUrl.compare(0, SCHEME_WIDGET.length(), SCHEME_WIDGET) == 0)
+ {
+ // remove "widget://"
+ workingUrl.erase(0, SCHEME_WIDGET.length());
+ }
+ else if (workingUrl.compare(0, SCHEME_FILE.length(), SCHEME_FILE) == 0)
+ {
+ // remove "file://"
+ workingUrl.erase(0, SCHEME_FILE.length());
+
+ // remove src path
+ if (workingUrl.compare(0, srcPath.length(), srcPath) == 0)
+ {
+ workingUrl.erase(0, srcPath.length());
+ }
+
+ // remove locale path
+ if (workingUrl.compare(0, LOCALE_PATH.length(), LOCALE_PATH) == 0)
+ {
+ workingUrl.erase(0, LOCALE_PATH.length());
+
+ pos = workingUrl.find_first_of('/');
+
+ if (pos != std::string::npos && pos > 0)
+ {
+ workingUrl.erase(0, pos+1);
+ }
+ }
+ }
+ else if (workingUrl.compare(0, SCHEM_APP.length(), SCHEM_APP) == 0)
+ {
+ // remove "app://"
+ workingUrl.erase(0, SCHEM_APP.length());
+
+ // remove tizen app id
+ if (workingUrl.compare(0, tzAppId.length(), tzAppId) == 0)
+ {
+ workingUrl.erase(0, tzAppId.length());
+ }
+ else
+ {
+ LogError("Tizen id does not match, ignoring");
+ return "";
+ }
+ }
+
+ // remove '/' token
+ if (!workingUrl.empty() && workingUrl[0] == '/')
+ {
+ workingUrl.erase(0, 1);
+ }
+
+ if (!workingUrl.empty() && workingUrl[workingUrl.length()-1] == '/') {
+ workingUrl.erase(workingUrl.length()-1, 1);
+ }
+
+ if (workingUrl.empty())
+ {
+ LogError("URL Localization Error!");
+ return "";
+ }
+
+ const LanguageTags& ltags = LanguageTagsProviderSingleton::Instance().getLanguageTags();
+
+ FOREACH(it, ltags)
+ {
+ std::string path = srcPath;
+
+ if (!it->empty())
+ {
+ path += LOCALE_PATH;
+
+ if (isExistFileCached(path) == false)
+ {
+ continue;
+ }
+
+ path += DPL::ToUTF8String(*it) + "/";
+
+ if (isExistFileCached(path) == false)
+ {
+ continue;
+ }
+ }
+
+ path += workingUrl;
+
+ if (isExistFileCached(path) == true)
+ {
+ found = true;
+ workingUrl = path;
+ break;
+ }
+ }
+
+ // restore suffix string
+ if (!found)
+ {
+ // return empty string
+ workingUrl = "";
+ }
+ else
+ {
+ if (!backupSuffix.empty())
+ {
+ workingUrl += backupSuffix;
+ }
+ }
+
+ return workingUrl;
+}
+
DPL::Optional<DPL::String> getFilePathInWidgetPackageFromUrl(
DbWidgetHandle widgetHandle,
const DPL::String &url)
include/dpl/wrt-dao-ro/plugin_dao_read_only.h
include/dpl/wrt-dao-ro/property_dao_read_only.h
include/dpl/wrt-dao-ro/widget_config.h
- include/dpl/wrt-dao-ro/vconf_config.h
include/dpl/wrt-dao-ro/widget_dao_read_only.h
include/dpl/wrt-dao-ro/wrt_db_types.h
include/dpl/wrt-dao-ro/WrtDatabase.h
#include <dpl/wrt-dao-ro/WrtDatabase.h>
namespace WrtDB {
-void GlobalDAO::SetDeveloperMode(bool mode)
-{
- LogDebug("updating Developer mode to:" << mode);
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- GlobalProperties::Row row;
- row.Set_developer_mode(mode);
-
- WRT_DB_UPDATE(update, GlobalProperties, &WrtDatabase::interface())
- update->Values(row);
- update->Execute();
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAO::Exception::DatabaseError,
- "Failed to update Developer Mode");
- }
-}
-
void GlobalDAO::SetSecureByDefault(bool secure)
{
//If secure == true -> widget does not need to be signed
#include <dpl/wrt-dao-ro/common_dao_types.h>
namespace WrtDB {
-bool GlobalDAOReadOnly::GetDeveloperMode()
-{
- LogDebug("Getting Developer mode");
- Try {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- WRT_DB_SELECT(select, GlobalProperties, &WrtDatabase::interface())
- return select->GetSingleValue<GlobalProperties::developer_mode>();
- }
- Catch(DPL::DB::SqlConnection::Exception::Base){
- ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError,
- "Failed to get developer mode");
- }
-}
bool GlobalDAOReadOnly::GetSecureByDefault()
{
}
}
+PluginHandleList PluginDAOReadOnly::getRootPluginHandleList()
+{
+ LogDebug("Getting root plugin handle list.");
+ Try {
+ using namespace DPL::DB::ORM;
+ using namespace DPL::DB::ORM::wrt;
+
+ WRT_DB_SELECT(select, PluginProperties, &WrtDatabase::interface())
+ PluginHandleList handleList = select->GetValueList<PluginProperties::PluginPropertiesId>();
+
+ WRT_DB_SELECT(select_2nd, PluginDependencies, &WrtDatabase::interface())
+ PluginDependencies::Select::RowList dependenciesRows = select_2nd->GetRowList();
+
+ if (!dependenciesRows.empty())
+ {
+ FOREACH(it, dependenciesRows)
+ {
+ handleList.remove(it->Get_PluginPropertiesId());
+ }
+ }
+
+ return handleList;
+ }
+ Catch(DPL::DB::SqlConnection::Exception::Base) {
+ ReThrowMsg(PluginDAOReadOnly::Exception::DatabaseError,
+ "Failed in getRootPluginHandleList");
+ }
+}
+
DbPluginHandle PluginDAOReadOnly::getPluginHandle() const
{
return m_pluginHandle;
ThrowMsg(PropertyDAOReadOnly::Exception::ReadOnlyProperty,
"Property is readonly");
}
+ DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppid));
if (readonly.IsNull()) {
WidgetPreference::Row row;
+ row.Set_app_id(widgetHandle);
row.Set_tizen_appid(tzAppid);
row.Set_key_name(key);
row.Set_key_value(value);
}
}
-void RegisterProperties(TizenAppId tzAppid,
+void RegisterProperties(DbWidgetHandle widgetHandle, TizenAppId tzAppid,
const WidgetRegisterInfo ®Info)
{
LogDebug("Registering proferences for widget. appid: " << tzAppid);
{
{ // Insert into table Widget Preferences
WidgetPreference::Row row;
+ row.Set_app_id(widgetHandle);
row.Set_tizen_appid(tzAppid);
row.Set_key_name(it->name);
row.Set_key_value(it->value);
FOREACH(it, ormWidgetPrefRow) {
WidgetPreferenceRow row;
+ row.appId = it->Get_app_id();
row.tizen_appid = it->Get_tizen_appid();
row.key_name = it->Get_key_name();
row.key_value = it->Get_key_value();
Try {
using namespace DPL::DB::ORM;
using namespace DPL::DB::ORM::wrt;
+
+ DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppid));
+
WRT_DB_SELECT(select, WidgetPreference, &WrtDatabase::interface())
- select->Where(And(Equals<WidgetPreference::tizen_appid>(tzAppid),
+ select->Where(And(Equals<WidgetPreference::app_id>(widgetHandle),
Equals<WidgetPreference::key_name>(key)));
return select->GetSingleValue<WidgetPreference::readonly>();
Try {
using namespace DPL::DB::ORM;
using namespace DPL::DB::ORM::wrt;
+
+ DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppid));
+
ORMWidgetPropertyKeyList keyList;
WRT_DB_SELECT(select, WidgetPreference, &WrtDatabase::interface())
- select->Where(Equals<WidgetPreference::tizen_appid>(tzAppid));
+ select->Where(Equals<WidgetPreference::app_id>(widgetHandle));
keyList = select->GetValueList<WidgetPreference::key_name>();
WidgetPropertyKeyList retKeyList;
Try {
using namespace DPL::DB::ORM;
using namespace DPL::DB::ORM::wrt;
+
+ DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppId));
+
WRT_DB_SELECT(select, WidgetPreference, &WrtDatabase::interface())
- select->Where(Equals<WidgetPreference::tizen_appid>(tzAppId));
+ select->Where(Equals<WidgetPreference::app_id>(widgetHandle));
ORMWidgetPreferenceList ormPrefList = select->GetRowList();
WidgetPreferenceList prefList;
Try {
using namespace DPL::DB::ORM;
using namespace DPL::DB::ORM::wrt;
+
+ DbWidgetHandle widgetHandle(WidgetDAOReadOnly::getHandle(tzAppid));
+
WRT_DB_SELECT(select, WidgetPreference, &WrtDatabase::interface())
- select->Where(And(Equals<WidgetPreference::tizen_appid>(tzAppid),
+ select->Where(And(Equals<WidgetPreference::app_id>(widgetHandle),
Equals<WidgetPreference::key_name>(key)));
ORMWidgetPropertyValue ormPropValue =
SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to set web database usage")
}
-void WidgetDAO::setFileSystemUsage(const SettingsType value)
-{
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
-
- ScopedTransaction transaction(&WrtDatabase::interface());
- if (!isWidgetInstalled(getHandle())) {
- ThrowMsg(WidgetDAOReadOnly::Exception::WidgetNotExist,
- "Cannot find widget. Handle: " << getHandle());
- }
-
- WidgetSecuritySettings::Row row;
- row.Set_file_system_usage(value);
-
- WRT_DB_UPDATE(update, WidgetSecuritySettings, &WrtDatabase::interface())
- update->Where(Equals<WidgetSecuritySettings::app_id>(getHandle()));
- update->Values(row);
- update->Execute();
-
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to set filesystem usage")
-}
-
void WidgetDAO::registerWidget(
const TizenAppId & tzAppId,
const WidgetRegisterInfo &widgetRegInfo,
registerWidgetStartFile(widgetHandle, widgetRegInfo);
- PropertyDAO::RegisterProperties(tzAppId, widgetRegInfo);
+ PropertyDAO::RegisterProperties(widgetHandle, tzAppId, widgetRegInfo);
registerWidgetFeatures(widgetHandle, widgetRegInfo);
const WidgetRegisterInfo ®Info)
{
using namespace DPL::DB::ORM;
+ using namespace DPL::DB::ORM::wrt;
const ConfigParserData& widgetConfigurationInfo = regInfo.configInfo;
FOREACH(it, widgetConfigurationInfo.privilegeList)
{
- wrt::WidgetPrivilege::Row widgetPrivilege;
+ WidgetPrivilege::Row widgetPrivilege;
widgetPrivilege.Set_app_id(widgetHandle);
widgetPrivilege.Set_name(it->name);
- DO_INSERT(widgetPrivilege, wrt::WidgetPrivilege)
+ DO_INSERT(widgetPrivilege, WidgetPrivilege)
}
}
row.Set_geolocation_usage(SETTINGS_TYPE_ON);
row.Set_web_notification_usage(SETTINGS_TYPE_ON);
row.Set_web_database_usage(SETTINGS_TYPE_ON);
- row.Set_file_system_usage(SETTINGS_TYPE_ON);
DO_INSERT(row, WidgetSecuritySettings)
}
"Cannot find widget. tzAppId: " << fromAppId);
}
- WidgetInfo::Row row;
+ WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface())
+ select->Where(Equals<WidgetInfo::tizen_appid>(fromAppId));
+
+ WidgetInfo::Row row = select->GetSingleRow();
+
+ //WidgetInfo::Row row;
row.Set_tizen_appid(toAppId);
WRT_DB_UPDATE(update, WidgetInfo, &WrtDatabase::interface())
return static_cast<SettingsType>(*result);
}
-SettingsType WidgetDAOReadOnly::getFileSystemUsage(void) const
-{
- WidgetSecuritySettingsRow row =
- getWidgetSecuritySettingsRow(m_widgetHandle);
- DPL::OptionalInt result = row.Get_file_system_usage();
- return static_cast<SettingsType>(*result);
-}
-
DPL::OptionalString WidgetDAOReadOnly::getWidgetInstalledPath() const
{
SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
#undef SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
#undef SQL_CONNECTION_EXCEPTION_HANDLER_END
#undef CHECK_WIDGET_EXISTENCE
-} // namespace WrtDB
+} // namespace WrtDB
\ No newline at end of file
typedef std::list<AppControlInfo> AppControlInfoList;
typedef std::list<std::pair<DPL::String, DPL::String> > BoxSizeList;
+ typedef std::list<std::pair<DPL::String, DPL::String> > BoxLabelList;
struct LiveboxInfo
{
};
typedef BoxContent BoxContentInfo;
- DPL::String m_label;
+ BoxLabelList m_label;
DPL::String m_icon;
DPL::String m_liveboxId;
DPL::String m_primary;
DPL::OptionalString startFile;
DPL::OptionalString startFileEncoding;
DPL::OptionalString startFileContentType;
+ DPL::OptionalString startFileNamespace;
IconsList iconsList;
// tizen id / required platform min version for TIZEN webapp
}
/**
- * widgets share directory path
+ * widgets private temp data path
*/
-inline const char* GetWidgetSharePath()
+inline const char* GetWidgetPrivateTempStoragePath()
{
- return "share";
+ return "tmp";
}
/**
return "/opt/share/widget/temp_info";
}
-inline const char* GetVconfKeyPrefixPath()
+inline const char* GetWidgetSharedPath()
{
- return "file/private";
+ return "/shared";
}
-inline const char* GetVconfKeyPopupUsagePath()
+inline const char* GetWidgetDataPath()
{
- return "/popup_usage";
+ return "/data";
}
-inline const char* GetVconfKeyGeolocationUsagePath()
+inline const char* GetWidgetTrustedPath()
{
- return "/geolocation_usage";
+ return "/trusted";
}
-inline const char* GetVconfKeyWebNotificationUsagePath()
+inline const char* GetWidgetResPath()
{
- return "/web_notification_usage";
-}
-
-inline const char* GetVconfKeyWebDatabaseUsagePath()
-{
- return "/web_database_usage";
-}
-
-inline const char* GetVconfKeyMemorySavingModePath()
-{
- return "/memory_saving_mode";
+ return "/res";
}
} // namespace GlobalConfig
} // namespace WrtDB
static bool IsValidSubTag(const DPL::String& tag, int type);
- static bool GetDeveloperMode();
-
static bool GetSecureByDefault();
static bool getComplianceMode();
PluginDAOReadOnly(const std::string &libraryName);
static PluginHandleList getPluginHandleList();
+ static PluginHandleList getRootPluginHandleList();
static bool isPluginInstalled(const std::string &libraryName);
static bool isPluginInstalled(DbPluginHandle pluginHandle);
typedef std::list<WidgetPropertyKey> WidgetPropertyKeyList;
struct WidgetPreferenceRow {
+ int appId;
TizenAppId tizen_appid;
WidgetPropertyKey key_name;
WidgetPropertyValue key_value;
+++ /dev/null
-/*
- * 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 vconf_config.h
- * @author Jihoon Chung (jihoon.chung@samsung.com)
- * @version 1.0
- * @brief Implementation file for vconf key config.
- */
-#ifndef SRC_DOMAIN_VCONF_CONFIG_H
-#define SRC_DOMAIN_VCONF_CONFIG_H
-
-#include <string>
-#include <dpl/string.h>
-
-#include <dpl/wrt-dao-ro/global_config.h>
-#include <dpl/wrt-dao-ro/path_builder.h>
-
-namespace WrtDB {
-namespace VconfConfig {
-inline std::string GetVconfKeyRootPath(DPL::String tzPkgId)
-{
- return PathBuilder()
- .Append(GlobalConfig::GetVconfKeyPrefixPath())
- .Append(DPL::ToUTF8String(tzPkgId))
- .GetFullPath();
-}
-
-inline std::string GetVconfKeyPopupUsage(DPL::String tzPkgId)
-{
- return PathBuilder()
- .Append(GlobalConfig::GetVconfKeyPrefixPath())
- .Append(DPL::ToUTF8String(tzPkgId))
- .Concat(GlobalConfig::GetVconfKeyPopupUsagePath())
- .GetFullPath();
-}
-
-inline std::string GetVconfKeyGeolocationUsage(DPL::String tzPkgId)
-{
- return PathBuilder()
- .Append(GlobalConfig::GetVconfKeyPrefixPath())
- .Append(DPL::ToUTF8String(tzPkgId))
- .Concat(GlobalConfig::GetVconfKeyGeolocationUsagePath())
- .GetFullPath();
-}
-
-inline std::string GetVconfKeyWebNotificationUsage(DPL::String tzPkgId)
-{
- return PathBuilder()
- .Append(GlobalConfig::GetVconfKeyPrefixPath())
- .Append(DPL::ToUTF8String(tzPkgId))
- .Concat(GlobalConfig::GetVconfKeyWebNotificationUsagePath())
- .GetFullPath();
-}
-
-inline std::string GetVconfKeyMemorySavingMode(DPL::String tzPkgId)
-{
- return PathBuilder()
- .Append(GlobalConfig::GetVconfKeyPrefixPath())
- .Append(DPL::ToUTF8String(tzPkgId))
- .Concat(GlobalConfig::GetVconfKeyMemorySavingModePath())
- .GetFullPath();
-}
-
-inline std::string GetVconfKeyWebDatabaseUsage(DPL::String tzPkgId)
-{
- return PathBuilder()
- .Append(GlobalConfig::GetVconfKeyPrefixPath())
- .Append(DPL::ToUTF8String(tzPkgId))
- .Concat(GlobalConfig::GetVconfKeyWebDatabaseUsagePath())
- .GetFullPath();
-}
-} // namespace VconfConfig
-} // namespace WrtDB
-
-#endif
inline std::string GetWidgetTemporaryStoragePath(DPL::String tzPkgId)
{
- return PathBuilder()
- .Append(GlobalConfig::GetTmpDirPath())
- .Append(DPL::ToUTF8String(tzPkgId))
+ return PathBuilder(GetWidgetBasePath(tzPkgId))
+ .Append(GlobalConfig::GetWidgetPrivateTempStoragePath())
.GetFullPath();
}
.Concat(".desktop")
.GetFullPath();
}
+
+inline std::string GetWidgetSharedStoragePath(DPL::String tzPkgId)
+{
+ return PathBuilder()
+ .Append(GlobalConfig::GetWidgetUserDataPath())
+ .Append(DPL::ToUTF8String(tzPkgId))
+ .Concat(GlobalConfig::GetWidgetSharedPath())
+ .GetFullPath();
+}
+
+inline std::string GetWidgetSharedDataStoragePath(DPL::String tzPkgId)
+{
+ return PathBuilder(GetWidgetSharedStoragePath(tzPkgId))
+ .Concat(GlobalConfig::GetWidgetDataPath())
+ .GetFullPath();
+}
+
+inline std::string GetWidgetSharedTrustedStoragePath(DPL::String tzPkgId)
+{
+ return PathBuilder(GetWidgetSharedStoragePath(tzPkgId))
+ .Concat(GlobalConfig::GetWidgetTrustedPath())
+ .GetFullPath();
+}
+
+inline std::string GetWidgetSharedResStoragePath(DPL::String tzPkgId)
+{
+ return PathBuilder(GetWidgetSharedStoragePath(tzPkgId))
+ .Concat(GlobalConfig::GetWidgetResPath())
+ .GetFullPath();
+}
} // namespace WidgetConfig
} // namespace WrtDB
SettingsType getGeolocationUsage() const;
SettingsType getWebNotificationUsage() const;
SettingsType getWebDatabaseUsage() const;
- SettingsType getFileSystemUsage() const;
/**
* This method returns widget's installed path
class GlobalDAO : public GlobalDAOReadOnly
{
public:
- static void SetDeveloperMode(bool mode);
-
static void SetSecureByDefault(bool secureByDefault);
static void setComplianceMode(bool mode);
/* This method registers properties for widget.
* Properties unregistering is done via "delete cascade" mechanism in SQL
*/
-void RegisterProperties(TizenAppId tzAppid,
+void RegisterProperties(DbWidgetHandle widgetHandle, TizenAppId tzAppid,
const WidgetRegisterInfo ®Info);
} // namespace PropertyDAO
} // namespace WrtDB
void setGeolocationUsage(const SettingsType value);
void setWebNotificationUsage(const SettingsType value);
void setWebDatabaseUsage(const SettingsType value);
- void setFileSystemUsage(const SettingsType value);
private:
//Methods used during widget registering
)
/*TODO: secure_by_default should be 0 by default*/
CREATE_TABLE(GlobalProperties)
- COLUMN_NOT_NULL(developer_mode, INT, DEFAULT 0)
COLUMN_NOT_NULL(secure_by_default, INT, DEFAULT 1)
COLUMN_NOT_NULL(home_network_data_usage, TINYINT, DEFAULT 1)
COLUMN_NOT_NULL(roaming_data_usage, TINYINT, DEFAULT 1)
CREATE_TABLE_END()
CREATE_TABLE(WidgetPreference)
+ COLUMN_NOT_NULL(app_id, INTEGER,)
COLUMN_NOT_NULL(tizen_appid, TEXT, DEFAULT 0)
COLUMN_NOT_NULL(key_name, TEXT,)
COLUMN(key_value, TEXT, DEFAULT '')
COLUMN(readonly, INT, DEFAULT 0)
TABLE_CONSTRAINTS(
- PRIMARY KEY(tizen_appid, key_name),
- FOREIGN KEY(tizen_appid) REFERENCES WidgetInfo (tizen_appid) ON DELETE CASCADE
+ PRIMARY KEY(app_id, key_name),
+ FOREIGN KEY(app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE
)
CREATE_TABLE_END()
COLUMN_NOT_NULL(geolocation_usage, INT, DEFAULT 1)
COLUMN_NOT_NULL(web_notification_usage, INT, DEFAULT 1)
COLUMN_NOT_NULL(web_database_usage, INT, DEFAULT 1)
- COLUMN_NOT_NULL(file_system_usage, INT, DEFAULT 1)
TABLE_CONSTRAINTS(
FOREIGN KEY (app_id) REFERENCES WidgetInfo (app_id) ON DELETE CASCADE
)
-#git:framework/web/wrt-commons wrt-commons 0.2.119
+#git:framework/web/wrt-commons
Name: wrt-commons
Summary: Wrt common library
-Version: 0.2.119
+Version: 0.2.128
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
%define with_tests 1
%endif
+%define with_child 0
+%if "%{WITH_CHILD}" == "ON" || "%{WITH_CHILD}" == "Y" || "%{WITH_CHILD}" == "YES" || "%{WITH_CHILD}" == "TRUE" || "%{WITH_CHILD}" == "1"
+ %define with_child 1
+%endif
+
%build
export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"
-DDPL_LOG="OFF" \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
- %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
+ %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS} \
+ %{?WITH_CHILD:-DWITH_CHILD=%WITH_CHILD}
make %{?jobs:-j%jobs}
%install
# Set Smack label for db files
chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db
chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal
-chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/usr/dbspace/.wrt_custom_handler.db
-chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/usr/dbspace/.wrt_custom_handler.db-journal
+chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db
+chsmack -a 'wrt-commons::db_wrt' /opt/usr/dbspace/.wrt_custom_handler.db-journal
echo "[WRT] wrt-commons postinst done ..."
ADD_SUBDIRECTORY(files_localization)
ADD_SUBDIRECTORY(localizationTagsProvider)
ADD_SUBDIRECTORY(utils)
-ADD_SUBDIRECTORY(test)
+
+IF(WITH_CHILD)
+ MESSAGE(STATUS "Additional test subdirectory is being added")
+ ADD_SUBDIRECTORY(test)
+ENDIF(WITH_CHILD)
# Rollback CXX flags
#SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_BACKUP})
RUNNER_TEST_GROUP_INIT(DAO)
/*
- * Name: global_dao_developer_mode
- * Description: tests if developer mode is correctly set and get
- * Expected: received developer shoudl match the one was set
- */
-RUNNER_TEST(global_dao_developer_mode)
-{
- bool prev_mode = GlobalDAO::GetDeveloperMode();
- GlobalDAO::SetDeveloperMode(false);
- RUNNER_ASSERT_MSG(!GlobalDAO::GetDeveloperMode(), "set false failed");
-
- GlobalDAO::SetDeveloperMode(true);
- RUNNER_ASSERT_MSG(GlobalDAO::GetDeveloperMode(), "set true failed");
- GlobalDAO::SetDeveloperMode(prev_mode);
-}
-
-/*
* Name: home_network_data_usage
* Description: tests if HomeNetworkDataUsage is correctly set and get
* Expected: received developer shoudl match the one was set
RUNNER_ASSERT_MSG(
dao.getWebDatabaseUsage() == WrtDB::SETTINGS_TYPE_ON,
"WebDatabaseUsage is not deafult on");
- RUNNER_ASSERT_MSG(
- dao.getFileSystemUsage() == WrtDB::SETTINGS_TYPE_ON,
- "FileSystemUsage is not deafult on");
dao.setSecurityPopupUsage(WrtDB::SETTINGS_TYPE_OFF);
RUNNER_ASSERT_MSG(
RUNNER_ASSERT_MSG(
dao.getWebDatabaseUsage() == WrtDB::SETTINGS_TYPE_ON,
"WebDatabaseUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getFileSystemUsage() == WrtDB::SETTINGS_TYPE_ON,
- "FileSystemUsage - wrong value");
dao.setGeolocationUsage(WrtDB::SETTINGS_TYPE_ALWAYS_ASK);
RUNNER_ASSERT_MSG(
RUNNER_ASSERT_MSG(
dao.getWebDatabaseUsage() == WrtDB::SETTINGS_TYPE_ON,
"WebDatabaseUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getFileSystemUsage() == WrtDB::SETTINGS_TYPE_ON,
- "FileSystemUsage - wrong value");
dao.setWebNotificationUsage(WrtDB::SETTINGS_TYPE_OFF);
RUNNER_ASSERT_MSG(
RUNNER_ASSERT_MSG(
dao.getWebDatabaseUsage() == WrtDB::SETTINGS_TYPE_ON,
"WebDatabaseUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getFileSystemUsage() == WrtDB::SETTINGS_TYPE_ON,
- "FileSystemUsage - wrong value");
dao.setWebDatabaseUsage(WrtDB::SETTINGS_TYPE_ALWAYS_ASK);
RUNNER_ASSERT_MSG(
RUNNER_ASSERT_MSG(
dao.getWebDatabaseUsage() == WrtDB::SETTINGS_TYPE_ALWAYS_ASK,
"WebDatabaseUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getFileSystemUsage() == WrtDB::SETTINGS_TYPE_ON,
- "FileSystemUsage - wrong value");
-
- dao.setFileSystemUsage(WrtDB::SETTINGS_TYPE_OFF);
- RUNNER_ASSERT_MSG(
- dao.getSecurityPopupUsage() == WrtDB::SETTINGS_TYPE_OFF,
- "SecurityPopupUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getGeolocationUsage() == WrtDB::SETTINGS_TYPE_ALWAYS_ASK,
- "GeolocationUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getWebNotificationUsage() == WrtDB::SETTINGS_TYPE_OFF,
- "WebNotificationUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getWebDatabaseUsage() == WrtDB::SETTINGS_TYPE_ALWAYS_ASK,
- "WebDatabaseUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getFileSystemUsage() == WrtDB::SETTINGS_TYPE_OFF,
- "FileSystemUsage - wrong value");
-
- dao.setFileSystemUsage(WrtDB::SETTINGS_TYPE_ON);
- RUNNER_ASSERT_MSG(
- dao.getSecurityPopupUsage() == WrtDB::SETTINGS_TYPE_OFF,
- "SecurityPopupUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getGeolocationUsage() == WrtDB::SETTINGS_TYPE_ALWAYS_ASK,
- "GeolocationUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getWebNotificationUsage() == WrtDB::SETTINGS_TYPE_OFF,
- "WebNotificationUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getWebDatabaseUsage() == WrtDB::SETTINGS_TYPE_ALWAYS_ASK,
- "WebDatabaseUsage - wrong value");
- RUNNER_ASSERT_MSG(
- dao.getFileSystemUsage() == WrtDB::SETTINGS_TYPE_ON,
- "FileSystemUsage - wrong value");
}
/*
}
/*
+ * Name: widget_dao_test_register_widget_privileges
+ * Description: Tests registration of widget privileges
+ */
+RUNNER_TEST(widget_dao_test_register_widget_privileges)
+{
+
+ WacSecurityMock sec;
+ WidgetRegisterInfo regInfo;
+
+ ConfigParserData::PrivilegeList& privilegeList =
+ regInfo.configInfo.privilegeList;
+ privilegeList.insert(DPL::FromUTF8String("name"));
+ privilegeList.insert(DPL::FromUTF8String("name2"));
+
+ TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+ WidgetDAO dao(tizenAppId);
+
+ WrtDB::PrivilegeList privListFromDB;
+ privListFromDB = dao.getWidgetPrivilege();
+
+ RUNNER_ASSERT(privilegeList.size() == privListFromDB.size());
+
+ auto privListIt = privilegeList.begin();
+ auto privDBIt = privListFromDB.begin();
+ for(; privListIt != privilegeList.end() && privDBIt != privListFromDB.end();
+ ++privListIt, ++privDBIt)
+ {
+ RUNNER_ASSERT(*privDBIt == privListIt->name);
+ }
+}
+
+/*
+ * Name: widget_dao_test_register_app_control
+ * Description: Tests app control
+ */
+RUNNER_TEST(widget_dao_test_register_app_control)
+{
+ WacSecurityMock sec;
+ WidgetRegisterInfo regInfo;
+
+ ConfigParserData::AppControlInfo appControl(DPL::FromUTF8String("operation"));
+ appControl.m_disposition
+ = ConfigParserData::AppControlInfo::Disposition::WINDOW;
+ appControl.m_mimeList.insert(DPL::FromUTF8String("mime"));
+ appControl.m_src = DPL::FromUTF8String("src");
+ appControl.m_uriList.insert(DPL::FromUTF8String("uri"));
+
+ ConfigParserData::AppControlInfoList& appControlListRef
+ = regInfo.configInfo.appControlList;
+ appControlListRef.push_back(appControl);
+
+ TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+
+ WidgetDAO dao(tizenAppId);
+
+ WrtDB::WidgetAppControlList appControlInfoListDB;
+ dao.getAppControlList(appControlInfoListDB);
+ RUNNER_ASSERT(appControlInfoListDB.size() == appControlListRef.size());
+ auto appDBIt = appControlInfoListDB.begin();
+ auto appRefIt = appControlListRef.begin();
+
+ for (;appDBIt != appControlInfoListDB.end()
+ && appRefIt != appControlListRef.end();
+ ++appDBIt, ++appRefIt)
+ {
+ RUNNER_ASSERT((WidgetAppControl::Disposition)
+ appRefIt->m_disposition == appDBIt->disposition);
+ RUNNER_ASSERT(appRefIt->m_index == appDBIt->index);
+ RUNNER_ASSERT(appRefIt->m_operation == appDBIt->operation);
+ RUNNER_ASSERT(appRefIt->m_src == appDBIt->src);
+ for(auto it = appRefIt->m_mimeList.begin();
+ it != appRefIt->m_mimeList.end();
+ ++it)
+ {
+ RUNNER_ASSERT((*it) == appDBIt->mime);
+ }
+ for(auto it = appRefIt->m_uriList.begin();
+ it != appRefIt->m_uriList.end();
+ ++it)
+ {
+ RUNNER_ASSERT((*it) == appDBIt->uri);
+ }
+ }
+}
+
+/*
* Name: widget_dao_test_is_widget_installed
* Description: Tests checking if widgets are installed
* Expected: installed widgets should be stated as installed
RUNNER_ASSERT_MSG(dao.getCspPolicy().IsNull(), "Policy is not null");
}
}
-#undef RUNNER_ASSERT_WHAT_EQUALS
+#undef RUNNER_ASSERT_WHAT_EQUALS
\ No newline at end of file
<domain name="wrt-commons"/>
<provide>
<label name="wrt-commons::db_wrt"/>
- <label name="wrt-commons::db_wrt_custom_handler"/>
</provide>
</define>
<request>