void WidgetDAO::registerWidgetSecuritySettings(DbWidgetHandle widgetHandle)
{
- SQL_CONNECTION_EXCEPTION_HANDLER_BEGIN
- {
- using namespace DPL::DB::ORM;
- using namespace DPL::DB::ORM::wrt;
- DPL::DB::ORM::wrt::ScopedTransaction transaction(&WrtDatabase::interface());
-
- WidgetSecuritySettings::Row row;
- row.Set_app_id(widgetHandle);
- row.Set_security_popup_usage(SETTINGS_TYPE_ON);
- 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);
+ using namespace DPL::DB::ORM;
+ using namespace DPL::DB::ORM::wrt;
+ WidgetSecuritySettings::Row row;
+ row.Set_app_id(widgetHandle);
+ row.Set_security_popup_usage(SETTINGS_TYPE_ON);
+ 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)
- transaction.Commit();
- }
- SQL_CONNECTION_EXCEPTION_HANDLER_END("Failed to register external files");
+ DO_INSERT(row, WidgetSecuritySettings)
}
void WidgetDAO::unregisterAllExternalLocations()
}
/*
+Name: widget_dao_test_register_widget_security_settings
+Description: Tests registeration of dafault values of security settings
+Expected: widget should be registered in database.
+ Returned values should match dafault.
+*/
+RUNNER_TEST(widget_dao_test_register_widget_security_settings)
+{
+ WacSecurityMock sec;
+ WidgetRegisterInfo regInfo;
+ WidgetPkgName pkgname = REGISTER_WIDGET(regInfo, sec);
+
+ WidgetDAO dao(pkgname);
+ RUNNER_ASSERT_MSG(dao.getSecurityPopupUsage() == WrtDB::SETTINGS_TYPE_ON, "SecurityPopupUsage is not deafult on");
+ RUNNER_ASSERT_MSG(dao.getGeolocationUsage() == WrtDB::SETTINGS_TYPE_ON, "GeolocationUsage is not deafult on");
+ RUNNER_ASSERT_MSG(dao.getWebNotificationUsage() == WrtDB::SETTINGS_TYPE_ON, "WebNotificationUsage is not deafult on");
+ 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(dao.getSecurityPopupUsage() == WrtDB::SETTINGS_TYPE_OFF, "SecurityPopupUsage - wrong value");
+ RUNNER_ASSERT_MSG(dao.getGeolocationUsage() == WrtDB::SETTINGS_TYPE_ON, "GeolocationUsage - wrong value");
+ RUNNER_ASSERT_MSG(dao.getWebNotificationUsage() == WrtDB::SETTINGS_TYPE_ON, "WebNotificationUsage - wrong value");
+ 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(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_ON, "WebNotificationUsage - wrong value");
+ 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(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_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(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");
+
+ 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_win_modes
Description: Tests registeration of window modes
Expected: all modes should be returned from dao