From a8415eb144d0387886eb309113888bc3638c4714 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Thu, 6 Jun 2013 19:47:08 +0900 Subject: [PATCH] [Release] wrt-commons_0.2.128 Change-Id: I8714388664c70b9229422f6e6f5e19b85650fa7b --- CMakeLists.txt | 2 + .../dpl/localization/w3c_file_localization.h | 1 + .../src/w3c_file_localization.cpp | 171 ++++++++++++++++++ modules/widget_dao/CMakeLists.txt | 1 - modules/widget_dao/dao/global_dao.cpp | 19 -- .../widget_dao/dao/global_dao_read_only.cpp | 14 -- .../widget_dao/dao/plugin_dao_read_only.cpp | 29 +++ modules/widget_dao/dao/property_dao.cpp | 5 +- .../widget_dao/dao/property_dao_read_only.cpp | 21 ++- modules/widget_dao/dao/widget_dao.cpp | 41 +---- .../widget_dao/dao/widget_dao_read_only.cpp | 10 +- .../dpl/wrt-dao-ro/config_parser_data.h | 4 +- .../include/dpl/wrt-dao-ro/global_config.h | 32 ++-- .../dpl/wrt-dao-ro/global_dao_read_only.h | 2 - .../dpl/wrt-dao-ro/plugin_dao_read_only.h | 1 + .../dpl/wrt-dao-ro/property_dao_read_only.h | 1 + .../include/dpl/wrt-dao-ro/vconf_config.h | 88 --------- .../include/dpl/wrt-dao-ro/widget_config.h | 35 +++- .../dpl/wrt-dao-ro/widget_dao_read_only.h | 1 - .../include/dpl/wrt-dao-rw/global_dao.h | 2 - .../include/dpl/wrt-dao-rw/property_dao.h | 2 +- .../include/dpl/wrt-dao-rw/widget_dao.h | 1 - modules/widget_dao/orm/wrt_db | 7 +- packaging/wrt-commons.spec | 16 +- tests/CMakeLists.txt | 6 +- tests/dao/TestCases_GlobalDAO.cpp | 16 -- tests/dao/TestCases_WidgetDAO.cpp | 137 +++++++++----- wrt-commons.manifest | 1 - 28 files changed, 390 insertions(+), 276 deletions(-) mode change 100644 => 100755 modules/localization/include/dpl/localization/w3c_file_localization.h mode change 100644 => 100755 modules/localization/src/w3c_file_localization.cpp mode change 100644 => 100755 modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h delete mode 100644 modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h diff --git a/CMakeLists.txt b/CMakeLists.txt index dd7e778..746e7b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ ELSE(DPL_LOG AND NOT CMAKE_BUILD_TYPE MATCHES "profiling") 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") @@ -108,6 +109,7 @@ MESSAGE(STATUS "CMAKE_COMPILER_IS_GNUCXX : " ${CMAKE_COMPILER_IS_GNUCXX}) 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 diff --git a/modules/localization/include/dpl/localization/w3c_file_localization.h b/modules/localization/include/dpl/localization/w3c_file_localization.h old mode 100644 new mode 100755 index 52c3af9..f0e1997 --- a/modules/localization/include/dpl/localization/w3c_file_localization.h +++ b/modules/localization/include/dpl/localization/w3c_file_localization.h @@ -44,6 +44,7 @@ DPL::Optional getFilePathInWidgetPackageFromUrl( DPL::Optional getFilePathInWidgetPackageFromUrl( WrtDB::WidgetDAOReadOnlyPtr dao, const DPL::String &url); +std::string getFilePathInWidgetPackageFromUrl(const std::string &tzAppId, const std::string &url); DPL::Optional getFilePathInWidgetPackage( WrtDB::DbWidgetHandle widgetHandle, diff --git a/modules/localization/src/w3c_file_localization.cpp b/modules/localization/src/w3c_file_localization.cpp old mode 100644 new mode 100755 index 152440e..66865ba --- a/modules/localization/src/w3c_file_localization.cpp +++ b/modules/localization/src/w3c_file_localization.cpp @@ -117,6 +117,177 @@ DPL::Optional GetFilePathInWidgetPackageInternal( } namespace W3CFileLocalization { +static bool isExistFileCached(const std::string& path) +{ + static std::map 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 getFilePathInWidgetPackageFromUrl( DbWidgetHandle widgetHandle, const DPL::String &url) diff --git a/modules/widget_dao/CMakeLists.txt b/modules/widget_dao/CMakeLists.txt index 1c58aa9..d62ee17 100755 --- a/modules/widget_dao/CMakeLists.txt +++ b/modules/widget_dao/CMakeLists.txt @@ -127,7 +127,6 @@ INSTALL(FILES 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 diff --git a/modules/widget_dao/dao/global_dao.cpp b/modules/widget_dao/dao/global_dao.cpp index 0c22d90..8678c3d 100644 --- a/modules/widget_dao/dao/global_dao.cpp +++ b/modules/widget_dao/dao/global_dao.cpp @@ -29,25 +29,6 @@ #include 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 diff --git a/modules/widget_dao/dao/global_dao_read_only.cpp b/modules/widget_dao/dao/global_dao_read_only.cpp index d634523..3916e57 100644 --- a/modules/widget_dao/dao/global_dao_read_only.cpp +++ b/modules/widget_dao/dao/global_dao_read_only.cpp @@ -32,20 +32,6 @@ #include 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(); - } - Catch(DPL::DB::SqlConnection::Exception::Base){ - ReThrowMsg(GlobalDAOReadOnly::Exception::DatabaseError, - "Failed to get developer mode"); - } -} bool GlobalDAOReadOnly::GetSecureByDefault() { diff --git a/modules/widget_dao/dao/plugin_dao_read_only.cpp b/modules/widget_dao/dao/plugin_dao_read_only.cpp index d5acba9..045cdd6 100644 --- a/modules/widget_dao/dao/plugin_dao_read_only.cpp +++ b/modules/widget_dao/dao/plugin_dao_read_only.cpp @@ -154,6 +154,35 @@ PluginHandleList PluginDAOReadOnly::getPluginHandleList() } } +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(); + + 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; diff --git a/modules/widget_dao/dao/property_dao.cpp b/modules/widget_dao/dao/property_dao.cpp index 8b3dabb..434e842 100644 --- a/modules/widget_dao/dao/property_dao.cpp +++ b/modules/widget_dao/dao/property_dao.cpp @@ -102,9 +102,11 @@ void SetProperty(TizenAppId tzAppid, 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); @@ -133,7 +135,7 @@ void SetProperty(TizenAppId tzAppid, } } -void RegisterProperties(TizenAppId tzAppid, +void RegisterProperties(DbWidgetHandle widgetHandle, TizenAppId tzAppid, const WidgetRegisterInfo ®Info) { LogDebug("Registering proferences for widget. appid: " << tzAppid); @@ -148,6 +150,7 @@ void RegisterProperties(TizenAppId 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); diff --git a/modules/widget_dao/dao/property_dao_read_only.cpp b/modules/widget_dao/dao/property_dao_read_only.cpp index c475f2a..5e06afc 100644 --- a/modules/widget_dao/dao/property_dao_read_only.cpp +++ b/modules/widget_dao/dao/property_dao_read_only.cpp @@ -57,6 +57,7 @@ void convertWidgetPreferenceRow(const ORMWidgetPreferenceList& ormWidgetPrefRow, 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(); @@ -92,8 +93,11 @@ DPL::OptionalInt CheckPropertyReadFlag(TizenAppId tzAppid, 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(tzAppid), + select->Where(And(Equals(widgetHandle), Equals(key))); return select->GetSingleValue(); @@ -110,9 +114,12 @@ WidgetPropertyKeyList GetPropertyKeyList(TizenAppId tzAppid) 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(tzAppid)); + select->Where(Equals(widgetHandle)); keyList = select->GetValueList(); WidgetPropertyKeyList retKeyList; @@ -144,8 +151,11 @@ WidgetPreferenceList GetPropertyList(TizenAppId tzAppId) 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(tzAppId)); + select->Where(Equals(widgetHandle)); ORMWidgetPreferenceList ormPrefList = select->GetRowList(); WidgetPreferenceList prefList; @@ -167,8 +177,11 @@ WidgetPropertyValue GetPropertyValue(TizenAppId tzAppid, 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(tzAppid), + select->Where(And(Equals(widgetHandle), Equals(key))); ORMWidgetPropertyValue ormPropValue = diff --git a/modules/widget_dao/dao/widget_dao.cpp b/modules/widget_dao/dao/widget_dao.cpp index 250e8f5..2e79ea0 100644 --- a/modules/widget_dao/dao/widget_dao.cpp +++ b/modules/widget_dao/dao/widget_dao.cpp @@ -195,32 +195,6 @@ void WidgetDAO::setWebDatabaseUsage(const SettingsType value) 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(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, @@ -286,7 +260,7 @@ void WidgetDAO::registerWidgetInternal( registerWidgetStartFile(widgetHandle, widgetRegInfo); - PropertyDAO::RegisterProperties(tzAppId, widgetRegInfo); + PropertyDAO::RegisterProperties(widgetHandle, tzAppId, widgetRegInfo); registerWidgetFeatures(widgetHandle, widgetRegInfo); @@ -581,15 +555,16 @@ void WidgetDAO::registerWidgetPrivilege(DbWidgetHandle widgetHandle, 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) } } @@ -869,7 +844,6 @@ void WidgetDAO::registerWidgetSecuritySettings(DbWidgetHandle widgetHandle) 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) } @@ -947,7 +921,12 @@ void WidgetDAO::updateWidgetAppIdInternal( "Cannot find widget. tzAppId: " << fromAppId); } - WidgetInfo::Row row; + WRT_DB_SELECT(select, WidgetInfo, &WrtDatabase::interface()) + select->Where(Equals(fromAppId)); + + WidgetInfo::Row row = select->GetSingleRow(); + + //WidgetInfo::Row row; row.Set_tizen_appid(toAppId); WRT_DB_UPDATE(update, WidgetInfo, &WrtDatabase::interface()) diff --git a/modules/widget_dao/dao/widget_dao_read_only.cpp b/modules/widget_dao/dao/widget_dao_read_only.cpp index 87815fc..3890603 100644 --- a/modules/widget_dao/dao/widget_dao_read_only.cpp +++ b/modules/widget_dao/dao/widget_dao_read_only.cpp @@ -1221,14 +1221,6 @@ SettingsType WidgetDAOReadOnly::getWebDatabaseUsage(void) const return static_cast(*result); } -SettingsType WidgetDAOReadOnly::getFileSystemUsage(void) const -{ - WidgetSecuritySettingsRow row = - getWidgetSecuritySettingsRow(m_widgetHandle); - DPL::OptionalInt result = row.Get_file_system_usage(); - return static_cast(*result); -} - DPL::OptionalString WidgetDAOReadOnly::getWidgetInstalledPath() const { SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN @@ -1278,4 +1270,4 @@ WidgetSecurityModelVersion WidgetDAOReadOnly::getSecurityModelVersion() const #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 diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h old mode 100644 new mode 100755 index bc78fe4..d0ecc41 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/config_parser_data.h @@ -181,6 +181,7 @@ class ConfigParserData typedef std::list AppControlInfoList; typedef std::list > BoxSizeList; + typedef std::list > BoxLabelList; struct LiveboxInfo { @@ -199,7 +200,7 @@ class ConfigParserData }; typedef BoxContent BoxContentInfo; - DPL::String m_label; + BoxLabelList m_label; DPL::String m_icon; DPL::String m_liveboxId; DPL::String m_primary; @@ -313,6 +314,7 @@ class ConfigParserData DPL::OptionalString startFile; DPL::OptionalString startFileEncoding; DPL::OptionalString startFileContentType; + DPL::OptionalString startFileNamespace; IconsList iconsList; // tizen id / required platform min version for TIZEN webapp diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h index 3b9ca41..4daca99 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/global_config.h @@ -125,11 +125,11 @@ inline const char* GetWidgetPrivateStoragePath() } /** - * widgets share directory path + * widgets private temp data path */ -inline const char* GetWidgetSharePath() +inline const char* GetWidgetPrivateTempStoragePath() { - return "share"; + return "tmp"; } /** @@ -285,34 +285,24 @@ inline const char* GetTempInstallInfoPath() 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 diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/global_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/global_dao_read_only.h index f5eab4e..bc805a7 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/global_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/global_dao_read_only.h @@ -57,8 +57,6 @@ class GlobalDAOReadOnly static bool IsValidSubTag(const DPL::String& tag, int type); - static bool GetDeveloperMode(); - static bool GetSecureByDefault(); static bool getComplianceMode(); diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h index eb9c030..293cf13 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/plugin_dao_read_only.h @@ -79,6 +79,7 @@ class PluginDAOReadOnly PluginDAOReadOnly(const std::string &libraryName); static PluginHandleList getPluginHandleList(); + static PluginHandleList getRootPluginHandleList(); static bool isPluginInstalled(const std::string &libraryName); static bool isPluginInstalled(DbPluginHandle pluginHandle); diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/property_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/property_dao_read_only.h index d7ff799..88e308a 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/property_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/property_dao_read_only.h @@ -37,6 +37,7 @@ typedef DPL::OptionalString WidgetPropertyValue; typedef std::list WidgetPropertyKeyList; struct WidgetPreferenceRow { + int appId; TizenAppId tizen_appid; WidgetPropertyKey key_name; WidgetPropertyValue key_value; diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h deleted file mode 100644 index c84e866..0000000 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/vconf_config.h +++ /dev/null @@ -1,88 +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 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 -#include - -#include -#include - -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 diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_config.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_config.h index 1144bdc..643ff7b 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_config.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_config.h @@ -55,9 +55,8 @@ inline std::string GetWidgetPersistentStoragePath(DPL::String tzPkgId) inline std::string GetWidgetTemporaryStoragePath(DPL::String tzPkgId) { - return PathBuilder() - .Append(GlobalConfig::GetTmpDirPath()) - .Append(DPL::ToUTF8String(tzPkgId)) + return PathBuilder(GetWidgetBasePath(tzPkgId)) + .Append(GlobalConfig::GetWidgetPrivateTempStoragePath()) .GetFullPath(); } @@ -69,6 +68,36 @@ inline std::string GetWidgetDesktopFilePath(DPL::String tzPkgId) .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 diff --git a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h index 3f9870c..f265281 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h +++ b/modules/widget_dao/include/dpl/wrt-dao-ro/widget_dao_read_only.h @@ -811,7 +811,6 @@ class WidgetDAOReadOnly SettingsType getGeolocationUsage() const; SettingsType getWebNotificationUsage() const; SettingsType getWebDatabaseUsage() const; - SettingsType getFileSystemUsage() const; /** * This method returns widget's installed path diff --git a/modules/widget_dao/include/dpl/wrt-dao-rw/global_dao.h b/modules/widget_dao/include/dpl/wrt-dao-rw/global_dao.h index 21b66fe..5522306 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-rw/global_dao.h +++ b/modules/widget_dao/include/dpl/wrt-dao-rw/global_dao.h @@ -29,8 +29,6 @@ namespace WrtDB { class GlobalDAO : public GlobalDAOReadOnly { public: - static void SetDeveloperMode(bool mode); - static void SetSecureByDefault(bool secureByDefault); static void setComplianceMode(bool mode); diff --git a/modules/widget_dao/include/dpl/wrt-dao-rw/property_dao.h b/modules/widget_dao/include/dpl/wrt-dao-rw/property_dao.h index faecc0d..7e3f215 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-rw/property_dao.h +++ b/modules/widget_dao/include/dpl/wrt-dao-rw/property_dao.h @@ -51,7 +51,7 @@ void SetProperty(TizenAppId tzAppid, /* 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 diff --git a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h index c7d8e94..9830f68 100644 --- a/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h +++ b/modules/widget_dao/include/dpl/wrt-dao-rw/widget_dao.h @@ -162,7 +162,6 @@ class WidgetDAO : public WidgetDAOReadOnly 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 diff --git a/modules/widget_dao/orm/wrt_db b/modules/widget_dao/orm/wrt_db index 607ec23..d4c747b 100644 --- a/modules/widget_dao/orm/wrt_db +++ b/modules/widget_dao/orm/wrt_db @@ -4,7 +4,6 @@ SQL( ) /*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) @@ -102,14 +101,15 @@ CREATE_TABLE(WidgetExtendedInfo) 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() @@ -235,7 +235,6 @@ CREATE_TABLE(WidgetSecuritySettings) 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 ) diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 1087f63..6acaec0 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -1,7 +1,7 @@ -#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 @@ -47,6 +47,11 @@ Wrt common library development headers %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" @@ -55,7 +60,8 @@ cmake . -DVERSION=%{version} \ -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 @@ -124,8 +130,8 @@ fi # 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 ..." diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d3a9edf..b271d5c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -19,7 +19,11 @@ ADD_SUBDIRECTORY(event) 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}) diff --git a/tests/dao/TestCases_GlobalDAO.cpp b/tests/dao/TestCases_GlobalDAO.cpp index 65cb9e0..ff182af 100644 --- a/tests/dao/TestCases_GlobalDAO.cpp +++ b/tests/dao/TestCases_GlobalDAO.cpp @@ -38,22 +38,6 @@ const DPL::String widgetPackage5(L"widgetpackage5"); 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 diff --git a/tests/dao/TestCases_WidgetDAO.cpp b/tests/dao/TestCases_WidgetDAO.cpp index c753d64..204bc3e 100644 --- a/tests/dao/TestCases_WidgetDAO.cpp +++ b/tests/dao/TestCases_WidgetDAO.cpp @@ -565,9 +565,6 @@ RUNNER_TEST(widget_dao_test_register_widget_security_settings) 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( @@ -582,9 +579,6 @@ RUNNER_TEST(widget_dao_test_register_widget_security_settings) 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( @@ -599,9 +593,6 @@ RUNNER_TEST(widget_dao_test_register_widget_security_settings) 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( @@ -616,9 +607,6 @@ RUNNER_TEST(widget_dao_test_register_widget_security_settings) 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( @@ -633,43 +621,6 @@ RUNNER_TEST(widget_dao_test_register_widget_security_settings) 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"); } /* @@ -831,6 +782,92 @@ RUNNER_TEST(widget_dao_test_register_widget_certificates) } } +/* + * 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 @@ -1105,4 +1142,4 @@ RUNNER_TEST(widget_dao_test_register_csp_empty) 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 diff --git a/wrt-commons.manifest b/wrt-commons.manifest index 9b907d3..c63943b 100644 --- a/wrt-commons.manifest +++ b/wrt-commons.manifest @@ -3,7 +3,6 @@ -- 2.34.1