Revision: 200915 PDK_2.0.a
authorKiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
Fri, 08 May 2009 08:25:06 +0300
changeset 1 7c90e6132015
parent 0 dd21522fd290
child 2 8de7b67c0fb3
child 5 10e98eab6f85
Revision: 200915 Kit: 200918
brdo.layers.sysdef.xml
browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp
browserutilities/browserdialogsprovider/SrcData/BrowserDialogsProvider.rss
browserutilities/browserdialogsprovider/loc/BrowserDialogsProvider.loc
browserutilities/downloadmgr/DownloadMgrClntSrv/src/DownloadMgrSrvObject.cpp
browserutilities/downloadmgr/DownloadMgrServEng/Group/HttpDMServEng.mmp
browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpClientApp.cpp
browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp
browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/Data/DownloadMgrUiLib.rss
browserutilities/downloadmgr/DownloadMgrUiLib/Group/DownloadMgrUiLib.mmp
browserutilities/downloadmgr/DownloadMgrUiLib/Inc/CDownloadsListArray.h
browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListArray.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/Src/CUserInteractionsUtils.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/Src/UserInteractionsEventHandler.cpp
browserutilities/downloadmgr/DownloadMgrUiLib/loc/DownloadMgrUiLib.loc
browserutilities/feedsengine/FeedsServer/Server/src/FeedsDatabase.cpp
browserutilities/schemehandler/SchemeDispatcher/src/RtspHandler.cpp
browserutilities/webutils/conf/webutils.confml
browserutilities/webutils/conf/webutils.confml.bak
browserutilities/webutils/src/CUserAgent.cpp
browserutilities/xmlparser/group/XMLInterface.mmp
codhandler/codeng/group/CodEng.mmp
codhandler/codeng/src/FileSaver.cpp
web_plat/browser_dialogs_provider_api/inc/BrowserDialogsProvider.h
web_plat/browser_platform_api/inc/Browser_platform_variant.hrh
web_plat/rt_gesturehelper_api/group/bld.inf
web_plat/rt_gesturehelper_api/inc/rt_gesturecontrol.h
web_plat/rt_gesturehelper_api/inc/rt_gestureobserver.h
web_pub/browser_control_api/tsrc/data/historytest1.html
web_pub/browser_control_api/tsrc/data/historytest2.html
web_pub/browser_control_api/tsrc/data/historytest3.html
web_pub/browser_control_api/tsrc/data/img8.jpg
web_pub/browser_control_api/tsrc/data/loadtest.html
web_pub/browser_control_api/tsrc/data/loadtest.saved
web_pub/browser_control_api/tsrc/data/loadtest1.wml
web_pub/browser_control_api/tsrc/data/loadtest2.html
web_pub/browser_control_api/tsrc/data/loadtest2.wml
web_pub/browser_control_api/tsrc/data/loadtest3.wml
web_pub/browser_control_api/tsrc/data/ui_browser_control_api.cfg
web_pub/browser_control_api/tsrc/group/BrCtlApiTest.mmp
web_pub/browser_plugin_api/inc/PluginAdapterInterface.h
web_pub/browser_plugin_api/inc/npapi.h
web_pub/download_mgr_client_api/tsrc/Bwins/DownloadMgrClientApiTestu.def
web_pub/download_mgr_client_api/tsrc/EABI/DownloadMgrClientApiTestu.def
web_pub/download_mgr_client_api/tsrc/group/Bld.inf
web_pub/download_mgr_client_api/tsrc/group/DownloadMgrClientApiTest.mmp
web_pub/download_mgr_client_api/tsrc/group/DownloadMgrClientApiTest.pkg
web_pub/download_mgr_client_api/tsrc/group/RDTest_02.der
web_pub/download_mgr_client_api/tsrc/group/RDTest_02.key
web_pub/download_mgr_client_api/tsrc/group/buildsis.bat
web_pub/download_mgr_client_api/tsrc/inc/DownloadMgrClientApiTest.h
web_pub/download_mgr_client_api/tsrc/init/testframework.ini
web_pub/download_mgr_client_api/tsrc/src/CDownloadMgrUiLibRegistryTestCases.cpp
web_pub/download_mgr_client_api/tsrc/src/CDownloadMgrUiUserInteractionsTestCases.cpp
web_pub/download_mgr_client_api/tsrc/src/DownloadMgrClientApiTest.cpp
web_pub/download_mgr_client_api/tsrc/src/RHttpDownloadMgrTestCases.cpp
web_pub/download_mgr_client_api/tsrc/src/RHttpDownloadTestCases.cpp
web_pub/download_mgr_ui_api/inc/CDownloadMgrUiDownloadsList.h
web_pub/favourites_engine_api/inc/FavouritesLimits.h
web_pub/favourites_engine_api/tsrc/bwins/FavouritesEngineTestu.def
web_pub/favourites_engine_api/tsrc/eabi/FavouritesEngineTestu.def
web_pub/favourites_engine_api/tsrc/group/Bld.inf
web_pub/favourites_engine_api/tsrc/group/FavouritesEngineTest.mmp
web_pub/favourites_engine_api/tsrc/group/FavouritesEngineTest.pkg
web_pub/favourites_engine_api/tsrc/group/buildsis.bat
web_pub/favourites_engine_api/tsrc/group/rd-key.pem
web_pub/favourites_engine_api/tsrc/group/rd.cer
web_pub/favourites_engine_api/tsrc/inc/FavouritesDbTestObserver.h
web_pub/favourites_engine_api/tsrc/inc/FavouritesEngineTest.h
web_pub/favourites_engine_api/tsrc/inc/FavouritesItemTestData.h
web_pub/favourites_engine_api/tsrc/init/testframework.ini
web_pub/favourites_engine_api/tsrc/src/FavouritesDbIncrementalTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesDbTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesDbTestObserver.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesEngineTest.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesFileTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesItemListTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesItemTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesItemTestData.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesNotifierTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesSessionTestCases.cpp
web_pub/favourites_engine_api/tsrc/src/FavouritesWapApTestCases.cpp
web_pub/settings_api/inc/BrowserUiSDKCRKeys.h
webengine/osswebengine/JavaScriptCore/kjs/collector.cpp
webengine/osswebengine/JavaScriptCore/kjs/function.cpp
webengine/osswebengine/JavaScriptCore/wtf/symbian/cstddef
webengine/osswebengine/JavaScriptCore/wtf/symbian/float.h
webengine/osswebengine/MemoryManager/Group/MemMan.mmp
webengine/osswebengine/MemoryManager/Inc/DLA.h
webengine/osswebengine/MemoryManager/Inc/FastAllocator.h
webengine/osswebengine/MemoryManager/Inc/MemoryPool.h
webengine/osswebengine/MemoryManager/Inc/SymbianDlHeap.h
webengine/osswebengine/MemoryManager/Inc/common.h
webengine/osswebengine/MemoryManager/Src/FastAllocator.cpp
webengine/osswebengine/MemoryManager/Src/MemoryManager.cpp
webengine/osswebengine/MemoryManager/Src/MemoryPool.cpp
webengine/osswebengine/MemoryManager/Src/SymbianDLAllocatorWrapper.cpp
webengine/osswebengine/MemoryManager/Src/fast_malloc.cpp
webengine/osswebengine/MemoryManager/Src/heap.cpp
webengine/osswebengine/WebCore/dom/CharacterData.cpp
webengine/osswebengine/WebCore/html/HTMLParser.cpp
webengine/osswebengine/WebCore/html/HTMLParser.h
webengine/osswebengine/WebCore/html/HTMLTokenizer.cpp
webengine/osswebengine/WebCore/loader/DocLoader.cpp
webengine/osswebengine/WebCore/page/symbian/WebCoreGraphicsContext.cpp
webengine/osswebengine/WebCore/platform/Font.h
webengine/osswebengine/WebCore/platform/graphics/symbian/GraphicsContextSymbian.cpp
webengine/osswebengine/WebCore/platform/graphics/symbian/ImageSymbian.cpp
webengine/osswebengine/WebCore/platform/graphics/symbian/ZoomFactor.h
webengine/osswebengine/WebCore/platform/network/symbian/DataConnection.cpp
webengine/osswebengine/WebCore/platform/network/symbian/HttpSessionManager.cpp
webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.cpp
webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.h
webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleSymbian.cpp
webengine/osswebengine/WebCore/platform/network/symbian/ResourceRequest.h
webengine/osswebengine/WebCore/platform/network/symbian/UnknownContentHandler.cpp
webengine/osswebengine/WebCore/platform/network/symbian/UnknownContentHandler.h
webengine/osswebengine/WebCore/platform/symbian/FontSymbian.cpp
webengine/osswebengine/WebCore/platform/symbian/StaticObjectsContainer.cpp
webengine/osswebengine/WebCore/platform/symbian/StaticObjectsContainer.h
webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp
webengine/osswebengine/WebCore/rendering/RenderText.cpp
webengine/osswebengine/WebCore/rendering/RenderText.h
webengine/osswebengine/WebKit/s60/misc/WebTabbedNavigation.cpp
webengine/osswebengine/WebKit/s60/misc/WebUtil.cpp
webengine/osswebengine/WebKit/s60/plugins/NpnImplementation.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginHandler.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginHandler.h
webengine/osswebengine/WebKit/s60/plugins/PluginSkin.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp
webengine/osswebengine/WebKit/s60/plugins/PluginWin.h
webengine/osswebengine/WebKit/s60/webcoresupport/WebFrameLoaderClient.cpp
webengine/osswebengine/WebKit/s60/webview/BrCtl.cpp
webengine/osswebengine/WebKit/s60/webview/WebCursor.cpp
webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp
webengine/osswebengine/WebKit/s60/webview/WebFrame.cpp
webengine/osswebengine/WebKit/s60/webview/WebPageFullScreenHandler.cpp
webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp
webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.h
webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.cpp
webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.h
webengine/osswebengine/WebKit/s60/webview/WebScrollbarDrawer.cpp
webengine/osswebengine/WebKit/s60/webview/WebScrollbarDrawer.h
webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp
webengine/osswebengine/WebKit/s60/webview/WebView.cpp
webengine/osswebengine/WebKit/s60/webview/WebView.h
webengine/osswebengine/WebKit/s60/webview/webview_api_test/tsrc/group/Copy of WebViewApiTest.mmp
webengine/osswebengine/WebKit/s60/webview/webview_api_test/tsrc/group/WebViewApiTest.mmp
webengine/osswebengine/cache/group/EABI/BrowserCacheu.def
webengine/osswebengine/cache/inc/HttpCacheEntry.h
webengine/osswebengine/cache/inc/HttpCacheEvictionHandler.h
webengine/osswebengine/cache/inc/HttpCacheHandler.h
webengine/osswebengine/cache/inc/HttpCacheLookupTable.h
webengine/osswebengine/cache/inc/HttpCacheManager.h
webengine/osswebengine/cache/inc/HttpCacheStreamHandler.h
webengine/osswebengine/cache/inc/HttpCacheUtil.h
webengine/osswebengine/cache/src/HttpCacheEntry.cpp
webengine/osswebengine/cache/src/HttpCacheEvictionHandler.cpp
webengine/osswebengine/cache/src/HttpCacheHandler.cpp
webengine/osswebengine/cache/src/HttpCacheLookupTable.cpp
webengine/osswebengine/cache/src/HttpCacheManager.cpp
webengine/osswebengine/cache/src/HttpCacheStreamHandler.cpp
webengine/osswebengine/cache/src/HttpCacheUtil.cpp
webengine/webkitutils/rt_gesturehelper/bwins/rt_gesturehelperu.def
webengine/webkitutils/rt_gesturehelper/eabi/rt_gesturehelperu.def
webengine/webkitutils/rt_gesturehelper/group/rt_gesturehelper.mmp
webengine/webkitutils/rt_gesturehelper/inc/rt_gesturecontrol.h
webengine/webkitutils/rt_gesturehelper/inc/rt_gesturehelper.h
webengine/webkitutils/rt_gesturehelper/inc/rt_gestureobserver.h
webengine/webkitutils/rt_gesturehelper/src/gesture.cpp
webengine/webkitutils/rt_gesturehelper/src/gesture.h
webengine/webkitutils/rt_gesturehelper/src/gesturecontrol.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturehelper.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.h
webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.cpp
webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.h
webengine/webkitutils/rt_gesturehelper/src/hittest.cpp
webengine/webkitutils/rt_gesturehelper/src/pointercapturer.cpp
webengine/webkitutils/rt_gesturehelper/src/pointercapturer.h
webengine/wmlengine/src/fbox/include/nw_fbox_CEpoc32InputBox.h
webengine/wmlengine/src/fbox/src/FBOXCEpoc32InputBox.cpp
webengine/wmlengine/src/gdi/src/GDIDeviceContext.cpp
widgets/widgetapp/inc/WidgetUiObserver.h
widgets/widgetapp/src/WidgetUiAppUi.cpp
widgets/widgetapp/src/WidgetUiObserver.cpp
widgets/widgetapp/src/WidgetUiWindow.cpp
widgets/widgetapp/src/WidgetUiWindowContainer.cpp
widgets/widgetapp/src/cpspublisher.cpp
widgets/widgetlauncher/src/WidgetLauncher.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/brdo.layers.sysdef.xml	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,119 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd"
+  [ <!ENTITY layer_real_source_path "sf/mw/web" > ]>
+
+<SystemDefinition name="web" schema="1.4.0">
+  <systemModel>
+    <layer name="mw_layer">
+      <module name="web_plat">
+        <unit unitID="aiw_browser_provider_api" name="aiw_browser_provider_api" bldFile="&layer_real_source_path;/web_plat/aiw_browser_provider_api/group" mrp=""/>
+        <unit unitID="browser_dialogs_provider_api" name="browser_dialogs_provider_api" bldFile="&layer_real_source_path;/web_plat/browser_dialogs_provider_api/group" mrp=""/>
+        <unit unitID="browser_platform_api" name="browser_platform_api" bldFile="&layer_real_source_path;/web_plat/browser_platform_api/group" mrp=""/>
+        <unit unitID="cod_handler_api" name="cod_handler_api" bldFile="&layer_real_source_path;/web_plat/cod_handler_api/group" mrp=""/>
+        <unit unitID="multipart_parser_api" name="multipart_parser_api" bldFile="&layer_real_source_path;/web_plat/multipart_parser_api/group" mrp=""/>
+        <unit unitID="scheme_handler_plugin_api" name="scheme_handler_plugin_api" bldFile="&layer_real_source_path;/web_plat/scheme_handler_plugin_api/group" mrp=""/>
+        <unit unitID="download_mgr_client_api_extn" name="download_mgr_client_api_extn" bldFile="&layer_real_source_path;/web_plat/download_mgr_client_api_extn/group" mrp=""/>
+        <unit unitID="connection_manager_api" name="connection_manager_api" bldFile="&layer_real_source_path;/web_plat/connection_manager_api/group" mrp=""/>        
+        <unit unitID="feeds_engine_api" name="feeds_engine_api" bldFile="&layer_real_source_path;/web_plat/feeds_engine_api/group" mrp=""/>        
+        <unit unitID="launcher_api" name="launcher_api" bldFile="&layer_real_source_path;/web_plat/launcher_api/group" mrp=""/>                  
+        <unit unitID="recent_url_store_api" name="recent_url_store_api" bldFile="&layer_real_source_path;/web_plat/recent_url_store_api/group" mrp=""/>    
+        <unit unitID="rt_gesturehelper_api" name="rt_gesturehelper_api" bldFile="&layer_real_source_path;/web_plat/rt_gesturehelper_api/group" mrp=""/>    
+        <unit unitID="scriptable_plugin_api" name="scriptable_plugin_api" bldFile="&layer_real_source_path;/web_plat/scriptable_plugin_api/group" mrp=""/>            
+        <unit unitID="webutils_api" name="webutils_api" bldFile="&layer_real_source_path;/web_plat/webutils_api/group" mrp=""/>                    
+        <unit unitID="widget_registry_api" name="widget_registry_api" bldFile="&layer_real_source_path;/web_plat/widget_registry_api/group" mrp=""/>                         
+        <unit unitID="xml_parser_api" name="xml_parser_api" bldFile="&layer_real_source_path;/web_plat/xml_parser_api/group" mrp=""/>                         
+      </module>
+      <module name="web_pub">
+        <unit unitID="browser_control_api" name="browser_control_api" bldFile="&layer_real_source_path;/web_pub/browser_control_api/group" mrp=""/>
+        <unit unitID="browser_plugin_api" name="browser_plugin_api" bldFile="&layer_real_source_path;/web_pub/browser_plugin_api/group" mrp=""/>
+        <unit unitID="download_mgr_client_api" name="download_mgr_client_api" bldFile="&layer_real_source_path;/web_pub/download_mgr_client_api/group" mrp=""/>
+        <unit unitID="download_mgr_ui_api" name="download_mgr_ui_api" bldFile="&layer_real_source_path;/web_pub/download_mgr_ui_api/group" mrp=""/>
+        <unit unitID="favourites_engine_api" name="favourites_engine_api" bldFile="&layer_real_source_path;/web_pub/favourites_engine_api/group" mrp=""/>
+        <unit unitID="settings_api" name="settings_api" bldFile="&layer_real_source_path;/web_pub/settings_api/group" mrp=""/>        
+      </module>
+      <module name="browser_utilities">
+        <unit unitID="browserdialogsprovider" name="browserdialogsprovider" bldFile="&layer_real_source_path;/browserutilities/browserdialogsprovider/group" mrp=""/>
+        <unit unitID="recenturlstore" name="recenturlstore" bldFile="&layer_real_source_path;/browserutilities/recenturlstore/group" mrp=""/>
+        <unit unitID="xmlparser" name="cxmlparser" bldFile="&layer_real_source_path;/browserutilities/xmlparser/group" mrp=""/>
+        <unit unitID="cxmllibrary" name="cxmlparser" bldFile="&layer_real_source_path;/browserutilities/cxmllibrary/group" mrp=""/>
+        <unit unitID="downloadmgr" name="downloadmgr" bldFile="&layer_real_source_path;/browserutilities/downloadmgr/group" mrp=""/>
+        <unit unitID="connectionmanager" name="connectionmanager" bldFile="&layer_real_source_path;/browserutilities/connectionmanager/group" mrp=""/>
+        <unit unitID="browsertelservice" name="browsertelservice" bldFile="&layer_real_source_path;/browserutilities/browsertelservice/group" mrp=""/>
+        <unit unitID="favouritesengine" name="favouritesengine" bldFile="&layer_real_source_path;/browserutilities/favouritesengine/group" mrp=""/>
+        <unit unitID="feedsengine" name="feedsengine" bldFile="&layer_real_source_path;/browserutilities/feedsengine/group" mrp=""/>
+        <unit unitID="multipartparser" name="multipartparser" bldFile="&layer_real_source_path;/browserutilities/multipartparser/group" mrp=""/>
+        <unit unitID="schemehandler" name="schemehandler" bldFile="&layer_real_source_path;/browserutilities/schemehandler/group" mrp=""/>
+        <unit unitID="webutils" name="webutils" bldFile="&layer_real_source_path;/browserutilities/webutils/group" mrp=""/>
+      </module>
+      <module name="webengine">
+        <unit unitID="cache" name="cache" bldFile="&layer_real_source_path;/webengine/osswebengine/cache/group" mrp=""/>
+        <unit unitID="memorymanager" name="memorymanager" bldFile="&layer_real_source_path;/webengine/osswebengine/MemoryManager/group" mrp=""/>
+        <unit unitID="javascriptcore" name="javascriptcore" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/JavaScriptCore" mrp=""/>
+        <unit unitID="npscript" name="npscript" bldFile="&layer_real_source_path;/webengine/osswebengine/npscript/group" mrp=""/>
+        <unit unitID="webkitutils" name="webkitutils" bldFile="&layer_real_source_path;/webengine/webkitutils/group" mrp=""/>
+        <unit unitID="pagescaler" name="pagescaler" bldFile="&layer_real_source_path;/webengine/pagescaler/group" mrp=""/>
+        <unit unitID="widgetinstaller" name="widgetinstaller" bldFile="&layer_real_source_path;/webengine/widgetinstaller/group" mrp=""/>
+        <unit unitID="widgetregistry" name="widgetregistry" bldFile="&layer_real_source_path;/webengine/widgetregistry/group" mrp=""/>
+        <unit unitID="webkit_libxml2" name="webkit_libxml2" bldFile="&layer_real_source_path;/webengine/osswebengine/webkit/s60/group/libxml2" mrp=""/>
+        <component name="webcore">
+          <unit unitID="webcore_derivedsources" name="webcore_derivedsources" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/DerivedSources" mrp=""/>
+          <unit unitID="webcore_bindings" name="webcore_bindings" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/bindings" mrp=""/>
+          <unit unitID="webcore_webcorecss" name="webcore_webcorecss" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/webcorecss" mrp=""/>
+          <unit unitID="webcore_dom" name="webcore_dom" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/dom" mrp=""/>
+          <unit unitID="webcore_editing" name="webcore_editing" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/editing" mrp=""/>
+          <unit unitID="webcore_history" name="webcore_history" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/history" mrp=""/>
+          <unit unitID="webcore_html" name="webcore_html" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/html" mrp=""/>
+          <unit unitID="webcore_loader" name="webcore_loader" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/loader" mrp=""/>
+          <unit unitID="webcore_page" name="webcore_page" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/page" mrp=""/>
+          <unit unitID="webcore_rendering" name="webcore_rendering" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/rendering" mrp=""/>
+          <unit unitID="webcore_xml" name="webcore_xml" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/xml" mrp=""/>
+          <unit unitID="webcore_bridge" name="webcore_bridge" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/bridge" mrp=""/>
+          <unit unitID="webcore_platform" name="webcore_platform" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webcore/platform" mrp=""/>
+        </component>
+        <unit unitID="webkit_plugins" name="webkit_plugins" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/plugins" mrp=""/>
+        <unit unitID="webkit_webkit" name="webkit_webkit" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/webkit" mrp=""/>
+        <unit unitID="webkit_browserengine" name="webkit_browserengine" bldFile="&layer_real_source_path;/webengine/osswebengine/WebKit/S60/group/browserengine" mrp=""/>
+        <component name="wmlengine">
+        <unit unitID="wmlengine_adt" name="wmlengine_adt" bldFile="&layer_real_source_path;/webengine/wmlengine/group/adt" mrp=""/>
+          <unit unitID="wmlengine_css" name="wmlengine_css" bldFile="&layer_real_source_path;/webengine/wmlengine/group/css" mrp=""/>
+          <unit unitID="wmlengine_evt" name="wmlengine_evt" bldFile="&layer_real_source_path;/webengine/wmlengine/group/evt" mrp=""/>
+          <unit unitID="wmlengine_fbox" name="wmlengine_fbox" bldFile="&layer_real_source_path;/webengine/wmlengine/group/fbox" mrp=""/>
+          <unit unitID="wmlengine_gdi" name="wmlengine_gdi" bldFile="&layer_real_source_path;/webengine/wmlengine/group/gdi" mrp=""/>
+          <unit unitID="wmlengine_hed" name="wmlengine_hed" bldFile="&layer_real_source_path;/webengine/wmlengine/group/hed" mrp=""/>
+          <unit unitID="wmlengine_htmlp" name="wmlengine_htmlp" bldFile="&layer_real_source_path;/webengine/wmlengine/group/htmlp" mrp=""/>
+          <unit unitID="wmlengine_image" name="wmlengine_image" bldFile="&layer_real_source_path;/webengine/wmlengine/group/image" mrp=""/>
+          <unit unitID="wmlengine_imagech" name="wmlengine_imagech" bldFile="&layer_real_source_path;/webengine/wmlengine/group/imagech" mrp=""/>
+          <unit unitID="wmlengine_lmgr" name="wmlengine_lmgr" bldFile="&layer_real_source_path;/webengine/wmlengine/group/lmgr" mrp=""/>
+          <unit unitID="wmlengine_object" name="wmlengine_object" bldFile="&layer_real_source_path;/webengine/wmlengine/group/object" mrp=""/>
+          <unit unitID="wmlengine_markup" name="wmlengine_markup" bldFile="&layer_real_source_path;/webengine/wmlengine/group/markup" mrp=""/>
+          <unit unitID="wmlengine_msg" name="wmlengine_msg" bldFile="&layer_real_source_path;/webengine/wmlengine/group/msg" mrp=""/>
+          <unit unitID="wmlengine_system" name="wmlengine_system" bldFile="&layer_real_source_path;/webengine/wmlengine/group/system" mrp=""/>
+          <unit unitID="wmlengine_text" name="wmlengine_text" bldFile="&layer_real_source_path;/webengine/wmlengine/group/text" mrp=""/>
+          <unit unitID="wmlengine_Unicode" name="wmlengine_Unicode" bldFile="&layer_real_source_path;/webengine/wmlengine/group/Unicode" mrp=""/>
+          <unit unitID="wmlengine_wml1x" name="wmlengine_wml1x" bldFile="&layer_real_source_path;/webengine/wmlengine/group/wml1x" mrp=""/>
+          <unit unitID="wmlengine_wmlscriptch" name="wmlengine_wmlscriptch" bldFile="&layer_real_source_path;/webengine/wmlengine/group/wmlscriptch" mrp=""/>
+          <unit unitID="wmlengine_xhtml" name="wmlengine_xhtml" bldFile="&layer_real_source_path;/webengine/wmlengine/group/xhtml" mrp=""/>
+          <unit unitID="wmlengine_script" name="wmlengine_script" bldFile="&layer_real_source_path;/webengine/wmlengine/group/script" mrp=""/>
+          <unit unitID="wmlengine_wml" name="wmlengine_wml" bldFile="&layer_real_source_path;/webengine/wmlengine/group/wml" mrp=""/>
+          <unit unitID="wmlengine_fileloader" name="wmlengine_fileloader" bldFile="&layer_real_source_path;/webengine/wmlengine/group/fileloader" mrp=""/>
+          <unit unitID="wmlengine_urlloader" name="wmlengine_urlloader" bldFile="&layer_real_source_path;/webengine/wmlengine/group/urlloader" mrp=""/>
+          <unit unitID="wmlengine_browser" name="wmlengine_browser" bldFile="&layer_real_source_path;/webengine/wmlengine/group/browser" mrp=""/>
+          <unit unitID="wmlengine_wmlengine" name="wmlengine_wmlengine" bldFile="&layer_real_source_path;/webengine/wmlengine/group/wmlengine" mrp=""/>
+        </component>    
+        <unit unitID="device" name="device" bldFile="&layer_real_source_path;/webengine/device/group" mrp=""/>
+        <unit unitID="widgetengine" name="widgetengine"     bldFile="&layer_real_source_path;/webengine/widgetengine/group" mrp=""/>
+        <unit unitID="memoryplugin" name="memoryplugin"     bldFile="&layer_real_source_path;/webengine/memoryplugin/group" mrp=""/>
+        <unit unitID="widgetmemoryplugin" name="widgetmemoryplugin"  bldFile="&layer_real_source_path;/webengine/widgetmemoryplugin/group" mrp=""/>
+        <unit unitID="widgetbackuprestore" name="widgetbackuprestore" bldFile="&layer_real_source_path;/webengine/widgetbackuprestore/group" mrp=""/>
+        <unit unitID="browserrecognizers" name="browserrecognizers" bldFile="&layer_real_source_path;/webengine/browserrecognizers/group" mrp=""/>
+        <unit unitID="wrtharvester" name="wrtharvester" bldFile="&layer_real_source_path;/webengine/wrtharvester/group" mrp=""/>        
+      </module>
+      <module name="codhandler">
+        <unit unitID="codhandler" name="codhandler" bldFile="&layer_real_source_path;/codhandler/group" mrp=""/>
+      </module>
+      <module name="widgets">
+        <unit unitID="widgets" name="widgets" bldFile="&layer_real_source_path;/widgets/group" mrp=""/>
+      </module>
+    </layer>
+  </systemModel>
+</SystemDefinition>
--- a/browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/browserdialogsprovider/Src/BrowserDialogsProvider.cpp	Fri May 08 08:25:06 2009 +0300
@@ -54,11 +54,11 @@
 #include <StringLoader.h>				// strings
 #include <f32file.h>
 #include <THttpFields.h>
+#include <textresolver.h>
 
 // Resources
 #include <coneresloader.h>
 #include <BrowserDialogsProvider.rsg>
-#include <ErrorRes.rsg>
 
 // Data Caging
 #include <data_caging_path_literals.hrh>    
@@ -71,7 +71,6 @@
 
 // DLL resource file name with path
 _LIT( KBrowserDialogsProviderDirAndFile, "z:BrowserDialogsProvider.rsc" );// resource
-_LIT( KErrorResDirAndFile, "z:ErrorRes.rsc" );  // error resource
 
 //Mime Types
 _LIT( KMimeTypeImage, "image/*" );
@@ -91,9 +90,7 @@
 :   iCoeEnv( *CCoeEnv::Static() ), 
     iObserver( aObserver ),
     iResourceLoader( iCoeEnv ),    
-    iResourceOpened( EFalse ),    
-    iErrResourceLoader( iCoeEnv ),    
-    iErrResourceOpened( EFalse )    
+    iResourceOpened( EFalse )
 	{
 	}
 
@@ -132,7 +129,6 @@
 CBrowserDialogsProvider::~CBrowserDialogsProvider()
 	{
 	iResourceLoader.Close();
-	iErrResourceLoader.Close();
 
 	// Delete any dialogs
 	CancelAll();
@@ -152,7 +148,9 @@
 EXPORT_C void CBrowserDialogsProvider::DialogNotifyErrorL( TInt aErrCode )
 	{
     TInt httpErr = KBrCtlHttpErrorsOffset - aErrCode;
-
+	CTextResolver* textresolver = CTextResolver::NewLC(); 
+	TPtrC msg;
+		
     switch ( httpErr )
         {
         case EHttpMultipleChoices: 
@@ -160,21 +158,21 @@
         case EHttpMovedTemporarily:
         case EHttpTemporaryRedirect:
             {
-            // Handle the redirect error dialog
-            HBufC* msg = NULL;
-            msg = StringLoader::LoadLC( R_NW_STAT_TOO_MANY_REDIRECTS );
-            DialogNoteL( *msg );
-    		CleanupStack::PopAndDestroy();	// msg
+            // Id for r_nw_stat_too_many_redirects is -20019, browser errors start at -20000 
+            msg.Set( textresolver->ResolveErrorString( KErrTooManyRedirects ));  
             break;
             }
         default:
             {
             // Handle all others as system error dialog
-        	iCoeEnv.HandleError( aErrCode );
-        	break;
+            msg.Set( textresolver->ResolveErrorString( aErrCode ));            
+        	  break;
             }
         }   // end of switch
 	
+       DialogNoteL( msg );
+       CleanupStack::PopAndDestroy(); //textresolver
+       
 	if ( iObserver )
     	{
     	iObserver->ReportDialogEventL( 
@@ -192,6 +190,8 @@
 								TInt aErrCode, const TDesC& /*aUri*/ )
 	{
     TInt httpErr = KBrCtlHttpErrorsOffset - aErrCode;
+    CTextResolver* textresolver = CTextResolver::NewLC(); 
+	TPtrC msg;	
 
     switch ( httpErr )
         {
@@ -200,20 +200,29 @@
         case EHttpMovedTemporarily:
         case EHttpTemporaryRedirect:
             {
-            // Handle the redirect error dialog
-            HBufC* msg = NULL;
-            msg = StringLoader::LoadLC( R_NW_STAT_TOO_MANY_REDIRECTS );
-            DialogNoteL( *msg );
-    		CleanupStack::PopAndDestroy();	// msg
-            break;
+            // Handle the redirect error dialog browser errors start from -20000 ,id for r_nw_stat_malformed_url is -20019.
+			msg.Set( textresolver->ResolveErrorString( KErrTooManyRedirects ));  
+			DialogNoteL( msg );
+            break;     
             }
+        case EHttpBadGateway:
+	        {
+    	    // Handle the unresolved dns name error dialog
+    	    HBufC* msg = NULL;
+        	msg = StringLoader::LoadLC( R_BROWSER_NOT_VALID_DNS_NAME);
+			DialogNoteL( *msg );			
+			CleanupStack::PopAndDestroy();	// msg
+			break;
+        	}
         default:
             {
             // Handle all others as system error dialog
-        	iCoeEnv.HandleError( aErrCode );
-        	break;
+            msg.Set( textresolver->ResolveErrorString( aErrCode ));     
+			DialogNoteL( msg );
+            break;
             }
-        }   // end of switch
+        }   // end of switch			 
+    CleanupStack::PopAndDestroy(); //textresolver    
 	
     if ( iObserver )
         {
@@ -1220,33 +1229,6 @@
             User::Leave( error );
             }
         }
-
-    if ( !iErrResourceOpened )
-        {
-        // Add error resource file.
-        TParse* errfp = new(ELeave) TParse(); 
-
-        TInt err = errfp->Set( KErrorResDirAndFile, 
-                               &KDC_RESOURCE_FILES_DIR, 
-                               NULL ); 
-        if ( err != KErrNone)
-            {
-            User::Leave( err );
-            }   
-    
-        TFileName errResourceFileName = errfp->FullName();
-        delete errfp;
-
-        TRAPD( error, iErrResourceLoader.OpenL( errResourceFileName ) );
-        if ( !error )
-            {
-            iErrResourceOpened = ETrue;
-            }
-        else
-            {
-            User::Leave( error );
-            }
-        }
     }
 
 
--- a/browserutilities/browserdialogsprovider/SrcData/BrowserDialogsProvider.rss	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/browserdialogsprovider/SrcData/BrowserDialogsProvider.rss	Fri May 08 08:25:06 2009 +0300
@@ -56,6 +56,8 @@
 // Authentication Dialog
 RESOURCE TBUF r_browser_dlgprov_auth_fail_retry_query		{ buf=text_wml_auth_fail_retry_query; }
 RESOURCE TBUF r_browser_dlgprov_query_basic_authentication	{ buf=qtn_browser_dlgprov_query_basic_authentication; }
+// DNS look up failed message
+RESOURCE TBUF r_browser_not_valid_dns_name						{ buf = qtn_browser_not_valid_dns_name; }
 
 //
 // ===================================================
--- a/browserutilities/browserdialogsprovider/loc/BrowserDialogsProvider.loc	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/browserdialogsprovider/loc/BrowserDialogsProvider.loc	Fri May 08 08:25:06 2009 +0300
@@ -87,7 +87,9 @@
 //
 #define qtn_browser_query_select_image  "Select image"
 
-
+//d: message for unresolved hostname. The host name could not be resolved by Domain Name Server lookup
+//l: opup_note_window
+#define qtn_browser_not_valid_dns_name  "Unresolved server name"
 
 //-----------------------------------------------------------------------------
 //
--- a/browserutilities/downloadmgr/DownloadMgrClntSrv/src/DownloadMgrSrvObject.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrClntSrv/src/DownloadMgrSrvObject.cpp	Fri May 08 08:25:06 2009 +0300
@@ -108,8 +108,8 @@
 	{
     CLOG_WRITE( "CDownloadSubSession::CloseDownload" )
    
+    iDownload->DetachClientInstance(iSession->ClientAppInstance());
     iSession->ClientAppInstance()->ClientApp()->UnregisterDownload( iDownload ); 
-	iDownload->DetachClientInstance(iSession->ClientAppInstance());
 	iSession->DeleteDownload( Message().Int3() );
 	}
 
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Group/HttpDMServEng.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Group/HttpDMServEng.mmp	Fri May 08 08:25:06 2009 +0300
@@ -95,7 +95,11 @@
 LIBRARY     apmime.lib              // For mime type handling (class TDataType)
 
 LIBRARY     PlatformEnv.lib
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 LIBRARY     MGXMediaFileAPI.lib
+#endif
+
 LIBRARY     DcfRep.lib
 LIBRARY     FeatMgr.lib
 
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpClientApp.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpClientApp.cpp	Fri May 08 08:25:06 2009 +0300
@@ -207,14 +207,25 @@
 
     CLOG_WRITE8_1( "New instance id: [%d]", instanceId );
 
-    // Create new connhandler used by the instance
-    // Every instance has its own connhandler
-    CHttpConnHandler* conn = CHttpConnHandler::NewL( this );
+    
+    CHttpConnHandler* conn = NULL;
+    
+    if(iInstances->Count() ==0 && iConnections->Count() > 0)
+        {
+          conn = iConnections->At(0) ;	 
+        }
+    else
+        {
+        // Create new connhandler used by the instance
+        // Every instance has its own connhandler
+        conn = CHttpConnHandler::NewL( this );
 
-    // connhandlers are owned by CHttpClientApp.
-    CleanupStack::PushL( conn );
-    iConnections->AppendL( conn );
-    CleanupStack::Pop( conn );
+        // connhandlers are owned by CHttpClientApp.
+        CleanupStack::PushL( conn );
+        iConnections->AppendL( conn );
+        CleanupStack::Pop( conn );
+        }
+    
 
     // Create new client instance
     CHttpClientAppInstance* instance = 
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpConnHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -444,6 +444,7 @@
             && iConnStage == KLinkLayerOpen )
             {
 			CLOG_WRITE_1( "ShutDown->Start: atOnce=%d", aAtOnce );
+			iConnStage = KConnectionStartingClose;
             iShutDown->Start( KShutDownTimer );
             }
         else
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp	Fri May 08 08:25:06 2009 +0300
@@ -18,6 +18,7 @@
 
 
 // INCLUDE FILES
+#include <platform/mw/Browser_platform_variant.hrh>
 #include    "HeaderField.h"
 #include    "HttpDownloadManagerServerEngine.h"
 #include    "HttpClientApp.h"
@@ -34,8 +35,12 @@
 #include    <HttpFilterCommonStringsExt.h>
 #include    <tinternetdate.h>
 #include    <SysUtil.h>
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 #include    <MGXFileManagerFactory.h>
 #include    <CMGXFileManager.h>
+#endif
+
 #include    <DcfEntry.h>
 #include    <DcfRep.h>
 
@@ -614,8 +619,6 @@
                 if( iClAppInstance )
                     {
                     SetDownloadStatus( EHttpProgNone, EHttpDlDeleting );
-                    //Deref Attach Download instance
-                    aClAppInstance->ClientApp()->UnregisterDownload( this ); 
                     return;
                     }
                 }
@@ -625,8 +628,6 @@
                 if( iPDClAppInstance )
                     {
                     SetDownloadStatus( EHttpProgNone, EHttpDlDeleting );
-                    //Deref Master Client Instance
-                    aClAppInstance->ClientApp()->UnregisterDownload( this );                    
                     return;
                     }
                 }        
@@ -672,7 +673,7 @@
 	        CLOG_WRITE("Keep file");
 	        closeOp = CHttpStorage::EKeepFile;
 	        }
-    
+	        
 	if( iStorage->RFileSetByClient())
 	    {
 	    TBool pausable;
@@ -682,6 +683,7 @@
             CLOG_WRITE("Keep file");
 	        closeOp = CHttpStorage::EKeepFile;
             }
+		
 	    }
     if( iCodDlData )
 	    {
@@ -721,7 +723,7 @@
     	iStorage->CloseDestinationFile( closeOp );
     	}
     // when delete there's no store -> no leave
-    aClAppInstance->ClientApp()->UnregisterDownload( this ); 
+    //  aClAppInstance->ClientApp()->UnregisterDownload( this ); 
     }
 
 
@@ -7025,6 +7027,9 @@
 
 	LOGGER_ENTERFN( "CHttpDownload::NotifyMediaGalleryL" );
     CLOG_WRITE_1(" notifying Gallery and DcfReposory about move for: %S",&aFileName);
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF    
+    
     //
     // Notify Media Gallery about new media file
     CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
@@ -7039,6 +7044,8 @@
         TRAP_IGNORE( mgFileManager->UpdateL() );
         }
     CleanupStack::PopAndDestroy( mgFileManager );
+    
+#endif    
     //
     // Notify DCF repository
     TRAP_IGNORE( UpdateDCFRepositoryL( aFileName ) );
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Data/DownloadMgrUiLib.rss	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Data/DownloadMgrUiLib.rss	Fri May 08 08:25:06 2009 +0300
@@ -310,6 +310,8 @@
 RESOURCE TBUF r_dmul_download_content_saved_to_gallery { buf = qtn_browser_downloads_content_saved_to_gallery; }
 
 RESOURCE TBUF r_dmul_download_content_saved_to_downloads_folder { buf =  qtn_dl_saved_to_folder; } 
+RESOURCE TBUF r_dmul_download_file_saved { buf =  qtn_browser_downloads_file_saved; } 
+RESOURCE TBUF r_dmul_download_files_saved { buf =  qtn_browser_downloads_files_saved; } 
 
 RESOURCE MENU_BAR r_dmul_downloadslist_menubar
     {
@@ -385,6 +387,22 @@
     }
 
 
+RESOURCE AIW_INTEREST r_dmul_filemanager_aiw_interest
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM
+            {
+            id = KAiwCmdEdit;
+            serviceCmd = KAiwCmdEdit;
+            contentType = "*";
+            serviceClass = KAiwClassBase; 
+            defaultProvider = 0x200110F9; // The service UID
+            maxProviders = 1;
+            }
+        };
+    }
+
 RESOURCE TBUF r_dmul_download_del_conf { buf = qtn_query_common_conf_delete; } 
 RESOURCE TBUF r_dmul_download_can_conf { buf = qtn_browser_downloads_query_cancel; }
 
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Group/DownloadMgrUiLib.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Group/DownloadMgrUiLib.mmp	Fri May 08 08:25:06 2009 +0300
@@ -123,7 +123,11 @@
 LIBRARY         DRMCommon.lib
 LIBRARY         DrmRights.lib
 LIBRARY         DrmServerInterfaces.lib
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 LIBRARY			MGXMediaFileAPI.lib
+#endif
+
 LIBRARY			DcfRep.lib
 LIBRARY         centralrepository.lib 
 LIBRARY         caf.lib
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Inc/CDownloadsListArray.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Inc/CDownloadsListArray.h	Fri May 08 08:25:06 2009 +0300
@@ -213,11 +213,17 @@
         
 
         HBufC* iSavedToDownloadsFolderString;
+        
+        HBufC* iFileSavedString;
+        HBufC* iFilesSavedString;
 
         HBufC* iNullDesC; ///< Owned.
 
         CApaMaskedBitmap* iApaMaskedBitmap; ///< Temp storage. Owned.
         
+        TBool                       iPlatformSupportsGallery;
+        
+        
      
     };
 
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadMgrUiDownloadsList.cpp	Fri May 08 08:25:06 2009 +0300
@@ -18,6 +18,7 @@
 
 
 // INCLUDE FILES
+#include <platform/mw/Browser_platform_variant.hrh>
 #include    "CDownloadMgrUiDownloadsList.h"
 #include    "CDownloadMgrUiLibRegistry.h"
 #include    "CDownloadMgrUiDownloadMenu.h"
@@ -39,9 +40,13 @@
 #include    <uikon.hrh>
 #include    <AknServerApp.h>
 #include    <UriUtils.h>
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 #include    <MGXFileManagerFactory.h>
 #include    <CMGXFileManager.h>
 #include    <MediaGalleryUID.h>  //Gallery UIDs
+#endif
+
 #include    <DocumentHandler.h>
 #include    "bautils.h"
 #include    <BrowserUiSDKCRKeys.h>
@@ -55,6 +60,9 @@
 // CONSTANTS
 const TInt KUpdateProgressInfoInterval   = 2*1000000;  // 2 sec
 
+const TInt KMostRecentSort  = 2;  // Most Recent Sort in File Manager
+const TInt KLauchStandAlone = 1;  // Launch the File Manager in Stand Alone Mode
+
 _LIT8(KSisxContentType, "x-epoc/x-sisx-app");
 
 // FORWARD DECLARATIONS
@@ -705,7 +713,8 @@
     ( CDownloadMgrUiLibRegistry& aRegistryModel )
 :   CDownloadMgrUiBase( aRegistryModel ),
     iIsVisible( EFalse ),
-    iIsCancelInProgress( EFalse )
+    iIsCancelInProgress( EFalse ),
+    iPlatformSupportsGallery( EFalse )
     {
     }
 
@@ -731,6 +740,12 @@
 	iProgressiveDownload = EFalse;
 	iRegistryModel.DownloadMgr().GetBoolAttribute(EDlMgrProgressiveDownload, iProgressiveDownload);
     CLOG_LEAVEFN("CDownloadMgrUiDownloadsList::ConstructL");
+    
+    //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh
+    #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
+    iPlatformSupportsGallery = ETrue;
+    #endif
+  
     }
 
 // -----------------------------------------------------------------------------
@@ -1874,6 +1889,9 @@
     			   CleanupStack::PopAndDestroy( &rfs );
 
     			   // Notify Media Gallery about new media file
+    			   
+    			#ifdef BRDO_APP_GALLERY_SUPPORTED_FF   
+    			
     			   CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
     			       CEikonEnv::Static()->FsSession() );
     			   if( fileNamePtr.Length() > 0 )
@@ -1885,9 +1903,18 @@
     			       {
     			       TRAP_IGNORE( mgFileManager->UpdateL() );
     			       }
-
+    			 
     			   delete mgFileManager;
     			   mgFileManager = NULL;
+    			 
+    			 #else
+    			 
+    			  if( fileNamePtr.Length() > 0 )
+    			       {
+    			       TRAP_IGNORE( iUiUtils->UpdateDCFRepositoryL( fileNamePtr ) );
+    			       }
+    			 
+    			 #endif  
     			   
                 	}
                  else
@@ -2004,6 +2031,9 @@
 
         case EDownloadsListCmdGallery:
             {
+            
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
+            
             TVwsViewId id = TVwsViewId(
                 TUid::Uid( KMediaGalleryUID3 ),
                 TUid::Uid( KMediaGalleryListViewUID ) );
@@ -2015,31 +2045,54 @@
                     id, 
                     TUid::Uid( KMediaGalleryCmdMoveFocusToAllFilesTab ),
                     customMessage );
+#endif                    
             break;
             }
       
         case EDownloadsListCmdFileManager:
             {
+ 
+            if ( iPlatformSupportsGallery )
+                {
+            	LaunchFileManagerApplication();
+                }
+            else
+                {
+            	CAiwServiceHandler* serviceHandler = CAiwServiceHandler::NewL();
+                serviceHandler->AttachL( R_DMUL_FILEMANAGER_AIW_INTEREST );
             
-            TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
-            CRepository *repository=CRepository::NewL(KCRUidBrowser);
-            TInt fileManagerId;
-            User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId ));
-            TUid id = TUid::Uid(fileManagerId);
-            TApaTask task = taskList.FindApp( id );
-            if ( task.Exists() )
-            {
-            task.BringToForeground();
-            }
-            else 
-            {
-            RApaLsSession appArcSession;
-            User::LeaveIfError( appArcSession.Connect() );
-            CleanupClosePushL( appArcSession );
-            TThreadId id1;
-            User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) );  
-            CleanupStack::PopAndDestroy( &appArcSession );
-            }
+                CAiwGenericParamList* inParams = CAiwGenericParamList::NewLC();
+             
+                //get the destination file path
+                HBufC* fileName = HBufC::NewLC( KMaxPath );
+                TPtr fileNamePtr = fileName->Des();
+                User::LeaveIfError ( currDownload.GetStringAttribute( EDlAttrDestFilename, fileNamePtr ) );
+               
+                // Locate the last '\\' character and remove the file name so that we will get the folder name
+                TInt len = fileNamePtr.LocateReverse('\\');
+                TPtr ptr = fileNamePtr.LeftTPtr(len + 1);
+            
+                // Append the directory name to be opened
+                inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( ptr ) ) );
+                //Append the sort method
+                inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KMostRecentSort ) ) );
+                //Append to define whether to open in standalone mode
+                inParams->AppendL(TAiwGenericParam(EGenericParamDir, TAiwVariant( KLauchStandAlone ) ) );
+    
+                TRAPD( err, serviceHandler->ExecuteServiceCmdL( KAiwCmdEdit, *inParams, serviceHandler->OutParamListL() ));
+            
+    	   		CleanupStack::PopAndDestroy( fileName );
+            	CleanupStack::PopAndDestroy( inParams );
+        	
+        	    delete serviceHandler;
+        	    
+        	    //if there is any error, open the file manager in root folder
+                if (err != KErrNone)
+          	        {
+          	        LaunchFileManagerApplication();
+           		    }
+                }
+  
             break;
             }
          
@@ -2049,6 +2102,38 @@
             }
         }
     }
+    
+    
+// -----------------------------------------------------------------------------
+// CDownloadMgrUiDownloadsList::LaunchFileManagerApplication
+// -----------------------------------------------------------------------------
+//
+
+void CDownloadMgrUiDownloadsList::LaunchFileManagerApplication()
+{
+	
+    TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
+    CRepository *repository=CRepository::NewL(KCRUidBrowser);
+    TInt fileManagerId;
+    User::LeaveIfError(repository->Get(KFileManagerUid , fileManagerId ));
+    TUid id = TUid::Uid(fileManagerId);
+    TApaTask task = taskList.FindApp( id );
+    if ( task.Exists() )
+        {
+        task.BringToForeground();
+        }
+    else 
+        {
+        RApaLsSession appArcSession;
+        User::LeaveIfError( appArcSession.Connect() );
+        CleanupClosePushL( appArcSession );
+        TThreadId id1;
+        User::LeaveIfError( appArcSession.StartDocument( KNullDesC, id, id1 ) );  
+        CleanupStack::PopAndDestroy( &appArcSession );
+        }
+	
+}
+
 
 // -----------------------------------------------------------------------------
 // CDownloadMgrUiDownloadsList::DynInitMenuPaneL
@@ -2167,7 +2252,9 @@
             }
             
         // For any gallery supported download,  "go to gallery" option should be displayed in the download list option when the download completes     
-        if ( !( isCompleted && s60Supported && gallerySupported ) )
+        
+        
+        if ( (!( isCompleted && s60Supported && gallerySupported ) ) || (!iPlatformSupportsGallery) )
             {
 			aMenuPane->DeleteMenuItem( EDownloadsListCmdGallery );
     		}
@@ -2284,12 +2371,15 @@
         if ( !( 1 < downloadCount ) )
             {
             aMenuPane->DeleteMenuItem( EDownloadsListCmdCancelAll );
-            }                               
-       	
-        if ( isCompleted && gallerySupported && s60Supported )
-            {
-            aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager );
-            }  
+            }              
+                             
+       	if ( iPlatformSupportsGallery )
+       	    {
+       		if ( isCompleted && gallerySupported && s60Supported )
+                {
+                aMenuPane->DeleteMenuItem( EDownloadsListCmdFileManager );
+                }
+       	    }
         }
         
     if ( wasCompleted && !isThemeType ) 
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListArray.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CDownloadsListArray.cpp	Fri May 08 08:25:06 2009 +0300
@@ -18,6 +18,7 @@
 
 
 // INCLUDE FILES
+#include <platform/mw/Browser_platform_variant.hrh>
 #include    "CDownloadsListArray.h"
 #include    "ProgressInfoCreator.h"
 #include    "DMgrUiLibPanic.h"
@@ -32,7 +33,11 @@
 #include    <f32file.h>
 #include    <AknsUtils.h>
 #include    <DocumentHandler.h>
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 #include    <MediaGalleryUid.h>
+#endif
+
 #include    "CDownloadUtils.h"
 #include    <HttpDownloadMgrCommon.h>
 #include    "CUserInteractionsUtils.h"
@@ -75,7 +80,8 @@
 //
 CDownloadsListArray::CDownloadsListArray()
 :   iCoeEnv( *CCoeEnv::Static() ),
-    iOwnedExt( EFalse )
+    iOwnedExt( EFalse ),
+    iPlatformSupportsGallery ( EFalse )
     {
     }
 
@@ -103,11 +109,21 @@
     CLOG_WRITE(" iSavedToGalleryString OK");
 	iSavedToDownloadsFolderString=  iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_CONTENT_SAVED_TO_DOWNLOADS_FOLDER);
 	CLOG_WRITE(" iSavedToGalleryDownload OK");
+	iFileSavedString = iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_FILE_SAVED );
+	iFilesSavedString = iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_FILES_SAVED );
+
+	
     iNullDesC = KNullDesC().AllocL();
     CLOG_WRITE(" iNullDesC OK");
     User::LeaveIfError( iApaLsSess.Connect() );
     CLOG_WRITE(" iApaLsSess OK");
     
+        
+    //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh
+    #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
+    iPlatformSupportsGallery = ETrue;
+    #endif
+    
 
     // Initialize the UiLib' mbm file name:
     TParse* fileParser = new (ELeave) TParse;
@@ -172,6 +188,10 @@
 	iSavedToGalleryString = 0;
 	delete iSavedToDownloadsFolderString;
 	iSavedToDownloadsFolderString=0;
+	delete iFileSavedString;
+	iFileSavedString = 0;
+	delete iFilesSavedString;
+	iFilesSavedString = 0;
     delete iNullDesC;
     iNullDesC = 0;
     iApaLsSess.Close();
@@ -369,30 +389,44 @@
             }
                     
         iProgressInfoRes.Zero();
-        TBool supported( EFalse );
-        TRAP_IGNORE(supported=IsSupportedL(aDownloadUiData));     
 
 		if ( aDownloadUiData.iDownloadState == EHttpDlMultipleMOCompleted ) 
-			{ 
- 		     if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged )
-				{
- 				if( supported )
-				   {
-				    iProgressInfoRes.Copy
-					        ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) );				    
-				   }
-				else
-                   {
-                	iProgressInfoRes.Copy
-			                ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) );                      
-                   }				    
-				}				
-	     else
-    	    {
- 
-          iProgressInfoRes.Copy
-		    	( iCompletedString->Left( KMaxDownloadItemTextPartLength ) );  	
-					
+		    { 
+ 		    if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged )
+			    {
+			    if ( iPlatformSupportsGallery )
+			        {
+			    	TBool supported( EFalse );
+                    TRAP_IGNORE(supported = IsSupportedL(aDownloadUiData)); 
+ 				    if( supported )
+				        {
+				        iProgressInfoRes.Copy
+					                    ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) );				    
+				        }
+				    else
+                        {
+                	    iProgressInfoRes.Copy
+			                            ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) );                      
+                        }
+			        }
+			    else
+			        {
+			        if (aDownloadUiData.iNumMediaObjects > 1)
+			            {
+			        	iProgressInfoRes.Copy
+			                            ( iFilesSavedString->Left( KMaxDownloadItemTextPartLength ) );                      
+			            }
+			        else
+			            {
+			        	iProgressInfoRes.Copy
+			                            ( iFileSavedString->Left( KMaxDownloadItemTextPartLength ) );                      
+			            }     
+                    }    
+			    }				
+	        else
+    	        {
+                iProgressInfoRes.Copy
+		    	        ( iCompletedString->Left( KMaxDownloadItemTextPartLength ) );  	
 				}
 			}
         else
@@ -457,31 +491,46 @@
         indexStr.Format( KIndexString, aDownloadUiData.iActiveMoIndex, aDownloadUiData.iNumMediaObjects );
         ret += indexStr.Length();
         }
-    
-    TBool supported( EFalse );
-    TRAP_IGNORE(supported=IsSupportedL(aDownloadUiData));     
        
     iProgressInfoRes.Zero();
 	if ( aDownloadUiData.iDownloadState == EHttpDlMultipleMOCompleted ) 
-		{ 
-		 if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged )
-			{
-		     if( supported )
-		        {
-		        iProgressInfoRes.Copy
-				        ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) );
-		        }
-		     else
+	    { 
+		if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged )
+		    {
+		    if ( iPlatformSupportsGallery )
 		        {
-            	iProgressInfoRes.Copy
-			            ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) );  
+		        TBool supported( EFalse );
+                TRAP_IGNORE(supported=IsSupportedL(aDownloadUiData));  
+		        if( supported )
+		            {
+		            iProgressInfoRes.Copy
+				                    ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) );
+		            }
+		        else
+		            {
+            	    iProgressInfoRes.Copy
+			                        ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) );  
+		            }
 		        }
+		    else
+		        {
+		        if (aDownloadUiData.iNumMediaObjects > 1)
+			        {
+			        iProgressInfoRes.Copy
+			                        ( iFilesSavedString->Left( KMaxDownloadItemTextPartLength ) );                      
+			        }
+			    else
+			        {
+			       	iProgressInfoRes.Copy
+			                        ( iFileSavedString->Left( KMaxDownloadItemTextPartLength ) );                      
+			        }    
+		        }    
 			}
-		 else
-			{
-             iProgressInfoRes.Copy
-			       ( iCompletedString->Left( KMaxDownloadItemTextPartLength ) );  	
-			}
+		else
+		    {
+            iProgressInfoRes.Copy
+			                 ( iCompletedString->Left( KMaxDownloadItemTextPartLength ) );  	
+		    }
         }
      //finished  here   
     else
@@ -576,11 +625,16 @@
 
     // Use Media Gallery's icon instead of Image Viewer, because IV's icon 
     // does not support skins, but MG's icon does support it.
+    
+  
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF    
+
     if ( appFound && appUid == TUid::Uid(KImageViewerHandler) )
         {
         appUid = TUid::Uid(KMediaGalleryUID3);
         }
-        
+#endif
+
     // Load the proper icon.
     CFbsBitmap* bitmap = 0;
     CFbsBitmap* mask = 0;
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CUserInteractionsUtils.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/CUserInteractionsUtils.cpp	Fri May 08 08:25:06 2009 +0300
@@ -18,6 +18,7 @@
 
 
 // INCLUDE FILES
+#include <platform/mw/Browser_platform_variant.hrh>
 #include    "CUserInteractionsUtils.h"
 #include    "MDownloadHandlerObserver.h"
 #include    "CDownloadMgrUiBase.h"
@@ -56,8 +57,11 @@
 #include    <rconnmon.h>
 #include    <DcfEntry.h>
 #include    <DcfRep.h>
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 #include    <MGXFileManagerFactory.h>
 #include    <CMGXFileManager.h>
+#endif
 
 // LOCAL CONSTANTS AND MACROS
 const TInt KErrorUiHttpStatusBase = -25000;
@@ -906,9 +910,13 @@
 	   
         if(iCodDownload)
 			{
+			
+			#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 			CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
 	        CEikonEnv::Static()->FsSession() );
 	        
+	        #endif
+	        
 	        //Assume that all files to be deleted are valid.
 	        TBool fileNotFound = EFalse;
 	        
@@ -930,6 +938,8 @@
                     }
 
                 rfs.Delete( fileNamePtr );
+                
+                #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
                 // Notify Media Gallery about new media file
                 if( fileNamePtr.Length() > 0 )
                    {
@@ -940,11 +950,23 @@
                    {
                    TRAP_IGNORE( mgFileManager->UpdateL() );
                    }
+                 
+                 #else
+                    if( fileNamePtr.Length() > 0 )
+                   {
+                   TRAP_IGNORE( UpdateDCFRepositoryL( fileNamePtr ) );
+                   }
+                  
+                 #endif  
+                   
                 CleanupStack::PopAndDestroy( &rfs );
                 CleanupStack::PopAndDestroy( fileName );    
                 }
+                
+                #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
                 delete mgFileManager;
                 mgFileManager = NULL;
+                #endif
                 
                 //Inform the user that atleast one file not found.	
 	   		    if(fileNotFound)
@@ -1754,13 +1776,14 @@
                 (
                     appArcSession.StartDocument( *param, pdPlayerUid, id )
                 );
-            if( aProgressively )
-                {
-                User::LeaveIfError( aDownload.SetIntAttribute( EDlAttrActivePlayedDownload, activeDownloadID ) );
-                }            
+                     
             CleanupStack::PopAndDestroy( &appArcSession );
             CleanupStack::PopAndDestroy( param );
             }
+        if( aProgressively )
+            {
+            User::LeaveIfError( aDownload.SetIntAttribute( EDlAttrActivePlayedDownload, activeDownloadID ) );
+            }   
 
         CleanupStack::PopAndDestroy( param8 );
 		CleanupStack::PopAndDestroy( fileName );
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/Src/UserInteractionsEventHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/Src/UserInteractionsEventHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -18,6 +18,7 @@
 
 
 // INCLUDE FILES
+#include <platform/mw/Browser_platform_variant.hrh>
 #include    "UserInteractionsEventHandler.h"
 #include    "CUserInteractionsUtils.h"
 #include    "ProgressInfoCreator.h"
@@ -38,8 +39,12 @@
 #include    <etelpckt.h>
 #include    <AknNoteDialog.h>
 #include    <UriUtils.h>
+
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 #include    <MGXFileManagerFactory.h>
 #include    <CMGXFileManager.h>
+#endif
 
 #include    <pathinfo.h>
 #include    <driveinfo.h>
@@ -936,6 +941,8 @@
             EDlAttrDestFilename, fileNamePtr );
         CLOG_WRITE_FORMAT(" EDlAttrDestFilename: %S",&fileNamePtr);
         TBool havePath = (attErr == KErrNone) && (fileNamePtr.Length() > 0);
+        
+        #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
         //
         CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
             CEikonEnv::Static()->FsSession() );
@@ -948,10 +955,19 @@
             {
             TRAP_IGNORE( mgFileManager->UpdateL() );
             }
-        CleanupStack::PopAndDestroy( fileName );
+        
         delete mgFileManager;
         mgFileManager = NULL;
         
+        #else
+         if( havePath )
+            {
+            TRAP_IGNORE( iUiUtils.UpdateDCFRepositoryL( fileNamePtr ) );
+            }
+        #endif    
+        
+        CleanupStack::PopAndDestroy( fileName );
+        
         }
     else
         {
--- a/browserutilities/downloadmgr/DownloadMgrUiLib/loc/DownloadMgrUiLib.loc	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrUiLib/loc/DownloadMgrUiLib.loc	Fri May 08 08:25:06 2009 +0300
@@ -388,4 +388,18 @@
 //
 #define qtn_browser_downloads_cancel_all "Cancel All"
 
+//d:Shown for completed downloads in Downloads List, if gallery is not supported
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:7.1
+//
+#define qtn_browser_downloads_file_saved "File Saved"
+
+//d:Shown for completed downloads in Downloads List for Album download(more than one media object), if gallery is not supported
+//l:list_double_large_graphic_pane_t2_cp2
+//w:
+//r:7.1
+//
+#define qtn_browser_downloads_files_saved "Files Saved"
+
 // End of File
--- a/browserutilities/feedsengine/FeedsServer/Server/src/FeedsDatabase.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/feedsengine/FeedsServer/Server/src/FeedsDatabase.cpp	Fri May 08 08:25:06 2009 +0300
@@ -2941,6 +2941,7 @@
     TPtrC  description(KNullDesC);
     TPtrC  link(KNullDesC);
     TPtrC  itemIdStr(KNullDesC);
+    TBool  isNewItem(EFalse);
 
     // Get the values.
     for (TInt i = 0; i < aAttributes.Count(); i++)
@@ -2968,25 +2969,6 @@
                 break;                
             }
         }
-    
-    // Ignore the item if it is already in the database.
-    // TODO: Don't ignore it if the timestamp changes.  In this case 
-    //       the item needs to be updated below rather than inserted.
-    TInt  id;
-    
-    if (FindItemL(aFeedId, itemIdStr, id))
-        {
-        // If the item is found then append it's id to aItemIds.
-        aItemIds.AppendL(id);
-
-        return EFalse;
-        }
-        
-    // Otherwise this is a new item so append the provided id to aItemIds.
-    else
-        {
-        aItemIds.AppendL(aItemId);
-        }
 
     // If timeStamp was provided convert it into a TTime otherwise just
     // use the current time.
@@ -3004,11 +2986,51 @@
         {
         date.UniversalTime();
         }
-        
-    // Update the database.
-    iItemTable.Reset();
-    iItemTable.InsertL();
-    
+
+    // Ignore the item if it is already in the database.
+    // If the timestamp chnages the item needs to be updated 
+    // rather than inserted.
+    TInt  id;
+
+    if (FindItemL(aFeedId, itemIdStr, id))
+        {
+        TDbSeekKey  seekKey( id );
+        // Update the database.
+        iItemTable.SeekL(seekKey);
+        iItemTable.GetL();
+
+        TBuf<(KMaxTimeFormatSpec + KMaxShortDateFormatSpec) * 2>  previousTimestamp;
+        TTime previousDate = iItemTable.ColTime(iItemColSet->ColNo(KDate));
+        previousDate.FormatL(previousTimestamp, TTimeFormatSpec());
+
+        if (date == previousDate)
+            {
+            // If the item is found and timestamp remains same then just 
+            // append it's id to aItemIds.
+            aItemIds.AppendL(id);
+            return isNewItem;
+            }
+        else
+            {
+            // If the item is found and the timestamp has changed then make sure that 
+            // the new itemId is appened to aItemIds.
+            aItemIds.AppendL(aItemId);
+            iItemTable.GetL();
+            iItemTable.UpdateL();
+            }
+        }
+
+    // Otherwise this is a new item so append the provided id to aItemIds.
+    else
+        {
+        aItemIds.AppendL(aItemId);
+
+        // Update the database.
+        iItemTable.Reset();
+        iItemTable.InsertL();
+        isNewItem = ETrue;
+        }
+
     iItemTable.SetColL(iItemColSet->ColNo(KItemId), aItemId);
     iItemTable.SetColL(iItemColSet->ColNo(KFeedId), aFeedId);
     iItemTable.SetColL(iItemColSet->ColNo(KDate), date);
@@ -3017,10 +3039,9 @@
     WriteLongTextL(iItemTable, iItemColSet->ColNo(KDescription), description);
     WriteLongTextL(iItemTable, iItemColSet->ColNo(KWebUrl), link);
     WriteLongTextL(iItemTable, iItemColSet->ColNo(KItemIdStr), itemIdStr);
-    
+
     iItemTable.PutL();
-    
-    return ETrue;
+    return isNewItem;
     }
     
     
@@ -4505,6 +4526,7 @@
         HBufC* idStr = NULL;
         ReadLongTextL(iItemTable, iItemColSet->ColNo(KItemIdStr), idStr);
         CleanupStack::PushL(idStr);
+        TPtrC idStrPtr(idStr->Des());
 
         switch( itemStatus )
             {
@@ -4512,21 +4534,21 @@
                 {
                 FEED_LOG6(_L("Feeds"), _L("Feeds_DB.log"), 
                     EFileLoggingModeAppend, _L("%d\t%d\t%S\t%S\t%S\t%S"), 
-                    itemId, feedId, &KUnread(), &idStr->Des(), &title, &timestamp);
+                    itemId, feedId, &KUnread(), &idStrPtr, &title, &timestamp);
                 }
                 break;
             case EReadItem:
-                {            
+                {
                 FEED_LOG6(_L("Feeds"), _L("Feeds_DB.log"), 
                     EFileLoggingModeAppend, _L("%d\t%d\t%S\t%S\t%S\t%S"), 
-                    itemId, feedId, &KRead(), &idStr->Des(), &title, &timestamp);
+                    itemId, feedId, &KRead(), &idStrPtr, &title, &timestamp);
                 }
                 break;
             case ENewItem:
-                {            
+                {
                 FEED_LOG6(_L("Feeds"), _L("Feeds_DB.log"), 
                     EFileLoggingModeAppend, _L("%d\t%d\t%S\t%S\t%S\t%S"), 
-                    itemId, feedId, &KNew(), &idStr->Des(), &title, &timestamp);
+                    itemId, feedId, &KNew(), &idStrPtr, &title, &timestamp);
                 }
                 break;
             }
--- a/browserutilities/schemehandler/SchemeDispatcher/src/RtspHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/schemehandler/SchemeDispatcher/src/RtspHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -153,7 +153,7 @@
     CLOG_WRITE(" :iDocHandler->OpenTempFileL() ok");
     CleanupClosePushL( ramDocTempFile );
     //
-    TDataType dataType( _L8("audio/x-pn-realaudio") );
+    TDataType dataType( _L8("audio/x-pn-realaudio-plugin") );
     CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
     TAiwVariant filename( _L8("c:\\system\\temp\\RtspTemp.ram") );
     TAiwGenericParam param( EGenericParamFile, filename );
Binary file browserutilities/webutils/conf/webutils.confml has changed
Binary file browserutilities/webutils/conf/webutils.confml.bak has changed
--- a/browserutilities/webutils/src/CUserAgent.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/webutils/src/CUserAgent.cpp	Fri May 08 08:25:06 2009 +0300
@@ -32,7 +32,7 @@
 #define KPlaceHolderMozillaVer		_L("Mozilla/5.0")
 #define KPlaceHolderSecurity		_L("U;")
 #define KPlaceHolderComponent		_L("AppleWebKit/525 (KHTML, like Gecko) Version/3.0 Safari/525")
-#define KPlaceHolderBrowserNG		_L("BrowserNG")
+#define KPlaceHolderBrowserName		_L("WicKed")
 
 #define KPlaceHolderSlash           _L("/")
 #define KPlaceHolderSymbianOS       _L("SymbianOS")
@@ -411,9 +411,7 @@
 	aUAStringPtr.Append(KPlaceHolderClose);
 	
 	aUAStringPtr.Append(KSpaceChar);
-	aUAStringPtr.Append(KPlaceHolderBrowserNG);
-	aUAStringPtr.Append(KSpaceChar);
-	aUAStringPtr.Append(iBrowserVersionStr->Des());
+	aUAStringPtr.Append(iBrowserNameAndVersionStr->Des());
 
 	aUAStringPtr.Append(KSpaceChar);
 	aUAStringPtr.Append(KPlaceHolderComponent);
@@ -717,8 +715,8 @@
 	TInt length = KMaxBrowserVersionStringLength  + KMaxBrowserNameLength;
 	iBrowserNameAndVersionStr = HBufC::NewL( length);
 
-	iBrowserNameAndVersionStr->Des().Append(KPlaceHolderBrowserNG);			
-	iBrowserNameAndVersionStr->Des().Append(KSpaceChar);  // add a gap
+	iBrowserNameAndVersionStr->Des().Append(KPlaceHolderBrowserName);			
+	iBrowserNameAndVersionStr->Des().Append(KPlaceHolderSlash);
 	iBrowserNameAndVersionStr->Des().Append( *iBrowserVersionStr );
 }
 // End of file
--- a/browserutilities/xmlparser/group/XMLInterface.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/browserutilities/xmlparser/group/XMLInterface.mmp	Fri May 08 08:25:06 2009 +0300
@@ -61,7 +61,7 @@
 LIBRARY		charconv.lib 
 LIBRARY		cxmlparser.lib
 
-LANG			SC
+LANGUAGE_IDS
 /*
 START WINS      
 ?wins_specific_information
--- a/codhandler/codeng/group/CodEng.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/codhandler/codeng/group/CodEng.mmp	Fri May 08 08:25:06 2009 +0300
@@ -113,7 +113,11 @@
 LIBRARY     avkon.lib 
 LIBRARY     commonengine.lib
 LIBRARY     cone.lib 
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 LIBRARY     MGXMediaFileAPI.lib
+#endif
+
 LIBRARY     DcfRep.lib
 LIBRARY     estor.lib
 
--- a/codhandler/codeng/src/FileSaver.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/codhandler/codeng/src/FileSaver.cpp	Fri May 08 08:25:06 2009 +0300
@@ -19,7 +19,7 @@
 
 
 // INCLUDE FILES
-
+#include <platform/mw/Browser_platform_variant.hrh>
 #include "FileSaver.h"
 #include "CodBuffStorage.h"
 #include "CodLoadObserver.h"
@@ -35,8 +35,12 @@
 #include <HttpDownloadMgrCommon.h>
 #include <DocumentHandler.h>
 #include <pathinfo.h>
+
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 #include <MGXFileManagerFactory.h>
 #include <CMGXFileManager.h>
+#endif
+
 #include <DcfEntry.h>
 #include <DcfRep.h>
 
@@ -603,12 +607,16 @@
 // knows update its view.
 // ---------------------------------------------------------
 // 
+
+
 void CFileSaver::UpdateMediaGalleryIfNeededL( const TDesC& aFileName )
-    {       
+    {
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF           
     CMGXFileManager* fm = MGXFileManagerFactory::NewFileManagerL( iFs );
     CleanupStack::PushL(fm);
     fm->UpdateL(aFileName);
     CleanupStack::PopAndDestroy(); // fm
+#endif    
     }
 // ---------------------------------------------------------
 // CFileSaver::NotifyMediaGalleryL()
@@ -617,6 +625,8 @@
 // 
 void CFileSaver::NotifyMediaGalleryL( const TDesC& aFileName )
     {
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF    
+    
     CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( iFs );
     CleanupStack::PushL( mgFileManager );
 
@@ -625,6 +635,9 @@
 
     // Notify Media Gallery
     TRAP_IGNORE( UpdateMediaGalleryIfNeededL( aFileName ) );
+
+#endif
+    
     
     // Notify DCF repository
     TRAP_IGNORE( UpdateDCFRepositoryL( aFileName ) );
--- a/web_plat/browser_dialogs_provider_api/inc/BrowserDialogsProvider.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_plat/browser_dialogs_provider_api/inc/BrowserDialogsProvider.h	Fri May 08 08:25:06 2009 +0300
@@ -31,6 +31,7 @@
 // Tooltip
 const TInt KDefaultTooltipDelay = 1;        // time in milliseconds
 const TInt KDefaultTooltipDuration = 2000;  // time in milliseconds
+const TInt KErrTooManyRedirects  = -20019;
 
 // FORWARD DECLARATIONS
 class CBrowserSelectElementDlg;
@@ -343,9 +344,7 @@
         MBrowserDialogsProviderObserver* iObserver;         // not ownedCBrowserDialogsProvider
 
         RConeResourceLoader iResourceLoader;
-        TBool iResourceOpened;
-
-        RConeResourceLoader iErrResourceLoader;
+        TBool iResourceOpened;	  			  
         TBool iErrResourceOpened;
 
         // Reusable tooltip
--- a/web_plat/browser_platform_api/inc/Browser_platform_variant.hrh	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_plat/browser_platform_api/inc/Browser_platform_variant.hrh	Fri May 08 08:25:06 2009 +0300
@@ -66,6 +66,8 @@
 // Defines WRT widgets feature to publish on homescreen
 #define BRDO_WRT_HS_FF
 
+// Gallery App is not present
+#undef BRDO_APP_GALLERY_SUPPORTED_FF
 /*
 * ===================
 *        S60 3.23
@@ -91,9 +93,11 @@
 
 #undef BRDO_WRT_HS_FF
 
+// Gallery App is present
+#define BRDO_APP_GALLERY_SUPPORTED_FF
 // Missing from ProductVariant.hrh
 #ifndef LANGUAGE_IDS
-#define LANGUAGE_IDS LANG sc 01 02 03 04 05 06 07 08 09 10 13 14 15 16 17 18 25 26 27 28 29 30 31 32 33 37 39 42 44 45 49 50 51 54 57 58 59 67 68 70 76 78 79 83 93 94 96 102 103 129 157 158 159 160 161 230 326 327
+#define LANGUAGE_IDS LANG sc
 #endif
 
 #define BRDO_APP_VERSION_MAJOR 7
--- a/web_plat/rt_gesturehelper_api/group/bld.inf	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_plat/rt_gesturehelper_api/group/bld.inf	Fri May 08 08:25:06 2009 +0300
@@ -21,7 +21,7 @@
 DEFAULT
 
 PRJ_EXPORTS
-../inc/rt_gesturecontrol.h   MW_LAYER_PLATFORM_EXPORT_PATH(rt_gesturecontrol.h)
+
 ../inc/rt_gesturehelper.h    MW_LAYER_PLATFORM_EXPORT_PATH(rt_gesturehelper.h)
 ../inc/rt_gestureobserver.h  MW_LAYER_PLATFORM_EXPORT_PATH(rt_gestureobserver.h)
 
--- a/web_plat/rt_gesturehelper_api/inc/rt_gesturecontrol.h	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture control
-*
-*/
-
-
-#ifndef _RT_GESTURECONTROL_H_
-#define _RT_GESTURECONTROL_H_
-
-#include <alf/alfcontrol.h>
-
-class CAlfEnv;
-class CAlfDisplay;
-
-namespace RT_GestureHelper
-{
-
-class CGestureHelper;
-class MGestureObserver;
-
-/** 
- * Gesture control provides pointer event forwarding to gesture helper.
- * 
- * Gesture control can be created as
- *  - Stand-alone: This functionality is usable by clients that want to 
- *    capture pointer events from anywhere in the screen. For example, a view 
- *    that wants to know if user tapped anywhere on the screen could use this. 
- *  - Derived: client can use the forward-pointer-events-to-gesture-helper
- *    functionality by deriving from CGestureControl. Client has to create at 
- *    least one visual that captures pointer events. This base class will 
- *    receive the events and forward them to CGestureHelper.
- * 
- * The client can keep other widgets on top of this control, to allow them
- * priority of capturing the pointer events.
- */
-class CGestureControl : public CAlfControl
-    {
-public:
-    /** 
-     * Creates a stand-alone gesture control. 
-     * Creates a full screen visual that captures pointer events. Converts
-     * pointer events to gestures and calls back on aObserver.
-     * @param aFreeControlGroupId control group id that client does not use
-     */
-    IMPORT_C static CGestureControl* NewLC( MGestureObserver& aObserver,
-        CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId );
-    
-    /** Destructor */
-    IMPORT_C ~CGestureControl();
-    
-    // From CAlfControl
-    IMPORT_C TBool OfferEventL( const TAlfEvent& aEvent );
-    
-    /** @see CGestureHelper::SetHoldingEnabled */
-    IMPORT_C void SetHoldingEnabled( TBool aEnabled );
-    /** @see CGestureHelper::IsHoldingEnabled */
-    IMPORT_C TBool IsHoldingEnabled() const;    
-    /** @see CGestureHelper::SetDoubleTapEnabled */
-    IMPORT_C void SetDoubleTapEnabled( TBool aEnabled );
-    /** @see CGestureHelper::IsDoubleTapEnabled */
-    IMPORT_C TBool IsDoubleTapEnabled() const;
-        
-protected:
-    /** Constructor */
-    IMPORT_C CGestureControl();
-    
-    /**
-     * Deriving class is expected to create a visual to receive pointer events.
-     * This base class does not create a visual (unless creates via NewLC, i.e.,
-     * in that case this class is not derived from)
-     * @param aFreeControlGroupId control group id that client does not use
-     */
-    IMPORT_C void ConstructL( MGestureObserver& aObserver,
-        CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId );
-
-private:
-    /// Helper that provides gestures
-    CGestureHelper* iHelper;
-    };
-
-} // namespace RT_GestureHelper
-
-#endif // _RT_GESTURECONTROL_H_
--- a/web_plat/rt_gesturehelper_api/inc/rt_gestureobserver.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_plat/rt_gesturehelper_api/inc/rt_gestureobserver.h	Fri May 08 08:25:06 2009 +0300
@@ -15,15 +15,11 @@
 *
 */
 
-
 #ifndef _RT_GESTUREOBSERVER_H_
 #define _RT_GESTUREOBSERVER_H_
 
 #include <e32std.h>
 
-class CAlfControl;
-class CAlfVisual;
-
 namespace RT_GestureHelper
 {
 
@@ -78,78 +74,45 @@
 /**
  * a gesture event
  */
-class MGestureEvent
+
+enum TAxis
     {
-public:
-    /** X and Y axes, or both */
-    enum TAxis
-        {
-        EAxisBoth,
-        EAxisHorizontal,
-        EAxisVertical
-        };
+    EAxisBoth,
+    EAxisHorizontal,
+    EAxisVertical
+    };
+
 
-public:
-    /**
-     * @param aRelevantAxis indicates whether only x, y or both coordinates 
-     *        should be considered when determining the code. For example,
-     *        if client specifies EAxisVertical as relevant axis, a swipe
-     *        to left and slightly up would result in an "swipe up" code,
-     *        and not "swipe left" code. If client specifies EAxisHorizontal
-     *        or EAxisBoth, "swipe left" code is returned.
-     * @return gesture code
-     */
-    virtual TGestureCode Code( TAxis aRelevantAxis ) /* const */ = 0;
-    
-    /** 
-     * @return ETrue if user has activated holding 
-     *         (by keeping stylus in the same position for longer time)
-     *         EFalse if holding has not been activated
-     */
-    virtual TBool IsHolding() const = 0;
-    
-    /** 
-     * @return position where gesture started, i.e., where stulys 
-     * was pressed down 
-     */
-    virtual TPoint StartPos() const = 0;
+class TGestureEvent
+{
+public:    
+    inline TGestureCode Code( TAxis /*aRelevantAxis*/ ) const { return iCode; };
+    inline TBool IsHolding() const { return iIsHolding; };
+    inline TPoint StartPos() const { return iStartPos; };
+    inline TPoint CurrentPos() const { return iCurrPos; }; 
+    inline TRealPoint Speed() const { return iSpeed; };
+    inline TRealPoint SpeedPercent ( const TRect& /*aEdges*/ ) const { return iSpeedPercent; };
+    inline TPoint Distance() const { return iDistance; }; 
     
-    /** 
-     * @return current position of the stylus
-     */
-    virtual TPoint CurrentPos() const = 0; 
+    inline void SetCurrentPos(TPoint aPos) { iCurrPos = aPos; };
+    inline void SetStartPos(TPoint aPos) {iStartPos = aPos; };
+    inline void SetCode(TGestureCode aCode) {iCode = aCode; };
+    inline void SetSpeed(TRealPoint aSpeed) { iSpeed = aSpeed; };
+    inline void SetDistance(TPoint aDistance) { iDistance = aDistance; };
+    inline void SetSpeedPercent(TRealPoint aSpeedPercent) { iSpeedPercent = aSpeedPercent; };
     
-    /** 
-     * @return speed of a swipe. unit is pixels per second.
-     */
-    virtual TRealPoint Speed() const = 0;
+    inline void SetIsHolding(TBool aIsHolding) { iIsHolding = aIsHolding; };
     
-    /**
-     * Abstracts the algorithm to calculate speed during swipe and hold. This
-     * algorithm (currently) assumes that max speed is achieved at the edges of an
-     * area.
-     * @param aEdges represents the coordinates of the rectange on which speed is 
-     *               calculated. Speed will reach maximum if stylus is on the edge 
-     *               or beyond the rect. In practise, the value should match the
-     *               area of the layout that contains the scrollable visuals.
-     *               For example, if the control area is the whole screen, the
-     *               rect should be the screen rect.
-     * @returns the speed as a percentage between -100% and 100%
-     */
-    virtual TRealPoint SpeedPercent( const TRect& aEdges ) const = 0;
-    
-    /** 
-     * @return Length of gesture from starting position
-     *         (start pos - current pos)
-     */
-    virtual TPoint Distance() const = 0; 
-    
-    /**
-     * @return visual on which the gesture started
-     *         NULL if not known (e.g., AVKON-based client 
-     */
-    virtual CAlfVisual* Visual() const = 0;
-    };
+private:    
+    TGestureCode   iCode;
+    TBool          iIsHolding;
+    TPoint         iStartPos;
+    TPoint         iCurrPos;
+    TRealPoint     iSpeed;
+    TRealPoint     iSpeedPercent;
+    TPoint         iDistance;
+};
+
     
 /** 
  * Observer that will be notified when user makes gestures
@@ -161,22 +124,9 @@
      * Handle the gesture event
      * @param aEvent event describing the gesture 
      */
-    virtual void HandleGestureL( const MGestureEvent& aEvent ) = 0;
+    virtual void HandleGestureL( const TGestureEvent& aEvent ) = 0;
     };
 
-/** 
- * static class for finding a visual from a visual tree
- */
-class HitTest
-    {
-public:
-    /** 
-     * @return the leaf-most visual is under aPos, or NULL if not found
-     */
-    IMPORT_C static CAlfVisual* VisualByCoordinates( const CAlfControl& aControl, 
-        const TPoint& aPos );
-    };
-    
 // ----------------------------------------------------------------------------
 // Default constructor for real point
 // ----------------------------------------------------------------------------
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/historytest1.html	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML><HEAD>
+<TITLE>History Test 1</TITLE>
+
+<script type="text/javascript">
+function SetFocus()
+{
+document.getElementById('button1').focus();
+}
+</script>
+</HEAD>
+
+<BODY onload='SetFocus()' bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
+
+	<p>
+	This test tests that LoadData actually works.
+	If you see this page the test passed.
+	<form>
+	<input type='text' id='box1' />
+	<input type='submit' id='button1' value='button1' />
+	<br/>
+	<input type='submit' id='button2' value='#2' />
+	<input type='text' id='box2' />
+	</form>
+
+	<img src="img8.jpg" id='image' />
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/historytest2.html	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML><HEAD>
+<TITLE>History Test 2</TITLE>
+
+<script type="text/javascript">
+function SetFocus()
+{
+document.getElementById('button1').focus();
+}
+</script>
+</HEAD>
+
+<BODY onload='SetFocus()' bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
+
+	<p>
+	This test tests that LoadData actually works.
+	If you see this page the test passed.
+	<form>
+	<input type='text' id='box1' />
+	<input type='submit' id='button1' value='button1' />
+	<br/>
+	<input type='submit' id='button2' value='#2' />
+	<input type='text' id='box2' />
+	</form>
+
+	<img src="img8.jpg" id='image' />
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/historytest3.html	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML><HEAD>
+<TITLE>History Test 3</TITLE>
+
+<script type="text/javascript">
+function SetFocus()
+{
+document.getElementById('button1').focus();
+}
+</script>
+</HEAD>
+
+<BODY onload='SetFocus()' bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
+
+	<p>
+	This test tests that LoadData actually works.
+	If you see this page the test passed.
+	<form>
+	<input type='text' id='box1' />
+	<input type='submit' id='button1' value='button1' />
+	<br/>
+	<input type='submit' id='button2' value='#2' />
+	<input type='text' id='box2' />
+	</form>
+
+	<img src="img8.jpg" id='image' />
+</BODY>
+</HTML>
Binary file web_pub/browser_control_api/tsrc/data/img8.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/loadtest.html	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+<TITLE>Demo </TITLE>
+</HEAD>
+
+<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
+
+	<p>
+	This test tests that LoadData actually works.
+	If you see this page the test passed.
+	<img src="img8.jpg" id='image' />
+	</p>
+
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/loadtest.saved	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,19 @@
+SAVED-PAGE/3.1
+Content-Location: file://c:/brctltest/loadtest.html
+Content-Type: multipart/mixed; boundary="S60BrowserSavedPage"
+Content-Length: 407
+Last-Modified: Tue, 09 May 2006 17:56:03 GMT
+
+--S60BrowserSavedPage
+Content-Location: file://c:/brctltest/loadtest.html
+Content-Type: text/html
+
+<HTML><HEAD><TITLE>Demo </TITLE></HEAD><BODY bgcolor="#ffffff" leftmargin="0" topmargin="0" marginheight="2" marginwidth="2">
+
+	<P>
+	This test tests that LoadData actually works.
+	If you see this page the test passed.
+	<IMG src="img8.jpg" alt="No image here">
+
+</P></BODY></HTML>
+--S60BrowserSavedPage--
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/loadtest1.wml	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
+<wml>
+<template>
+	<do type="accept" name="gh" label="* Help?"><go href="#H1"/></do>
+	<do type="prev"   name="gb" label="* Back!"><prev/></do>
+	<do type="accept" name="PostResults" label="PostResults"><go href="../WMLBrowserPost.asp"/></do>
+</template>
+
+<card id="C1" title="nbsp_01v00">
+	<p>40.07.01</p>
+	<p>
+	Non-breaking space in a table cell.
+        <table title="T2" columns="2">
+           <tr>
+               <td>
+               R1-C1
+               First&#160;SecondVeryVeryLongWordSecondVeryVeryLongWordSecondVeryVeryLongWord
+               </td>
+               <td>
+               R1-C2
+               </td>
+           </tr>
+           <tr>
+               <td>
+               R2-C1
+               </td>
+               <td>
+               R2-C2
+               </td>
+           </tr>
+        </table>
+        </p>     
+<p><a title="Go" href="nbsp_02v00.wml">Next</a>
+	</p>
+</card>
+
+<card id="H1" title="Help">
+	<p>
+	In the first cell R1-C1 there is a non-breaking space between the words 'First' and 'SecondVeryVeryLongWordSecondVeryVeryLongWordSecondVeryVeryLongWord'. 
+	</p>
+</card>
+</wml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/loadtest2.html	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML><HEAD>
+<TITLE>Demo </TITLE>
+
+<script type="text/javascript">
+function SetFocus()
+{
+document.getElementById('button1').focus();
+}
+</script>
+</HEAD>
+
+<BODY onload='SetFocus()' bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
+
+	<p>
+	This test tests that LoadData actually works.
+	If you see this page the test passed.
+	<form>
+	<input type='text' id='box1' />
+	<input type='submit' id='button1' value='button1' />
+	<br/>
+	<input type='submit' id='button2' value='#2' />
+	<input type='text' id='box2' />
+	</form>
+
+	<img src="img8.jpg" id='image' />
+</BODY>
+</HTML>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/loadtest2.wml	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
+<wml>
+<template>
+	<do type="accept" name="gh" label="* Help?"><go href="#H1"/></do>
+	<do type="prev"   name="gb" label="* Back!"><prev/></do>
+	<do type="accept" name="PostResults" label="PostResults"><go href="../WMLBrowserPost.asp"/></do>
+</template>
+
+<card id="C1" title="WML Load 2">
+	<p>40.07.01</p>
+	<p>
+	Non-breaking space in a table cell.
+        <table title="T2" columns="2">
+           <tr>
+               <td>
+               R1-C1
+               First&#160;SecondVeryVeryLongWordSecondVeryVeryLongWordSecondVeryVeryLongWord
+               </td>
+               <td>
+               R1-C2
+               </td>
+           </tr>
+           <tr>
+               <td>
+               R2-C1
+               </td>
+               <td>
+               R2-C2
+               </td>
+           </tr>
+        </table>
+        </p>     
+<p><a title="Go" href="nbsp_02v00.wml">Next</a>
+	</p>
+</card>
+
+<card id="H1" title="Help">
+	<p>
+	In the first cell R1-C1 there is a non-breaking space between the words 'First' and 'SecondVeryVeryLongWordSecondVeryVeryLongWordSecondVeryVeryLongWord'. 
+	</p>
+</card>
+</wml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/loadtest3.wml	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.3//EN" "http://www.wapforum.org/DTD/wml13.dtd">
+<wml>
+<template>
+	<do type="accept" name="gh" label="* Help?"><go href="#H1"/></do>
+	<do type="prev"   name="gb" label="* Back!"><prev/></do>
+	<do type="accept" name="PostResults" label="PostResults"><go href="../WMLBrowserPost.asp"/></do>
+</template>
+
+<card id="C1" title="WML Load 3">
+	<p>40.07.01</p>
+	<p>
+	Non-breaking space in a table cell.
+        <table title="T2" columns="2">
+           <tr>
+               <td>
+               R1-C1
+               First&#160;SecondVeryVeryLongWordSecondVeryVeryLongWordSecondVeryVeryLongWord
+               </td>
+               <td>
+               R1-C2
+               </td>
+           </tr>
+           <tr>
+               <td>
+               R2-C1
+               </td>
+               <td>
+               R2-C2
+               </td>
+           </tr>
+        </table>
+        </p>     
+<p><a title="Go" href="nbsp_02v00.wml">Next</a>
+	</p>
+</card>
+
+<card id="H1" title="Help">
+	<p>
+	In the first cell R1-C1 there is a non-breaking space between the words 'First' and 'SecondVeryVeryLongWordSecondVeryVeryLongWordSecondVeryVeryLongWord'. 
+	</p>
+</card>
+</wml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/browser_control_api/tsrc/data/ui_browser_control_api.cfg	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,902 @@
+[Test]
+title Create Browser Control BC Test
+create BrCtlApiTest container
+container CreateBrowserControl 
+container DestroyBrowserControl
+delete container
+[Endtest] 
+
+[Test]
+title Create Browser Control with Configuration1 BC Test
+create BrCtlApiTest container
+container CreateBrowserControl DisplayScrollBar ClientNotifyURL DisableInputAndPlugins LoadHttpFw SavedPage
+container DestroyBrowserControl
+delete container
+[Endtest] 
+
+[Test]
+title Create Browser Control with Configuration2 BC Test 
+create BrCtlApiTest container
+container CreateBrowserControl DisplayScrollBar ClientNotifyURL FindItem LoadHttpFw SavedPage
+container DestroyBrowserControl
+delete container
+[Endtest] 
+
+[Test]
+title Zoom Levels BC Test
+create BrCtlApiTest container
+container CreateBrowserControl 
+container ZoomLevels
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title SavedPage BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container SavedPage
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title CertInfo BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container CertInfo
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title NavigationAvailable BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container NavigationAvailable
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title CommandObserver BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container CommandObserver
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title FocusedElementType BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container FocusedElementType
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title FocusedImage BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container FocusedImage
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title SetSelfDownloadContentTypes BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container SetSelfDownloadContentTypes
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title AddOptionMenuItems BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container AddOptionMenuItems
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title BrCtlInitLoadData BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container BrCtlInitLoadData
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title LoadDataL BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container LoadData
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title GetBitmapData BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container LoadData
+pause 3000
+container GetBitmapData
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title SaveToFile BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container SaveToFile
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title FindKeyword BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container FindKeyword test 0
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title MinimumSize BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container MinimumSize
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title OfferKeyEvent BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container OfferKeyEvent
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title OkToExit BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container OkToExit
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title BrCtlSetParam BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container BrCtlSetParam
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title BrCtlSubscribeToMenuItems BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container BrCtlSubscribeToMenuItems
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleDownloadCommand BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleDownloadCommand
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title VersionInfo BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container VersionInfo
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title ContentSize BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container ContentSize
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title BrCtlSettings BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container BrCtlSettings
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title EmptyCache BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container EmptyCache
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandDisconnect1 BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Disconnect1
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandCancelFetch BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand CancelFetch
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandOpen BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Open
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandReload BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Reload
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandBack BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Back
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandForward BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Forward
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandClearHistory BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ClearHistory
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandShowHistory BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ShowHistory
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandDisconnect2 BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Disconnect2
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandAccept BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Accept
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandCancel BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand Cancel
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandOpenToViewer1 BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand OpenToViewer1
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandAddToPhoneBook BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand AddToPhoneBook
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandMakeCall BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand MakeCall
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandRemoveFileName BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand RemoveFileName
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandShowImages BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ShowImages
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandLoadImages BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand LoadImages
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandGainFocus BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand GainFocus
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandLoseFocus BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand LoseFocus
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandFindItem BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand FindItem
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandFindItemPhoneNumber BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand FindItemPhoneNumber
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandFindItemEMail BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand FindItemEMail
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandFindItemAddress BC Test
+create BrCtlApiTest container
+container CreateBrowserControl FindItemAddress
+container HandleCommand
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandFindKeyword BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand FindKeyword
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandClearFind BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ClearFind
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandShowThumbnailView BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ShowThumbnailView
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandOneStepBack BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand OneStepBack
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandShowHistory BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ShowHistory
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandAppForeground BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand AppForeground
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandAppBackground BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand AppBackground
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandOpenNewWindow BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand OpenNewWindow
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandOpenToViewer2 BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand OpenToViewer2
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandClearAutoFormFillData BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ClearAutoFormFillData
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandClearAutoFormFillPasswordData BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ClearAutoFormFillPasswordData
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandRemoveFileName BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand RemoveFileName
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandFreeMemory BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand FreeMemory
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandMemoryGood BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand MemoryGood
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandDumpRenderTree BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand DumpRenderTree
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandUnloadWMLEngine BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand UnloadWMLEngine
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandSmartLinkMakeCall BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand SmartLinkMakeCall
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandSmartLinkSendMessage BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand SmartLinkSendMessage
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandSmartLinkAddToPhoneBook BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand SmartLinkAddToPhoneBook
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandShowToolBar BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ShowToolBar
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandSmartLinkSendEmail BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand SmartLinkSendEmail
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandUnLoadPluginWindows BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand UnLoadPluginWindows
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandFindItemVoIPAddress BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand FindItemVoIPAddress
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandSmartLinkMakeVoipCall BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand SmartLinkMakeVoipCall
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandZoomSliderHide BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ZoomSliderHide
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandEnterFullscreenBrowsing BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand EnterFullscreenBrowsing
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandLeaveFullscreenBrowsing BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand LeaveFullscreenBrowsing
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandShowDownloads BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ShowDownloads
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandSaveLaunchParams BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand SaveLaunchParams
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandShowAnchorHref BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ShowAnchorHref
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandLoadFocusedImage BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand LoadFocusedImage
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandZoomSliderShow BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand ZoomSliderShow
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandHistoryNavigateForward BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand HistoryNavigateForward
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandHistoryNavigateBack BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand HistoryNavigateBack
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title HandleCommandNULL BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container HandleCommand 
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title PageInfoTitle BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container LoadData
+pause 3000
+container PageInfo Title
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title PageInfoUrl BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container LoadData
+pause 3000
+container PageInfo Url
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title PageInfoFocusedNodeUrl BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container LoadData
+pause 3000
+container PageInfo FocusedNodeUrl
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title PageInfoContent BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container LoadData
+pause 3000
+container PageInfo Content
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title PageInfoSavedPage BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container LoadData
+pause 3000
+container PageInfo SavedPage
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title WmlOptionMenuItems BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container WmlOptionMenuItems
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title ImageCount BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container ImageCount
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title PostUrl BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container PostUrl
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title History Handler BC Test
+create BrCtlApiTest container
+container CreateBrowserControl DisplayScrollBar ClientNotifyURL DisableInputAndPlugins LoadHttpFw SavedPage GraphicalHistory
+container HistoryHandler Page1
+pause 3000
+container HistoryHandler Page2
+pause 3000
+container HistoryHandler Page3
+pause 3000
+container HandleCommand ShowHistory
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title WML Load BC Test
+create BrCtlApiTest container
+container CreateBrowserControl
+container WMLLoad Page1
+pause 3000
+container WMLLoad Page2
+pause 3000
+container WMLLoad Page3
+pause 3000
+container HandleCommand HistoryNavigateBack
+pause 3000
+container DestroyBrowserControl
+delete container
+[Endtest]
+
+[Test]
+title Create Browser Control With Widget Extension BC Test
+create BrCtlApiTest container
+container CreateBrCtlWithWidgetExtension
+container DestroyBrowserControl
+delete container
+[Endtest] 
--- a/web_pub/browser_control_api/tsrc/group/BrCtlApiTest.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_pub/browser_control_api/tsrc/group/BrCtlApiTest.mmp	Fri May 08 08:25:06 2009 +0300
@@ -54,6 +54,6 @@
 // component under test
 LIBRARY     browserengine.lib
 
-LANG            SC
+LANGUAGE_IDS
 
 // End of File
--- a/web_pub/browser_plugin_api/inc/PluginAdapterInterface.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_pub/browser_plugin_api/inc/PluginAdapterInterface.h	Fri May 08 08:25:06 2009 +0300
@@ -122,7 +122,10 @@
        ESystemNotification,
        EPluginInvisible,
        EPluginActivated,
-       EPluginDeactivated};
+       EPluginDeactivated,
+       EMenuOptionEnableDecider,
+       EPluginPause
+    };
 
 
     public: // New functions
--- a/web_pub/browser_plugin_api/inc/npapi.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_pub/browser_plugin_api/inc/npapi.h	Fri May 08 08:25:06 2009 +0300
@@ -362,6 +362,8 @@
     // Custom NPP variables, starting from 100 till 1000
     NPPVPluginFocusPosition = 100,    
     NPPVPluginDeactivate = 101,
+    NPPVPluginZoom = 102,
+    NPPVPluginPointerEvent = 103,
     NPPVpluginInteractiveBool = 1000,
 #endif
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/Bwins/DownloadMgrClientApiTestu.def	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/EABI/DownloadMgrClientApiTestu.def	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/group/Bld.inf	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// Nothing to do
+
+PRJ_TESTEXPORTS
+../init/testframework.ini    /epoc32/winscw/c/TestFramework/testframework.ini
+
+
+PRJ_MMPFILES
+// Nothing to do
+
+PRJ_TESTMMPFILES
+DownloadMgrClientApiTest.mmp
+
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/group/DownloadMgrClientApiTest.mmp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+#include <platform_paths.hrh>
+#include <platform/mw/Browser_platform_variant.hrh>
+
+TARGET          DownloadMgrClientApiTest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+#if defined(EKA2)
+CAPABILITY      ALL -TCB
+VENDORID        0
+#endif
+
+DEFFILE         DownloadMgrClientApiTest.def
+
+SOURCEPATH      ../src
+SOURCE          DownloadMgrClientApiTest.cpp
+SOURCE          RHttpDownloadTestCases.cpp
+SOURCE          RHttpDownloadMgrTestCases.cpp
+
+USERINCLUDE     ../inc 
+MW_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   ../../inc 
+SYSTEMINCLUDE   ../../../download_mgr_ui_api/inc 
+
+LIBRARY         euser.lib efsrv.lib downloadmgr.lib esock.lib
+LIBRARY         stiftestinterface.lib
+
+LANGUAGE_IDS
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/group/DownloadMgrClientApiTest.pkg	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,35 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+; Languages
+; none -  English only by default
+&EN
+
+; Installation header
+; Only one component name as we only support English
+; UID is the main app's UID
+
+#{"DownloadMgrClientApiTest"},(0x101FB3E7),3,0,0,TYPE=SA
+(0x101F7961),0,0,0,{"Series60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; Files to install and to where
+"\epoc32\Release\armv5\urel\DownloadMgrClientApiTest.dll"-"!:\sys\bin\DownloadMgrClientApiTest.dll"
+"..\init\testframework.ini"-"!:\testframework\testframework.ini"
\ No newline at end of file
Binary file web_pub/download_mgr_client_api/tsrc/group/RDTest_02.der has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/group/RDTest_02.key	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXQIBAAKBgQC/TDP7KKIaf5+uW4OD2iVZuUMC2a+SeQTjf6srlKcOm+CpPNXn
+uLNm/8fdEnyOIuRXPRKmqhs1n0JkxEGHynELWMTuKXbQx9SRAGUXzyneGn+IJNnO
+vOKHWgKCouX2hfI8rtkdqJpqmO460gGsMgw+lsbeyWyW9lnfLxq+ZC7sqQIDAQAB
+AoGBALmUWZE8GBaQ3P4u9WUCSd3DJkkrmXIFSULSZeH/chlwCwDjbbhArHothVzo
+REE3hEFFlERvHbplZ+mNouzy7boduvgUzbksGrbGMLJ2qO1GzWWVwV+GzOWKd3ss
+/98Gwoy5R8pjnkqUE2wP1iJFw0FjvUTKcYv/z6t3LLJ0CsoBAkEA+c7ixvsviQ3J
+s0INytCKU2bf8fqFQJi1VI82ukxNsujGTQ9upVSjuvqPvWyDvvTdrUBHqO+3qPut
+sEh01Q8aiQJBAMQKDJPVRu4ud3mwUfEavzL5EjqwG1k9VCNGYsT4FwtrHcxu1oP/
+pk6M3rIZukqomoEEnHWPMwhrK3fhBqi0OSECQQDr40VXege4FnH5OI2Hj4afHMyp
+VdQQXGMWFyopnzXblFz0lXb43cTCIiorR9XcMqNFHybLypkWE5o+lRzlt55pAkBQ
+P/zeF5Sts//cpL0mgdh7OVKpC6ZmZaCnwAx2rUhhuDu+kDDoYCLoTOps5fNI1LRK
+1GRoC3LMo3Jr5IYhUYWBAkBpCpN6k4JU/mszq98EojHerQNxk8sPqvQKUzTutohT
+1gLX9yepGayB/TtT2EEJDkWOlnTy/dvN6W3vzbJYz97x
+-----END RSA PRIVATE KEY-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/group/buildsis.bat	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,24 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: 
+rem
+
+@echo off
+makesis DownloadMgrClientApiTest.pkg
+@echo Sign DownloadMgrClientApiTest.sis...
+signsis DownloadMgrClientApiTest.sis DownloadMgrClientApiTest.sisx RDTest_02.der RDTest_02.key
+@echo Delete intermediate files...
+del DownloadMgrClientApiTest.sis
+@echo Done, please copy DownloadMgrClientApiTest.sisx to your phone
+@echo on
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/inc/DownloadMgrClientApiTest.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,699 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  DownloadMgrClientApiTest test module.
+*
+*/
+
+
+
+#ifndef DOWNLOADMGRCLIENTAPITEST_H
+#define DOWNLOADMGRCLIENTAPITEST_H
+
+// INCLUDES
+#include <StifTestModule.h>
+#include <StifLogger.h>
+#include <f32file.h>
+#include <DownloadMgrClient.h>
+#include <CDownloadMgrUiLibRegistry.h>
+
+// CONSTANTS
+const TInt KThisAppUid = 0x101FB3E7;
+
+// MACROS
+
+// Logging path
+_LIT( KDownloadMgrClientApiTestLogPath, "\\logs\\testframework\\DownloadMgrClientApiTest\\" ); 
+// Log file
+_LIT( KDownloadMgrClientApiTestLogFile, "DownloadMgrClientApiTest.txt" ); 
+
+// Function pointer related internal definitions
+// Rounding known bug in GCC
+
+#ifdef __VC32__
+#define GETPTR 
+#else
+#define GETPTR &
+#endif  
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+class CDownloadMgrClientApiTest;
+class CActiveDownloadMgrDbNotifier;
+
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt CDemoModule::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt (CDownloadMgrClientApiTest::* TestFunction)(TTestResult&);    
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC           iCaseName;    
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {        
+        };
+
+    };
+
+// CLASS DECLARATION
+
+/**
+*  This a DownloadMgrBCTest class.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CDownloadMgrClientApiTest) : public CTestModuleBase,
+                                        public MHttpDownloadMgrObserver,
+                                        public MHttpDownloadMgrNextUriObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CDownloadMgrClientApiTest* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CDownloadMgrClientApiTest();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the DownloadMgrBCTest. 
+        *       It is called once for every instance of DownloadMgrBCTest after
+        *       its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of DownloadMgrBCTest.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from DownloadMgrBCTest. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& /* aFailureType */,
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; User may add implementation for OOM test 
+        * environment initialization. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL. User may add implementation 
+        * for OOM test warning handling. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */);
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+    private:    // from MHttpDownloadMgrObserver
+
+        void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
+
+    private:    // from MHttpDownloadMgrObserver
+
+        void NextUriL( RHttpDownload& aDownload, const TDesC8& aUri );
+
+    private:   // Functions to test RHttpDownload interface
+
+        /**
+        * RHttpDownload Start test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadStartTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload Pause test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadPauseTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload Reset test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadResetTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload Delete test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadDeleteTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload Move test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadMoveTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload GetIntAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadGetIntAttributeTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload GetBoolAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadGetBoolAttributeTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload GetStringAttribute test case with TDes16 argument.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadGetStringAttribute16Test( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload GetStringAttribute test case with TDes8 argument.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadGetStringAttribute8Test( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload GetFileHandleAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadGetFileHandleAttributeTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload SetIntAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadSetIntAttributeTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload SetBoolAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadSetBoolAttributeTest( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload SetStringAttribute test case with TDes16 argument.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadSetStringAttribute16Test( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload SetStringAttribute test case with TDes8 argument.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadSetStringAttribute8Test( TTestResult& aResult );
+        
+        /**
+        * RHttpDownload SetFileHandleAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DownloadSetFileHandleAttributeTest( TTestResult& aResult );
+
+    private:   // Functions to test RHttpDownloadMgr interface
+
+        /**
+        * RHttpDownloadMgr ConnectL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerConnectLTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr Version test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerVersionTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr Close test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerCloseTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr CurrentDownloads test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerCurrentDownloadsTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr CreateDownloadL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerCreateDownloadLWithBoolTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr CreateDownloadL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerCreateDownloadLTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr CreateClientSideDownloadL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerCreateClientSideDownloadLTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr CreateCodDownloadL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerCreateCodDownloadLTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr FindDownload test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerFindDownloadTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr PauseAll test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerPauseAllTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr StartAll test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerStartAllTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr ResetAll test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerResetAllTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr DeleteAll test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerDeleteAllTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr Disconnect test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerDisconnectTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr GetIntAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerGetIntAttributeTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr GetBoolAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerGetBoolAttributeTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr GetStringAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerGetStringAttribute16Test( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr GetStringAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerGetStringAttribute8Test( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetIntAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetIntAttributeTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetBoolAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetBoolAttributeTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetStringAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetStringAttribute16Test( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetStringAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetStringAttribute8Test( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetDefaultIntAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetDefaultIntAttributeTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetDefaultBoolAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetDefaultBoolAttributeTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetDefaultStringAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetDefaultStringAttribute16Test( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetDefaultStringAttribute test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetDefaultStringAttribute8Test( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr AddObserverL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerAddObserverLTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr RemoveObserver test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerRemoveObserverTest( TTestResult& aResult );
+
+        /**
+        * RHttpDownloadMgr SetNextUriObserver test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ManagerSetNextUriObserverTest( TTestResult& aResult );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CDownloadMgrClientApiTest();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        CStifLogger * iLog;
+        
+        RFs iFileSystem;
+        RHttpDownloadMgr  iDownloadManager;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // DOWNLOADMGRCLIENTAPITEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/init/testframework.ini	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,178 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if 
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module. 
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= DownloadMgrClientApiTest
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIFTestFramework logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number 
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' 
+
+#CreateLogDirectories= YES		# Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML			# Possible values: TXT or HTML
+#EmulatorOutput= FILE			# Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML			# Possible values: TXT or HTML
+#HardwareOutput= FILE			# Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE		# Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES			# Possible values: YES or NO
+#WithTimeStamp= YES			# Possible values: YES or NO
+#WithLineBreak= YES			# Possible values: YES or NO
+#WithEventRanking= YES			# Possible values: YES or NO
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/src/CDownloadMgrUiLibRegistryTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,184 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "DownloadMgrBCTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: RegistryNewLTest
+
+    Description: Test the CDownloadMgrUiLibRegistry NewL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::RegistryNewLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the CDownloadMgrUiRegistry NewL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    CDownloadMgrUiLibRegistry* registry = CDownloadMgrUiLibRegistry::NewL( iDownloadManager );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( registry )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    
+	    delete registry;
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: RegistryRegisterUserInteractionsLTest
+
+    Description: Test the CDownloadMgrUiLibRegistry RegisterUserInteractionsL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::RegistryRegisterUserInteractionsLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the CDownloadMgrUiRegistry RegisterUserInteractionsL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: RegistryRegisterDownloadsListLTest
+
+    Description: Test the CDownloadMgrUiLibRegistry RegisterDownloadsListL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::RegistryRegisterDownloadsListLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the CDownloadMgrUiRegistry RegisterDownloadsListL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/src/CDownloadMgrUiUserInteractionsTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "DownloadMgrBCTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: InteractionsOkToExitLTest
+
+    Description: Test the CDownloadMgrUiUserInteractions OkToExitL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::InteractionsOkToExitLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the CDownloadMgrUiUserInteractions OkToExitL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: InteractionsPrepareToExitWithViewIdTest
+
+    Description: Test the CDownloadMgrUiUserInteractions PrepareToExit method with ViewId argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::InteractionsPrepareToExitWithViewIdTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the CDownloadMgrUiUserInteractions PrepareToExit method with ViewId argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: InteractionsPrepareToExitTest
+
+    Description: Test the CDownloadMgrUiUserInteractions PrepareToExit method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::InteractionsPrepareToExitTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the CDownloadMgrUiUserInteractions PrepareToExit method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: InteractionsHandleDownloadLTest
+
+    Description: Test the CDownloadMgrUiUserInteractions HandleDownloadL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Proposal
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::InteractionsHandleDownloadLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the CDownloadMgrUiUserInteractions HandleDownloadL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/src/DownloadMgrClientApiTest.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,552 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  DownloadMgrClientApiTest class member functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "DownloadMgrClientApiTest.h"
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ---------------------------------------------------------
+// DeleteFileL
+// ---------------------------------------------------------
+//
+void DeleteFileL( const TDesC& aFile, RFs& aFs )
+    {
+    TParse file;
+    User::LeaveIfError( aFs.Parse( aFile, file ) );
+    TUint att;
+    TInt res = aFs.Att( file.FullName(), att );
+    if ( res == KErrNone )
+        {
+        User::LeaveIfError( aFs.Delete( file.FullName() ) );
+        }
+    }
+
+// ---------------------------------------------------------
+// CopyFileL
+// ---------------------------------------------------------
+//
+void CopyFileL( const TDesC& aSrc, const TDesC& aDst, RFs& aFs )
+    {
+    RFile src;
+    RFile dst;
+    TBuf8<256> buf;
+
+    User::LeaveIfError( src.Open
+        ( aFs, aSrc, EFileRead | EFileShareReadersOnly | EFileStream ) );
+    CleanupClosePushL<RFile>( src );
+    (void)aFs.MkDirAll( aDst );    
+    (void)aFs.SetAtt( aDst, 0, KEntryAttReadOnly ); // Overwrite read-only.
+    User::LeaveIfError( dst.Replace
+        ( aFs, aDst, EFileWrite | EFileShareExclusive | EFileStream ) );
+    CleanupClosePushL<RFile>( dst );
+    FOREVER
+        {
+        User::LeaveIfError( src.Read( buf ) );
+        if ( !buf.Length() )
+            {
+            break;
+            }
+        User::LeaveIfError( dst.Write( buf ) );
+        }
+    CleanupStack::PopAndDestroy( 2 );   // close dst, src
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::CDownloadMgrClientApiTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CDownloadMgrClientApiTest::CDownloadMgrClientApiTest()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CDownloadMgrClientApiTest::ConstructL()
+    {
+    iLog = CStifLogger::NewL( KDownloadMgrClientApiTestLogPath, 
+                          KDownloadMgrClientApiTestLogFile);
+                          
+    User::LeaveIfError( iFileSystem.Connect() );
+
+    iDownloadManager.ConnectL( TUid::Uid( KThisAppUid ), *this, EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CDownloadMgrClientApiTest* CDownloadMgrClientApiTest::NewL()
+    {
+    CDownloadMgrClientApiTest* self = new (ELeave) CDownloadMgrClientApiTest;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CDownloadMgrClientApiTest::~CDownloadMgrClientApiTest()
+    {
+    iDownloadManager.Close();
+    iFileSystem.Close();
+    delete iLog;
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CDownloadMgrClientApiTest::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: Case
+
+    Description: Returns a test case by number.
+
+    This function contains an array of all available test cases 
+    i.e pair of case name and test function. If case specified by parameter
+    aCaseNumber is found from array, then that item is returned.
+
+    The reason for this rather complicated function is to specify all the
+    test cases only in one place. It is not necessary to understand how
+    function pointers to class member functions works when adding new test
+    cases. See function body for instructions how to add new test case.
+    
+    Parameters:    const TInt aCaseNumber :in:      Test case number
+
+    Return Values: const TCaseInfo Struct containing case name & function
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/ 
+const TCaseInfo CDownloadMgrClientApiTest::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /*
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    *
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    OOMHard.cpp file and to OOMHard.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // CDemoModule::PrintTest. Otherwise the compiler
+        // gives errors.
+                
+        ENTRY( "Download Start test", CDownloadMgrClientApiTest::DownloadStartTest ),
+        ENTRY( "Download Pause test", CDownloadMgrClientApiTest::DownloadPauseTest ),
+        ENTRY( "Download Reset test", CDownloadMgrClientApiTest::DownloadResetTest ),
+        ENTRY( "Download Delete test", CDownloadMgrClientApiTest::DownloadDeleteTest ),
+        ENTRY( "Download Move test", CDownloadMgrClientApiTest::DownloadMoveTest ),
+        ENTRY( "Download GetIntAttribute test", CDownloadMgrClientApiTest::DownloadGetIntAttributeTest ),
+        ENTRY( "Download GetBoolAttribute test", CDownloadMgrClientApiTest::DownloadGetBoolAttributeTest ),
+        ENTRY( "Download GetStringAttribute test with TDes16 argument", CDownloadMgrClientApiTest::DownloadGetStringAttribute16Test ),
+        ENTRY( "Download GetStringAttribute test with TDes8 argument", CDownloadMgrClientApiTest::DownloadGetStringAttribute8Test ),
+        ENTRY( "Download GetFileHandleAttribute test", CDownloadMgrClientApiTest::DownloadGetFileHandleAttributeTest ),
+        ENTRY( "Download SetIntAttribute test", CDownloadMgrClientApiTest::DownloadSetIntAttributeTest ),
+        ENTRY( "Download SetBoolAttribute test", CDownloadMgrClientApiTest::DownloadSetBoolAttributeTest ),
+        ENTRY( "Download SetStringAttribute test with TDes16 argument", CDownloadMgrClientApiTest::DownloadSetStringAttribute16Test ),
+        ENTRY( "Download SetStringAttribute test with TDes8 argument", CDownloadMgrClientApiTest::DownloadSetStringAttribute8Test ),
+        ENTRY( "Download SetFileHandleAttribute test with TDes8 argument", CDownloadMgrClientApiTest::DownloadSetFileHandleAttributeTest ),
+        ENTRY( "Manager ConnectL test", CDownloadMgrClientApiTest::ManagerConnectLTest ),
+        ENTRY( "Manager Version test", CDownloadMgrClientApiTest::ManagerVersionTest ),
+        ENTRY( "Manager Close test", CDownloadMgrClientApiTest::ManagerCloseTest ),
+        ENTRY( "Manager CurrentDownloads test", CDownloadMgrClientApiTest::ManagerCurrentDownloadsTest ),
+        ENTRY( "Manager CreateDownloadL test with Bool argument", CDownloadMgrClientApiTest::ManagerCreateDownloadLWithBoolTest ),
+        ENTRY( "Manager CreateDownloadL test", CDownloadMgrClientApiTest::ManagerCreateDownloadLTest ),
+        ENTRY( "Manager CreateCodDownloadL test", CDownloadMgrClientApiTest::ManagerCreateCodDownloadLTest ),
+        ENTRY( "Manager FindDownload test", CDownloadMgrClientApiTest::ManagerFindDownloadTest ),
+        ENTRY( "Manager PauseAll test", CDownloadMgrClientApiTest::ManagerPauseAllTest ),
+        ENTRY( "Manager StartAll test", CDownloadMgrClientApiTest::ManagerStartAllTest ),
+        ENTRY( "Manager ResetAll test", CDownloadMgrClientApiTest::ManagerResetAllTest ),
+        ENTRY( "Manager DeleteAll test", CDownloadMgrClientApiTest::ManagerDeleteAllTest ),
+        ENTRY( "Manager Disconnect test", CDownloadMgrClientApiTest::ManagerDisconnectTest ),
+        ENTRY( "Manager GetIntAttribute test", CDownloadMgrClientApiTest::ManagerGetIntAttributeTest ),
+        ENTRY( "Manager GetBoolAttribute test", CDownloadMgrClientApiTest::ManagerGetBoolAttributeTest ),
+        ENTRY( "Manager GetStringAttribute test with TDesC16 argument", CDownloadMgrClientApiTest::ManagerGetStringAttribute16Test ),
+        ENTRY( "Manager SetIntAttribute test", CDownloadMgrClientApiTest::ManagerSetIntAttributeTest ),
+        ENTRY( "Manager SetBoolAttribute test", CDownloadMgrClientApiTest::ManagerSetBoolAttributeTest ),
+        ENTRY( "Manager SetStringAttribute test with TDesC16 argument", CDownloadMgrClientApiTest::ManagerSetStringAttribute16Test ),
+        ENTRY( "Manager SetDefaultIntAttribute test", CDownloadMgrClientApiTest::ManagerSetDefaultIntAttributeTest ),
+        ENTRY( "Manager SetDefaultBoolAttribute test", CDownloadMgrClientApiTest::ManagerSetDefaultBoolAttributeTest ),
+        ENTRY( "Manager SetDefaultStringAttribute test with TDesc16 argument", CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute16Test ),
+        ENTRY( "Manager SetDefaultStringAttribute test with TDesc8 argument", CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute8Test ),
+        ENTRY( "Manager AddObserverL test", CDownloadMgrClientApiTest::ManagerAddObserverLTest ),
+        ENTRY( "Manager RemoveObserver test", CDownloadMgrClientApiTest::ManagerRemoveObserverTest ),
+        ENTRY( "Manager SetNextUriObserver test", CDownloadMgrClientApiTest::ManagerSetNextUriObserverTest ),
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+void CDownloadMgrClientApiTest::HandleDMgrEventL( RHttpDownload& /*aDownload*/, THttpDownloadEvent /*aEvent*/ )
+    {
+
+    }
+
+void CDownloadMgrClientApiTest::NextUriL( RHttpDownload& /*aDownload*/, const TDesC8& /*aUri*/ )
+	{
+
+	}
+
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CDownloadMgrClientApiTest::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+       // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+        // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+        // Set number for the testcase.
+        // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+        // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+        // Append TTestCaseInfo to the testcase array. After appended 
+        // successfully the TTestCaseInfo object is owned (and freed) 
+        // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+        // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CDownloadMgrClientApiTest::RunTestCaseL(
+    const TInt aCaseNumber,
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogInfo, "Starting testcase [%S]" );
+    iLog->Log( KLogInfo, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        execStatus  = ( this->*iMethod )( aResult );
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+TBool CDownloadMgrClientApiTest::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& /* aFirstMemFailure */, 
+                                TInt& /* aLastMemFailure */ ) 
+    {
+    _LIT( KOOMTestQueryL, "CDownloadMgrClientApiTest::OOMTestQueryL" );
+    iLog->Log( KOOMTestQueryL ); 
+
+    return EFalse;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CDownloadMgrClientApiTest::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CDownloadMgrClientApiTest::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CDownloadMgrClientApiTest::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//                  
+void CDownloadMgrClientApiTest::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CDownloadMgrClientApiTest::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// E32Dll is a DLL entry point function
+// Returns: KErrNone: No error
+// -----------------------------------------------------------------------------
+//
+#ifndef EKA2 // Hide Dll entry point to EKA2
+GLDEF_C TInt E32Dll(
+    TDllReason /*aReason*/) // Reason
+    {
+    return(KErrNone);
+
+    }
+#endif // EKA2
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/src/RHttpDownloadMgrTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,1620 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include <es_sock.h>
+#include "DownloadMgrClientApiTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerConnectLTest
+
+    Description: Test the RHttpDownloadMgr ConnectL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerConnectLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr ConnectL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    RHttpDownloadMgr downloadMgr;
+	
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	    
+    downloadMgr.ConnectL( TUid::Uid( KThisAppUid ), *this, EFalse );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+	// RHttpDownloadMgr::ConnectL provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    
+    downloadMgr.Close();
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerVersionTest
+
+    Description: Test the RHttpDownloadMgr Version method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerVersionTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr Version method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    TVersion version;
+    
+    version = iDownloadManager.Version();
+
+    if (version.iMinor > 0)
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerCloseTest
+
+    Description: Test the RHttpDownloadMgr Close method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerCloseTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr Close method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    RHttpDownloadMgr downloadMgr;
+    
+    downloadMgr.ConnectL( TUid::Uid( KThisAppUid ), *this, EFalse );
+
+    downloadMgr.Close();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+	// RHttpDownloadMgr::Close provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerCurrentDownloadsTest
+
+    Description: Test the RHttpDownloadMgr CurrentDownloads method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerCurrentDownloadsTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr CurrentDownloads method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    const CDownloadArray* array; 
+    array = &iDownloadManager.CurrentDownloads();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (array->Count() == 0)
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerCreateDownloadLWithBoolTest
+
+    Description: Test the RHttpDownloadMgr CreateDownloadL method with TBool argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerCreateDownloadLWithBoolTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr CreateDownloadL method with TBool argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( &download != NULL )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerCreateDownloadLTest
+
+    Description: Test the RHttpDownloadMgr CreateDownloadL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerCreateDownloadLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr CreateDownloadL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( &download != NULL )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerCreateClientSideDownloadLTest
+
+    Description: Test the RHttpDownloadMgr CreateClientSideDownloadL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerCreateClientSideDownloadLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr CreateClientSideDownloadL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    _LIT( KUnableToTest1 ,"Unable to test CreateClientSideDownloadL method");
+    TestModuleIf().Printf( 0, KDefinition, KUnableToTest1 );
+
+    _LIT( KUnableToTest2 ,"S60 3rd Edition SDK does not provide a way to create the required CHttpTransaction");
+    TestModuleIf().Printf( 0, KDefinition, KUnableToTest2 );
+
+//    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+//    CleanupStack::PushL( scheduler );
+//    CActiveScheduler::Install( scheduler );
+
+//    CUrlRequestInfo* requestInfo = CUrlRequestInfo::NewL();
+//    CleanupStack::NewL( requestInfo );
+//    _LIT( KUrl, "http://testsuite.nokia-boston.com");
+//    requestInfo->SetUrlL( KUrl() );
+
+//    TBool isNewDl = ETrue;
+//    RHttpDownload& download = iDownloadManager.CreateClientSideDownloadL( NULL, isNewDl );
+//    RHttpDownload& download = NULL;
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+//    if ( &download != NULL )
+//	    {
+//	    _LIT( KDescription , "Test case passed" );
+//	    aResult.SetResult( KErrNone, KDescription );
+//	    }
+//    else
+//	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+//	    }
+
+//    iDownloadManager.DeleteAll();
+//    CleanupStack::PopAndDestroy( 2 ); // scheduler, requestInfo
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerCreateCodDownloadLTest
+
+    Description: Test the RHttpDownloadMgr CreateCodDownloadL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerCreateCodDownloadLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr CreateCodDownloadL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    _LIT8( KCodUrl, "testsuite.nokia-boston.com" );
+    HBufC8* buf = HBufC8::NewLC( KCodUrl().Length() );
+    buf->Des().Copy( KCodUrl() );            
+    _LIT8( KCodMimeType, "text/x-co-desc" );
+
+
+    TInt retVal;
+    RHttpDownload* download;
+    download = &iDownloadManager.CreateCodDownloadL( KCodUrl(),
+        	                                         buf->Des(),
+        	                                         KCodMimeType(),
+        	                                         NULL,
+        	                                         retVal );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( &download != NULL )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy( 2 ); // scheduler, buf
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerFindDownloadTest
+
+    Description: Test the RHttpDownloadMgr FindDownload method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerFindDownloadTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr FindDownload method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TBuf<128> url = _L("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+    _LIT8( KMsgBody, "123456789123456789123456789");
+
+    HBufC8* urlToFind = HBufC8::NewLC( url.Length() );
+    urlToFind->Des().Copy( url );            
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    RHttpDownload* download = iDownloadManager.FindDownload( *urlToFind, KMsgBody() );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( download == NULL )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // urlToFind
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerPauseAllTest
+
+    Description: Test the RHttpDownloadMgr PauseAll method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerPauseAllTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr PauseAll method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url );
+
+    download.Start();
+    
+    TInt result = iDownloadManager.PauseAll();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerStartAllTest
+
+    Description: Test the RHttpDownloadMgr StartAll method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerStartAllTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr StartAll method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url );
+
+    TInt result = iDownloadManager.StartAll();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerResetAllTest
+
+    Description: Test the RHttpDownloadMgr ResetAll method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerResetAllTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr ResetAll method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    // Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url );
+	
+    iDownloadManager.StartAll();
+
+    TInt result = iDownloadManager.ResetAll();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerDeleteAllTest
+
+    Description: Test the RHttpDownloadMgr DeleteAll method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerDeleteAllTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr DeleteAll method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url );
+
+    TInt result = iDownloadManager.DeleteAll();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerDisconnectTest
+
+    Description: Test the RHttpDownloadMgr Disconnect method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerDisconnectTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr Disconnect method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+    
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url );
+
+    TInt result = iDownloadManager.Disconnect();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if ( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerGetIntAttributeTest
+
+    Description: Test the RHttpDownloadMgr GetIntAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerGetIntAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr GetIntAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TInt32 value;
+    TInt result = iDownloadManager.GetIntAttribute( EDlMgrAppUid, value );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerGetBoolAttributeTest
+
+    Description: Test the RHttpDownloadMgr GetBoolAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerGetBoolAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr GetBoolAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBool value;
+    TInt result = iDownloadManager.GetBoolAttribute( EDlMgrConnected, value );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerGetStringAttribute16Test
+
+    Description: Test the RHttpDownloadMgr GetStringAttribute method with TDesC16 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerGetStringAttribute16Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr GetStringAttribute method with TDesC16 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    HBufC16* stringAttr = HBufC16::NewLC( KMaxUrlLength );
+    TPtr16 stringAttrPtr = stringAttr->Des();
+    TInt result = iDownloadManager.GetStringAttribute( EDlMgrCodFolder, stringAttrPtr );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( 2 ); // scheduler, stringAttr
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerGetStringAttribute8Test
+
+    Description: Test the RHttpDownloadMgr GetStringAttribute method with TDesC8 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerGetStringAttribute8Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr GetStringAttribute method with TDesC8 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    _LIT( KFailReason1 ,"RHttpDownloadMgr GetStringAttribute method with TDesC8 argument results in a panic/leave every time it is called");
+    TestModuleIf().Printf( 0, KDefinition, KFailReason1 );
+
+    _LIT( KFailReason2 ,"Unable to test GetStringAttribute method with TDesC8 argument");
+    TestModuleIf().Printf( 0, KDefinition, KFailReason2 );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetIntAttributeTest
+
+    Description: Test the RHttpDownloadMgr SetIntAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetIntAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetIntAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TInt result = iDownloadManager.SetIntAttribute( EDlMgrExitAction, EExitNothing );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetBoolAttributeTest
+
+    Description: Test the RHttpDownloadMgr SetBoolAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetBoolAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetBoolAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TInt result = iDownloadManager.SetBoolAttribute( EDlMgrEnableCookies, ETrue );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetStringAttribute16Test
+
+    Description: Test the RHttpDownloadMgr SetStringAttribute method with TDesC16 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetStringAttribute16Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetStringAttribute method with TDesC16 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    RSocketServ iSocketServ;
+    RConnection iConnection;
+
+    iSocketServ.Connect();
+    iConnection.Open( iSocketServ );
+
+    TName name;
+
+    iConnection.Name( name );
+
+    TInt result = iDownloadManager.SetStringAttribute( EDlMgrConnectionName, name );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrPermissionDenied )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iConnection.Close();
+    iSocketServ.Close();
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetStringAttribute8Test
+
+    Description: Test the RHttpDownloadMgr SetStringAttribute method with TDesC8 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetStringAttribute8Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetStringAttribute method with TDesC8 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    _LIT( KFailReason1 ,"RHttpDownloadMgr SetStringAttribute method with TDesC8 argument results in a panic/leave every time it is called");
+    TestModuleIf().Printf( 0, KDefinition, KFailReason1 );
+
+    _LIT( KFailReason2 ,"Unable to test SetStringAttribute method with TDesC8 argument");
+    TestModuleIf().Printf( 0, KDefinition, KFailReason2 );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    _LIT( KDescription , "Test case failed" );
+    aResult.SetResult( KErrGeneral, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetDefaultIntAttributeTest
+
+    Description: Test the RHttpDownloadMgr SetDefaultIntAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetDefaultIntAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultIntAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TInt result = iDownloadManager.SetDefaultIntAttribute( EDlAttrAction, ELaunch );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetDefaultBoolAttributeTest
+
+    Description: Test the RHttpDownloadMgr SetDefaultBoolAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetDefaultBoolAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultBoolAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TInt result = iDownloadManager.SetDefaultBoolAttribute( EDlAttrDisconnectOnReset, ETrue );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetDefaultStringAttribute16Test
+
+    Description: Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC16 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute16Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC16 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    _LIT( KDestFilename, "c:\\logs\\DownloadMgr\\" );
+    TInt result = iDownloadManager.SetDefaultStringAttribute( EDlAttrDestFilename, KDestFilename() );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetDefaultStringAttribute8Test
+
+    Description: Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC8 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute8Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetDefaultStringAttribute method with TDesC8 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    _LIT8( KUserName, "username");
+    TInt result = iDownloadManager.SetDefaultStringAttribute( EDlAttrUsername, KUserName() );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerAddObserverLTest
+
+    Description: Test the RHttpDownloadMgr AddObserverL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerAddObserverLTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr AddObserverL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iDownloadManager.AddObserverL( *this );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+	// RHttpDownloadMgr::AddObserverL provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    
+    iDownloadManager.RemoveObserver( *this );
+    
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerRemoveObserverTest
+
+    Description: Test the RHttpDownloadMgr RemoveObserver method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerRemoveObserverTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr RemoveObserver method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iDownloadManager.AddObserverL( *this );
+    
+    iDownloadManager.RemoveObserver( *this );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+	// RHttpDownloadMgr::RemoveObserver provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: ManagerSetNextUriObserverTest
+
+    Description: Test the RHttpDownloadMgr SetNextUriObserver method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::ManagerSetNextUriObserverTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownloadMgr SetNextUriObserver method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iDownloadManager.SetNextUriObserver( this );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+	// RHttpDownloadMgr::SetNextUriObserver provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+    
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/download_mgr_client_api/tsrc/src/RHttpDownloadTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,991 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "DownloadMgrClientApiTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadStartTest
+
+    Description: Test the RHttpDownload Start method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadStartTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload Start method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+	
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+    
+    TInt result = download.Start();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadPauseTest
+
+    Description: Test the RHttpDownload Pause method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadPauseTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload Pause method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+	
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    download.Start();
+    
+    TInt result = download.Pause();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadResetTest
+
+    Description: Test the RHttpDownload Reset method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadResetTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload Reset method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    download.Start();
+    
+    TInt result = download.Reset();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadDeleteTest
+
+    Description: Test the RHttpDownload Delete method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadDeleteTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    download.Start();
+    
+    TInt result = download.Delete();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadMoveTest
+
+    Description: Test the RHttpDownload Move method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadMoveTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload Move method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    download.Start();
+    
+    TInt result = download.Move();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNotReady )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadGetIntAttributeTest
+
+    Description: Test the RHttpDownload GetIntAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadGetIntAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload GetIntAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    TInt32 value;
+    TInt result = download.GetIntAttribute( EDlAttrId, value );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadGetBoolAttributeTest
+
+    Description: Test the RHttpDownload GetBoolAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadGetBoolAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload GetBoolAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    TBool value;
+    TInt result = download.GetBoolAttribute( EDlAttrDestRemovable, value );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadGetStringAttribute16Test
+
+    Description: Test the RHttpDownload GetStringAttribute method using TDes16 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadGetStringAttribute16Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload GetStringAttribute method using TDes16 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    HBufC16* stringAttr = HBufC16::NewLC( KMaxUrlLength );
+    TPtr16 stringAttrPtr = stringAttr->Des();
+    TInt result = download.GetStringAttribute( EDlAttrCurrentUrl, stringAttrPtr );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy( 2 ); // scheduler, stringAttr
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadGetStringAttribute8Test
+
+    Description: Test the RHttpDownload GetStringAttribute method using TDes8 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadGetStringAttribute8Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload GetStringAttribute method using TDes8 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    HBufC8* stringAttr = HBufC8::NewLC( KMaxUrlLength );
+    TPtr8 stringAttrPtr = stringAttr->Des();
+    TInt result = download.GetStringAttribute( EDlAttrCurrentUrl, stringAttrPtr );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy( 2 ); // scheduler, stringAttr
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadGetFileHandleAttributeTest
+
+    Description: Test the RHttpDownload GetFileHandleAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadGetFileHandleAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload GetFileHandleAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    download.Start();
+    
+    RFile file;
+    TInt result = download.GetFileHandleAttribute( file );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrArgument )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadSetIntAttributeTest
+
+    Description: Test the RHttpDownload SetIntAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadSetIntAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload SetIntAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    TInt result = download.SetIntAttribute( EDlAttrFotaPckgId, KDefaultFotaPckgId );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadSetBoolAttributeTest
+
+    Description: Test the RHttpDownload SetBoolAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadSetBoolAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload SetBoolAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    TInt result = download.SetBoolAttribute( EDlAttrProgressive, EFalse );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadSetStringAttribute16Test
+
+    Description: Test the RHttpDownload SetStringAttribute method using TDes16 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadSetStringAttribute16Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload SetStringAttribute method using TDes16 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    _LIT( KDestFileName, "c:\\fakefile\\");
+    TInt result = download.SetStringAttribute( EDlAttrDestFilename, KDestFileName() );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrArgument )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadSetStringAttribute8Test
+
+    Description: Test the RHttpDownload SetStringAttribute method using TDes8 argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadSetStringAttribute8Test( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload SetStringAttribute method using TDes8 argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+    _LIT8( KUserName, "username");
+    TInt result = download.SetStringAttribute( EDlAttrUsername, KUserName );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDownloadMgrClientApiTest
+
+    Method: DownloadSetFileHandleAttributeTest
+
+    Description: Test the RHttpDownload SetFileHandleAttribute method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CDownloadMgrClientApiTest::DownloadSetFileHandleAttributeTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the RHttpDownload SetFileHandleAttribute method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    TBuf8<128> url = _L8("http://waplabdc.nokia-boston.com/browser/users/s60_devtests/nightly_ss_on.xml");
+
+    TBool isNewDl = ETrue;
+    RHttpDownload& download = iDownloadManager.CreateDownloadL( url, isNewDl );
+
+	// Added To avoid user Input while Automation in is Progress
+	// 7 - SONERA GPRS Access Point
+	TInt dlresult = iDownloadManager.SetIntAttribute( EDlMgrIap, 7 );
+	
+    download.Start();
+    
+    RFile file;
+    TInt result = download.SetFileHandleAttribute( file );
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if( result == KErrBadHandle )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    iDownloadManager.DeleteAll();
+    CleanupStack::PopAndDestroy(); // scheduler
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- a/web_pub/download_mgr_ui_api/inc/CDownloadMgrUiDownloadsList.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_pub/download_mgr_ui_api/inc/CDownloadMgrUiDownloadsList.h	Fri May 08 08:25:06 2009 +0300
@@ -236,6 +236,8 @@
         void ProvideInputParametersL( CAiwGenericParamList& aParams,
                                       TInt& /*aCommandOptions*/,
                                       RHttpDownload& aDownload);
+                                      
+        void LaunchFileManagerApplication();
 
     private:  // Data
         
@@ -252,6 +254,7 @@
 		TBool						iProgressiveDownload;
 		
 		TBool						iIsCancelInProgress;
+		TBool                       iPlatformSupportsGallery;
 
     private: // Friend classes
 
--- a/web_pub/favourites_engine_api/inc/FavouritesLimits.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_pub/favourites_engine_api/inc/FavouritesLimits.h	Fri May 08 08:25:06 2009 +0300
@@ -93,6 +93,9 @@
 /// Context id for Music Shop music.
 LOCAL_C const TInt32 KFavouritesMusicContextId = 0x00000008;
 
+// Context id for Service.
+LOCAL_C const TInt32 KFavouritesServiceContextId = 0x00000009;
+
 /// Special context IDs for launching into these.
 LOCAL_C const TInt32 KFavouritesFeedsContextId = 0x00000000A;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/bwins/FavouritesEngineTestu.def	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+	?LibEntryL@@YAPAVCTestModuleBase@@XZ @ 1 NONAME ; class CTestModuleBase * LibEntryL(void)
+	?SetRequirements@@YAHAAPAVCTestModuleParam@@AAK@Z @ 2 NONAME ; int SetRequirements(class CTestModuleParam * &, unsigned long &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/eabi/FavouritesEngineTestu.def	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+	_Z9LibEntryLv @ 1 NONAME
+	_Z15SetRequirementsRP16CTestModuleParamRm @ 2 NONAME
+	_ZTI23TFavouritesItemTestData @ 3 NONAME ; #<TI>#
+	_ZTI25CFavouritesDbTestObserver @ 4 NONAME ; #<TI>#
+	_ZTV23TFavouritesItemTestData @ 5 NONAME ; #<VT>#
+	_ZTV25CFavouritesDbTestObserver @ 6 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/group/Bld.inf	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Favourites engine API test module
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// Nothing to do
+
+PRJ_TESTEXPORTS
+../init/testframework.ini    /epoc32/winscw/c/TestFramework/testframework.ini
+
+PRJ_MMPFILES
+// Nothing to do
+
+PRJ_TESTMMPFILES
+FavouritesEngineTest.mmp
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/group/FavouritesEngineTest.mmp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+#include <platform_paths.hrh>
+#include <platform/mw/Browser_platform_variant.hrh>
+
+TARGET          FavouritesEngineTest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E7
+
+#if defined(EKA2)
+CAPABILITY      ALL -TCB
+//VENDORID        VID_DEFAULT
+VENDORID        0
+#endif
+
+DEFFILE         FavouritesEngineTest.def
+
+SOURCEPATH      ../src
+SOURCE          FavouritesEngineTest.cpp
+SOURCE          FavouritesItemTestCases.cpp
+SOURCE          FavouritesItemListTestCases.cpp
+SOURCE          FavouritesDbTestCases.cpp
+SOURCE          FavouritesWapApTestCases.cpp
+SOURCE          FavouritesDbIncrementalTestCases.cpp
+SOURCE          FavouritesFileTestCases.cpp
+SOURCE          FavouritesSessionTestCases.cpp
+SOURCE          FavouritesNotifierTestCases.cpp
+SOURCE          FavouritesItemTestData.cpp
+SOURCE          FavouritesDbTestObserver.cpp
+
+USERINCLUDE     ../inc 
+SYSTEMINCLUDE   ../../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib efsrv.lib favouritesengine.lib estor.lib
+LIBRARY         stiftestinterface.lib
+
+LANGUAGE_IDS
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/group/FavouritesEngineTest.pkg	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,35 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: 
+;
+; Languages
+; none -  English only by default
+&EN
+
+; Installation header
+; Only one component name as we only support English
+; UID is the main app's UID
+
+#{"FavouritesEngineTest"},(0x101FB3E7),3,0,0,TYPE=SA
+(0x101F7961),0,0,0,{"Series60ProductID"}
+
+; Non-localised vendor name
+:"Nokia Corporation"
+
+; Localised vendor names
+%{"Nokia Corporation"}
+
+; Files to install and to where
+"\epoc32\Release\armv5\urel\FavouritesEngineTest.dll"-"!:\sys\bin\FavouritesEngineTest.dll"
+"..\init\testframework.ini"-"!:\testframework\testframework.ini"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/group/buildsis.bat	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,24 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of the License "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description: 
+rem
+
+@echo off
+makesis FavouritesEngineTest.pkg
+@echo Sign FavouritesEngineTest.sis...
+signsis FavouritesEngineTest.sis FavouritesEngineTest.sisx rd.cer rd-key.pem
+@echo Delete intermediate files...
+del FavouritesEngineTest.sis
+@echo Done, please copy FavouritesEngineTest.sisx to your phone
+@echo on
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/group/rd-key.pem	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,15 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIICXAIBAAKBgQDLRF+r1FGGkCwTrb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW4
+6Y+LWaA8HMlDdoHRB0FgASisYcFagwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh
+7W7Dt9F5FZij8F7/9Pi6+FhhxZFIf1DD+yry9D7+Sp+BgdNALe4XOpf25QIBAwKB
+gQCHgupyjYuvCsgNHn7PNtnvVxInrB5MQNoPli+O+uNJWUK/Q+57Rl+yO8AoEzDX
+pFaLWiuVVhsdloDnAgabT/FXzYncs6uOHyEUV+dSXb78vtLPJqAX+Fg2i3hOXreB
+yskcZ13/OsKVOu5wgrJkx2baZufkqMwOSytf5y9nwjEIKwJBAP+inobagVNrN62j
+KQva3cC+UN/6XnKdTc0CA6bHyLOaJoH1xiMwG/VS2PGjHI0tiSMNtLn/QPpHJ003
+iabGhdUCQQDLjp/9UjFT6K6CF66Chqf30pZXhx+GTSQZmv/gvZiMly7X9fX9BGX3
+2MbJohBC4yI21XKTbisWywkF73Hwh+TRAkEAqmxprzxWN5zPyRdwspHpKymLP/w+
+9xOJM1atGdqFzRFvAU6EF3Vn+OHl9my9s3OwwgkjJqorUYTE3iUGby8D4wJBAIe0
+aqjhdjfwdFa6dFcEb/qMZDpaFQQzbWZnVUB+ZbMPdI/5TqitmU/l2dvBYCyXbCSO
+TGJJcg8yBgP09qBamIsCQFL7j1tM0XPVQJQ89WpKCld7O9ORxRGVj1eG0tWijrH8
+mGbYh8SGCVoWV3vrKSS8GBrFVgQnqUaHuEdtM7tpCAQ=
+-----END RSA PRIVATE KEY-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/group/rd.cer	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,17 @@
+-----BEGIN CERTIFICATE-----
+MIICzDCCAjWgAwIBAgIBADANBgkqhkiG9w0BAQUFADArMRAwDgYDVQQKEwdSRCBD
+ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZTAeFw0wNDExMTUxMjQyMDZaFw0z
+NzA5MjMxMjQyMDZaMCsxEDAOBgNVBAoTB1JEIENlcnQxFzAVBgNVBAMTDlJEIENl
+cnRpZmljYXRlMIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDLRF+r1FGGkCwT
+rb420kbnAps7gi1yYUcXYUdWeFTuBeQe5eW46Y+LWaA8HMlDdoHRB0FgASisYcFa
+gwno9+oFf4AJka4H1gWEs5XTGwAA1s0d8XGh7W7Dt9F5FZij8F7/9Pi6+FhhxZFI
+f1DD+yry9D7+Sp+BgdNALe4XOpf25QIBA6OCAQAwgf0wDAYDVR0TBAUwAwEB/zAL
+BgNVHQ8EBAMCAoQwHQYDVR0OBBYEFFi/kuGzxhVpjGxe9ZwlxC3fH9jFMFMGA1Ud
+IwRMMEqAFFi/kuGzxhVpjGxe9ZwlxC3fH9jFoS+kLTArMRAwDgYDVQQKEwdSRCBD
+ZXJ0MRcwFQYDVQQDEw5SRCBDZXJ0aWZpY2F0ZYIBADBsBgNVHSAEZTBjMGEGBFUd
+IAAwWTATBggrBgEFBQcCARYHaHR0cDovLzBCBggrBgEFBQcCAjA2GjRGb3IgUiZE
+IHVzYWdlIG9ubHkuIFRoaXMgY2VydGlmaWNhdGUgaXMgbm90IHRydXN0ZWQuMA0G
+CSqGSIb3DQEBBQUAA4GBAHGB4RQMAgBdeT2hxfOr6f2nA/dZm+M5yX5daUtZnET9
+Ed0A9sazLawfN2G1KFQT9kxEParAyoAkpbMAsRrnRz/9cM3OHgFm/NiKRnf50DpT
+7oCx0I/65mVD2kt+xXE62/Ii5KPnTufIkPi2uLvURCia1tTS8JmJ8dtxDGyQt8BR
+-----END CERTIFICATE-----
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/inc/FavouritesDbTestObserver.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration of class CFavouritesDbTestObserver.
+*
+*/
+
+
+#ifndef FAVOURITES_DB_TEST_OBSERVER_H
+#define FAVOURITES_DB_TEST_OBSERVER_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <FavouritesDbObserver.h>
+#include "FavouritesEngineTest.h"
+
+// FORWARD DECLARATION
+
+class CActiveFavouritesDbNotifier;
+
+// CLASS DECLARATION
+
+/**
+* Favourites Engine test observer.
+*/
+class CFavouritesDbTestObserver: public CActive, public MFavouritesDbObserver
+    {
+    public:     // Constructors and destructor
+        
+        /**
+        * Constructor.
+        * @param aTester Tester object.
+        */
+        CFavouritesDbTestObserver( CFavouritesEngineTest& aTester );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CFavouritesDbTestObserver();
+
+    protected:  // from CActive
+
+        /**
+        * Run a step of the observer test.
+        */
+        void RunL();
+
+        /**
+        * Cancel protocol implementation.
+        */
+        void DoCancel();
+
+    public:     // from MFavouritesDbObserver
+
+        /**
+        * Act accordingly to database events.
+        * @param aEvent Database event.
+        */
+        void HandleFavouritesDbEventL( RDbNotifier::TEvent aEvent );
+
+    public:     // new methods
+
+        /**
+        * Start the test.
+        */
+        void Start();
+
+        /**
+        * Continue the test.
+        */
+        void Next();
+
+    private:    // data
+
+        CFavouritesEngineTest* iTester;           ///< Tester; not owned.
+        CActiveFavouritesDbNotifier* iNotifier; ///< Database notifier.
+        TInt iStep;                             ///< Test step.
+        TInt iLastEvent;                        ///< Last event occurred.
+        TInt iEventCount;                       ///< Count of events.
+
+    };
+
+#endif
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/inc/FavouritesEngineTest.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,1289 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FavouritesEngineTest test module.
+*
+*/
+
+
+
+#ifndef FAVOURITESENGINETEST_H
+#define FAVOURITESENGINETEST_H
+
+// INCLUDES
+#include "StifTestModule.h"
+#include <StifLogger.h>
+#include <f32file.h>
+#include <FavouritesSession.h>
+#include <FavouritesItem.h>
+#include <FavouritesItemList.h>
+#include <FavouritesDb.h>
+#include <FavouritesFile.h>
+//#include <RfsApMapper.h>
+#include <FavouritesDbIncremental.h>
+#include <FavouritesDbObserver.h>
+#include <ActiveFavouritesDbNotifier.h>
+#include "FavouritesItemTestData.h"
+
+// CONSTANTS
+_LIT( KTestDbName, "Test" );
+
+// MACROS
+/// Cosmetic purpose macro, to initialize reference item.
+#define InitItemL(name)                             \
+    name->SetType( CFavouritesItem::EItem );        \
+    name->SetNameL( _L( #name ) );                  \
+    name->SetUrlL( _L( #name ) );                   \
+    name->SetUserNameL( _L( #name ) );              \
+    name->SetPasswordL( _L( #name ) );              \
+    name->SetParentFolder( KFavouritesRootUid );
+
+/// Cosmetic purpose macro, to initialize reference folder.
+#define InitFolderL(name)                           \
+    name->SetType( CFavouritesItem::EFolder );      \
+    name->SetNameL( _L( #name ) );                  \
+    name->SetUrlL( _L( "" ) );                      \
+    name->SetUserNameL( _L( "" ) );                 \
+    name->SetPasswordL( _L( "" ) );                 \
+    name->SetParentFolder( KFavouritesRootUid );
+
+/// Cosmetic purpose macro, to create and initialize reference item.
+#define CreateItemL(name)                           \
+    name = CFavouritesItem::NewL();                 \
+    InitItemL( name );
+
+/// Cosmetic purpose macro, to create and initialize reference folder.
+#define CreateFolderL(name)                         \
+    name = CFavouritesItem::NewL();                 \
+    InitFolderL( name );
+
+// Logging path
+_LIT( KFavouritesEngineTestLogPath, "\\logs\\testframework\\FavouritesEngineTest\\" ); 
+// Log file
+_LIT( KFavouritesEngineTestLogFile, "FavouritesEngineTest.txt" ); 
+
+// Function pointer related internal definitions
+// Rounding known bug in GCC
+
+#ifdef __VC32__
+#define GETPTR 
+#else
+#define GETPTR &
+#endif  
+#define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
+#define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
+#define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
+#define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
+
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+class CFavouritesEngineTest;
+class CActiveFavouritesDbNotifier;
+
+// A typedef for function that does the actual testing,
+// function is a type 
+// TInt CDemoModule::<NameOfFunction> ( TTestResult& aResult )
+typedef TInt (CFavouritesEngineTest::* TestFunction)(TTestResult&);    
+
+// CLASS DECLARATION
+
+/**
+*  An internal structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  \b Library: ?library
+*
+*  @since ?Series60_version
+*/
+class TCaseInfoInternal
+    {
+    public:
+        const TText*    iCaseName;
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+    };
+
+// CLASS DECLARATION
+
+/**
+*  A structure containing a test case name and
+*  the pointer to function doing the test
+*
+*  \b Library: ?library
+*
+*  @since ?Series60_version
+*/
+class TCaseInfo
+    {
+    public:
+        TPtrC           iCaseName;    
+        TestFunction    iMethod;
+        TBool           iIsOOMTest;
+        TInt            iFirstMemoryAllocation;
+        TInt            iLastMemoryAllocation;
+
+    TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
+        {        
+        };
+
+    };
+
+// CLASS DECLARATION
+
+/**
+*  This a FavouritesBCTest class.
+*  ?other_description_lines
+*
+*  \b Library: ?library
+*
+*  @since ?Series60_version
+*/
+//NONSHARABLE_CLASS(CFavouritesEngineTest) : public CTestModuleBase,
+//                                       public MRfsApMapper
+NONSHARABLE_CLASS(CFavouritesEngineTest) : public CTestModuleBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CFavouritesEngineTest* NewL();
+
+        /**
+        * Destructor.
+        */
+        virtual ~CFavouritesEngineTest();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    private:    // from MRfsApMApper
+
+        /**
+        * Dummy AP mapping to test RFS. Original value is returned always.
+        * @return ETrue.
+        */
+        TBool MapAccessPoint( TUint aOldUid, TUint& aNewUid );
+
+    public: // Functions from base classes
+
+        /**
+        * From CTestModuleBase InitL is used to initialize the FavouritesBCTest. 
+        *       It is called once for every instance of FavouritesBCTest after
+        *       its creation.
+        * @since ?Series60_version
+        * @param aIniFile Initialization file for the test module (optional)
+        * @param aFirstTime Flag is true when InitL is executed for first 
+        *               created instance of FavouritesBCTest.
+        * @return Symbian OS error code
+        */
+        TInt InitL( TFileName& aIniFile, TBool aFirstTime );
+
+        /**
+        * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
+        *   from FavouritesBCTest. 
+        * @since ?Series60_version
+        * @param aTestCaseFile Test case file (optional)
+        * @param aTestCases  Array of TestCases returned to test framework
+        * @return Symbian OS error code
+        */
+        TInt GetTestCasesL( const TFileName& aTestCaseFile, 
+                            RPointerArray<TTestCaseInfo>& aTestCases );
+
+        /**
+        * From CTestModuleBase RunTestCaseL is used to run an individual 
+        *   test case. 
+        * @since ?Series60_version
+        * @param aCaseNumber Test case number
+        * @param aTestCaseFile Test case file (optional)
+        * @param aResult Test case result returned to test framework (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error, which is 
+        *           not reported in aResult parameter as test case failure).
+        */   
+        TInt RunTestCaseL( const TInt aCaseNumber, 
+                           const TFileName& aTestCaseFile,
+                           TTestResult& aResult );
+
+        /**
+        * From CTestModuleBase; OOMTestQueryL is used to specify is particular
+        * test case going to be executed using OOM conditions
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailureType OOM failure type (optional)
+        * @param aFirstMemFailure The first heap memory allocation failure value (optional)
+        * @param aLastMemFailure The last heap memory allocation failure value (optional)
+        * @return TBool
+        */
+        virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
+                                     const TInt /* aCaseNumber */, 
+                                     TOOMFailureType& /* aFailureType */,
+                                     TInt& /* aFirstMemFailure */, 
+                                     TInt& /* aLastMemFailure */ );
+
+        /**
+        * From CTestModuleBase; User may add implementation for OOM test 
+        * environment initialization. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
+                                    const TInt /* aCaseNumber */ ); 
+
+        /**
+        * From CTestModuleBase; OOMHandleWarningL. User may add implementation 
+        * for OOM test warning handling. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @param aFailNextValue FailNextValue for OOM test execution (optional)
+        * @return None
+        */
+        virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
+                                        const TInt /* aCaseNumber */, 
+                                        TInt& /* aFailNextValue */);
+
+        /**
+        * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
+        * test environment. Usually no implementation is required.
+        * @param aTestCaseFile Test case file (optional)
+        * @param aCaseNumber Test case number (optional)
+        * @return None
+        */
+        virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
+                                       const TInt /* aCaseNumber */ );
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CFavouritesEngineTest();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Function returning test case name and pointer to test case function.
+        * @since ?Series60_version
+        * @param aCaseNumber test case number
+        * @return TCaseInfo 
+        */
+        const TCaseInfo Case ( const TInt aCaseNumber ) const;
+
+    private:   // Functions to test FavouritesItem interface
+
+        /**
+        * FavouritesItem NewLC test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemNewLCTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem NewL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemNewLTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem destructor test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemDestructorTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem Assign(=) operator test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemAssignTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem Uid test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemUidTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem ParentFolder test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemParentFolderTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem Type test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemTypeTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem Name test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemNameTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem Url test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemUrlTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem WapAp test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemWapApTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem UserName test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemUserNameTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem Password test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemPasswordTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem ContextId test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemContextIdTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem IsItem test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemIsItemTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem IsFolder test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemIsFolderTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem IsFactoryItem test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemIsFactoryItemTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem IsReadOnly test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemIsReadOnlyTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem Modified test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemModifiedTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem ClearL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemClearLTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetParentFolder test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetParentFolderTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetType test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetTypeTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetNameL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetNameLTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetUrlL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetUrlLTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetWapAp test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetWapApTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetUserNameL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetUserNameLTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetPasswordL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetPasswordLTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItem SetContextId test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ItemSetContextIdTestL( TTestResult& aResult );
+
+    private:     // Functions to test FavouritesItemList interface
+
+        /**
+        * FavouritesItemList constructor (CFavouritesItemList) test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListConstructorTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItemList destructor (~CFavouritesItemList) test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListDestructorTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItemList Delete single item test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListDeleteTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItemList Delete range of items test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListDeleteRangeTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItemList SortL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListSortTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItemList UidToIndex test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListUidToIndexTestL( TTestResult& aResult );
+
+        /**
+        * FavouritesItemList IndexToUid test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListIndexToUidTestL( TTestResult& aResult );
+        
+        /**
+        * FavouritesItemList ItemByUid test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt ListItemByUidTestL( TTestResult& aResult );
+        
+    private:
+        /**
+        * CreatePopulatedDbL is used to create a Favourites Db
+        * populated with test data.
+        * @since ?Series60_version
+        * @param None
+        * @return None
+        */
+        void CreatePopulatedDbL();
+        
+        /**
+        * DestroyDbItems deletes the items used by CreatePopulatedDbL.
+        * @since ?Series60_version
+        * @param None
+        * @return None
+        */
+        void DestroyDbItems();
+        
+    private:   // Functions to test RFavouritesDb interface
+
+        /**
+        * RFavouritesDb Open test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbOpenTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Version test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbVersionTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb IsDamaged test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbIsDamagedTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Recover test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbRecoverTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Compact test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbCompactTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Size test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSizeTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb UpdateStats test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbUpdateStatsTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Begin test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbBeginTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Commit test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbCommitTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Rollback test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbRollbackTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb CleanupRollbackPushL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbCleanupRollbackPushLTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Get test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbGetTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb GetAll test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbGetAllTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb GetUids test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbGetUidsTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb PreferredUid test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbPreferredUidTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Delete test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbDeleteTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Update test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbUpdateTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Add test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbAddTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetHomepage test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetHomepageTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetLastVisited test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetLastVisitedTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetFactoryItem test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetFactoryItemTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetReadOnly test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetReadOnlyTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetModified test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetModifiedTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetPreferredUid test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetPreferredUidTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb ItemExists test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbItemExistsTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb FolderExists test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbFolderExistsTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb Count test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbCountTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetData test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetDataTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb GetData test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbGetDataTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetBrowserData test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbSetBrowserDataTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb SetBrowserData test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbGetBrowserDataTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb MakeUniqueName with folder argument test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbMakeUniqueNameWithFolderTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb MakeUniqueName test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbMakeUniqueNameTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb CreateStartPageItemL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbCreateStartPageItemLTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb CreateAdaptiveItemsFolderL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbCreateAdaptiveItemsFolderLTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb DeleteFile test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbDeleteFileTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb RestoreFactorySettingsL test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbRestoreFactorySettingsLTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDb DeleteFile test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbDeleteFolderTestL( TTestResult& aResult );
+
+    private:   // Functions to test TFavouritesWapAp interface
+
+        /**
+        * TFavouritesWapAp constructor test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApConstructorTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp assign operator using TFavouritesWapAp test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApAssignWithApTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp assign operator using ApId test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApAssignWithApIdTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp SetNull test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApSetNullTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp SetDefault test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApSetDefaultTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp SetApId test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApSetApIdTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp IsNull test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApIsNullTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp IsDefault test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApIsDefaultTest( TTestResult& aResult );
+
+        /**
+        * TFavouritesWapAp ApId test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt WapApApIdTest( TTestResult& aResult );
+
+    private:   // Functions to test RFavouritesDbIncremental interface
+    
+        /**
+        * RFavouritesDbIncremental Recover test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbIncRecoverTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDbIncremental Compact test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbIncCompactTestL( TTestResult& aResult );
+
+        /**
+        * RFavouritesDbIncremental Next test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt DbIncNextTestL( TTestResult& aResult );
+
+    private:   // Functions to test RFavouritesFile interface
+    
+        /**
+        * RFavouritesFile Close test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt FileCloseTestL( TTestResult& aResult );
+    
+        /**
+        * RFavouritesFile Open test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt FileOpenTestL( TTestResult& aResult );
+    
+        /**
+        * RFavouritesFile Replace test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt FileReplaceTestL( TTestResult& aResult );
+    
+        /**
+        * RFavouritesFile Read test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt FileReadTestL( TTestResult& aResult );
+    
+        /**
+        * RFavouritesFile Write test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt FileWriteTestL( TTestResult& aResult );
+    
+        /**
+        * RFavouritesFile Size test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt FileSizeTestL( TTestResult& aResult );
+
+    private:   // Functions to test RFavouritesSession interface
+    
+        /**
+        * RFavouritesSession Version test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SessionVersionTest( TTestResult& aResult );
+    
+        /**
+        * RFavouritesSession Connect test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SessionConnectTest( TTestResult& aResult );
+    
+        /**
+        * RFavouritesSession ResourceMark test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SessionResourceMarkTest( TTestResult& aResult );
+    
+        /**
+        * RFavouritesSession ResourceCheck test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SessionResourceCheckTest( TTestResult& aResult );
+    
+        /**
+        * RFavouritesSession ResourceCount test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SessionResourceCountTest( TTestResult& aResult );
+    
+        /**
+        * RFavouritesSession DeleteDatabase test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SessionDeleteDatabaseTestL( TTestResult& aResult );
+    
+        /**
+        * RFavouritesSession __DbgSetAllocFail test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt SessionDbgSetAllocFailTest( TTestResult& aResult );
+
+    private:   // Functions to test CActiveFavouritesDbNotifier interface
+    
+        /**
+        * CActiveFavouritesDbNotifier constructor test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt NotifierConstructorTestL( TTestResult& aResult );
+    
+        /**
+        * CActiveFavouritesDbNotifier destructor test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt NotifierDestructorTestL( TTestResult& aResult );
+    
+        /**
+        * CActiveFavouritesDbNotifier Start test case.
+        * @since ?Series60_version
+        * @param aResult Test case result (PASS/FAIL)
+        * @return Symbian OS error code (test case execution error 
+        *   that is not returned as test case result in aResult)
+        */
+        TInt NotifierStartTestL( TTestResult& aResult );
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        // Pointer to test (function) to be executed
+        TestFunction iMethod;
+
+        CStifLogger * iLog;
+        
+        RFavouritesSession iFavouritesSession;
+        RFs iFileSystem;
+        RFavouritesDb iFavouritesDb;
+        CFavouritesItem* iItemFolder1;
+        CFavouritesItem* iItemFolder2;
+        CFavouritesItem* iItem1;
+        CFavouritesItem* iItem2;
+        CFavouritesItem* iItem3;
+        CFavouritesItem* iItem4;
+        CFavouritesItem* iItem5;
+        CFavouritesItem* iItem6;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+
+    };
+
+#endif      // FAVOURITESENGINETEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/inc/FavouritesItemTestData.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Declaration of class TFavouritesItemTestData.
+*
+*/
+
+
+#ifndef FAVOURITES_ITEM_TEST_DATA_H
+#define FAVOURITES_ITEM_TEST_DATA_H
+
+//  INCLUDES
+
+#include <e32base.h>
+#include <FavouritesItemData.h>
+
+// CLASS DECLARATION
+
+/**
+* Mixin class for representing extra data for a favourites item.
+*/
+class TFavouritesItemTestData: public MFavouritesItemData
+    {
+
+    public:     // from MFavouritesItemData
+
+        /**
+        * Externalize into a stream.
+        * @param aStream The stream to externalize to.
+        */
+        virtual void ExternalizeL( RWriteStream& aStream ) const;
+
+        /**
+        * Internalize from a stream.
+        * @param aStream The stream to externalize from.
+        */
+        virtual void InternalizeL( RReadStream& aStream );
+
+    public:     // data
+
+        TInt iTestData;     ///< Some test data to write / read.
+
+    };
+
+#endif
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/init/testframework.ini	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,178 @@
+#
+# This is STIFTestFramework initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if 
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module. 
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= FavouritesEngineTest
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIFTestFramework logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number 
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' 
+
+#CreateLogDirectories= YES		# Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML			# Possible values: TXT or HTML
+#EmulatorOutput= FILE			# Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML			# Possible values: TXT or HTML
+#HardwareOutput= FILE			# Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE		# Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES			# Possible values: YES or NO
+#WithTimeStamp= YES			# Possible values: YES or NO
+#WithLineBreak= YES			# Possible values: YES or NO
+#WithEventRanking= YES			# Possible values: YES or NO
+
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesDbIncrementalTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,232 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbIncRecoverTestL
+
+    Description: Test the RFavouritesDbIncremental Recover method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbIncRecoverTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesDbIncremental Recover method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt step;
+    RFavouritesDbIncremental incremental;
+    TInt result = incremental.Recover( iFavouritesDb, step );
+    CleanupClosePushL<RFavouritesDbIncremental>( incremental );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, incremental
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbIncCompactTestL
+
+    Description: Test the RFavouritesDbIncremental Compact method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbIncCompactTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesDbIncremental Compact method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt step;
+    RFavouritesDbIncremental incremental;
+    TInt result = incremental.Compact( iFavouritesDb, step );
+    CleanupClosePushL<RFavouritesDbIncremental>( incremental );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, incremental
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbIncNextTestL
+
+    Description: Test the RFavouritesDbIncremental Next method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbIncNextTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesDbIncremental Next method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt step;
+    RFavouritesDbIncremental incremental;
+    incremental.Compact( iFavouritesDb, step );
+    CleanupClosePushL<RFavouritesDbIncremental>( incremental );
+
+    TInt result = incremental.Next( step );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, incremental
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesDbTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,2210 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbOpenTestL
+
+    Description: Test opening the Favourites Db by using the Open method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbOpenTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Open method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TInt result = iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbVersionTestL
+
+    Description: Test the Favourites Db Version method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbVersionTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Version method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    TVersion dbVersion = iFavouritesDb.Version();
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (dbVersion.iMajor > 0)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbIsDamagedTestL
+
+    Description: Test the Favourites Db IsDamaged method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbIsDamagedTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db IsDamaged method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    TBool isDbDamaged = EFalse;
+    
+    TInt result = iFavouritesDb.IsDamaged(isDbDamaged);
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbRecoverTestL
+
+    Description: Test the Favourites Db Recover method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbRecoverTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Recover method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    TInt result = iFavouritesDb.Recover();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbCompactTestL
+
+    Description: Test the Favourites Db Compact method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbCompactTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Compact method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    TInt result = iFavouritesDb.Compact();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSizeTestL
+
+    Description: Test the Favourites Db Size method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSizeTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Size method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    RDbDatabase::TSize dbSize;
+    
+    TInt result = iFavouritesDb.Size(dbSize);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbUpdateStatsTestL
+
+    Description: Test the Favourites Db UpdateStats method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbUpdateStatsTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db UpdateStats method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    TInt result = iFavouritesDb.UpdateStats();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbBeginTestL
+
+    Description: Test the Favourites Db Begin method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbBeginTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Begin method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    TInt result = iFavouritesDb.Begin(EFalse);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbCommitTestL
+
+    Description: Test the Favourites Db Commit method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbCommitTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Commit method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    iFavouritesDb.Begin(EFalse);
+    TInt result = iFavouritesDb.Commit();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbRollbackTestL
+
+    Description: Test the Favourites Db Rollback method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbRollbackTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Rollback method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    iFavouritesDb.Begin(EFalse);
+    CreateItemL( iItem1 );
+    iFavouritesDb.Add( *iItem1, EFalse );
+    
+    TInt result = KErrNone;
+    TRAP(result, iFavouritesDb.Rollback());
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    delete iItem1;
+    iItem1 = NULL;
+    
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbCleanupRollbackPushLTestL
+
+    Description: Test the Favourites Db CleanupRollbackPushL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbCleanupRollbackPushLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db CleanupRollbackPushL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    iFavouritesDb.Begin(EFalse);
+    iFavouritesDb.CleanupRollbackPushL();
+    CreateItemL( iItem1 );
+    iFavouritesDb.Add( *iItem1, EFalse );
+    TInt result = iFavouritesDb.Commit();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::Pop(); // RollbackPush
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    delete iItem1;
+    iItem1 = NULL;
+    
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbGetTestL
+
+    Description: Test the Favourites Db Get method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbGetTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Get method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+
+    TInt result = iFavouritesDb.Get( iItem1->Uid(), *item );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, item
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbGetAllTestL
+
+    Description: Test the Favourites Db GetAll method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbGetAllTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db GetAll method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    TInt result = iFavouritesDb.GetAll( *list, KFavouritesRootUid );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete list;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbGetUidsTestL
+
+    Description: Test the Favourites Db GetUids method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbGetUidsTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db GetUids method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    CArrayFix<TInt>* uids = new (ELeave) CArrayFixFlat<TInt>( 1 );
+
+    TInt result = iFavouritesDb.GetUids( *uids, KFavouritesRootUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete uids;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbPreferredUidTestL
+
+    Description: Test the Favourites Db PreferredUid method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbPreferredUidTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db PreferredUid method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    iFavouritesDb.SetPreferredUid(iItemFolder1->Uid(), 222);
+    TInt preferredUid;
+    iFavouritesDb.PreferredUid( iItemFolder1->Uid(), preferredUid );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (preferredUid == 222)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbDeleteTestL
+
+    Description: Test the Favourites Db Delete method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbDeleteTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt countBeforeDelete;
+    iFavouritesDb.Count(countBeforeDelete, KFavouritesNullUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId);
+    iFavouritesDb.Delete( iItem3->Uid() );
+    TInt countAfterDelete;
+    iFavouritesDb.Count(countAfterDelete, KFavouritesNullUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (countAfterDelete == countBeforeDelete - 1)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbUpdateTestL
+
+    Description: Test the Favourites Db Update method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbUpdateTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Update method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    CFavouritesItem* updateItem = CFavouritesItem::NewLC();
+
+    InitItemL( updateItem );
+    updateItem->SetParentFolder(iItemFolder1->Uid());
+    TInt result = iFavouritesDb.Update(*updateItem, iItem6->Uid(), EFalse);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, updateItem
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbAddTestL
+
+    Description: Test the Favourites Db Add method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbAddTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Add method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    CFavouritesItem* itemToAdd = CFavouritesItem::NewLC();
+    InitItemL( itemToAdd );
+
+    TInt countBeforeAdd;
+    iFavouritesDb.Count(countBeforeAdd, KFavouritesNullUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId);
+    iFavouritesDb.Add( *itemToAdd, EFalse );
+    TInt countAfterAdd;
+    iFavouritesDb.Count(countAfterAdd, KFavouritesNullUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (countAfterAdd == countBeforeAdd + 1)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, itemToAdd
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetHomepageTestL
+
+    Description: Test the Favourites Db SetHomepage method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetHomepageTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetHomepage method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CFavouritesItem* homepageItem = CFavouritesItem::NewLC();
+    InitItemL( homepageItem );
+    
+    TInt result = iFavouritesDb.SetHomepage(*homepageItem);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, homepageItem
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetLastVisitedTestL
+
+    Description: Test the Favourites Db SetLastVisited method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetLastVisitedTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetLastVisited method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CFavouritesItem* lastvisitedItem = CFavouritesItem::NewLC();
+    InitItemL( lastvisitedItem );
+    
+    TInt result = iFavouritesDb.SetLastVisited( *lastvisitedItem );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, lastvisitedItem
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetFactoryItemTestL
+
+    Description: Test the Favourites Db SetFactoryItem method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetFactoryItemTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetFactoryItem method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt result = iFavouritesDb.SetFactoryItem( iItem1->Uid(), ETrue );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetReadOnlyTestL
+
+    Description: Test the Favourites Db SetReadOnly method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetReadOnlyTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetReadOnly method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt result = iFavouritesDb.SetReadOnly( iItem1->Uid(), ETrue );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetModifiedTestL
+
+    Description: Test the Favourites Db SetModified method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetModifiedTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetModified method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt result = iFavouritesDb.SetModified( iItem1->Uid(), TTime() );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetPreferredUidTestL
+
+    Description: Test the Favourites Db SetPreferredUid method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetPreferredUidTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetPreferredUid method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt result = iFavouritesDb.SetPreferredUid(iItemFolder1->Uid(), 222);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbItemExistsTestL
+
+    Description: Test the Favourites Db ItemExists method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbItemExistsTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db ItemExists method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    TBool doesItemExist;
+
+    TInt result = iFavouritesDb.ItemExists(iItem1->Uid(), doesItemExist);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbFolderExistsTestL
+
+    Description: Test the Favourites Db FolderExists method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbFolderExistsTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db FolderExists method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    TBool doesFolderExist;
+
+    TInt result = iFavouritesDb.FolderExists(iItemFolder1->Uid(), doesFolderExist);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbCountTestL
+
+    Description: Test the Favourites Db Count method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbCountTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Count method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt count;
+    TInt result = iFavouritesDb.Count(count, KFavouritesNullUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetDataTestL
+
+    Description: Test the Favourites Db SetData method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetDataTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetData method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TFavouritesItemTestData data;
+    data.iTestData = 222;
+
+    TInt result = iFavouritesDb.SetData(iItem1->Uid(), data);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbGetDataTestL
+
+    Description: Test the Favourites Db GetData method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbGetDataTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db GetData method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TFavouritesItemTestData data;
+    data.iTestData = 222;
+
+    iFavouritesDb.SetData(iItem1->Uid(), data);
+    TInt result = iFavouritesDb.GetData(iItem1->Uid(), data);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbSetBrowserDataTestL
+
+    Description: Test the Favourites Db SetBrowserData method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbSetBrowserDataTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db SetBrowserData method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TFavouritesItemTestData data;
+    data.iTestData = 222;
+
+    TInt result = iFavouritesDb.SetBrowserData(iItem1->Uid(), data);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbGetBrowserDataTestL
+
+    Description: Test the Favourites Db GetBrowserData method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbGetBrowserDataTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db GetBrowserData method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TFavouritesItemTestData data;
+    data.iTestData = 222;
+
+    iFavouritesDb.SetBrowserData(iItem1->Uid(), data);
+    TInt result = iFavouritesDb.GetBrowserData(iItem1->Uid(), data);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbMakeUniqueNameWithFolderTestL
+
+    Description: Test the Favourites Db MakeUniqueName method with folder argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbMakeUniqueNameWithFolderTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db MakeUniqueName method with folder argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TBuf<KFavouritesMaxName> name = _L("Item");
+    TInt result = iFavouritesDb.MakeUniqueName( name, KFavouritesRootUid );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbMakeUniqueNameTestL
+
+    Description: Test the Favourites Db MakeUniqueName method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbMakeUniqueNameTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db MakeUniqueName method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    CFavouritesItem* uniqueItem = CFavouritesItem::NewLC();
+
+    InitItemL( uniqueItem );
+    TInt result = iFavouritesDb.MakeUniqueName( *uniqueItem );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (result == KErrNone)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, uniqueItem
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbCreateStartPageItemLTestL
+
+    Description: Test the Favourites Db CreateStartPageItemL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbCreateStartPageItemLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db CreateStartPageItemL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    CFavouritesItem* startPageItem = iFavouritesDb.CreateStartPageItemL();
+    CleanupStack::PushL( startPageItem );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if ( startPageItem->Uid() == KFavouritesStartPageUid )
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, startPageItem
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbCreateAdaptiveItemsFolderLTestL
+
+    Description: Test the Favourites Db CreateAdaptiveItemsFolderL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbCreateAdaptiveItemsFolderLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db CreateAdaptiveItemsFolderL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    CFavouritesItem* adaptiveItemsFolder = iFavouritesDb.CreateAdaptiveItemsFolderL();
+    CleanupStack::PushL( adaptiveItemsFolder );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if ( adaptiveItemsFolder->Uid() == KFavouritesAdaptiveItemsFolderUid )
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, startPageItem
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbDeleteFileTestL
+
+    Description: Test the Favourites Db DeleteFile method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbDeleteFileTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db DeleteFile method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt result = iFavouritesDb.DeleteFile( iItem1->Uid() );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if ( result == KErrNotFound )
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbRestoreFactorySettingsLTestL
+
+    Description: Test the Favourites Db RestoreFactorySettingsL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbRestoreFactorySettingsLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+/*    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db RestoreFactorySettingsL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    _LIT( KFailureMode , "RestoreFactorySettingsL is leaving in the STIF test context.");
+    aResult.SetResult( KErrGeneral, KFailureMode );
+
+    _LIT( KFailureMode2 , "That leave cannot currently be trapped, so unable to test.");
+    aResult.SetResult( KErrGeneral, KFailureMode2 );
+
+    _LIT( KBookmarkDatabaseBackup, "c:\\system\\data\\Bookmarks1.db.backup" );
+    _LIT( KBookmarkDatabase, "c:\\private\\100012a5\\DBS_101FD685_Test.db" );
+    _LIT( KDatabasePath, "c:\\testdata\\Bookmarks1.db.RfsTest.v80" );
+
+    TRAPD( err, RFavouritesDb::RestoreFactorySettingsL( KTestDbName, KDatabasePath, *this ) );
+
+    if ( err == KErrPathNotFound )
+	    {
+*/
+        _LIT( KDescription , "Test case passed");
+        aResult.SetResult( KErrNone, KDescription );
+/*	    }
+    else
+	    {
+        _LIT( KDescription , "Test case failed");
+        aResult.SetResult( KErrGeneral, KDescription );
+	    }
+*/
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DbDeleteTestL
+
+    Description: Test the Favourites Db Delete method on deleting a non-empty 
+    folder.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Draft
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::DbDeleteFolderTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the Db Delete method on Folder");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+
+    TInt countBeforeDelete;
+    iFavouritesDb.Count(countBeforeDelete, KFavouritesNullUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId);
+
+    /*
+    ::Delete API documentation states:
+    "If this is a folder, all descendants and the contents of them are deleted." 
+    Deleting iItemFolder1 must cause iItem3 and iItem4 to be deleted.
+    */
+    const TInt result = iFavouritesDb.Delete( iItemFolder1->Uid() );
+
+    TInt countAfterDelete;
+    iFavouritesDb.Count(countAfterDelete, KFavouritesNullUid, CFavouritesItem::ENone, NULL, KFavouritesNullContextId);
+
+    // 3 less items - the folder iItemFolder1 and items iItem3, iItem4 in 
+    // that folder
+    if ( (result == KErrNone) && (countAfterDelete == countBeforeDelete - 3 ) )
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesDbTestObserver.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of class CFavouritesDbTestObserver
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <FavouritesDb.h>
+#include "FavouritesDbTestObserver.h"
+//#include "FavouritesDbTester.h"
+#include "ActiveFavouritesDbNotifier.h"
+
+// CONSTANTS
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// CFavouritesDbTestObserver::CFavouritesDbTestObserver
+// ---------------------------------------------------------
+//
+CFavouritesDbTestObserver::CFavouritesDbTestObserver
+( CFavouritesEngineTest& aTester )
+: CActive( EPriorityLow ), iTester( &aTester )
+    {
+    // Observer has lower priority than the notifier; to make sure we don't
+    // miss notification.
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------
+// CFavouritesDbTestObserver::~CFavouritesDbTestObserver
+// ---------------------------------------------------------
+//
+CFavouritesDbTestObserver::~CFavouritesDbTestObserver()
+    {
+    Cancel();
+    delete iNotifier;
+//    iTester->iDb.Close();
+    }
+
+// ---------------------------------------------------------
+// CFavouritesDbTestObserver::RunL
+// ---------------------------------------------------------
+//
+void CFavouritesDbTestObserver::RunL()
+    {
+    CActiveScheduler::Stop();
+    }
+
+// ---------------------------------------------------------
+// CFavouritesDbTestObserver::DoCancel
+// ---------------------------------------------------------
+//
+void CFavouritesDbTestObserver::DoCancel()
+    {
+    if ( iNotifier )
+        {
+        iNotifier->Cancel();
+        }
+    }
+
+// ---------------------------------------------------------
+// CFavouritesDbTestObserver::HandleFavouritesDbEventL
+// ---------------------------------------------------------
+//
+void CFavouritesDbTestObserver::HandleFavouritesDbEventL
+( RDbNotifier::TEvent aEvent )
+    {
+    iLastEvent = aEvent;
+    iEventCount++;
+    }
+
+// ---------------------------------------------------------
+// CFavouritesDbTestObserver::Start
+// ---------------------------------------------------------
+//
+void CFavouritesDbTestObserver::Start()
+    {
+    iStep = -1; // First call to Next will increment it to 1.
+    iLastEvent = 666;
+    iEventCount = 0;
+    Next();
+    }
+
+// ---------------------------------------------------------
+// CFavouritesDbTestObserver::Next
+// ---------------------------------------------------------
+//
+void CFavouritesDbTestObserver::Next()
+    {
+    iStep++;
+    iStatus = KRequestPending;
+    SetActive();
+	TRequestStatus *status = &iStatus;
+	User::RequestComplete( status, KErrNone );  // Invoke RunL()
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesEngineTest.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,697 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  FavouritesBCTest class member functions
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES  
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ---------------------------------------------------------
+// DeleteFileL
+// ---------------------------------------------------------
+//
+void DeleteFileL( const TDesC& aFile, RFs& aFs )
+    {
+    TParse file;
+    User::LeaveIfError( aFs.Parse( aFile, file ) );
+    TUint att;
+    TInt res = aFs.Att( file.FullName(), att );
+    if ( res == KErrNone )
+        {
+        User::LeaveIfError( aFs.Delete( file.FullName() ) );
+        }
+    }
+
+// ---------------------------------------------------------
+// CopyFileL
+// ---------------------------------------------------------
+//
+void CopyFileL( const TDesC& aSrc, const TDesC& aDst, RFs& aFs )
+    {
+    RFile src;
+    RFile dst;
+    TBuf8<256> buf;
+
+    User::LeaveIfError( src.Open
+        ( aFs, aSrc, EFileRead | EFileShareReadersOnly | EFileStream ) );
+    CleanupClosePushL<RFile>( src );
+    (void)aFs.MkDirAll( aDst );    
+    (void)aFs.SetAtt( aDst, 0, KEntryAttReadOnly ); // Overwrite read-only.
+    User::LeaveIfError( dst.Replace
+        ( aFs, aDst, EFileWrite | EFileShareExclusive | EFileStream ) );
+    CleanupClosePushL<RFile>( dst );
+    FOREVER
+        {
+        User::LeaveIfError( src.Read( buf ) );
+        if ( !buf.Length() )
+            {
+            break;
+            }
+        User::LeaveIfError( dst.Write( buf ) );
+        }
+    CleanupStack::PopAndDestroy( 2 );   // close dst, src
+    }
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::CFavouritesEngineTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CFavouritesEngineTest::CFavouritesEngineTest()
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// Note: If OOM test case uses STIF Logger, then STIF Logger must be created
+// with static buffer size parameter (aStaticBufferSize). Otherwise Logger 
+// allocates memory from heap and therefore causes error situations with OOM 
+// testing. For more information about STIF Logger construction, see STIF Users 
+// Guide.
+// -----------------------------------------------------------------------------
+//
+void CFavouritesEngineTest::ConstructL()
+    {
+    iLog = CStifLogger::NewL( KFavouritesEngineTestLogPath, 
+                          KFavouritesEngineTestLogFile);
+                          
+    User::LeaveIfError( iFileSystem.Connect() );
+
+    User::LeaveIfError( iFavouritesSession.Connect() );
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CFavouritesEngineTest* CFavouritesEngineTest::NewL()
+    {
+    CFavouritesEngineTest* self = new (ELeave) CFavouritesEngineTest;
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CFavouritesEngineTest::~CFavouritesEngineTest()
+    {
+    iFavouritesDb.Close();
+    iFavouritesSession.Close();
+    iFileSystem.Close();
+    delete iLog;
+    }
+
+// ----------------------------------------------------------
+// CFavouritesDbTester::MapAccessPoint()
+// ----------------------------------------------------------
+//
+TBool CFavouritesEngineTest::MapAccessPoint
+( TUint aOldUid, TUint& aNewUid )
+    {
+    aNewUid = aOldUid;
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::InitL
+// InitL is used to initialize the Test Module.
+// -----------------------------------------------------------------------------
+//
+TInt CFavouritesEngineTest::InitL( 
+    TFileName& /*aIniFile*/, 
+    TBool /*aFirstTime*/ )
+    {
+    return KErrNone;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CDemoModule
+
+    Method: Case
+
+    Description: Returns a test case by number.
+
+    This function contains an array of all available test cases 
+    i.e pair of case name and test function. If case specified by parameter
+    aCaseNumber is found from array, then that item is returned.
+
+    The reason for this rather complicated function is to specify all the
+    test cases only in one place. It is not necessary to understand how
+    function pointers to class member functions works when adding new test
+    cases. See function body for instructions how to add new test case.
+    
+    Parameters:    const TInt aCaseNumber :in:      Test case number
+
+    Return Values: const TCaseInfo Struct containing case name & function
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/ 
+const TCaseInfo CFavouritesEngineTest::Case ( 
+    const TInt aCaseNumber ) const 
+     {
+
+    /*
+    * To add new test cases, implement new test case function and add new 
+    * line to KCases array specify the name of the case and the function 
+    * doing the test case
+    * In practice, do following
+    *
+    * 1) Make copy of existing test case function and change its name
+    *    and functionality. Note that the function must be added to 
+    *    OOMHard.cpp file and to OOMHard.h 
+    *    header file.
+    *
+    * 2) Add entry to following KCases array either by using:
+    *
+    * 2.1: FUNCENTRY or ENTRY macro
+    * ENTRY macro takes two parameters: test case name and test case 
+    * function name.
+    *
+    * FUNCENTRY macro takes only test case function name as a parameter and
+    * uses that as a test case name and test case function name.
+    *
+    * Or
+    *
+    * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used
+    * only with OOM (Out-Of-Memory) testing!
+    *
+    * OOM_ENTRY macro takes five parameters: test case name, test case 
+    * function name, TBool which specifies is method supposed to be run using
+    * OOM conditions, TInt value for first heap memory allocation failure and 
+    * TInt value for last heap memory allocation failure.
+    * 
+    * OOM_FUNCENTRY macro takes test case function name as a parameter and uses
+    * that as a test case name, TBool which specifies is method supposed to be
+    * run using OOM conditions, TInt value for first heap memory allocation 
+    * failure and TInt value for last heap memory allocation failure. 
+    */ 
+
+    static TCaseInfoInternal const KCases[] =
+        {
+        // To add new test cases, add new items to this array
+        
+        // NOTE: When compiled to GCCE, there must be Classname::
+        // declaration in front of the method name, e.g. 
+        // CDemoModule::PrintTest. Otherwise the compiler
+        // gives errors.
+                
+        ENTRY( "Item NewLC test", CFavouritesEngineTest::ItemNewLCTestL ),
+        ENTRY( "Item NewL test", CFavouritesEngineTest::ItemNewLTestL ),
+        ENTRY( "Item Destructor test", CFavouritesEngineTest::ItemDestructorTestL ),
+        ENTRY( "Item Assign(=) operator test", CFavouritesEngineTest::ItemAssignTestL ),
+        ENTRY( "Item Uid test", CFavouritesEngineTest::ItemUidTestL ),
+        ENTRY( "Item ParentFolder test", CFavouritesEngineTest::ItemParentFolderTestL ),
+        ENTRY( "Item Type test", CFavouritesEngineTest::ItemTypeTestL ),
+        ENTRY( "Item Name test", CFavouritesEngineTest::ItemNameTestL ),
+        ENTRY( "Item Url test", CFavouritesEngineTest::ItemUrlTestL ),
+        ENTRY( "Item WapAp test", CFavouritesEngineTest::ItemWapApTestL ),
+        ENTRY( "Item UserName test", CFavouritesEngineTest::ItemUserNameTestL ),
+        ENTRY( "Item Password test", CFavouritesEngineTest::ItemPasswordTestL ),
+        ENTRY( "Item ContextId test", CFavouritesEngineTest::ItemContextIdTestL ),
+        ENTRY( "Item IsItem test", CFavouritesEngineTest::ItemIsItemTestL ),
+        ENTRY( "Item IsFolder test", CFavouritesEngineTest::ItemIsFolderTestL ),
+        ENTRY( "Item IsFactoryItem test", CFavouritesEngineTest::ItemIsFactoryItemTestL ),
+        ENTRY( "Item IsReadOnly test", CFavouritesEngineTest::ItemIsReadOnlyTestL ),
+        ENTRY( "Item Modified test", CFavouritesEngineTest::ItemModifiedTestL ),
+        ENTRY( "Item ClearL test", CFavouritesEngineTest::ItemClearLTestL ),
+        ENTRY( "Item SetParentFolder test", CFavouritesEngineTest::ItemSetParentFolderTestL ),
+        ENTRY( "Item SetType test", CFavouritesEngineTest::ItemSetTypeTestL ),
+        ENTRY( "Item SetNameL test", CFavouritesEngineTest::ItemSetNameLTestL ),
+        ENTRY( "Item SetUrlL test", CFavouritesEngineTest::ItemSetUrlLTestL ),
+        ENTRY( "Item SetWapAp test", CFavouritesEngineTest::ItemSetWapApTestL ),
+        ENTRY( "Item SetUserNameL test", CFavouritesEngineTest::ItemSetUserNameLTestL ),
+        ENTRY( "Item SetPasswordL test", CFavouritesEngineTest::ItemSetPasswordLTestL ),
+        ENTRY( "Item SetContextId test", CFavouritesEngineTest::ItemSetContextIdTestL ),
+        ENTRY( "List Constructor test", CFavouritesEngineTest::ListConstructorTestL ),
+        ENTRY( "List Destructor test", CFavouritesEngineTest::ListDestructorTestL ),
+        ENTRY( "List Delete test", CFavouritesEngineTest::ListDeleteTestL ),
+        ENTRY( "List Delete Range test", CFavouritesEngineTest::ListDeleteRangeTestL ),
+        ENTRY( "List Sort test", CFavouritesEngineTest::ListSortTestL ),
+        ENTRY( "List UidToIndex test", CFavouritesEngineTest::ListUidToIndexTestL ),
+        ENTRY( "List IndexToUid test", CFavouritesEngineTest::ListIndexToUidTestL ),
+        ENTRY( "List ItemByUid test", CFavouritesEngineTest::ListItemByUidTestL ),
+        ENTRY( "Db Open test", CFavouritesEngineTest::DbOpenTestL ),
+        ENTRY( "Db Version test", CFavouritesEngineTest::DbVersionTestL ),
+        ENTRY( "Db IsDamaged test", CFavouritesEngineTest::DbIsDamagedTestL ),
+        ENTRY( "Db Recover test", CFavouritesEngineTest::DbRecoverTestL ),
+        ENTRY( "Db Compact test", CFavouritesEngineTest::DbCompactTestL ),
+        ENTRY( "Db Size test", CFavouritesEngineTest::DbSizeTestL ),
+        ENTRY( "Db UpdateStats test", CFavouritesEngineTest::DbUpdateStatsTestL ),
+        ENTRY( "Db Begin test", CFavouritesEngineTest::DbBeginTestL ),
+        ENTRY( "Db Commit test", CFavouritesEngineTest::DbCommitTestL ),
+        ENTRY( "Db Rollback test", CFavouritesEngineTest::DbRollbackTestL ),
+        ENTRY( "Db CleanupRollbackPushL test", CFavouritesEngineTest::DbCleanupRollbackPushLTestL ),
+        ENTRY( "Db Get test", CFavouritesEngineTest::DbGetTestL ),
+        ENTRY( "Db GetAll test", CFavouritesEngineTest::DbGetAllTestL ),
+        ENTRY( "Db GetUids test", CFavouritesEngineTest::DbGetUidsTestL ),
+        ENTRY( "Db PreferredUid test", CFavouritesEngineTest::DbPreferredUidTestL ),
+        ENTRY( "Db Delete test", CFavouritesEngineTest::DbDeleteTestL ),
+        ENTRY( "Db Update test", CFavouritesEngineTest::DbUpdateTestL ),
+        ENTRY( "Db Add test", CFavouritesEngineTest::DbAddTestL ),
+        ENTRY( "Db SetHomepage test", CFavouritesEngineTest::DbSetHomepageTestL ),
+        ENTRY( "Db SetLastVisited test", CFavouritesEngineTest::DbSetLastVisitedTestL ),
+        ENTRY( "Db SetFactoryItem test", CFavouritesEngineTest::DbSetFactoryItemTestL ),
+        ENTRY( "Db SetReadOnly test", CFavouritesEngineTest::DbSetReadOnlyTestL ),
+        ENTRY( "Db SetModified test", CFavouritesEngineTest::DbSetModifiedTestL ),
+        ENTRY( "Db SetPreferredUid test", CFavouritesEngineTest::DbSetPreferredUidTestL ),
+        ENTRY( "Db ItemExists test", CFavouritesEngineTest::DbItemExistsTestL ),
+        ENTRY( "Db FolderExists test", CFavouritesEngineTest::DbFolderExistsTestL ),
+        ENTRY( "Db Count test", CFavouritesEngineTest::DbCountTestL ),
+        ENTRY( "Db SetData test", CFavouritesEngineTest::DbSetDataTestL ),
+        ENTRY( "Db GetData test", CFavouritesEngineTest::DbGetDataTestL ),
+        ENTRY( "Db SetBrowserData test", CFavouritesEngineTest::DbSetBrowserDataTestL ),
+        ENTRY( "Db GetBrowserData test", CFavouritesEngineTest::DbGetBrowserDataTestL ),
+        ENTRY( "Db MakeUniqueName with folder test", CFavouritesEngineTest::DbMakeUniqueNameWithFolderTestL ),
+        ENTRY( "Db MakeUniqueName test", CFavouritesEngineTest::DbMakeUniqueNameTestL ),
+        ENTRY( "Db CreateStartPageItemL test", CFavouritesEngineTest::DbCreateStartPageItemLTestL ),
+        ENTRY( "Db CreateAdaptiveItemsFolderL test", CFavouritesEngineTest::DbCreateAdaptiveItemsFolderLTestL ),
+        ENTRY( "Db DeleteFile test", CFavouritesEngineTest::DbDeleteFileTestL ),
+//        ENTRY( "Db RestoreFactorySettingsL test", CFavouritesEngineTest::DbRestoreFactorySettingsLTestL ),
+        ENTRY( "WapAp Constructor test", CFavouritesEngineTest::WapApConstructorTest ),
+        ENTRY( "WapAp Assign with Ap test", CFavouritesEngineTest::WapApAssignWithApTest ),
+        ENTRY( "WapAp Assign with ApId test", CFavouritesEngineTest::WapApAssignWithApIdTest ),
+        ENTRY( "WapAp SetNull test", CFavouritesEngineTest::WapApSetNullTest ),
+        ENTRY( "WapAp SetDefault test", CFavouritesEngineTest::WapApSetDefaultTest ),
+        ENTRY( "WapAp SetApId test", CFavouritesEngineTest::WapApSetApIdTest ),
+        ENTRY( "WapAp IsNull test", CFavouritesEngineTest::WapApIsNullTest ),
+        ENTRY( "WapAp IsDefault test", CFavouritesEngineTest::WapApIsDefaultTest ),
+        ENTRY( "WapAp ApId test", CFavouritesEngineTest::WapApApIdTest ),
+        ENTRY( "DbInc Recover test", CFavouritesEngineTest::DbIncRecoverTestL ),
+        ENTRY( "DbInc Compact test", CFavouritesEngineTest::DbIncCompactTestL ),
+        ENTRY( "DbInc Next test", CFavouritesEngineTest::DbIncNextTestL ),
+        ENTRY( "File Close test", CFavouritesEngineTest::FileCloseTestL ),
+        ENTRY( "File Open test", CFavouritesEngineTest::FileOpenTestL ),
+        ENTRY( "File Replace test", CFavouritesEngineTest::FileReplaceTestL ),
+        ENTRY( "File Read test", CFavouritesEngineTest::FileReadTestL ),
+        ENTRY( "File Write test", CFavouritesEngineTest::FileWriteTestL ),
+        ENTRY( "File Size test", CFavouritesEngineTest::FileSizeTestL ),
+        ENTRY( "Session Version test", CFavouritesEngineTest::SessionVersionTest ),
+        ENTRY( "Session Connect test", CFavouritesEngineTest::SessionConnectTest ),
+        ENTRY( "Session ResourceMark test", CFavouritesEngineTest::SessionResourceMarkTest ),
+        ENTRY( "Session ResourceCheck test", CFavouritesEngineTest::SessionResourceCheckTest ),
+        ENTRY( "Session ResourceCount test", CFavouritesEngineTest::SessionResourceCountTest ),
+        ENTRY( "Session DeleteDatabase test", CFavouritesEngineTest::SessionDeleteDatabaseTestL ),
+        ENTRY( "Session __DbgSetAllocFail test", CFavouritesEngineTest::SessionDbgSetAllocFailTest ),
+        ENTRY( "Notifier constructor test", CFavouritesEngineTest::NotifierConstructorTestL ),
+        ENTRY( "Notifier destructor test", CFavouritesEngineTest::NotifierDestructorTestL ),
+        ENTRY( "Notifier Start test", CFavouritesEngineTest::NotifierStartTestL ),
+        ENTRY( "Db DeleteFolder test", CFavouritesEngineTest::DbDeleteFolderTestL )
+        };
+
+    // Verify that case number is valid
+    if( (TUint) aCaseNumber >= sizeof( KCases ) / 
+                               sizeof( TCaseInfoInternal ) )
+        {
+
+        // Invalid case, construct empty object
+        TCaseInfo null( (const TText*) L"" );
+        null.iMethod = NULL;
+        null.iIsOOMTest = EFalse;
+        null.iFirstMemoryAllocation = 0;
+        null.iLastMemoryAllocation = 0;
+        return null;
+
+        } 
+
+    // Construct TCaseInfo object and return it
+    TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName );
+    tmp.iMethod = KCases[ aCaseNumber ].iMethod;
+    tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest;
+    tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation;
+    tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation;
+    return tmp;
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: CreatePopulatedDb
+
+    Description: Populate a test db with items.
+  
+    Parameters:  None   
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFavouritesEngineTest::CreatePopulatedDbL()
+    {
+    DestroyDbItems();
+
+    // Create reference items in inst vars.
+    CreateFolderL( iItemFolder1 );
+    CreateFolderL( iItemFolder2 );
+    CreateItemL( iItem1 );
+    CreateItemL( iItem2 );
+    CreateItemL( iItem3 );
+    CreateItemL( iItem4 );
+    CreateItemL( iItem5 );
+    CreateItemL( iItem6 );
+
+    // Add items to database.
+    iFavouritesDb.Add( *iItemFolder1, EFalse );
+    iFavouritesDb.Add( *iItemFolder2, EFalse );
+
+    iItem3->SetParentFolder( iItemFolder1->Uid() );
+    iItem4->SetParentFolder( iItemFolder1->Uid() );
+    iItem5->SetParentFolder( iItemFolder2->Uid() );
+    iItem6->SetParentFolder( iItemFolder2->Uid() );
+
+    // Insert out of order for sort test
+    iFavouritesDb.Add( *iItem5, EFalse );
+    iFavouritesDb.Add( *iItem1, EFalse );
+    iFavouritesDb.Add( *iItem6, EFalse );
+    iFavouritesDb.Add( *iItem3, EFalse );
+    iFavouritesDb.Add( *iItem2, EFalse );
+    iFavouritesDb.Add( *iItem4, EFalse );
+
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: DestroyDb
+
+    Description: Delete the test database and all items in it.
+  
+    Parameters:  None
+
+    Return Values: None
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+void CFavouritesEngineTest::DestroyDbItems()
+    {
+    delete iItemFolder1;
+    delete iItemFolder2;
+    delete iItem1;
+    delete iItem2;
+    delete iItem3;
+    delete iItem4;
+    delete iItem5;
+    delete iItem6;
+
+    iItemFolder1 = NULL;
+    iItemFolder2 = NULL;
+    iItem1 = NULL;
+    iItem2 = NULL;
+    iItem3 = NULL;
+    iItem4 = NULL;
+    iItem5 = NULL;
+    iItem6 = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::GetTestCasesL
+// GetTestCases is used to inquire test cases from the Test Module. Test
+// cases are stored to array of test cases. The Test Framework will be 
+// the owner of the data in the RPointerArray after GetTestCases return
+// and it does the memory deallocation. 
+// -----------------------------------------------------------------------------
+//
+TInt CFavouritesEngineTest::GetTestCasesL( 
+    const TFileName& /*aConfig*/, 
+    RPointerArray<TTestCaseInfo>& aTestCases )
+    {
+
+    // Loop through all test cases and create new
+    // TTestCaseInfo items and append items to aTestCase array    
+    for( TInt i = 0; Case(i).iMethod != NULL; i++ )
+        {
+        // Allocate new TTestCaseInfo from heap for a testcase definition.
+        TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo();
+    
+        // PushL TTestCaseInfo to CleanupStack.    
+        CleanupStack::PushL( newCase );
+
+        // Set number for the testcase.
+        // When the testcase is run, this comes as a parameter to RunTestCaseL.
+        newCase->iCaseNumber = i;
+
+        // Set title for the test case. This is shown in UI to user.
+        newCase->iTitle.Copy( Case(i).iCaseName );
+
+        // Append TTestCaseInfo to the testcase array. After appended 
+        // successfully the TTestCaseInfo object is owned (and freed) 
+        // by the TestServer. 
+        User::LeaveIfError(aTestCases.Append ( newCase ) );
+        
+        // Pop TTestCaseInfo from the CleanupStack.
+        CleanupStack::Pop( newCase );
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::RunTestCaseL
+// RunTestCaseL is used to run an individual test case specified 
+// by aTestCase. Test cases that can be run may be requested from 
+// Test Module by GetTestCases method before calling RunTestCase.
+// -----------------------------------------------------------------------------
+//
+TInt CFavouritesEngineTest::RunTestCaseL(
+    const TInt aCaseNumber,
+    const TFileName& /*aConfig*/,
+    TTestResult& aResult )
+    {
+    // Return value
+    TInt execStatus = KErrNone;
+
+    // Get the pointer to test case function
+    TCaseInfo tmp = Case ( aCaseNumber );
+
+    _LIT( KLogInfo, "Starting testcase [%S]" );
+    iLog->Log( KLogInfo, &tmp.iCaseName);
+
+    // Check that case number was valid
+    if ( tmp.iMethod != NULL )
+        {
+        // Valid case was found, call it via function pointer
+        iMethod = tmp.iMethod;        
+        execStatus  = ( this->*iMethod )( aResult );
+        }
+    else
+        {
+        // Valid case was not found, return error.
+        execStatus = KErrNotFound;
+        }
+
+    // Return case execution status (not the result of the case execution)
+    return execStatus;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::OOMTestQueryL
+// Used to check if a particular test case should be run in OOM conditions and 
+// which memory allocations should fail.    
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+TBool CFavouritesEngineTest::OOMTestQueryL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */, 
+                                TOOMFailureType& /* aFailureType */, 
+                                TInt& /* aFirstMemFailure */, 
+                                TInt& /* aLastMemFailure */ ) 
+    {
+    _LIT( KOOMTestQueryL, "CFavouritesEngineTest::OOMTestQueryL" );
+    iLog->Log( KOOMTestQueryL ); 
+
+    return EFalse;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::OOMTestInitializeL
+// Used to perform the test environment setup for a particular OOM test case. 
+// Test Modules may use the initialization file to read parameters for Test 
+// Module initialization but they can also have their own configure file or 
+// some other routine to initialize themselves.  
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CFavouritesEngineTest::OOMTestInitializeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::OOMHandleWarningL
+// In some cases the heap memory allocation should be skipped, either due to
+// problems in the OS code or components used by the code being tested, or even 
+// inside the tested components which are implemented this way on purpose (by 
+// design), so it is important to give the tester a way to bypass allocation 
+// failures.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//
+void CFavouritesEngineTest::OOMHandleWarningL( 
+                                const TFileName& /* aTestCaseFile */,
+                                const TInt /* aCaseNumber */, 
+                                TInt& /* aFailNextValue */ )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CFavouritesEngineTest::OOMTestFinalizeL
+// Used to perform the test environment cleanup for a particular OOM test case.
+//
+// NOTE: This method is virtual and must be implemented only if test case
+// should be executed using OOM conditions.  
+// -----------------------------------------------------------------------------
+//                  
+void CFavouritesEngineTest::OOMTestFinalizeL( 
+                                const TFileName& /* aTestCaseFile */, 
+                                const TInt /* aCaseNumber */ )
+    {
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point
+// Returns: CTestModuleBase*: Pointer to Test Module object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CTestModuleBase* LibEntryL()
+    {
+    return CFavouritesEngineTest::NewL();
+
+    }
+
+// -----------------------------------------------------------------------------
+// SetRequirements handles test module parameters(implements evolution
+// version 1 for test module's heap and stack sizes configuring).
+// Returns: TInt: Symbian error code.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, 
+                                TUint32& /*aParameterValid*/ )
+    {
+
+    /* --------------------------------- NOTE ---------------------------------
+    USER PANICS occurs in test thread creation when:
+    1) "The panic occurs when the value of the stack size is negative."
+    2) "The panic occurs if the minimum heap size specified is less
+       than KMinHeapSize".
+       KMinHeapSize: "Functions that require a new heap to be allocated will
+       either panic, or will reset the required heap size to this value if
+       a smaller heap size is specified".
+    3) "The panic occurs if the minimum heap size specified is greater than
+       the maximum size to which the heap can grow".
+    Other:
+    1) Make sure that your hardware or Symbian OS is supporting given sizes.
+       e.g. Hardware might support only sizes that are divisible by four.
+    ------------------------------- NOTE end ------------------------------- */
+
+    // Normally STIF uses default heap and stack sizes for test thread, see:
+    // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize.
+    // If needed heap and stack sizes can be configured here by user. Remove
+    // comments and define sizes.
+
+/*
+    aParameterValid = KStifTestModuleParameterChanged;
+
+    CTestModuleParamVer01* param = CTestModuleParamVer01::NewL();
+    // Stack size
+    param->iTestThreadStackSize= 16384; // 16K stack
+    // Heap sizes
+    param->iTestThreadMinHeap = 4096;   // 4K heap min
+    param->iTestThreadMaxHeap = 1048576;// 1M heap max
+
+    aTestModuleParam = param;
+*/
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// E32Dll is a DLL entry point function
+// Returns: KErrNone: No error
+// -----------------------------------------------------------------------------
+//
+#ifndef EKA2 // Hide Dll entry point to EKA2
+GLDEF_C TInt E32Dll(
+    TDllReason /*aReason*/) // Reason
+    {
+    return(KErrNone);
+
+    }
+#endif // EKA2
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesFileTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,423 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: FileCloseTestL
+
+    Description: Test the RFavouritesFile Close method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::FileCloseTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesFile Close method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    RFavouritesFile file;
+	file.Open( iFavouritesDb, iItem1->Uid() );
+	
+	file.Close();  // Close returns void, so we have to assume success
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: FileOpenTestL
+
+    Description: Test the RFavouritesFile Open method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::FileOpenTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesFile Open method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    RFavouritesFile file;
+	TInt result = file.Open( iFavouritesDb, iItem1->Uid() );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+	file.Close();
+
+    if( result == KErrNotFound )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: FileReplaceTestL
+
+    Description: Test the RFavouritesFile Replace method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::FileReplaceTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesFile Replace method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    RFavouritesFile file;
+	TInt result = file.Replace( iFavouritesDb, KFavouritesRootUid );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+	file.Close();
+
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: FileReadTestL
+
+    Description: Test the RFavouritesFile Read method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::FileReadTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesFile Read method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    RFavouritesFile fileToWrite;
+    TPtrC8 testString = _L8("Once upon a time");
+        
+    fileToWrite.Replace( iFavouritesDb, iItem1->Uid() );
+        
+    fileToWrite.Write(testString);
+    
+    fileToWrite.Close();
+
+    RFavouritesFile fileToRead;
+	HBufC8 *readBuf = HBufC8::NewLC(testString.Length());
+	TPtr8 readPtr(readBuf->Des());
+	
+    fileToRead.Open( iFavouritesDb, iItem1->Uid() );
+
+	TInt result = fileToRead.Read( readPtr );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+	fileToRead.Close();
+
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(2); // iFavouritesDb, readBuf
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: FileWriteTestL
+
+    Description: Test the RFavouritesFile Write method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::FileWriteTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesFile Write method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    RFavouritesFile fileToWrite;
+    TPtrC8 testString = _L8("Once upon a time");
+        
+    fileToWrite.Replace( iFavouritesDb, iItem1->Uid() );
+        
+    TInt result = fileToWrite.Write(testString);
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+    fileToWrite.Close();
+
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: FileSizeTestL
+
+    Description: Test the RFavouritesFile Size method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::FileSizeTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesFile Size method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    RFavouritesFile file;
+
+    TPtrC8 testString = _L8("Once upon a time");
+        
+    file.Replace( iFavouritesDb, iItem1->Uid() );
+        
+    file.Write(testString);
+
+    TInt dbSize;
+    
+    TInt result = file.Size( dbSize );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+	file.Close();
+	
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesItemListTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,544 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+// -----------------------------------------------------------------------------
+// CompareItemNamesL
+// Compare the names of two favourite list items.
+// Returns: negative, if aItem1.Name is less than aItem2.Name
+//          0, if aItem1.Name is the same as aItem2.Name 
+//          positive, if aItem1.Name is greater than aItem2.Name
+// -----------------------------------------------------------------------------
+//
+LOCAL_C TInt CompareItemNamesL(const CFavouritesItem& aItem1, const CFavouritesItem& aItem2)
+    {
+    return aItem1.Name().CompareF(aItem2.Name());
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListConstructorTestL
+
+    Description: Test the item list constructor method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListConstructorTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list constructor method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (list)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    
+	    delete list;
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListDestructorTestL
+
+    Description: Test the item list destructor method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListDestructorTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list destructor method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    list->~CFavouritesItemList();
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (list)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    
+	    delete list;
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListDeleteTestL
+
+    Description: Test the item list Delete method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListDeleteTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    iFavouritesDb.GetAll( *list, KFavouritesRootUid );
+
+    TInt countBeforeDelete = list->Count();
+    
+    list->Delete( 1 );
+    
+    TInt countAfterDelete = list->Count();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (countAfterDelete == countBeforeDelete - 1)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete list;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListDeleteRangeTestL
+
+    Description: Test deleting a range of items using the item list Delete method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListDeleteRangeTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    iFavouritesDb.GetAll( *list, KFavouritesRootUid );
+
+    TInt countBeforeDelete = list->Count();
+    
+    list->Delete( 1, 3 );
+    
+    TInt countAfterDelete = list->Count();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (countAfterDelete == countBeforeDelete - 3)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete list;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListSortTestL
+
+    Description: Test sorting the list using the Sort method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListSortTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    iFavouritesDb.GetAll( *list, KFavouritesRootUid );
+
+    list->SortL( &CompareItemNamesL );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    const CFavouritesItem* firstItem = list->ItemByUid( list->IndexToUid( 0 ) );
+
+    if (firstItem->Name() == _L("iItem1"))
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete list;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListUidToIndexTestL
+
+    Description: Test uid to index conversion using the UidToIndex method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListUidToIndexTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    iFavouritesDb.GetAll( *list, KFavouritesRootUid );
+    
+    list->SortL( &CompareItemNamesL );
+
+    const CFavouritesItem* firstItem = list->ItemByUid( list->IndexToUid( 1 ) );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (firstItem->Uid() == list->IndexToUid( 1 ))
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete list;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListIndexToUidTestL
+
+    Description: Test index to uid conversion using the UidToIndex method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListIndexToUidTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    iFavouritesDb.GetAll( *list, KFavouritesRootUid );
+    
+    list->SortL( &CompareItemNamesL );
+    
+    TInt itemUid = list->IndexToUid(1);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (itemUid == list->At(1)->Uid())
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete list;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ListItemByUidTestL
+
+    Description: Test retrieveing an item by Id using the ItemByUid method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ListItemByUidTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the item list Delete method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+
+    CreatePopulatedDbL();
+    
+    CFavouritesItemList* list = new (ELeave) CFavouritesItemList();
+
+    iFavouritesDb.GetAll( *list, KFavouritesRootUid );
+    
+    list->SortL( &CompareItemNamesL );
+    
+    const CFavouritesItem* firstItem = list->ItemByUid( list->IndexToUid( 0 ) );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (firstItem->Name() == _L("iItem1"))
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    delete list;
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesItemTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,1441 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+/*
+-------------------------------------------------------------------------------
+
+    DESCRIPTION
+
+    This module contains the implementation of CTestModuleDemo class 
+    member functions that does the actual tests.
+
+-------------------------------------------------------------------------------
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemNewLCTestL
+
+    Description: Test creating a new favourites item with the NewLC method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemNewLCTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Creating item with NewLC method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemNewLTestL
+
+    Description: Test creating a new favourites item with the NewL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemNewLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Creating item with NewL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewL();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    
+	    delete item;
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemDestructorTestL
+
+    Description: Test destroying an item with the ~CFavouritesItem method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemDestructorTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Destroying item with ~CFavouritesItem method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewL();
+    
+    delete item;
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    _LIT( KDescription , "Test case passed");
+    aResult.SetResult( KErrNone, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemAssignTestL
+
+    Description: Assigning one item to another with the Assign(=) method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemAssignTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Assigning item with Assign(=) operator");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item1 = CFavouritesItem::NewLC();
+    item1->SetNameL( _L("Item1") );
+    CFavouritesItem* item2 = CFavouritesItem::NewLC();
+    item2->SetNameL( _L("Item2") );
+
+    *item1 = *item2;
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item1->Name() == item2->Name())
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( 2 );   // item1, item2
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemUidTestL
+
+    Description: Test getting the item's Uid using the Uid method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemUidTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's Uid with Uid method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TInt itemUid = item->Uid();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (itemUid == 0)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemParentFolderTestL
+
+    Description: Test getting the item's parent folder using the ParentFolder method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemParentFolderTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's parent folder with ParentFolder method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TInt itemParent = item->ParentFolder();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (itemParent == 0)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemTypeTestL
+
+    Description: Test getting the item's type using the Type method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemTypeTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's type with Type method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TInt itemType = item->Type();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (itemType == 1)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemNameTestL
+
+    Description: Test getting the item's name using the Name method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemNameTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's name with Name method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TPtrC itemName = item->Name();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    _LIT( KItemName ,"");
+    if (itemName == KItemName)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemUrlTestL
+
+    Description: Test getting the item's url using the Url method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemUrlTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's url with Url method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TPtrC itemUrl = item->Url();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    _LIT( KItemUrl ,"");
+    if (itemUrl == KItemUrl)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemWapApTestL
+
+    Description: Test getting the item's access point using the WapAp method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemWapApTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's access point with WapAp method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TFavouritesWapAp itemAP = item->WapAp();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (itemAP.IsDefault())
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemUserNameTestL
+
+    Description: Test getting the item's user name using the UserName method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemUserNameTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's user name with UserName method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TPtrC itemUserName = item->UserName();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    _LIT( KItemUserName ,"");
+    if (itemUserName == KItemUserName)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemPasswordTestL
+
+    Description: Test getting the item's password using the Password method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemPasswordTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's password with Password method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TPtrC itemPassword = item->Password();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    _LIT( KItemPassword ,"");
+    if (itemPassword == KItemPassword)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemContextIdTestL
+
+    Description: Test getting the item's context id using the ContextId method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemContextIdTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting item's context id with ContextId method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TInt32 itemContextId = item->ContextId();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (itemContextId == 0)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemIsItemTestL
+
+    Description: Test if the item is an item using the IsItem method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemIsItemTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Checking if the item is an item with IsItem method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TBool itemIsItem = item->IsItem();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (itemIsItem)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemIsFolderTestL
+
+    Description: Test if the item is a folder using the IsFolder method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemIsFolderTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Checking if the item is a folder with IsFolder method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TBool itemIsFolder = item->IsFolder();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (!itemIsFolder)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemIsFactoryItemTestL
+
+    Description: Test if the item is a factory item using the IsFactoryItem method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemIsFactoryItemTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Checking if the item is a factory item with IsFactory method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TBool itemIsFactoryItem = item->IsFactoryItem();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (!itemIsFactoryItem)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemIsReadOnlyTestL
+
+    Description: Test if the item is read-only using the IsReadOnly method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemIsReadOnlyTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Checking if the item is read-only item with IsReadOnly method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TBool itemIsReadOnly = item->IsReadOnly();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (!itemIsReadOnly)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemModifiedTestL
+
+    Description: Test getting the last modified time using the Modified method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemModifiedTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Getting the item's last modified time with Modified method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    TTime itemModified = item->Modified();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (itemModified != NULL)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemClearLTestL
+
+    Description: Test clearing the item using the ClearL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemClearLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Clearing the item with ClearL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetType(CFavouritesItem::EFolder);
+    item->SetNameL( _L("Item Name") );
+    item->ClearL();
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if ((item->Type() == CFavouritesItem::EFolder) || (item->Name() == _L("Item Name")))
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetParentFolderTestL
+
+    Description: Test setting the item's parent folder using the SetParentFolder method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetParentFolderTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's parent folder with SetParentFolder method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetParentFolder(3);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->ParentFolder() == 3)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetTypeTestL
+
+    Description: Test setting the item's type using the SetType method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetTypeTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's type with SetType method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetType(CFavouritesItem::EFolder);
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->Type() == CFavouritesItem::EFolder)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetNameLTestL
+
+    Description: Test setting the item's name using the SetNameL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetNameLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's name with SetNameL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetNameL( _L("Item Name") );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->Name() == _L("Item Name"))
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetUrlLTestL
+
+    Description: Test setting the item's url using the SetUrlL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetUrlLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's url with SetUrlL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetUrlL( _L("http://www.nokia.com") );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->Url() == _L("http://www.nokia.com"))
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetWapApTestL
+
+    Description: Test setting the item's access point using the SetWapAp method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetWapApTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's access point with SetWapAp method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+
+    TFavouritesWapAp accessPoint;
+    accessPoint.SetApId( 22 );
+    item->SetWapAp( accessPoint );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->WapAp().ApId() == 22)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetUserNameLTestL
+
+    Description: Test setting the item's user name using the SetUserNameL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetUserNameLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's user name with SetUserNameL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetUserNameL( _L("New User") );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->UserName() == _L("New User"))
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetPasswordLTestL
+
+    Description: Test setting the item's password using the SetPasswordL method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetPasswordLTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's password with SetPasswordL method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetPasswordL( _L("12345") );
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->Password() == _L("12345"))
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: ItemSetContextIdTestL
+
+    Description: Test setting the item's context id using the SetContextId method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::ItemSetContextIdTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Setting the item's context id with SetContextId method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    CFavouritesItem* item = CFavouritesItem::NewLC();
+    
+    item->SetContextId(22);
+
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if (item->ContextId() == 22)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy( item );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesItemTestData.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of class TFavouritesItemTestData
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <s32strm.h>
+#include "FavouritesItemTestData.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------
+// TFavouritesItemTestData::ExternalizeL
+// ---------------------------------------------------------
+//
+void TFavouritesItemTestData::ExternalizeL( RWriteStream& aStream ) const
+    {
+    aStream.WriteInt32L( iTestData );
+    }
+
+// ---------------------------------------------------------
+// TFavouritesItemTestData::InternalizeL
+// ---------------------------------------------------------
+//
+void TFavouritesItemTestData::InternalizeL( RReadStream& aStream )
+    {
+    iTestData = aStream.ReadInt32L();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesNotifierTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+#include "FavouritesDbTestObserver.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: NotifierConstructorTestL
+
+    Description: Test the CActiveFavouritesDbNotifier constructor method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::NotifierConstructorTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the CActiveFavouritesDbNotifier constructor method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    CFavouritesDbTestObserver* observer = new (ELeave) CFavouritesDbTestObserver( *this );
+    CleanupStack::PushL( observer );
+
+    observer->Start();
+    CActiveScheduler::Start();
+
+    CActiveFavouritesDbNotifier* notifier = new (ELeave) CActiveFavouritesDbNotifier( iFavouritesDb, (MFavouritesDbObserver &)*this );
+    CleanupStack::PushL( notifier );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+    if( notifier )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(4); // iFavouritesDb, observer, notifier
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: NotifierDestructorTestL
+
+    Description: Test the CActiveFavouritesDbNotifier destructor method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::NotifierDestructorTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the CActiveFavouritesDbNotifier destructor method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    CFavouritesDbTestObserver* observer = new (ELeave) CFavouritesDbTestObserver( *this );
+    CleanupStack::PushL( observer );
+
+    observer->Start();
+    CActiveScheduler::Start();
+
+    CActiveFavouritesDbNotifier* notifier = new (ELeave) CActiveFavouritesDbNotifier( iFavouritesDb, (MFavouritesDbObserver &)*this );
+    CleanupStack::PushL( notifier );
+    
+    notifier->~CActiveFavouritesDbNotifier();
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+    if( notifier )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(4); // iFavouritesDb, observer, notifier
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: NotifierStartTestL
+
+    Description: Test the CActiveFavouritesDbNotifier Start method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::NotifierStartTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the CActiveFavouritesDbNotifier Start method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+    
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
+    CleanupStack::PushL( scheduler );
+    CActiveScheduler::Install( scheduler );
+
+    CFavouritesDbTestObserver* observer = new (ELeave) CFavouritesDbTestObserver( *this );
+    CleanupStack::PushL( observer );
+
+    observer->Start();
+    CActiveScheduler::Start();
+
+    CActiveFavouritesDbNotifier* notifier = new (ELeave) CActiveFavouritesDbNotifier( iFavouritesDb, (MFavouritesDbObserver &)*this );
+    CleanupStack::PushL( notifier );
+    
+    TInt result = notifier->Start();
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    CleanupStack::PopAndDestroy(4); // iFavouritesDb, observer, notifier
+    iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesSessionTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,374 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: SessionVersionTest
+
+    Description: Test the RFavouritesSession Version method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::SessionVersionTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesSession Version method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TVersion sessionVersion = iFavouritesSession.Version();
+    
+    _LIT( KData2 ,"Finished");
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    if (sessionVersion.iMajor > 0)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: SessionConnectTest
+
+    Description: Test the RFavouritesSession Connect method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::SessionConnectTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesSession Connect method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    RFavouritesSession session;
+    
+    TInt result = session.Connect();
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+    
+    session.Close();
+	
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: SessionResourceMarkTest
+
+    Description: Test the RFavouritesSession ResourceMark method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::SessionResourceMarkTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesSession ResourceMark method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesSession.ResourceMark();
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+	// ResourceMark provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: SessionResourceCheckTest
+
+    Description: Test the RFavouritesSession ResourceCheck method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::SessionResourceCheckTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesSession ResourceCheck method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesSession.ResourceCheck();
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+	// ResourceCheck provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: SessionResourceCountTest
+
+    Description: Test the RFavouritesSession ResourceCount method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::SessionResourceCountTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesSession ResourceCount method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TInt count = iFavouritesSession.ResourceCount();
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+    if( count == 0 )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: SessionDeleteDatabaseTestL
+
+    Description: Test the RFavouritesSession DeleteDatabase method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::SessionDeleteDatabaseTestL( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesSession DeleteDatabase method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesDb.Open( iFavouritesSession, KTestDbName );
+    CleanupClosePushL<RFavouritesDb>( iFavouritesDb );
+    
+    CreatePopulatedDbL();
+
+    CleanupStack::PopAndDestroy(); // iFavouritesDb
+    TInt result = iFavouritesSession.DeleteDatabase( KTestDbName );
+
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+    if( result == KErrNone )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: SessionDbgSetAllocFailTest
+
+    Description: Test the RFavouritesSession __DbgSetAllocFail method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::SessionDbgSetAllocFailTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the RFavouritesSession __DbgSetAllocFail method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    iFavouritesSession.__DbgSetAllocFail( RHeap::ENone, 1 );
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+	
+	// __DbgSetAllocFail provides no results, so if we've gotten this far assume success
+    _LIT( KDescription , "Test case passed" );
+    aResult.SetResult( KErrNone, KDescription );
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web_pub/favourites_engine_api/tsrc/src/FavouritesWapApTestCases.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,507 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32math.h>
+#include "FavouritesEngineTest.h"
+
+// EXTERNAL DATA STRUCTURES
+// None
+
+// EXTERNAL FUNCTION PROTOTYPES  
+// None
+
+// CONSTANTS
+// None
+
+// MACROS
+// None
+
+// LOCAL CONSTANTS AND MACROS
+// None
+
+// MODULE DATA STRUCTURES
+// None
+
+// LOCAL FUNCTION PROTOTYPES
+// None
+
+// FORWARD DECLARATIONS
+// None
+
+// ==================== LOCAL FUNCTIONS =======================================
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApConstructorTest
+
+    Description: Test the WapAp constructor method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApConstructorTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the WapAp constructor method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint = 222;
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if(accessPoint.ApId() == 222)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApAssignWithApTest
+
+    Description: Test the WapAp assign(=) operater using a WapAp as the argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApAssignWithApTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the WapAp assign(=) operater using a WapAp as the argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint1, accessPoint2;
+    
+    accessPoint1 = 222;
+    
+    accessPoint2 = accessPoint1;
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if(accessPoint2.ApId() == 222)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApAssignWithApIdTest
+
+    Description: Test the WapAp assign(=) operater using an ApId as the argument.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApAssignWithApIdTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the WapAp assign(=) operater using an ApId as the argument");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint = 222;
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if(accessPoint.ApId() == 222)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApSetNullTest
+
+    Description: Test the WapAp SetNull method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApSetNullTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the WapAp SetNull method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint.SetNull();
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if(accessPoint.IsNull())
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApSetDefaultTest
+
+    Description: Test the WapAp SetDefault method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApSetDefaultTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the WapAp SetDefault method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint.SetDefault();
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if(accessPoint.IsDefault())
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApSetApIdTest
+
+    Description: Test the WapAp SetApId method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApSetApIdTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the WapAp SetApId method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint.SetApId(222);
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if(accessPoint.ApId() == 222)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApIsNullTest
+
+    Description: Test the WapAp IsNull method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApIsNullTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State");
+    _LIT( KData ,"Test the WapAp IsNull method");
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint.SetNull();
+    
+    TBool isNull = accessPoint.IsNull();
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if(isNull)
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApIsDefaultTest
+
+    Description: Test the WapAp IsDefault method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApIsDefaultTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the WapAp IsDefault method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint.SetDefault();
+    
+    TBool isDefault = accessPoint.IsDefault();
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if( isDefault )
+	    {
+	    _LIT( KDescription , "Test case passed");
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed");
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+/*
+-------------------------------------------------------------------------------
+
+    Class: CFavouritesEngineTest
+
+    Method: WapApApIdTest
+
+    Description: Test the WapAp ApId method.
+  
+    Parameters:  TTestResult& aErrorDescription: out:   
+                    Test result and on error case a short description of error
+
+    Return Values: TInt: Always KErrNone to indicate that test was valid
+
+    Errors/Exceptions: None
+
+    Status: Approved
+
+-------------------------------------------------------------------------------
+*/
+TInt CFavouritesEngineTest::WapApApIdTest( TTestResult& aResult )
+    {
+    /* Simple server connect */
+    _LIT( KDefinition ,"State" );
+    _LIT( KData ,"Test the WapAp ApId method" );
+    TestModuleIf().Printf( 0, KDefinition, KData );
+
+    TFavouritesWapAp accessPoint;
+    
+    accessPoint.SetApId( 222 );
+    
+    TUint32 apId = accessPoint.ApId();
+    
+    TBool isDefault = accessPoint.IsDefault();
+    
+    _LIT( KData2 ,"Finished" );
+    TestModuleIf().Printf( 0, KDefinition, KData2 );
+
+    if( apId == 222 )
+	    {
+	    _LIT( KDescription , "Test case passed" );
+	    aResult.SetResult( KErrNone, KDescription );
+	    }
+    else
+	    {
+	    _LIT( KDescription , "Test case failed" );
+	    aResult.SetResult( KErrGeneral, KDescription );
+	    }
+
+    // Case was executed
+    return KErrNone;
+    }
+
+// ================= OTHER EXPORTED FUNCTIONS =================================
+
+// End of File
--- a/web_pub/settings_api/inc/BrowserUiSDKCRKeys.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/web_pub/settings_api/inc/BrowserUiSDKCRKeys.h	Fri May 08 08:25:06 2009 +0300
@@ -337,4 +337,52 @@
 // Any String value
 const TUint32 KBrowserNGShortCutFuncZoomMode =      0x00000076;
 
+// KBrowserSearchIconPath path to mif file saving search icons
+// Given and updated by search application
+// like z:\\resource\\apps\\xxx.mif
+const TUint32 KBrowserSearchIconPath = 0x00000077;
+
+// KBrowserSearchIconId Current search iconId From search mif file
+// Given and updated by search application
+// Valid values: TInt
+const TUint32 KBrowserSearchIconId = 0x00000078;
+
+// KBrowserSearchIconMaskId Current search iconMaskId From search mif file
+// Given and updated by search application
+// Valid values: TInt
+const TUint32 KBrowserSearchIconMaskId = 0x00000079;
+
+// KBrowserSearchProviderTitle Title to current search provider
+// Given and updated by search application
+const TUint32 KBrowserSearchProviderTitle = 0x0000007A;
+
+// KBrowserServiceUrl Browser Service url
+// Used to lauch service application through scheme handler
+const TUint32 KBrowserServiceUrl = 0x0000007B;
+
+// KBrowserFirstBoot
+// Valid values: 1 if browser first boot is not done yet, other 0  
+const TUint32 KBrowserFirstBoot = 0x0000007C;
+
+// KBrowserSearch TInt if browser search is present 
+// Valid values: 0, 1
+const TUint32 KBrowserSearch = 0x0000007D;
+
+// KBrowserServices TInt if browser service is present
+// Valid values: 0,1 
+const TUint32 KBrowserServices = 0x0000007E;
+
+// KBrowserSearchAppUid - browser Search Application UID
+// Valid values:any positive 32-bit integer value
+const TUint32 KBrowserSearchAppUid= 0x0000007F;
+
+// Search Application View UID for selection of Default 
+// Search Provider.
+// Valid values:any positive 32-bit integer value.
+const TUint32 KBrowserSearchProviderSettingViewId = 0x00000080;
+
+// KBrowserSearchProviderUrl Browser Search url
+// Used by Search Scheme Handler.
+const TUint32 KBrowserSearchProviderUrl = 0x00000081;
+
 #endif      // BROWSERUISDKCRKEYS_H
\ No newline at end of file
--- a/webengine/osswebengine/JavaScriptCore/kjs/collector.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/JavaScriptCore/kjs/collector.cpp	Fri May 08 08:25:06 2009 +0300
@@ -83,6 +83,9 @@
 
 enum OperationInProgress { NoOperation, Allocation, Collection };
 
+//forward declaration
+static void freeBlock(CollectorBlock* block);
+
 struct CollectorHeap {
   CollectorBlock** blocks;
   size_t numBlocks;
@@ -94,6 +97,12 @@
   size_t extraCost;
 
   OperationInProgress operationInProgress;
+
+  ~CollectorHeap() {
+      for(int i=0; i<usedBlocks; ++i) {
+          freeBlock(blocks[i]);
+      }
+  }
 };
 
 static CollectorHeap heap = { 0, 0, 0, 0, 0, 0, 0, NoOperation };
--- a/webengine/osswebengine/JavaScriptCore/kjs/function.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/JavaScriptCore/kjs/function.cpp	Fri May 08 08:25:06 2009 +0300
@@ -74,6 +74,9 @@
 {
   JSObject* globalObj = exec->dynamicInterpreter()->globalObject();
 
+#if PLATFORM(SYMBIAN)
+  exec->dynamicInterpreter()->resetStatementCount();
+#endif
   // enter a new execution context
   Context ctx(globalObj, exec->dynamicInterpreter(), thisObj, body.get(),
                  codeType(), exec->context(), this, &args);
--- a/webengine/osswebengine/JavaScriptCore/wtf/symbian/cstddef	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/JavaScriptCore/wtf/symbian/cstddef	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,16 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
--- a/webengine/osswebengine/JavaScriptCore/wtf/symbian/float.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/JavaScriptCore/wtf/symbian/float.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,16 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
--- a/webengine/osswebengine/MemoryManager/Group/MemMan.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Group/MemMan.mmp	Fri May 08 08:25:06 2009 +0300
@@ -25,22 +25,26 @@
 
 TARGETTYPE      dll
 
+OPTION ARMCC -O3 -Otime
 UID 0x1000008D  0x10281B6D
 
 //MACRO OOM_LOGGING
 MACRO USE_FAST_MALLOC
 MACRO NOKIA_CHANGES
+MACRO __NEW_ALLOCATOR__
+//MACRO TRACE_CHUNK_USAGE
 
 CAPABILITY CAP_GENERAL_DLL
 VENDORID    VID_DEFAULT
 EPOCALLOWDLLDATA
 #ifndef __BROWSER_SDK
 MW_LAYER_SYSTEMINCLUDE
-MW_LAYER_LIBC_SYSTEMINCLUDE
+//MW_LAYER_LIBC_SYSTEMINCLUDE
 #else
 SYSTEMINCLUDE   /Epoc32/include
+#endif
 SYSTEMINCLUDE   /epoc32/include/libc
-#endif
+//#endif
 
 USERINCLUDE     ../Inc
 
@@ -50,6 +54,8 @@
 SOURCE StopScheduler.cpp
 SOURCE fast_malloc.cpp
 SOURCE FastAllocator.cpp
+SOURCE heap.cpp
+SOURCE SymbianDLAllocatorWrapper.cpp
 
 LIBRARY euser.lib
 DEBUGLIBRARY flogger.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/MemoryManager/Inc/DLA.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,1048 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*
+*/
+/*DLA.h*/
+#ifndef __DLA__
+#define __DLA__
+
+#define DEFAULT_TRIM_THRESHOLD ((size_t)4U * (size_t)1024U)
+
+#define __SYMBIAN__
+#define MSPACES 0
+#define HAVE_MORECORE 1
+#define	MORECORE_CONTIGUOUS 1
+#define	HAVE_MMAP 0
+#define HAVE_MREMAP 0
+#define DEFAULT_GRANULARITY (4096U)
+#define FOOTERS 0
+#define USE_LOCKS 0
+#define INSECURE 1
+#define NO_MALLINFO 0
+
+#define LACKS_SYS_TYPES_H
+#ifndef LACKS_SYS_TYPES_H
+#include <sys/types.h>  /* For size_t */
+#else
+#ifndef _SIZE_T_DECLARED
+typedef unsigned int size_t;
+#define	_SIZE_T_DECLARED
+#endif
+#endif  /* LACKS_SYS_TYPES_H */
+
+/* The maximum possible size_t value has all bits set */
+#define MAX_SIZE_T           (~(size_t)0)
+
+#ifndef ONLY_MSPACES
+	#define ONLY_MSPACES 0
+#endif  /* ONLY_MSPACES */
+
+#ifndef MSPACES
+	#if ONLY_MSPACES
+		#define MSPACES 1
+	#else   /* ONLY_MSPACES */
+		#define MSPACES 0
+	#endif  /* ONLY_MSPACES */
+#endif  /* MSPACES */
+
+#ifndef MALLOC_ALIGNMENT
+	#define MALLOC_ALIGNMENT ((size_t)8U)
+#endif  /* MALLOC_ALIGNMENT */
+
+#ifndef FOOTERS
+	#define FOOTERS 0
+#endif  /* FOOTERS */
+
+#ifndef ABORT
+//	#define ABORT  abort()
+	#define ABORT  User::Invariant()// redefined so euser isn't dependant on oe
+#endif  /* ABORT */
+
+#ifndef ABORT_ON_ASSERT_FAILURE
+	#define ABORT_ON_ASSERT_FAILURE 1
+#endif  /* ABORT_ON_ASSERT_FAILURE */
+
+#ifndef PROCEED_ON_ERROR
+	#define PROCEED_ON_ERROR 0
+#endif  /* PROCEED_ON_ERROR */
+
+#ifndef USE_LOCKS
+	#define USE_LOCKS 0
+#endif  /* USE_LOCKS */
+
+#ifndef INSECURE
+	#define INSECURE 0
+#endif  /* INSECURE */
+
+#ifndef HAVE_MMAP
+	#define HAVE_MMAP 1
+#endif  /* HAVE_MMAP */
+
+#ifndef MMAP_CLEARS
+	#define MMAP_CLEARS 1
+#endif  /* MMAP_CLEARS */
+
+#ifndef HAVE_MREMAP
+	#ifdef linux
+		#define HAVE_MREMAP 1
+	#else   /* linux */
+		#define HAVE_MREMAP 0
+	#endif  /* linux */
+#endif  /* HAVE_MREMAP */
+
+#ifndef MALLOC_FAILURE_ACTION
+	//#define MALLOC_FAILURE_ACTION  errno = ENOMEM;
+	#define MALLOC_FAILURE_ACTION ;
+#endif  /* MALLOC_FAILURE_ACTION */
+
+#ifndef HAVE_MORECORE
+	#if ONLY_MSPACES
+		#define HAVE_MORECORE 1 /*AMOD: has changed */
+	#else   /* ONLY_MSPACES */
+		#define HAVE_MORECORE 1
+	#endif  /* ONLY_MSPACES */
+#endif  /* HAVE_MORECORE */
+
+#if !HAVE_MORECORE
+	#define MORECORE_CONTIGUOUS 0
+#else   /* !HAVE_MORECORE */
+	#ifndef MORECORE
+		#define MORECORE DLAdjust
+	#endif  /* MORECORE */
+	#ifndef MORECORE_CONTIGUOUS
+		#define MORECORE_CONTIGUOUS 0
+	#endif  /* MORECORE_CONTIGUOUS */
+#endif  /* !HAVE_MORECORE */
+
+#ifndef DEFAULT_GRANULARITY
+	#if MORECORE_CONTIGUOUS
+		#define DEFAULT_GRANULARITY 4096  /* 0 means to compute in init_mparams */
+	#else   /* MORECORE_CONTIGUOUS */
+		#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U)
+	#endif  /* MORECORE_CONTIGUOUS */
+#endif  /* DEFAULT_GRANULARITY */
+
+#ifndef DEFAULT_TRIM_THRESHOLD
+	#ifndef MORECORE_CANNOT_TRIM
+		#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U)
+	#else   /* MORECORE_CANNOT_TRIM */
+		#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T
+	#endif  /* MORECORE_CANNOT_TRIM */	
+#endif  /* DEFAULT_TRIM_THRESHOLD */
+
+#ifndef DEFAULT_MMAP_THRESHOLD
+	#if HAVE_MMAP
+		#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U)
+	#else   /* HAVE_MMAP */
+		#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
+	#endif  /* HAVE_MMAP */
+#endif  /* DEFAULT_MMAP_THRESHOLD */
+
+#ifndef USE_BUILTIN_FFS
+	#define USE_BUILTIN_FFS 0
+#endif  /* USE_BUILTIN_FFS */
+
+#ifndef USE_DEV_RANDOM
+	#define USE_DEV_RANDOM 0
+#endif  /* USE_DEV_RANDOM */
+
+#ifndef NO_MALLINFO
+	#define NO_MALLINFO 0
+#endif  /* NO_MALLINFO */
+#ifndef MALLINFO_FIELD_TYPE
+	#define MALLINFO_FIELD_TYPE size_t
+#endif  /* MALLINFO_FIELD_TYPE */
+
+/*
+  mallopt tuning options.  SVID/XPG defines four standard parameter
+  numbers for mallopt, normally defined in malloc.h.  None of these
+  are used in this malloc, so setting them has no effect. But this
+  malloc does support the following options.
+*/
+
+#define M_TRIM_THRESHOLD     (-1)
+#define M_GRANULARITY        (-2)
+#define M_MMAP_THRESHOLD     (-3)
+
+#if !NO_MALLINFO
+/*
+  This version of malloc supports the standard SVID/XPG mallinfo
+  routine that returns a struct containing usage properties and
+  statistics. It should work on any system that has a
+  /usr/include/malloc.h defining struct mallinfo.  The main
+  declaration needed is the mallinfo struct that is returned (by-copy)
+  by mallinfo().  The malloinfo struct contains a bunch of fields that
+  are not even meaningful in this version of malloc.  These fields are
+  are instead filled by mallinfo() with other numbers that might be of
+  interest.
+
+  HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
+  /usr/include/malloc.h file that includes a declaration of struct
+  mallinfo.  If so, it is included; else a compliant version is
+  declared below.  These must be precisely the same for mallinfo() to
+  work.  The original SVID version of this struct, defined on most
+  systems with mallinfo, declares all fields as ints. But some others
+  define as unsigned long. If your system defines the fields using a
+  type of different width than listed here, you MUST #include your
+  system version and #define HAVE_USR_INCLUDE_MALLOC_H.
+*/
+
+/* #define HAVE_USR_INCLUDE_MALLOC_H */
+
+#ifdef HAVE_USR_INCLUDE_MALLOC_H
+#include "/usr/include/malloc.h"
+#else /* HAVE_USR_INCLUDE_MALLOC_H */
+
+struct mallinfo {
+  MALLINFO_FIELD_TYPE arena;    /* non-mmapped space allocated from system */
+  MALLINFO_FIELD_TYPE ordblks;  /* number of free chunks */
+  MALLINFO_FIELD_TYPE smblks;   /* always 0 */
+  MALLINFO_FIELD_TYPE hblks;    /* always 0 */
+  MALLINFO_FIELD_TYPE hblkhd;   /* space in mmapped regions */
+  MALLINFO_FIELD_TYPE usmblks;  /* maximum total allocated space */
+  MALLINFO_FIELD_TYPE fsmblks;  /* always 0 */
+  MALLINFO_FIELD_TYPE uordblks; /* total allocated space */
+  MALLINFO_FIELD_TYPE fordblks; /* total free space */
+  MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */
+  MALLINFO_FIELD_TYPE cellCount;/* Number of chunks allocated*/
+};
+
+#endif /* HAVE_USR_INCLUDE_MALLOC_H */
+#endif /* NO_MALLINFO */
+
+#if MSPACES
+	typedef void* mspace;
+#endif /* MSPACES */
+
+#if 0
+
+#include <stdio.h>/* for printing in malloc_stats */
+
+#ifndef LACKS_ERRNO_H
+	#include <errno.h>       /* for MALLOC_FAILURE_ACTION */
+#endif /* LACKS_ERRNO_H */
+
+#if FOOTERS
+	#include <time.h>        /* for magic initialization */
+#endif /* FOOTERS */
+
+#ifndef LACKS_STDLIB_H
+	#include <stdlib.h>      /* for abort() */
+#endif /* LACKS_STDLIB_H */
+
+#ifdef DEBUG
+	#if ABORT_ON_ASSERT_FAILURE
+		#define assert(x) if(!(x)) ABORT
+	#else /* ABORT_ON_ASSERT_FAILURE */
+		#include <assert.h>
+	#endif /* ABORT_ON_ASSERT_FAILURE */
+#else  /* DEBUG */
+		#define assert(x)
+#endif /* DEBUG */
+
+#ifndef LACKS_STRING_H
+	#include <string.h>      /* for memset etc */
+#endif  /* LACKS_STRING_H */
+
+#if USE_BUILTIN_FFS
+	#ifndef LACKS_STRINGS_H
+		#include <strings.h>     /* for ffs */
+	#endif /* LACKS_STRINGS_H */
+#endif /* USE_BUILTIN_FFS */
+
+#if HAVE_MMAP
+	#ifndef LACKS_SYS_MMAN_H
+		#include <sys/mman.h>    /* for mmap */
+	#endif /* LACKS_SYS_MMAN_H */
+	#ifndef LACKS_FCNTL_H
+		#include <fcntl.h>
+	#endif /* LACKS_FCNTL_H */
+#endif /* HAVE_MMAP */
+
+#if HAVE_MORECORE
+	#ifndef LACKS_UNISTD_H
+		#include <unistd.h>     /* for sbrk */
+	extern void*     sbrk(size_t);
+	#else /* LACKS_UNISTD_H */
+		#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+			extern void*     sbrk(ptrdiff_t);			
+			/*Amod sbrk is not defined in WIN32 need to check in symbian*/
+		#endif /* FreeBSD etc */
+	#endif /* LACKS_UNISTD_H */
+#endif /* HAVE_MORECORE */
+
+#endif
+
+#define assert(x)	ASSERT(x)
+			
+/*AMOD: For malloc_getpagesize*/
+#if 0	// replaced with GET_PAGE_SIZE() defined in heap.cpp
+#ifndef WIN32
+	#ifndef malloc_getpagesize
+		#ifdef _SC_PAGESIZE         /* some SVR4 systems omit an underscore */
+			#ifndef _SC_PAGE_SIZE
+				#define _SC_PAGE_SIZE _SC_PAGESIZE
+			#endif
+		#endif
+		#ifdef _SC_PAGE_SIZE
+			#define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
+		#else
+			#if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
+				extern size_t getpagesize();
+				#define malloc_getpagesize getpagesize()
+			#else
+				#ifdef WIN32 /* use supplied emulation of getpagesize */
+					#define malloc_getpagesize getpagesize()
+				#else
+					#ifndef LACKS_SYS_PARAM_H
+						#include <sys/param.h>
+					#endif
+					#ifdef EXEC_PAGESIZE
+						#define malloc_getpagesize EXEC_PAGESIZE
+					#else
+						#ifdef NBPG
+							#ifndef CLSIZE
+								#define malloc_getpagesize NBPG
+							#else
+								#define malloc_getpagesize (NBPG * CLSIZE)
+							#endif
+						#else
+							#ifdef NBPC
+								#define malloc_getpagesize NBPC
+							#else
+								#ifdef PAGESIZE
+									#define malloc_getpagesize PAGESIZE
+								#else /* just guess */
+									#define malloc_getpagesize ((size_t)4096U)
+								#endif
+							#endif
+						#endif
+					#endif
+				#endif
+			#endif
+		#endif
+	#endif
+#endif
+#endif
+/*AMOD: For malloc_getpagesize*/
+
+/* ------------------- size_t and alignment properties -------------------- */
+
+/* The byte and bit size of a size_t */
+#define SIZE_T_SIZE         (sizeof(size_t))
+#define SIZE_T_BITSIZE      (sizeof(size_t) << 3)
+
+/* Some constants coerced to size_t */
+/* Annoying but necessary to avoid errors on some plaftorms */
+#define SIZE_T_ZERO         ((size_t)0)
+#define SIZE_T_ONE          ((size_t)1)
+#define SIZE_T_TWO          ((size_t)2)
+#define TWO_SIZE_T_SIZES    (SIZE_T_SIZE<<1)
+#define FOUR_SIZE_T_SIZES   (SIZE_T_SIZE<<2)
+#define SIX_SIZE_T_SIZES    (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES)
+#define HALF_MAX_SIZE_T     (MAX_SIZE_T / 2U)
+
+/* The bit mask value corresponding to MALLOC_ALIGNMENT */
+#define CHUNK_ALIGN_MASK    (MALLOC_ALIGNMENT - SIZE_T_ONE)
+
+/* True if address a has acceptable alignment */
+//#define is_aligned(A)       (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0)
+#define is_aligned(A)       (((unsigned int)((A)) & (CHUNK_ALIGN_MASK)) == 0)
+
+/* the number of bytes to offset an address to align it */
+#define align_offset(A)\
+	((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\
+	((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK))
+				
+/* -------------------------- MMAP preliminaries ------------------------- */
+
+/*
+   If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and
+   checks to fail so compiler optimizer can delete code rather than
+   using so many "#if"s.
+*/
+
+
+/* MORECORE and MMAP must return MFAIL on failure */
+#define MFAIL                ((void*)(MAX_SIZE_T))
+#define CMFAIL               ((TUint8*)(MFAIL)) /* defined for convenience */
+
+#if !HAVE_MMAP
+	#define IS_MMAPPED_BIT       (SIZE_T_ZERO)
+	#define USE_MMAP_BIT         (SIZE_T_ZERO)
+	#define CALL_MMAP(s)         MFAIL
+	#define CALL_MUNMAP(a, s)    (-1)
+	#define DIRECT_MMAP(s)       MFAIL
+#else /* !HAVE_MMAP */
+	#define IS_MMAPPED_BIT       (SIZE_T_ONE)
+	#define USE_MMAP_BIT         (SIZE_T_ONE)
+		#ifndef WIN32
+			#define CALL_MUNMAP(a, s)    DLUMMAP((a),(s)) /*munmap((a), (s))*/
+			#define MMAP_PROT            (PROT_READ|PROT_WRITE)
+			#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+				#define MAP_ANONYMOUS        MAP_ANON
+			#endif /* MAP_ANON */
+			#ifdef MAP_ANONYMOUS       
+				#define MMAP_FLAGS           (MAP_PRIVATE|MAP_ANONYMOUS)
+				#define CALL_MMAP(s)         mmap(0, (s), MMAP_PROT, (int)MMAP_FLAGS, -1, 0)
+			#else /* MAP_ANONYMOUS */
+				/*
+				   Nearly all versions of mmap support MAP_ANONYMOUS, so the following
+				   is unlikely to be needed, but is supplied just in case.
+				*/
+				#define MMAP_FLAGS           (MAP_PRIVATE)
+				//static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
+				#define CALL_MMAP(s) DLMMAP(s)
+				/*#define CALL_MMAP(s) ((dev_zero_fd < 0) ? \
+			           (dev_zero_fd = open("/dev/zero", O_RDWR), \
+			            mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \
+			            mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0))
+			            */
+				#define CALL_REMAP(a, s, d)    DLREMAP((a),(s),(d))
+			#endif /* MAP_ANONYMOUS */
+			#define DIRECT_MMAP(s)       CALL_MMAP(s)
+		#else /* WIN32 */
+			#define CALL_MMAP(s)         win32mmap(s)
+			#define CALL_MUNMAP(a, s)    win32munmap((a), (s))
+			#define DIRECT_MMAP(s)       win32direct_mmap(s)
+		#endif /* WIN32 */
+#endif /* HAVE_MMAP */
+
+#if HAVE_MMAP && HAVE_MREMAP
+	#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#else  /* HAVE_MMAP && HAVE_MREMAP */
+	#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
+#endif /* HAVE_MMAP && HAVE_MREMAP */
+
+#if HAVE_MORECORE
+	#define CALL_MORECORE(S)     SetBrk(S)
+#else  /* HAVE_MORECORE */
+	#define CALL_MORECORE(S)     MFAIL
+#endif /* HAVE_MORECORE */
+
+/* mstate bit set if continguous morecore disabled or failed */
+#define USE_NONCONTIGUOUS_BIT (4U)
+
+/* segment bit set in create_mspace_with_base */
+#define EXTERN_BIT            (8U)
+
+
+#if USE_LOCKS
+/*
+  When locks are defined, there are up to two global locks:
+  * If HAVE_MORECORE, morecore_mutex protects sequences of calls to
+    MORECORE.  In many cases sys_alloc requires two calls, that should
+    not be interleaved with calls by other threads.  This does not
+    protect against direct calls to MORECORE by other threads not
+    using this lock, so there is still code to cope the best we can on
+    interference.
+  * magic_init_mutex ensures that mparams.magic and other
+    unique mparams values are initialized only once.
+*/
+	#ifndef WIN32
+		/* By default use posix locks */
+		#include <pthread.h>
+		#define MLOCK_T pthread_mutex_t
+		#define INITIAL_LOCK(l)      pthread_mutex_init(l, NULL)
+		#define ACQUIRE_LOCK(l)      pthread_mutex_lock(l)
+		#define RELEASE_LOCK(l)      pthread_mutex_unlock(l)
+		
+		#if HAVE_MORECORE
+			//static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER;
+		#endif /* HAVE_MORECORE */
+			//static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER;
+	#else /* WIN32 */
+		#define MLOCK_T long
+		#define INITIAL_LOCK(l)      *(l)=0
+		#define ACQUIRE_LOCK(l)      win32_acquire_lock(l)
+		#define RELEASE_LOCK(l)      win32_release_lock(l)
+		#if HAVE_MORECORE
+			static MLOCK_T morecore_mutex;
+		#endif /* HAVE_MORECORE */
+		static MLOCK_T magic_init_mutex;
+	#endif /* WIN32 */
+	#define USE_LOCK_BIT               (2U)
+#else  /* USE_LOCKS */
+	#define USE_LOCK_BIT               (0U)
+	#define INITIAL_LOCK(l)
+#endif /* USE_LOCKS */
+
+#if USE_LOCKS && HAVE_MORECORE
+	#define ACQUIRE_MORECORE_LOCK(M)    ACQUIRE_LOCK((M->morecore_mutex)/*&morecore_mutex*/);
+	#define RELEASE_MORECORE_LOCK(M)    RELEASE_LOCK((M->morecore_mutex)/*&morecore_mutex*/);
+#else /* USE_LOCKS && HAVE_MORECORE */
+	#define ACQUIRE_MORECORE_LOCK(M)
+	#define RELEASE_MORECORE_LOCK(M)
+#endif /* USE_LOCKS && HAVE_MORECORE */
+
+#if USE_LOCKS
+		/*Currently not suporting this*/				
+	#define ACQUIRE_MAGIC_INIT_LOCK(M)  ACQUIRE_LOCK(((M)->magic_init_mutex));
+	//AMOD: changed #define ACQUIRE_MAGIC_INIT_LOCK()
+	//#define RELEASE_MAGIC_INIT_LOCK()
+	#define RELEASE_MAGIC_INIT_LOCK(M)  RELEASE_LOCK(((M)->magic_init_mutex));
+#else  /* USE_LOCKS */
+	#define ACQUIRE_MAGIC_INIT_LOCK(M)
+	#define RELEASE_MAGIC_INIT_LOCK(M)
+#endif /* USE_LOCKS */
+
+/*CHUNK representation*/
+struct malloc_chunk {
+  size_t               prev_foot;  /* Size of previous chunk (if free).  */
+  size_t               head;       /* Size and inuse bits. */
+  struct malloc_chunk* fd;         /* double links -- used only if free. */
+  struct malloc_chunk* bk;
+};
+
+typedef struct malloc_chunk  mchunk;
+typedef struct malloc_chunk* mchunkptr;
+typedef struct malloc_chunk* sbinptr;  /* The type of bins of chunks */
+typedef unsigned int bindex_t;         /* Described below */
+typedef unsigned int binmap_t;         /* Described below */
+typedef unsigned int flag_t;           /* The type of various bit flag sets */
+
+
+/* ------------------- Chunks sizes and alignments ----------------------- */
+#define MCHUNK_SIZE         (sizeof(mchunk))
+
+#if FOOTERS
+	#define CHUNK_OVERHEAD      (TWO_SIZE_T_SIZES)
+#else /* FOOTERS */
+	#define CHUNK_OVERHEAD      (SIZE_T_SIZE)
+#endif /* FOOTERS */
+
+/* MMapped chunks need a second word of overhead ... */
+#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES)
+/* ... and additional padding for fake next-chunk at foot */
+#define MMAP_FOOT_PAD       (FOUR_SIZE_T_SIZES)
+
+/* The smallest size we can malloc is an aligned minimal chunk */
+#define MIN_CHUNK_SIZE ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* conversion from malloc headers to user pointers, and back */
+#define chunk2mem(p)        ((void*)((TUint8*)(p)       + TWO_SIZE_T_SIZES))
+#define mem2chunk(mem)      ((mchunkptr)((TUint8*)(mem) - TWO_SIZE_T_SIZES))
+/* chunk associated with aligned address A */
+#define align_as_chunk(A)   (mchunkptr)((A) + align_offset(chunk2mem(A)))
+
+/* Bounds on request (not chunk) sizes. */
+#define MAX_REQUEST         ((-MIN_CHUNK_SIZE) << 2)
+#define MIN_REQUEST         (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE)
+
+/* pad request bytes into a usable size */
+#define pad_request(req) (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK)
+
+/* pad request, checking for minimum (but not maximum) */
+#define request2size(req) (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req))
+
+/* ------------------ Operations on head and foot fields ----------------- */
+
+/*
+  The head field of a chunk is or'ed with PINUSE_BIT when previous
+  adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in
+  use. If the chunk was obtained with mmap, the prev_foot field has
+  IS_MMAPPED_BIT set, otherwise holding the offset of the base of the
+  mmapped region to the base of the chunk.
+*/
+#define PINUSE_BIT          (SIZE_T_ONE)
+#define CINUSE_BIT          (SIZE_T_TWO)
+#define INUSE_BITS          (PINUSE_BIT|CINUSE_BIT)
+
+/* Head value for fenceposts */
+#define FENCEPOST_HEAD      (INUSE_BITS|SIZE_T_SIZE)
+
+/* extraction of fields from head words */
+#define cinuse(p)           ((p)->head & CINUSE_BIT)
+#define pinuse(p)           ((p)->head & PINUSE_BIT)
+#define chunksize(p)        ((p)->head & ~(INUSE_BITS))
+
+#define clear_pinuse(p)     ((p)->head &= ~PINUSE_BIT)
+#define clear_cinuse(p)     ((p)->head &= ~CINUSE_BIT)
+
+/* Treat space at ptr +/- offset as a chunk */
+#define chunk_plus_offset(p, s)  ((mchunkptr)(((TUint8*)(p)) + (s)))
+#define chunk_minus_offset(p, s) ((mchunkptr)(((TUint8*)(p)) - (s)))
+
+/* Ptr to next or previous physical malloc_chunk. */
+#define next_chunk(p) ((mchunkptr)( ((TUint8*)(p)) + ((p)->head & ~INUSE_BITS)))
+#define prev_chunk(p) ((mchunkptr)( ((TUint8*)(p)) - ((p)->prev_foot) ))
+
+/* extract next chunk's pinuse bit */
+#define next_pinuse(p)  ((next_chunk(p)->head) & PINUSE_BIT)
+
+/* Get/set size at footer */
+#define get_foot(p, s)  (((mchunkptr)((TUint8*)(p) + (s)))->prev_foot)
+#define set_foot(p, s)  (((mchunkptr)((TUint8*)(p) + (s)))->prev_foot = (s))
+
+/* Set size, pinuse bit, and foot */
+#define set_size_and_pinuse_of_free_chunk(p, s) ((p)->head = (s|PINUSE_BIT), set_foot(p, s))
+
+/* Set size, pinuse bit, foot, and clear next pinuse */
+#define set_free_with_pinuse(p, s, n) (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s))
+
+#define is_mmapped(p) (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT))
+
+/* Get the internal overhead associated with chunk p */
+#define overhead_for(p) (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD)
+
+/* Return true if malloced space is not necessarily cleared */
+#if MMAP_CLEARS
+	#define calloc_must_clear(p) (!is_mmapped(p))
+#else /* MMAP_CLEARS */
+	#define calloc_must_clear(p) (1)
+#endif /* MMAP_CLEARS */
+
+/* ---------------------- Overlaid data structures ----------------------- */
+struct malloc_tree_chunk {
+  /* The first four fields must be compatible with malloc_chunk */
+  size_t                    				prev_foot;
+  size_t                    				head;
+  struct malloc_tree_chunk*	fd;
+  struct malloc_tree_chunk*	bk;
+
+  struct malloc_tree_chunk* child[2];
+  struct malloc_tree_chunk* parent;
+  bindex_t                  index;
+};
+
+typedef struct malloc_tree_chunk  tchunk;
+typedef struct malloc_tree_chunk* tchunkptr;
+typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */
+
+/* A little helper macro for trees */
+#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1])
+/*Segment structur*/
+struct malloc_segment {
+  TUint8*        base;             /* base address */
+  size_t       size;             /* allocated size */
+  struct malloc_segment* next;   /* ptr to next segment */
+  flag_t       sflags;           /* mmap and extern flag */
+};
+
+#define is_mmapped_segment(S)  ((S)->sflags & IS_MMAPPED_BIT)
+#define is_extern_segment(S)   ((S)->sflags & EXTERN_BIT)
+
+typedef struct malloc_segment  msegment;
+typedef struct malloc_segment* msegmentptr;
+
+/*Malloc State data structur*/
+
+#define NSMALLBINS        (32U)
+#define NTREEBINS         (32U)
+#define SMALLBIN_SHIFT    (3U)
+#define SMALLBIN_WIDTH    (SIZE_T_ONE << SMALLBIN_SHIFT)
+#define TREEBIN_SHIFT     (8U)
+#define MIN_LARGE_SIZE    (SIZE_T_ONE << TREEBIN_SHIFT)
+#define MAX_SMALL_SIZE    (MIN_LARGE_SIZE - SIZE_T_ONE)
+#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD)
+
+struct malloc_state {
+  binmap_t   smallmap;
+  binmap_t   treemap;
+  size_t     dvsize;
+  size_t     topsize;
+  TUint8*      least_addr;
+  mchunkptr  dv;
+  mchunkptr  top;
+  size_t     trim_check;
+  size_t     magic;
+  mchunkptr  smallbins[(NSMALLBINS+1)*2];
+  tbinptr    treebins[NTREEBINS];
+  size_t     footprint;
+  size_t     max_footprint;
+  flag_t     mflags;
+#if USE_LOCKS
+  MLOCK_T    mutex;     /* locate lock among fields that rarely change */
+  MLOCK_T	magic_init_mutex;  
+  MLOCK_T	morecore_mutex;
+#endif /* USE_LOCKS */
+  msegment   seg;
+};
+
+typedef struct malloc_state*    mstate;
+
+/* ------------- Global malloc_state and malloc_params ------------------- */
+
+/*
+  malloc_params holds global properties, including those that can be
+  dynamically set using mallopt. There is a single instance, mparams,
+  initialized in init_mparams.
+*/
+
+struct malloc_params {
+  size_t magic;
+  size_t page_size;
+  size_t granularity;
+  size_t mmap_threshold;
+  size_t trim_threshold;
+  flag_t default_mflags;
+#if USE_LOCKS
+  MLOCK_T	magic_init_mutex;  
+#endif /* USE_LOCKS */
+};
+
+/* The global malloc_state used for all non-"mspace" calls */
+/*AMOD: Need to check this as this will be the member of the class*/
+
+//static struct malloc_state _gm_;
+//#define gm                 (&_gm_)
+ 
+//#define is_global(M)       ((M) == &_gm_)
+/*AMOD: has changed*/
+#define is_global(M)       ((M) == gm)
+#define is_initialized(M)  ((M)->top != 0)
+
+/* -------------------------- system alloc setup ------------------------- */
+
+/* Operations on mflags */
+
+#define use_lock(M)           ((M)->mflags &   USE_LOCK_BIT)
+#define enable_lock(M)        ((M)->mflags |=  USE_LOCK_BIT)
+#define disable_lock(M)       ((M)->mflags &= ~USE_LOCK_BIT)
+
+#define use_mmap(M)           ((M)->mflags &   USE_MMAP_BIT)
+#define enable_mmap(M)        ((M)->mflags |=  USE_MMAP_BIT)
+#define disable_mmap(M)       ((M)->mflags &= ~USE_MMAP_BIT)
+
+#define use_noncontiguous(M)  ((M)->mflags &   USE_NONCONTIGUOUS_BIT)
+#define disable_contiguous(M) ((M)->mflags |=  USE_NONCONTIGUOUS_BIT)
+
+#define set_lock(M,L) ((M)->mflags = (L)? ((M)->mflags | USE_LOCK_BIT) :  ((M)->mflags & ~USE_LOCK_BIT))
+
+/* page-align a size */
+#define page_align(S) (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE))
+
+/* granularity-align a size */
+#define granularity_align(S)  (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE))
+
+#define is_page_aligned(S)   (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0)
+#define is_granularity_aligned(S)   (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0)
+
+/*  True if segment S holds address A */
+#define segment_holds(S, A)  ((TUint8*)(A) >= S->base && (TUint8*)(A) < S->base + S->size)
+
+#ifndef MORECORE_CANNOT_TRIM
+	#define should_trim(M,s)  ((s) > (M)->trim_check)
+#else  /* MORECORE_CANNOT_TRIM */
+	#define should_trim(M,s)  (0)
+#endif /* MORECORE_CANNOT_TRIM */
+
+/*
+  TOP_FOOT_SIZE is padding at the end of a segment, including space
+  that may be needed to place segment records and fenceposts when new
+  noncontiguous segments are added.
+*/
+#define TOP_FOOT_SIZE  (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE)
+
+/* -------------------------------  Hooks -------------------------------- */
+
+/*
+  PREACTION should be defined to return 0 on success, and nonzero on
+  failure. If you are not using locking, you can redefine these to do
+  anything you like.
+*/
+
+#if USE_LOCKS
+	/* Ensure locks are initialized */
+	#define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams())
+	#define PREACTION(M) (use_lock((M))?(ACQUIRE_LOCK((M)->mutex),0):0) /*Action to take like lock before alloc*/
+	#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK((M)->mutex); }
+
+#else /* USE_LOCKS */
+	#ifndef PREACTION
+		#define PREACTION(M) (0)
+	#endif  /* PREACTION */
+	#ifndef POSTACTION
+		#define POSTACTION(M)
+	#endif  /* POSTACTION */
+#endif /* USE_LOCKS */
+
+/*
+  CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses.
+  USAGE_ERROR_ACTION is triggered on detected bad frees and
+  reallocs. The argument p is an address that might have triggered the
+  fault. It is ignored by the two predefined actions, but might be
+  useful in custom actions that try to help diagnose errors.
+*/
+
+#if PROCEED_ON_ERROR
+	/* A count of the number of corruption errors causing resets */
+	int malloc_corruption_error_count;
+	/* default corruption action */
+	static void reset_on_error(mstate m);
+	#define CORRUPTION_ERROR_ACTION(m)  reset_on_error(m)
+	#define USAGE_ERROR_ACTION(m, p)
+#else /* PROCEED_ON_ERROR */
+	#ifndef CORRUPTION_ERROR_ACTION
+		#define CORRUPTION_ERROR_ACTION(m) ABORT
+	#endif /* CORRUPTION_ERROR_ACTION */
+	#ifndef USAGE_ERROR_ACTION
+		#define USAGE_ERROR_ACTION(m,p) ABORT
+	#endif /* USAGE_ERROR_ACTION */
+#endif /* PROCEED_ON_ERROR */
+
+	/* -------------------------- Debugging setup ---------------------------- */
+
+#if ! DEBUG
+	#define check_free_chunk(M,P)
+	#define check_inuse_chunk(M,P)
+	#define check_malloced_chunk(M,P,N)
+	#define check_mmapped_chunk(M,P)
+	#define check_malloc_state(M)
+	#define check_top_chunk(M,P)
+#else /* DEBUG */
+	#define check_free_chunk(M,P)       do_check_free_chunk(M,P)
+	#define check_inuse_chunk(M,P)      do_check_inuse_chunk(M,P)
+	#define check_top_chunk(M,P)        do_check_top_chunk(M,P)
+	#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N)
+	#define check_mmapped_chunk(M,P)    do_check_mmapped_chunk(M,P)
+	#define check_malloc_state(M)       do_check_malloc_state(M)
+	static void   do_check_any_chunk(mstate m, mchunkptr p);
+	static void   do_check_top_chunk(mstate m, mchunkptr p);
+	static void   do_check_mmapped_chunk(mstate m, mchunkptr p);
+	static void   do_check_inuse_chunk(mstate m, mchunkptr p);
+	static void   do_check_free_chunk(mstate m, mchunkptr p);
+	static void   do_check_malloced_chunk(mstate m, void* mem, size_t s);
+	static void   do_check_tree(mstate m, tchunkptr t);
+	static void   do_check_treebin(mstate m, bindex_t i);
+	static void   do_check_smallbin(mstate m, bindex_t i);
+	static void   do_check_malloc_state(mstate m);
+	static int    bin_find(mstate m, mchunkptr x);
+	static size_t traverse_and_check(mstate m);
+#endif /* DEBUG */
+
+/* ---------------------------- Indexing Bins ---------------------------- */
+
+#define is_small(s)         (((s) >> SMALLBIN_SHIFT) < NSMALLBINS)
+#define small_index(s)      ((s)  >> SMALLBIN_SHIFT)
+#define small_index2size(i) ((i)  << SMALLBIN_SHIFT)
+#define MIN_SMALL_INDEX     (small_index(MIN_CHUNK_SIZE))
+
+/* addressing by index. See above about smallbin repositioning */
+#define smallbin_at(M, i)   ((sbinptr)((TUint8*)&((M)->smallbins[(i)<<1])))
+#define treebin_at(M,i)     (&((M)->treebins[i]))
+
+
+/* Bit representing maximum resolved size in a treebin at i */
+#define bit_for_tree_index(i) (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2)
+
+/* Shift placing maximum resolved bit in a treebin at i as sign bit */
+#define leftshift_for_tree_index(i) ((i == NTREEBINS-1)? 0 : ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2)))
+
+/* The size of the smallest chunk held in bin with index i */
+#define minsize_for_tree_index(i) ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) |  (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1)))
+
+
+/* ------------------------ Operations on bin maps ----------------------- */
+/* bit corresponding to given index */
+#define idx2bit(i)              ((binmap_t)(1) << (i))
+/* Mark/Clear bits with given index */
+#define mark_smallmap(M,i)      ((M)->smallmap |=  idx2bit(i))
+#define clear_smallmap(M,i)     ((M)->smallmap &= ~idx2bit(i))
+#define smallmap_is_marked(M,i) ((M)->smallmap &   idx2bit(i))
+#define mark_treemap(M,i)       ((M)->treemap  |=  idx2bit(i))
+#define clear_treemap(M,i)      ((M)->treemap  &= ~idx2bit(i))
+#define treemap_is_marked(M,i)  ((M)->treemap  &   idx2bit(i))
+
+/* isolate the least set bit of a bitmap */
+#define least_bit(x)         ((x) & -(x))
+
+/* mask with all bits to left of least bit of x on */
+#define left_bits(x)         ((x<<1) | -(x<<1))
+
+/* mask with all bits to left of or equal to least bit of x on */
+#define same_or_left_bits(x) ((x) | -(x))
+
+	/* isolate the least set bit of a bitmap */
+#define least_bit(x)         ((x) & -(x))
+
+/* mask with all bits to left of least bit of x on */
+#define left_bits(x)         ((x<<1) | -(x<<1))
+
+/* mask with all bits to left of or equal to least bit of x on */
+#define same_or_left_bits(x) ((x) | -(x))
+
+#if !INSECURE
+	/* Check if address a is at least as high as any from MORECORE or MMAP */
+	#define ok_address(M, a) ((TUint8*)(a) >= (M)->least_addr)
+	/* Check if address of next chunk n is higher than base chunk p */
+	#define ok_next(p, n)    ((TUint8*)(p) < (TUint8*)(n))
+	/* Check if p has its cinuse bit on */
+	#define ok_cinuse(p)     cinuse(p)
+	/* Check if p has its pinuse bit on */
+	#define ok_pinuse(p)     pinuse(p)
+#else /* !INSECURE */
+	#define ok_address(M, a) (1)
+	#define ok_next(b, n)    (1)
+	#define ok_cinuse(p)     (1)
+	#define ok_pinuse(p)     (1)
+#endif /* !INSECURE */
+
+#if (FOOTERS && !INSECURE)
+	/* Check if (alleged) mstate m has expected magic field */
+	#define ok_magic(M)      ((M)->magic == mparams.magic)
+#else  /* (FOOTERS && !INSECURE) */
+	#define ok_magic(M)      (1)
+#endif /* (FOOTERS && !INSECURE) */
+
+/* In gcc, use __builtin_expect to minimize impact of checks */
+#if !INSECURE
+	#if defined(__GNUC__) && __GNUC__ >= 3
+		#define RTCHECK(e)  __builtin_expect(e, 1)
+	#else /* GNUC */
+		#define RTCHECK(e)  (e)
+	#endif /* GNUC */
+
+#else /* !INSECURE */
+	#define RTCHECK(e)  (1)
+#endif /* !INSECURE */
+/* macros to set up inuse chunks with or without footers */
+#if !FOOTERS
+	#define mark_inuse_foot(M,p,s)
+	/* Set cinuse bit and pinuse bit of next chunk */
+	#define set_inuse(M,p,s)  ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT)
+	/* Set cinuse and pinuse of this chunk and pinuse of next chunk */
+	#define set_inuse_and_pinuse(M,p,s) ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT)
+	/* Set size, cinuse and pinuse bit of this chunk */
+	#define set_size_and_pinuse_of_inuse_chunk(M, p, s) ((p)->head = (s|PINUSE_BIT|CINUSE_BIT))
+#else /* FOOTERS */
+	/* Set foot of inuse chunk to be xor of mstate and seed */
+	#define mark_inuse_foot(M,p,s) (((mchunkptr)((TUint8*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic))
+	#define get_mstate_for(p) ((mstate)(((mchunkptr)((TUint8*)(p)+(chunksize(p))))->prev_foot ^ mparams.magic))
+	#define set_inuse(M,p,s)\
+		((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\
+		(((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT), \
+		mark_inuse_foot(M,p,s))
+	#define set_inuse_and_pinuse(M,p,s)\
+	((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+	(((mchunkptr)(((TUint8*)(p)) + (s)))->head |= PINUSE_BIT),\
+	mark_inuse_foot(M,p,s))
+	#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\
+	((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\
+	mark_inuse_foot(M, p, s))
+#endif /* !FOOTERS */
+
+
+#if ONLY_MSPACES
+#define internal_malloc(m, b) mspace_malloc(m, b)
+#define internal_free(m, mem) mspace_free(m,mem);
+#else /* ONLY_MSPACES */
+	#if MSPACES
+		#define internal_malloc(m, b) (m == gm)? dlmalloc(b) : mspace_malloc(m, b)
+		#define internal_free(m, mem) if (m == gm) dlfree(mem); else mspace_free(m,mem);
+	#else /* MSPACES */
+		#define internal_malloc(m, b) dlmalloc(b)
+		#define internal_free(m, mem) dlfree(mem)
+	#endif /* MSPACES */
+#endif /* ONLY_MSPACES */
+/******CODE TO SUPORT SLAB ALLOCATOR******/
+	
+	#ifndef NDEBUG
+	#define CHECKING 1
+	#endif
+	#define HYSTERESIS 4
+	#define HYSTERESIS_BYTES (2*pagesize)
+	
+	#if CHECKING
+	//#define ASSERT(x) {if (!(x)) abort();}
+	#define CHECK(x) x
+	#else 
+	#define ASSERT(x) (void)0
+	#define CHECK(x) (void)0
+	#endif
+	
+	class slab;
+	class slabhdr;
+	#define maxslabsize		60
+	#define	pageshift		12
+	#define pagesize		(1<<pageshift)
+	#define	slabshift		10
+	#define	slabsize		(1 << slabshift)
+	#define cellalign		8
+	const unsigned slabfull = 0;
+	const TInt	slabsperpage	=	(int)(pagesize/slabsize);
+	#define hibit(bits) (((unsigned)bits & 0xc) ? 2 + ((unsigned)bits>>3) : ((unsigned) bits>>1))
+
+	#define lowbit(bits)	(((unsigned) bits&3) ? 1 - ((unsigned)bits&1) : 3 - (((unsigned)bits>>2)&1))
+	#define maxslabsize	60
+	#define minpagepower	pageshift+2
+	#define cellalign	8
+	class slabhdr
+	{
+	public:
+		unsigned header;
+		// made up of
+		// bits   |    31    | 30..28 | 27..18 | 17..12 |  11..8  |   7..0   |
+		//        +----------+--------+--------+--------+---------+----------+
+		// field  | floating |  zero  | used-4 |  size  | pagemap | free pos |
+		//
+		slab** parent;		// reference to parent's pointer to this slab in tree
+		slab* child1;		// 1st child in tree
+		slab* child2;		// 2nd child in tree
+	};
+
+	inline unsigned header_floating(unsigned h)
+	{return (h&0x80000000);}
+	const unsigned maxuse = (slabsize - sizeof(slabhdr))>>2;
+	const unsigned firstpos = sizeof(slabhdr)>>2;
+	#define checktree(x) (void)0
+	template <class T> inline T floor(const T addr, unsigned aln)
+		{return T((unsigned(addr))&~(aln-1));}
+	template <class T> inline T ceiling(T addr, unsigned aln)
+		{return T((unsigned(addr)+(aln-1))&~(aln-1));}
+	template <class T> inline unsigned lowbits(T addr, unsigned aln)
+		{return unsigned(addr)&(aln-1);}
+	template <class T1, class T2> inline int ptrdiff(const T1* a1, const T2* a2)
+		{return reinterpret_cast<const unsigned char*>(a1) - reinterpret_cast<const unsigned char*>(a2);}
+	template <class T> inline T offset(T addr, unsigned ofs)
+		{return T(unsigned(addr)+ofs);}
+	class slabset
+	{
+	public:
+		void* initslab(slab* s);
+		unsigned size;
+		slab* partial;
+	};
+	
+	class slab : public slabhdr
+	{
+	public:
+		void init(unsigned clz);
+		//static slab* slabfor( void* p);
+		static slab* slabfor(const void* p) ;
+	private:
+		unsigned char payload[slabsize-sizeof(slabhdr)];
+	};
+	class page
+	{
+	public:
+		inline static page* pagefor(slab* s);
+		//slab slabs;
+		slab slabs[slabsperpage];
+	};
+	
+	
+	inline page* page::pagefor(slab* s)
+	{
+		return reinterpret_cast<page*>(floor(s, pagesize));
+	}
+	struct pagecell
+	{
+		void* page;
+		unsigned size;
+	};
+	/******CODE TO SUPORT SLAB ALLOCATOR******/
+#endif/*__DLA__*/
--- a/webengine/osswebengine/MemoryManager/Inc/FastAllocator.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Inc/FastAllocator.h	Fri May 08 08:25:06 2009 +0300
@@ -21,6 +21,23 @@
 #include <e32base.h>
 #include <e32cmn.h>
 
+#ifdef TRACK_ALLOCATIONS
+typedef struct {
+	TInt requestedSize;
+	TUint32 cellId; 
+}THeapTrace;
+
+TAny* GetRealPtrFromClientPtr(TAny* aClientPtr);
+void  DecreaseSizeInPlace(TInt& aSize);
+
+class CMemoryPool;
+TAny* TraceAlloc(CMemoryPool* aPool, TInt* aSize, TUint32* aCellId);
+void TraceFree(TAny **aPtr);
+TBool TracePreRealloc(TAny** aPtr, TInt *aSize, TUint32& aOriginalCellId);
+void TracePostRealloc(TAny** p, TInt aRequestedSize, TUint32* aNewCellId, TUint32 aOriginalCellId, TBool aIssueNewCellId);
+
+#endif
+
 class CFastMemoryPool;
 
 class RFastAllocator : public RAllocator
@@ -46,6 +63,35 @@
     RHeap& iHeap;
     TUint32 iHeapBase;
     CFastMemoryPool* iPool;
+#ifdef TRACK_ALLOCATIONS
+    TUint32 iNextCellId;
+#endif
+  };
+
+class CNewSymbianHeapPool;
+
+NONSHARABLE_CLASS(RSymbianDlAllocatorWrapper) : public RAllocator
+{
+public:
+	RSymbianDlAllocatorWrapper(CNewSymbianHeapPool*);
+    ~RSymbianDlAllocatorWrapper();
+
+	TAny* Alloc(TInt aSize);
+	void Free(TAny* aPtr);
+	TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
+	TInt AllocLen(const TAny* aCell) const;
+	TInt Compress();
+	void Reset();
+	TInt AllocSize(TInt& aTotalAllocSize) const;
+	TInt Available(TInt& aBiggestBlock) const;
+	TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
+	TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
+
+private:
+    CNewSymbianHeapPool* iPool;
+#ifdef TRACK_ALLOCATIONS
+    TUint32 iNextCellId;
+#endif
   };
 
 #endif //!__FASTALLOCATOR_H__
--- a/webengine/osswebengine/MemoryManager/Inc/MemoryPool.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Inc/MemoryPool.h	Fri May 08 08:25:06 2009 +0300
@@ -331,4 +331,35 @@
         TUint iRescueBufferSize;
     };
 
+class RSymbianDLHeap;
+
+/**
+*  The memory pool using new symbian DLMalloc/Slab hybrid allocator for fast allocation
+*  @lib memman.lib
+*  @since 3.1
+*/
+NONSHARABLE_CLASS(CNewSymbianHeapPool) : public CMemoryPool
+    {
+    public:
+    	CNewSymbianHeapPool();
+    	~CNewSymbianHeapPool();
+    	
+        TBool Create();
+    	
+        TAny* Allocate( TUint aSize )   { return AllocFromPool( aSize ); }
+        TAny* ReAllocate( TAny* aPtr, TUint aSize );
+        void Free( TAny* aPtr );
+        TUint MemorySize( TAny* aPtr );
+        void SetRescueBufferSize( TInt aSize );
+        TAny* DoAlloc( TUint aSize );
+        TBool PreCheck( TUint aTotalSize, TUint aMaxBufSize, const TDesC8& aChecker );
+        TUint PostCheck();
+        TUint FreeMemory( TFreeMem& aFree );
+        void RestoreRescueBuffer();
+    private:
+    	void InitLocal();
+    	
+    	RSymbianDLHeap *iAlloc;
+    };
+
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/MemoryManager/Inc/SymbianDlHeap.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,295 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*
+*/
+
+#ifndef SYMBIANDLHEAP_H_
+#define SYMBIANDLHEAP_H_
+
+/**
+@publishedAll
+@released
+
+Represents the default implementation for a heap.
+
+The default implementation uses an address-ordered first fit type algorithm.
+
+The heap itself is contained in a chunk and may be the only occupant of the 
+chunk or may share the chunk with the program stack.
+
+The class contains member functions for allocating, adjusting, freeing individual 
+cells and generally managing the heap.
+
+The class is not a handle in the same sense that RChunk is a handle; i.e. 
+there is no Kernel object which corresponds to the heap.
+*/
+#include "DLA.h"
+
+#undef UIMPORT_C
+#define UIMPORT_C 
+
+NONSHARABLE_CLASS(RSymbianDLHeap) : public RAllocator
+	{
+public:
+	enum{EAllocCellSize = 8};
+#ifndef __MANUALLY_INCLUDED_RSymbianDLHeap_CPP__
+	UIMPORT_C virtual TAny* Alloc(TInt aSize);
+	UIMPORT_C virtual void Free(TAny* aPtr);
+	UIMPORT_C virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
+	UIMPORT_C virtual TInt AllocLen(const TAny* aCell) const;
+	UIMPORT_C virtual TInt Compress();
+	UIMPORT_C virtual void Reset();
+	UIMPORT_C virtual TInt AllocSize(TInt& aTotalAllocSize) const;
+	UIMPORT_C virtual TInt Available(TInt& aBiggestBlock) const;
+	UIMPORT_C virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
+	
+protected:
+	UIMPORT_C virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
+#else
+	 virtual TAny* Alloc(TInt aSize);
+	 virtual void Free(TAny* aPtr);
+	 virtual TAny* ReAlloc(TAny* aPtr, TInt aSize, TInt aMode=0);
+	 virtual TInt AllocLen(const TAny* aCell) const;
+	 virtual TInt Compress();
+	 virtual void Reset();
+	 virtual TInt AllocSize(TInt& aTotalAllocSize) const;
+	 virtual TInt Available(TInt& aBiggestBlock) const;
+	 virtual TInt DebugFunction(TInt aFunc, TAny* a1=NULL, TAny* a2=NULL);
+protected:
+	 virtual TInt Extension_(TUint aExtensionId, TAny*& a0, TAny* a1);
+#endif
+	
+public:
+	TInt Size() const
+	{ return iChunkSize; }
+	
+	inline TInt MaxLength() const;
+	inline TUint8* Base() const;
+	inline TInt Align(TInt a) const;
+	inline const TAny* Align(const TAny* a) const;
+	//inline TBool IsLastCell(const SCell* aCell) const;
+	inline void Lock() const;
+	inline void Unlock() const;
+	inline TInt ChunkHandle() const;
+
+    /**
+    @internalComponent
+    */
+	struct _s_align {char c; double d;};
+
+    /**
+    The structure of a heap cell header for a heap cell on the free list.
+    */
+	struct SCell {
+	             /**
+	             The length of the cell, which includes the length of
+	             this header.
+	             */
+	             TInt len; 
+	             
+	             
+	             /**
+	             A pointer to the next cell in the free list.
+	             */
+	             SCell* next;
+	             };
+
+	/** 
+    The default cell alignment.
+    */
+	enum {ECellAlignment = sizeof(_s_align)-sizeof(double)};
+			
+	/**
+	Size of a free cell header.
+	*/
+	enum {EFreeCellSize = sizeof(SCell)};
+
+    /**
+    @internalComponent
+    */
+    enum TDefaultShrinkRatios {EShrinkRatio1=256, EShrinkRatioDflt=512};
+
+public:
+	UIMPORT_C RSymbianDLHeap(TInt aMaxLength, TInt aAlign=0, TBool aSingleThread=ETrue);
+	UIMPORT_C RSymbianDLHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy, TInt aAlign=0, TBool aSingleThread=EFalse);
+	inline RSymbianDLHeap();
+
+	TAny* operator new(TUint aSize, TAny* aBase) __NO_THROW;
+	inline void operator delete(TAny*, TAny*);
+	
+protected:
+	UIMPORT_C SCell* GetAddress(const TAny* aCell) const;
+
+public:
+	TInt iMinLength;
+	TInt iMaxLength;			// maximum bytes used by the allocator in total
+	TInt iOffset;					// offset of RSymbianDLHeap object from chunk base
+	TInt iGrowBy;
+
+	TInt iChunkHandle;			// handle of chunk
+	RFastLock iLock;
+	TUint8* iBase;				// bottom of DL memory, i.e. this+sizeof(RSymbianDLHeap)
+	TUint8* iTop;					// top of DL memory (page aligned)
+	TInt iAlign;
+	TInt iMinCell;
+	TInt iPageSize;
+	SCell iFree;
+protected:
+	TInt iNestingLevel;
+	TInt iAllocCount;
+	TAllocFail iFailType;
+	TInt iFailRate;
+	TBool iFailed;
+	TInt iFailAllocCount;
+	TInt iRand;
+	TAny* iTestData;
+protected:
+	TInt iChunkSize;				// currently allocated bytes in the chunk (== chunk.Size())
+	malloc_state iGlobalMallocState;
+	malloc_params mparams;
+private:
+	void Init(TInt aBitmapSlab, TInt aPagePower, size_t aTrimThreshold);/*Init internal data structures*/
+	inline int init_mparams(size_t aTrimThreshold /*= DEFAULT_TRIM_THRESHOLD*/);		
+	inline void init_bins(mstate m);
+	inline void init_top(mstate m, mchunkptr p, size_t psize);
+	void* sys_alloc(mstate m, size_t nb);
+	msegmentptr segment_holding(mstate m, TUint8* addr);
+	void add_segment(mstate m, TUint8* tbase, size_t tsize, flag_t mmapped);
+	int sys_trim(mstate m, size_t pad);
+	int has_segment_link(mstate m, msegmentptr ss);
+	size_t release_unused_segments(mstate m);		
+	void* mmap_alloc(mstate m, size_t nb);/*Need to check this function*/		
+	void* prepend_alloc(mstate m, TUint8* newbase, TUint8* oldbase, size_t nb);				
+	void* tmalloc_large(mstate m, size_t nb);
+	void* tmalloc_small(mstate m, size_t nb);
+	/*MACROS converted functions*/
+	static inline void unlink_first_small_chunk(mstate M,mchunkptr B,mchunkptr P,bindex_t& I);
+	static inline void insert_small_chunk(mstate M,mchunkptr P, size_t S);
+	static inline void insert_chunk(mstate M,mchunkptr P,size_t S);
+	static inline void unlink_large_chunk(mstate M,tchunkptr X);
+	static inline void unlink_small_chunk(mstate M, mchunkptr P,size_t S);
+	static inline void unlink_chunk(mstate M, mchunkptr P, size_t S);
+	static inline void compute_tree_index(size_t S, bindex_t& I);
+	static inline void insert_large_chunk(mstate M,tchunkptr X,size_t S);
+	static inline void replace_dv(mstate M, mchunkptr P, size_t S);
+	static inline void compute_bit2idx(binmap_t X,bindex_t& I);
+	/*MACROS converted functions*/
+	TAny* SetBrk(TInt32 aDelta);
+	void* internal_realloc(mstate m, void* oldmem, size_t bytes);
+	void  internal_malloc_stats(mstate m);
+	int change_mparam(int param_number, int value);
+#if !NO_MALLINFO
+		mallinfo internal_mallinfo(mstate m);
+#endif
+	void Init_Dlmalloc(size_t capacity, int locked, size_t aTrimThreshold);
+	void* dlmalloc(size_t);
+	void  dlfree(void*);
+	void* dlrealloc(void*, size_t);
+	int dlmallopt(int, int);
+	size_t dlmalloc_footprint(void);
+	size_t dlmalloc_max_footprint(void);
+	#if !NO_MALLINFO
+		struct mallinfo dlmallinfo(void);
+	#endif
+	int  dlmalloc_trim(size_t);
+	size_t dlmalloc_usable_size(void*);
+	void  dlmalloc_stats(void);		
+	inline	mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb);
+
+		/****************************Code Added For DL heap**********************/			
+	friend class CNewSymbianHeapPool;
+private:
+	unsigned short slab_threshold;
+	unsigned short page_threshold;		// 2^n is smallest cell size allocated in paged allocator
+	slab* partial_page;// partial-use page tree
+	page* spare_page;					// single empty page cached
+	unsigned char sizemap[(maxslabsize>>2)+1];	// index of slabset based on size class
+private:
+	static void tree_remove(slab* s);
+	static void tree_insert(slab* s,slab** r);
+public:
+	enum {okbits = (1<<(maxslabsize>>2))-1};
+	void slab_init(unsigned slabbitmap);
+	void* slab_allocate(slabset& allocator);
+	void slab_free(void* p);
+	void* allocnewslab(slabset& allocator);
+	void* allocnewpage(slabset& allocator);
+	void freeslab(slab* s);
+	void freepage(page* p);
+	void* map(void* p,unsigned sz);
+	void* remap(void* p,unsigned oldsz,unsigned sz);
+	void unmap(void* p,unsigned sz);
+	/**I think we need to move this functions to slab allocator class***/
+	static inline unsigned header_free(unsigned h) 
+	{return (h&0x000000ff);}
+	static inline unsigned header_pagemap(unsigned h) 
+	{return (h&0x00000f00)>>8;}
+	static inline unsigned header_size(unsigned h) 
+	{return (h&0x0003f000)>>12;}
+	static inline unsigned header_usedm4(unsigned h) 
+	{return (h&0x0ffc0000)>>18;}
+	/***paged allocator code***/
+	void paged_init(unsigned pagepower);	
+	void* paged_allocate(unsigned size);
+	void paged_free(void* p);	
+	void* paged_reallocate(void* p, unsigned size);
+	pagecell* paged_descriptor(const void* p) const ;
+private: 
+	// paged allocator structures
+	enum {npagecells=4};
+	pagecell pagelist[npagecells];		// descriptors for page-aligned large allocations
+	/**
+	 *always keep this variable at the bottom of the class as its used as
+	 * array of more than 1 objest though it declared a single.
+	 *  TODO: dynamic sizing of heap object based on slab configuration.
+	 *             Just allocate maximum number of slabsets for now
+	 * */
+	slabset slaballoc[15];
+	};
+
+
+inline void RSymbianDLHeap::Lock() const
+/**
+@internalComponent
+*/
+	{((RFastLock&)iLock).Wait();}
+
+
+
+
+inline void RSymbianDLHeap::Unlock() const
+/**
+@internalComponent
+*/
+	{((RFastLock&)iLock).Signal();}
+
+
+inline TInt RSymbianDLHeap::ChunkHandle() const
+/**
+@internalComponent
+*/
+	{
+	return iChunkHandle;
+	}
+
+inline void RSymbianDLHeap::operator delete(TAny*, TAny*) 
+/**
+Called if constructor issued by operator new(TUint aSize, TAny* aBase) throws exception.
+This is dummy as corresponding new operator does not allocate memory.
+*/
+	{}
+
+#endif /* SYMBIANDLHEAP_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/MemoryManager/Inc/common.h	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*
+*/
+
+#ifndef __E32_COMMON_H__
+#define __E32_COMMON_H__
+
+#ifdef __KERNEL_MODE__
+#include <e32cmn.h>
+#include <e32panic.h>
+#include <u32std.h>
+#else
+#include <e32std.h>
+#include <e32base.h>
+#include <e32math.h>
+#include <e32svr.h>
+#include <e32ver.h>
+#include <e32hal.h>
+#include <e32panic.h>
+#include <u32exec.h>
+#endif
+
+GLREF_C void Panic(TCdtPanic aPanic);
+GLDEF_C void PanicBadArrayIndex();
+GLREF_C TInt __DoConvertNum(TUint, TRadix, TUint, TUint8*&);
+GLREF_C TInt __DoConvertNum(Uint64, TRadix, TUint, TUint8*&);
+
+#ifdef __KERNEL_MODE__
+GLREF_C void KernHeapFault(TCdtPanic aPanic);
+GLREF_C void KHeapCheckThreadState();
+TInt StringLength(const TUint16* aPtr);
+TInt StringLength(const TUint8* aPtr);
+
+#define	STD_CLASS					Kern
+#define	STRING_LENGTH(s)			StringLength(s)
+#define	STRING_LENGTH_16(s)			StringLength(s)
+#define	PANIC_CURRENT_THREAD(c,r)	Kern::PanicCurrentThread(c, r)
+#define __KERNEL_CHECK_RADIX(r)		__ASSERT_ALWAYS(((r)==EDecimal)||((r)==EHex),Panic(EInvalidRadix))
+#define	APPEND_BUF_SIZE				10
+#define	APPEND_BUF_SIZE_64			20
+#define	HEAP_PANIC(r)				RHeapK::Fault(r)
+#define	GET_PAGE_SIZE(x)			x = M::PageSizeInBytes()
+#define	DIVISION_BY_ZERO()			FAULT()
+
+#ifdef _DEBUG
+#define	__CHECK_THREAD_STATE		RHeapK::CheckThreadState()
+#else
+#define	__CHECK_THREAD_STATE
+#endif
+
+#else
+
+#define	STD_CLASS					User
+#define	STRING_LENGTH(s)			User::StringLength(s)
+#define	STRING_LENGTH_16(s)			User::StringLength(s)
+#define	PANIC_CURRENT_THREAD(c,r)	User::Panic(c, r)
+#define	MEM_COMPARE_16				Mem::Compare
+#define __KERNEL_CHECK_RADIX(r)
+#define	APPEND_BUF_SIZE				32
+#define	APPEND_BUF_SIZE_64			64
+#define	HEAP_PANIC(r)				Panic(r)
+#define	GET_PAGE_SIZE(x)			UserHal::PageSizeInBytes(x)
+#define	DIVISION_BY_ZERO()			User::RaiseException(EExcIntegerDivideByZero)
+#define	__CHECK_THREAD_STATE
+
+#endif	// __KERNEL_MODE__
+
+#endif
--- a/webengine/osswebengine/MemoryManager/Src/FastAllocator.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Src/FastAllocator.cpp	Fri May 08 08:25:06 2009 +0300
@@ -15,13 +15,126 @@
 *
 *
 */
+
 #include "FastAllocator.h"
 #include "MemoryManager.h"
 #include "MemoryPool.h"
+#include <e32std.h>
+#include <e32debug.h>
 
+
+#ifdef TRACK_ALLOCATIONS
+TAny* GetClientPtrFromRealPtr(TAny* aRealPtr)
+	{
+	return (TAny*)(((TUint8*)aRealPtr) + sizeof(THeapTrace));
+	}
+TAny* GetRealPtrFromClientPtr(TAny* aClientPtr)
+	{
+	return (TAny*)(((TUint8*)aClientPtr) - sizeof(THeapTrace));
+	}
+
+void IncreaseSizeInPlace(TInt& aSize)
+	{
+	aSize += sizeof(THeapTrace);
+	}
+void DecreaseSizeInPlace(TInt& aSize)
+	{
+	aSize -= sizeof(THeapTrace);
+	}
+
+TInt GetSizeFromRealPtr(TAny* aRealPtr)
+	{
+	return ((THeapTrace*)aRealPtr)->requestedSize;
+	}
+
+void SetSizeWithRealPtr(TAny *aRealPtr, TInt aSize)
+	{
+	((THeapTrace*)aRealPtr)->requestedSize = aSize;
+	}
+
+TUint32 GetCellIdWithRealPtr(TAny* aRealPtr)
+	{
+	return((THeapTrace*)aRealPtr)->cellId;
+	}
+
+void SetCellIdWithRealPtr(TAny* aRealPtr, TUint32 aCellId)
+	{
+	((THeapTrace*)aRealPtr)->cellId = aCellId;
+	}
+void IncrementAndSetCellIdWithRealPtr(TAny* aRealPtr, TUint32* aCellId)
+	{
+	((THeapTrace*)aRealPtr)->cellId = (*aCellId)++;
+	}
+
+
+TAny* TraceAlloc(CMemoryPool* aPool, TInt* aSize, TUint32* aCellId)
+	{
+	// add space at the start of the data area for a TInt tracking requested size
+	TInt requestedSize = *aSize;
+	IncreaseSizeInPlace(*aSize);
+	TAny *ptr = aPool->Allocate( *aSize );
+    SetSizeWithRealPtr(ptr, requestedSize);
+    IncrementAndSetCellIdWithRealPtr(ptr, aCellId);
+    
+    RDebug::Print(_L("MEM: a,%d,,%d"), GetCellIdWithRealPtr(ptr), requestedSize);
+	
+    // somewhere to add a debugger to catch every 1024 allocations
+    if((*aCellId & 0x0FFF) == 0)
+    	{
+    	aCellId = aCellId;
+    	}
+    
+    return GetClientPtrFromRealPtr(ptr);
+	}
+
+void TraceFree(TAny **aPtr)
+	{
+	if(aPtr && *aPtr)
+		{
+		*aPtr = GetRealPtrFromClientPtr(*aPtr);
+	    RDebug::Print(_L("MEM: f,%d,%d,"), GetCellIdWithRealPtr(*aPtr), GetSizeFromRealPtr(*aPtr));
+		}
+	}
+
+TBool TracePreRealloc(TAny** aPtr, TInt *aSize, TUint32& aOriginalCellId)
+	{
+	TInt requestedSize = *aSize;
+	TBool issueNewCellId = EFalse;
+	aOriginalCellId=0;
+	if(aPtr && *aPtr)
+		{
+		*aPtr = GetRealPtrFromClientPtr(*aPtr);
+		aOriginalCellId = GetCellIdWithRealPtr(*aPtr);
+	    RDebug::Print(_L("MEM: r,%d,%d,%d"), GetCellIdWithRealPtr(*aPtr), GetSizeFromRealPtr(*aPtr), requestedSize);
+		}
+	else
+		{
+		issueNewCellId = ETrue;
+		}
+	IncreaseSizeInPlace(*aSize);
+	
+	return issueNewCellId;
+	}
+
+void TracePostRealloc(TAny** p, TInt aRequestedSize, TUint32* aNewCellId, TUint32 aOriginalCellId, TBool aIssueNewCellId)
+	{
+    if(p && *p)
+    	{
+    	SetSizeWithRealPtr(*p, aRequestedSize);
+    	if(aIssueNewCellId)
+    		IncrementAndSetCellIdWithRealPtr(*p, aNewCellId);
+    	else
+    		SetCellIdWithRealPtr(*p, aOriginalCellId);
+    	*p = GetClientPtrFromRealPtr(*p);
+    	}
+	}
+#endif
 EXPORT_C RFastAllocator::RFastAllocator(CFastMemoryPool* aPool) : iHeap( User::Heap() ), iPool( aPool )
 {
     iHeapBase = (TUint32)iHeap.Base() & 0xffff0000;
+#ifdef TRACK_ALLOCATIONS
+    iNextCellId = 0;
+#endif
 }
 
 EXPORT_C RFastAllocator::~RFastAllocator()
@@ -31,11 +144,18 @@
 
 EXPORT_C TAny* RFastAllocator::Alloc(TInt aSize)
 {
+#ifdef TRACK_ALLOCATIONS
+	return TraceAlloc(iPool, &aSize, &iNextCellId);
+#else
     return iPool->Allocate( aSize );
+#endif
 }
 
 EXPORT_C void RFastAllocator::Free(TAny* aPtr)
 {
+#ifdef TRACK_ALLOCATIONS
+	TraceFree(&aPtr);
+#endif	
     // make sure we go to the right memory pool
     if( IsLocatedInHeap( aPtr ) )
         iHeap.Free( aPtr );
@@ -45,6 +165,10 @@
 
 EXPORT_C TAny* RFastAllocator::ReAlloc(TAny* aPtr, TInt aSize, TInt aMode)
 {
+#ifdef TRACK_ALLOCATIONS
+	TUint32 originalCellId;
+	TBool issueNewCellId = TracePreRealloc(&aPtr, &aSize, originalCellId);
+#endif
     TAny* p(NULL);
     TInt originalSize(0);
     
@@ -75,13 +199,23 @@
         Free(p);
         return NULL;
         }
-
+#ifdef TRACK_ALLOCATIONS
+    TracePostRealloc(&p, aSize, &iNextCellId, originalCellId, issueNewCellId);
+#endif
     return p;
 }
 
 EXPORT_C TInt RFastAllocator::AllocLen(const TAny* aCell) const
 {
+#ifdef TRACK_ALLOCATIONS
+	if(aCell)
+		aCell = GetRealPtrFromClientPtr((TAny*)aCell);
+	TInt size = iPool->MemorySize( (void*)(aCell) );
+	DecreaseSizeInPlace(size);
+	return size;
+#else
     return iPool->MemorySize( (void*)(aCell) );
+#endif
 }
 
 EXPORT_C TInt RFastAllocator::Compress()
--- a/webengine/osswebengine/MemoryManager/Src/MemoryManager.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Src/MemoryManager.cpp	Fri May 08 08:25:06 2009 +0300
@@ -53,10 +53,17 @@
     {
     // create the right memory pool
     __ASSERT_DEBUG( s_pool == 0, User::Panic( KMemManPanicDes, 0 ) );
+#ifdef __NEW_ALLOCATOR__
+    s_pool = new CNewSymbianHeapPool();
+    s_pool->Create();
+    RSymbianDlAllocatorWrapper* allocator = new RSymbianDlAllocatorWrapper((CNewSymbianHeapPool*)s_pool);
+    return User::SwitchAllocator( allocator );
+#else
     s_pool = new CFastMemoryPool();
     s_pool->Create();
     RFastAllocator* allocator = new RFastAllocator((CFastMemoryPool*)s_pool);
     return User::SwitchAllocator( allocator );
+#endif
     }
 
 //-----------------------------------------------------------------------------
@@ -64,8 +71,13 @@
 //-----------------------------------------------------------------------------
 EXPORT_C void MemoryManager::CloseFastAllocator(RAllocator* aDefaultAllocator)
     {
+#ifdef __NEW_ALLOCATOR__
+    RAllocator* allocator = User::SwitchAllocator( aDefaultAllocator );
+    delete (RSymbianDlAllocatorWrapper*)(allocator);
+#else
     RAllocator* allocator = User::SwitchAllocator( aDefaultAllocator );
     delete (RFastAllocator*)(allocator);
+#endif
     }
 
 //-----------------------------------------------------------------------------
--- a/webengine/osswebengine/MemoryManager/Src/MemoryPool.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Src/MemoryPool.cpp	Fri May 08 08:25:06 2009 +0300
@@ -25,7 +25,9 @@
 #include "MemoryPool.h"
 #include "StopScheduler.h"
 #include "fast_malloc.h"
+#include "SymbianDlHeap.h"
 #include <OOMMonitorSession.h>
+#include <hal.h>
 
 // CONSTANTS
 
@@ -390,11 +392,29 @@
     // avoid small checkings
     if( aTotalSize < 1024 ) return ETrue;
 
+	// first check the application heap's max free block
+	TInt maxFreeBlock = 0;
+	User::Allocator().Available(maxFreeBlock);
+	if (aTotalSize < maxFreeBlock)
+		return ETrue;
+	
+
     // free memory in Hal
     TMemoryInfoV1Buf info;
     UserHal::MemoryInfo( info );
     TInt sizeNeeded = aTotalSize + iRescueBufferSize;
-    if( sizeNeeded > info().iFreeRamInBytes )
+
+	// check if there is enough space for the heap to grow
+	bool needSysCheck = EFalse;
+	if (info().iFreeRamInBytes > sizeNeeded) {
+		RHeap& heap = User::Heap();
+		if (heap.MaxLength() - heap.Size() > sizeNeeded)
+			return ETrue;
+
+		needSysCheck = ETrue;
+	}
+
+	if(sizeNeeded > info().iFreeRamInBytes || needSysCheck)
         {
         CollectMemory(sizeNeeded);
         
@@ -425,4 +445,215 @@
     // do nothing here.
     }
 
+#ifdef __NEW_ALLOCATOR__
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::FreeMemory
+//-----------------------------------------------------------------------------
+TUint CNewSymbianHeapPool::FreeMemory(TFreeMem& /*aFree*/ )
+    {
+    // TODO: implement free_memory
+    return KMaxTUint;
+//    return free_memory( aFree.iPool, aFree.iHeap, aFree.iHal );
+    }
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::DoAlloc
+//-----------------------------------------------------------------------------
+TAny* CNewSymbianHeapPool::DoAlloc( TUint aSize )
+    {
+    return iAlloc->Alloc( aSize );
+    }
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::ReAllocate
+//-----------------------------------------------------------------------------
+TAny* CNewSymbianHeapPool::ReAllocate( TAny* aPtr, TUint aSize )
+    {
+    // reset the status for next allocation
+    iMemStatus &= ~ERescueOOM;
+
+    TAny* p = iAlloc->ReAlloc( aPtr, aSize );
+    
+    // check memory manager status
+    if( !p || iMemStatus & ERescueOOM )
+        {
+        if( !iIsCollecting )
+            {
+            CollectMemory();
+            }
+
+        if( !p )
+			p = iAlloc->ReAlloc( aPtr, aSize );
+
+        NotifyAndStop();
+        }
+
+    return p;
+    }
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::PreCheck
+//-----------------------------------------------------------------------------
+TBool CNewSymbianHeapPool::PreCheck(TUint aTotalSize, TUint aMaxBufSize,
+		const TDesC8& /*aCheckerName*/)
+	{
+	/* aTotalSize - total amount desired
+	 * aMaxBufSize - largest single allocation desired
+	 */
+
+	// avoid small checkings
+	if (aTotalSize < 1024)
+		return ETrue;
+
+	/*
+	 * Browser fast_malloc implementation merges together total/max allocation requests and says YES if system free memory is >6MB
+	 */
+	// mirror existing size calculation
+	aTotalSize = aTotalSize > (aMaxBufSize * 2) ? aTotalSize
+			: (aMaxBufSize * 2);
+
+	// if we have more than 6 MB of free mem, we 
+	// should skip malloc_info call.
+	// free memory in Hal
+    TInt systemFreeMemory = 0;
+	if( HAL::Get(HALData::EMemoryRAMFree, systemFreeMemory) == KErrNone )
+		{
+		const TUint checkThreshold = 6*1024*1024;
+		if(systemFreeMemory> checkThreshold && systemFreeMemory> aTotalSize)
+		return ETrue;
+		}
+
+	/* For a proper implementation of RHeap, the stats available are:
+	 * AllocSize	Total number of allocated bytes
+	 * Size			Total number of bytes held from system
+	 * Available	Max block size and amount of bytes held but not allocated
+	 */
+	/* We don't have those bits of the heap implemented yet
+	 */ 
+	TInt freeSpace = 0; // be conservative, use 0 intead of 64<<10;
+	TInt req = freeSpace + systemFreeMemory - aTotalSize;	
+	
+	if(req > 0)
+		return ETrue;
+	
+	// First, ask system for memory from other applications.
+	ROomMonitorSession oomMs;
+	if (oomMs.Connect() == KErrNone)
+		{
+		oomMs.RequestFreeMemory(aTotalSize);
+		oomMs.Close();
+		}
+
+	// We haven't altered our heap yet, so ask the system how much is free now...
+	HAL::Get(HALData::EMemoryRAMFree, systemFreeMemory);
+	req = freeSpace + systemFreeMemory - aTotalSize;	
+	
+	if(req > 0)
+		return ETrue;
+	
+	// We haven't got the required amount free yet, try the browser heap.
+	CollectMemory(aTotalSize);
+	// ask the system how much is free now...
+	HAL::Get(HALData::EMemoryRAMFree, systemFreeMemory);
+	req = freeSpace + systemFreeMemory - aTotalSize;	
+	
+	// if we still haven't got enough RAM, we should stop the browser from going any further just yet.
+	if (req < 0)
+		{
+		iMemStatus |= ECheckOOM;
+		NotifyAndStop();
+		return EFalse;
+		}
+	
+	return ETrue;
+	}
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::PostCheck
+//-----------------------------------------------------------------------------
+TUint CNewSymbianHeapPool::PostCheck()
+    {
+    return iMemStatus;
+    }
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::Free
+//-----------------------------------------------------------------------------
+void CNewSymbianHeapPool::Free( TAny* aPtr )
+    {
+    return iAlloc->Free( aPtr );
+    }
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::MemorySize
+//-----------------------------------------------------------------------------
+TUint CNewSymbianHeapPool::MemorySize( TAny* aPtr )
+    {
+    return iAlloc->AllocLen( aPtr );
+    }
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::SetRescueBufferSize
+//-----------------------------------------------------------------------------
+void CNewSymbianHeapPool::SetRescueBufferSize( TInt /*aSize*/ )
+    {
+    //fast_set_rescue_buffer_size( aSize );
+    }
+
+//-----------------------------------------------------------------------------
+// CNewSymbianHeapPool::RestoreRescueBuffer
+//-----------------------------------------------------------------------------
+void CNewSymbianHeapPool::RestoreRescueBuffer()
+    {
+    //alloc_rescue_buffer();
+    }
+
+CNewSymbianHeapPool::CNewSymbianHeapPool() : CMemoryPool()
+	{
+	}
+
+CNewSymbianHeapPool::~CNewSymbianHeapPool()
+	{
+//	iAlloc->Close();	// TODO: Need to clean up here, but it's not implemented in the allocator yet.
+						// Not fatal anyway because all the handles are process local and we should only
+						// be deleting this object when we're closing the allocator - which we never do
+						// except at process end.
+	}
+
+const TInt KMaxHeapSize = 0x2000000; //32MB
+const TInt KHeapGrowSize = 0x10000;  //64KB
+
+TBool CNewSymbianHeapPool::Create()
+	{
+	// need to know system page size
+	TInt page_size;
+	UserHal::PageSizeInBytes(page_size);
+
+	// Create the thread's heap chunk.
+	//
+	// The chunk needs reserve enough address space for twice the maximum allocation
+	// The heap object is instantiated exactly half way up the chunk, and initially is provided just 1 page of memory
+	// This memory can be committed as part of the call to creat the chunk
+	//
+	TInt maxChunkSize = 2 * KMaxHeapSize;
+	TInt offset = KMaxHeapSize;
+	TInt minLength = page_size;
+	RChunk c;
+	TInt r = c.CreateDisconnectedLocal(offset, offset+minLength, maxChunkSize, EOwnerProcess);
+	if (r!=KErrNone)
+		return EFalse;
+	
+	iAlloc = new (c.Base() + offset) RSymbianDLHeap(c.Handle(), offset, minLength, KMaxHeapSize, KHeapGrowSize, 8, EFalse /* not single threaded! */);
+	iAlloc->iHandles = &iAlloc->iChunkHandle;
+	iAlloc->iHandleCount = 2;
+	// chunk handle now 'owned' by iAlloc
+	r = iAlloc->iLock.CreateLocal(EOwnerProcess);
+
+	if(r != KErrNone)
+		return EFalse;
+	
+	return CMemoryPool::Create();
+	}
+
+#endif
 // END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/MemoryManager/Src/SymbianDLAllocatorWrapper.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*
+*/
+
+#include "FastAllocator.h"
+#include "MemoryManager.h"
+#include "MemoryPool.h"
+#include <e32std.h>
+#include <e32debug.h>
+
+RSymbianDlAllocatorWrapper::RSymbianDlAllocatorWrapper(CNewSymbianHeapPool* aPool) : iPool( aPool )
+{
+#ifdef TRACK_ALLOCATIONS
+	iNextCellId = 0;
+#endif
+}
+
+RSymbianDlAllocatorWrapper::~RSymbianDlAllocatorWrapper()
+{
+}
+
+TAny* RSymbianDlAllocatorWrapper::Alloc(TInt aSize)
+{
+#ifdef TRACK_ALLOCATIONS
+	return TraceAlloc(iPool, &aSize, &iNextCellId);
+#else
+    return iPool->Allocate( aSize );
+#endif
+}
+
+void RSymbianDlAllocatorWrapper::Free(TAny* aPtr)
+{
+#ifdef TRACK_ALLOCATIONS
+	TraceFree(&aPtr);
+#endif	
+	iPool->Free( aPtr );
+}
+
+TAny* RSymbianDlAllocatorWrapper::ReAlloc(TAny* aPtr, TInt aSize, TInt aMode)
+{
+#ifdef TRACK_ALLOCATIONS
+	TUint32 originalCellId;
+	TBool issueNewCellId = TracePreRealloc(&aPtr, &aSize, originalCellId);
+#endif
+	
+	TAny* p = iPool->ReAllocate( aPtr, aSize );
+
+    // Handle aMode.
+	// 0: default. Don't move on shrink, but can move if growing
+    // ENeverMove: Don't move memory on realloc, return NULL if it was moved.
+    // EAllowMoveOnShrink: Allow moving memory on realloc when size requested
+    //    is smaller, return NULL if moved and request size is greater (equal).
+	//
+	// This allocator only operates in mode 0 (for now), so we only have to check the stricter ENeverMove mode
+	//
+    if ( (aMode == ENeverMove && p != aPtr) )
+        {
+        Free(p);
+        return NULL;
+        }
+#ifdef TRACK_ALLOCATIONS
+    TracePostRealloc(&p, aSize, &iNextCellId, originalCellId, issueNewCellId);
+#endif
+    return p;
+}
+
+TInt RSymbianDlAllocatorWrapper::AllocLen(const TAny* aCell) const
+{
+#ifdef TRACK_ALLOCATIONS
+	if(aCell)
+		aCell = GetRealPtrFromClientPtr((TAny*)aCell);
+	TInt size = iPool->MemorySize( (void*)(aCell) );
+	DecreaseSizeInPlace(size);
+	return size;
+#else
+	return iPool->MemorySize( (void*)(aCell) );
+#endif
+}
+
+TInt RSymbianDlAllocatorWrapper::Compress()
+{
+    // DO NOTHING
+    return 0;
+}
+
+void RSymbianDlAllocatorWrapper::Reset()
+{
+    // DO NOTHING
+}
+
+TInt RSymbianDlAllocatorWrapper::AllocSize(TInt& aTotalAllocSize) const
+{
+    // allocated cell size
+    aTotalAllocSize = 0;
+    return 0;
+}
+
+TInt RSymbianDlAllocatorWrapper::Available(TInt& aBiggestBlock) const
+{
+    // make sure the caller is not scared of futher allocation
+    aBiggestBlock = KMaxTInt;
+    return KMaxTUint;
+}
+
+TInt RSymbianDlAllocatorWrapper::DebugFunction(TInt, TAny*, TAny*)
+{
+    return 0;
+}
+
+TInt RSymbianDlAllocatorWrapper::Extension_(TUint, TAny*&, TAny*)
+{
+    return 0;
+}
+
+// END OF FILE
--- a/webengine/osswebengine/MemoryManager/Src/fast_malloc.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/MemoryManager/Src/fast_malloc.cpp	Fri May 08 08:25:06 2009 +0300
@@ -1,3 +1,20 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*
+*/
 /*
   This is a version (aka dlmalloc) of malloc/free/realloc written by
   Doug Lea and released to the public domain, as explained at
@@ -4976,6 +4993,11 @@
     return oldmark;
 }
 
+#ifdef TRACE_CHUNK_USAGE
+void TraceChunkUsage(TInt aChunkHandle, TUint8* aBase, TInt aChunkSize);
+#else
+#define TraceChunkUsage(a,b,c)
+#endif
 void* symbian_mmap(size_t size)
 {
     size_t addr = (size_t)watermark;
@@ -5023,6 +5045,7 @@
     else
         oldmark = (void*)addr;
 
+    TraceChunkUsage(rchunk.Handle(),rchunk.Base(),rchunk.Size());
     MEM_LOGF( _L8("chunk size: %d"), rchunk.Size());
     return oldmark;
 }
@@ -5067,7 +5090,7 @@
                     // all three cells are adjacent
                     if (p->ptr + p->size == e->ptr) {
                         p->size += e->size;
-                        p->next = 0;
+                        p->next = e->next;
                         free(e);
                     }
                 } else if (cell->ptr + cell->size == e->ptr) {
@@ -5093,6 +5116,7 @@
         }
     }
 
+    TraceChunkUsage(rchunk.Handle(),rchunk.Base(),rchunk.Size());
     MEM_LOGF( _L8("chunk size: %d"), rchunk.Size());
     return 0;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/webengine/osswebengine/MemoryManager/Src/heap.cpp	Fri May 08 08:25:06 2009 +0300
@@ -0,0 +1,2270 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*
+*/
+
+#include "common.h"
+
+#ifdef TRACE_CHUNK_USAGE
+void TraceChunkUsage(TInt aChunkHandle, TUint8* aBase, TInt aChunkSize)
+	{
+	RDebug::Print(_L("MEM: c,%d,%d,%d"), aChunkHandle, aBase, aChunkSize);
+	}
+#else
+#define TraceChunkUsage(a,b,c)
+#endif
+
+#ifdef __NEW_ALLOCATOR__
+
+#include "SymbianDLHeap.h"
+
+_LIT(KDLHeapPanicCategory, "DL Heap");
+#define	GET_PAGE_SIZE(x)			UserHal::PageSizeInBytes(x)
+#define	__CHECK_CELL(p)
+#define __POWER_OF_2(x)				((TUint32)((x)^((x)-1))>=(TUint32)(x))
+
+#define gm  (&iGlobalMallocState)
+
+void Panic(TCdtPanic aPanic)
+	{
+	User::Panic(KDLHeapPanicCategory, aPanic);
+	}
+
+#undef UEXPORT_C
+#define UEXPORT_C 
+
+UEXPORT_C RSymbianDLHeap::RSymbianDLHeap(TInt aMaxLength, TInt aAlign, TBool aSingleThread)
+// constructor for a fixed heap. Just use DL allocator
+	:iMinLength(aMaxLength), iMaxLength(aMaxLength), iOffset(0), iGrowBy(0), iChunkHandle(0),
+	iNestingLevel(0), iAllocCount(0), iFailType(ENone), iTestData(NULL), iChunkSize(aMaxLength)
+	{
+
+	// bodge so GKIServ (hudson generic low level layer) starts up ok - it uses an aAlign of 0 which panics, so if see 0 then force to 4
+	if ((TUint32)aAlign>=sizeof(TAny*) && __POWER_OF_2(iAlign))
+		{
+		iAlign = aAlign;
+		}
+	else
+		{
+		iAlign = 4;
+		}
+	iPageSize = 0;
+	iFlags = aSingleThread ? (ESingleThreaded|EFixedSize) : EFixedSize;
+
+	Init(0, 0, 0);
+	}
+
+UEXPORT_C RSymbianDLHeap::RSymbianDLHeap(TInt aChunkHandle, TInt aOffset, TInt aMinLength, TInt aMaxLength, TInt aGrowBy,
+			TInt aAlign, TBool aSingleThread)
+		: iMinLength(aMinLength), iMaxLength(aMaxLength), iOffset(aOffset), iChunkHandle(aChunkHandle), iNestingLevel(0), iAllocCount(0),
+			iAlign(aAlign),iFailType(ENone), iTestData(NULL), iChunkSize(aMinLength)
+	{
+	// TODO: Locked the page size to 4 KB - change this to pick up from the OS
+	GET_PAGE_SIZE(iPageSize);
+	__ASSERT_ALWAYS(aOffset >=0, User::Panic(KDLHeapPanicCategory, ETHeapNewBadOffset));
+	iGrowBy = _ALIGN_UP(aGrowBy, iPageSize);
+	iFlags = aSingleThread ? ESingleThreaded : 0;
+
+	// Initialise
+	// if the heap is created with aMinLength==aMaxLength then it cannot allocate slab or page memory
+	// so these sub-allocators should be disabled. Otherwise initialise with default values
+	if (aMinLength == aMaxLength)
+		Init(0, 0, 0);
+	else
+		Init(0x3fff, 16, 0x10000);	// all slabs, page {64KB}, trim {64KB}
+//		Init(0xabe, 16, iPageSize*4);	// slabs {48, 40, 32, 24, 20, 16, 12}, page {64KB}, trim {16KB}
+	}
+
+UEXPORT_C TAny* RSymbianDLHeap::operator new(TUint aSize, TAny* aBase) __NO_THROW
+	{
+	__ASSERT_ALWAYS(aSize>=sizeof(RSymbianDLHeap), HEAP_PANIC(ETHeapNewBadSize));
+	RSymbianDLHeap* h = (RSymbianDLHeap*)aBase;
+	h->iAlign = 0x80000000;	// garbage value
+	h->iBase = ((TUint8*)aBase) + aSize;
+	return aBase;
+	}
+
+void RSymbianDLHeap::Init(TInt aBitmapSlab, TInt aPagePower, size_t aTrimThreshold)
+	{
+	__ASSERT_ALWAYS((TUint32)iAlign>=sizeof(TAny*) && __POWER_OF_2(iAlign), HEAP_PANIC(ETHeapNewBadAlignment));
+
+	/*Moved code which does iunitilization */
+	iTop = (TUint8*)this + iMinLength;
+	spare_page = 0;
+	memset(&mparams,0,sizeof(mparams));
+
+	Init_Dlmalloc(iTop - iBase, 0, aTrimThreshold);
+
+	slab_init(aBitmapSlab);
+
+	/*10-1K,11-2K,12-4k,13-8K,14-16K,15-32K,16-64K*/
+	paged_init(aPagePower);
+	}
+
+UEXPORT_C RSymbianDLHeap::SCell* RSymbianDLHeap::GetAddress(const TAny* aCell) const
+//
+// As much as possible, check a cell address and backspace it
+// to point at the cell header.
+//
+	{
+
+	TLinAddr m = TLinAddr(iAlign - 1);
+	__ASSERT_ALWAYS(!(TLinAddr(aCell)&m), HEAP_PANIC(ETHeapBadCellAddress));
+
+	SCell* pC = (SCell*)(((TUint8*)aCell)-EAllocCellSize);
+	__CHECK_CELL(pC);
+
+	return pC;
+	}
+
+UEXPORT_C TInt RSymbianDLHeap::AllocLen(const TAny* aCell) const
+{
+	if (ptrdiff(aCell, this) >= 0)
+	{
+		mchunkptr m = mem2chunk(aCell);
+		return chunksize(m) - CHUNK_OVERHEAD;
+	}
+	if (lowbits(aCell, pagesize) > cellalign)
+		return header_size(slab::slabfor(aCell)->header);
+	if (lowbits(aCell, pagesize) == cellalign)
+		return *(unsigned*)(offset(aCell,-int(cellalign)))-cellalign;
+	return paged_descriptor(aCell)->size;
+}
+
+UEXPORT_C TAny* RSymbianDLHeap::Alloc(TInt aSize)
+{
+	__ASSERT_ALWAYS((TUint)aSize<(KMaxTInt/2),HEAP_PANIC(ETHeapBadAllocatedCellSize));
+
+	TAny* addr;
+
+	Lock();
+	if (aSize < slab_threshold)
+	{
+		TInt ix = sizemap[(aSize+3)>>2];
+		ASSERT(ix != 0xff);
+		addr = slab_allocate(slaballoc[ix]);
+	}else if((aSize >> page_threshold)==0)
+		{
+		addr = dlmalloc(aSize);
+		}
+	else
+		{
+		addr = paged_allocate(aSize);
+		}
+
+	Unlock();
+
+	return addr;
+}
+
+UEXPORT_C TInt RSymbianDLHeap::Compress()
+	{
+	if (iFlags & EFixedSize)
+		return 0;
+
+	Lock();
+	dlmalloc_trim(0);
+	if (spare_page)
+	{
+		unmap(spare_page, pagesize);
+		spare_page = 0;
+	}
+	Unlock();
+	return 0;
+	}
+
+UEXPORT_C void RSymbianDLHeap::Free(TAny* aPtr)
+{
+
+	Lock();
+
+	if (!aPtr)
+		;
+	else if (ptrdiff(aPtr, this) >= 0)
+		{
+		dlfree( aPtr);
+		}
+	else if (lowbits(aPtr, pagesize) <= cellalign)
+		{
+		paged_free(aPtr);
+		}
+	else
+		{
+		slab_free(aPtr);
+		}
+	Unlock();
+}
+
+
+UEXPORT_C void RSymbianDLHeap::Reset()
+	{
+	// TODO free everything
+	}
+
+UEXPORT_C TAny* RSymbianDLHeap::ReAlloc(TAny* aPtr, TInt aSize, TInt /*aMode = 0*/)
+//
+// Support aMode==0 properly: do not move the cell if the request is smaller than old size
+//
+	{
+	if(ptrdiff(aPtr,this)>=0)
+	{
+		// original cell is in DL zone
+		if((aSize>>page_threshold)==0 || aSize <= chunksize(mem2chunk(aPtr)) - CHUNK_OVERHEAD)
+			{
+			// new one is below page limit or smaller than old one (so can't be moved)
+			Lock();
+			TAny* addr = dlrealloc(aPtr,aSize);
+			Unlock();
+			return addr;
+			}
+	}
+	else if(lowbits(aPtr,pagesize)<=cellalign)
+	{
+		// original cell is either NULL or in paged zone
+		if (!aPtr)
+			return Alloc(aSize);
+
+		// either the new size is larger (in which case it will still be in paged zone)
+		// or it is smaller, but we will never move a shrinking cell so in paged zone
+		// must handle [rare] case that aSize == 0, as paged_[re]allocate() will panic
+		if (aSize == 0)
+			aSize = 1;
+		Lock();
+		TAny* addr = paged_reallocate(aPtr,aSize);
+		Unlock();
+		return addr;
+	}
+	else
+	{
+		// original cell is in slab zone
+		// return original if new one smaller
+		if(aSize <= header_size(slab::slabfor(aPtr)->header))
+			return aPtr;
+	}
+	// can't do better than allocate/copy/free
+	TAny* newp = Alloc(aSize);
+	if(newp)
+	{
+		TInt oldsize = AllocLen(aPtr);
+		memcpy(newp,aPtr,oldsize<aSize?oldsize:aSize);
+		Free(aPtr);
+	}
+	return newp;
+	}
+
+UEXPORT_C TInt RSymbianDLHeap::Available(TInt& aBiggestBlock) const
+{
+	aBiggestBlock = 0;
+	return 1000;
+	/*Need to see how to implement this*/
+	// TODO: return iHeap.Available(aBiggestBlock);
+}
+UEXPORT_C TInt RSymbianDLHeap::AllocSize(TInt& aTotalAllocSize) const
+{
+	aTotalAllocSize = 0;
+	return 0;
+}
+
+UEXPORT_C TInt RSymbianDLHeap::DebugFunction(TInt /*aFunc*/, TAny* /*a1*/, TAny* /*a2*/)
+	{
+	return 0;
+	}
+UEXPORT_C TInt RSymbianDLHeap::Extension_(TUint /* aExtensionId */, TAny*& /* a0 */, TAny* /* a1 */)
+	{
+	return KErrNotSupported;
+	}
+
+long    sysconf		(int size )
+	{
+	if (UserHal::PageSizeInBytes(size)!=KErrNone)
+		size = 0x1000;
+	return size;
+	}
+
+
+///////////////////////////////////////////////////////////////////////////////
+// imported from dla.cpp
+///////////////////////////////////////////////////////////////////////////////
+
+//#include <unistd.h>
+//#define DEBUG_REALLOC
+#ifdef DEBUG_REALLOC
+#include <e32debug.h>
+#endif
+inline int RSymbianDLHeap::init_mparams(size_t aTrimThreshold /*= DEFAULT_TRIM_THRESHOLD*/)
+{
+	if (mparams.page_size == 0)
+	{
+		size_t s;
+		mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD;
+		mparams.trim_threshold = aTrimThreshold;
+		#if MORECORE_CONTIGUOUS
+			mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT;
+		#else  /* MORECORE_CONTIGUOUS */
+			mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT;
+		#endif /* MORECORE_CONTIGUOUS */
+
+			s = (size_t)0x58585858U;
+		ACQUIRE_MAGIC_INIT_LOCK(&mparams);
+		if (mparams.magic == 0) {
+		  mparams.magic = s;
+		  /* Set up lock for main malloc area */
+		  INITIAL_LOCK(&gm->mutex);
+		  gm->mflags = mparams.default_mflags;
+		}
+		RELEASE_MAGIC_INIT_LOCK(&mparams);
+
+		// DAN replaced
+		// mparams.page_size = malloc_getpagesize;
+		int temp = 0;
+		GET_PAGE_SIZE(temp);
+		mparams.page_size = temp;
+
+		mparams.granularity = ((DEFAULT_GRANULARITY != 0)?
+							   DEFAULT_GRANULARITY : mparams.page_size);
+
+		/* Sanity-check configuration:
+		   size_t must be unsigned and as wide as pointer type.
+		   ints must be at least 4 bytes.
+		   alignment must be at least 8.
+		   Alignment, min chunk size, and page size must all be powers of 2.
+		*/
+
+		if ((sizeof(size_t) != sizeof(TUint8*)) ||
+			(MAX_SIZE_T < MIN_CHUNK_SIZE)  ||
+			(sizeof(int) < 4)  ||
+			(MALLOC_ALIGNMENT < (size_t)8U) ||
+			((MALLOC_ALIGNMENT    & (MALLOC_ALIGNMENT-SIZE_T_ONE))    != 0) ||
+			((MCHUNK_SIZE         & (MCHUNK_SIZE-SIZE_T_ONE))         != 0) ||
+			((mparams.granularity & (mparams.granularity-SIZE_T_ONE)) != 0) ||
+			((mparams.page_size   & (mparams.page_size-SIZE_T_ONE))   != 0))
+		  ABORT;
+	}
+	return 0;
+}
+
+inline void RSymbianDLHeap::init_bins(mstate m) {
+  /* Establish circular links for smallbins */
+  bindex_t i;
+  for (i = 0; i < NSMALLBINS; ++i) {
+    sbinptr bin = smallbin_at(m,i);
+    bin->fd = bin->bk = bin;
+  }
+}
+/* ---------------------------- malloc support --------------------------- */
+
+/* allocate a large request from the best fitting chunk in a treebin */
+void* RSymbianDLHeap::tmalloc_large(mstate m, size_t nb) {
+  tchunkptr v = 0;
+  size_t rsize = -nb; /* Unsigned negation */
+  tchunkptr t;
+  bindex_t idx;
+  compute_tree_index(nb, idx);
+
+  if ((t = *treebin_at(m, idx)) != 0) {
+    /* Traverse tree for this bin looking for node with size == nb */
+    size_t sizebits =
+    nb <<
+    leftshift_for_tree_index(idx);
+    tchunkptr rst = 0;  /* The deepest untaken right subtree */
+    for (;;) {
+      tchunkptr rt;
+      size_t trem = chunksize(t) - nb;
+      if (trem < rsize) {
+        v = t;
+        if ((rsize = trem) == 0)
+          break;
+      }
+      rt = t->child[1];
+      t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1];
+      if (rt != 0 && rt != t)
+        rst = rt;
+      if (t == 0) {
+        t = rst; /* set t to least subtree holding sizes > nb */
+        break;
+      }
+      sizebits <<= 1;
+    }
+  }
+  if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */
+    binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap;
+    if (leftbits != 0) {
+      bindex_t i;
+      binmap_t leastbit = least_bit(leftbits);
+      compute_bit2idx(leastbit, i);
+      t = *treebin_at(m, i);
+    }
+  }
+  while (t != 0) { /* find smallest of tree or subtree */
+    size_t trem = chunksize(t) - nb;
+    if (trem < rsize) {
+      rsize = trem;
+      v = t;
+    }
+    t = leftmost_child(t);
+  }
+  /*  If dv is a better fit, return 0 so malloc will use it */
+  if (v != 0 && rsize < (size_t)(m->dvsize - nb)) {
+    if (RTCHECK(ok_address(m, v))) { /* split */
+      mchunkptr r = chunk_plus_offset(v, nb);
+      assert(chunksize(v) == rsize + nb);
+      if (RTCHECK(ok_next(v, r))) {
+        unlink_large_chunk(m, v);
+        if (rsize < MIN_CHUNK_SIZE)
+          set_inuse_and_pinuse(m, v, (rsize + nb));
+        else {
+          set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+          set_size_and_pinuse_of_free_chunk(r, rsize);
+          insert_chunk(m, r, rsize);
+        }
+        return chunk2mem(v);
+      }
+    }
+    CORRUPTION_ERROR_ACTION(m);
+  }
+  return 0;
+}
+
+/* allocate a small request from the best fitting chunk in a treebin */
+void* RSymbianDLHeap::tmalloc_small(mstate m, size_t nb) {
+  tchunkptr t, v;
+  size_t rsize;
+  bindex_t i;
+  binmap_t leastbit = least_bit(m->treemap);
+  compute_bit2idx(leastbit, i);
+
+  v = t = *treebin_at(m, i);
+  rsize = chunksize(t) - nb;
+
+  while ((t = leftmost_child(t)) != 0) {
+    size_t trem = chunksize(t) - nb;
+    if (trem < rsize) {
+      rsize = trem;
+      v = t;
+    }
+  }
+
+  if (RTCHECK(ok_address(m, v))) {
+    mchunkptr r = chunk_plus_offset(v, nb);
+    assert(chunksize(v) == rsize + nb);
+    if (RTCHECK(ok_next(v, r))) {
+      unlink_large_chunk(m, v);
+      if (rsize < MIN_CHUNK_SIZE)
+        set_inuse_and_pinuse(m, v, (rsize + nb));
+      else {
+        set_size_and_pinuse_of_inuse_chunk(m, v, nb);
+        set_size_and_pinuse_of_free_chunk(r, rsize);
+        replace_dv(m, r, rsize);
+      }
+      return chunk2mem(v);
+    }
+  }
+  CORRUPTION_ERROR_ACTION(m);
+  return 0;
+}
+
+inline void RSymbianDLHeap::init_top(mstate m, mchunkptr p, size_t psize)
+{
+	/* Ensure alignment */
+	size_t offset = align_offset(chunk2mem(p));
+	p = (mchunkptr)((TUint8*)p + offset);
+	psize -= offset;
+	m->top = p;
+	m->topsize = psize;
+	p->head = psize | PINUSE_BIT;
+	/* set size of fake trailing chunk holding overhead space only once */
+	mchunkptr chunkPlusOff = chunk_plus_offset(p, psize);
+	chunkPlusOff->head = TOP_FOOT_SIZE;
+	m->trim_check = mparams.trim_threshold; /* reset on each update */
+}
+
+void* RSymbianDLHeap::internal_realloc(mstate m, void* oldmem, size_t bytes)
+{
+  if (bytes >= MAX_REQUEST) {
+    MALLOC_FAILURE_ACTION;
+    return 0;
+  }
+  if (!PREACTION(m)) {
+    mchunkptr oldp = mem2chunk(oldmem);
+    size_t oldsize = chunksize(oldp);
+    mchunkptr next = chunk_plus_offset(oldp, oldsize);
+    mchunkptr newp = 0;
+    void* extra = 0;
+
+    /* Try to either shrink or extend into top. Else malloc-copy-free */
+
+    if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) &&
+                ok_next(oldp, next) && ok_pinuse(next))) {
+      size_t nb = request2size(bytes);
+      if (is_mmapped(oldp))
+        newp = mmap_resize(m, oldp, nb);
+      else
+	  if (oldsize >= nb) { /* already big enough */
+        size_t rsize = oldsize - nb;
+        newp = oldp;
+        if (rsize >= MIN_CHUNK_SIZE) {
+          mchunkptr remainder = chunk_plus_offset(newp, nb);
+          set_inuse(m, newp, nb);
+          set_inuse(m, remainder, rsize);
+          extra = chunk2mem(remainder);
+        }
+      }
+		/*AMOD: Modified to optimized*/
+		else if (next == m->top && oldsize + m->topsize > nb)
+		{
+			/* Expand into top */
+			if(oldsize + m->topsize > nb)
+			{
+		        size_t newsize = oldsize + m->topsize;
+		        size_t newtopsize = newsize - nb;
+		        mchunkptr newtop = chunk_plus_offset(oldp, nb);
+		        set_inuse(m, oldp, nb);
+		        newtop->head = newtopsize |PINUSE_BIT;
+		        m->top = newtop;
+		        m->topsize = newtopsize;
+		        newp = oldp;
+			}
+      }
+    }
+    else {
+      USAGE_ERROR_ACTION(m, oldmem);
+      POSTACTION(m);
+      return 0;
+    }
+
+    POSTACTION(m);
+
+    if (newp != 0) {
+      if (extra != 0) {
+        internal_free(m, extra);
+      }
+      check_inuse_chunk(m, newp);
+      return chunk2mem(newp);
+    }
+    else {
+      void* newmem = internal_malloc(m, bytes);
+      if (newmem != 0) {
+        size_t oc = oldsize - overhead_for(oldp);
+        memcpy(newmem, oldmem, (oc < bytes)? oc : bytes);
+        internal_free(m, oldmem);
+      }
+      return newmem;
+    }
+  }
+  return 0;
+}
+/* ----------------------------- statistics ------------------------------ */
+mallinfo RSymbianDLHeap::internal_mallinfo(mstate m) {
+  struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+  TInt chunkCnt = 0;
+  if (!PREACTION(m)) {
+    check_malloc_state(m);
+    if (is_initialized(m)) {
+      size_t nfree = SIZE_T_ONE; /* top always free */
+      size_t mfree = m->topsize + TOP_FOOT_SIZE;
+      size_t sum = mfree;
+      msegmentptr s = &m->seg;
+      TInt tmp = (TUint8*)m->top - (TUint8*)s->base;
+      while (s != 0) {
+        mchunkptr q = align_as_chunk(s->base);
+        chunkCnt++;
+        while (segment_holds(s, q) &&
+               q != m->top && q->head != FENCEPOST_HEAD) {
+          size_t sz = chunksize(q);
+          sum += sz;
+          if (!cinuse(q)) {
+            mfree += sz;
+            ++nfree;
+          }
+          q = next_chunk(q);
+        }
+        s = s->next;
+      }
+      nm.arena    = sum;
+      nm.ordblks  = nfree;
+      nm.hblkhd   = m->footprint - sum;
+      nm.usmblks  = m->max_footprint;
+      nm.uordblks = m->footprint - mfree;
+      nm.fordblks = mfree;
+      nm.keepcost = m->topsize;
+      nm.cellCount= chunkCnt;/*number of chunks allocated*/
+    }
+    POSTACTION(m);
+  }
+  return nm;
+}
+
+void  RSymbianDLHeap::internal_malloc_stats(mstate m) {
+if (!PREACTION(m)) {
+  size_t maxfp = 0;
+  size_t fp = 0;
+  size_t used = 0;
+  check_malloc_state(m);
+  if (is_initialized(m)) {
+    msegmentptr s = &m->seg;
+    maxfp = m->max_footprint;
+    fp = m->footprint;
+    used = fp - (m->topsize + TOP_FOOT_SIZE);
+
+    while (s != 0) {
+      mchunkptr q = align_as_chunk(s->base);
+      while (segment_holds(s, q) &&
+             q != m->top && q->head != FENCEPOST_HEAD) {
+        if (!cinuse(q))
+          used -= chunksize(q);
+        q = next_chunk(q);
+      }
+      s = s->next;
+    }
+  }
+  POSTACTION(m);
+}
+}
+/* support for mallopt */
+int RSymbianDLHeap::change_mparam(int param_number, int value) {
+  size_t val = (size_t)value;
+  init_mparams(DEFAULT_TRIM_THRESHOLD);
+  switch(param_number) {
+  case M_TRIM_THRESHOLD:
+    mparams.trim_threshold = val;
+    return 1;
+  case M_GRANULARITY:
+    if (val >= mparams.page_size && ((val & (val-1)) == 0)) {
+      mparams.granularity = val;
+      return 1;
+    }
+    else
+      return 0;
+  case M_MMAP_THRESHOLD:
+    mparams.mmap_threshold = val;
+    return 1;
+  default:
+    return 0;
+  }
+}
+/* Get memory from system using MORECORE or MMAP */
+void* RSymbianDLHeap::sys_alloc(mstate m, size_t nb)
+{
+	TUint8* tbase = CMFAIL;
+	size_t tsize = 0;
+	flag_t mmap_flag = 0;
+	//init_mparams();/*No need to do init_params here*/
+	/* Directly map large chunks */
+	if (use_mmap(m) && nb >= mparams.mmap_threshold)
+	{
+		void* mem = mmap_alloc(m, nb);
+		if (mem != 0)
+			return mem;
+	}
+  /*
+    Try getting memory in any of three ways (in most-preferred to
+    least-preferred order):
+    1. A call to MORECORE that can normally contiguously extend memory.
+       (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or
+       or main space is mmapped or a previous contiguous call failed)
+    2. A call to MMAP new space (disabled if not HAVE_MMAP).
+       Note that under the default settings, if MORECORE is unable to
+       fulfill a request, and HAVE_MMAP is true, then mmap is
+       used as a noncontiguous system allocator. This is a useful backup
+       strategy for systems with holes in address spaces -- in this case
+       sbrk cannot contiguously expand the heap, but mmap may be able to
+       find space.
+    3. A call to MORECORE that cannot usually contiguously extend memory.
+       (disabled if not HAVE_MORECORE)
+  */
+  /*Trying to allocate the memory*/
+	if(MORECORE_CONTIGUOUS && !use_noncontiguous(m))
+	{
+	TUint8* br = CMFAIL;
+    msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (TUint8*)m->top);
+    size_t asize = 0;
+    ACQUIRE_MORECORE_LOCK(m);
+    if (ss == 0)
+	{  /* First time through or recovery */
+		TUint8* base = (TUint8*)CALL_MORECORE(0);
+		if (base != CMFAIL)
+		{
+			asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE);
+			/* Adjust to end on a page boundary */
+			if (!is_page_aligned(base))
+				asize += (page_align((size_t)base) - (size_t)base);
+			/* Can't call MORECORE if size is negative when treated as signed */
+			if (asize < HALF_MAX_SIZE_T &&(br = (TUint8*)(CALL_MORECORE(asize))) == base)
+			{
+				tbase = base;
+				tsize = asize;
+			}
+		}
+    }
+    else
+	{
+      /* Subtract out existing available top space from MORECORE request. */
+		asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE);
+    /* Use mem here only if it did continuously extend old space */
+      if (asize < HALF_MAX_SIZE_T &&
+          (br = (TUint8*)(CALL_MORECORE(asize))) == ss->base+ss->size) {
+        tbase = br;
+        tsize = asize;
+      }
+    }
+    if (tbase == CMFAIL) {    /* Cope with partial failure */
+      if (br != CMFAIL) {    /* Try to use/extend the space we did get */
+        if (asize < HALF_MAX_SIZE_T &&
+            asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) {
+          size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize);
+          if (esize < HALF_MAX_SIZE_T) {
+            TUint8* end = (TUint8*)CALL_MORECORE(esize);
+            if (end != CMFAIL)
+              asize += esize;
+            else {            /* Can't use; try to release */
+              CALL_MORECORE(-asize);
+              br = CMFAIL;
+            }
+          }
+        }
+      }
+      if (br != CMFAIL) {    /* Use the space we did get */
+        tbase = br;
+        tsize = asize;
+      }
+      else
+        disable_contiguous(m); /* Don't try contiguous path in the future */
+    }
+    RELEASE_MORECORE_LOCK(m);
+  }
+  if (HAVE_MMAP && tbase == CMFAIL) {  /* Try MMAP */
+    size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE;
+    size_t rsize = granularity_align(req);
+    if (rsize > nb) { /* Fail if wraps around zero */
+      TUint8* mp = (TUint8*)(CALL_MMAP(rsize));
+      if (mp != CMFAIL) {
+        tbase = mp;
+        tsize = rsize;
+        mmap_flag = IS_MMAPPED_BIT;
+      }
+    }
+  }
+  if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
+    size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE);
+    if (asize < HALF_MAX_SIZE_T) {
+      TUint8* br = CMFAIL;
+      TUint8* end = CMFAIL;
+      ACQUIRE_MORECORE_LOCK(m);
+      br = (TUint8*)(CALL_MORECORE(asize));
+      end = (TUint8*)(CALL_MORECORE(0));
+      RELEASE_MORECORE_LOCK(m);
+      if (br != CMFAIL && end != CMFAIL && br < end) {
+        size_t ssize = end - br;
+        if (ssize > nb + TOP_FOOT_SIZE) {
+          tbase = br;
+          tsize = ssize;
+        }
+      }
+    }
+  }
+  if (tbase != CMFAIL) {
+    if ((m->footprint += tsize) > m->max_footprint)
+      m->max_footprint = m->footprint;
+    if (!is_initialized(m)) { /* first-time initialization */
+      m->seg.base = m->least_addr = tbase;
+      m->seg.size = tsize;
+      m->seg.sflags = mmap_flag;
+      m->magic = mparams.magic;
+      init_bins(m);
+      if (is_global(m))
+        init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
+      else {
+        /* Offset top by embedded malloc_state */
+        mchunkptr mn = next_chunk(mem2chunk(m));
+        init_top(m, mn, (size_t)((tbase + tsize) - (TUint8*)mn) -TOP_FOOT_SIZE);
+      }
+    }else {
+      /* Try to merge with an existing segment */
+      msegmentptr sp = &m->seg;
+      while (sp != 0 && tbase != sp->base + sp->size)
+        sp = sp->next;
+      if (sp != 0 && !is_extern_segment(sp) &&
+          (sp->sflags & IS_MMAPPED_BIT) == mmap_flag &&
+          segment_holds(sp, m->top))
+    	  { /* append */
+        sp->size += tsize;
+        init_top(m, m->top, m->topsize + tsize);
+      }
+      else {
+        if (tbase < m->least_addr)
+          m->least_addr = tbase;
+        sp = &m->seg;
+        while (sp != 0 && sp->base != tbase + tsize)
+          sp = sp->next;
+        if (sp != 0 &&
+            !is_extern_segment(sp) &&
+            (sp->sflags & IS_MMAPPED_BIT) == mmap_flag) {
+          TUint8* oldbase = sp->base;
+          sp->base = tbase;
+          sp->size += tsize;
+          return prepend_alloc(m, tbase, oldbase, nb);
+        }
+        else
+          add_segment(m, tbase, tsize, mmap_flag);
+      }
+    }
+    if (nb < m->topsize) { /* Allocate from new or extended top space */
+      size_t rsize = m->topsize -= nb;
+      mchunkptr p = m->top;
+      mchunkptr r = m->top = chunk_plus_offset(p, nb);
+      r->head = rsize | PINUSE_BIT;
+      set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+      check_top_chunk(m, m->top);
+      check_malloced_chunk(m, chunk2mem(p), nb);
+      return chunk2mem(p);
+    }
+  }
+  /*need to check this*/
+  //errno = -1;
+  return 0;
+}
+msegmentptr RSymbianDLHeap::segment_holding(mstate m, TUint8* addr) {
+  msegmentptr sp = &m->seg;
+  for (;;) {
+    if (addr >= sp->base && addr < sp->base + sp->size)
+      return sp;
+    if ((sp = sp->next) == 0)
+      return 0;
+  }
+}
+/* Unlink the first chunk from a smallbin */
+inline void RSymbianDLHeap::unlink_first_small_chunk(mstate M,mchunkptr B,mchunkptr P,bindex_t& I)
+{
+  mchunkptr F = P->fd;
+  assert(P != B);
+  assert(P != F);
+  assert(chunksize(P) == small_index2size(I));
+  if (B == F)
+    clear_smallmap(M, I);
+  else if (RTCHECK(ok_address(M, F))) {
+    B->fd = F;
+    F->bk = B;
+  }
+  else {
+    CORRUPTION_ERROR_ACTION(M);
+  }
+}
+/* Link a free chunk into a smallbin  */
+inline void RSymbianDLHeap::insert_small_chunk(mstate M,mchunkptr P, size_t S)
+{
+  bindex_t I  = small_index(S);
+  mchunkptr B = smallbin_at(M, I);
+  mchunkptr F = B;
+  assert(S >= MIN_CHUNK_SIZE);
+  if (!smallmap_is_marked(M, I))
+    mark_smallmap(M, I);
+  else if (RTCHECK(ok_address(M, B->fd)))
+    F = B->fd;
+  else {
+    CORRUPTION_ERROR_ACTION(M);
+  }
+  B->fd = P;
+  F->bk = P;
+  P->fd = F;
+  P->bk = B;
+}
+
+
+inline void RSymbianDLHeap::insert_chunk(mstate M,mchunkptr P,size_t S)
+{
+	if (is_small(S))
+		insert_small_chunk(M, P, S);
+	else{
+		tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S);
+	 }
+}
+
+inline void RSymbianDLHeap::unlink_large_chunk(mstate M,tchunkptr X)
+{
+  tchunkptr XP = X->parent;
+  tchunkptr R;
+  if (X->bk != X) {
+    tchunkptr F = X->fd;
+    R = X->bk;
+    if (RTCHECK(ok_address(M, F))) {
+      F->bk = R;
+      R->fd = F;
+    }
+    else {
+      CORRUPTION_ERROR_ACTION(M);
+    }
+  }
+  else {
+    tchunkptr* RP;
+    if (((R = *(RP = &(X->child[1]))) != 0) ||
+        ((R = *(RP = &(X->child[0]))) != 0)) {
+      tchunkptr* CP;
+      while ((*(CP = &(R->child[1])) != 0) ||
+             (*(CP = &(R->child[0])) != 0)) {
+        R = *(RP = CP);
+      }
+      if (RTCHECK(ok_address(M, RP)))
+        *RP = 0;
+      else {
+        CORRUPTION_ERROR_ACTION(M);
+      }
+    }
+  }
+  if (XP != 0) {
+    tbinptr* H = treebin_at(M, X->index);
+    if (X == *H) {
+      if ((*H = R) == 0)
+        clear_treemap(M, X->index);
+    }
+    else if (RTCHECK(ok_address(M, XP))) {
+      if (XP->child[0] == X)
+        XP->child[0] = R;
+      else
+        XP->child[1] = R;
+    }
+    else
+      CORRUPTION_ERROR_ACTION(M);
+    if (R != 0) {
+      if (RTCHECK(ok_address(M, R))) {
+        tchunkptr C0, C1;
+        R->parent = XP;
+        if ((C0 = X->child[0]) != 0) {
+          if (RTCHECK(ok_address(M, C0))) {
+            R->child[0] = C0;
+            C0->parent = R;
+          }
+          else
+            CORRUPTION_ERROR_ACTION(M);
+        }
+        if ((C1 = X->child[1]) != 0) {
+          if (RTCHECK(ok_address(M, C1))) {
+            R->child[1] = C1;
+            C1->parent = R;
+          }
+          else
+            CORRUPTION_ERROR_ACTION(M);
+        }
+      }
+      else
+        CORRUPTION_ERROR_ACTION(M);
+    }
+  }
+}
+
+/* Unlink a chunk from a smallbin  */
+inline void RSymbianDLHeap::unlink_small_chunk(mstate M, mchunkptr P,size_t S)
+{
+  mchunkptr F = P->fd;
+  mchunkptr B = P->bk;
+  bindex_t I = small_index(S);
+  assert(P != B);
+  assert(P != F);
+  assert(chunksize(P) == small_index2size(I));
+  if (F == B)
+    clear_smallmap(M, I);
+  else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&
+                   (B == smallbin_at(M,I) || ok_address(M, B)))) {
+    F->bk = B;
+    B->fd = F;
+  }
+  else {
+    CORRUPTION_ERROR_ACTION(M);
+  }
+}
+
+inline void RSymbianDLHeap::unlink_chunk(mstate M, mchunkptr P, size_t S)
+{
+  if (is_small(S))
+	unlink_small_chunk(M, P, S);
+  else
+  {
+	  tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP);
+  }
+}
+
+inline void RSymbianDLHeap::compute_tree_index(size_t S, bindex_t& I)
+{
+  size_t X = S >> TREEBIN_SHIFT;
+  if (X == 0)
+    I = 0;
+  else if (X > 0xFFFF)
+    I = NTREEBINS-1;
+  else {
+    unsigned int Y = (unsigned int)X;
+    unsigned int N = ((Y - 0x100) >> 16) & 8;
+    unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;
+    N += K;
+    N += K = (((Y <<= K) - 0x4000) >> 16) & 2;
+    K = 14 - N + ((Y <<= K) >> 15);
+    I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));
+  }
+}
+
+/* ------------------------- Operations on trees ------------------------- */
+
+/* Insert chunk into tree */
+inline void RSymbianDLHeap::insert_large_chunk(mstate M,tchunkptr X,size_t S)
+{
+  tbinptr* H;
+  bindex_t I;
+  compute_tree_index(S, I);
+  H = treebin_at(M, I);
+  X->index = I;
+  X->child[0] = X->child[1] = 0;
+  if (!treemap_is_marked(M, I)) {
+    mark_treemap(M, I);
+    *H = X;
+    X->parent = (tchunkptr)H;
+    X->fd = X->bk = X;
+  }
+  else {
+    tchunkptr T = *H;
+    size_t K = S << leftshift_for_tree_index(I);
+    for (;;) {
+      if (chunksize(T) != S) {
+        tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);
+        K <<= 1;
+        if (*C != 0)
+          T = *C;
+        else if (RTCHECK(ok_address(M, C))) {
+          *C = X;
+          X->parent = T;
+          X->fd = X->bk = X;
+          break;
+        }
+        else {
+          CORRUPTION_ERROR_ACTION(M);
+          break;
+        }
+      }
+      else {
+        tchunkptr F = T->fd;
+        if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {
+          T->fd = F->bk = X;
+          X->fd = F;
+          X->bk = T;
+          X->parent = 0;
+          break;
+        }
+        else {
+          CORRUPTION_ERROR_ACTION(M);
+          break;
+        }
+      }
+    }
+  }
+}
+
+/*
+  Unlink steps:
+
+  1. If x is a chained node, unlink it from its same-sized fd/bk links
+     and choose its bk node as its replacement.
+  2. If x was the last node of its size, but not a leaf node, it must
+     be replaced with a leaf node (not merely one with an open left or
+     right), to make sure that lefts and rights of descendents
+     correspond properly to bit masks.  We use the rightmost descendent
+     of x.  We could use any other leaf, but this is easy to locate and
+     tends to counteract removal of leftmosts elsewhere, and so keeps
+     paths shorter than minimally guaranteed.  This doesn't loop much
+     because on average a node in a tree is near the bottom.
+  3. If x is the base of a chain (i.e., has parent links) relink
+     x's parent and children to x's replacement (or null if none).
+*/
+
+/* Replace dv node, binning the old one */
+/* Used only when dvsize known to be small */
+inline void RSymbianDLHeap::replace_dv(mstate M, mchunkptr P, size_t S)
+{
+  size_t DVS = M->dvsize;
+  if (DVS != 0) {
+    mchunkptr DV = M->dv;
+    assert(is_small(DVS));
+    insert_small_chunk(M, DV, DVS);
+  }
+  M->dvsize = S;
+  M->dv = P;
+}
+
+inline void RSymbianDLHeap::compute_bit2idx(binmap_t X,bindex_t& I)
+{
+	unsigned int Y = X - 1;
+	unsigned int K = Y >> (16-4) & 16;
+	unsigned int N = K;        Y >>= K;
+	N += K = Y >> (8-3) &  8;  Y >>= K;
+	N += K = Y >> (4-2) &  4;  Y >>= K;
+	N += K = Y >> (2-1) &  2;  Y >>= K;
+	N += K = Y >> (1-0) &  1;  Y >>= K;
+	I = (bindex_t)(N + Y);
+}
+
+void RSymbianDLHeap::add_segment(mstate m, TUint8* tbase, size_t tsize, flag_t mmapped) {
+  /* Determine locations and sizes of segment, fenceposts, old top */
+  TUint8* old_top = (TUint8*)m->top;
+  msegmentptr oldsp = segment_holding(m, old_top);
+  TUint8* old_end = oldsp->base + oldsp->size;
+  size_t ssize = pad_request(sizeof(struct malloc_segment));
+  TUint8* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+  size_t offset = align_offset(chunk2mem(rawsp));
+  TUint8* asp = rawsp + offset;
+  TUint8* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp;
+  mchunkptr sp = (mchunkptr)csp;
+  msegmentptr ss = (msegmentptr)(chunk2mem(sp));
+  mchunkptr tnext = chunk_plus_offset(sp, ssize);
+  mchunkptr p = tnext;
+  int nfences = 0;
+
+  /* reset top to new space */
+  init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE);
+
+  /* Set up segment record */
+  assert(is_aligned(ss));
+  set_size_and_pinuse_of_inuse_chunk(m, sp, ssize);
+  *ss = m->seg; /* Push current record */
+  m->seg.base = tbase;
+  m->seg.size = tsize;
+  m->seg.sflags = mmapped;
+  m->seg.next = ss;
+
+  /* Insert trailing fenceposts */
+  for (;;) {
+    mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE);
+    p->head = FENCEPOST_HEAD;
+    ++nfences;
+    if ((TUint8*)(&(nextp->head)) < old_end)
+      p = nextp;
+    else
+      break;
+  }
+  assert(nfences >= 2);
+
+  /* Insert the rest of old top into a bin as an ordinary free chunk */
+  if (csp != old_top) {
+    mchunkptr q = (mchunkptr)old_top;
+    size_t psize = csp - old_top;
+    mchunkptr tn = chunk_plus_offset(q, psize);
+    set_free_with_pinuse(q, psize, tn);
+    insert_chunk(m, q, psize);
+  }
+
+  check_top_chunk(m, m->top);
+}
+
+
+void* RSymbianDLHeap::prepend_alloc(mstate m, TUint8* newbase, TUint8* oldbase,
+                           size_t nb) {
+  mchunkptr p = align_as_chunk(newbase);
+  mchunkptr oldfirst = align_as_chunk(oldbase);
+  size_t psize = (TUint8*)oldfirst - (TUint8*)p;
+  mchunkptr q = chunk_plus_offset(p, nb);
+  size_t qsize = psize - nb;
+  set_size_and_pinuse_of_inuse_chunk(m, p, nb);
+
+  assert((TUint8*)oldfirst > (TUint8*)q);
+  assert(pinuse(oldfirst));
+  assert(qsize >= MIN_CHUNK_SIZE);
+
+  /* consolidate remainder with first chunk of old base */
+  if (oldfirst == m->top) {
+    size_t tsize = m->topsize += qsize;
+    m->top = q;
+    q->head = tsize | PINUSE_BIT;
+    check_top_chunk(m, q);
+  }
+  else if (oldfirst == m->dv) {
+    size_t dsize = m->dvsize += qsize;
+    m->dv = q;
+    set_size_and_pinuse_of_free_chunk(q, dsize);
+  }
+  else {
+    if (!cinuse(oldfirst)) {
+      size_t nsize = chunksize(oldfirst);
+      unlink_chunk(m, oldfirst, nsize);
+      oldfirst = chunk_plus_offset(oldfirst, nsize);
+      qsize += nsize;
+    }
+    set_free_with_pinuse(q, qsize, oldfirst);
+    insert_chunk(m, q, qsize);
+    check_free_chunk(m, q);
+  }
+
+  check_malloced_chunk(m, chunk2mem(p), nb);
+  return chunk2mem(p);
+}
+
+void* RSymbianDLHeap::mmap_alloc(mstate m, size_t nb) {
+  size_t mmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK);
+  if (mmsize > nb) {     /* Check for wrap around 0 */
+    TUint8* mm = (TUint8*)(DIRECT_MMAP(mmsize));
+    if (mm != CMFAIL) {
+      size_t offset = align_offset(chunk2mem(mm));
+      size_t psize = mmsize - offset - MMAP_FOOT_PAD;
+      mchunkptr p = (mchunkptr)(mm + offset);
+      p->prev_foot = offset | IS_MMAPPED_BIT;
+      (p)->head = (psize|CINUSE_BIT);
+      mark_inuse_foot(m, p, psize);
+      chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD;
+      chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0;
+
+      if (mm < m->least_addr)
+        m->least_addr = mm;
+      if ((m->footprint += mmsize) > m->max_footprint)
+        m->max_footprint = m->footprint;
+      assert(is_aligned(chunk2mem(p)));
+      check_mmapped_chunk(m, p);
+      return chunk2mem(p);
+    }
+  }
+  return 0;
+}
+
+	int RSymbianDLHeap::sys_trim(mstate m, size_t pad)
+	{
+	  size_t released = 0;
+	  if (pad < MAX_REQUEST && is_initialized(m)) {
+	    pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */
+
+	    if (m->topsize > pad) {
+	      /* Shrink top space in granularity-size units, keeping at least one */
+	      size_t unit = mparams.granularity;
+				size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - SIZE_T_ONE) * unit;
+	      msegmentptr sp = segment_holding(m, (TUint8*)m->top);
+
+	      if (!is_extern_segment(sp)) {
+	        if (is_mmapped_segment(sp)) {
+	          if (HAVE_MMAP &&
+	              sp->size >= extra &&
+	              !has_segment_link(m, sp)) { /* can't shrink if pinned */
+	            size_t newsize = sp->size - extra;
+	            /* Prefer mremap, fall back to munmap */
+	            if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) ||
+	                (CALL_MUNMAP(sp->base + newsize, extra) == 0)) {
+	              released = extra;
+	            }
+	          }
+	        }
+	        else if (HAVE_MORECORE) {
+	          if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */
+	            extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit;
+	          ACQUIRE_MORECORE_LOCK(m);
+	          {
+	            /* Make sure end of memory is where we last set it. */
+	            TUint8* old_br = (TUint8*)(CALL_MORECORE(0));
+	            if (old_br == sp->base + sp->size) {
+	              TUint8* rel_br = (TUint8*)(CALL_MORECORE(-extra));
+	              TUint8* new_br = (TUint8*)(CALL_MORECORE(0));
+	              if (rel_br != CMFAIL && new_br < old_br)
+	                released = old_br - new_br;
+	            }
+	          }
+	          RELEASE_MORECORE_LOCK(m);
+	        }
+	      }
+
+	      if (released != 0) {
+	        sp->size -= released;
+	        m->footprint -= released;
+	        init_top(m, m->top, m->topsize - released);
+	        check_top_chunk(m, m->top);
+	      }
+	    }
+
+	    /* Unmap any unused mmapped segments */
+	    if (HAVE_MMAP)
+	      released += release_unused_segments(m);
+
+	    /* On failure, disable autotrim to avoid repeated failed future calls */
+	    if (released == 0)
+	      m->trim_check = MAX_SIZE_T;
+	  }
+
+	  return (released != 0)? 1 : 0;
+	}
+
+	inline int RSymbianDLHeap::has_segment_link(mstate m, msegmentptr ss)
+	{
+	  msegmentptr sp = &m->seg;
+	  for (;;) {
+	    if ((TUint8*)sp >= ss->base && (TUint8*)sp < ss->base + ss->size)
+	      return 1;
+	    if ((sp = sp->next) == 0)
+	      return 0;
+	  }
+	}
+
+	/* Unmap and unlink any mmapped segments that don't contain used chunks */
+	size_t RSymbianDLHeap::release_unused_segments(mstate m)
+	{
+	  size_t released = 0;
+	  msegmentptr pred = &m->seg;
+	  msegmentptr sp = pred->next;
+	  while (sp != 0) {
+	    TUint8* base = sp->base;
+	    size_t size = sp->size;
+	    msegmentptr next = sp->next;
+	    if (is_mmapped_segment(sp) && !is_extern_segment(sp)) {
+	      mchunkptr p = align_as_chunk(base);
+	      size_t psize = chunksize(p);
+	      /* Can unmap if first chunk holds entire segment and not pinned */
+	      if (!cinuse(p) && (TUint8*)p + psize >= base + size - TOP_FOOT_SIZE) {
+	        tchunkptr tp = (tchunkptr)p;
+	        assert(segment_holds(sp, (TUint8*)sp));
+	        if (p == m->dv) {
+	          m->dv = 0;
+	          m->dvsize = 0;
+	        }
+	        else {
+	          unlink_large_chunk(m, tp);
+	        }
+	        if (CALL_MUNMAP(base, size) == 0) {
+	          released += size;
+	          m->footprint -= size;
+	          /* unlink obsoleted record */
+	          sp = pred;
+	          sp->next = next;
+	        }
+	        else { /* back out if cannot unmap */
+	          insert_large_chunk(m, tp, psize);
+	        }
+	      }
+	    }
+	    pred = sp;
+	    sp = next;
+	  }/*End of while*/
+	  return released;
+	}
+	/* Realloc using mmap */
+	inline	mchunkptr RSymbianDLHeap::mmap_resize(mstate m, mchunkptr oldp, size_t nb)
+	{
+	  size_t oldsize = chunksize(oldp);
+	  if (is_small(nb)) /* Can't shrink mmap regions below small size */
+	    return 0;
+	  /* Keep old chunk if big enough but not too big */
+	  if (oldsize >= nb + SIZE_T_SIZE &&
+	      (oldsize - nb) <= (mparams.granularity << 1))
+	    return oldp;
+	  else {
+	    size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT;
+	    size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD;
+	    size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES +
+	                                         CHUNK_ALIGN_MASK);
+	    TUint8* cp = (TUint8*)CALL_MREMAP((char*)oldp - offset,
+	                                  oldmmsize, newmmsize, 1);
+	    if (cp != CMFAIL) {
+	      mchunkptr newp = (mchunkptr)(cp + offset);
+	      size_t psize = newmmsize - offset - MMAP_FOOT_PAD;
+	      newp->head = (psize|CINUSE_BIT);
+	      mark_inuse_foot(m, newp, psize);
+	      chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD;
+	      chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0;
+
+	      if (cp < m->least_addr)
+	        m->least_addr = cp;
+	      if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint)
+	        m->max_footprint = m->footprint;
+	      check_mmapped_chunk(m, newp);
+	      return newp;
+	    }
+	  }
+	  return 0;
+	}
+
+
+void RSymbianDLHeap::Init_Dlmalloc(size_t capacity, int locked, size_t aTrimThreshold)
+	{
+		memset(gm,0,sizeof(malloc_state));
+		init_mparams(aTrimThreshold); /* Ensure pagesize etc initialized */
+		// The maximum amount that can be allocated can be calculated as:-
+		// 2^sizeof(size_t) - sizeof(malloc_state) - TOP_FOOT_SIZE - page size (all accordingly padded)
+		// If the capacity exceeds this, no allocation will be done.
+		gm->seg.base = gm->least_addr = iBase;
+		gm->seg.size = capacity;
+		gm->seg.sflags = !IS_MMAPPED_BIT;
+		set_lock(gm, locked);
+		gm->magic = mparams.magic;
+		init_bins(gm);
+		init_top(gm, (mchunkptr)iBase, capacity - TOP_FOOT_SIZE);
+	}
+
+void* RSymbianDLHeap::dlmalloc(size_t bytes) {
+  /*
+     Basic algorithm:
+     If a small request (< 256 bytes minus per-chunk overhead):
+       1. If one exists, use a remainderless chunk in associated smallbin.
+          (Remainderless means that there are too few excess bytes to
+          represent as a chunk.)
+       2. If it is big enough, use the dv chunk, which is normally the
+          chunk adjacent to the one used for the most recent small request.
+       3. If one exists, split the smallest available chunk in a bin,
+          saving remainder in dv.
+       4. If it is big enough, use the top chunk.
+       5. If available, get memory from system and use it
+     Otherwise, for a large request:
+       1. Find the smallest available binned chunk that fits, and use it
+          if it is better fitting than dv chunk, splitting if necessary.
+       2. If better fitting than any binned chunk, use the dv chunk.
+       3. If it is big enough, use the top chunk.
+       4. If request size >= mmap threshold, try to directly mmap this chunk.
+       5. If available, get memory from system and use it
+
+     The ugly goto's here ensure that postaction occurs along all paths.
+  */
+  if (!PREACTION(gm)) {
+    void* mem;
+    size_t nb;
+    if (bytes <= MAX_SMALL_REQUEST) {
+      bindex_t idx;
+      binmap_t smallbits;
+      nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes);
+      idx = small_index(nb);
+      smallbits = gm->smallmap >> idx;
+
+      if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */
+        mchunkptr b, p;
+        idx += ~smallbits & 1;       /* Uses next bin if idx empty */
+        b = smallbin_at(gm, idx);
+        p = b->fd;
+        assert(chunksize(p) == small_index2size(idx));
+        unlink_first_small_chunk(gm, b, p, idx);
+        set_inuse_and_pinuse(gm, p, small_index2size(idx));
+        mem = chunk2mem(p);
+        check_malloced_chunk(gm, mem, nb);
+        goto postaction;
+      }
+
+      else if (nb > gm->dvsize) {
+        if (smallbits != 0) { /* Use chunk in next nonempty smallbin */
+          mchunkptr b, p, r;
+          size_t rsize;
+          bindex_t i;
+          binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx));
+          binmap_t leastbit = least_bit(leftbits);
+          compute_bit2idx(leastbit, i);
+          b = smallbin_at(gm, i);
+          p = b->fd;
+          assert(chunksize(p) == small_index2size(i));
+          unlink_first_small_chunk(gm, b, p, i);
+          rsize = small_index2size(i) - nb;
+          /* Fit here cannot be remainderless if 4byte sizes */
+          if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE)
+            set_inuse_and_pinuse(gm, p, small_index2size(i));
+          else {
+            set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+            r = chunk_plus_offset(p, nb);
+            set_size_and_pinuse_of_free_chunk(r, rsize);
+            replace_dv(gm, r, rsize);
+          }
+          mem = chunk2mem(p);
+          check_malloced_chunk(gm, mem, nb);
+          goto postaction;
+        }
+
+        else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) {
+          check_malloced_chunk(gm, mem, nb);
+          goto postaction;
+        }
+      }
+    }
+    else if (bytes >= MAX_REQUEST)
+      nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */
+    else {
+      nb = pad_request(bytes);
+      if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) {
+        check_malloced_chunk(gm, mem, nb);
+        goto postaction;
+      }
+    }
+
+    if (nb <= gm->dvsize) {
+      size_t rsize = gm->dvsize - nb;
+      mchunkptr p = gm->dv;
+      if (rsize >= MIN_CHUNK_SIZE) { /* split dv */
+        mchunkptr r = gm->dv = chunk_plus_offset(p, nb);
+        gm->dvsize = rsize;
+        set_size_and_pinuse_of_free_chunk(r, rsize);
+        set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+      }
+      else { /* exhaust dv */
+        size_t dvs = gm->dvsize;
+        gm->dvsize = 0;
+        gm->dv = 0;
+        set_inuse_and_pinuse(gm, p, dvs);
+      }
+      mem = chunk2mem(p);
+      check_malloced_chunk(gm, mem, nb);
+      goto postaction;
+    }
+
+    else if (nb < gm->topsize) { /* Split top */
+      size_t rsize = gm->topsize -= nb;
+      mchunkptr p = gm->top;
+      mchunkptr r = gm->top = chunk_plus_offset(p, nb);
+      r->head = rsize | PINUSE_BIT;
+      set_size_and_pinuse_of_inuse_chunk(gm, p, nb);
+      mem = chunk2mem(p);
+      check_top_chunk(gm, gm->top);
+      check_malloced_chunk(gm, mem, nb);
+      goto postaction;
+    }
+
+    mem = sys_alloc(gm, nb);
+
+  postaction:
+    POSTACTION(gm);
+    return mem;
+  }
+
+  return 0;
+}
+
+void RSymbianDLHeap::dlfree(void* mem) {
+  /*
+     Consolidate freed chunks with preceeding or succeeding bordering
+     free chunks, if they exist, and then place in a bin.  Intermixed
+     with special cases for top, dv, mmapped chunks, and usage errors.
+  */
+
+	if (mem != 0)
+	{
+		mchunkptr p  = mem2chunk(mem);
+#if FOOTERS
+		mstate fm = get_mstate_for(p);
+		if (!ok_magic(fm))
+		{
+			USAGE_ERROR_ACTION(fm, p);
+			return;
+		}
+#else /* FOOTERS */
+#define fm gm
+#endif /* FOOTERS */
+
+		if (!PREACTION(fm))
+		{
+			check_inuse_chunk(fm, p);
+			if (RTCHECK(ok_address(fm, p) && ok_cinuse(p)))
+			{
+				size_t psize = chunksize(p);
+				mchunkptr next = chunk_plus_offset(p, psize);
+				if (!pinuse(p))
+				{
+					size_t prevsize = p->prev_foot;
+					if ((prevsize & IS_MMAPPED_BIT) != 0)
+					{
+						prevsize &= ~IS_MMAPPED_BIT;
+						psize += prevsize + MMAP_FOOT_PAD;
+						/*TInt tmp = TOP_FOOT_SIZE;
+						TUint8* top = (TUint8*)fm->top + fm->topsize + 40;
+						if((top == (TUint8*)p)&& fm->topsize > 4096)
+						{
+							fm->topsize += psize;
+							msegmentptr sp = segment_holding(fm, (TUint8*)fm->top);
+							sp->size+=psize;
+							if (should_trim(fm, fm->topsize))
+								sys_trim(fm, 0);
+ 							goto postaction;
+						}
+						else*/
+						{
+							if (CALL_MUNMAP((char*)p - prevsize, psize) == 0)
+								fm->footprint -= psize;
+							goto postaction;
+						}
+					}
+					else
+					{
+						mchunkptr prev = chunk_minus_offset(p, prevsize);
+						psize += prevsize;
+						p = prev;
+						if (RTCHECK(ok_address(fm, prev)))
+						{ /* consolidate backward */
+							if (p != fm->dv)
+							{
+								unlink_chunk(fm, p, prevsize);
+							}
+							else if ((next->head & INUSE_BITS) == INUSE_BITS)
+							{
+								fm->dvsize = psize;
+								set_free_with_pinuse(p, psize, next);
+								goto postaction;
+							}
+						}
+						else
+							goto erroraction;
+					}
+				}
+
+				if (RTCHECK(ok_next(p, next) && ok_pinuse(next)))
+				{
+					if (!cinuse(next))
+					{  /* consolidate forward */
+						if (next == fm->top)
+						{
+							size_t tsize = fm->topsize += psize;
+							fm->top = p;
+							p->head = tsize | PINUSE_BIT;
+							if (p == fm->dv)
+							{
+								fm->dv = 0;
+								fm->dvsize = 0;
+							}
+							if (should_trim(fm, tsize))
+								sys_trim(fm, 0);
+							goto postaction;
+						}
+						else if (next == fm->dv)
+						{
+							size_t dsize = fm->dvsize += psize;
+							fm->dv = p;
+							set_size_and_pinuse_of_free_chunk(p, dsize);
+							goto postaction;
+						}
+						else
+						{
+							size_t nsize = chunksize(next);
+							psize += nsize;
+							unlink_chunk(fm, next, nsize);
+							set_size_and_pinuse_of_free_chunk(p, psize);
+							if (p == fm->dv)
+							{
+								fm->dvsize = psize;
+								goto postaction;
+							}
+						}
+					}
+					else
+						set_free_with_pinuse(p, psize, next);
+					insert_chunk(fm, p, psize);
+					check_free_chunk(fm, p);
+					goto postaction;
+				}
+			}
+erroraction:
+    	USAGE_ERROR_ACTION(fm, p);
+postaction:
+    	POSTACTION(fm);
+		}
+	}
+#if !FOOTERS
+#undef fm
+#endif /* FOOTERS */
+}
+
+void* RSymbianDLHeap::dlrealloc(void* oldmem, size_t bytes) {
+  if (oldmem == 0)
+    return dlmalloc(bytes);
+#ifdef REALLOC_ZERO_BYTES_FREES
+  if (bytes == 0) {
+    dlfree(oldmem);
+    return 0;
+  }
+#endif /* REALLOC_ZERO_BYTES_FREES */
+  else {
+#if ! FOOTERS
+    mstate m = gm;
+#else /* FOOTERS */
+    mstate m = get_mstate_for(mem2chunk(oldmem));
+    if (!ok_magic(m)) {
+      USAGE_ERROR_ACTION(m, oldmem);
+      return 0;
+    }
+#endif /* FOOTERS */
+    return internal_realloc(m, oldmem, bytes);
+  }
+}
+
+
+int RSymbianDLHeap::dlmalloc_trim(size_t pad) {
+  int result = 0;
+  if (!PREACTION(gm)) {
+    result = sys_trim(gm, pad);
+    POSTACTION(gm);
+  }
+  return result;
+}
+
+size_t RSymbianDLHeap::dlmalloc_footprint(void) {
+  return gm->footprint;
+}
+
+size_t RSymbianDLHeap::dlmalloc_max_footprint(void) {
+  return gm->max_footprint;
+}
+
+#if !NO_MALLINFO
+struct mallinfo RSymbianDLHeap::dlmallinfo(void) {
+  return internal_mallinfo(gm);
+}
+#endif /* NO_MALLINFO */
+
+void RSymbianDLHeap::dlmalloc_stats() {
+  internal_malloc_stats(gm);
+}
+
+int RSymbianDLHeap::dlmallopt(int param_number, int value) {
+  return change_mparam(param_number, value);
+}
+
+//inline slab* slab::slabfor(void* p)
+slab* slab::slabfor( const void* p)
+{
+return (slab*)(floor(p, slabsize));
+}
+
+
+void RSymbianDLHeap::tree_remove(slab* s)
+{
+	slab** r = s->parent;
+	slab* c1 = s->child1;
+	slab* c2 = s->child2;
+	for (;;)
+	{
+		if (!c2)
+		{
+			*r = c1;
+			if (c1)
+				c1->parent = r;
+			return;
+		}
+		if (!c1)
+		{
+			*r = c2;
+			c2->parent = r;
+			return;
+		}
+		if (c1 > c2)
+		{
+			slab* c3 = c1;
+			c1 = c2;
+			c2 = c3;
+		}
+		slab* newc2 = c1->child2;
+		*r = c1;
+		c1->parent = r;
+		c1->child2 = c2;
+		c2->parent = &c1->child2;
+		s = c1;
+		c1 = s->child1;
+		c2 = newc2;
+		r = &s->child1;
+	}
+}	
+void RSymbianDLHeap::tree_insert(slab* s,slab** r)
+	{
+		slab* n = *r;
+		for (;;)
+		{
+			if (!n)
+			{	// tree empty
+				*r = s;
+				s->parent = r;
+				s->child1 = s->child2 = 0;
+				break;
+			}
+			if (s < n)
+			{	// insert between parent and n
+				*r = s;
+				s->parent = r;
+				s->child1 = n;
+				s->child2 = 0;
+				n->parent = &s->child1;
+				break;
+			}
+			slab* c1 = n->child1;
+			slab* c2 = n->child2;
+			if ((c1 - 1) > (c2 - 1))
+			{
+				r = &n->child1;
+				n = c1;
+			}
+			else
+			{
+				r = &n->child2;
+				n = c2;
+			}
+		}
+	}
+void* RSymbianDLHeap::allocnewslab(slabset& allocator)
+//
+// Acquire and initialise a new slab, returning a cell from the slab
+// The strategy is:
+// 1. Use the lowest address free slab, if available. This is done by using the lowest slab
+//    in the page at the root of the partial_page heap (which is address ordered). If the
+//    is now fully used, remove it from the partial_page heap.
+// 2. Allocate a new page for slabs if no empty slabs are available
+//
+{
+	page* p = page::pagefor(partial_page);
+	if (!p)
+		return allocnewpage(allocator);
+
+	unsigned h = p->slabs[0].header;
+	unsigned pagemap = header_pagemap(h);
+	ASSERT(&p->slabs[hibit(pagemap)] == partial_page);
+
+	unsigned slabix = lowbit(pagemap);
+	p->slabs[0].header = h &~ (0x100<<slabix);
+	if (!(pagemap &~ (1<<slabix)))
+	{
+		tree_remove(partial_page);	// last free slab in page
+	}
+	return allocator.initslab(&p->slabs[slabix]);
+}
+
+/**Defination of this functionis not there in proto code***/
+#if 0
+void RSymbianDLHeap::partial_insert(slab* s)
+	{
+		// slab has had first cell freed and needs to be linked back into partial tree
+		slabset& ss = slaballoc[sizemap[s->clz]];
+
+		ASSERT(s->used == slabfull);
+		s->used = ss.fulluse - s->clz;		// full-1 loading
+		tree_insert(s,&ss.partial);
+		checktree(ss.partial);
+	}
+/**Defination of this functionis not there in proto code***/
+#endif
+
+void* RSymbianDLHeap::allocnewpage(slabset& allocator)
+//
+// Acquire and initialise a new page, returning a cell from a new slab
+// The partial_page tree is empty (otherwise we'd have used a slab from there)
+// The partial_page link is put in the highest addressed slab in the page, and the
+// lowest addressed slab is used to fulfill the allocation request
+//
+{
+	page* p	 = spare_page;
+	if (p)
+		spare_page = 0;
+	else
+	{
+		p = static_cast<page*>(map(0,pagesize));
+		if (!p)
+			return 0;
+	}
+	
+	ASSERT(p == floor(p,pagesize));
+	p->slabs[0].header = ((1<<3) + (1<<2) + (1<<1))<<8;		// set pagemap
+	p->slabs[3].parent = &partial_page;
+	p->slabs[3].child1 = p->slabs[3].child2 = 0;
+	partial_page = &p->slabs[3];
+	return allocator.initslab(&p->slabs[0]);
+}
+
+void RSymbianDLHeap::freepage(page* p)
+//
+// Release an unused page to the OS
+// A single page is cached for reuse to reduce thrashing
+// the OS allocator.
+//
+{
+	ASSERT(ceiling(p,pagesize) == p);
+	if (!spare_page)
+	{
+		spare_page = p;
+		return;
+	}
+	unmap(p,pagesize);
+}
+
+void RSymbianDLHeap::freeslab(slab* s)
+//
+// Release an empty slab to the slab manager
+// The strategy is:
+// 1. The page containing the slab is checked to see the state of the other slabs in the page by
+//    inspecting the pagemap field in the header of the first slab in the page.
+// 2. The pagemap is updated to indicate the new unused slab
+// 3. If this is the only unused slab in the page then the slab header is used to add the page to
+//    the partial_page tree/heap
+// 4. If all the slabs in the page are now unused the page is release back to the OS
+// 5. If this slab has a higher address than the one currently used to track this page in
+//    the partial_page heap, the linkage is moved to the new unused slab
+//
+{
+	tree_remove(s);
+	checktree(*s->parent);
+	ASSERT(header_usedm4(s->header) == header_size(s->header)-4);
+	CHECK(s->header |= 0xFF00000);			// illegal value for debug purposes
+	page* p = page::pagefor(s);
+	unsigned h = p->slabs[0].header;
+	int slabix = s - &p->slabs[0];
+	unsigned pagemap = header_pagemap(h);
+	p->slabs[0].header = h | (0x100<<slabix);
+	if (pagemap == 0)
+	{	// page was full before, use this slab as link in empty heap
+		tree_insert(s, &partial_page);
+	}
+	else
+	{	// find the current empty-link slab
+		slab* sl = &p->slabs[hibit(pagemap)];
+		pagemap ^= (1<<slabix);
+		if (pagemap == 0xf)
+		{	// page is now empty so recycle page to os
+			tree_remove(sl);
+			freepage(p);
+			return;
+		}
+		// ensure the free list link is in highest address slab in page
+		if (s > sl)
+		{	// replace current link with new one. Address-order tree so position stays the same
+			slab** r = sl->parent;
+			slab* c1 = sl->child1;
+			slab* c2 = sl->child2;
+			s->parent = r;
+			s->child1 = c1;
+			s->child2 = c2;
+			*r = s;
+			if (c1)
+				c1->parent = &s->child1;
+			if (c2)
+				c2->parent = &s->child2;
+		}
+		CHECK(if (s < sl) s=sl);
+	}
+	ASSERT(header_pagemap(p->slabs[0].header) != 0);
+	ASSERT(hibit(header_pagemap(p->slabs[0].header)) == unsigned(s - &p->slabs[0]));
+}
+
+void RSymbianDLHeap::slab_init(unsigned slabbitmap)
+{
+	ASSERT((slabbitmap & ~okbits) == 0);
+	ASSERT(maxslabsize <= 60);
+
+	slab_threshold=0;
+	partial_page = 0;
+	unsigned char ix = 0xff;
+	unsigned bit = 1<<((maxslabsize>>2)-1);
+	for (int sz = maxslabsize; sz >= 0; sz -= 4, bit >>= 1)
+	{
+		if (slabbitmap & bit)
+		{
+			if (++ix == 0)
+				slab_threshold=sz+1;
+			slabset& c = slaballoc[ix];
+			c.size = sz;
+			c.partial = 0;
+		}
+		sizemap[sz>>2] = ix;
+	}
+}
+
+void* RSymbianDLHeap::slab_allocate(slabset& ss)
+//
+// Allocate a cell from the given slabset
+// Strategy:
+// 1. Take the partially full slab at the top of the heap (lowest address).
+// 2. If there is no such slab, allocate from a new slab
+// 3. If the slab has a non-empty freelist, pop the cell from the front of the list and update the slab
+// 4. Otherwise, if the slab is not full, return the cell at the end of the currently used region of
+//    the slab, updating the slab
+// 5. Otherwise, release the slab from the partial tree/heap, marking it as 'floating' and go back to
+//    step 1
+//
+{
+	for (;;)
+	{
+		slab *s = ss.partial;
+		if (!s)
+			break;
+		unsigned h = s->header;
+		unsigned free = h & 0xff;		// extract free cell positiong
+		if (free)
+		{
+			ASSERT(((free<<2)-sizeof(slabhdr))%header_size(h) == 0);
+			void* p = offset(s,free<<2);
+			free = *(unsigned char*)p;	// get next pos in free list
+			h += (h&0x3C000)<<6;		// update usedm4
+			h &= ~0xff;
+			h |= free;					// update freelist
+			s->header = h;
+			ASSERT(header_free(h) == 0 || ((header_free(h)<<2)-sizeof(slabhdr))%header_size(h) == 0);
+			ASSERT(header_usedm4(h) <= 0x3F8u);
+			ASSERT((header_usedm4(h)+4)%header_size(h) == 0);
+			return p;
+		}
+		unsigned h2 = h + ((h&0x3C000)<<6);
+		if (h2 < 0xfc00000)
+		{
+			ASSERT((header_usedm4(h2)+4)%header_size(h2) == 0);
+			s->header = h2;
+			return offset(s,(h>>18) + sizeof(unsigned) + sizeof(slabhdr));
+		}
+		h |= 0x80000000;				// mark the slab as full-floating
+		s->header = h;
+		tree_remove(s);
+		checktree(ss.partial);
+		// go back and try the next slab...
+	}
+	// no partial slabs found, so allocate from a new slab
+	return allocnewslab(ss);
+}
+void RSymbianDLHeap::slab_free(void* p)
+//
+// Free a cell from the slab allocator
+// Strategy:
+// 1. Find the containing slab (round down to nearest 1KB boundary)
+// 2. Push the cell into the slab's freelist, and update the slab usage count
+// 3. If this is the last allocated cell, free the slab to the main slab manager
+// 4. If the slab was full-floating then insert the slab in it's respective partial tree
+//
+{
+	ASSERT(lowbits(p,3)==0);
+	slab* s = slab::slabfor(p);
+
+	unsigned pos = lowbits(p, slabsize);
+	unsigned h = s->header;
+	ASSERT(header_usedm4(h) != 0x3fC);		// slab is empty already
+	ASSERT((pos-sizeof(slabhdr))%header_size(h) == 0);
+	*(unsigned char*)p = (unsigned char)h;
+	h &= ~0xFF;
+	h |= (pos>>2);
+	unsigned size = h & 0x3C000;
+	if (int(h) >= 0)
+	{
+		h -= size<<6;
+		if (int(h)>=0)
+		{
+			s->header = h;
+			return;
+		}
+		freeslab(s);
+		return;
+	}
+	h -= size<<6;
+	h &= ~0x80000000;
+	s->header = h;
+	slabset& ss = slaballoc[sizemap[size>>14]];
+	tree_insert(s,&ss.partial);
+	checktree(ss.partial);
+}
+
+void* slabset::initslab(slab* s)
+//
+// initialise an empty slab for this allocator and return the fist cell
+// pre-condition: the slabset has no partial slabs for allocation
+//
+{
+	ASSERT(partial==0);
+	unsigned h = s->header & 0xF00;	// preserve pagemap only
+	h |= (size<<12);					// set size
+	h |= (size-4)<<18;					// set usedminus4 to one object minus 4
+	s->header = h;
+	partial = s;
+	s->parent = &partial;
+	s->child1 = s->child2 = 0;
+	return offset(s,sizeof(slabhdr));
+}
+
+TAny* RSymbianDLHeap::SetBrk(TInt32 aDelta)
+{
+	if (iFlags & EFixedSize)
+		return MFAIL;
+
+	if (aDelta < 0)
+		{
+		unmap(offset(iTop, aDelta), -aDelta);
+		}
+	else if (aDelta > 0)
+		{
+		if (!map(iTop, aDelta))
+			return MFAIL;
+		}
+	void * p =iTop;
+	iTop = offset(iTop, aDelta);
+	
+	return p;
+}
+
+void* RSymbianDLHeap::map(void* p,unsigned sz)
+//
+// allocate pages in the chunk
+// if p is NULL, find an allocate the required number of pages (which must lie in the lower half)
+// otherwise commit the pages specified
+//
+{
+ASSERT(p == floor(p, pagesize));
+ASSERT(sz == ceiling(sz, pagesize));
+ASSERT(sz > 0);
+
+	if (iChunkSize + sz > iMaxLength)
+		return 0;
+
+	RChunk chunk;
+	chunk.SetHandle(iChunkHandle);
+	if (p)
+	{
+		TInt r = chunk.Commit(iOffset + ptrdiff(p, this),sz);
+		if (r < 0)
+			return 0;
+		ASSERT(p = offset(this, r - iOffset));
+		iChunkSize += sz;	
+		return p;
+	}
+
+	TInt r = chunk.Allocate(sz);
+	if (r < 0)
+		return 0;
+	if (r > iOffset)
+	{
+		// can't allow page allocations in DL zone
+		chunk.Decommit(r, sz);
+		return 0;
+	}
+	iChunkSize += sz;
+	
+	TraceChunkUsage(iChunkHandle, iBase, iChunkSize);
+	
+	return offset(this, r - iOffset);
+}
+
+void* RSymbianDLHeap::remap(void* p,unsigned oldsz,unsigned sz)
+{
+	if (oldsz > sz)
+		{	// shrink
+		unmap(offset(p,sz), oldsz-sz);
+		}
+	else if (oldsz < sz)
+		{	// grow, try and do this in place first
+		if (!map(offset(p, oldsz), sz-oldsz))
+			{
+			// need to allocate-copy-free
+			void* newp = map(0, sz);
+			memcpy(newp, p, oldsz);
+			unmap(p,oldsz);
+			return newp;
+			}
+		}
+	return p;
+}
+
+void RSymbianDLHeap::unmap(void* p,unsigned sz)
+{
+	ASSERT(p == floor(p, pagesize));
+	ASSERT(sz == ceiling(sz, pagesize));
+	ASSERT(sz > 0);
+
+	RChunk chunk;
+	chunk.SetHandle(iChunkHandle);
+	TInt r = chunk.Decommit(ptrdiff(p, offset(this,-iOffset)), sz);
+	//TInt offset = (TUint8*)p-(TUint8*)chunk.Base();
+	//TInt r = chunk.Decommit(offset,sz);
+
+	ASSERT(r >= 0);
+	iChunkSize -= sz;
+	
+	TraceChunkUsage(iChunkHandle, iBase, iChunkSize);
+}
+
+void RSymbianDLHeap::paged_init(unsigned pagepower)
+	{
+		if (pagepower == 0)
+			pagepower = 31;
+		else if (pagepower < minpagepower)
+			pagepower = minpagepower;
+		page_threshold = pagepower;
+		for (int i=0;i<npagecells;++i)
+		{
+			pagelist[i].page = 0;
+			pagelist[i].size = 0;
+		}
+	}
+
+void* RSymbianDLHeap::paged_allocate(unsigned size)
+{
+	unsigned nbytes = ceiling(size, pagesize);
+	if (nbytes < size + cellalign)
+	{	// not enough extra space for header and alignment, try and use cell list
+		for (pagecell *c = pagelist,*e = c + npagecells;c < e;++c)
+			if (c->page == 0)
+			{
+				void* p = map(0, nbytes);
+				if (!p)
+					return 0;
+				c->page = p;
+				c->size = nbytes;
+				return p;
+			}
+	}
+	// use a cell header
+	nbytes = ceiling(size + cellalign, pagesize);
+	void* p = map(0, nbytes);
+	if (!p)
+		return 0;
+	*static_cast<unsigned*>(p) = nbytes;
+	return offset(p, cellalign);
+}
+
+void* RSymbianDLHeap::paged_reallocate(void* p, unsigned size)
+{
+	if (lowbits(p, pagesize) == 0)
+	{	// continue using descriptor
+		pagecell* c = paged_descriptor(p);
+		unsigned nbytes = ceiling(size, pagesize);
+		void* newp = remap(p, c->size, nbytes);
+		if (!newp)
+			return 0;
+		c->page = newp;
+		c->size = nbytes;
+		return newp;
+	}
+	else
+	{	// use a cell header
+		ASSERT(lowbits(p,pagesize) == cellalign);
+		p = offset(p,-int(cellalign));
+		unsigned nbytes = ceiling(size + cellalign, pagesize);
+		unsigned obytes = *static_cast<unsigned*>(p);
+		void* newp = remap(p, obytes, nbytes);
+		if (!newp)
+			return 0;
+		*static_cast<unsigned*>(newp) = nbytes;
+		return offset(newp, cellalign);
+	}
+}
+
+void RSymbianDLHeap::paged_free(void* p)
+{
+	if (lowbits(p,pagesize) == 0)
+	{	// check pagelist
+		pagecell* c = paged_descriptor(p);
+		unmap(p, c->size);
+		c->page = 0;
+		c->size = 0;
+	}
+	else
+	{	// check page header
+		unsigned* page = static_cast<unsigned*>(offset(p,-int(cellalign)));
+		unsigned size = *page;
+		unmap(page,size);
+	}
+}
+
+pagecell* RSymbianDLHeap::paged_descriptor(const void* p) const
+{
+	ASSERT(lowbits(p,pagesize) == 0);
+	// Double casting to keep the compiler happy. Seems to think we can trying to
+	// change a non-const member (pagelist) in a const function
+	pagecell* c = (pagecell*)((void*)pagelist);
+	pagecell* e = c + npagecells;
+	for (;;)
+	{
+		ASSERT(c!=e);
+		if (c->page == p)
+			return c;
+		++c;
+	}
+}
+
+#endif
--- a/webengine/osswebengine/WebCore/dom/CharacterData.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/dom/CharacterData.cpp	Fri May 08 08:25:06 2009 +0300
@@ -156,8 +156,9 @@
     if ((!renderer() || !rendererIsNeeded(renderer()->style())) && attached()) {
         detach();
         attach();
-    } else if (renderer())
-        static_cast<RenderText*>(renderer())->setTextWithOffset(str, offset, count);
+    } else if (renderer()){
+    	static_cast<RenderText*>(renderer())->setTextWithOffset(str, offset, count, false, true);
+    }
 
     dispatchModifiedEvent(oldStr);
     oldStr->deref();
--- a/webengine/osswebengine/WebCore/html/HTMLParser.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/html/HTMLParser.cpp	Fri May 08 08:25:06 2009 +0300
@@ -169,6 +169,9 @@
     m_isindexElement = 0;
 
     m_skipModeTag = nullAtom;
+#if PLATFORM(SYMBIAN)
+    m_scriptSupported = true;
+#endif
 }
 
 void HTMLParser::setCurrent(Node* newCurrent) 
@@ -773,8 +776,19 @@
 {
     if (!m_isParsingFragment) {
         Settings* settings = document->settings();
-        if (settings && settings->isJavaScriptEnabled())
+#if PLATFORM(SYMBIAN)
+        if (m_scriptSupported && settings && settings->isJavaScriptEnabled()) {
             setSkipMode(noscriptTag);
+        }
+        else {
+            m_scriptSupported = true;
+            return false;
+        }
+#else    
+        if (settings && settings->isJavaScriptEnabled()) {
+            setSkipMode(noscriptTag);
+        }
+#endif
     }
     return true;
 }
--- a/webengine/osswebengine/WebCore/html/HTMLParser.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/html/HTMLParser.h	Fri May 08 08:25:06 2009 +0300
@@ -69,6 +69,9 @@
 
     bool skipMode() const { return !m_skipModeTag.isNull(); }
     bool isHandlingResidualStyleAcrossBlocks() const { return m_handlingResidualStyleAcrossBlocks; }
+#if PLATFORM(SYMBIAN)
+    void setScriptOk( bool scriptSupported ) { m_scriptSupported = scriptSupported; }
+#endif
 
 private:
     void setCurrent(Node*);
@@ -159,6 +162,9 @@
     bool m_reportErrors;
     bool m_handlingResidualStyleAcrossBlocks;
     int inStrayTableContent;
+#if PLATFORM(SYMBIAN)
+    bool m_scriptSupported;
+#endif
 };
 
 }
--- a/webengine/osswebengine/WebCore/html/HTMLTokenizer.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/html/HTMLTokenizer.cpp	Fri May 08 08:25:06 2009 +0300
@@ -491,6 +491,16 @@
             setSrc(SegmentedString());
             state = scriptExecution(exScript, state, DeprecatedString::null, scriptStartLineno);
         }
+#if PLATFORM(SYMBIAN)
+        else
+        {
+            // script was not executed for possible reasons: either configured
+            // not to, or type not supported.     
+            // set the script_ok flag in parser to false, so that noscript
+            // can be handled and displayed.
+            parser->setScriptOk( false );
+        }
+#endif
     }
 
     if (!m_executingScript && !state.loadingExtScript()) {
--- a/webengine/osswebengine/WebCore/loader/DocLoader.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/loader/DocLoader.cpp	Fri May 08 08:25:06 2009 +0300
@@ -294,7 +294,9 @@
     ListHashSet<CachedResource*>::iterator end = m_preloads.end();
     for (ListHashSet<CachedResource*>::iterator it = m_preloads.begin(); it != end; ++it) {
         CachedResource* res = *it;
-        if (res->preloadResult() == CachedResource::PreloadNotReferenced)
+        if (res->canDelete() && !res->inCache())  
+	            delete res;  
+        else if (res->preloadResult() == CachedResource::PreloadNotReferenced) 
             cache()->remove(res);
         res->decreasePreloadCount();
     }
--- a/webengine/osswebengine/WebCore/page/symbian/WebCoreGraphicsContext.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/page/symbian/WebCoreGraphicsContext.cpp	Fri May 08 08:25:06 2009 +0300
@@ -1,30 +1,20 @@
 /*
- * Copyright (c) 2005 Nokia Corporation, Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Nokia Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
+
 
 #include "config.h"
 #include "WebCoreGraphicsContext.h"
--- a/webengine/osswebengine/WebCore/platform/Font.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/Font.h	Fri May 08 08:25:06 2009 +0300
@@ -183,7 +183,7 @@
     }
 #endif
     static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; }
-    static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f; }
+    static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f || c == 0x200b; }
 private:
     FontDescription m_fontDescription;
 #if !PLATFORM(QT)
--- a/webengine/osswebengine/WebCore/platform/graphics/symbian/GraphicsContextSymbian.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/graphics/symbian/GraphicsContextSymbian.cpp	Fri May 08 08:25:06 2009 +0300
@@ -373,14 +373,14 @@
 
     int x = xForm(rect.x());
     int y = xForm(rect.y());
-    float w = (float)rect.width();
+    float w = xForm((float)rect.width());
 
     // starting point & end point
     float r = w/2;
     float fa = startAngle;
-    TPoint ps( x + r*cos(-fa * M_PI/180), y + r*sin( -fa * M_PI/180 ) );
+    TPoint ps( x + r + r*cos(fa * M_PI/180), y + r - r*sin( fa * M_PI/180 ) );
     fa += angleSpan;
-    TPoint pe( x + r*cos(-fa * M_PI/180), y + r*sin( -fa * M_PI/180 ) );
+    TPoint pe( x + r + r*cos(fa * M_PI/180), y + r - r*sin( fa * M_PI/180 ) );
 
     setPenColor( context, strokeColor() );
     gc.DrawArc( xForm(rect), ps, pe );
--- a/webengine/osswebengine/WebCore/platform/graphics/symbian/ImageSymbian.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/graphics/symbian/ImageSymbian.cpp	Fri May 08 08:25:06 2009 +0300
@@ -325,6 +325,9 @@
 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, CompositeOperator op)
 {
     WebCoreGraphicsContext* context = ctxt->platformContext();
+	if (!context) {
+          return;
+	}
 
     CMaskedBitmap* bm = frameAtIndex(m_currentFrame);
     if (!bm) // If it's too early we won't have an BitmapImage yet.
--- a/webengine/osswebengine/WebCore/platform/graphics/symbian/ZoomFactor.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/graphics/symbian/ZoomFactor.h	Fri May 08 08:25:06 2009 +0300
@@ -1,27 +1,19 @@
 /*
- * Copyright (C) 2007 Nokia
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  
+*
+*/
 
 #ifndef __ZOOMFACTOR_H__
 #define __ZOOMFACTOR_H__
--- a/webengine/osswebengine/WebCore/platform/network/symbian/DataConnection.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/DataConnection.cpp	Fri May 08 08:25:06 2009 +0300
@@ -155,8 +155,8 @@
             if( !ok ) { // if not base64, simple copy
                 if( !body ) {
                     body = HBufC8::NewLC( data.Length() );
+                    body->Des().Copy( data );
                 }
-                body->Des().Copy( data );
             }
         }
     }
--- a/webengine/osswebengine/WebCore/platform/network/symbian/HttpSessionManager.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/HttpSessionManager.cpp	Fri May 08 08:25:06 2009 +0300
@@ -109,6 +109,10 @@
 		RStringF batchingBuffSize = strP.StringF(HTTP::EBatchingBufferSize, stringTable );
 		connInfo.SetPropertyL( batchingBuffSize, THTTPHdrVal(KHttpBatchingBuffSize));
 
+		//set HTTP socket prioritis to high
+		THTTPHdrVal enableTranspHndlrPriority(strP.StringF(HTTP::EEnableTranspHndlrPriority, RHTTPSession::GetTable()));
+		connInfo.SetPropertyL(strP.StringF(HTTP::ETranspHndlrPriority, RHTTPSession::GetTable()), enableTranspHndlrPriority);
+
 
         strP.OpenL( HttpFilterCommonStringsExt::GetTable() );
         strP.OpenL( HttpFilterCommonStringsExt::GetLanguageTable() );
--- a/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.cpp	Fri May 08 08:25:06 2009 +0300
@@ -1,30 +1,19 @@
 /*
- * Copyright (C) 2006 Enrico Ros <enrico.ros@m31engineering.it>
- * Copyright (C) 2006 Trolltech ASA
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CResourceHandleManager
+*
+*/
 
 #include "config.h"
 
--- a/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleManagerSymbian.h	Fri May 08 08:25:06 2009 +0300
@@ -1,30 +1,19 @@
 /*
- * Copyright (C) 2006 Enrico Ros <enrico.ros@m31engineering.it>
- * Copyright (C) 2006 Trolltech ASA
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CResourceHandleManager
+*
+*/
 
 #ifndef ResourceHandleManagerSymbian_H
 #define ResourceHandleManagerSymbian_H
--- a/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleSymbian.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/ResourceHandleSymbian.cpp	Fri May 08 08:25:06 2009 +0300
@@ -1,29 +1,19 @@
 /*
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ResourceHandle
+*
+*/
 
 #include "config.h"
 
--- a/webengine/osswebengine/WebCore/platform/network/symbian/ResourceRequest.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/ResourceRequest.h	Fri May 08 08:25:06 2009 +0300
@@ -1,29 +1,20 @@
-// -*- mode: c++; c-basic-offset: 4 -*-
 /*
- * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ResourceRequest
+*
+*/
+
 
 #ifndef ResourceRequest_h
 #define ResourceRequest_h
--- a/webengine/osswebengine/WebCore/platform/network/symbian/UnknownContentHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/UnknownContentHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -1,30 +1,19 @@
 /*
- * Copyright (C) 2008 Nokia, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UnknownContentHandler
+*
+*/
 
 
 #include "UnknownContentHandler.h"
--- a/webengine/osswebengine/WebCore/platform/network/symbian/UnknownContentHandler.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/network/symbian/UnknownContentHandler.h	Fri May 08 08:25:06 2009 +0300
@@ -1,30 +1,19 @@
 /*
- * Copyright (C) 2007 Nokia, Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  UnknownContentHandler
+*
+*/
 
 #ifndef __UNKNOWNCONTENTHANDLER_H__
 #define __UNKNOWNCONTENTHANDLER_H__
--- a/webengine/osswebengine/WebCore/platform/symbian/FontSymbian.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/symbian/FontSymbian.cpp	Fri May 08 08:25:06 2009 +0300
@@ -128,7 +128,9 @@
             // and replace them with regular spaces. otherwise they show up as boxes.
             if (indexOfFirstNonRegularSpace > -1) {
                 for(; indexOfFirstNonRegularSpace<strLength; ++indexOfFirstNonRegularSpace ) {
-                    if( TChar(newStr[indexOfFirstNonRegularSpace]).IsSpace() ) {
+                	// if ZERO WIDTH SPACE found do not replace it with regular space
+                    if( TChar(newStr[indexOfFirstNonRegularSpace]).IsSpace() && 
+                    	!(Font::treatAsZeroWidthSpace (newStr[indexOfFirstNonRegularSpace]))) {
                         newStr[indexOfFirstNonRegularSpace] = ' ';
                     }
                 }
--- a/webengine/osswebengine/WebCore/platform/symbian/StaticObjectsContainer.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/symbian/StaticObjectsContainer.cpp	Fri May 08 08:25:06 2009 +0300
@@ -59,6 +59,7 @@
     ,m_capabilities(0)
     ,m_oomHandler(0)
     ,m_fullScreenMode(false)
+    ,m_pluginFullscreen(false)
 {
     // Check the device resolution
     CEikonEnv* eikEnv = CEikonEnv::Static();
--- a/webengine/osswebengine/WebCore/platform/symbian/StaticObjectsContainer.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/symbian/StaticObjectsContainer.h	Fri May 08 08:25:06 2009 +0300
@@ -66,6 +66,8 @@
     WebCursor* webCursor();
     WebCannedImages* webCannedImages();
     PluginHandler* pluginHandler();
+    void setPluginFullscreen(bool val) { m_pluginFullscreen = val; }
+    bool isPluginFullscreen() { return m_pluginFullscreen; }
 
     virtual ~StaticObjectsContainer();
 
@@ -98,6 +100,7 @@
     Vector<CBrCtl*>         m_activeBrCtls;
     OOMHandler*             m_oomHandler;
     bool                    m_fullScreenMode;
+    bool                    m_pluginFullscreen;
 };
 
 }
--- a/webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/platform/symbian/bitmap/MaskedBitmap.cpp	Fri May 08 08:25:06 2009 +0300
@@ -456,11 +456,19 @@
     {
     if (!HasMask()) 
         {
-        gc.UseBrushPattern(iBitmap);
-        gc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
-        gc.SetBrushOrigin(srcPt);
-        gc.DrawRect(bmpRect);
-        gc.DiscardBrushPattern();
+        TRAP_IGNORE( 
+            CFbsBitGc* copy = CFbsBitGc::NewL();
+            CleanupStack::PushL( copy );
+            copy->Activate( (CFbsDevice*) gc.Device() );
+            copy->CopySettings( gc );
+            copy->UseBrushPattern(iBitmap);
+            copy->SetPenStyle(CGraphicsContext::ENullPen);
+            copy->SetBrushStyle(CGraphicsContext::EPatternedBrush);
+            copy->SetBrushOrigin(srcPt);
+            copy->DrawRect(bmpRect);
+            copy->DiscardBrushPattern();
+            CleanupStack::PopAndDestroy( copy );
+        );
         }
     else 
         {
--- a/webengine/osswebengine/WebCore/rendering/RenderText.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/rendering/RenderText.cpp	Fri May 08 08:25:06 2009 +0300
@@ -769,7 +769,7 @@
     containingBlock()->setSelectionState(state);
 }
 
-void RenderText::setTextWithOffset(PassRefPtr<StringImpl> text, unsigned offset, unsigned len, bool force)
+void RenderText::setTextWithOffset(PassRefPtr<StringImpl> text, unsigned offset, unsigned len, bool force, bool backspace)
 {
     unsigned oldLen = textLength();
     unsigned newLen = text->length();
@@ -831,7 +831,7 @@
     }
 
     m_linesDirty = dirtiedLines;
-    setText(text, force);
+    setText(text, force, backspace);
 }
 
 static inline bool isInlineFlowOrEmptyText(RenderObject* o)
@@ -860,7 +860,7 @@
     return prev;
 }
 
-void RenderText::setTextInternal(PassRefPtr<StringImpl> text)
+void RenderText::setTextInternal(PassRefPtr<StringImpl> text, bool backspace)
 {
     m_text = text;
     ASSERT(m_text);
@@ -924,7 +924,13 @@
                 m_text = m_text->secureShowLast(whiteBullet);
                 break;
             case TSDISC:
-                m_text = m_text->secureShowLast(bullet);
+                if(backspace){
+                	m_text = m_text->secure(bullet);
+                }
+                else{
+                	m_text = m_text->secureShowLast(bullet);
+                }
+                	
                 break;
             case TSSQUARE:
                 m_text = m_text->secureShowLast(blackSquare);
@@ -960,14 +966,14 @@
     m_isAllASCII = charactersAreAllASCII(m_text.get());
 }
 
-void RenderText::setText(PassRefPtr<StringImpl> text, bool force)
+void RenderText::setText(PassRefPtr<StringImpl> text, bool force, bool backspace)
 {
     ASSERT(text);
 
     if (!force && equal(m_text.get(), text.get()))
         return;
 
-    setTextInternal(text);
+    setTextInternal(text, backspace);
     setNeedsLayoutAndPrefWidthsRecalc();
 }
 
--- a/webengine/osswebengine/WebCore/rendering/RenderText.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebCore/rendering/RenderText.h	Fri May 08 08:25:06 2009 +0300
@@ -97,8 +97,8 @@
 
     virtual short verticalPositionHint(bool firstLine) const;
 
-    void setText(PassRefPtr<StringImpl>, bool force = false);
-    void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len, bool force = false);
+    void setText(PassRefPtr<StringImpl>, bool force = false, bool backspace = false);
+    void setTextWithOffset(PassRefPtr<StringImpl>, unsigned offset, unsigned len, bool force = false, bool backspace = false);
 
     virtual bool canBeSelectionLeaf() const { return true; }
     virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
@@ -132,7 +132,7 @@
     void checkConsistency() const;
 
 protected:
-    virtual void setTextInternal(PassRefPtr<StringImpl>);
+    virtual void setTextInternal(PassRefPtr<StringImpl>, bool backspace = false);
     virtual void calcPrefWidths(int leadWidth);
     virtual UChar previousCharacter();
 
--- a/webengine/osswebengine/WebKit/s60/misc/WebTabbedNavigation.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/misc/WebTabbedNavigation.cpp	Fri May 08 08:25:06 2009 +0300
@@ -224,6 +224,10 @@
                 StaticObjectsContainer::instance()->webCursor()->updatePositionAndElemType(m_focusPosition - m_webView->mainFrame()->frameView()->contentPos());
                 ret = true;
             }
+            else
+            {
+                m_focusPosition = oldFocusPoint;
+            }
         }
     }
     StaticObjectsContainer::instance()->webCursor()->cursorUpdate(true);
--- a/webengine/osswebengine/WebKit/s60/misc/WebUtil.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/misc/WebUtil.cpp	Fri May 08 08:25:06 2009 +0300
@@ -83,32 +83,32 @@
     }
     else if ( e->hasLocalName(aTag) ) {
         elType = TBrCtlDefs::EElementAnchor;
-        
+
         String href = e->getAttribute( hrefAttr );
         if (!href.isNull()) {
-            
-            if( href.startsWith( KTel ) ) {            
+
+            if( href.startsWith( KTel ) ) {
                 elType = TBrCtlDefs::EElementTelAnchor;
             }
             else if( href.startsWith( KWtai ) ) {
-            
+
                 if( href.startsWith( KWtaiMC ) || href.startsWith(KWtaiAP) || href.startsWith(KWtaiSD) ) {
                     elType = TBrCtlDefs::EElementTelAnchor;
-                }                    
-                    
+                }
+
             }
             else if( href.startsWith( KMailto ) ) {
                 elType = TBrCtlDefs::EElementMailtoAnchor;
             }
 
-    
+
         }
         else if (!e->getAttribute( ctiAttr ).isNull()) {
-            elType = TBrCtlDefs::EElementTelAnchor;                
+            elType = TBrCtlDefs::EElementTelAnchor;
         }
-        else if( e->hasLocalName(areaTag) ) {        
-        
-            elType = TBrCtlDefs::EElementInputBox;                        
+        else if( e->hasLocalName(areaTag) ) {
+
+            elType = TBrCtlDefs::EElementInputBox;
         }
     }
     else if (e->isControl()) {
@@ -138,7 +138,7 @@
             }
         }
         else if (ie->type() == "textarea")
-            elType = TBrCtlDefs::EElementTextAreaBox;            
+            elType = TBrCtlDefs::EElementTextAreaBox;
     }
     else if( e->hasLocalName(objectTag) || e->hasLocalName(embedTag) ) {
         if( e->renderer() && e->renderer()->isWidget() )
@@ -160,23 +160,23 @@
 
 
 WebFrame* frameAndPointUnderCursor(IntPoint& p_, WebView& v_)
-{    
+{
     WebFrameView* mfv = v_.mainFrame()->frameView();
     p_ = StaticObjectsContainer::instance()->webCursor()->position();
     WebFrame* frame = v_.mainFrame()->frameAtPoint(p_);
-    if (!frame) 
+    if (!frame)
         frame = v_.mainFrame();
-    IntPoint rc = frame->frameView()->rectInGlobalCoords().iTl;    
+    IntPoint rc = frame->frameView()->rectInGlobalCoords().iTl;
     p_ = frame->frameView()->viewCoordsInFrameCoords(p_);
     return frame;
 }
 
 String getNodeUrlAtPointInFrame(WebFrame& f_, IntPoint& p_)
-{    
+{
     Document* doc = core(&f_)->document();
     if (doc) {
         Node* node = doc->elementFromPoint(p_.x(), p_.y());
-        
+
         if (node) {
             if (node->hasTagName(areaTag)) {
                 HTMLElement* e =  static_cast<HTMLElement*>(node);
@@ -189,29 +189,29 @@
             for (; n; n = n->parentNode())
                 if (n->isFocusable() && n->isElementNode())
                     break;
-        
+
             if (n && n->isFocusable() && n->isElementNode()) {
-                HTMLElement* e =  static_cast<HTMLElement*>(n);            
+                HTMLElement* e =  static_cast<HTMLElement*>(n);
                 if (!e->getAttribute(hrefAttr).isNull()) {
-                    return e->getAttribute(hrefAttr);                
+                    return e->getAttribute(hrefAttr);
                 }
             }
         }
     }
-    return String();   
+    return String();
 }
 
 
 int imageCountInFrame(WebFrame& wf_, bool visibleOnly_)
-{        
+{
     int count = 0;
     Frame* f = core(&wf_);
-    
+
     if (!f || !f->document() || !f->document()->renderer())
         return count;
-    
-    Document* doc = f->document();    
-    RefPtr<WebCore::HTMLCollection> collection = doc->images();         
+
+    Document* doc = f->document();
+    RefPtr<WebCore::HTMLCollection> collection = doc->images();
 
     FrameView* v = doc->view();
     IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect();
@@ -221,20 +221,20 @@
         RenderImage* render = static_cast<RenderImage*>(n->renderer());
         if (render) {
 
-            Image* img = render->image();     
-            if (!img->isNull() && img->data()) { 
+            Image* img = render->image();
+            if (!img->isNull() && img->data()) {
                 //if visible only is true, check for intersection
-                bool processing = true;                    
+                bool processing = true;
                 if (visibleOnly_) {
                     IntRect imageRect;
                     IntPoint tl = wf_.frameView()->frameCoordsInViewCoords(n->getRect().topLeft());
                     IntPoint br = wf_.frameView()->frameCoordsInViewCoords(n->getRect().bottomRight());
                     imageRect.setLocation(tl);
                     imageRect.setSize(br-tl);
-                    
+
                     processing = r1.intersects(imageRect);
                 }
-                if (processing) {                    
+                if (processing) {
                     String alttext = static_cast<HTMLImageElement*>(render->element())->altText();
                     // Check if alttext is "Nokia" or "No_save".
                     // Then do not count
@@ -249,52 +249,52 @@
 }
 
 CArrayFixFlat<TBrCtlImageCarrier>* imagesInFrame(WebFrame& wf_, bool visibleOnly_)
-{    
+{
     CArrayFixFlat<TBrCtlImageCarrier>* imglist = new CArrayFixFlat<TBrCtlImageCarrier>(10);
     Frame* f = core(&wf_);
-    
+
     if (!f || !f->document() || !f->document()->renderer())
         return imglist;
 
     CleanupStack::PushL(imglist);
 
-    Document* doc = f->document();    
+    Document* doc = f->document();
     FrameView* v = doc->view();
     IntRect r1 = wf_.frameView()->topView()->mainFrame()->frameView()->rect();
-    
+
 
-    RefPtr<WebCore::HTMLCollection> collection = doc->images();         
+    RefPtr<WebCore::HTMLCollection> collection = doc->images();
     for (Node* n = collection->firstItem(); n; n = collection->nextItem()) {
 
         RenderImage* render = static_cast<RenderImage*>(n->renderer());
-        if (render) {               
-            Image* img = render->image();     
-            if (!img->isNull() && img->data()) { 
+        if (render) {
+            Image* img = render->image();
+            if (!img->isNull() && img->data()) {
                 //if visible only is true, check for intersection
-                TBool processing = ETrue;                    
+                TBool processing = ETrue;
                 if (visibleOnly_) {
                     IntRect imageRect;
                     IntPoint tl = wf_.frameView()->frameCoordsInViewCoords(n->getRect().topLeft());
                     IntPoint br = wf_.frameView()->frameCoordsInViewCoords(n->getRect().bottomRight());
                     imageRect.setLocation(tl);
                     imageRect.setSize(br-tl);
-                    
+
                     processing = r1.intersects(imageRect);
                 }
-                if (processing) {                    
+                if (processing) {
                     String alttext = static_cast<HTMLImageElement*>(render->element())->altText();
-                    TBrCtlImageType type = EImageTypeAny; 
+                    TBrCtlImageType type = EImageTypeAny;
                     if (img->getMimeType().find("image/vnd.wap.wbmp") == 0)
-                        type = EImageTypeWbmp; 
+                        type = EImageTypeWbmp;
                     else if (img->getMimeType().find("image/vnd.nokia.ota-bitmap") == 0)
-                        type = EImageTypeOta; 
+                        type = EImageTypeOta;
                     //
-                    TBrCtlImageCarrier tImg(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()), 
+                    TBrCtlImageCarrier tImg(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()),
                         static_cast<HTMLImageElement*>(render->element())->getAttribute(srcAttr),
                         alttext, type, img->getMimeType());
 
                     // Check if alttext is "Nokia" or "No_save".
-                    // Then do not add the image to the list                
+                    // Then do not add the image to the list
                     if (!(equalIgnoringCase(alttext, "nokia") || equalIgnoringCase(alttext, "no_save"))) {
                         // Check if this image has been retrieved before.
                         // Image pointer should be the same for similar images
@@ -310,36 +310,36 @@
                         if (!imgexists)
                             imglist->AppendL(tImg);
                     }
-                }                
+                }
             }
-        }                        
+        }
     }
     CleanupStack::Pop(imglist);
-    return imglist; 
+    return imglist;
 }
 
 CArrayFixFlat<TBrCtlSubscribeTo>* findSubscribeToInFrame(WebFrame& wf_)
 {
     CArrayFixFlat<TBrCtlSubscribeTo>* linkList = new CArrayFixFlat<TBrCtlSubscribeTo>(10);
     Frame* f = core(&wf_);
-    
+
     if (!f || !f->document())
         return linkList;
 
     CleanupStack::PushL(linkList);
     for (Node *n = f->document(); n; n = n->traverseNextNode()) {
-        if (n->isElementNode() && n->hasTagName(linkTag)) {                
+        if (n->isElementNode() && n->hasTagName(linkTag)) {
 
-            HTMLElement* e =  static_cast<HTMLElement*>(n);           
+            HTMLElement* e =  static_cast<HTMLElement*>(n);
             String type = e->getAttribute(typeAttr);
 
-            if (type == "application/rss+xml" || type == "application/atom+xml" || 
+            if (type == "application/rss+xml" || type == "application/atom+xml" ||
                 type == "text/xml" || type == "application/xml") {
                 String href = e->getAttribute(hrefAttr);
                 String title = e->getAttribute(titleAttr);
 
-                TBrCtlSubscribeTo item(title.des(), href.des(), 0);       
-                linkList->AppendL(item);                
+                TBrCtlSubscribeTo item(title.des(), href.des(), 0);
+                linkList->AppendL(item);
             }
         }
     }
@@ -353,7 +353,7 @@
     TBrCtlImageCarrier* t = NULL;
     RenderImage *r = renderImageUnderCursor(webView);
     if (r) {
-        Image* img = r->image();     
+        Image* img = r->image();
         CachedImage* ci = r->cachedImage();
         if( ci && !img->isNull()) {
             SharedBuffer* imgData = img->data();
@@ -374,7 +374,7 @@
                         else if ( img->getMimeType().des().Find(KMimeOTA) != KErrNotFound ) {
                             brCtlTtype = EImageTypeOta;
                         }
-                        t = new TBrCtlImageCarrier(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()), 
+                        t = new TBrCtlImageCarrier(TPtrC8((const TUint8*)img->data()->data(),img->data()->size()),
                             static_cast<HTMLImageElement*>(r->element())->getAttribute(srcAttr),
                             alttext, brCtlTtype, img->getMimeType());
                         if (!t) {
@@ -414,7 +414,7 @@
         CachedImage* ci = r->cachedImage();
         if (ci && ci->status() == CachedResource::Unknown) {
             IntPoint p;
-            WebFrame* frame = frameAndPointUnderCursor(p, *webView);            
+            WebFrame* frame = frameAndPointUnderCursor(p, *webView);
             cache()->loader()->load(core(frame)->document()->docLoader(), ci, true);
         }
     }
@@ -428,20 +428,20 @@
     RenderImage* render = NULL;
     if (!f || !f->document() || !f->document()->renderer())
         return NULL;
-    Document* doc = f->document();    
+    Document* doc = f->document();
     FrameView* v = doc->view();
-    RefPtr<WebCore::HTMLCollection> collection = doc->images();         
+    RefPtr<WebCore::HTMLCollection> collection = doc->images();
     for (Node* n = collection->firstItem(); n; n = collection->nextItem()) {
         render = static_cast<RenderImage*>(n->renderer());
-        if (render) {               
-            Image* img = render->image();     
-            if (!img->isNull()) { 
+        if (render) {
+            Image* img = render->image();
+            if (!img->isNull()) {
                 //if visible only is true, check for intersection
                 if (n->getRect().contains(p)) {
                     return render;
-                }                
+                }
             }
-        }                        
+        }
     }
     return NULL;
 }
@@ -490,7 +490,7 @@
     menuPane.InsertMenuItemL(item, 0);
 }
 
-int textMultiplier(int fontLevel, int originalSize) 
+int textMultiplier(int fontLevel, int originalSize)
 {
     int sizeMultiplier = originalSize;
     switch(fontLevel)
@@ -550,7 +550,7 @@
                     for (; n; n = n->parentNode())
                         if (n->isFocusable() && n->isElementNode())
                             break;
-        
+
                     if (n && n->isFocusable() && n->isElementNode()) {
                         HTMLElement* e =  static_cast<HTMLElement*>(n);
                         String tel;
@@ -587,14 +587,14 @@
                         // telbook
                         attr = e->getAttribute(telbookAttr);
                         if (!attr.isNull() && !attr.isEmpty() )
-                            telbook = attr;            
+                            telbook = attr;
                         // Save to phone book
-                        String url;            
+                        String url;
                         String makeCallUrlPrefix("wtai://wp/ap;");
-                        char numberNameSeparator = ';';            
-                        int len = makeCallUrlPrefix.length() + 3; // NULL terminator and ';' separators            
-                        len += tel.length() + telbook.length() + email.length();            
-                        //url.reserve(len);            
+                        char numberNameSeparator = ';';
+                        int len = makeCallUrlPrefix.length() + 3; // NULL terminator and ';' separators
+                        len += tel.length() + telbook.length() + email.length();
+                        //url.reserve(len);
                         url = makeCallUrlPrefix;
                         url.append(tel);
                         url.append(numberNameSeparator);
@@ -623,12 +623,12 @@
         err == KErrHttpCannotEstablishTunnel) {
         return KErrSSLAlertHandshakeFailure;
     }
-    
+
     // Deal with DNS lookup errors
     if ((err <= KErrInet6NoDestination) && (err > (KErrInet6NoDestination - 200))) {
         return KBrowserHTTP502;
     }
-    
+
     // Deal with HTTP errors
     if (err <= KHttpErrorBase && err > KHttpErrorBase - 200) {
         // Encode errors
@@ -642,7 +642,7 @@
             err == KErrHttpDecodeDigestAuth) {
             return KBrowserMissingAuthHeader;
         }
-        
+
         // Decode errors
         if (err <= KErrHttpDecodeMalformedDate && err >= KErrHttpDecodeCookie) {
             return KBrowserBadContent;
@@ -722,13 +722,26 @@
 bool handleSelectElementScrolling(WebView* webView, int tb)
 {
     bool ret = false;
+    bool isScrollList = false;
     if (webView->focusedElementType() == TBrCtlDefs::EElementSelectMultiBox && tb != 0) {
         IntPoint point;
         WebFrame* frame = frameAndPointUnderCursor(point, *webView);
         Element* e = core(frame)->document()->elementFromPoint(point.x(), point.y());
         if (e && e->isControl()) {
             HTMLGenericFormElement* ie = static_cast<HTMLGenericFormElement*>( e );
-            if (ie->type() == "select-multiple") {
+        	if (ie->type() == "select-multiple") {
+        		isScrollList = true;
+        	}
+        	else if (ie->type() == "select-one") {
+        		HTMLSelectElement* theSecletedElement = static_cast<HTMLSelectElement*>( e );
+        		//check if the size is > 1
+        		if (theSecletedElement->size() > 1) {
+        			isScrollList = true;
+        		} //select-one
+        	}
+
+        	//scroll only for the list which is either multiple or single but with more than one lines
+            if (isScrollList) {
                 RenderListBox* render = static_cast<RenderListBox*>(e->renderer());
                 if (render->isScrollable()) {
                     HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>( e );
@@ -767,10 +780,11 @@
                             ret = true;
                         }
                     }
-                }
-            }
-        }
-    }
+                }//isScrollable()
+            }//isScrollList
+        } //isControl
+    } //focusedElementType()
+
     return ret;
-}    
+}
 
--- a/webengine/osswebengine/WebKit/s60/plugins/NpnImplementation.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/plugins/NpnImplementation.cpp	Fri May 08 08:25:06 2009 +0300
@@ -439,6 +439,17 @@
             }
         }
         break;
+        case NPPVPluginPointerEvent:
+            {
+            PluginWin* pluginWin = (PluginWin*)aInstance->ndata;
+            if (pluginWin) {
+                TPointerEvent* event = (TPointerEvent*)aSetValue;
+                if (event) {
+                    pluginWin->HandlePointerEventFromPluginL(*event);
+                }
+            }
+            break;
+            }
         case NPPVPluginDeactivate:
             {
             PluginWin* pluginWin = (PluginWin*)aInstance->ndata;
@@ -454,6 +465,16 @@
             pluginWin->TogleScreenMode(*isFullScreen);
             break;
             }
+        case NPPVPluginZoom:
+            {
+            PluginWin* pluginWin = (PluginWin*)aInstance->ndata;
+            if (pluginWin) {
+                TPoint* focusPoint = (TPoint*) aSetValue;
+                if (focusPoint) {
+                    pluginWin->adaptiveZoom(*focusPoint);
+                   }
+               }
+            }
         default:
         break;
     
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -22,7 +22,8 @@
 #include <e32std.h>
 #include <e32uid.h>
 #include <sysutil.h>
-#include "../../bidi.h"
+#include "config.h"
+#include "..\..\bidi.h"
 
 // System includes
 #include <ecom/ecom.h>
@@ -398,6 +399,8 @@
     : m_pluginInfoArray( KPluginGranularity )
       ,m_enablePlugins(enablePlugins)
       ,m_asyncLoading(ETrue)
+      ,m_pluginToActivate(NULL)
+      ,m_activePlugin(NULL)
 {
 }
 
@@ -440,6 +443,7 @@
 {
     m_pluginInfoArray.ResetAndDestroy();
     m_pluginInfoArray.Close();
+    m_pluginObjects.clear();
     if (m_idle) {
        m_idle->Cancel();
     }
@@ -885,4 +889,12 @@
     return isSupported;
 }
 
+void PluginHandler::storePluginObject(PluginSkin* pluginObj)
+{
+    m_pluginObjects.add(pluginObj);    
+}
+void  PluginHandler::removePluginObject(PluginSkin* pluginObj)
+{
+    m_pluginObjects.remove(pluginObj);    
+}
 //  End of File
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginHandler.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginHandler.h	Fri May 08 08:25:06 2009 +0300
@@ -21,10 +21,11 @@
 #define PluginHandler_H
 
 //  INCLUDES
+#include <e32std.h>
 #include <npupp.h>
 #include <f32file.h>
 #include <badesca.h>
-
+#include <wtf/HashSet.h>
 #include <ECom/ImplementationInformation.h>    // ecom
 #include "EcomBrowserPluginInterface.h"
 #include "WebCorePluginHandler.h"
@@ -32,7 +33,7 @@
 // FORWARD DECLARATIONS
 class PluginInfo;
 class WebView;
-
+class PluginSkin;
 
 // CLASS DECLARATION
 
@@ -136,6 +137,13 @@
         * @return ETrue or EFalse.
         */
         TBool isSupported(const TDesC& contType, const TDesC8& url);
+        void  storePluginObject(PluginSkin* pluginObj);
+        void  removePluginObject(PluginSkin* pluginObj);
+        WTF::HashSet<PluginSkin*>& pluginObjects() { return m_pluginObjects; };
+        PluginSkin*  pluginToActivate() { return m_pluginToActivate; };
+        void  setPluginToActivate(PluginSkin* pluginObj) {m_pluginToActivate = pluginObj; };
+        PluginSkin*  activePlugin() { return m_activePlugin; };
+        void setActivePlugin(PluginSkin* pluginObj) { m_activePlugin = pluginObj; };
 
     private: // New functions
 
@@ -181,6 +189,7 @@
 
         // Array of information about existing plugins
         RPointerArray<PluginInfo>   m_pluginInfoArray;
+        WTF::HashSet<PluginSkin*>   m_pluginObjects;
         TInt                        m_nextHandle;
         TBool                       m_pluginsLoaded;
         TBool                       m_enablePlugins;
@@ -189,6 +198,8 @@
 
         CIdle*                      m_idle;              //Active Object to initailise
                                                         //the plugins from drives
+        PluginSkin*                 m_pluginToActivate;
+        PluginSkin*                 m_activePlugin;
     };
 
 
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginSkin.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginSkin.cpp	Fri May 08 08:25:06 2009 +0300
@@ -280,6 +280,10 @@
         PluginHandler* pluginhandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
         if ( pluginhandler) {
             pluginhandler->unloadPlugin( m_handle );
+            pluginhandler->removePluginObject(this);
+            if (this == pluginhandler->activePlugin()) {
+                pluginhandler->setActivePlugin(NULL);
+            }
         }
         m_handle = -1;
     }
@@ -427,6 +431,9 @@
         // Set right soft key
         m_frame->frameView()->topView()->brCtl()->updateDefaultSoftkeys();
         }
+    PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
+    pluginHandler->setPluginToActivate(NULL);
+    pluginHandler->setActivePlugin(NULL);
     }
 
 // ----------------------------------------------------------------------------
@@ -439,6 +446,7 @@
     if (m_pluginClosed)
         return;
 
+    PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
     TBool consumed(EFalse);
     if(m_pluginwin)
     {
@@ -451,14 +459,17 @@
                 m_frame->frameView()->topView()->setFocusedElementType(TBrCtlDefs::EElementActivatedObjectBox);
                 // Set right soft key
                 m_frame->frameView()->topView()->brCtl()->updateDefaultSoftkeys();
+                pluginHandler->setActivePlugin(this);
                 }
             }
         else
             {
             m_active = ETrue;
+            pluginHandler->setActivePlugin(this);
             m_frame->frameView()->topView()->openPluginPlayer(m_pluginwin);
             consumed = ETrue;
             m_active = EFalse;
+            pluginHandler->setActivePlugin(NULL);
             }
     } else {
         if ( m_pluginSupported ) {
@@ -603,6 +614,7 @@
     // Create the PluginWin, if it doesn't exist,
     m_pluginSupported = true;
     m_pluginwin = PluginWin::NewL(this, *m_frame->frameView()->topView());
+    pluginHandler->storePluginObject(this);
     m_frame->frameView()->invalidateRect(m_rect, EFalse);    
 }
 
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginWin.cpp	Fri May 08 08:25:06 2009 +0300
@@ -41,9 +41,12 @@
 #include "BrCtl.h"
 #include "Frame.h"
 #include "WebCursor.h"
+#include "WebPointerEventHandler.h"
 #include "WebPageScrollHandler.h"
+#include "WebKitLogger.h"
 
 using namespace WebCore;
+using namespace RT_GestureHelper;
 // CONSTANTS
 const TInt KPluginGranularity = 3;
 _LIT(KPath,"c:\\system\\temp\\");
@@ -156,6 +159,7 @@
 void PluginWin::windowChangedL()
 {
     if (m_fullscreen) return;
+    PlayPausePluginL();
     if (m_pluginskin->getNPPluginFucs() && m_pluginskin->getNPPluginFucs()->setwindow ){
         NPWindow  window;
     TRect rect( m_pluginskin->getPluginWinRect() );
@@ -659,6 +663,8 @@
 //
 TBool PluginWin::HitRegionContains(const TPoint &aPoint, const CCoeControl &/*aControl*/) const
     {
+    PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
+    pluginHandler->setPluginToActivate(NULL);
 
     if (m_pluginskin->frame()->frameView()->topView()->focusedElementType() != TBrCtlDefs::EElementActivatedObjectBox)
         {
@@ -668,6 +674,12 @@
             m_pluginskin->activate();
         }
         else {
+            /* We are storing  plugin that we want to acrivate here 
+             * When we get to WebPointerEventHandler::HandleGesture() we will check
+             * if this pointer != NULL and will send mousePress event to WebCore.
+             * This will trigger the plugin activation.
+             */         
+            pluginHandler->setPluginToActivate(m_pluginskin);
         TPoint point = m_pluginskin->getPluginWinRect().iTl + aPoint;
 
         // Plugin gets pointer event. Activate plugin
@@ -675,15 +687,6 @@
 
         WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
         cursor->setPosition(point);
-        TKeyEvent keyEvent;
-        keyEvent.iModifiers = 0;
-        keyEvent.iRepeats = 0;
-        keyEvent.iCode = EKeyDevice3;
-        keyEvent.iScanCode = EStdKeyDevice3;
-        CCoeEnv::Static()->SimulateKeyEventL(keyEvent, EEventKeyDown);
-        CCoeEnv::Static()->SimulateKeyEventL(keyEvent, EEventKey);
-        CCoeEnv::Static()->SimulateKeyEventL(keyEvent, EEventKeyUp);
-        PluginWin* win = const_cast<PluginWin*>(this);
         }
         }
     return ETrue;
@@ -725,14 +728,19 @@
 void PluginWin::TogleScreenMode(bool aFullScreen)
 {
   m_fullscreen = aFullScreen;
-  WebFrame* mf = mainFrame(m_pluginskin->frame());
+  CBrCtl*   brCtl = control(m_pluginskin->frame());
+
+  StaticObjectsContainer::instance()->setPluginFullscreen(aFullScreen);
+  brCtl->reportStateChanged(TBrCtlDefs::EStatePluginFullScreen, m_fullscreen);
+}
+void PluginWin::adaptiveZoom(const TPoint& aCurPosition)
+{
   CBrCtl*   brCtl = control(m_pluginskin->frame());
   WebView*  view = brCtl->webView();
-
-  view->setPluginFullscreen(aFullScreen);
-  brCtl->reportStateChanged(TBrCtlDefs::EStatePluginFullScreen, m_fullscreen);
+  WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
+  cursor->setPosition(aCurPosition);
+  view->setZoomLevelAdaptively();
 }
-
 void PluginWin::NotifyPluginVisible (TBool visible)
 
 {
@@ -748,3 +756,67 @@
       }	
     }
 }
+void PluginWin::PlayPausePluginL ()
+{
+    if(m_notifier) 
+    {
+        CBrCtl*   brCtl = control(m_pluginskin->frame());    
+        WebView*  view = brCtl->webView();
+        TBool scrolling = view->viewIsScrolling();
+        if (scrolling) {
+            m_notifier->NotifyL( MPluginNotifier::EPluginPause, (void*)1 );
+        }
+        else {
+            m_notifier->NotifyL( MPluginNotifier::EPluginPause, (void*)0 );
+        }
+    }
+}
+
+void PluginWin::HandlePointerEventFromPluginL(const TPointerEvent& aEvent)
+{
+    CBrCtl*   brCtl = control(m_pluginskin->frame());    
+    WebView*  view = brCtl->webView();
+    TPointerEvent event(aEvent);
+    
+    if (!StaticObjectsContainer::instance()->isPluginFullscreen()) {
+        event.iPosition = aEvent.iPosition - view->PositionRelativeToScreen();
+    }
+    view->pointerEventHandler()->HandlePointerEventL(event);
+}
+
+
+TBool PluginWin::HandleGesture(const TGestureEvent& aEvent)
+{
+    TBool ret = EFalse;
+    if (m_control) {
+        TGestureEvent gestEvent(aEvent);
+        CBrCtl*   brCtl = control(m_pluginskin->frame());    
+        WebView*  view = brCtl->webView();
+        TPoint newPos = aEvent.CurrentPos();
+        TPoint startPos = aEvent.StartPos();
+        TPoint viewPos = view->PositionRelativeToScreen();
+        TPoint ctrlPos = m_control->PositionRelativeToScreen();
+        
+        if (!StaticObjectsContainer::instance()->isPluginFullscreen()) {
+        // adjust the position to make it relative to top left corner of 
+            newPos += viewPos; 
+            startPos += viewPos;
+            gestEvent.SetCurrentPos(newPos);
+            gestEvent.SetStartPos(startPos);
+        }
+    
+        if (StaticObjectsContainer::instance()->isPluginFullscreen() || 
+	    m_control->Rect().Contains(newPos - ctrlPos)) {
+            NPEvent event;
+            NPEventPointer ev;
+            event.event = ENppEventPointer;
+            ev.reserved = &gestEvent;
+            ev.pointerEvent = NULL;
+            event.param = &ev;
+            ret = m_pluginskin->getNPPluginFucs()->event(m_pluginskin->getNPP(), 
+                                                         static_cast<void*>(&event));
+        }
+    }
+    return ret;
+
+}
--- a/webengine/osswebengine/WebKit/s60/plugins/PluginWin.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/plugins/PluginWin.h	Fri May 08 08:25:06 2009 +0300
@@ -25,6 +25,7 @@
 #include <coecntrl.h>
 #include <PluginAdapterInterface.h>
 #include <npapi.h>
+#include <rt_gesturehelper.h>
 
 // FORWARD DECLARATIONS
 class PluginSkin;
@@ -354,7 +355,12 @@
         * @return
         */
         void pluginDeactivate();        
-        
+        /**
+        * zoom on double tap on the plugin
+        * Sets the cursor poistion
+        * @return
+        */
+        void adaptiveZoom(const TPoint& aCurPosition);
 
 public: // Functions from MPluginAdapter
 
@@ -483,6 +489,9 @@
     
     
     void TogleScreenMode(bool aFullScreen);
+    void PlayPausePluginL ();
+    void HandlePointerEventFromPluginL(const TPointerEvent& aEvent);
+    TBool HandleGesture(const RT_GestureHelper::TGestureEvent& aEvent);    
     protected: // New functions
 
         /**
--- a/webengine/osswebengine/WebKit/s60/webcoresupport/WebFrameLoaderClient.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webcoresupport/WebFrameLoaderClient.cpp	Fri May 08 08:25:06 2009 +0300
@@ -796,7 +796,7 @@
     if (brctl(m_webFrame)->brCtlDialogsProvider()) {
         int err = mapHttpErrors(error.errorCode());
         if (err <= KBrowserHTTP100 && err > KBrowserFailure) {
-            if (total_bytes == 0) {
+            if (total_bytes == 0 || err == KBrowserHTTP502 ) {
                 HBufC* url = NULL;
                 url = HBufC::New(loader->originalURL().des().Length());
                 if (url) {
--- a/webengine/osswebengine/WebKit/s60/webview/BrCtl.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/BrCtl.cpp	Fri May 08 08:25:06 2009 +0300
@@ -286,8 +286,9 @@
 {
     if (m_webView->isPluginFullscreen()) return; //don't draw if in plugin fullscreen mode
 
-    if (!(m_capabilities & TBrCtlDefs::ECapabilityDisplayScrollBar) ||
-        AknLayoutUtils::PenEnabled()) { //touch screen scrollbar is drawn
+    if (!(m_capabilities & TBrCtlDefs::ECapabilityDisplayScrollBar) 
+          || (getMainScrollbarWidth() == 0)
+          || AknLayoutUtils::PenEnabled()) { //touch screen scrollbar is drawn
         return;                         //by WebScrollbarDrawer
     }
     CWindowGc& gc = SystemGc();
@@ -2474,7 +2475,8 @@
 
 int CBrCtl::getMainScrollbarWidth() const
 {
-  return (AknLayoutUtils::PenEnabled() ?  0  :  KMainScrollbarWidth);
+  //return (AknLayoutUtils::PenEnabled() ?  0  :  KMainScrollbarWidth);
+  return 0;
 }
 
 MBrCtlDownloadObserver* CBrCtl::brCtlDownloadObserver()
--- a/webengine/osswebengine/WebKit/s60/webview/WebCursor.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebCursor.cpp	Fri May 08 08:25:06 2009 +0300
@@ -11,7 +11,7 @@
 *
 * Contributors:
 *
-* Description:   Implemetation of CWebKiCursor
+* Description:   Implementation of CWebKiCursor
 *
 */
 
@@ -83,7 +83,7 @@
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
-// CWebKitCursor::NewL
+// WebCursor::NewL
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
 WebCursor* WebCursor::NewL()
@@ -132,7 +132,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::SetCurrentView
+// WebCursor::setCurrentView
 // -----------------------------------------------------------------------------
 void WebCursor::setCurrentView(WebView& view)
     {
@@ -147,7 +147,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::ConstructSprite
+// WebCursor::constructSprite
 // -----------------------------------------------------------------------------
 void WebCursor::constructSprite()
     {
@@ -194,13 +194,13 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::CursorUpdate
+// WebCursor::setCursor
 // -----------------------------------------------------------------------------
 void WebCursor::setCursor(CursorTypes type)
 {
     m_sprite.SetPosition( m_pos );
     m_type = type;
-    if (m_visible) {
+    if (m_visible && !(m_view->brCtl()->settings()->getTabbedNavigation())) {
         TSpriteMember spriteMem;
         switch( type )
             {
@@ -257,7 +257,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// WebCursor::CursorUpdate
+// WebCursor::cursorUpdate
 // -----------------------------------------------------------------------------
 void WebCursor::cursorUpdate(bool visible)
 {
@@ -266,27 +266,32 @@
     if ( m_view->showCursor() ) {
         m_visible = visible && (!m_view->brCtl()->settings()->getTabbedNavigation() || m_view->focusedElementType() == TBrCtlDefs::EElementSelectMultiBox); // check for tabbedNavigation here because it is called from so many places.
     }
-    
+
     resetTransparency();
     CursorTypes type = PointerCursor;
     TBrCtlDefs::TBrCtlElementType elType = m_view->focusedElementType();
+
     if (m_visible) {
-        if (elType == TBrCtlDefs::EElementNone || elType == TBrCtlDefs::EElementBrokenImage)
+        if      (    elType == TBrCtlDefs::EElementNone
+                  || elType == TBrCtlDefs::EElementImageBox
+                  || elType == TBrCtlDefs::EElementBrokenImage )
             type = PointerCursor;
-        else if (elType == TBrCtlDefs::EElementSmartLinkTel || elType == TBrCtlDefs::EElementSmartLinkEmail)
+        else if (    elType == TBrCtlDefs::EElementSmartLinkTel
+                  || elType == TBrCtlDefs::EElementSmartLinkEmail )
             type = IBeamCursor;
-        else if (m_view->brCtl()->settings()->getTabbedNavigation() && elType == TBrCtlDefs::EElementSelectMultiBox)
+        else if (    elType == TBrCtlDefs::EElementSelectMultiBox && m_view->brCtl()->settings()->getTabbedNavigation() )
             type = SelectMultiCursor;
         else
             type = HandCursor;
     }
+
     setCursor(type);
 }
 
 
 
 // -----------------------------------------------------------------------------
-// CWebKitCursor::getFrameAtPoint
+// WebCursor::getFrameAtPoint
 // -----------------------------------------------------------------------------
 WebFrame* WebCursor::getFrameAtPoint(const TPoint& viewPos_)
     {
@@ -299,7 +304,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::Reset
+// WebCursor::reset
 // -----------------------------------------------------------------------------
 void WebCursor::reset()
     {
@@ -309,7 +314,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::SetWaitCursor
+// WebCursor::setWaitCursor
 // -----------------------------------------------------------------------------
 void WebCursor::setWaitCursor(bool waiton)
     {
@@ -321,7 +326,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::OffsetCursor
+// WebCursor::offsetCursor
 // -----------------------------------------------------------------------------
 void WebCursor::offsetCursor(const TPoint& offset)
     {
@@ -330,7 +335,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::SetTransparent
+// WebCursor::setTransparent
 // -----------------------------------------------------------------------------
 void WebCursor::setTransparent(bool transparent)
 {
@@ -347,7 +352,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// WebCursor::SetOpaqueUntil
+// WebCursor::setOpaqueUntil
 // -----------------------------------------------------------------------------
 void WebCursor::setOpaqueUntil(int microsecs)
     {
@@ -357,7 +362,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::IncreaseTransparencyMoveCount
+// WebCursor::increaseTransparencyMoveCount
 // -----------------------------------------------------------------------------
 void WebCursor::increaseTransparencyMoveCount()
     {
@@ -365,7 +370,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// WebCursor::ResetTransparency
+// WebCursor::resetTransparency
 // -----------------------------------------------------------------------------
 void WebCursor::resetTransparency()
     {
@@ -556,6 +561,8 @@
 
 
 //-------------------------------------------------------------------------------
+// WebCursor::scrollAndMoveCursor
+//
 // Method that scrolls and moves the cursor based on the navigation algorithm
 // TODO: Investigate "autoscroll" and diagonal events from real HW and the
 //       diagonal event simulator wedge.
@@ -701,7 +708,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// WebCursor::setPosition
+// WebCursor::updatePositionAndElemType
 // -----------------------------------------------------------------------------
 void WebCursor::updatePositionAndElemType(const TPoint& pt)
 {
@@ -717,7 +724,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// WebCursor::movecursor
+// WebCursor::moveCursor
 // -----------------------------------------------------------------------------
 void WebCursor::moveCursor(int lr,int tb, int scrollRange)
     {
@@ -819,6 +826,9 @@
     }
 
 
+// -----------------------------------------------------------------------------
+// WebCursor::navigableNodeUnderCursor
+// -----------------------------------------------------------------------------
 bool WebCursor::navigableNodeUnderCursor(WebFrame& webFrame, TPoint& aPoint, TBrCtlDefs::TBrCtlElementType& aElType, TRect& aFocusRect) const
 {
     Frame* coreFrame = core(&webFrame);
@@ -834,6 +844,9 @@
     return false;
 }
 
+// -----------------------------------------------------------------------------
+// WebCursor::determineCursorPosition
+// -----------------------------------------------------------------------------
 bool WebCursor::determineCursorPosition( WebFrame& webFrame, TBrCtlDefs::TBrCtlElementType& aElType,
                                          TRect& aFocusRect, TRect& aSearchRect,
                                          TPoint &aCursorPosition, bool aInitialize)
@@ -868,6 +881,9 @@
 }
 
 
+// -----------------------------------------------------------------------------
+// WebCursor::calcSearchRect
+// -----------------------------------------------------------------------------
 TRect WebCursor::calcSearchRect(int lr, int tb, int scrollRange)
 {
     TRect searchRect;
@@ -898,6 +914,9 @@
     return searchRect;
 }
 
+// -----------------------------------------------------------------------------
+// WebCursor::increaseSearchRect
+// -----------------------------------------------------------------------------
 void WebCursor::increaseSearchRect(int lr,int tb,TRect& aRect)
 {
     int width(aRect.Width());
@@ -918,6 +937,9 @@
     m_flipCounter = 0;
 }
 
+// -----------------------------------------------------------------------------
+// WebCursor::decideCursorPosition
+// -----------------------------------------------------------------------------
 bool WebCursor::decideCursorPosition(WebFrame& webFrame, const IntRect& searchRect, IntPoint& cursorPosition)
 {
     int distance = -1;
@@ -963,6 +985,9 @@
     return found;
 }
 
+// -----------------------------------------------------------------------------
+// WebCursor::getFrameUnderCursor
+// -----------------------------------------------------------------------------
 WebFrame* WebCursor::getFrameUnderCursor()
 {
   return getFrameAtPoint(m_pos);
--- a/webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp	Fri May 08 08:25:06 2009 +0300
@@ -19,7 +19,10 @@
 
 #include "config.h"
 #include "../../bidi.h"
-
+#include "StaticObjectsContainer.h"
+#include "AtomicString.h"
+#include "PlatformFontCache.h"
+#include "BrCtl.h"
 #include "WebFepTextEditor.h"
 #include "WebEditorClient.h"
 #include "WebTextFormatMask.h"
@@ -88,6 +91,7 @@
     delete m_state;
     delete m_inlineEditText;
     delete m_textFormatMask;
+	delete m_ExtendedInputCapabilities;
     }
 
 // -----------------------------------------------------------------------------
@@ -495,11 +499,50 @@
 // 
 // 
 // -----------------------------------------------------------------------------
-void CWebFepTextEditor::GetScreenCoordinatesForFepL(TPoint& /*aLeftSideOfBaseLine*/,
-                                                    TInt& /*aHeight*/,
-                                                    TInt& /*aAscent*/,
-                                                    TInt /*aDocumentPosition*/) const
-{    
+void CWebFepTextEditor::GetScreenCoordinatesForFepL(TPoint& aLeftSideOfBaseLine,
+                                                    TInt& aHeight,
+                                                    TInt& aAscent,
+                                                    TInt aDocumentPosition) const
+{
+Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
+if (frame &&
+    frame->document() &&
+    frame->document()->focusedNode()){
+    if ( frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag) || 
+		 frame->document()->focusedNode()->hasTagName(HTMLNames::textareaTag)){
+		HTMLGenericFormElement*  ie = static_cast<HTMLGenericFormElement*>(frame->document()->focusedNode());	
+		SelectionController* sc = frame->selectionController();
+		int xPos(0);
+		int yPos(0);
+		if ( sc ){
+			IntRect rect = sc->caretRect(); 
+			xPos = rect.x();     
+			yPos = rect.y();
+			yPos +=  m_webView->brCtl()->PositionRelativeToScreen().iY;
+			Node* editNode = sc->focusNode();	
+			String str;
+			if ( editNode &&
+				 editNode->isTextNode() ) {
+				WebCore::Text* aText = (WebCore::Text*)editNode;
+				str = aText->data();
+				aDocumentPosition =  aText->length();
+				TInt position = aDocumentPosition - ( str.reverseFind(KBlankDesC(), aDocumentPosition )+1);
+				String word(str);
+				if( position > 0 ){
+					word = str.left( position );
+					}
+				RenderStyle* s = frame->document()->focusedNode()->renderStyle(); 	
+				PlatformFontCache* cache = StaticObjectsContainer::instance()->fontCache();
+				CFont* sFont =  cache->zoomedFont( s->fontDescription(), cache->fontZoomFactor());
+				TInt sizePix =	sFont->MeasureText( word.des() );
+				xPos -= sizePix;	
+				}		
+			}
+		aLeftSideOfBaseLine.SetXY( xPos,yPos );              
+		}
+	}
+	aAscent = 0;
+	aHeight = 0;
 }
 
 // -----------------------------------------------------------------------------
--- a/webengine/osswebengine/WebKit/s60/webview/WebFrame.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebFrame.cpp	Fri May 08 08:25:06 2009 +0300
@@ -44,6 +44,7 @@
 #include "webkitlogger.h"
 #include "webutil.h"
 #include "PluginSkin.h"
+#include "PluginHandler.h"
 #include "kjs_proxy.h"
 #if PLATFORM(SYMBIAN)
 #include "oom.h"
@@ -307,42 +308,18 @@
 
 PluginSkin* WebFrame::focusedPlugin()
 {
-    int pluginCount = 0;
-    Frame* coreFrame = core(this);
-    MWebCoreObjectWidget* view = NULL;
-    MWebCoreObjectWidget* tmpView = NULL;
-
-    for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
-        PassRefPtr<HTMLCollection> objects = frame->document()->objects();     
-        for (Node* n = objects->firstItem(); n; n = objects->nextItem()) {
-            tmpView = widget(n); 
-            if (tmpView) {
-                pluginCount++;
-                view = tmpView;
-                if (view->isActive()) {
-                    return static_cast<PluginSkin*>(view);
-                }
-            }
-        }
-
-        PassRefPtr<HTMLCollection> embeds = frame->document()->embeds();       
-        for (Node* n = embeds->firstItem(); n; n = embeds->nextItem()) {
-            tmpView = widget(n);
-            if (tmpView) { 
-                pluginCount++;
-                view = tmpView;
-                if (view->isActive()) {
-                    return static_cast<PluginSkin*>(view);
-                }
-            }
+    PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
+    PluginSkin* plugin = pluginHandler->activePlugin();
+    if (!plugin) {
+        //no focused plugin. If only one plugin is present return that plugin
+        WTF::HashSet<PluginSkin*> pluginObjs = pluginHandler->pluginObjects();
+        if (pluginObjs.size() == 1) {
+            WTF::HashSet<PluginSkin*>::iterator it = pluginObjs.begin();
+            plugin = *it;
         }
     }
-    //no focused plugin. If only one plugin is present return that plugin
-    if(pluginCount == 1 && view) {
-        return static_cast<PluginSkin*>(view);           
-    } //endof pluginCount = 1
-
-    return NULL;    
+    
+    return plugin;
 }
 
 void WebFrame::setFrameView(WebFrameView* v) 
--- a/webengine/osswebengine/WebKit/s60/webview/WebPageFullScreenHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPageFullScreenHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -28,7 +28,7 @@
 
 using namespace WebCore;
 
-const int KFullScreenButtonHight = 60;
+const int KFullScreenButtonHeight = 60;
 const int KFullScreenButtonWidth = 60;
 const int KFullScreenButtonBuff  = 5;
 
@@ -111,7 +111,9 @@
 {
     if (AknLayoutUtils::PenEnabled() && m_spriteVisible) {
         m_pos = m_webView->Rect().iBr;
-        m_pos -= TSize( KFullScreenButtonHight + KFullScreenButtonBuff, KFullScreenButtonWidth + KFullScreenButtonBuff);
+        TPoint point (m_webView->PositionRelativeToScreen());
+        m_pos -= TSize(  KFullScreenButtonWidth + KFullScreenButtonBuff, 
+        				 KFullScreenButtonHeight - point.iY + KFullScreenButtonBuff);
         m_sprite.SetPosition(m_pos);
     }
 }
@@ -134,7 +136,7 @@
 
 TBool WebPageFullScreenHandler::HitRegionContains(const TPoint& aPoint)
 {
-    TRect spriteRect (m_pos, TSize(KFullScreenButtonHight, KFullScreenButtonWidth));
+    TRect spriteRect (m_pos, TSize(KFullScreenButtonHeight, KFullScreenButtonWidth));
     return spriteRect.Contains(aPoint);
 }
 
@@ -163,7 +165,7 @@
 
 	TSpriteMember spriteMem;
 	spriteMem.iBitmap = cannedImage.m_img; 
-	spriteMem.iMaskBitmap = NULL; //masked bitmap still of the canned image need to be changed
+	spriteMem.iMaskBitmap = cannedImage.m_msk; //masked bitmap still of the canned image need to be changed
 
     m_sprite.AppendMember(spriteMem);
 	m_sprite.Activate();
--- a/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -130,11 +130,11 @@
         m_scrollTimer = CPeriodic::NewL(CActive::EPriorityUserInput - 1);
         m_pageOverviewScrollPeriodic = CPeriodic::NewL(CActive::EPriorityUserInput - 1);
         m_lastPosition = TPoint(0, 0);
-        
+        m_scrollbarDrawer = WebScrollbarDrawer::NewL();
         if(AknLayoutUtils::PenEnabled()) {
             m_touchScrolling = true;
             m_scrollDirectionState = ScrollDirectionUnassigned;
-            m_scrollbarDrawer = WebScrollbarDrawer::NewL();
+            
 #ifndef BRDO_USE_GESTURE_HELPER            
             m_decel = WebScrollingDecelerator::NewL(*m_webView);
 #else            
@@ -582,7 +582,7 @@
 }
 
 
-void WebPageScrollHandler::handleScrollingGH(const MGestureEvent& aEvent)
+void WebPageScrollHandler::handleScrollingGH(const TGestureEvent& aEvent)
 {   
     TPoint newPos = aEvent.CurrentPos();
     m_currentPosition = newPos;
@@ -600,7 +600,7 @@
 }
 
 
-void WebPageScrollHandler::handleTouchDownGH(const MGestureEvent& aEvent)
+void WebPageScrollHandler::handleTouchDownGH(const TGestureEvent& aEvent)
 {
     TPoint newPos = aEvent.CurrentPos();
     m_lastMoveEventTime = 0; 
@@ -617,7 +617,7 @@
 }
 
 
-void WebPageScrollHandler::handleTouchUpGH(const MGestureEvent& aEvent)
+void WebPageScrollHandler::handleTouchUpGH(const TGestureEvent& aEvent)
 {
     bool decelDoesScrollbars = false;
     TPoint newPos = aEvent.CurrentPos();
@@ -660,7 +660,7 @@
 }
 
 
-bool WebPageScrollHandler::startDeceleration(const MGestureEvent& aEvent)
+bool WebPageScrollHandler::startDeceleration(const TGestureEvent& aEvent)
 {
     bool started = false;
     TRealPoint gstSpeed = aEvent.Speed();
--- a/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPageScrollHandler.h	Fri May 08 08:25:06 2009 +0300
@@ -158,9 +158,9 @@
         static int pageOverviewScrollCallback( TAny* aPtr );
         //static int handleScrollTimerEventCallback( TAny* ptr);
         void scrollPageOverviewGH();
-        void handleScrollingGH(const RT_GestureHelper::MGestureEvent& aEvent);
-        void handleTouchDownGH(const RT_GestureHelper::MGestureEvent& aEvent);
-        void handleTouchUpGH(const RT_GestureHelper::MGestureEvent& aEvent);
+        void handleScrollingGH(const RT_GestureHelper::TGestureEvent& aEvent);
+        void handleTouchDownGH(const RT_GestureHelper::TGestureEvent& aEvent);
+        void handleTouchUpGH(const RT_GestureHelper::TGestureEvent& aEvent);
         void updateScrollbars(const TPoint& scrollPos, TPoint& newscrollDelta);
 
 public:
@@ -171,7 +171,7 @@
         bool calculateScrollableElement(const TPoint& aNewPosition);
         
         void scrollPageOverview(const TPointerEvent& pointerEvent);
-        bool startDeceleration(const RT_GestureHelper::MGestureEvent& aEvent);
+        bool startDeceleration(const RT_GestureHelper::TGestureEvent& aEvent);
         
      private:  
         // Pointer to owning view
--- a/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -53,7 +53,8 @@
 #include "Chrome.h"
 #include "ChromeClient.h"
 #include "FocusController.h"
-
+#include "WebTabbedNavigation.h"
+#include "PluginHandler.h"
 
 #include "WebKitLogger.h"
 using namespace WebCore;
@@ -130,9 +131,19 @@
  * EGestureDrop -  drag + touch up, !(EGestureSwipe || EGestureFlick) - events
  *                 sent: EGestureDrop, EGestureReleased
  */
-void WebPointerEventHandler::HandleGestureL( const MGestureEvent& aEvent )
+void WebPointerEventHandler::HandleGestureL( const TGestureEvent& aEvent )
 {
-    TGestureCode gtype = const_cast<MGestureEvent&>(aEvent).Code(MGestureEvent::EAxisBoth);
+    TGestureCode gtype = aEvent.Code(EAxisBoth);
+    TPoint gpos = aEvent.CurrentPos();
+    
+    TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
+    
+    PluginSkin* plugin = m_webview->mainFrame()->focusedPlugin();
+    if (plugin && plugin->pluginWin()) {
+      if (plugin->pluginWin()->HandleGesture(aEvent)) {
+          return;
+      }
+    }
     updateCursor(aEvent.CurrentPos());
 
     switch (gtype) {
@@ -204,7 +215,7 @@
 // ======================================================================
 // WebPointerEventHandler::handleTap
 // ======================================================================
-void WebPointerEventHandler::handleTapL(const MGestureEvent& aEvent)
+void WebPointerEventHandler::handleTapL(const TGestureEvent& aEvent)
 {
     m_buttonDownTimer.stop();
     m_lastTapEvent = m_currentEvent; 
@@ -215,7 +226,7 @@
 // ======================================================================
 //  WebPointerEventHandler::handleDoubleTap
 //======================================================================
-void WebPointerEventHandler::handleDoubleTap(const MGestureEvent& aEvent)
+void WebPointerEventHandler::handleDoubleTap(const TGestureEvent& aEvent)
 {
     if ( !m_webview->viewIsScrolling() &&
          (m_webview->brCtl()->capabilities() & TBrCtlDefs::ECapabilityFitToScreen)) {
@@ -232,13 +243,16 @@
 // ======================================================================
 // WebPointerEventHandler::handleTouchDownL
 //======================================================================
-void WebPointerEventHandler::handleTouchDownL(const MGestureEvent& aEvent)
+void WebPointerEventHandler::handleTouchDownL(const TGestureEvent& aEvent)
 {
     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
+    PluginHandler* pluginHandler = WebCore::StaticObjectsContainer::instance()->pluginHandler();
+    PluginSkin* pluginToActivate = pluginHandler->pluginToActivate();
     m_buttonDownEvent = m_currentEvent;
     m_highlightPos = aEvent.CurrentPos();
     
-    if ( !m_buttonDownTimer.isActive() && !m_webview->inPageViewMode() ){
+    if ( !m_buttonDownTimer.isActive() && !m_webview->inPageViewMode() && 
+         !pluginToActivate ){
         m_buttonDownTimer.startOneShot(0.1f);        
     }
 
@@ -254,6 +268,10 @@
                 plugin->pluginWin()->HandlePointerEventL(m_buttonDownEvent);
             }
         }
+    }
+    if (pluginToActivate) {
+        Frame* coreFrame = core(m_webview->mainFrame());
+        coreFrame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(m_buttonDownEvent));
     }    
     /*
      * After introducing "link selection" pointer down action is done in 
@@ -273,7 +291,7 @@
 // ======================================================================
 // WebPointerEventHandler::handleTouchUp 
 // ======================================================================
-void WebPointerEventHandler::handleTouchUp(const MGestureEvent& aEvent)
+void WebPointerEventHandler::handleTouchUp(const TGestureEvent& aEvent)
 {
     m_highlightPos = TPoint(-1,-1);
     m_highlightedNode = NULL;
@@ -284,7 +302,7 @@
 // ======================================================================
 // WebPointerEventHandler::handleMoveL
 // ======================================================================
-void WebPointerEventHandler::handleMove(const MGestureEvent& aEvent)
+void WebPointerEventHandler::handleMove(const TGestureEvent& aEvent)
 {
     TBrCtlDefs::TBrCtlElementType elType = m_webview->focusedElementType();
     TPoint curPos = aEvent.CurrentPos();
--- a/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebPointerEventHandler.h	Fri May 08 08:25:06 2009 +0300
@@ -43,7 +43,7 @@
     void HandlePointerEventL(const TPointerEvent& aPointerEvent);
     void HandleHighlightChange(const TPoint &aPoint);
 
-    virtual void HandleGestureL( const RT_GestureHelper::MGestureEvent& aEvent );
+    virtual void HandleGestureL( const RT_GestureHelper::TGestureEvent& aEvent );
     
     
 private:    
@@ -54,11 +54,11 @@
     bool isHighlitableElement(TBrCtlDefs::TBrCtlElementType& elType);
     TBrCtlDefs::TBrCtlElementType highlitableElement();
     void buttonDownTimerCB(WebCore::Timer<WebPointerEventHandler>* t);
-    void handleTouchDownL(const RT_GestureHelper::MGestureEvent& aEvent);
-    void handleTouchUp(const RT_GestureHelper::MGestureEvent& aEvent);
-    void handleTapL(const RT_GestureHelper::MGestureEvent& aEvent);
-    void handleDoubleTap(const RT_GestureHelper::MGestureEvent& aEvent);
-    void handleMove(const RT_GestureHelper::MGestureEvent& aEvent);
+    void handleTouchDownL(const RT_GestureHelper::TGestureEvent& aEvent);
+    void handleTouchUp(const RT_GestureHelper::TGestureEvent& aEvent);
+    void handleTapL(const RT_GestureHelper::TGestureEvent& aEvent);
+    void handleDoubleTap(const RT_GestureHelper::TGestureEvent& aEvent);
+    void handleMove(const RT_GestureHelper::TGestureEvent& aEvent);
     void doTapL();
     void updateCursor(const TPoint& pos);
 private:
--- a/webengine/osswebengine/WebKit/s60/webview/WebScrollbarDrawer.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebScrollbarDrawer.cpp	Fri May 08 08:25:06 2009 +0300
@@ -117,9 +117,14 @@
 
 void WebScrollbarDrawer::fadeScrollbar()
 {
+    fadeScrollbar(0);
+}
+
+void WebScrollbarDrawer::fadeScrollbar(TInt delay)
+{
   if (m_hasVScroll || m_hasHScroll) {
     if (!m_scrollBarFader->IsActive()) {
-      m_scrollBarFader->Start(0, KScrollBarFadeInterval, 
+      m_scrollBarFader->Start(delay, KScrollBarFadeInterval, 
                               TCallBack(&handleFadeScrollBar, this));
     }
   }
@@ -173,19 +178,26 @@
 
 void WebScrollbarDrawer::redrawScrollbar()
 {
-    TInt err = KErrNone;
-    calculateBitmapRects();
-    removeBitmaps();
-    err = SetupBitmaps();
-    if (err == KErrNone) {
-        m_spriteV.SetPosition(m_rectVThum.iTl);
-        updateSprite(m_spriteV, m_scrollBarV, m_scrollBarVMask);
-        m_spriteH.SetPosition(m_rectHThum.iTl);
-        updateSprite(m_spriteH, m_scrollBarH, m_scrollBarHMask);
+    if (m_webView) {
+	    TInt err = KErrNone;
+	    calculateBitmapRects();
+	    removeBitmaps();
+	    err = SetupBitmaps();
+	    if (err == KErrNone) {
+	        m_spriteV.SetPosition(m_rectVThum.iTl);
+	        updateSprite(m_spriteV, m_scrollBarV, m_scrollBarVMask);
+	        m_spriteH.SetPosition(m_rectHThum.iTl);
+	        updateSprite(m_spriteH, m_scrollBarH, m_scrollBarHMask);
+	    }
+	    else {
+	        clearSprites();
+	    }
     }
-    else {
-        clearSprites();
-    }
+}
+void WebScrollbarDrawer::drawScrollbar(WebView* view)
+{
+    TPoint p = TPoint(1,1);
+    drawScrollbar(view, p);
 }
 
 void WebScrollbarDrawer::drawScrollbar(WebView* view, TPoint& scrollPos) 
--- a/webengine/osswebengine/WebKit/s60/webview/WebScrollbarDrawer.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebScrollbarDrawer.h	Fri May 08 08:25:06 2009 +0300
@@ -35,7 +35,9 @@
     virtual ~WebScrollbarDrawer();
 
     void drawScrollbar(WebView* view, TPoint& scrollPos);
+    void drawScrollbar(WebView* view);
     int  getTransparency() const {return m_scrollBarTransparency;}
+    void fadeScrollbar(TInt delay);
     void fadeScrollbar();
     void fade();   
     int fadeTime();
--- a/webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebTextFormatMask.cpp	Fri May 08 08:25:06 2009 +0300
@@ -289,7 +289,7 @@
 {
     if( ++m_offset < m_length || m_length == kInfinite )
         return this;
-    
+    m_offset = 0;
     return NULL;
 }
 
--- a/webengine/osswebengine/WebKit/s60/webview/WebView.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebView.cpp	Fri May 08 08:25:06 2009 +0300
@@ -138,12 +138,11 @@
 
 
 // -----------------------------------------------------------------------------
-// CWebKitView::NewL
+// WebView::NewL
 // Public Class Method
 // Two-phased constructor.
 // -----------------------------------------------------------------------------
-WebView* WebView::NewL(
-                       CCoeControl& parent, CBrCtl* brctl )
+WebView* WebView::NewL( CCoeControl& parent, CBrCtl* brctl )
 {
     WebView* self = new (ELeave) WebView( brctl );
 
@@ -155,7 +154,7 @@
 }
 
 // -----------------------------------------------------------------------------
-// CWebKitView::CWebKitView
+// WebView::CWebKitView
 // Private Class Method
 // C++ default constructor can NOT contain any code, that might leave.
 // -----------------------------------------------------------------------------
@@ -163,6 +162,7 @@
 m_brctl(brctl)
 , m_isEditable(false)
 , m_currentEventKey(KNullKeyEvent)
+, m_currentEventCode(EEventNull)
 , m_scrollingSpeed(KNormalScrollRange*KZoomLevelDefaultValue/100)
 , m_focusedElementType(TBrCtlDefs::EElementNone)
 , m_pageScaler(NULL)
@@ -232,12 +232,11 @@
 }
 
 // -----------------------------------------------------------------------------
-// CWebKitView::ConstructL
+// WebView::ConstructL
 // Private Class Method
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
-void WebView::ConstructL(
-                         CCoeControl& parent)
+void WebView::ConstructL( CCoeControl& parent )
 {
     SetContainerWindowL(parent);
 
@@ -360,11 +359,10 @@
 }
 
 //-------------------------------------------------------------------------------
-// Draw ( from CCoeControl )
+// WebView::Draw ( from CCoeControl )
 // BitBlts the offscreen bitmap to the GraphicsContext
 //-------------------------------------------------------------------------------
-void WebView::Draw(
-                   const TRect& rect ) const
+void WebView::Draw( const TRect& rect ) const
 {
     if (m_pluginFullscreen) return;
 
@@ -437,11 +435,10 @@
 }
 
 //-------------------------------------------------------------------------------
-// SyncRepaint
+// WebView::syncRepaint
 // Repaint the given rectangle synchronously
 //-------------------------------------------------------------------------------
-void WebView::syncRepaint(
-                          const TRect& rect)
+void WebView::syncRepaint( const TRect& rect)
 {
     m_repaints.AddRect( rect );
     syncRepaint();
@@ -530,7 +527,7 @@
 
       // draw to back buffer
 
-   
+
     if(!(   m_widgetextension && m_widgetextension->IsWidgetPublising())) {
         mainFrame()->frameView()->draw( *m_webcorecontext, rect );
         if ( zoomLevel < m_minZoomLevel ) zoomLevel = m_minZoomLevel;
@@ -538,7 +535,7 @@
     }
 }
 //-------------------------------------------------------------------------------
-// SyncRepaint
+// WebView::syncRepaint
 // Repaint the current repaint region synchronously and clear it
 //-------------------------------------------------------------------------------
 void WebView::syncRepaint()
@@ -613,7 +610,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// DoRepaint
+// WebView::doRepaint
 // Perform a scheduled repaint
 //-------------------------------------------------------------------------------
 void WebView::doRepaint()
@@ -631,12 +628,12 @@
 }
 
 //-------------------------------------------------------------------------------
-// CollectOffscreenbitmap
+// WebView::collectOffscreenbitmap
 // Get offscreen bitmap
 //-------------------------------------------------------------------------------
 void WebView::collectOffscreenbitmapL(CFbsBitmap& snapshot)
 {
-   
+
     (snapshot).Create(m_brctl->Size(), StaticObjectsContainer::instance()->webSurface()->displayMode());
 
     CFbsBitmapDevice* device = CFbsBitmapDevice::NewL( &snapshot);
@@ -652,7 +649,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// ScheduleRepaint
+// WebView::scheduleRepaint
 // Schedule an asynchronous repaint
 //-------------------------------------------------------------------------------
 void WebView::scheduleRepaint(
@@ -667,7 +664,7 @@
 #endif
         }
     // if we are active, we'll repaint when timer fires
-    if( !m_repainttimer->IsActive() && !m_pageZoomHandler->isActive() && 
+    if( !m_repainttimer->IsActive() && !m_pageZoomHandler->isActive() &&
          m_allowRepaints) {
         // no timer yet, repaint immediatly (but asynchronously)
         m_repainttimer->Start( 0, 0, TCallBack( &doRepaintCb, this ) );
@@ -790,6 +787,325 @@
     return rv;
 }
 
+bool WebView::isNaviKey(const TKeyEvent& keyevent)
+{
+    return (    keyevent.iCode == EKeyUpArrow         // North
+             || keyevent.iCode == EKeyRightUpArrow    // Northeast
+             || keyevent.iCode == EStdKeyDevice11     //   : Extra KeyEvent supports diagonal event simulator wedge
+             || keyevent.iCode == EKeyRightArrow      // East
+             || keyevent.iCode == EKeyRightDownArrow  // Southeast
+             || keyevent.iCode == EStdKeyDevice12     //   : Extra KeyEvent supports diagonal event simulator wedge
+             || keyevent.iCode == EKeyDownArrow       // South
+             || keyevent.iCode == EKeyLeftDownArrow   // Southwest
+             || keyevent.iCode == EStdKeyDevice13     //   : Extra KeyEvent supports diagonal event simulator wedge
+             || keyevent.iCode == EKeyLeftArrow       // West
+             || keyevent.iCode == EKeyLeftUpArrow     // Northwest
+             || keyevent.iCode == EStdKeyDevice10);
+}
+
+bool WebView::handleEditable(const TKeyEvent& keyevent, TEventCode eventcode, Frame* frame )
+{
+    bool consumed = false;
+    consumed = frame->eventHandler()->keyEvent(PlatformKeyboardEvent(keyevent,eventcode));
+    // exit input on up/down key
+    // EXCEPT on touch-enabled devices. We'll just consume in that case
+    if ( !consumed && isNaviKey(keyevent) ) {
+        if (m_webfeptexteditor->validateTextFormat() ) {
+            setFocusNone();
+        }
+        else {
+            consumed = true;
+        }
+    }
+
+    return consumed;
+}
+
+
+bool WebView::handleEventKeyDown(const TKeyEvent& keyevent, TEventCode eventcode, Frame* frame)
+{
+    m_currentEventKey = keyevent;
+    m_currentEventCode = eventcode;
+    return false; // not consumed
+}
+
+
+void WebView::sendMouseEventToEngine(TPointerEvent::TType eventType, TPoint pos, Frame* frame)
+{
+    TPointerEvent event;
+    event.iPosition = pos;
+    event.iModifiers = 0;
+    event.iType = eventType;
+
+    switch (eventType) {
+        case TPointerEvent::EButton1Down:
+        {
+            frame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event));
+            break;
+        }
+
+        case TPointerEvent::EButton1Up:
+        {
+            frame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
+            break;
+        }
+
+        case TPointerEvent::EMove:
+        {
+            frame->eventHandler()->handleMouseMoveEvent(PlatformMouseEvent(event));
+            break;
+        }
+    };
+}
+
+
+void WebView::setFocusedNode(Frame* frame)
+{
+    Node* node = frame->eventHandler()->mousePressNode();
+    for (Node* n = node; n; n = n->parentNode()) {
+        if ( n->isFocusable() ) {
+            page()->focusController()->setFocusedNode(n, frame);
+        }
+    }
+}
+
+bool WebView::handleEventKeyL(const TKeyEvent& keyevent, TEventCode eventcode, Frame* frame)
+{
+    WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
+    bool consumed = false;
+
+    TKeyEvent oldKeyEvent(m_currentEventKey);
+    bool downEventConsumed = false;
+    if (m_currentEventCode == EEventKeyDown &&
+	keyevent.iCode != EKeyDevice3 ){
+        sendKeyEventToEngine(oldKeyEvent, EEventKeyDown, frame);
+    }
+    m_currentEventKey = keyevent;
+    m_currentEventCode = eventcode;
+    if (keyevent.iCode == EKeyDevice3) {
+        // pass it to webcore
+        sendMouseEventToEngine(TPointerEvent::EButton1Down,
+	                        cursor->position(), frame);
+
+        // mimic ccb's behavior of onFocus
+        setFocusedNode(frame);
+
+       // Toolbar is activated on long key press only if the element
+       // type is EElementNone during EEventKeyDown and EEventKey.
+       // This prevents toolbar from popping up in DHTML pages. Also,
+       // toolbar is activated when the user is not in fast scroll
+       // mode, or in page overview mode, or on wml page.
+       if ( ( m_focusedElementType == TBrCtlDefs::EElementNone ||
+              m_focusedElementType == TBrCtlDefs::EElementBrokenImage ) &&
+              keyevent.iRepeats && !m_brctl->wmlMode() ) {
+           launchToolBarL();
+       }
+       consumed = true;
+    }
+    else if (isNaviKey(keyevent)) {
+        if (m_brctl->settings()->getTabbedNavigation()) {
+            consumed = downEventConsumed || handleTabbedNavigation(keyevent, eventcode);
+        }
+        else {
+            consumed = handleKeyNavigation(keyevent, eventcode, frame);
+        }
+      } // if (m_brctl->settings()->getTabbedNavigation()
+      else { // Not an arrow key..
+             // activate hovered input element by just start typing
+          consumed = handleInputElement(keyevent, eventcode, frame);
+      }
+
+      if (!consumed) {
+          consumed = sendKeyEventToEngine(keyevent, eventcode, frame);
+      }
+    return consumed;
+}
+
+
+bool WebView::handleInputElement(const TKeyEvent& keyevent, TEventCode eventcode, Frame* frame)
+{
+    WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
+    if (m_focusedElementType == TBrCtlDefs::EElementInputBox ||
+        m_focusedElementType == TBrCtlDefs::EElementSelectBox ||
+        m_focusedElementType == TBrCtlDefs::EElementSelectMultiBox ||
+        m_focusedElementType == TBrCtlDefs::EElementTextAreaBox) {
+
+        sendMouseEventToEngine(TPointerEvent::EButton1Down, cursor->position(), frame);
+        sendMouseEventToEngine(TPointerEvent::EButton1Up, cursor->position(), frame);
+
+        if (m_focusedElementType == TBrCtlDefs::EElementInputBox ||
+            m_focusedElementType == TBrCtlDefs::EElementTextAreaBox) {
+            if (!m_fepTimer) {
+                m_fepTimer = new WebCore::Timer<WebView>(this, &WebView::fepTimerFired);
+            }
+
+            m_fepTimer->startOneShot(0.2f);
+            setEditable(true);
+        }
+        m_keyevent = keyevent;
+        m_eventcode = eventcode;
+    }
+    return true;
+}
+
+
+bool WebView::handleKeyNavigation(const TKeyEvent& keyevent, TEventCode eventcode, Frame* frame)
+{
+    WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
+    bool consumed = false;
+    bool fastscroll(m_fastScrollTimer->IsActive());
+
+    // start fast scrolling
+    m_showCursor = true;
+    if (!cursor->isVisible()) {
+        cursor->cursorUpdate(true);
+    }
+
+    m_savedPosition = mainFrame()->frameView()->contentPos();
+    cursor->scrollAndMoveCursor(keyevent.iCode, m_scrollingSpeed, fastscroll);
+    updateScrollbars();
+    if (!fastscroll) {
+        m_fastScrollTimer->Start(KCursorInitialDelay,KCursorUpdateFrquency,TCallBack(&scrollTimerCb,this));
+        m_scrollingStartTime.HomeTime();
+    }
+
+    // and minimap comes on
+    consumed = handleMinimapNavigation();
+
+    if (!fastscroll) {
+        sendMouseEventToEngine(TPointerEvent::EMove, cursor->position(), frame);
+    }
+
+    consumed = true;
+    return consumed;
+}
+
+
+bool WebView::handleMinimapNavigation()
+{
+    int scrollingTime = millisecondsScrolled();
+    if (!AknLayoutUtils::PenEnabled() && m_pageScalerEnabled &&
+          m_pageScaler && !isSmallPage() &&
+          m_brctl->settings()->brctlSetting(TBrCtlDefs::ESettingsPageOverview) &&
+         (scrollingTime > KPanningPageScalerStart || m_pageScaler->Visible())) {
+        m_pageScaler->SetVisibleUntil(KScalerVisibilityTime);
+    }
+    return true;
+}
+
+bool WebView::handleTabbedNavigation(const TKeyEvent& keyevent, TEventCode eventcode)
+{
+    int horizontal = 0;
+    int vertical = 0;
+    switch(keyevent.iCode) {
+        case EKeyUpArrow:             // North
+            vertical = -1;
+            break;
+
+        case EKeyRightUpArrow:        // Northeast
+        case EStdKeyDevice11:         //   : Extra KeyEvent supports diagonal event simulator wedge
+            vertical   = -1;
+            horizontal = +1;
+            break;
+
+        case EKeyRightArrow:          // East
+            horizontal = +1;
+            break;
+
+        case EKeyRightDownArrow:      // Southeast
+        case EStdKeyDevice12:         //   : Extra KeyEvent supports diagonal event simulator wedge
+            vertical   = +1;
+            horizontal = +1;
+            break;
+
+        case EKeyDownArrow:           // South
+            vertical   = +1;
+            break;
+
+        case EKeyLeftDownArrow:       // Southwest
+        case EStdKeyDevice13:         //   : Extra KeyEvent supports diagonal event simulator wedge
+            vertical   = +1;
+            horizontal = -1;
+            break;
+
+        case EKeyLeftArrow:           // West
+            horizontal = -1;
+            break;
+
+        case EKeyLeftUpArrow:         // Northwest
+        case EStdKeyDevice10:         //   : Extra KeyEvent supports diagonal event simulator wedge
+            vertical   = -1;
+            horizontal = -1;
+            break;
+
+        default:                      // (Should never get here)
+            break;
+
+    }
+    return m_tabbedNavigation->navigate(horizontal, vertical);
+}
+
+
+bool WebView::handleEventKeyUp(const TKeyEvent& keyevent, TEventCode eventcode, Frame* frame)
+{
+    bool consumed = false;
+    TInt delay = 2 * KCursorInitialDelay;
+    WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
+    m_fastScrollTimer->Cancel();
+    m_scrollingSpeed = KNormalScrollRange*100/scalingFactor();
+
+    if (viewIsFastScrolling()) {
+        setViewIsFastScrolling(false);
+        sendMouseEventToEngine(TPointerEvent::EMove, cursor->position(), frame);
+        toggleRepaintTimer(true);
+        if (!inPageViewMode()) {
+            delay = 0;
+        }
+    }
+    m_pageScrollHandler->scrollbarDrawer()->fadeScrollbar(delay);
+
+    if ( (keyevent.iScanCode == EStdKeyDevice3) ||
+         (keyevent.iScanCode == EStdKeyEnter) ) {
+        // pass it to webcore
+
+        if (m_focusedElementType == TBrCtlDefs::EElementInputBox ||
+            m_focusedElementType == TBrCtlDefs::EElementTextAreaBox) {
+            setEditable(true);
+        }
+        sendMouseEventToEngine(TPointerEvent::EButton1Up, cursor->position(), frame);
+        consumed = true;
+    }
+      if (!consumed) {
+          sendKeyEventToEngine(keyevent, eventcode, frame);
+      }
+      m_currentEventKey = KNullKeyEvent;
+      m_currentEventCode = EEventNull;
+    return consumed;
+}
+
+
+bool WebView::sendKeyEventToEngine(const TKeyEvent& keyevent,
+                                   TEventCode eventcode, Frame* frame)
+{
+    bool consumed = frame->eventHandler()->keyEvent(PlatformKeyboardEvent(keyevent,eventcode));
+
+    if (!consumed && eventcode == EEventKey &&
+        (m_brctl->capabilities() & TBrCtlDefs::ECapabilityAccessKeys)) {
+
+        TKeyEvent ke = keyevent;
+        TChar c(ke.iCode);
+        // Not consumed by WebCore, is alphanumeric and does not have any modifier
+        if (c.IsAlphaDigit() &&
+            !(ke.iModifiers & (EModifierCtrl | EModifierAlt | EModifierShift))) {
+            ke.iModifiers = EModifierCtrl;
+            frame->eventHandler()->keyEvent(PlatformKeyboardEvent(ke,EEventKeyDown));
+            consumed = true;
+        }
+    }
+    return consumed;
+}
+
+
 TKeyResponse WebView::OfferKeyEventL(const TKeyEvent& keyevent, TEventCode eventcode )
 {
     WebCursor* cursor = StaticObjectsContainer::instance()->webCursor();
@@ -806,253 +1122,37 @@
     if ( m_webFormFillPopup && m_webFormFillPopup->IsVisible() && AknLayoutUtils::PenEnabled() ) {
 	    if (EKeyWasConsumed == m_webFormFillPopup->HandleKeyEventL(keyevent, eventcode)) {
             return EKeyWasConsumed;
-	        }
+	    }
     }
 
     bool consumed = false;
     Frame* coreFrame = core(mainFrame());
     if (!coreFrame)
         return EKeyWasNotConsumed;
-
     coreFrame = page()->focusController()->focusedOrMainFrame();
 
     // edit events
     if (m_isEditable) {
-        consumed = page()->focusController()->focusedOrMainFrame()->eventHandler()->keyEvent(PlatformKeyboardEvent(keyevent,eventcode));
-        // exit input on up/down key
-        // EXCEPT on touch-enabled devices. We'll just consume in that case
-            if ( !consumed
-                 && (    keyevent.iCode == EKeyUpArrow         // North
-                      || keyevent.iCode == EKeyRightUpArrow    // Northeast
-                      || keyevent.iCode == EStdKeyDevice11     //   : Extra KeyEvent supports diagonal event simulator wedge
-                      || keyevent.iCode == EKeyRightArrow      // East
-                      || keyevent.iCode == EKeyRightDownArrow  // Southeast
-                      || keyevent.iCode == EStdKeyDevice12     //   : Extra KeyEvent supports diagonal event simulator wedge
-                      || keyevent.iCode == EKeyDownArrow       // South
-                      || keyevent.iCode == EKeyLeftDownArrow   // Southwest
-                      || keyevent.iCode == EStdKeyDevice13     //   : Extra KeyEvent supports diagonal event simulator wedge
-                      || keyevent.iCode == EKeyLeftArrow       // West
-                      || keyevent.iCode == EKeyLeftUpArrow     // Northwest
-                      || keyevent.iCode == EStdKeyDevice10 ) ) //   : Extra KeyEvent supports diagonal event simulator wedge
-                {
-                if (m_webfeptexteditor->validateTextFormat() ) {
-                    setFocusNone();
-                } else {
-                    consumed = true;
-                }
-            }
+        consumed = handleEditable(keyevent, eventcode, coreFrame);
     }
 
     // scroll events
     if (!consumed) {
         switch( eventcode ) {
         case EEventKeyDown:
-            m_currentEventKey = keyevent;
-            //page()->mainFrame()->setFocusedNodeIfNeeded();
-            //coreFrame->eventHandler()->mousePressNode()->focus();
-
+            handleEventKeyDown(keyevent, eventcode, coreFrame);
             break;
         case EEventKey:
             if (keyevent.iScanCode != m_currentEventKey.iScanCode ) return EKeyWasNotConsumed;
-            //
-            m_currentEventKey = keyevent;
-            if (keyevent.iCode == EKeyDevice3) {
-                // pass it to webcore
-                TPointerEvent event;
-                event.iPosition = StaticObjectsContainer::instance()->webCursor()->position();
-                event.iModifiers = 0;
-                event.iType = TPointerEvent::EButton1Down ;
-                coreFrame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event));
-
-                // mimic ccb's behavior of onFocus
-                Node* node = page()->focusController()->focusedOrMainFrame()->eventHandler()->mousePressNode();
-                for (Node* n = node; n; n = n->parentNode()) {
-                    if ( n->isFocusable() ) {
-                        page()->focusController()->setFocusedNode(n, page()->focusController()->focusedOrMainFrame());
-                    }
-                }
-
-                // Toolbar is activated on long key press only if the element
-                // type is EElementNone during EEventKeyDown and EEventKey.
-                // This prevents toolbar from popping up in DHTML pages. Also,
-                // toolbar is activated when the user is not in fast scroll
-                // mode, or in page overview mode, or on wml page.
-                if ( ( m_focusedElementType == TBrCtlDefs::EElementNone ||
-                       m_focusedElementType == TBrCtlDefs::EElementBrokenImage ) &&
-                       keyevent.iRepeats && !m_brctl->wmlMode() )
-                    {
-                    launchToolBarL();
-                    }
-                consumed = true;
-            } else if (    keyevent.iCode == EKeyUpArrow              // North
-                        || keyevent.iCode == EKeyRightUpArrow         // Northeast
-                        || keyevent.iCode == EStdKeyDevice11          //   : Extra KeyEvent supports diagonal event simulator wedge
-                        || keyevent.iCode == EKeyRightArrow           // East
-                        || keyevent.iCode == EKeyRightDownArrow       // Southeast
-                        || keyevent.iCode == EStdKeyDevice12          //   : Extra KeyEvent supports diagonal event simulator wedge
-                        || keyevent.iCode == EKeyDownArrow            // South
-                        || keyevent.iCode == EKeyLeftDownArrow        // Southwest
-                        || keyevent.iCode == EStdKeyDevice13          //   : Extra KeyEvent supports diagonal event simulator wedge
-                        || keyevent.iCode == EKeyLeftArrow            // West
-                        || keyevent.iCode == EKeyLeftUpArrow          // Northwest
-                        || keyevent.iCode == EStdKeyDevice10 )        //   : Extra KeyEvent supports diagonal event simulator wedge
-            {
-                if (m_brctl->settings()->getTabbedNavigation()) {
-                    int horizontal = 0;
-                    int vertical = 0;
-                    switch(keyevent.iCode)
-                    {
-                        case EKeyUpArrow:             // North
-                            vertical = -1;
-                            break;
-
-                        case EKeyRightUpArrow:        // Northeast
-                        case EStdKeyDevice11:         //   : Extra KeyEvent supports diagonal event simulator wedge
-                            vertical   = -1;
-                            horizontal = +1;
-                            break;
-
-                        case EKeyRightArrow:          // East
-                            horizontal = +1;
-                            break;
-
-                        case EKeyRightDownArrow:      // Southeast
-                        case EStdKeyDevice12:         //   : Extra KeyEvent supports diagonal event simulator wedge
-                            vertical   = +1;
-                            horizontal = +1;
-                            break;
-
-                        case EKeyDownArrow:           // South
-                            vertical   = +1;
-                            break;
-
-                        case EKeyLeftDownArrow:       // Southwest
-                        case EStdKeyDevice13:         //   : Extra KeyEvent supports diagonal event simulator wedge
-                            vertical   = +1;
-                            horizontal = -1;
-                            break;
-
-                        case EKeyLeftArrow:           // West
-                            horizontal = -1;
-                            break;
-
-                        case EKeyLeftUpArrow:         // Northwest
-                        case EStdKeyDevice10:         //   : Extra KeyEvent supports diagonal event simulator wedge
-                            vertical   = -1;
-                            horizontal = -1;
-                            break;
-
-                        default:                      // (Should never get here)
-                            break;
-
-                    }
-                    
-                   	consumed = m_tabbedNavigation->navigate(horizontal, vertical);
-                }
-                else {
-                    // start fast scrolling
-					m_showCursor = true;
-                    if (!cursor->isVisible()) {
-                        cursor->cursorUpdate(true);
-                    }
-                    bool fastscroll(m_fastScrollTimer->IsActive());
-                    m_savedPosition = mainFrame()->frameView()->contentPos();
-                    cursor->scrollAndMoveCursor(keyevent.iCode, m_scrollingSpeed, fastscroll);
-                    if (!fastscroll) {
-                        m_fastScrollTimer->Start(KCursorInitialDelay,KCursorUpdateFrquency,TCallBack(&scrollTimerCb,this));
-                        m_scrollingStartTime.HomeTime();
-                    }
-                    // and minimap comes on
-                    int scrollingTime = millisecondsScrolled();
-                    if (!AknLayoutUtils::PenEnabled() && m_pageScalerEnabled && m_pageScaler && !isSmallPage() &&
-                        m_brctl->settings()->brctlSetting(TBrCtlDefs::ESettingsPageOverview) &&
-                        (scrollingTime > KPanningPageScalerStart || m_pageScaler->Visible())) {
-                        m_pageScaler->SetVisibleUntil(KScalerVisibilityTime);
-					}
-                    //
-                    if (!fastscroll) {
-                      TPointerEvent event;
-                      event.iPosition = cursor->position();
-                      event.iModifiers = 0;
-                      event.iType = TPointerEvent::EMove;
-                      coreFrame->eventHandler()->handleMouseMoveEvent(PlatformMouseEvent(event));
-                    }
-                    consumed = true;
-                } // if (m_brctl->settings()->getTabbedNavigation()
-            } else {
-                // activate hovered input element by just start typing
-                if (m_focusedElementType == TBrCtlDefs::EElementInputBox || m_focusedElementType == TBrCtlDefs::EElementSelectBox
-                    || m_focusedElementType == TBrCtlDefs::EElementSelectMultiBox || m_focusedElementType == TBrCtlDefs::EElementTextAreaBox) {
-                    TPointerEvent event;
-                    event.iModifiers = 0;
-                    event.iPosition = cursor->position();
-                    event.iType = TPointerEvent::EButton1Down ;
-                    coreFrame->eventHandler()->handleMousePressEvent(PlatformMouseEvent(event));
-                    event.iType = TPointerEvent::EButton1Up;
-                    coreFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
-
-
-                    if (m_focusedElementType == TBrCtlDefs::EElementInputBox || m_focusedElementType == TBrCtlDefs::EElementTextAreaBox) {
-                        if (!m_fepTimer)
-                            m_fepTimer = new WebCore::Timer<WebView>(this, &WebView::fepTimerFired);
-
-                        m_fepTimer->startOneShot(0.2f);
-                        setEditable(true);
-                    }
-                    m_keyevent = keyevent;
-                    m_eventcode = eventcode;
-
-                    consumed = true;
-            }
-            }
+            consumed = handleEventKeyL(keyevent, eventcode, coreFrame);
             break;
         case EEventKeyUp:
-            m_fastScrollTimer->Cancel();
-            m_scrollingSpeed = KNormalScrollRange*100/scalingFactor();
-
-            if (viewIsFastScrolling()) {
-	      setViewIsFastScrolling(false);
-              toggleRepaintTimer(true);
-              if (AknLayoutUtils::PenEnabled() && !inPageViewMode()) {
-                  m_pageScrollHandler->scrollbarDrawer()->fadeScrollbar();
-              }
-            }
-            m_currentEventKey = KNullKeyEvent;
-            if ( (keyevent.iScanCode == EStdKeyDevice3) || (keyevent.iScanCode == EStdKeyEnter) ){
-                // pass it to webcore
-                TPointerEvent event;
-                if (m_focusedElementType == TBrCtlDefs::EElementInputBox || 
-                        m_focusedElementType == TBrCtlDefs::EElementTextAreaBox)
-                    {
-                    setEditable(true);
-                    }
-                event.iPosition = cursor->position();
-                event.iType = TPointerEvent::EButton1Up;
-                coreFrame->eventHandler()->handleMouseReleaseEvent(PlatformMouseEvent(event));
-                consumed = true;
-            }
+            consumed = handleEventKeyUp(keyevent, eventcode, coreFrame);
             break;
         }
     }
 
-    // keyevents
-    if (!consumed) {
-        consumed = coreFrame->eventHandler()->keyEvent(PlatformKeyboardEvent(keyevent,eventcode));
-        if (!consumed && eventcode == EEventKey && (m_brctl->capabilities() & TBrCtlDefs::ECapabilityAccessKeys)) {
-            TKeyEvent ke = keyevent;
-            TChar c(ke.iCode);
-            // Not consumed by WebCore, is alphanumeric and does not have any modifier
-            if (c.IsAlphaDigit() && !(ke.iModifiers & (EModifierCtrl | EModifierAlt | EModifierShift))) {
-                ke.iModifiers = EModifierCtrl;
-                coreFrame->eventHandler()->keyEvent(PlatformKeyboardEvent(ke,EEventKeyDown));
-                consumed = true;
-            }
-        }
-    }
-
-    //setEditable();
-
-    return (consumed)?EKeyWasConsumed:EKeyWasNotConsumed;
+    return (consumed) ? EKeyWasConsumed : EKeyWasNotConsumed;
 }
 
 
@@ -1062,6 +1162,20 @@
         (displayPosY * scalingFactor()) / 100, (documentWidth * scalingFactor()) / 100, Rect().Width(),
         (displayPosX * scalingFactor()) / 100);
 }
+void WebView::updateScrollbars()
+{
+    TPoint scrollDelta = mainFrame()->frameView()->contentPos() - m_savedPosition;
+    scrollDelta.iX *= 100;
+    scrollDelta.iY *= 100;
+    if (!inPageViewMode()) {
+        if (scrollDelta.iX == 0 && scrollDelta.iY == 0) {
+            m_pageScrollHandler->scrollbarDrawer()->drawScrollbar(this);
+        }
+        else {
+            m_pageScrollHandler->scrollbarDrawer()->drawScrollbar(this, scrollDelta);
+        }
+    }
+}
 
 void WebView::openPageViewL()
 {
@@ -1100,7 +1214,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// launchToolBarL
+// WebView::launchToolBarL
 //-------------------------------------------------------------------------------
 void WebView::launchToolBarL()
 {
@@ -1135,7 +1249,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// closeToolBarL
+// WebView::closeToolBarL
 //-------------------------------------------------------------------------------
 void WebView::closeToolBarL()
 {
@@ -1155,7 +1269,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// DrawDocumentPart ( from MPageScalerCallback )
+// WebView::DrawDocumentPart ( from MPageScalerCallback )
 //
 //
 //-------------------------------------------------------------------------------
@@ -1186,7 +1300,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// DocumentViewport ( from MPageScalerCallback )
+// WebView::DocumentViewport ( from MPageScalerCallback )
 //
 //
 //-------------------------------------------------------------------------------
@@ -1196,7 +1310,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// ScaledPageChanged ( from MPageScalerCallback )
+// WebView::ScaledPageChanged ( from MPageScalerCallback )
 //
 //
 //-------------------------------------------------------------------------------
@@ -1224,7 +1338,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// DocumentSize ( from MPageScalerCallback )
+// WebView::DocumentSize ( from MPageScalerCallback )
 //
 //
 //-------------------------------------------------------------------------------
@@ -1234,7 +1348,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// TouchScrolling ( from MPageScalerCallback )
+// WebView::TouchScrolling ( from MPageScalerCallback )
 //
 //
 //-------------------------------------------------------------------------------
@@ -1431,12 +1545,6 @@
     toggleRepaintTimer(false);
     m_scrollingSpeed = milli>=KPanningMaxTime ? KPanningMaxSpeed : KPanningStartSpeed+(KPanningMaxSpeed-KPanningStartSpeed)*Max(milli-KPanningStartTime,0)/KPanningMaxTime;
     m_scrollingSpeed = m_scrollingSpeed*100/scalingFactor();
-    TPoint scrollDelta = mainFrame()->frameView()->contentPos() - m_savedPosition;
-    scrollDelta.iX *= 100;
-    scrollDelta.iY *= 100;
-    if (AknLayoutUtils::PenEnabled() && !inPageViewMode()) {
-        m_pageScrollHandler->scrollbarDrawer()->drawScrollbar(this, scrollDelta);
-    }
     OfferKeyEventL(m_currentEventKey, EEventKey);
 }
 
@@ -1474,9 +1582,9 @@
 {
     if (!m_findKeyword) {
         WebFrame* frame = mainFrame()->findFrameWithSelection();
-        if(frame) {
-			frame->clearSelection();
-        }
+        if (frame) {
+            frame->clearSelection();
+            }
         return TBrCtlDefs::EFindNoMatches;
     }
     return search(*m_findKeyword, forward, true);
@@ -1517,7 +1625,7 @@
             return TBrCtlDefs::EFindMatch;
         }
         if (onlyOneFrame) {
-			startFrame->clearSelection();
+            startFrame->clearSelection();
             return TBrCtlDefs::EFindNoMatches;
         }
         frame = nextFrame;
@@ -1533,9 +1641,9 @@
             return TBrCtlDefs::EFindMatch;
     }
 
-	if(frame) {
-		frame->clearSelection();
-	}		
+    if (frame) {
+        frame->clearSelection();
+        }
     return TBrCtlDefs::EFindNoMatches;
 }
 
@@ -1564,8 +1672,8 @@
 
 
 //-------------------------------------------------------------------------------
-// HandlePointerBufferReadyL
-// Handles Pointer Move Events
+// WebView::HandlePointerBufferReadyL
+// Handles pointer move events
 //-------------------------------------------------------------------------------
 void WebView::HandlePointerBufferReadyL()
 {
@@ -1583,8 +1691,8 @@
 }
 
 //-------------------------------------------------------------------------------
-// HandlePointerEventL
-// Handles Pointer Events
+// WebView::HandlePointerEventL
+// Handles pointer events
 //-------------------------------------------------------------------------------
 void WebView::HandlePointerEventL(const TPointerEvent& aPointerEvent)
 {
@@ -1602,7 +1710,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// HandleShowAnchorHref()
+// WebView::handleShowAnchorHrefL
 // Display a popup with the url of an anchor
 //-------------------------------------------------------------------------------
 void WebView::handleShowAnchorHrefL()
@@ -1639,7 +1747,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// FocusedImageLC()
+// WebView::focusedImageLC
 // Return the image that is under the cursor
 //-------------------------------------------------------------------------------
 TBrCtlImageCarrier* WebView::focusedImageLC()
@@ -1654,7 +1762,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// LoadFocusedImageL()
+// WebView::loadFocusedImageL
 // Load the image that is under the cursor
 //-------------------------------------------------------------------------------
 void WebView::loadFocusedImageL()
@@ -1667,7 +1775,7 @@
 }
 
 //-------------------------------------------------------------------------------
-// RemovePopup()
+// WebView::removePopup
 // Delete the popupDrawer
 //-------------------------------------------------------------------------------
 void WebView::removePopup()
@@ -1680,6 +1788,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::zoomLevels
 //-------------------------------------------------------------------------------
 RArray<TUint>* WebView::zoomLevels()
 {
@@ -1687,6 +1796,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::setZoomLevel
 //-------------------------------------------------------------------------------
 void WebView::setZoomLevel(int zoomLevel)
 {
@@ -1699,6 +1809,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::setBitmapZoomLevel
 //-------------------------------------------------------------------------------
 void WebView::setBitmapZoomLevel(int zoomLevel)
 {
@@ -1755,6 +1866,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::restoreZoomLevel
 //-------------------------------------------------------------------------------
 void WebView::restoreZoomLevel(int zoomLevel)
 {
@@ -1768,6 +1880,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::resetZoomLevel
 //-------------------------------------------------------------------------------
 void WebView::resetZoomLevel(void)
 {
@@ -1812,6 +1925,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::updateMinZoomLevel
 //-------------------------------------------------------------------------------
 void WebView::updateMinZoomLevel(TSize size)
 {
@@ -1858,6 +1972,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::UpdateZoomArray
 //-------------------------------------------------------------------------------
 void WebView::UpdateZoomArray()
 {
@@ -1893,6 +2008,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::zoomLevelChanged
 //-------------------------------------------------------------------------------
 void WebView::zoomLevelChanged(int newZoomLevel)
 {
@@ -1964,6 +2080,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView:::resetLastZoomLevelIfNeeded
 //-------------------------------------------------------------------------------
 void WebView::resetLastZoomLevelIfNeeded()
 {
@@ -1972,7 +2089,7 @@
 }
 
 //-----------------------------------------------------------------------------
-// setZoomLevelAdaptively()
+// WebView::setZoomLevelAdaptively()
 //-----------------------------------------------------------------------------
 void WebView::setZoomLevelAdaptively()
 {
@@ -1980,25 +2097,25 @@
 
   // Double Tap Zooming: it toggles between default, maxiZoomLevel.
   // Depending on the current zoom level:
-  //   A. If the current is already the max, it zooms to the max 
+  //   A. If the current is already the max, it zooms to the max
   //   B. If the current is bigger than/equal to the default zoom level zooms to the default, it zooms to the max
-  //   C. Otherwise it zooms to the default level first. 
+  //   C. Otherwise it zooms to the default level first.
   // For the mobile pages, such as google.com and cnn.com, minimum zoom level equals
   // to the default zoom level. Zooming is only possible between default and maximum
   // zoom level, double tap only won't reach logic C
   //
-  // For both mobile and non-mobile pages, it creates the same end user double tap 
-  // experiences 
-  
+  // For both mobile and non-mobile pages, it creates the same end user double tap
+  // experiences
+
     if (m_currentZoomLevel == m_maxZoomLevel ) {
-        zoomLevel = KZoomLevelDefaultValue;    	
+        zoomLevel = KZoomLevelDefaultValue;
     }
     else if (m_currentZoomLevel >= KZoomLevelDefaultValue ) {
         zoomLevel = m_maxZoomLevel;
-    }	
+    }
     else {
-        zoomLevel = KZoomLevelDefaultValue;    	
-    } 
+        zoomLevel = KZoomLevelDefaultValue;
+    }
 
     // move the content
     WebFrameView* view = mainFrame()->frameView();
@@ -2022,6 +2139,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::openPluginPlayer
 // Called when user clicks a plugin which is able to accept user input,
 // this feature is only used in US build
 //-------------------------------------------------------------------------------
@@ -2049,6 +2167,7 @@
     page()->focusController()->setFocusedNode(NULL, page()->focusController()->focusedOrMainFrame());
 }
 //-------------------------------------------------------------------------------
+// WebView::closePluginPlayer
 //-------------------------------------------------------------------------------
 void WebView::closePluginPlayer()
 {
@@ -2064,6 +2183,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::createWidgetExtension
 //-------------------------------------------------------------------------------
 CWidgetExtension* WebView::createWidgetExtension(MWidgetCallback &aWidgetCallback)
 {
@@ -2078,6 +2198,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::forceLayoutAndResize
 //-------------------------------------------------------------------------------
 void WebView::forceLayoutAndResize(WebFrame* frame)
 {
@@ -2106,6 +2227,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::showZoomSliderL
 //-------------------------------------------------------------------------------
 void WebView::showZoomSliderL()
 {
@@ -2120,6 +2242,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::hideZoomSliderL
 //-------------------------------------------------------------------------------
 void WebView::hideZoomSliderL()
 {
@@ -2129,6 +2252,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::notifyZoomSliderModeChangeL
 //-------------------------------------------------------------------------------
 void WebView::notifyZoomSliderModeChangeL( bool mode )
 {
@@ -2139,6 +2263,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::maxZoomLevel
 //-------------------------------------------------------------------------------
 int WebView::maxZoomLevel()
 {
@@ -2146,6 +2271,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::minZoomLevel
 //-------------------------------------------------------------------------------
 int WebView::minZoomLevel()
 {
@@ -2153,6 +2279,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::updateZoomLevel
 //-------------------------------------------------------------------------------
 void WebView::updateZoomLevel( TBrCtlDefs::TBrCtlSettings setting, unsigned int value)
 {
@@ -2178,6 +2305,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::EnterFullscreenBrowsingL
 //-------------------------------------------------------------------------------
 void WebView::EnterFullscreenBrowsingL()
 {
@@ -2188,6 +2316,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::LeaveFullscreenBrowsingL
 //-------------------------------------------------------------------------------
 void WebView::LeaveFullscreenBrowsingL()
 {
@@ -2198,6 +2327,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::notifyFullscreenModeChangeL
 //-------------------------------------------------------------------------------
 void WebView::notifyFullscreenModeChangeL(bool mode)
 {
@@ -2206,6 +2336,7 @@
 }
 
 //-------------------------------------------------------------------------------
+// WebView::checkForZoomChange
 //-------------------------------------------------------------------------------
 void WebView::checkForZoomChange()
 {
@@ -2259,6 +2390,7 @@
      m_redirectWithLockedHistory = value;
 }
 //-------------------------------------------------------------------------------
+// WebView::notifyPlugins
 // Webview notifies plugins to handle play/pause of .swf files when user switches to menu/another application
 //-------------------------------------------------------------------------------
 void WebView::notifyPlugins(TBool focus)
@@ -2314,7 +2446,7 @@
 
 
 //-----------------------------------------------------------------------------
-// setZoomCursorPosition(TBool)
+// WebView::setZoomCursorPosition
 // Set the cursor position while zooming, this is only for non-touch device
 //-----------------------------------------------------------------------------
 void WebView::setZoomCursorPosition(TBool isZoomIn)
@@ -2359,7 +2491,7 @@
 
 
 // ---------------------------------------------------------------------------
-// FindCurrentZoomIndex
+// WebView::FindCurrentZoomIndex
 // ---------------------------------------------------------------------------
 TInt WebView::FindCurrentZoomIndex(TInt aCurrentZoomLevel)
 {
@@ -2381,7 +2513,7 @@
     return m_widgetextension ? m_widgetextension->GetWidgetId():0;
 }
 
-void WebView::setShowCursor(TBool showCursor) 
+void WebView::setShowCursor(TBool showCursor)
 {
     m_showCursor = showCursor;
     StaticObjectsContainer::instance()->webCursor()->setCursorVisible(showCursor);
--- a/webengine/osswebengine/WebKit/s60/webview/WebView.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebView.h	Fri May 08 08:25:06 2009 +0300
@@ -35,6 +35,7 @@
     class DOMDocument;
     class FormState;
     class Element;
+    class Frame;
 }
 
 class CPluginHandler;
@@ -167,6 +168,7 @@
         WebPointerEventHandler* pointerEventHandler() { return m_webpointerEventHandler; }
         void updateScrollbars(int documentHeight, int displayPosY,
             int documentWidth, int displayPosX);
+        void updateScrollbars();
         void openPageViewL();
         void closePageView();
         void cancelPageView();
@@ -441,7 +443,21 @@
         void zoomLevelChanged(int newZoomLevel);
         void UpdateZoomArray();
         TInt FindCurrentZoomIndex(TInt aCurrentZoomLevel);
+        bool sendKeyEventToEngine(const TKeyEvent& keyevent, 
+	                          TEventCode eventcode, WebCore::Frame* frame);
 
+        // helper functions for OfferKeyEventL
+        bool handleEventKeyDown(const TKeyEvent& keyevent, TEventCode eventcode, WebCore::Frame* frame);
+        bool handleTabbedNavigation(const TKeyEvent& keyevent, TEventCode eventcode);
+        bool handleMinimapNavigation();
+        bool handleKeyNavigation(const TKeyEvent& keyevent, TEventCode eventcode, WebCore::Frame* frame);
+        bool handleInputElement(const TKeyEvent& keyevent, TEventCode eventcode, WebCore::Frame* frame);
+        bool handleEventKeyL(const TKeyEvent& keyevent, TEventCode eventcode, WebCore::Frame* frame);
+        void setFocusedNode(WebCore::Frame* frame);
+        void sendMouseEventToEngine(TPointerEvent::TType eventType, TPoint pos, WebCore::Frame* frame);
+        bool handleEventKeyUp(const TKeyEvent& keyevent, TEventCode eventcode, WebCore::Frame* frame);
+        bool handleEditable(const TKeyEvent& keyevent, TEventCode eventcode, WebCore::Frame* frame );
+        bool isNaviKey(const TKeyEvent& keyevent);
     public:
         void fepTimerFired(WebCore::Timer<WebView>*);
         void fepVKBTimerFired(WebCore::Timer<WebView>*);
@@ -475,6 +491,7 @@
 
         TTime m_scrollingStartTime;
         TKeyEvent m_currentEventKey;
+        TEventCode m_currentEventCode;
         CPeriodic* m_fastScrollTimer;
         int m_scrollingSpeed;
         TBrCtlDefs::TBrCtlElementType m_focusedElementType;
--- a/webengine/osswebengine/WebKit/s60/webview/webview_api_test/tsrc/group/Copy of WebViewApiTest.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  ?Description
-*
-*/
-
-#include <domain/osextensions/platform_paths.hrh>
-#include <data_caging_paths.hrh>
-#include "/../../../../WebEngine/OssWebEngine/WebKit/s60/group/common.mmpi"
-
-TARGET          WebViewApiTest.dll
-TARGETTYPE      dll
-UID             0x1000008D 0x101FB3E3
-
-CAPABILITY      ALL -TCB
-/* Remove comments and replace 0x00000000 with correct vendor id */
-// VENDORID     0x00000000
-/* Remove comments and replace 0x00000000 with correct secure id */
-// SECUREID     0x00000000
-
-DEFFILE         WebView.def
-
-USERINCLUDE .
-//USERINCLUDE ../inc
-//USERINCLUDE ../../inc
-USERINCLUDE ../../../../WebEngine/PageScaler/inc
-USERINCLUDE ../mock/inc
-
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/wtf
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/kjs
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/pcre
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/bindings
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/bindings/c
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/wtf/unicode
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/wtf/unicode/symbian
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/wtf/symbian
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/icu
-USERINCLUDE ../../../../WebEngine/OssWebEngine/JavaScriptCore/ForwardingHeaders
-
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/platform
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/platform/symbian
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/platform/network
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/platform/network/symbian
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/platform/graphics
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/history
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/icu
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/bindings/js
-
-USERINCLUDE ../../../../WebEngine/OssWebEngine/MemoryManager/Inc 
-USERINCLUDE ../../../../WebEngine/OssWebEngine/DerivedSources/WebCore
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebKit/Misc
-USERINCLUDE ../../../../WebEngine/OssWebEngine/WebKit/S60/WebView
-USERINCLUDE /S60/mw/web/inc
-USERINCLUDE ../../../../WebEngine/Device/inc
-
-SYSTEMINCLUDE ../../../../WebEngine/OssWebEngine/DerivedSources/JavaScriptCore
-
-APP_LAYER_SYSTEMINCLUDE
-
-SYSTEMINCLUDE   . 
-SYSTEMINCLUDE /epoc32/include/ecom
-SYSTEMINCLUDE /epoc32/include/http
-//SYSTEMINCLUDE /epoc32/include/libc
-SYSTEMINCLUDE /epoc32/include/libc/sys
-SYSTEMINCLUDE /epoc32/include/stdapis
-//SYSTEMINCLUDE ../../../../WebEngine/OssWebEngine/WebCore/platform/symbian/Libxml2
-
-
-SOURCEPATH      ../src
-SOURCEPATH      ../mock/src
-SOURCE          WebViewApiTest.cpp WebViewApiTestBlocks.cpp
-SOURCE			    WebViewApiTestContainer.cpp BrCtlApiTestContainer.cpp
-SOURCE			    BrCtlApiTestDialogsProvider.cpp BrCtlApiTestObserver.cpp BrCtlApiTestStateChangeObserver.cpp
-
-SOURCEPATH      ../mock/src
-SOURCE					BrCtlTest.cpp
-
-LIBRARY         euser.lib cone.lib eikcore.lib apparc.lib avkon.lib 
-LIBRARY         flogger.lib apmime.lib apgrfx.lib efsrv.lib eikcoctl.lib 
-LIBRARY         commonui.lib ecom.lib eikdlg.lib aknnotify.lib
-
-// stif framework
-LIBRARY         stiftestinterface.lib stiftestengine.lib
-
-// component under test
-LIBRARY     browserengine.lib
-
-LANG            SC
-
-// End of File
\ No newline at end of file
--- a/webengine/osswebengine/WebKit/s60/webview/webview_api_test/tsrc/group/WebViewApiTest.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/webview_api_test/tsrc/group/WebViewApiTest.mmp	Fri May 08 08:25:06 2009 +0300
@@ -18,6 +18,7 @@
 #include <domain/osextensions/platform_paths.hrh>
 #include <data_caging_paths.hrh>
 //#include "/../../../../WebEngine/OssWebEngine/WebKit/s60/group/common.mmpi"
+#include <platform/mw/Browser_platform_variant.hrh>
 
 TARGET          WebViewApiTest.dll
 TARGETTYPE      dll
@@ -29,7 +30,7 @@
 /* Remove comments and replace 0x00000000 with correct secure id */
 // SECUREID     0x00000000
 
-LANG            SC
+LANGUAGE_IDS
 
 DEFFILE         WebViewApiTest.def
 
--- a/webengine/osswebengine/cache/group/EABI/BrowserCacheu.def	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/group/EABI/BrowserCacheu.def	Fri May 08 08:25:06 2009 +0300
@@ -16,14 +16,12 @@
 	_ZTI17CHttpCacheHandler @ 15 NONAME ; #<TI>#
 	_ZTI17CHttpCacheManager @ 16 NONAME ; #<TI>#
 	_ZTI21CHttpCacheLookupTable @ 17 NONAME ; #<TI>#
-	_ZTI21CHttpCacheStreamEntry @ 18 NONAME ; #<TI>#
-	_ZTI23CHttpCacheStreamHandler @ 19 NONAME ; #<TI>#
-	_ZTI25CHttpCacheEvictionHandler @ 20 NONAME ; #<TI>#
-	_ZTV15CHttpCacheEntry @ 21 NONAME ; #<VT>#
-	_ZTV17CHttpCacheHandler @ 22 NONAME ; #<VT>#
-	_ZTV17CHttpCacheManager @ 23 NONAME ; #<VT>#
-	_ZTV21CHttpCacheLookupTable @ 24 NONAME ; #<VT>#
-	_ZTV21CHttpCacheStreamEntry @ 25 NONAME ; #<VT>#
-	_ZTV23CHttpCacheStreamHandler @ 26 NONAME ; #<VT>#
-	_ZTV25CHttpCacheEvictionHandler @ 27 NONAME ; #<VT>#
+	_ZTI23CHttpCacheStreamHandler @ 18 NONAME ; #<TI>#
+	_ZTI25CHttpCacheEvictionHandler @ 19 NONAME ; #<TI>#
+	_ZTV15CHttpCacheEntry @ 20 NONAME ; #<VT>#
+	_ZTV17CHttpCacheHandler @ 21 NONAME ; #<VT>#
+	_ZTV17CHttpCacheManager @ 22 NONAME ; #<VT>#
+	_ZTV21CHttpCacheLookupTable @ 23 NONAME ; #<VT>#
+	_ZTV23CHttpCacheStreamHandler @ 24 NONAME ; #<VT>#
+	_ZTV25CHttpCacheEvictionHandler @ 25 NONAME ; #<VT>#
 
--- a/webengine/osswebengine/cache/inc/HttpCacheEntry.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/inc/HttpCacheEntry.h	Fri May 08 08:25:06 2009 +0300
@@ -20,8 +20,11 @@
 
 //  INCLUDES
 #include <e32base.h>
+#include <f32file.h>
 
 // CONSTANTS
+const TInt KBufferSize32k = 32768;
+const TInt KBufferSizeZero = 0;
 
 // MACROS
 
@@ -155,7 +158,7 @@
         * @param 
         * @return 
         */
-        inline TUint Size() const { return iSize; }
+        inline TUint BodySize() const { return iBodySize; }
 
         /**
         * 
@@ -163,7 +166,7 @@
         * @param 
         * @return 
         */
-        void SetSize( TUint aSize );
+        void SetBodySize( TUint aSize );
 
         /**
         * 
@@ -183,6 +186,38 @@
 
         /**
         * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        inline RFile& HeaderFile() { return iHeaderFile; }
+
+        /**
+        * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        inline RFile& BodyFile() { return iBodyFile; }
+
+        /**
+        * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        TPtr8 CacheBuffer();
+        
+        /**
+        * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        void SetCacheBufferL( TInt aCacheBufferSize );
+
+        /**
+        * 
         * @since 3.1
         * @param 
         * @return 
@@ -221,6 +256,41 @@
         */
         void Accessed(TInt64 aLastAccessed, TUint16 aRef);
 
+        /**
+        * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        inline TBool BodyFileDeleteNeeded() { return iBodyFileDeleteNeeded; }
+
+        /**
+        * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        inline void SetBodyFileDeleteNeeded( TBool aBodyFileDeleteNeeded )
+                    {
+                    iBodyFileDeleteNeeded = aBodyFileDeleteNeeded;
+                    }
+
+        /**
+        * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        TBool CacheFilesOpened() { return iCacheFilesOpened; }
+
+        /**
+        * 
+        * @since 7.1
+        * @param 
+        * @return 
+        */
+        void SetCacheFilesOpened( TBool aCacheFilesOpened );
+
     public : 
 
         // support linked list
@@ -245,9 +315,9 @@
     private:    // Data
 
         //
-        HBufC8*                         iUrl;       // owned
+        HBufC8*                         iUrl;               // owned
         // if empty, then use url to get filename
-        HBufC*                          iFileName; // owned
+        HBufC*                          iFileName;          // owned
         //
         TCacheEntryState                iState;
         //
@@ -255,17 +325,27 @@
         // ref counter
         TUint16                         iRef;
         // content size
-        TUint                           iSize;
+        TUint                           iBodySize;
         // header size
         TUint16                         iHeaderSize;
         // protected content like css, script
         TUint8                          iProtected;
         //
-        TSglQueLink                     iSlink;
+        TSglQueLink                     iSqlQueLink;
+        //
+        CHttpCacheEvictionHandler*      iEvictionHandler;   // not owned
+        // Etrue if added to the eviction table
+        TUint8                          iEvictionCandidate;
+        //
+        TBool                           iBodyFileDeleteNeeded;
         //
-        CHttpCacheEvictionHandler*      iEvictionHandler;         // not owned
-        // Etrue if added to the eviction table
-        TUint8                          iVictim;
+        RFile                           iHeaderFile;        // owned
+        //
+        RFile                           iBodyFile;          // owned
+        //
+        HBufC8*                         iCacheBuffer;       // owned
+        // ETrue if files open (and attached to StreamHandler) for read/write
+        TBool                           iCacheFilesOpened;
     };
 
 #endif      // CHTTPCACHEENTRY_H
--- a/webengine/osswebengine/cache/inc/HttpCacheEvictionHandler.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/inc/HttpCacheEvictionHandler.h	Fri May 08 08:25:06 2009 +0300
@@ -84,14 +84,6 @@
         * @param 
         * @return 
         */
-        void Changed( CHttpCacheEntry& aCacheEntry ); 
-
-        /**
-        * 
-        * @since 3.1
-        * @param 
-        * @return 
-        */
         void Remove( CHttpCacheEntry& aCacheEntry ); 
 
         /**
@@ -160,9 +152,13 @@
         */
         TInt FastLog2( TUint aNum );
 
-#ifdef __CACHELOG__
+        /**
+        * Used for debugging
+        * @since 3.1
+        * @param 
+        * @return 
+        */
         void LogBuckets();
-#endif // __CACHELOG__
 
     private:    // Data
 
--- a/webengine/osswebengine/cache/inc/HttpCacheHandler.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/inc/HttpCacheHandler.h	Fri May 08 08:25:06 2009 +0300
@@ -304,7 +304,7 @@
         * @param
         * @return
         */
-        void HandleCorruptEntry( CHttpCacheEntry& aStrayEntry, TBool aUpdate = ETrue );
+        void DeleteCacheEntry( CHttpCacheEntry& aEntry, TBool aUpdate = ETrue );
 
 
         /**
@@ -332,8 +332,8 @@
         HBufC*                          iIndexFile; // owned
         // Observing changes in cache
         CHttpCacheObserver* iHttpCacheObserver; // owned
-	// An opened and configured file server session
-	RFs iRfs;
+    	// An opened and configured file server session
+    	RFs iRfs;
     };
 
 #endif      // CHTTPCACHEHANDLER_H
--- a/webengine/osswebengine/cache/inc/HttpCacheLookupTable.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/inc/HttpCacheLookupTable.h	Fri May 08 08:25:06 2009 +0300
@@ -118,7 +118,7 @@
         * @param
         * @return
         */
-        void EraseCorruptEntry( const TDesC8& aUrl );
+        void EraseCacheEntry( const TDesC8& aUrl );
         
         /**
         *
--- a/webengine/osswebengine/cache/inc/HttpCacheManager.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/inc/HttpCacheManager.h	Fri May 08 08:25:06 2009 +0300
@@ -250,6 +250,7 @@
         */
 
         TBool VSSHeaderCheck(  TDes8*  aHttpHeaderString ) const ;
+
     private:    // Data
 
         CHttpCacheHandler*                         iCache;      // owned
--- a/webengine/osswebengine/cache/inc/HttpCacheStreamHandler.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/inc/HttpCacheStreamHandler.h	Fri May 08 08:25:06 2009 +0300
@@ -43,183 +43,6 @@
 *  @lib
 *  @since 3.1
 */
-class CHttpCacheStreamEntry : public CBase
-    {
-    public:  // Constructors and destructor
-
-        /**
-        * Two-phased constructor.
-        * @since 3.1
-        * @param
-        * @param
-        * @return CHttpCacheStreamEntry object.
-        */
-        static CHttpCacheStreamEntry* NewL( RFs& aRfs, CHttpCacheEntry& aHttpCacheEntry, TDriveUnit aDrive,
-            TInt64 aCriticalLevel );
-
-        /**
-        * Destructor.
-        */
-        virtual ~CHttpCacheStreamEntry();
-
-    public: // new functions
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        inline CHttpCacheEntry* CacheEntry() const { return iHttpCacheEntry; }
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        void Erase();
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        HBufC8* HeadersL();
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        HBufC8* NextChunkL( TBool& aLastChunk );
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        TInt SaveHeaders( const TDesC8& aHeaderStr );
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        void RemoveHeaders();
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        TInt SaveBodyData( const TDesC8& aBodyStr );
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        void RemoveBodyData();
-
-        /**
-        * Flush
-        * @since 3.1
-        * @param
-        * @return
-        */
-        TInt Flush();
-
-    private:
-
-        /**
-        * Construct.
-        * @since 3.1
-        * @param
-        * @param
-        * @return CHttpCacheStreamEntry object.
-        */
-        CHttpCacheStreamEntry( RFs& aRfs, CHttpCacheEntry& aHttpCacheEntry, TDriveUnit aDrive,
-            TInt64 aCriticalLevel );
-
-        /**
-        * By default Symbian 2nd phase constructor is private.
-        */
-        void ConstructL();
-
-    private: //
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        void GetHeaderFileName( const TFileName& aBodyFileName, TFileName& aHeaderFileName );
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        TBool OpenCacheFiles();
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        TBool CreateNewFilesL();
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        void BodyFileName( TFileName& aBodyFileName );
-
-        /**
-        *
-        * @since 3.1
-        * @param
-        * @return
-        */
-        TBool DiskSpaceBelowCriticalLevel( TInt aContentSize );
-
-    private:    // Data
-
-        //
-        TBool               iFileOk;
-        //
-        RFs                 iRfs;       // not owned
-        //
-        RFile               iHeaderFile;      // owned
-        //
-        RFile               iBodyFile;      // owned
-        //
-        CHttpCacheEntry*    iHttpCacheEntry; // not owned
-        //
-        TDriveUnit          iDrive;
-        //
-        TInt64              iCriticalLevel;
-        //
-        HBufC8*             iCacheBuffer;   // owned
-    };
-
-/**
-*
-*  @lib
-*  @since 3.1
-*/
 class CHttpCacheStreamHandler : public CBase
     {
     public:  // Constructors and destructor
@@ -254,6 +77,14 @@
         * @param
         * @return
         */
+        inline void SetSavedContentSize( TInt aContentSize ) { iContentSize = aContentSize; }
+
+        /**
+        *
+        * @since 3.1
+        * @param
+        * @return
+        */
         TBool AttachL( CHttpCacheEntry& aCacheEntry );
 
         /**
@@ -262,7 +93,7 @@
         * @param
         * @return
         */
-        void Detach( const CHttpCacheEntry& aCacheEntry );
+        void Detach( CHttpCacheEntry& aCacheEntry );
 
         /**
         *
@@ -270,7 +101,7 @@
         * @param
         * @return
         */
-        void Erase( const CHttpCacheEntry& aCacheEntry );
+        void EraseCacheFile( CHttpCacheEntry& aCacheEntry );
 
         /**
         *
@@ -334,17 +165,16 @@
         * @param
         * @return
         */
-        inline void SetStartupCacheSize( TInt aContentSize ) { iContentSize = aContentSize; }
+        TBool OpenCacheFiles( CHttpCacheEntry& aCacheEntry );
 
-#ifdef _DEBUG
         /**
         *
         * @since 3.1
         * @param
         * @return
         */
-        inline TBool Find( const CHttpCacheEntry& aCacheEntry ) { return ( FindStreamEntry( aCacheEntry ) != NULL );  }
-#endif // _DEBUG
+        TBool CreateNewFilesL( CHttpCacheEntry& aCacheEntry );
+
     private:
 
         /**
@@ -369,24 +199,28 @@
         * @param
         * @return
         */
-        CHttpCacheStreamEntry* FindStreamEntry( const CHttpCacheEntry& aCacheEntry, TInt* aIndex = NULL );
-
-
+        TBool IsDiskSpaceAvailable( TInt aContentSize );
+        
+        /**
+        *
+        * @since 7.1
+        * @param
+        * @return
+        */
+        void FindCacheEntryIndex( const CHttpCacheEntry& aCacheEntry, TInt* aIndex );
 
     private:    // Data
 
         //
-        RFs                                         iRfs;               // owned
+        RFs                                 iRfs;               // owned
         // attached entries
-        CArrayPtrFlat<CHttpCacheStreamEntry>*       iActiveEntries;     // owned
-        //
-        TInt                                        iContentSize;
+        CArrayPtrFlat<CHttpCacheEntry>*     iActiveEntries;     // owned
         //
-        TDriveUnit          iDrive;
+        TInt                                iContentSize;
         //
-        TInt64              iCriticalLevel;
+        TDriveUnit                          iDrive;
         //
-        TInt                iDiskFull;
+        TInt64                              iCriticalLevel;
     };
 
 #endif      // CHTTPCACHESTREAMHANDLER_H
--- a/webengine/osswebengine/cache/inc/HttpCacheUtil.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/inc/HttpCacheUtil.h	Fri May 08 08:25:06 2009 +0300
@@ -36,6 +36,15 @@
     EMethodTrace,
     };
 
+enum TLogItemType
+    {
+    ELogItemTypeNone,
+    ELogBucketIndex,
+    ELogEntrySize,
+    ELogLookupTablePos,
+    ELogFileErrorCode
+    };
+
 const TInt KCacheVersionNumber = 1;
 //make 16 subdirectories named 0 through F for organizing cached files
 const TUint32 KCacheSubdirCount = 16;
@@ -138,7 +147,7 @@
         * @return
         */
         static TCacheLoadMethod MethodFromStr( RStringF aMethodStr, RStringPool aStrP );
-
+     
         /**
         *
         * @since 3.1
@@ -230,7 +239,7 @@
         static TInt GetCacheControls( const RHTTPHeaders& aHeaders, TInt64* aMaxAge, TInt64* aMinFresh, TInt64* aMaxStale, TBool* aMustRevalidate,
             TBool* aNoCache, TBool* aNoStore, RStringPool aStrP );
 
-    /**
+        /**
         *
         * @since 3.1
         * @param
@@ -248,6 +257,18 @@
 
         /**
         *
+        * @since 7.1
+        * @param
+        * @return
+        */
+        static void WriteLogFilenameAndUrl( TInt aLogLevel,
+                                            TPtrC aMethodName,
+                                            const TPtrC aFilename,
+                                            const TDesC8& aUrl,
+                                            TInt aAny,
+                                            TLogItemType aItemType = ELogItemTypeNone );
+        /**
+        *
         * @since 3.1
         * @param
         * @return
--- a/webengine/osswebengine/cache/src/HttpCacheEntry.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/src/HttpCacheEntry.cpp	Fri May 08 08:25:06 2009 +0300
@@ -27,7 +27,7 @@
 // EXTERNAL FUNCTION PROTOTYPES
 
 // CONSTANTS
-const TInt CHttpCacheEntry::iOffset = _FOFF( CHttpCacheEntry, iSlink );
+const TInt CHttpCacheEntry::iOffset = _FOFF( CHttpCacheEntry, iSqlQueLink );
 
 // MACROS
 
@@ -49,8 +49,7 @@
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CHttpCacheEntry::CHttpCacheEntry(
-    CHttpCacheEvictionHandler& aEvictionHandler )
+CHttpCacheEntry::CHttpCacheEntry( CHttpCacheEvictionHandler& aEvictionHandler )
     : iState( ECacheUninitialized ),
       iEvictionHandler( &aEvictionHandler )
     {
@@ -61,8 +60,7 @@
 // Symbian 2nd phase constructor can leave.
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEntry::ConstructL(
-    const TDesC8& aUrl )
+void CHttpCacheEntry::ConstructL( const TDesC8& aUrl )
     {
     iUrl = aUrl.AllocL();
     iFileName = KNullDesC().AllocL();
@@ -100,15 +98,29 @@
     return self;
     }
 
+// -----------------------------------------------------------------------------
 // Destructor
+// -----------------------------------------------------------------------------
+//
 CHttpCacheEntry::~CHttpCacheEntry()
     {
-  if( iVictim && iEvictionHandler)
-    {
-    iEvictionHandler->Remove( *this );
-    }
+    // Clean up eviction handler
+    if ( iEvictionCandidate && iEvictionHandler )
+        {
+        iEvictionHandler->Remove( *this );
+        }
+
+    // Close files, this will commit changes
+    if ( iCacheFilesOpened )
+        {
+        iHeaderFile.Close();
+        iBodyFile.Close();
+        }
+
+    // Clean up our memory
     delete iUrl;
     delete iFileName;
+    delete iCacheBuffer;
     }
 
 // -----------------------------------------------------------------------------
@@ -116,30 +128,29 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEntry::SetState(
-    TCacheEntryState aState )
+void CHttpCacheEntry::SetState( TCacheEntryState aState )
     {
-    // add entry to the eviction table once it gets completed
-    if( aState == ECacheComplete && !iVictim )
+    // Add entry to the eviction table once it gets completed
+    if ( aState == ECacheComplete && !iEvictionCandidate )
         {
         // don't add it twice
         iEvictionHandler->Insert( *this );
-        iVictim = ETrue;
+        iEvictionCandidate = ETrue;
         }
+
     iState = aState;
     }
 
-
 // -----------------------------------------------------------------------------
 // CHttpCacheEntry::SetFileNameL
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEntry::SetFileNameL(
-    const TFileName& aFileName )
+void CHttpCacheEntry::SetFileNameL( const TFileName& aFileName )
     {
     delete iFileName;
     iFileName = NULL;
+    
     iFileName = aFileName.AllocL();
     }
 
@@ -153,42 +164,41 @@
     {
     TTime now;
     now.HomeTime();
-
     iLastAccessed = now.Int64();
 
     iRef++;
-    if( iVictim )
+
+    if ( iEvictionCandidate )
         {
         iEvictionHandler->Accessed( *this );
         }
+
 #ifdef __CACHELOG__
     _LIT( KAccessFormat, "entry accessed: %d" );
     TBuf<100> buf;
     buf.Format( KAccessFormat, iRef );
     HttpCacheUtil::WriteUrlToLog( 0, buf, iUrl->Des() );
 #endif // __CACHELOG__
+
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheEntry::SetSize
+// CHttpCacheEntry::SetBodySize
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEntry::SetSize(
-    TUint aSize )
+void CHttpCacheEntry::SetBodySize( TUint aBodySize )
     {
-    if( iSize && !aSize )
+    if ( iBodySize && !aBodySize )
         {
-        // body removal
-        // remove itself from the eviction table.
-        // this is no longer a victim
-      if( iVictim )
-        {
-        iEvictionHandler->Remove( *this );
-            iVictim = EFalse;
+        // Remove from the eviction table, this is no longer a candidate
+        if ( iEvictionCandidate )
+            {
+            iEvictionHandler->Remove( *this );
+            iEvictionCandidate = EFalse;
+            }
         }
-        }
-    iSize = aSize;
+    iBodySize = aBodySize;
     }
 
 // -----------------------------------------------------------------------------
@@ -199,9 +209,11 @@
 void CHttpCacheEntry::SetProtected()
     {
     iProtected = ETrue;
-    // iRef
     iRef = 50;
-    HttpCacheUtil::WriteLog( 0, _L( "protected item" ) );
+
+#ifdef __CACHELOG__
+    HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheEntry::SetProtected - protected item" ) );
+#endif
     }
 
 // -----------------------------------------------------------------------------
@@ -209,45 +221,47 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt CHttpCacheEntry::Internalize(
-    RFileReadStream& aReadStream )
+TInt CHttpCacheEntry::Internalize( RFileReadStream& aReadStream )
     {
-    TRAPD( err,
-     TInt len;
-    
     // url length
-    len = aReadStream.ReadInt32L();
-    delete iUrl;
-    iUrl=NULL;
-    iUrl = HBufC8::NewL( len );
-    TPtr8 ptr8( iUrl->Des() );
-    // url
-    aReadStream.ReadL( ptr8, len );
+    TRAPD( err,
+     	TInt len;
     
-    // filename length
-    len = aReadStream.ReadInt32L();
-    HBufC* filename = HBufC::NewLC( len );
-    TPtr ptr( filename->Des() );
-    // url
-    aReadStream.ReadL( ptr, len );
-    //
-    SetFileNameL( filename->Des() );
-    //
-    CleanupStack::PopAndDestroy(); // filename
-    // la
-    TReal64 la;
-    la = aReadStream.ReadReal64L();
-    iLastAccessed = la;
-    // ref
-    iRef = aReadStream.ReadUint32L();
-    // size
-    iSize = aReadStream.ReadUint32L( );
-    // size
-    iHeaderSize = aReadStream.ReadUint32L( );
-    // protected
-    iProtected = aReadStream.ReadInt32L();
-    //
-    SetState( ECacheComplete ); );
+    	// url length
+    	len = aReadStream.ReadInt32L();
+        delete iUrl;
+        iUrl=NULL;
+        iUrl = HBufC8::NewL( len );
+        TPtr8 ptr8( iUrl->Des() );
+        // url
+        aReadStream.ReadL( ptr8, len );
+        
+        // filename length
+        len = aReadStream.ReadInt32L();
+        HBufC* filename = HBufC::NewLC( len );
+        TPtr ptr( filename->Des() );
+        // url
+        aReadStream.ReadL( ptr, len );
+        //
+        SetFileNameL( filename->Des() );
+        //
+        CleanupStack::PopAndDestroy(); // filename
+        // la
+        TReal64 la;
+        la = aReadStream.ReadReal64L();
+        iLastAccessed = la;
+        // ref
+        iRef = aReadStream.ReadUint32L();
+        // size
+        iBodySize = aReadStream.ReadUint32L( );
+        // size
+        iHeaderSize = aReadStream.ReadUint32L( );
+        // protected
+        iProtected = aReadStream.ReadInt32L();
+        //
+        SetState( ECacheComplete );
+    );	// end of TRAPD
+
     return err;
     }
 
@@ -256,28 +270,29 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt CHttpCacheEntry::Externalize(
-    RFileWriteStream& aWriteStream )
+TInt CHttpCacheEntry::Externalize( RFileWriteStream& aWriteStream )
     {
     TRAPD( err,
-    // url length
-    aWriteStream.WriteInt32L( iUrl->Length() );
-    // url
-    aWriteStream.WriteL( iUrl->Des() );
-    // filename length
-    aWriteStream.WriteInt32L( iFileName->Length() );
-    // filename
-    aWriteStream.WriteL( iFileName->Des() );
-    // la
-    aWriteStream.WriteReal64L( iLastAccessed );
-    // ref
-    aWriteStream.WriteUint32L( iRef );
-    // size
-    aWriteStream.WriteUint32L( iSize );
-    // size
-    aWriteStream.WriteUint32L( iHeaderSize );
-    // protected
-    aWriteStream.WriteInt32L( iProtected ); );
+        // url length
+        aWriteStream.WriteInt32L( iUrl->Length() );
+        // url
+        aWriteStream.WriteL( iUrl->Des() );
+        // filename length
+        aWriteStream.WriteInt32L( iFileName->Length() );
+        // filename
+        aWriteStream.WriteL( iFileName->Des() );
+        // la
+        aWriteStream.WriteReal64L( iLastAccessed );
+        // ref
+        aWriteStream.WriteUint32L( iRef );
+        // size
+        aWriteStream.WriteUint32L( iBodySize );
+        // size
+        aWriteStream.WriteUint32L( iHeaderSize );
+        // protected
+        aWriteStream.WriteInt32L( iProtected );
+    );  // end of TRAPD
+
     return err;
     }
 
@@ -286,14 +301,15 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEntry::Accessed(TInt64 aLastAccessed, TUint16 aRef)
+void CHttpCacheEntry::Accessed( TInt64 aLastAccessed, TUint16 aRef )
     {
     iLastAccessed = aLastAccessed;
     iRef = aRef;
-    if( iVictim )
+    if ( iEvictionCandidate )
         {
         iEvictionHandler->Accessed( *this );
         }
+
 #ifdef __CACHELOG__
     _LIT( KAccessFormat, "entry accessed: %d" );
     TBuf<100> buf;
@@ -303,4 +319,62 @@
 
     }
 
+// -----------------------------------------------------------------------------
+// CHttpCacheEntry::SetCacheFilesOpened
+//
+// -----------------------------------------------------------------------------
+//
+void CHttpCacheEntry::SetCacheFilesOpened( TBool aCacheFilesOpened )
+    {
+    // Set our files open flag
+    iCacheFilesOpened = aCacheFilesOpened;
+    }
+
+// -----------------------------------------------------------------------------
+// CHttpCacheEntry::CacheBuffer
+// NOTE: Cache buffer is created on:
+// 1. Normal content entrypoint into CacheManager
+//    CacheManager::ReceivedResponseHeadersL -> CacheHandler::ReceivedResponseHeadersL ->
+//    CacheHandler::HandleResponseOkL (calls method - SetCacheBuffer, needed to
+//    accumulate body content on multiple CacheHandler::ReceivedBodyDataL calls)
+// 2. Multipart content entrypoint into CacheManager
+//    CacheManager::SaveL -> CacheHandler::SaveL -> CacheHandler::SaveBuffer ->
+//    CacheStreamHandler::SaveBodyData (calls this method - CacheBuffer, needed
+//    because cacheBuffer=null and single call made, no accumulation of body data) 
+// -----------------------------------------------------------------------------
+//
+TPtr8 CHttpCacheEntry::CacheBuffer()
+    {
+    if ( iCacheBuffer == NULL )
+        {
+        // Create the cache buffer, if needed
+        iCacheBuffer = HBufC8::New( KBufferSize32k );
+        if ( iCacheBuffer == NULL )
+			{
+			// OOM, return empty cache buffer
+			TPtr8 emptyCacheBuffer( NULL, 0, 0 );
+			return emptyCacheBuffer;
+			}
+		}
+
+    return iCacheBuffer->Des();
+    }
+
+// -----------------------------------------------------------------------------
+// CHttpCacheEntry::SetCacheBufferL
+//
+// -----------------------------------------------------------------------------
+//
+void CHttpCacheEntry::SetCacheBufferL( TInt aCacheBufferSize )
+    {
+    if ( aCacheBufferSize > 0 && iCacheBuffer == NULL )
+        {
+        iCacheBuffer = HBufC8::NewL( aCacheBufferSize );
+        }
+    else if ( aCacheBufferSize <= 0 )
+        {
+        delete iCacheBuffer;
+        iCacheBuffer = NULL;
+        }
+    }
 //  End of File
--- a/webengine/osswebengine/cache/src/HttpCacheEvictionHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/src/HttpCacheEvictionHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -124,30 +124,29 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEvictionHandler::Insert(
-    CHttpCacheEntry& aCacheEntry )
+void CHttpCacheEvictionHandler::Insert( CHttpCacheEntry& aCacheEntry )
     {
 #ifdef __CACHELOG__
     HttpCacheUtil::WriteUrlToLog( 0, _L( "Eviction table: item is inserted:" ), aCacheEntry.Url() );
     // check double insert
     CHttpCacheEntry* entry;
-    for( TInt i = 0; i < KHttpCacheBucketNum; i++ )
+    for ( TInt i = 0; i < KHttpCacheBucketNum; i++ )
         {
         TBucketIter bucketIter( *iBuckets->At( i ) );
         //
         bucketIter.SetToFirst();
-        while( ( entry = bucketIter++ ) != NULL )
+        while ( ( entry = bucketIter++ ) != NULL )
             {
             __ASSERT_DEBUG( ( entry != &aCacheEntry ) , User::Panic( _L("cacheHandler Panic"), KErrCorrupt ) );
             }
         }
-    //
-    HttpCacheUtil::WriteLog( 0, _L( "insert entry to eviction table:" ), BucketIndex( FastLog2( aCacheEntry.Size() ) ) );
+
+    HttpCacheUtil::WriteLog( 0, _L( "insert entry to eviction table:" ), BucketIndex( FastLog2( aCacheEntry.BodySize() ) ) );
 #endif // __CACHELOG__
+
     // Objects are classified into a limited number of groups according to log2(Si/refi)
-    // caclulate to which bucket it goes.
-    // buckets are orderd by LRU
-    Bucket( BucketIndex( FastLog2( aCacheEntry.Size() / aCacheEntry.Ref() ) ) )->AddLast( aCacheEntry );
+    // calculate to which bucket it goes. Buckets are orderd by LRU
+    Bucket( BucketIndex( FastLog2( aCacheEntry.BodySize() / aCacheEntry.Ref() ) ) )->AddLast( aCacheEntry );
     }
 
 // -----------------------------------------------------------------------------
@@ -155,10 +154,9 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEvictionHandler::Accessed(
-    CHttpCacheEntry& aCacheEntry )
+void CHttpCacheEvictionHandler::Accessed( CHttpCacheEntry& aCacheEntry )
     {
-    HttpCacheUtil::WriteUrlToLog( 0, _L( "Eviction table: item is accessed:" ), aCacheEntry.Url() );
+    HttpCacheUtil::WriteUrlToLog( 0, _L( "CHttpCacheEvictionHandler::Accessed - Eviction table: item is accessed:" ), aCacheEntry.Url() );
     // first check where it is now
     TInt oldRef( aCacheEntry.Ref() - 1 );
     if( oldRef > 0 )
@@ -166,20 +164,26 @@
         //
         // buckets are orderd by LRU
         // see if we need to move it to a new bucket
-        TInt currentBucketIndex( BucketIndex( FastLog2( aCacheEntry.Size() / oldRef ) ) );
-        TInt newBucketIndex( BucketIndex( FastLog2( aCacheEntry.Size() / aCacheEntry.Ref() ) ) );
+        TInt currentBucketIndex( BucketIndex( FastLog2( aCacheEntry.BodySize() / oldRef ) ) );
+        TInt newBucketIndex( BucketIndex( FastLog2( aCacheEntry.BodySize() / aCacheEntry.Ref() ) ) );
         // check if the item is really there
         TBool itemOk( ItemIsInBucket( currentBucketIndex, aCacheEntry ) );
 
-        if( itemOk )
+        if ( itemOk )
             {
-            HttpCacheUtil::WriteLog( 0, _L( "item is in bucket:" ), currentBucketIndex );
-            if( currentBucketIndex == newBucketIndex )
+            if ( currentBucketIndex == newBucketIndex )
                 {
-                HttpCacheUtil::WriteLog( 0, _L( "move entry to the end of the bucket. it's safe there" ) );
+#ifdef __CACHELOG__
+                HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                               _L("CHttpCacheEvictionHandler::Accessed - MOVED item to end of bucket"),
+                                               aCacheEntry.Filename(),
+                                               aCacheEntry.Url(),
+                                               newBucketIndex,
+                                               ELogBucketIndex );
+#endif
                 TBucket* bucket( Bucket( currentBucketIndex ) );
                 // move it to the end
-                if( !bucket->IsLast( &aCacheEntry ) )
+                if ( !bucket->IsLast( &aCacheEntry ) )
                     {
                     bucket->Remove( aCacheEntry );
                     bucket->AddLast( aCacheEntry );
@@ -187,15 +191,21 @@
                 }
             else
                 {
-                HttpCacheUtil::WriteLog( 0, _L( "move item to a new bucket" ), newBucketIndex );
+#ifdef __CACHELOG__
+                HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                               _L("CHttpCacheEvictionHandler::Accessed - MOVED item to new bucket"),
+                                               aCacheEntry.Filename(),
+                                               aCacheEntry.Url(),
+                                               newBucketIndex,
+                                               ELogBucketIndex );
+#endif
                 // new bucket
                 TBucket* currBucket( Bucket( currentBucketIndex ) );
                 TBucket* newBucket( Bucket( newBucketIndex ) );
                 // remove from the current and add it to the
                 // new as last item
 
-                // make sure the item is there
-                // move it to the end
+                // make sure the item is there, move it to the end
                 currBucket->Remove( aCacheEntry );
                 newBucket->AddLast( aCacheEntry );
                 }
@@ -219,62 +229,68 @@
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheEvictionHandler::Changed
-//
-// -----------------------------------------------------------------------------
-//
-void CHttpCacheEvictionHandler::Changed(
-    CHttpCacheEntry& /*aCacheEntry*/ )
-    {
-    // check if size changed
-    }
-
-// -----------------------------------------------------------------------------
 // CHttpCacheEvictionHandler::Remove
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheEvictionHandler::Remove(
-    CHttpCacheEntry& aCacheEntry )
+void CHttpCacheEvictionHandler::Remove( CHttpCacheEntry& aCacheEntry )
     {
-    HttpCacheUtil::WriteUrlToLog( 0, _L( "Eviction table: try to remove item:" ), aCacheEntry.Url() );
-    //
-    TInt sizeFreqVal( FastLog2( aCacheEntry.Size() / aCacheEntry.Ref() ) );
+#ifdef __CACHELOG__
+    HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheEvictionHandler::Remove - trying to removing entry"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           aCacheEntry.BodySize(),
+                                           ELogEntrySize );
+#endif
+
+    TInt sizeFreqVal( FastLog2( aCacheEntry.BodySize() / aCacheEntry.Ref() ) );
     // check if the item is in the right bucket
     TInt bucketIndex( BucketIndex( sizeFreqVal ) );
     TBucket* bucket( Bucket( bucketIndex ) );
     TBool itemOk( ItemIsInBucket( bucketIndex, aCacheEntry ) );
 
-    if( itemOk )
+    if ( itemOk )
         {
-        //
-        HttpCacheUtil::WriteLog( 0, _L( "removed from bucket:" ), bucketIndex );
+#ifdef __CACHELOG__
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheEvictionHandler::Remove - removing entry from"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           bucketIndex,
+                                           ELogBucketIndex );
+#endif
         bucket->Remove( aCacheEntry );
         }
 #ifdef __CACHELOG__
     else
         {
-         HttpCacheUtil::WriteLog( 0, _L( "item is not in bucket no." ), bucketIndex );
+         HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheEvictionHandler::Remove - item NOT in"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           bucketIndex,
+                                           ELogBucketIndex );
         }
 #endif // __CACHELOG__
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheEvictionHandler::Evict
+// CHttpCacheEvictionHandler::EvictL
 //
 // -----------------------------------------------------------------------------
 //
 CArrayPtrFlat<CHttpCacheEntry>* CHttpCacheEvictionHandler::EvictL(
     TInt aSpaceNeeded )
     {
-    HttpCacheUtil::WriteLog( 0, _L( "need space:" ), aSpaceNeeded );
 #ifdef __CACHELOG__
+    HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheEvictionHandler::EvictL - aSpaceNeeded = " ), aSpaceNeeded );
     LogBuckets();
 #endif // __CACHELOG__
-    //
+
     CArrayPtrFlat<CHttpCacheEntry>* evictedEntries = new(ELeave)CArrayPtrFlat<CHttpCacheEntry>( 10 );
     CleanupStack::PushL( evictedEntries );
-    //
+
     // Each group is managed using a LRU
     // policy. The extended cost-to-size model is applied to the
     // eviction candidates from all nonempty groups, purging the
@@ -299,13 +315,18 @@
                 {
                 entry = bucket->First();
                 }
+#ifdef __CACHELOG__
+            else {
+                HttpCacheUtil::WriteLog( 0, _L("CHttpCacheEvictionHandler::EvictL : NO entries found in bucket ="), i);
+            }
+#endif
             // evacuate nonactive entries only
             if( entry && entry->State() == CHttpCacheEntry::ECacheComplete )
                 {
                 // watch out for 32 bit. it might overflow secInt.
                 currTime.SecondsFrom( entry->LastAccessed(), secInt );
 
-                TInt val( secInt.Int() * entry->Size() / entry->Ref() );
+                TInt val( secInt.Int() * entry->BodySize() / entry->Ref() );
                 // get the object with largest ( DeltaT * Size / Ref )
                 if( val > maxVal )
                     {
@@ -315,37 +336,51 @@
                     }
                 }
             }
-        // remove from the bucket
-        // add it to the evicted list
+
+        // remove from the bucket, add it to the evicted list, 
         // reduce space needed size
-        if( candidate )
+        if ( candidate )
             {
 #ifdef __CACHELOG__
             // no protected entries should be evacuated
             if( candidate->Protected() )
             	{
-	            HttpCacheUtil::WriteUrlToLog( 0, _L( "PROTECTED entry is about to be removed" ), candidate->Url() );
+	            HttpCacheUtil::WriteUrlToLog( 0, _L( "CHttpCacheEvictionHandler::EvictL - PROTECTED entry is about to be removed" ), candidate->Url() );
             	}
-            //
-            HttpCacheUtil::WriteUrlToLog( 0, _L( "entry to remove:" ), candidate->Url() );
+
+            HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheEvictionHandler::EvictL - removing entry "),
+                                           candidate->Filename(),
+                                           candidate->Url(),
+                                           candidate->BodySize(), 
+                                           ELogEntrySize );
 #endif //__CACHELOG__
-            //
+            
             iBuckets->At( bucketInd )->Remove( *candidate );
-            // reduce size
-            aSpaceNeeded-= candidate->Size();
-            aSpaceNeeded-= candidate->HeaderSize();
-            //
+            // Reduce size needed
+            aSpaceNeeded -= candidate->BodySize();
+            aSpaceNeeded -= candidate->HeaderSize();
+
             evictedEntries->AppendL( candidate );
-            //
-            HttpCacheUtil::WriteLog( 0, _L( "more space needed" ), aSpaceNeeded );
+
+#ifdef __CACHELOG__
+            if ( aSpaceNeeded > 0 ) {
+                HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheEvictionHandler::EvictL - more space needed aSpaceNeeded = " ), aSpaceNeeded );
+            	}
+#endif
             }
         else
             {
             // no candidate no free
+#ifdef __CACHELOG__
+            HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheEvictionHandler::EvictL - NO Candidates to remove" ) );
+#endif
             break;
             }
-        }
+        }   // end if while
+
     CleanupStack::Pop(); // evictedEntries
+
     return evictedEntries;
     }
 
@@ -356,9 +391,11 @@
 //
 void CHttpCacheEvictionHandler::RemoveAll()
     {
+#ifdef __CACHELOG__
     HttpCacheUtil::WriteLog( 0, _L( "Eviction table: remove all item:" ) );
-    //
-    for( TInt i = 0; i < KHttpCacheBucketNum; i++ )
+#endif
+
+    for ( TInt i = 0; i < KHttpCacheBucketNum; i++ )
         {
         iBuckets->At( i )->Reset();
         //
@@ -428,13 +465,20 @@
             found = ETrue;
             break;
             }
-        }
+        }   // end of while
+
 #ifdef __CACHELOG__
     if( !found )
         {
-        HttpCacheUtil::WriteLog( 0, _L( "Eviction table: item NOT FOUND" ) );
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheEvictionHandler::ItemIsInBucket - entry NOT found"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           aCacheEntry.BodySize(), 
+                                           ELogEntrySize );
         }
 #endif // __CACHELOG__
+
     return found;
     }
 
@@ -470,18 +514,23 @@
         while( ( entry = bucketIter++ ) != NULL )
             {
             _LIT( KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%.%*C4%:3%+B");
-            _LIT( KRefSizeString,"size: %d refcount:%d");
+            _LIT( KRefSizeString,"CHttpCacheEvictionHandler::LogBuckets - size: %d refcount:%d");
 
             TBuf<50> refStr;
             TBuf<50> lastAccessedStr;
 
             TTime lastAccessed( entry->LastAccessed() );
-            lastAccessed.FormatL( lastAccessedStr, KDateString );
+            TRAP_IGNORE( lastAccessed.FormatL( lastAccessedStr, KDateString ) );
             // add size/refcount
-            refStr.Format( KRefSizeString, entry->Size(), entry->Ref() );
+            refStr.Format( KRefSizeString, entry->BodySize(), entry->Ref() );
             // copy to 8bit string
-            HttpCacheUtil::WriteUrlToLog( 0, refStr, entry->Url() );
             HttpCacheUtil::WriteLog( 0, lastAccessedStr );
+            HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                               _L("CHttpCacheEvictionHandler::LogBuckets - "),
+                                               entry->Filename(),
+                                               entry->Url(),
+                                               i, 
+                                               ELogBucketIndex );
             }
         }
     }
--- a/webengine/osswebengine/cache/src/HttpCacheHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/src/HttpCacheHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -146,20 +146,20 @@
     return self;
     }
 
+// -----------------------------------------------------------------------------
 // Destructor
+// -----------------------------------------------------------------------------
+//
 CHttpCacheHandler::~CHttpCacheHandler()
     {
-   
-        TRAP_IGNORE( SaveLookupTableL() );
-   
+    TRAP_IGNORE( SaveLookupTableL() );
     //
     delete iHttpCacheObserver;
     //
-    if (iEvictionHandler)
+    if ( iEvictionHandler )
         {
         iEvictionHandler->RemoveAll();
         }
-
     //
     delete iLookupTable;
     //
@@ -184,8 +184,10 @@
     TBrCtlDefs::TBrCtlCacheMode aCacheMode,
     THttpCacheEntry& aCacheEntry )
     {
+#ifdef __CACHELOG__
     HttpCacheUtil::WriteUrlToLog( 0, _L( "request item" ), aTrans.Request().URI().UriDes() );
-    //
+#endif
+
     TInt status( KErrNotFound );
     CHttpCacheEntry* entry = NULL;
     // 0. check if we need to check cache at all (protected vs no cache mode)
@@ -193,9 +195,8 @@
     // 2. check if it is complete
     // 3. see if it is useable
 
-    // use protected item on reload???
-    // currently not
-    // and do not use cache for post
+    // use protected item on reload
+    // currently not and do not use cache for post
     if( aCacheMode != TBrCtlDefs::ECacheModeNoCache &&
         HttpCacheUtil::MethodFromStr( aTrans.Request().Method(), aTrans.Session().StringPool() ) != EMethodPost )
         {
@@ -242,7 +243,7 @@
             else
                 {
                 // cleanup on the corrupt entry
-                HandleCorruptEntry( *entry );
+                DeleteCacheEntry( *entry );
                 entry = NULL;
                 // item is not in cache
                 status = KErrNotFound;
@@ -346,39 +347,41 @@
     RHTTPTransaction* aTrans,
     THttpCacheEntry& aCacheEntry )
     {
-    if (aTrans)
-        HttpCacheUtil::WriteUrlToLog( 0, _L( "Request is closed" ), aTrans->Request().URI().UriDes() );
-    // fine
-    // make sure transaction is moved to the complete list
+#ifdef __CACHELOG__
+    if ( aTrans )
+        HttpCacheUtil::WriteUrlToLog( 0, _L( "CHttpCacheHandler::RequestClosed on url =" ), aTrans->Request().URI().UriDes() );
+#endif
+
+    // Fine, make sure transaction is moved to the complete list
     CHttpCacheEntry* entry = aCacheEntry.iCacheEntry;
 
-    if( entry )
+    if ( entry )
         {
         // normal close on a request - when the content is loaded from the cache
-        if( entry->State() == CHttpCacheEntry::ECacheRequesting )
+        if ( entry->State() == CHttpCacheEntry::ECacheRequesting )
             {
             entry->SetState( CHttpCacheEntry::ECacheComplete );
             iStreamHandler->Detach( *entry );
             }
         // transaction is closed without being completed
-        else if( entry->State() == CHttpCacheEntry::ECacheResponding ||
-            entry->State() == CHttpCacheEntry::ECacheDestroyed )
+        else if ( entry->State() == CHttpCacheEntry::ECacheResponding ||
+                  entry->State() == CHttpCacheEntry::ECacheDestroyed )
             {
             // remove uncompleted/destroyed entry
             iStreamHandler->Detach( *entry );
-            HandleCorruptEntry( *entry );
+            DeleteCacheEntry( *entry );
             entry = NULL;
             aCacheEntry.iCacheEntry = NULL;
 #ifdef __CACHELOG__
-            HttpCacheUtil::WriteLog( 0, _L( "uncompleted entry" ) );
+            HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheHandler::RequestClosed - uncompleted entry" ) );
 #endif
             }
-        else if( entry->State() == CHttpCacheEntry::ECacheComplete )
+        else if ( entry->State() == CHttpCacheEntry::ECacheComplete )
             {
-            // normal close on the request - when the contet is saved to the cache
+            // normal close on the request - when the content is saved to the cache
             // ResponseComplete has already been called
             // check if the stream is released
-            __ASSERT_DEBUG( !iStreamHandler->Find( *entry ) , PanicCacheHandler( KErrCorrupt ) );
+            // __ASSERT_DEBUG( !entry->CacheFilesOpened() ) , PanicCacheHandler( KErrCorrupt ) );
             }
         else
             {
@@ -387,7 +390,6 @@
         }
     }
 
-
 // -----------------------------------------------------------------------------
 // CHttpCacheHandler::AdjustResponseTime
 //
@@ -453,9 +455,10 @@
     THttpCacheEntry& aCacheEntry )
     {
 #ifdef __CACHELOG__
-    HttpCacheUtil::WriteUrlToLog( 0, _L( "received http headers" ), aTrans.Request().URI().UriDes() );
+    HttpCacheUtil::WriteLog( 0, _L("---> CHttpCacheHandler::ReceivedResponseHeadersL"), 0);
+    HttpCacheUtil::WriteUrlToLog( 0, _L( "CHttpCacheHandler::ReceivedResponseHeadersL - received http headers" ), aTrans.Request().URI().UriDes() );
 #endif
-    //
+
     TBool protectedEntry( EFalse );
     // check if the item is cacheable
     // no item should be bigger than the 1/3 of the cache size
@@ -466,16 +469,25 @@
         if( entry )
             {
 #ifdef __CACHELOG__
-            HttpCacheUtil::WriteUrlToLog( 0, _L( "item is already in the cache" ), entry->Url() );
-#endif            
-            //
+        	HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                       _L("CHttpCacheHandler::ReceivedResponseHeadersL"),
+                                       entry->Filename(),
+                                       entry->Url(),
+                                       entry->BodySize(), 
+                                       ELogEntrySize );
+#endif
+
             if( entry->State() != CHttpCacheEntry::ECacheComplete )
                 {
-                // multiple incoming entries? doh.
+                // multiple incoming entries doh.
 #ifdef __CACHELOG__
-                HttpCacheUtil::WriteLog( 0, _L( "MULTIPLE REQUEST!!!!!!!!!!!!!!!!!!!!!!!!!" ) );
-#endif                
-                // __ASSERT_DEBUG( EFalse, PanicCacheHandler( KErrCorrupt ) );
+        		HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                       _L("CHttpCacheHandler::ReceivedResponseHeadersL - ERROR MULTIPLE requests"),
+                                       entry->Filename(),
+                                       entry->Url(),
+                                       entry->BodySize(), 
+                                       ELogEntrySize );
+#endif
                 // ignore this one and the first will proceed.
                 entry = NULL;
                 }
@@ -483,7 +495,7 @@
         else
             {
 #ifdef __CACHELOG__
-            HttpCacheUtil::WriteLog( 0, _L( "create new cache item" ) );
+            HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheHandler::ReceivedResponseHeadersL - create new cache item" ) );
 #endif
             //Check adjustment of response time is required or not.
             AdjustResponseTime( aTrans );
@@ -495,9 +507,13 @@
                 if( protectedEntry )
                     {
 #ifdef __CACHELOG__
-                    HttpCacheUtil::WriteLog( 0, _L( "this item is protected" ) );
+        			HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                       _L("CHttpCacheHandler::ReceivedResponseHeadersL - this is protected item"),
+                                       entry->Filename(),
+                                       entry->Url(),
+                                       entry->BodySize(), 
+                                       ELogEntrySize );
 #endif
-                    //
                     entry->SetProtected();
                     RHTTPHeaders responseHeaders = aTrans.Response().GetHeaderCollection();
                     RStringPool strP = aTrans.Session().StringPool();
@@ -524,10 +540,10 @@
                 // 3. update the headers anyway in case of notmodified (304)
                 // 4. remove the old body in case of bodyupdate
                 TInt httpStatus( aTrans.Response().StatusCode() );
+
 #ifdef __CACHELOG__
-                HttpCacheUtil::WriteLog( 0, _L( "status code: " ), httpStatus );
+                HttpCacheUtil::WriteLog( 0,  _L("CHttpCacheHandler::ReceivedResponseHeadersL - status code ="), httpStatus );
 #endif
-                //
                 TBool ok( EFalse );
                 if( httpStatus == HTTPStatus::EOk )
                     {
@@ -537,7 +553,7 @@
                     {
                     ok = HandleResponseNotModifiedL( *entry, aTrans );
                     }
-                //
+
                 // entry could be corrupted at this point
                 if( ok )
                     {
@@ -549,13 +565,13 @@
                 else
                     {
                     iStreamHandler->Detach( *entry );
-                    HandleCorruptEntry( *entry );
+                    DeleteCacheEntry( *entry );
                     entry = NULL;
                     }
                 }
             else
                 {
-                HandleCorruptEntry( *entry );
+                DeleteCacheEntry( *entry );
                 entry = NULL;
                 }
             }
@@ -572,24 +588,36 @@
     MHTTPDataSupplier& aBodyDataSupplier,
     THttpCacheEntry& aCacheEntry )
     {
-    HttpCacheUtil::WriteUrlToLog( 0, _L( "received body" ), aTrans.Request().URI().UriDes() );
+#ifdef __CACHELOG__
+    HttpCacheUtil::WriteUrlToLog( 0, _L( "CHttpCacheHandler::ReceivedResponseBodyDataL - received body from url =" ), aTrans.Request().URI().UriDes() );
+#endif
+
     // 1. check if we are caching this resource
     // 2. update the body data
     CHttpCacheEntry* entry = aCacheEntry.iCacheEntry;
 
-    if( entry && entry->State() == CHttpCacheEntry::ECacheResponding )
+    if ( entry && entry->State() == CHttpCacheEntry::ECacheResponding )
         {
+#ifdef __CACHELOG__
+        HttpCacheUtil::WriteLog( 0, _L("---> CHttpCacheHandler::ReceivedResponseBodyDataL"), entry->BodySize() );
+#endif
         HBufC8* bodyStr = HttpCacheUtil::BodyToBufferL( aBodyDataSupplier );
-        if( bodyStr )
+        if ( bodyStr )
             {
+            // Do we have old body data to remove first
+            if ( entry->BodyFileDeleteNeeded() ) {
+                iStreamHandler->RemoveBodyData( *entry );
+                entry->SetBodyFileDeleteNeeded( EFalse );
+            	}
+            
             // erase entry if we are unable to save it (low disk space)
             if( !SaveBuffer( *entry, bodyStr->Des(), ETrue ) )
                 {
                 // detach it from the stream and erase it
                 iStreamHandler->Detach( *entry );
-                HandleCorruptEntry( *entry );
+                DeleteCacheEntry( *entry );
 #ifdef __CACHELOG__                
-                HttpCacheUtil::WriteLog( 0, _L( "body cannot be saved" ) );
+                HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheHandler::ReceivedResponseBodyDataL - body cannot be saved" ) );
 #endif                
                 entry = NULL;
                 // remove entry
@@ -598,7 +626,7 @@
 #ifdef __CACHELOG__
             else
                 {
-                HttpCacheUtil::WriteLog( 0, _L( "body is saved" ) );
+                HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheHandler::ReceivedResponseBodyDataL - body is saved" ) );
                 }
 #endif // __CACHELOG__
             //
@@ -621,32 +649,48 @@
     // 2. mark the entry as complete
     CHttpCacheEntry* entry = aCacheEntry.iCacheEntry;
 
-    if( entry )
+    if ( entry )
         {
-        if( entry->State() == CHttpCacheEntry::ECacheResponding )
+#ifdef __CACHELOG__
+        HttpCacheUtil::WriteLog( 0, _L("---> CHttpCacheHandler::ResponseComplete"), entry->BodySize() );
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheHandler::ResponseComplete"),
+                                           entry->Filename(),
+                                           entry->Url(),
+                                           entry->BodySize(),
+                                           ELogEntrySize );
+#endif
+
+        if ( entry->State() == CHttpCacheEntry::ECacheResponding )
             {
-            // flush the entry
-            if( !iStreamHandler->Flush( *entry ) )
+            // Flush the entry
+            if ( !iStreamHandler->Flush( *entry ) )
                 {
+                // We failed saving (flush), cleanup
                 iStreamHandler->Detach( *entry );
-                HandleCorruptEntry( *entry );
-#ifdef __CACHELOG__
-                HttpCacheUtil::WriteLog( 0, _L( "body cannot be saved" ) );
-#endif
+
+                // Deleting the entry frees cache buffer
+                DeleteCacheEntry( *entry );
                 entry = NULL;
-                // remove entry
                 aCacheEntry.iCacheEntry = NULL;
                 }
             else
                 {
+                // We successfully saved (flush) body
                 entry->SetState( CHttpCacheEntry::ECacheComplete );
                 iStreamHandler->Detach( *entry );
+
+                // Clear the flushed cache buffer, we were using for incoming body
+                entry->SetCacheBufferL( KBufferSizeZero );
                 }
             }
         else if( entry->State() == CHttpCacheEntry::ECacheDestroyed )
             {
             iStreamHandler->Detach( *entry );
-            HandleCorruptEntry( *entry, EFalse );
+
+            // Deleting the entry frees cache buffer
+            DeleteCacheEntry( *entry, EFalse );
+            entry = NULL;
             aCacheEntry.iCacheEntry = NULL;
             }
         }
@@ -685,23 +729,22 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt CHttpCacheHandler::RemoveL(
-    const TDesC8& aUrl )
+TInt CHttpCacheHandler::RemoveL( const TDesC8& aUrl )
     {
     TInt status( KErrNotFound );
     HttpCacheUtil::WriteUrlToLog( 0, _L( "remove item:" ), aUrl );
     CHttpCacheEntry* entry = iLookupTable->Find( aUrl );
 
-    if( entry )
+    if ( entry )
         {
-        if( entry->State() == CHttpCacheEntry::ECacheComplete )
+        if ( entry->State() == CHttpCacheEntry::ECacheComplete )
             {
-            // delete
+            // Delete from lookup table
             status = iLookupTable->Remove( aUrl );
             }
         else
             {
-            // mark it as deleted and erase it when the
+            // Mark it as deleted and erase it when the
             // trans is complete
             entry->SetState( CHttpCacheEntry::ECacheDestroyed );
             status = KErrNone;
@@ -715,8 +758,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-TBool CHttpCacheHandler::Find(
-    const TDesC8& aUrl )
+TBool CHttpCacheHandler::Find( const TDesC8& aUrl )
     {
     // find
     CHttpCacheEntry* entry = iLookupTable->Find( aUrl );
@@ -758,7 +800,7 @@
         // cleanup
         if( !saved && entry )
             {
-            HandleCorruptEntry( *entry );
+            DeleteCacheEntry( *entry );
             }
         }
     return saved;
@@ -806,7 +848,7 @@
                         {
                         // sorry, we made this entry corrupt. remove it
                         iStreamHandler->Detach( *entry );
-                        HandleCorruptEntry( *entry );
+                        DeleteCacheEntry( *entry );
                         entry = NULL;
                         }
                     }
@@ -886,7 +928,6 @@
                         HttpCacheUtil::WriteLog( 0, _L( "cache item is not fresh. needs revalidation" ) );
 #endif
                         // MKLE-7PRD27: Avoid removing cache entry here 
-                        
                         mustRevalidate = ETrue;
                         // add headers like EIfModifiedSince, EETag, EIfNoneMatch
                         HttpCacheUtil::AddValidationHeaders( responseHeaders, requestHeaders, strP );
@@ -915,7 +956,7 @@
         }
     else
         {
-        HandleCorruptEntry( aCacheEntry );
+        DeleteCacheEntry( aCacheEntry );
         // needs validation
         mustRevalidate = ETrue;
         }
@@ -927,8 +968,7 @@
 //
 // -----------------------------------------------------------------------------
 //
-TBool CHttpCacheHandler::CacheNeedsSpaceL(
-    TInt aSize )
+TBool CHttpCacheHandler::CacheNeedsSpaceL( TInt aSize )
     {
     TBool ok( ETrue );
 #ifdef __CACHELOG__
@@ -938,27 +978,30 @@
 #endif // __CACHELOG__
 
     // check if we need extra space
-    if( iStreamHandler->SavedContentSize() + aSize > iSize )
+    if ( iStreamHandler->SavedContentSize() + aSize > iSize )
         {
+
 #ifdef __CACHELOG__
         // items in the cache
         TInt size( 0 );
         HttpCacheUtil::WriteLog( 0, _L( "cached items" ) );
+
         const CArrayPtrFlat<CHttpCacheEntry>& entries = iLookupTable->Entries();
         for( TInt i = 0; i < entries.Count(); i++ )
             {
             CHttpCacheEntry* entry = entries.At( i );
             if( entry && entry != (CHttpCacheEntry*)0xffffffff )
                 {
-                HttpCacheUtil::WriteUrlToLog( 0, entry->Url(), entry->Size() );
-                size+=entry->Size();
-                size+=entry->HeaderSize();
+                HttpCacheUtil::WriteUrlToLog( 0, entry->Url(), entry->BodySize() );
+                size += entry->BodySize();
+                size += entry->HeaderSize();
                 }
             }
         HttpCacheUtil::WriteLog( 0, _L( "occupy with headers:" ), size );
 #endif // __CACHELOG__
+
         CArrayPtrFlat<CHttpCacheEntry>* evictedList = iEvictionHandler->EvictL( aSize );
-        if( evictedList && evictedList->Count() )
+        if ( evictedList && evictedList->Count() )
             {
             // destroy items
             CHttpCacheEntry* entry;
@@ -972,7 +1015,7 @@
                     iLookupTable->Remove( entry->Url() );
                     }
                 }
-            // __ASSERT_DEBUG( iStreamHandler->SavedContentSize() + aSize < iSize, PanicCacheHandler( KErrCorrupt ) );
+
             // ok = ETrue if there is enough space
             ok = ( iStreamHandler->SavedContentSize() + aSize < iSize );
             }
@@ -1004,49 +1047,56 @@
     RHTTPHeaders responseHeader = aTrans.Response().GetHeaderCollection();
     RStringPool strP = aTrans.Session().StringPool();
     HBufC8* responseHeaderStr = HttpCacheUtil::HeadersToBufferLC( responseHeader, strP );
-    //
+
     TBool update( ETrue );
     // get cached headers to compare
     HBufC8* cachedHeaderStr = iStreamHandler->HeadersL( aEntry );
-    // we've got some headers to update,
-    // check if we really need to update them
-    if( cachedHeaderStr )
+    
+    // we've got some headers to update, check if we really need to update them
+    if ( cachedHeaderStr )
         {
         CleanupStack::PushL( cachedHeaderStr );
-        //
+
         update = HttpCacheUtil::CacheNeedsUpdateL( responseHeader, cachedHeaderStr->Des(), strP );
 
         CleanupStack::PopAndDestroy(); // cachedHeaderStr
         }
-    //
-    if( update )
+
+    if ( update )
         {
 #ifdef __CACHELOG__
-        HttpCacheUtil::WriteLog( 0, _L( "udpate headers" ) );
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                       _L("CHttpCacheHandler::HandleResponseOkL - cache UPDATE needed"),
+                                       aEntry.Filename(),
+                                       aEntry.Url(),
+                                       aEntry.BodySize(), 
+                                       ELogEntrySize );
 #endif
-        if( aEntry.HeaderSize() )
+        if ( aEntry.HeaderSize() )
             {
-            // remove it first
+            // remove headers from headerFile first
             iStreamHandler->RemoveHeaders( aEntry );
             }
-        // save
+
+        // save new headerFile
         saveOk = SaveBuffer( aEntry, responseHeaderStr->Des() );
-
-        if( aEntry.Size() )
+        
+        if ( aEntry.BodySize() )
             {
-#ifdef __CACHELOG__
-            HttpCacheUtil::WriteLog( 0, _L( "remove body" ) );
-#endif            
-            //
-            iStreamHandler->RemoveBodyData( aEntry );
+            // We will remove this body data, after we confirm that we get new
+            // body data
+            aEntry.SetBodyFileDeleteNeeded( ETrue );
             }
+
+        // Setup a cache buffer to hold the incoming body
+        aEntry.SetCacheBufferL( KBufferSize32k );
         }
     else
         {
         // if neither the header nor the body need to be updated, then
         // detach entry to protect from being updated
 #ifdef __CACHELOG__
-        HttpCacheUtil::WriteLog( 0, _L( "no udpate needed, ignore response" ) );
+        HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheHandler::HandleResponseOkL - no update needed, ignore response" ) );
 #endif        
         //
         aEntry.SetState( CHttpCacheEntry::ECacheComplete );
@@ -1054,8 +1104,10 @@
         // pretend that save was ok.
         saveOk = ETrue;
         }
+
+    CleanupStack::PopAndDestroy(); // responseHeaderStr
+
     // destroy corrupt entry by returning EFalse
-    CleanupStack::PopAndDestroy(); // responseHeaderStr
     return saveOk;
     }
 
@@ -1163,7 +1215,7 @@
             CleanupClosePushL( readStream );
             aLookupTable->InternalizeL( readStream, iDirectory->Des() );
             CleanupStack::PopAndDestroy(1); // readStream
-        }
+            }
     }
 
 // -----------------------------------------------------------------------------
@@ -1208,20 +1260,28 @@
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheHandler::HandleCorruptEntry
+// CHttpCacheHandler::DeleteCacheEntry
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheHandler::HandleCorruptEntry(
-    CHttpCacheEntry& aStrayEntry,
+void CHttpCacheHandler::DeleteCacheEntry(
+    CHttpCacheEntry& aEntry,
     TBool aUpdate )
     {
-    (void)aUpdate;//suppress compiler and PC-lint warnings
+    // suppress compiler and PC-lint warnings
+    (void)aUpdate;
+
 #ifdef __CACHELOG__
-    HttpCacheUtil::WriteLog( 0, _L( "delete this stray entry" ) );
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                       _L("CHttpCacheHandler::DeleteCacheEntry"),
+                                       aEntry.Filename(),
+                                       aEntry.Url(),
+                                       aEntry.BodySize(), 
+                                       ELogEntrySize );
 #endif
-    // remove from the lookuptable
-    iLookupTable->EraseCorruptEntry( aStrayEntry.Url() );
+
+    // Remove from the lookuptable
+    iLookupTable->EraseCacheEntry( aEntry.Url() );
     }
 
 // -----------------------------------------------------------------------------
@@ -1241,10 +1301,11 @@
     TBool aBody )
     {
     TBool ok( EFalse );
+    
     TRAPD( err, ok = CacheNeedsSpaceL( aBuffer.Length() ) );
-    if( err == KErrNone && ok )
+    if ( err == KErrNone && ok )
         {
-        // safe save
+        // Did we have a safe save of the body or header
         ok = aBody ? iStreamHandler->SaveBodyData( aEntry, aBuffer ) : iStreamHandler->SaveHeaders( aEntry, aBuffer );
         }
 #ifdef __CACHELOG__
--- a/webengine/osswebengine/cache/src/HttpCacheLookupTable.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/src/HttpCacheLookupTable.cpp	Fri May 08 08:25:06 2009 +0300
@@ -97,7 +97,9 @@
     return self;
     }
 
+// -----------------------------------------------------------------------------
 // Destructor
+// -----------------------------------------------------------------------------
 CHttpCacheLookupTable::~CHttpCacheLookupTable()
     {
     // do not call ResetAndDestroy on iEntries
@@ -150,17 +152,35 @@
 //
 // -----------------------------------------------------------------------------
 //
-CHttpCacheEntry* CHttpCacheLookupTable::Find(
-    const TDesC8& aUrl )
+CHttpCacheEntry* CHttpCacheLookupTable::Find( const TDesC8& aUrl )
     {
     CHttpCacheEntry* entry = NULL;
-  TInt pos( Probe( aUrl, EFalse ) );
-    //
-  if( Valid( pos ) )
+    TInt pos( Probe( aUrl, EFalse ) );
+
+    if ( Valid( pos ) )
         {
         entry = iEntries->At( pos );
+        
+        if ( entry )
+            {
+            if ( entry->BodySize() == 0 &&
+                 entry->State() == CHttpCacheEntry::ECacheComplete )
+                {
+
+#ifdef __CACHELOG__
+                HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheLookupTable::Find - Found ZERO size"),
+                                           entry->Filename(),
+                                           entry->Url(),
+                                           pos,
+                                           ELogLookupTablePos );
+#endif
+                return NULL;
+                }
+            }
         }
-  return entry;
+
+    return entry;
     }
 
 // -----------------------------------------------------------------------------
@@ -168,59 +188,68 @@
 //
 // -----------------------------------------------------------------------------
 //
-TInt CHttpCacheLookupTable::Remove(
-    const TDesC8& aUrl )
+TInt CHttpCacheLookupTable::Remove( const TDesC8& aUrl )
     {
     TInt status( KErrNotFound );
-  TInt pos( Probe( aUrl, EFalse ) );
-    //
-  if( Valid( pos ) )
+    TInt pos( Probe( aUrl, EFalse ) );
+
+    if( Valid( pos ) )
         {
         // remove only nonactive entry
         CHttpCacheEntry* entry = iEntries->At( pos );
-        if( entry->State() == CHttpCacheEntry::ECacheComplete )
+        if ( entry->State() == CHttpCacheEntry::ECacheComplete )
             {
+#ifdef __CACHELOG__
+            HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheLookupTable::Remove - ERASING item"),
+                                           entry->Filename(),
+                                           entry->Url(),
+                                           pos,
+                                           ELogLookupTablePos );
+#endif
             Erase( pos );
             status = KErrNone;
-            HttpCacheUtil::WriteLog( 0, _L( "remove item" ), pos );
             }
 #ifndef __CACHELOG__
         }
-#else // __CACHELOG__
+#else //__CACHELOG__
         else
             {
-            HttpCacheUtil::WriteLog( 0, _L( "item is active. cannot be removed" ), pos );
+            HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheLookupTable::Remove - can NOT remove item, is active state"),
+                                           entry->Filename(),
+                                           entry->Url(),
+                                           pos,
+                                           ELogLookupTablePos );
             }
         }
     else
         {
-        HttpCacheUtil::WriteLog( 0, _L( "item is not valid. cannot be removed" ), pos );
+        HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheLookupTable::Remove - item is not valid. cannot be removed" ), pos );
         }
 #endif // __CACHELOG__
+
     return status;
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheLookupTable::EraseCorruptEntry
+// CHttpCacheLookupTable::EraseCacheEntry
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheLookupTable::EraseCorruptEntry(
-    const TDesC8& aUrl )
+void CHttpCacheLookupTable::EraseCacheEntry( const TDesC8& aUrl )
     {
-  TInt pos( Probe( aUrl, EFalse ) );
-    //
-  if( Valid( pos ) )
+    TInt pos( Probe( aUrl, EFalse ) );
+    
+    if ( Valid( pos ) )
         {
         Erase( pos );
-        HttpCacheUtil::WriteLog( 0, _L( "remove corrupt item" ), pos );
         }
 #ifdef __CACHELOG__
     else
         {
         // there must be a valid position for this entry
         __ASSERT_DEBUG( EFalse, User::Panic( _L("cacheHandler Panic"), KErrCorrupt ) );
-        HttpCacheUtil::WriteLog( 0, _L( "corrupt item is not valid" ), pos );
         }
 #endif // __CACHELOG__
     }
@@ -233,23 +262,28 @@
 TInt CHttpCacheLookupTable::RemoveAll()
     {
     TInt numberOfBytes( 0 );
-    HttpCacheUtil::WriteLog( 0, _L( "remove 'em all" ) );
-    //
-    for( TInt i = 0; i < iEntries->Count(); i++ )
+
+#ifdef __CACHELOG__
+    HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheLookupTable::RemoveAll - remove 'em all" ) );
+#endif
+
+    for ( TInt i = 0; i < iEntries->Count(); i++ )
         {
         CHttpCacheEntry* entry = iEntries->At( i );
-        // remove all nonactive entries
-        if( Valid( i ) && entry->State() == CHttpCacheEntry::ECacheComplete )
+        // Remove all nonactive entries
+        if ( Valid( i ) && entry->State() == CHttpCacheEntry::ECacheComplete )
             {
-            numberOfBytes+= ( entry->HeaderSize() + entry->Size() );
+            numberOfBytes += ( entry->HeaderSize() + entry->BodySize() );
             Erase( i );
             }
         }
+
 #ifdef __CACHELOG__
     HttpCacheUtil::WriteLog( 0, _L( "number of items left:" ), iCount );
     // check if there are pending items -should not be though
     __ASSERT_DEBUG( iCount == 0, User::Panic( _L("cacheHandler Panic"), KErrCorrupt ) );
 #endif // __CACHELOG__
+
     return numberOfBytes;
     }
 
@@ -294,7 +328,7 @@
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheLookupTable::Internalize
+// CHttpCacheLookupTable::InternalizeL
 //
 // -----------------------------------------------------------------------------
 //
@@ -304,7 +338,7 @@
     {
     // get number of entries
     TInt version = 0;
-    TRAP_IGNORE( version = aReadStream.ReadInt32L() );
+    version = aReadStream.ReadInt32L();
     if( version == KCacheVersionNumber )
         {
         TInt count( aReadStream.ReadInt32L() );
@@ -321,27 +355,31 @@
                 {
                 // insert to the table
                 InsertL( entry );
-                contentSize+=entry->HeaderSize();
-                contentSize+=entry->Size();
+                contentSize += entry->HeaderSize();
+                contentSize += entry->BodySize();
                 }
-            else if( err == KErrNoMemory )
+            else if ( err == KErrNoMemory )
                 {
                 User::Leave( KErrNoMemory );
                 }
             else
                 {
-                // suggestions?
+                // suggestions
                 }
+
             // takes ownership
             CleanupStack::Pop(); // entry
             }
+
         // set startup cache size
+#ifdef __CACHELOG__
         HttpCacheUtil::WriteLog( 0, _L( "startup content size" ), contentSize );
-        iStreamHandler->SetStartupCacheSize( contentSize );
+#endif
+        iStreamHandler->SetSavedContentSize( contentSize );
         }
     else
         {
-        // cleanup index.dat?
+        // cleanup index.dat
         }
     }
 
@@ -384,10 +422,10 @@
     {
     __ASSERT_DEBUG( aCacheEntry != NULL,
         User::Panic( _L("cacheHandler Panic"), KErrCorrupt ) );
-    //
+
     TInt pos( -1 );
 
-    if( aCacheEntry )
+    if ( aCacheEntry )
         {
         pos = Probe( aCacheEntry->Url(), ETrue );
         // double check
@@ -403,14 +441,18 @@
                 pos = -1;
                 }
             }
+
         // insert
         if( pos != -1 )
             {
             iEntries->At( pos ) = aCacheEntry;
             iCount++;
+
+#ifdef __CACHELOG__
             HttpCacheUtil::WriteLog( 0, _L( "insert new item to the lookuptable" ), pos );
+#endif
             // check if the hashtable is full
-            if( iCount > ( iEntries->Count() >> 1 ) )
+            if ( iCount > ( iEntries->Count() >> 1 ) )
                 {
                 ReHashL();
                 }
@@ -525,12 +567,14 @@
 //
 void CHttpCacheLookupTable::ReHashL()
     {
+#ifdef __CACHELOG__
     HttpCacheUtil::WriteLog( 1, _L( "Resize lookuptable!" ) );
     HttpCacheUtil::WriteLog( 1, _L( "count=" ), iCount );
     HttpCacheUtil::WriteLog( 1, _L( "Table size=" ), iEntries->Count() );
-    //
+#endif
+
     TUint newSize( NextPrime( iEntries->Count() * 2 ) );
-  CArrayPtrFlat<CHttpCacheEntry>* newEntries =
+    CArrayPtrFlat<CHttpCacheEntry>* newEntries =
         new( ELeave )CArrayPtrFlat<CHttpCacheEntry>( newSize );
     // hash must operate on the new table
     CArrayPtrFlat<CHttpCacheEntry>* oldEntries = iEntries;
@@ -608,24 +652,33 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheLookupTable::Erase(
-    TInt aPos )
+void CHttpCacheLookupTable::Erase( TInt aPos )
     {
     // must be a valid pos
     __ASSERT_DEBUG( Valid( aPos ),  User::Panic( _L("cacheHandler Panic"), KErrCorrupt ) );
+
     CHttpCacheEntry* entry = iEntries->At( aPos );
 
     if( entry )
         {
         // delete file associated with this entry
         TBool attached( EFalse );
+        
+#ifdef __CACHELOG__
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheLookupTable::Erase"),
+                                           entry->Filename(),
+                                           entry->Url(),
+                                           aPos,
+                                           ELogLookupTablePos );
+#endif        
         TRAPD( err, attached = iStreamHandler->AttachL( *entry ) );
-        if( err == KErrNone && attached )
+        if ( err == KErrNone && attached )
             {
-            iStreamHandler->Erase( *entry );
+            iStreamHandler->EraseCacheFile( *entry );
             iStreamHandler->Detach( *entry );
             }
-        //
+
         SetDeleted( aPos );
         delete entry;
         iCount--;
--- a/webengine/osswebengine/cache/src/HttpCacheManager.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/src/HttpCacheManager.cpp	Fri May 08 08:25:06 2009 +0300
@@ -137,7 +137,7 @@
                                           const TDesC8& aUrl )
     {
     TBool VSSTransaction ( EFalse );
-    if( iVSSCacheEnabled && HttpCacheUtil::VSSCacheContent( aUrl, iVSSWhiteList ) )
+    if ( iVSSCacheEnabled && HttpCacheUtil::VSSCacheContent( aUrl, iVSSWhiteList ) )
         {
         RStringPool strP = aTrans.Session().StringPool();
 
@@ -164,13 +164,13 @@
         CleanupClosePushL<RStringF>( VSSnameStr);
 
         THTTPHdrVal tempVal;
-        if( aHttpHeader.GetField( VSSnameStr, 0, tempVal ) == KErrNone )
+        if ( aHttpHeader.GetField( VSSnameStr, 0, tempVal ) == KErrNone )
             {
             TPtrC8 valueStr ( KVSSHeaderFileldValue() );
             RStringF VSSValueStr = strP.OpenFStringL( valueStr );
             CleanupClosePushL<RStringF>( VSSValueStr );
 
-            if( tempVal == VSSValueStr )
+            if ( tempVal == VSSValueStr )
                 {
                 VSSTransaction      = ETrue;
                 }
@@ -178,6 +178,7 @@
             }
         CleanupStack::PopAndDestroy(); // VSSnameStr
         } //end if( iVSSCacheEnabled && HttpCacheUtil::VSSCacheContent( aUrl, iVSSWhiteList ) )
+
     return VSSTransaction;
     }
 // -----------------------------------------------------------------------------
@@ -353,7 +354,7 @@
         }
         
     //failure here is not mission critical
-    TRAPD( error, RemoveOrphanedFilesL() ); 
+    TRAP_IGNORE( RemoveOrphanedFilesL() ); 
     
     return numOfBytes;
     }
--- a/webengine/osswebengine/cache/src/HttpCacheStreamHandler.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/src/HttpCacheStreamHandler.cpp	Fri May 08 08:25:06 2009 +0300
@@ -30,7 +30,6 @@
 
 // CONSTANTS
 const TInt KHttpCacheActiveCount = 20;
-const TInt KBufferSize = 32768;
 #if 0
 const TInt KHttpCacheChunkSize = 2048;
 #endif // 0
@@ -49,454 +48,13 @@
 // ============================ MEMBER FUNCTIONS ===============================
 
 // -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::CHttpCacheStreamEntry
-// C++ default constructor can NOT contain any code, that
-// might leave.
-// -----------------------------------------------------------------------------
-//
-CHttpCacheStreamEntry::CHttpCacheStreamEntry(
-    RFs& aRfs,
-    CHttpCacheEntry& aHttpCacheEntry,
-    TDriveUnit aDrive,
-    TInt64 aCriticalLevel )
-    : iRfs( aRfs ), iHttpCacheEntry( &aHttpCacheEntry ), iDrive( aDrive ), iCriticalLevel( aCriticalLevel )
-    {
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::ConstructL
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CHttpCacheStreamEntry::ConstructL()
-    {
-    // consistency check on header/body files
-    // open the file or create one
-    iFileOk = ( iHttpCacheEntry->State() == CHttpCacheEntry::ECacheUninitialized ? CreateNewFilesL() : OpenCacheFiles() );
-    if( !iFileOk )
-        {
-        User::Leave( KErrCorrupt );
-        }
-    else if( iFileOk && iHttpCacheEntry->State() == CHttpCacheEntry::ECacheUninitialized )
-        {
-        iHttpCacheEntry->SetState( CHttpCacheEntry::ECacheInitialized );
-        }
-    iCacheBuffer = HBufC8::NewL( KBufferSize );
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::NewL
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CHttpCacheStreamEntry* CHttpCacheStreamEntry::NewL(
-    RFs& aRfs,
-    CHttpCacheEntry& aHttpCacheEntry,
-    TDriveUnit aDrive,
-    TInt64 aCriticalLevel )
-    {
-    CHttpCacheStreamEntry* self = new( ELeave ) CHttpCacheStreamEntry( aRfs,
-        aHttpCacheEntry, aDrive, aCriticalLevel );
-
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop();
-
-    return self;
-    }
-
-// Destructor
-CHttpCacheStreamEntry::~CHttpCacheStreamEntry()
-    {
-    // commit changes
-    if( iFileOk )
-        {
-        iHeaderFile.Close();
-        iBodyFile.Close();
-        }
-    delete iCacheBuffer;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::Erase
-//
-// -----------------------------------------------------------------------------
-//
-void CHttpCacheStreamEntry::Erase()
-    {
-    //
-    HttpCacheUtil::WriteUrlToLog( 0, _L( "erase files associated with" ), iHttpCacheEntry->Url() );
-    iHeaderFile.Close();
-    iBodyFile.Close();
-    // dont care about return vales
-    // as we cannot do much
-    TFileName bodyFileName;
-    // get body filename
-    BodyFileName( bodyFileName );
-
-    TFileName headerFileName;
-    HttpCacheUtil::GetHeaderFileName( bodyFileName, headerFileName );
-    //
-    TInt status;
-    status = iRfs.Delete( bodyFileName );
-    HttpCacheUtil::WriteLog( 0, bodyFileName, status );
-    //
-    status = iRfs.Delete( headerFileName );
-    HttpCacheUtil::WriteLog( 0, headerFileName, status );
-    // do not close them twice
-    iFileOk = EFalse;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::HeadersL
-//
-// -----------------------------------------------------------------------------
-//
-HBufC8* CHttpCacheStreamEntry::HeadersL()
-    {
-    //
-    HBufC8* headerStr = NULL;
-    TInt headerLen( 0 );
-    TInt err( iHeaderFile.Size( headerLen ) );
-    //
-    if( err == KErrNone && headerLen > 0 )
-        {
-        headerStr = HBufC8::NewL( headerLen );
-        TPtr8 ptr( headerStr->Des() );
-        // read headers
-        iHeaderFile.Read( 0, ptr, headerLen );
-        }
-    return headerStr;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::NextChunkL
-//
-// -----------------------------------------------------------------------------
-//
-HBufC8* CHttpCacheStreamEntry::NextChunkL(
-    TBool& aLastChunk )
-    {
-    HBufC8* bodyStr = NULL;
-#if 0
-    // incremental chunk handling
-    TInt size;
-    TInt contentSize( iBodyFile.Size( size ) );
-    size = Min( KHttpCacheChunkSize, contentSize );
-
-    bodyStr = HBufC8::NewL( size );
-    TPtr8 ptr( bodyStr->Des() );
-    //
-    iBodyFile.Read( ptr, size );
-    // check if we are at the end of the file
-    aLastChunk = ( bodyStr->Length() != size );
-#else // 0
-    // read body
-    TInt size;
-    TInt err( iBodyFile.Size( size ) );
-    if( err == KErrNone && size > 0 )
-        {
-        bodyStr = HBufC8::NewL( size );
-        TPtr8 ptr( bodyStr->Des() );
-        //
-        iBodyFile.Read( ptr, size );
-        }
-    aLastChunk = ETrue;
-#endif // 0
-    return bodyStr;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::SaveHeaders
-//
-// -----------------------------------------------------------------------------
-//
-TInt CHttpCacheStreamEntry::SaveHeaders(
-    const TDesC8& aHeaderStr )
-    {
-    TInt save( KErrNone );
-
-    if( aHeaderStr.Length() )
-        {
-        // below critical level
-        TBool below( ETrue );
-
-        below = DiskSpaceBelowCriticalLevel( aHeaderStr.Length() );
-
-        if( !below )
-            {
-            // save headers
-            // Don't force a flush, as the File Server takes care of write and read consistency.
-            iHttpCacheEntry->SetHeaderSize( aHeaderStr.Length() );
-            save = iHeaderFile.Write( aHeaderStr );
-            }
-        else
-            {
-            save = KErrDiskFull;
-            }
-        }
-    return save;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::RemoveHeaders
-//
-// -----------------------------------------------------------------------------
-//
-void CHttpCacheStreamEntry::RemoveHeaders()
-    {
-    // destroy data
-    iHeaderFile.SetSize( 0 );
-    iHttpCacheEntry->SetHeaderSize( 0 );
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::SaveBodyData
-//
-// -----------------------------------------------------------------------------
-//
-TInt CHttpCacheStreamEntry::SaveBodyData(
-    const TDesC8& aBodyStr )
-    {
-    TBool save( KErrNone );
-    TInt bodyLength( aBodyStr.Length() );
-
-    if( bodyLength )
-        {
-        TPtr8 buffer( iCacheBuffer->Des() );
-        if( buffer.Length() + bodyLength > buffer.MaxLength() )
-            {
-            //
-            HBufC8* overflowBuffer = NULL;
-            TInt cut( -1 );
-            // running out of space
-            TPtrC8 writePtr;
-            if( buffer.Length() == 0 )
-                {
-                // buffer is empty and the body is bigger than the buffer
-                writePtr.Set( aBodyStr );
-                }
-            else
-                {
-                cut =  buffer.MaxLength() - buffer.Length();
-                // enough space for the leftover?
-                if( bodyLength - cut > buffer.MaxLength() )
-                    {
-                    // not enough
-                    // put the buffer and the body together and
-                    // write it in one go.
-                    overflowBuffer = HBufC8::New( buffer.Length() + bodyLength );
-                    if( !overflowBuffer )
-                        {
-                        return KErrNoMemory;
-                        }
-                    TPtr8 overflowPtr( overflowBuffer->Des() );
-                    overflowPtr.Copy( buffer );
-                    overflowPtr.Append( aBodyStr );
-                    writePtr.Set( overflowBuffer->Des() );
-                    // empty buffer
-                    buffer.Zero();
-                    // no leftover left
-                    cut = -1;
-                    }
-                else
-                    {
-                    // fill the 32k
-                    buffer.Append( aBodyStr.Left( cut ) );
-                    writePtr.Set( buffer );
-                    }
-                }
-
-            // write to the disk
-            TBool below;
-            below = DiskSpaceBelowCriticalLevel( writePtr.Length() );
-
-            if( !below )
-                {
-                // write body
-                save = iBodyFile.Write( writePtr );
-                }
-            else
-                {
-                save = KErrDiskFull;
-                // reset buffers
-                buffer.Zero();
-                }
-            //
-            if( save == KErrNone && cut >= 0 )
-                {
-                // copy the leftover in to the buffer
-                buffer.Copy( aBodyStr.Mid( cut ) );
-                }
-            delete overflowBuffer;
-            }
-        else
-            {
-            buffer.Append( aBodyStr );
-            save = KErrNone;
-            }
-        // update size information
-        iHttpCacheEntry->SetSize( iHttpCacheEntry->Size() + bodyLength );
-        }
-    return save;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::RemoveBodyData
-//
-// -----------------------------------------------------------------------------
-//
-void CHttpCacheStreamEntry::RemoveBodyData()
-    {
-    // destroy data
-    iCacheBuffer->Des().Zero();
-    iBodyFile.SetSize( 0 );
-    iHttpCacheEntry->SetSize( 0 );
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::Flush
-//
-// -----------------------------------------------------------------------------
-//
-TInt CHttpCacheStreamEntry::Flush()
-    {
-    TInt saveOk( KErrNone );
-
-    if( iCacheBuffer->Length() )
-        {
-        TPtr8 bufferPtr( iCacheBuffer->Des() );
-
-        TBool below;
-        below = DiskSpaceBelowCriticalLevel( bufferPtr.Length() );
-
-        if( !below )
-            {
-            // append body
-            saveOk = iBodyFile.Write( bufferPtr );
-            }
-        else
-            {
-            saveOk = KErrDiskFull;
-            }
-        bufferPtr.Zero();
-        }
-    return saveOk;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::OpenCacheFiles
-//
-// -----------------------------------------------------------------------------
-//
-TBool CHttpCacheStreamEntry::OpenCacheFiles()
-    {
-    TInt statusHeader;
-    TInt statusBody;
-    //
-    TFileName bodyFileName;
-    // get body filename
-    BodyFileName( bodyFileName );
-    // header filename
-    TFileName headerFileName;
-    //
-    HttpCacheUtil::GetHeaderFileName( bodyFileName, headerFileName );
-
-    statusHeader = iHeaderFile.Open( iRfs, headerFileName, EFileShareExclusive | EFileWrite );
-    statusBody = iBodyFile.Open( iRfs, bodyFileName, EFileShareExclusive | EFileWrite );
-    return ( statusHeader == KErrNone && statusBody == KErrNone );
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::CreateNewFilesL
-//
-// -----------------------------------------------------------------------------
-//
-TBool CHttpCacheStreamEntry::CreateNewFilesL()
-    {
-    TInt statusHeader( KErrNotFound );
-    TInt statusBody( KErrNotFound );
-    TPath sessionPath;
-    User::LeaveIfError( iRfs.SessionPath( sessionPath ) );
-
-    //Given the full URL, generates a fully qualified path for saving the HTTP response
-    HBufC* bodyFileName = HttpCacheUtil::GenerateNameLC( iHttpCacheEntry->Url(), sessionPath );
-    TPtrC bodyFileNamePtr( *bodyFileName );
-    // get header file name
-    TFileName headerFileName;
-    HttpCacheUtil::GetHeaderFileName( bodyFileNamePtr, headerFileName );
-
-    // create a file or replace if it exists. 
-    statusBody = iBodyFile.Replace( iRfs, bodyFileNamePtr, EFileShareExclusive | EFileWrite );
-    if( statusBody == KErrNone )
-        {
-        // header file should not fail
-        statusHeader = iHeaderFile.Replace( iRfs, headerFileName, EFileShareExclusive | EFileWrite );
-        }
-    //
-    TBool fileOk( statusHeader == KErrNone && statusBody == KErrNone );
-#ifdef __CACHELOG__ 
-    HttpCacheUtil::WriteUrlToLog( 0, bodyFileNamePtr, iHttpCacheEntry->Url() );
-#endif 
-
-    //
-    if( fileOk )
-        {
-        iHttpCacheEntry->SetFileNameL( bodyFileNamePtr );
-#ifdef __CACHELOG__ 
-        HttpCacheUtil::WriteUrlToLog( 0, _L8("files are fine") );
-#endif 
-        }
-    else
-        {
-        // corrupt entry. delete the file
-        if( statusBody == KErrNone )
-            {
-            iRfs.Delete( bodyFileNamePtr );
-            }
-        // ???
-        __ASSERT_DEBUG( EFalse,
-            User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-        }
-    CleanupStack::PopAndDestroy( bodyFileName );
-    return fileOk;
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::BodyFileName
-//
-// -----------------------------------------------------------------------------
-//
-void CHttpCacheStreamEntry::BodyFileName(
-    TFileName& aBodyFileName )
-    {
-    TFileName bodyFileName;
-    aBodyFileName.Copy( iHttpCacheEntry->Filename()  );
-    }
-
-// -----------------------------------------------------------------------------
-// CHttpCacheStreamEntry::BodyFileName
-//
-// -----------------------------------------------------------------------------
-//
-TBool CHttpCacheStreamEntry::DiskSpaceBelowCriticalLevel(
-    TInt aContentSize )
-    {
-    TVolumeInfo vinfo;
-    TInt errorCode = iRfs.Volume( vinfo, iDrive );
-
-    return( errorCode != KErrNone || ( vinfo.iFree - aContentSize ) <= iCriticalLevel );
-    }
-
-// -----------------------------------------------------------------------------
 // CHttpCacheStreamHandler::CHttpCacheStreamHandler
 // C++ default constructor can NOT contain any code, that
 // might leave.
 // -----------------------------------------------------------------------------
 //
-CHttpCacheStreamHandler::CHttpCacheStreamHandler() : iDiskFull( EFalse )
+CHttpCacheStreamHandler::CHttpCacheStreamHandler()
     {
-    // change the iDiskFull back to false if somebody freed some disk space.
     }
 
 // -----------------------------------------------------------------------------
@@ -511,7 +69,7 @@
     User::LeaveIfError( iRfs.Connect() );
     // set path for the entries
     iRfs.SetSessionPath( aDirectory );
-    iActiveEntries = new( ELeave )CArrayPtrFlat<CHttpCacheStreamEntry>( KHttpCacheActiveCount );
+    iActiveEntries = new( ELeave )CArrayPtrFlat<CHttpCacheEntry>( KHttpCacheActiveCount );
     // get drive letter for sysutil
     TParsePtrC pathParser( aDirectory );
     iDrive = pathParser.Drive();
@@ -536,14 +94,18 @@
     return self;
     }
 
+// -----------------------------------------------------------------------------
 // Destructor
+// -----------------------------------------------------------------------------
+//
 CHttpCacheStreamHandler::~CHttpCacheStreamHandler()
     {
-    if( iActiveEntries )
+    if ( iActiveEntries )
         {
         iActiveEntries->ResetAndDestroy();
         }
     delete iActiveEntries;
+
     iRfs.Close();
     }
 
@@ -552,36 +114,50 @@
 //
 // -----------------------------------------------------------------------------
 //
-TBool CHttpCacheStreamHandler::AttachL(
-    CHttpCacheEntry& aCacheEntry )
+TBool CHttpCacheStreamHandler::AttachL( CHttpCacheEntry& aCacheEntry )
     {
 #ifdef __CACHELOG__
     // check for duplicates
-    for( TInt i = 0; i < iActiveEntries->Count(); i++ )
+    for ( TInt i = 0; i < iActiveEntries->Count(); i++ )
         {
-        __ASSERT_DEBUG( iActiveEntries->At( i )->CacheEntry() != &aCacheEntry,
-            User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
+        __ASSERT_DEBUG( iActiveEntries->At( i ) != &aCacheEntry,
+        User::Panic( _L("cacheStreamHandler Panic"), KErrCorrupt )  );
         }
 #endif // __CACHELOG__
-    TBool attached( ETrue );
-    // create and save stream entry
-    CHttpCacheStreamEntry* streamEntry = NULL;
+   
+    TBool cacheFilesOpened( EFalse );
 
-    TRAPD( err, streamEntry = CHttpCacheStreamEntry::NewL( iRfs, aCacheEntry, iDrive, iCriticalLevel ) );
-    if( err == KErrCorrupt )
+    if ( aCacheEntry.CacheFilesOpened() )
         {
-        //
-        attached = EFalse;
+        // Cache files already opened, no need to reopen
+        cacheFilesOpened = ETrue;
+        }
+    else if ( aCacheEntry.State() == CHttpCacheEntry::ECacheUninitialized )
+        {
+        // Create new cache files, they don't already exist
+        cacheFilesOpened = CreateNewFilesL( aCacheEntry );
         }
-    else if( err == KErrNoMemory )
+    else
         {
-        User::Leave( err );
+        // Open existing cache files
+        cacheFilesOpened = OpenCacheFiles( aCacheEntry );
         }
-    else if( streamEntry )
+    
+    if ( cacheFilesOpened )
         {
-        iActiveEntries->AppendL( streamEntry );
+        // Add to our active array, if not already there
+        TInt index( -1 );
+        FindCacheEntryIndex( aCacheEntry, &index );
+        if ( index == -1 )
+            {
+            iActiveEntries->AppendL( &aCacheEntry );
+            }
         }
-    return attached;
+
+    aCacheEntry.SetCacheFilesOpened( cacheFilesOpened );
+
+    // Return ETrue, if files opened and attached
+    return cacheFilesOpened;
     }
 
 // -----------------------------------------------------------------------------
@@ -589,39 +165,90 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheStreamHandler::Detach(
-    const CHttpCacheEntry& aCacheEntry )
+void CHttpCacheStreamHandler::Detach( CHttpCacheEntry& aCacheEntry )
     {
-    TInt index;
-    CHttpCacheStreamEntry* streamEntry = FindStreamEntry( aCacheEntry, &index );
-    __ASSERT_DEBUG( streamEntry != NULL, User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
+    // Close the files, this will commit changes
+    if ( aCacheEntry.CacheFilesOpened() )
+        {
+        aCacheEntry.BodyFile().Close();
+        aCacheEntry.HeaderFile().Close();
+        aCacheEntry.SetCacheFilesOpened( EFalse );
+        }
 
-    if( streamEntry )
+    // Delete from our active array
+    TInt index( -1 );
+    FindCacheEntryIndex( (const CHttpCacheEntry&)aCacheEntry, &index );
+    if ( index >= 0 )
         {
-        delete streamEntry;
         iActiveEntries->Delete( index );
         }
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheStreamHandler::Erase
+// CHttpCacheStreamHandler::EraseCacheFile
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheStreamHandler::Erase(
-    const CHttpCacheEntry& aCacheEntry )
+void CHttpCacheStreamHandler::EraseCacheFile( CHttpCacheEntry& aCacheEntry )
     {
-    TInt index;
-    CHttpCacheStreamEntry* streamEntry = FindStreamEntry( aCacheEntry, &index );
-    __ASSERT_DEBUG( streamEntry != NULL, User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
+    HttpCacheUtil::WriteUrlToLog( 0, _L( "CHttpCacheStreamHandler::Erase - erase files associated with" ), aCacheEntry.Url() );
+
+    aCacheEntry.HeaderFile().Close();
+    aCacheEntry.BodyFile().Close();
+    aCacheEntry.SetCacheFilesOpened( EFalse );
+
+    // Get body filename
+    TFileName bodyFileName = aCacheEntry.Filename();
+
+    // Get header filename
+    TFileName headerFileName;
+    HttpCacheUtil::GetHeaderFileName( bodyFileName, headerFileName );
+
+    TInt statusBody( KErrNotFound );
+    statusBody = iRfs.Delete( bodyFileName );
+
+    TInt statusHeader( KErrNotFound );
+    statusHeader = iRfs.Delete( headerFileName );
+
+    // Adjust the size
+    iContentSize -= aCacheEntry.BodySize();
+    iContentSize -= aCacheEntry.HeaderSize();
 
-    if( streamEntry )
-        {
-        streamEntry->Erase();
-        //
-        iContentSize-=aCacheEntry.Size();
-        iContentSize-=aCacheEntry.HeaderSize();
+#ifdef __CACHELOG__
+    if ( statusBody != KErrNone ) {
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CCHttpCacheStreamEntry::Erase - ERROR bodyFile delete"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           statusBody,
+                                           ELogFileErrorCode );
+        }
+    else {
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CCHttpCacheStreamEntry::Erase - SUCCESS bodyFile delete"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           aCacheEntry.BodySize(),
+                                           ELogEntrySize );
         }
+    if ( statusHeader != KErrNone ) {
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CCHttpCacheStreamEntry::Erase - ERROR headerFile delete"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           statusHeader,
+                                           ELogFileErrorCode );
+        }
+    else {
+        HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CCHttpCacheStreamEntry::Erase - SUCCESS headerFile delete"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           aCacheEntry.BodySize(),
+                                           ELogEntrySize );
+        }
+#endif //__CACHELOG__
+
     }
 
 // -----------------------------------------------------------------------------
@@ -629,18 +256,26 @@
 //
 // -----------------------------------------------------------------------------
 //
-HBufC8* CHttpCacheStreamHandler::HeadersL(
-    CHttpCacheEntry& aCacheEntry )
+HBufC8* CHttpCacheStreamHandler::HeadersL( CHttpCacheEntry& aCacheEntry )
     {
-    CHttpCacheStreamEntry* entry = FindStreamEntry( aCacheEntry );
     HBufC8* headerStr = NULL;
-    //
-    __ASSERT_DEBUG( entry != NULL,  User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-    //
-    if( entry )
+    TInt headerLen( 0 );
+    TInt err( KErrNone );
+
+    if ( !aCacheEntry.CacheFilesOpened() )
         {
-        headerStr = entry->HeadersL();
+        OpenCacheFiles( aCacheEntry );
         }
+
+    err = aCacheEntry.HeaderFile().Size( headerLen );
+    if ( err == KErrNone && headerLen > 0 )
+        {
+        headerStr = HBufC8::NewL( headerLen );
+        TPtr8 ptr( headerStr->Des() );
+        // read headers
+        aCacheEntry.HeaderFile().Read( 0, ptr, headerLen );
+        }
+
     return headerStr;
     }
 
@@ -653,16 +288,47 @@
     CHttpCacheEntry& aCacheEntry,
     TBool& aLastChunk )
     {
-    //
-    CHttpCacheStreamEntry* entry = FindStreamEntry( aCacheEntry );
     HBufC8* bodyStr = NULL;
-    //
-    __ASSERT_DEBUG( entry != NULL,  User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-    //
-    if( entry )
+    // Read whole body
+    TInt size( 0 );
+    TInt sizeErr( KErrNone );
+
+    if ( !aCacheEntry.CacheFilesOpened() )
+        {
+        OpenCacheFiles( aCacheEntry );
+        }
+
+    sizeErr = aCacheEntry.BodyFile().Size( size );
+    if ( sizeErr == KErrNone && size > 0 )
         {
-        bodyStr = entry->NextChunkL( aLastChunk );
+        bodyStr = HBufC8::NewL( size );
+        TPtr8 ptr( bodyStr->Des() );
+
+        TInt readErr( KErrNone );
+        readErr = aCacheEntry.BodyFile().Read( ptr, size );
+
+#ifdef __CACHELOG__
+        if ( readErr != KErrNone ) {
+            HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                               _L("CCHttpCacheStreamEntry::NextChunkL - bodyFile.read"),
+                                               aCacheEntry.Filename(),
+                                               aCacheEntry.Url(),
+                                               readErr,
+                                               ELogFileErrorCode );
+            }
+        else {
+            HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                               _L("CCHttpCacheStreamEntry::NextChunkL - bodyFile.read"),
+                                               aCacheEntry.Filename(),
+                                               aCacheEntry.Url(),
+                                               ptr.Length(),
+                                               ELogEntrySize );
+            }
+#endif  // __CACHELOG__
+
         }
+    aLastChunk = ETrue;
+
     return bodyStr;
     }
 
@@ -675,28 +341,28 @@
     CHttpCacheEntry& aCacheEntry,
     const TDesC8& aHeaderStr )
     {
-    TBool saved( KErrGeneral );
-    if( !iDiskFull )
+    TBool headerSaved( EFalse );
+
+    if ( !aCacheEntry.CacheFilesOpened() )
         {
-        CHttpCacheStreamEntry* entry = FindStreamEntry( aCacheEntry );
-        //
-        __ASSERT_DEBUG( entry != NULL,  User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-        //
-        if( entry )
+        OpenCacheFiles( aCacheEntry );
+        }
+
+    if ( aHeaderStr.Length() && IsDiskSpaceAvailable( aHeaderStr.Length() ) )
+        {
+        // We have space on disk, save headers. Don't force a flush, as the
+        // File Server takes care of write and read consistency.
+        TInt writeErr = aCacheEntry.HeaderFile().Write( aHeaderStr );
+
+        if ( writeErr == KErrNone )
             {
-            saved = entry->SaveHeaders( aHeaderStr );
-            // update content size in cache
-            if( saved == KErrNone )
-                {
-                iContentSize+=aHeaderStr.Length();
-                }
-            else if( saved == KErrDiskFull )
-                {
-                iDiskFull = ETrue;
-                }
+            aCacheEntry.SetHeaderSize( aHeaderStr.Length() );
+            iContentSize += aHeaderStr.Length();
+            headerSaved = ETrue;
             }
         }
-    return( saved == KErrNone );
+
+    return headerSaved;
     }
 
 // -----------------------------------------------------------------------------
@@ -704,18 +370,13 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheStreamHandler::RemoveHeaders(
-    CHttpCacheEntry& aCacheEntry )
+void CHttpCacheStreamHandler::RemoveHeaders( CHttpCacheEntry& aCacheEntry )
     {
-    CHttpCacheStreamEntry* entry = FindStreamEntry( aCacheEntry );
-    //
-    __ASSERT_DEBUG( entry != NULL,  User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-    //
-    if( entry )
-        {
-        iContentSize-=aCacheEntry.HeaderSize();
-        entry->RemoveHeaders();
-        }
+    iContentSize -= aCacheEntry.HeaderSize();
+
+    // Destroy data
+    aCacheEntry.HeaderFile().SetSize( 0 );
+    aCacheEntry.SetHeaderSize( 0 );
     }
 
 // -----------------------------------------------------------------------------
@@ -727,27 +388,101 @@
     CHttpCacheEntry& aCacheEntry,
     const TDesC8& aBodyStr )
     {
-    TInt saved( KErrGeneral );
-    if( !iDiskFull )
+    TInt bodySaved( EFalse );
+    TInt newBodyLength( aBodyStr.Length() );
+    TPtr8 buffer( aCacheEntry.CacheBuffer() );
+
+    if ( newBodyLength && buffer.MaxLength() )
         {
-        CHttpCacheStreamEntry* entry = FindStreamEntry( aCacheEntry );
-        //
-        __ASSERT_DEBUG( entry != NULL,  User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-        //
-        if( entry )
+        // Calculate if we have enough space in the buffer for incoming body
+        if ( buffer.Length() + newBodyLength > buffer.MaxLength() )
             {
-            saved = entry->SaveBodyData( aBodyStr );
-            if( saved == KErrNone )
+            // Incoming data is too big for the buffer
+            HBufC8* overflowBuffer = NULL;
+            TInt bufferSpaceLeft( -1 );
+            TPtrC8 writePtr;
+
+            if ( buffer.Length() == 0 )
+                {
+                // Buffer is empty and the body is bigger than the buffer,
+                // just take all of the incoming data
+                writePtr.Set( aBodyStr );
+                }
+            else
                 {
-                iContentSize+=aBodyStr.Length();
+                // We have some data in buffer, how much space do we have left
+                bufferSpaceLeft = buffer.MaxLength() - buffer.Length();
+                
+                if ( newBodyLength - bufferSpaceLeft > buffer.MaxLength() )
+                    {
+                    // Not enough space, so lets put the buffer and the new
+                    // body together and write it in one go.
+                    overflowBuffer = HBufC8::New( buffer.Length() + newBodyLength );
+                    if ( !overflowBuffer )
+                        {
+                        return EFalse;
+                        }
+
+                    TPtr8 overflowPtr( overflowBuffer->Des() );
+                    overflowPtr.Copy( buffer );
+                    overflowPtr.Append( aBodyStr );
+                    writePtr.Set( overflowBuffer->Des() );
+
+                    // empty buffer
+                    buffer.Zero();
+                    // no leftover left
+                    bufferSpaceLeft = -1;
+                    }
+                else
+                    {
+                    // Copy what we have enough space for
+                    buffer.Append( aBodyStr.Left( bufferSpaceLeft ) );
+                    writePtr.Set( buffer );
+                    }
                 }
-            else if( saved == KErrDiskFull )
+
+            // Write to the disk, if we have disk space
+            TInt writeErr( KErrNone );
+            if ( IsDiskSpaceAvailable( writePtr.Length() ) )
                 {
-                iDiskFull = ETrue;
+
+                if ( !aCacheEntry.CacheFilesOpened() )
+                    {
+                    OpenCacheFiles( aCacheEntry );
+                    }
+
+                // We have enough disk space, save body
+                TInt writeErr = aCacheEntry.BodyFile().Write( writePtr );
+                bodySaved = ETrue;
+                }
+            else
+                {
+                // We don't have enough disk space, clean up 
+                bodySaved = EFalse;
+                buffer.Zero();
                 }
+
+            if ( writeErr == KErrNone && bufferSpaceLeft >= 0 )
+                {
+                // Copy what we can of the leftover in to the buffer
+                buffer.Copy( aBodyStr.Mid( bufferSpaceLeft ) );
+                }
+            delete overflowBuffer;
             }
+        else
+            {
+            // We have enough space in buffer, add and wait for next body
+            // before writing to file
+            buffer.Append( aBodyStr );
+            bodySaved = ETrue;
+            }
+
+        // Body saved, update state
+        aCacheEntry.SetBodySize( aCacheEntry.BodySize() + newBodyLength );
+        iContentSize += aBodyStr.Length();
         }
-    return( saved == KErrNone );
+
+    return bodySaved;
     }
 
 // -----------------------------------------------------------------------------
@@ -755,18 +490,22 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CHttpCacheStreamHandler::RemoveBodyData(
-    CHttpCacheEntry& aCacheEntry )
+void CHttpCacheStreamHandler::RemoveBodyData( CHttpCacheEntry& aCacheEntry )
     {
-    CHttpCacheStreamEntry* entry = FindStreamEntry( aCacheEntry );
-    //
-    __ASSERT_DEBUG( entry != NULL,  User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-    //
-    if( entry )
-        {
-        iContentSize-=aCacheEntry.Size();
-        entry->RemoveBodyData();
-        }
+#ifdef __CACHELOG__
+     HttpCacheUtil::WriteLogFilenameAndUrl( 0,
+                                           _L("CHttpCacheStreamHandler::RemoveBodyData - CLEAR iCacheBuffer, entrySize, and iBodyFile"),
+                                           aCacheEntry.Filename(),
+                                           aCacheEntry.Url(),
+                                           aCacheEntry.BodySize(),
+                                           ELogEntrySize );
+#endif
+
+    // Remove data 
+    iContentSize -= aCacheEntry.BodySize();
+    aCacheEntry.SetBodySize( 0 );
+    aCacheEntry.CacheBuffer().Zero();
+    aCacheEntry.BodyFile().SetSize( 0 );
     }
 
 // -----------------------------------------------------------------------------
@@ -774,55 +513,168 @@
 //
 // -----------------------------------------------------------------------------
 //
-TBool CHttpCacheStreamHandler::Flush(
-    CHttpCacheEntry& aCacheEntry )
+TBool CHttpCacheStreamHandler::Flush( CHttpCacheEntry& aCacheEntry )
     {
-    TInt saved( KErrGeneral );
-    if( !iDiskFull )
+    TBool saved( EFalse );
+    TInt writeErr( KErrGeneral );
+    TInt cacheBufferLen( aCacheEntry.CacheBuffer().Length() );
+
+    if ( cacheBufferLen && IsDiskSpaceAvailable( cacheBufferLen ) )
         {
-        CHttpCacheStreamEntry* entry = FindStreamEntry( aCacheEntry );
-        //
-        __ASSERT_DEBUG( entry != NULL,  User::Panic( _L("cacheHandler Panic"), KErrCorrupt )  );
-        //
-        if( entry )
+        // We have enough space, save cache buffer
+        TPtr8 bufferPtr( aCacheEntry.CacheBuffer() );
+        if ( bufferPtr.Length() )
             {
-            saved = entry->Flush();
-            //
-            if( saved == KErrDiskFull )
+            if ( !aCacheEntry.CacheFilesOpened() )
                 {
-                iDiskFull = ETrue;
+                OpenCacheFiles( aCacheEntry );
+                }
+
+            writeErr = aCacheEntry.BodyFile().Write( bufferPtr );
+            if ( writeErr == KErrNone )
+                {
+                saved = ETrue;
                 }
             }
+
+        // Clear the buffer
+        bufferPtr.Zero();
         }
-    return( saved == KErrNone );
+
+    return saved;
+    }
+
+// -----------------------------------------------------------------------------
+// CHttpCacheStreamHandler::OpenCacheFiles
+//
+// -----------------------------------------------------------------------------
+//
+TBool CHttpCacheStreamHandler::OpenCacheFiles( CHttpCacheEntry& aCacheEntry )
+    {
+    TInt statusHeader( KErrNotFound );
+    TInt statusBody( KErrNotFound );
+
+    // get body filename
+    TFileName bodyFileName = aCacheEntry.Filename();
+
+    // header filename
+    TFileName headerFileName;
+    HttpCacheUtil::GetHeaderFileName( bodyFileName, headerFileName );
+
+    statusHeader = aCacheEntry.HeaderFile().Open( iRfs, headerFileName, EFileShareExclusive | EFileWrite );
+    statusBody = aCacheEntry.BodyFile().Open( iRfs, bodyFileName, EFileShareExclusive | EFileWrite );
+
+    TBool fileOk( statusHeader == KErrNone && statusBody == KErrNone );
+    if ( fileOk )
+        {
+        aCacheEntry.SetCacheFilesOpened( ETrue );
+        }
+
+    return fileOk;
     }
 
 // -----------------------------------------------------------------------------
-// CHttpCacheStreamHandler::FindStreamEntry
+// CHttpCacheStreamHandler::CreateNewFilesL
 //
 // -----------------------------------------------------------------------------
 //
-CHttpCacheStreamEntry* CHttpCacheStreamHandler::FindStreamEntry(
+TBool CHttpCacheStreamHandler::CreateNewFilesL( CHttpCacheEntry& aCacheEntry )
+    {
+    TInt statusHeader( KErrNotFound );
+    TInt statusBody( KErrNotFound );
+    TPath sessionPath;
+    User::LeaveIfError( iRfs.SessionPath( sessionPath ) );
+    
+    // Given the full URL, generates a fully qualified path for saving the HTTP response
+    HBufC* bodyFileName = HttpCacheUtil::GenerateNameLC( aCacheEntry.Url(), sessionPath );
+    TPtrC bodyFileNamePtr( *bodyFileName );
+ 
+    // Create header file name from body file name
+    TFileName headerFileName;
+    HttpCacheUtil::GetHeaderFileName( bodyFileNamePtr, headerFileName );
+
+    // Create the body file or replace it, if it exists. 
+    statusBody = aCacheEntry.BodyFile().Replace( iRfs, bodyFileNamePtr, EFileShareExclusive | EFileWrite );
+    if ( statusBody == KErrNone )
+        {
+        // Header file should not fail
+        statusHeader = aCacheEntry.HeaderFile().Replace( iRfs, headerFileName, EFileShareExclusive | EFileWrite );
+        }
+
+#ifdef __CACHELOG__ 
+    HttpCacheUtil::WriteUrlToLog( 0, bodyFileNamePtr, aCacheEntry.Url() );
+#endif 
+
+    TBool fileOk( statusHeader == KErrNone && statusBody == KErrNone );
+    if ( fileOk )
+        {
+        // Both body and header files created correctly 
+        aCacheEntry.SetFileNameL( bodyFileNamePtr );
+        aCacheEntry.SetState( CHttpCacheEntry::ECacheInitialized );
+        }
+    else
+        {
+        // Only the body file created, no header file, delete body file 
+        iRfs.Delete( bodyFileNamePtr );
+        iRfs.Delete( headerFileName );
+
+        aCacheEntry.SetBodySize( 0 );
+        aCacheEntry.SetHeaderSize( 0 );
+
+#ifdef __CACHELOG__
+        HttpCacheUtil::WriteLog( 0, _L( "CHttpCacheEntry::CreateNewFilesL - DELETE body file, header file failed" ) );
+#endif
+//        __ASSERT_DEBUG( EFalse, User::Panic( _L("CHttpCacheHandler::CreateNewFilesL Panic"), KErrCorrupt )  );
+        }
+
+    CleanupStack::PopAndDestroy( bodyFileName );
+
+    return fileOk;
+    }
+
+// -----------------------------------------------------------------------------
+// CHttpCacheStreamHandler::FindCacheEntryIndex
+//
+// -----------------------------------------------------------------------------
+//
+void CHttpCacheStreamHandler::FindCacheEntryIndex(
     const CHttpCacheEntry& aCacheEntry,
     TInt* aIndex )
     {
-    CHttpCacheStreamEntry* streamEntry = NULL;
-
-    for( TInt i = 0; i < iActiveEntries->Count(); i++ )
+    *aIndex = -1;
+    for ( TInt i = 0; i < iActiveEntries->Count(); i++ )
         {
-        CHttpCacheStreamEntry* entry = iActiveEntries->At( i );
+        CHttpCacheEntry* entry = iActiveEntries->At( i );
 
-        if( entry && entry->CacheEntry() == &aCacheEntry )
+        if ( entry == &aCacheEntry )
             {
-            streamEntry = entry;
-            if( aIndex )
+            if ( aIndex )
                 {
                 *aIndex = i;
                 }
             break;
             }
         }
-    return streamEntry;
+    }
+
+// -----------------------------------------------------------------------------
+// CHttpCacheStreamHandler::IsDiskSpaceAvailable
+//
+// -----------------------------------------------------------------------------
+//
+TBool CHttpCacheStreamHandler::IsDiskSpaceAvailable( TInt aContentSize )
+    {
+    TBool diskSpaceAvailable( EFalse );
+    TVolumeInfo vinfo;
+    TInt errorCode = iRfs.Volume( vinfo, iDrive );
+
+    if ( errorCode == KErrNone && ( vinfo.iFree - aContentSize ) > iCriticalLevel )
+        {
+        // We have space on the disk for the content
+        diskSpaceAvailable = ETrue;
+        }
+
+    return diskSpaceAvailable;
     }
 
 //  End of File
--- a/webengine/osswebengine/cache/src/HttpCacheUtil.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/osswebengine/cache/src/HttpCacheUtil.cpp	Fri May 08 08:25:06 2009 +0300
@@ -15,7 +15,6 @@
 *
 */
 
-
 // INCLUDE FILES
 #include "HttpCacheUtil.h"
 #include <http/rhttpheaders.h>
@@ -501,14 +500,18 @@
         TBuf<50> dateString;
         TTime fr( freshness );
 
-        fr.FormatL( dateString, KDateString );
-        HttpCacheUtil::WriteLog( 0, _L( "fresness" ) );
-        HttpCacheUtil::WriteLog( 0, dateString );
+        TRAP(err, fr.FormatL( dateString, KDateString ) );
+        if ( err == KErrNone ) {
+            HttpCacheUtil::WriteLog( 0, _L( "freshness" ) );
+            HttpCacheUtil::WriteLog( 0, dateString );
+            }
 
         TTime ca( age );
-        ca.FormatL( dateString, KDateString );
-        HttpCacheUtil::WriteLog( 0, _L( "age" ) );
-        HttpCacheUtil::WriteLog( 0, dateString );
+        TRAP( err, ca.FormatL( dateString, KDateString ) );
+        if ( err == KErrNone ) {
+            HttpCacheUtil::WriteLog( 0, _L( "age" ) );
+            HttpCacheUtil::WriteLog( 0, dateString );
+            }
 #endif // __CACHELOG__
 
     // Get useful cache-control directives from the requestHeaders
@@ -704,6 +707,7 @@
     return( noCacheField == KErrNone || noStoreField == KErrNone );
     }
 
+        
 // -----------------------------------------------------------------------------
 // HttpCacheUtil::GetHeaderFileName
 //
@@ -720,6 +724,7 @@
     aHeaderFileName.Append( KHttpCacheHeaderExt() );
     }
 
+
 // -----------------------------------------------------------------------------
 // HttpCacheUtil::AdjustExpirationTime
 //
@@ -734,16 +739,18 @@
 
     if( aResponseHeaders.GetField( aStrP.StringF( HTTP::EExpires, stringTable ), 0, hdrVal ) == KErrNone )
         {
+        TTime expDate( hdrVal.DateTime() );
+
+#ifdef __CACHELOG__
         HttpCacheUtil::WriteLog( 0, _L( "adjust expiration time from" ) );
 
-        TTime expDate( hdrVal.DateTime() );
-#ifdef __CACHELOG__
         TBuf<50> dateString;
         TTime expTime( hdrVal.DateTime() );
 
         expTime.FormatL( dateString, KDateString );
         HttpCacheUtil::WriteLog( 0, dateString );
 #endif // __CACHELOG__
+
         // double it
         TTimeIntervalMinutes minutes;
         TTimeIntervalHours hours;
@@ -752,16 +759,17 @@
 
         if( expDate.MinutesFrom( now, minutes ) == KErrNone )
             {
+
 #ifdef __CACHELOG__
-        //
         now.FormatL( dateString, KDateString );
+
         HttpCacheUtil::WriteLog( 0, _L( "current time" ) );
         HttpCacheUtil::WriteLog( 0, dateString );
         //
         now.FormatL( dateString, KDateString );
         HttpCacheUtil::WriteLog( 0, _L( "expires in (minutes)" ), minutes.Int() );
 #endif // __CACHELOG__
-            //
+
             expDate+=minutes;
             }
         // minutes owerflow? take hours instead
@@ -963,7 +971,9 @@
         contType.StrF() == strP.StringF( HttpFilterCommonStringsExt::EApplicationVndOmaDrm,
         HttpFilterCommonStringsExt::GetTable() ) )
         {
-        HttpCacheUtil::WriteLog( 0, _L( "sensitive content. do not cache" ) );
+#ifdef __CACHELOG__
+        HttpCacheUtil::WriteLog( 0, _L( "HttpCacheUtil::IsCacheable - sensitive content. do not cache" ) );
+#endif
         // drm == nocache
         isCacheable = EFalse;
         }
@@ -976,7 +986,9 @@
         if( respHeaders.GetField( fieldName, 0, contLen ) != KErrNotFound &&
             ( contLen.Type() == THTTPHdrVal::KTIntVal && contLen.Int() > aMaxSize ) )
             {
+#ifdef __CACHELOG__
             HttpCacheUtil::WriteLog( 0, _L( "oversized content. do not cache" ) );
+#endif
             // oversized content
             return EFalse;
             }
@@ -992,7 +1004,9 @@
             // If no-cache or no-store directives exist -> don't cache.
             if( noCache || noStore )
                 {
-                HttpCacheUtil::WriteLog( 0, _L( "no cache/no store header. do not cache" ) );
+#ifdef __CACHELOG__
+                HttpCacheUtil::WriteLog( 0, _L( "HttpCacheUtil::IsCacheable - no cache/no store header. do not cache" ) );
+#endif
                 // no protection on this entry
                 aProtectedEntry = EFalse;
                 return EFalse;
@@ -1108,15 +1122,16 @@
     TBool log( aLogLevel <= KCurrentLogLevel );
     TPtrC fileName( KHttpCacheGeneralFileName );
 
-    if( aLogLevel == 1 )
+    if ( aLogLevel == 1 )
         {
-        // hash
+        // write logging to hash.txt
         fileName.Set( KHttpCacheHashFileName );
         log = ETrue;
         }
-    if( log )
+
+    if ( log )
         {
-        if( aAny != 0xffff )
+        if ( aAny != 0xffff )
             {
             RFileLogger::WriteFormat(_L("Browser"), fileName, EFileLoggingModeAppend,
                     _L("%S %d"), &aBuf, aAny );
@@ -1135,6 +1150,97 @@
     }
 
 // -----------------------------------------------------------------------------
+// HttpCacheUtil::WriteLogFilenameAndUrl
+//
+// -----------------------------------------------------------------------------
+//
+void HttpCacheUtil::WriteLogFilenameAndUrl(
+    TInt aLogLevel,
+    TPtrC aMethodName,
+    const TPtrC aFilename,
+    const TDesC8& aUrl,
+    TInt aAny,
+    TLogItemType aItemType )
+    {
+#ifdef __CACHELOG__
+    // Create a buffer for method name, filename, and url string
+    _LIT(KColonSpace, " : ");
+    _LIT(KSpace, " ");
+    TInt itemTypeStringLen( 30 );
+    TInt tmpLen( aMethodName.Length() + aFilename.Length() +
+                 3*KColonSpace().Length() + aUrl.Length() + itemTypeStringLen );
+    HBufC* tmp = HBufC::New( tmpLen );
+    
+    if ( tmp ) {
+        TPtr tmpPtr( tmp->Des() );
+        tmpPtr.Copy( aMethodName );
+        tmpPtr.Append( KColonSpace );
+
+        TChar backSlash('\\');
+        TInt filenamePos( aFilename.LocateReverse( TChar('\\') ) );
+        if ( filenamePos > 0 ) {
+            tmpPtr.Append( aFilename.Right( aFilename.Length() - filenamePos - 1 ) );
+            tmpPtr.Append( KColonSpace );
+        }
+
+        // Convert url to TPtr
+        HBufC* tmpUrl = HBufC::New( aUrl.Length() );
+        if ( tmpUrl ) {
+            TPtr tmpUrlPtr( tmpUrl->Des() );
+            tmpUrlPtr.Copy( aUrl );
+            TInt urlPos( tmpUrlPtr.LocateReverse( TChar('/') ) );
+            if ( urlPos > 0 && (aUrl.Length()-2 > urlPos) ) {
+                tmpPtr.Append( tmpUrlPtr.Right( aUrl.Length() - urlPos - 1 ) );
+                tmpPtr.Append( KColonSpace );
+            }
+            else {
+                tmpPtr.Append( tmpUrlPtr );
+                tmpPtr.Append( KColonSpace );
+            }
+        }
+        
+        // Append the bucketIndex, lookup table pos, etc...
+        switch ( aItemType )
+        {
+            case ELogItemTypeNone:
+                break;
+        
+            case ELogBucketIndex:
+                tmpPtr.Append( _L("bucketIndex =") );
+                break;
+                
+            case ELogEntrySize:
+                tmpPtr.Append( _L("entrySize =") );
+                break;
+
+            case ELogLookupTablePos:
+                tmpPtr.Append( _L("lookupTable pos =") );
+                break;
+
+            case ELogFileErrorCode:
+                tmpPtr.Append( _L("file errorCode =") );
+                break;
+
+            default:
+                break;
+        }
+
+        HttpCacheUtil::WriteLog( aLogLevel, tmpPtr, aAny );
+
+        delete tmp;
+        delete tmpUrl;
+        }
+#else // __CACHELOG__
+    (void)aLogLevel;
+    (void)aMethodName;
+    (void)aFilename;
+    (void)aUrl;
+    (void)aAny;
+    (void)aItemType;
+#endif
+    }
+
+// -----------------------------------------------------------------------------
 // HttpCacheUtil::WriteUrlToLog
 //
 // Get the freshness of the "entry".
@@ -1221,19 +1327,19 @@
 // -----------------------------------------------------------------------------
 HBufC* HttpCacheUtil::GenerateNameLC(
         const TDesC8& aUrl, const TDesC& aBaseDir)
-        {
-
+    {
+   
     TUint32 crc (0);
-
+    
     //use the entire URL for CRC calculation: maximizes source entropy/avoids collisions
     Mem::Crc32(crc, aUrl.Ptr(), aUrl.Size()); 
     TUint32 nibble (crc & (KCacheSubdirCount-1)); // extract least significant 4 bits (nibble) for subdirectory
-
+    
     HBufC* fileName = HBufC::NewLC( KMaxPath ); // e.g E\078AFEFE
     _LIT(KFormat,"%S%x%c%08x"); // Note the %08x : a 32-bit value can represented as 0xFFFFFFFF 
     fileName->Des().Format(KFormat, &aBaseDir, nibble, KPathDelimiter, crc);
     return fileName;
-
+    
     }
 
 
@@ -1351,7 +1457,6 @@
     TDateTime date;
     TTime time;
 
-    // Int64 timeinsec;
     TInt64 correctedRecvAge;
     TInt64 apparentAge;
     TInt64 responseDelay;
@@ -1370,9 +1475,11 @@
 #ifdef __CACHELOG__
     TBuf<50> dateString;
     //
-    now.FormatL( dateString, KDateString );
-    HttpCacheUtil::WriteLog( 0, _L( "current time" ) );
-    HttpCacheUtil::WriteLog( 0, dateString );
+    TRAP( err, now.FormatL( dateString, KDateString ) );
+    if ( err == KErrNone ) {
+        HttpCacheUtil::WriteLog( 0, _L( "current time" ) );
+        HttpCacheUtil::WriteLog( 0, dateString );
+        }
 #endif // __CACHELOG__
 
     // The aRequestTime is same as that of headers time.
@@ -1597,7 +1704,7 @@
         else
             {
             aDirective = cacheDir.Copy();
-            // Directives which MUST have values;
+            // Directives which MUST have values
             if( ( aDirective == aStrP.StringF( HTTP::EMaxAge, RHTTPSession::GetTable() ) ) ||
                 ( aDirective == aStrP.StringF( HTTP::EMinFresh, RHTTPSession::GetTable() ) ) ||
                 ( aDirective == aStrP.StringF( HTTP::ESMaxAge, RHTTPSession::GetTable() ) ) )
--- a/webengine/webkitutils/rt_gesturehelper/bwins/rt_gesturehelperu.def	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/bwins/rt_gesturehelperu.def	Fri May 08 08:25:06 2009 +0300
@@ -1,22 +1,10 @@
 EXPORTS
-	??0CGestureControl@RT_GestureHelper@@IAE@XZ @ 1 NONAME ; RT_GestureHelper::CGestureControl::CGestureControl(void)
-	??1CGestureControl@RT_GestureHelper@@UAE@XZ @ 2 NONAME ; RT_GestureHelper::CGestureControl::~CGestureControl(void)
-	??1CGestureHelper@RT_GestureHelper@@UAE@XZ @ 3 NONAME ; RT_GestureHelper::CGestureHelper::~CGestureHelper(void)
-	?Cancel@CGestureHelper@RT_GestureHelper@@QAEXXZ @ 4 NONAME ; void RT_GestureHelper::CGestureHelper::Cancel(void)
-	?ConstructL@CGestureControl@RT_GestureHelper@@IAEXAAVMGestureObserver@2@AAVCAlfEnv@@AAVCAlfDisplay@@H@Z @ 5 NONAME ; void RT_GestureHelper::CGestureControl::ConstructL(class RT_GestureHelper::MGestureObserver &, class CAlfEnv &, class CAlfDisplay &, int)
-	?HandlePointerEventL@CGestureHelper@RT_GestureHelper@@QAEHABUTPointerEvent@@@Z @ 6 NONAME ; int RT_GestureHelper::CGestureHelper::HandlePointerEventL(struct TPointerEvent const &)
-	?InitAlfredPointerCaptureL@CGestureHelper@RT_GestureHelper@@QAEXAAVCAlfEnv@@AAVCAlfDisplay@@H@Z @ 7 NONAME ; void RT_GestureHelper::CGestureHelper::InitAlfredPointerCaptureL(class CAlfEnv &, class CAlfDisplay &, int)
-	?IsDoubleTapEnabled@CGestureControl@RT_GestureHelper@@QBEHXZ @ 8 NONAME ; int RT_GestureHelper::CGestureControl::IsDoubleTapEnabled(void) const
-	?IsDoubleTapEnabled@CGestureHelper@RT_GestureHelper@@QBEHXZ @ 9 NONAME ; int RT_GestureHelper::CGestureHelper::IsDoubleTapEnabled(void) const
-	?IsHoldingEnabled@CGestureControl@RT_GestureHelper@@QBEHXZ @ 10 NONAME ; int RT_GestureHelper::CGestureControl::IsHoldingEnabled(void) const
-	?IsHoldingEnabled@CGestureHelper@RT_GestureHelper@@QBEHXZ @ 11 NONAME ; int RT_GestureHelper::CGestureHelper::IsHoldingEnabled(void) const
-	?NewL@CGestureHelper@RT_GestureHelper@@SAPAV12@AAVMGestureObserver@2@@Z @ 12 NONAME ; class RT_GestureHelper::CGestureHelper * RT_GestureHelper::CGestureHelper::NewL(class RT_GestureHelper::MGestureObserver &)
-	?NewLC@CGestureControl@RT_GestureHelper@@SAPAV12@AAVMGestureObserver@2@AAVCAlfEnv@@AAVCAlfDisplay@@H@Z @ 13 NONAME ; class RT_GestureHelper::CGestureControl * RT_GestureHelper::CGestureControl::NewLC(class RT_GestureHelper::MGestureObserver &, class CAlfEnv &, class CAlfDisplay &, int)
-	?OfferEventL@CGestureControl@RT_GestureHelper@@UAEHABVTAlfEvent@@@Z @ 14 NONAME ; int RT_GestureHelper::CGestureControl::OfferEventL(class TAlfEvent const &)
-	?OfferEventL@CGestureHelper@RT_GestureHelper@@QAEHABVTAlfEvent@@@Z @ 15 NONAME ; int RT_GestureHelper::CGestureHelper::OfferEventL(class TAlfEvent const &)
-	?SetDoubleTapEnabled@CGestureControl@RT_GestureHelper@@QAEXH@Z @ 16 NONAME ; void RT_GestureHelper::CGestureControl::SetDoubleTapEnabled(int)
-	?SetDoubleTapEnabled@CGestureHelper@RT_GestureHelper@@QAEXH@Z @ 17 NONAME ; void RT_GestureHelper::CGestureHelper::SetDoubleTapEnabled(int)
-	?SetHoldingEnabled@CGestureControl@RT_GestureHelper@@QAEXH@Z @ 18 NONAME ; void RT_GestureHelper::CGestureControl::SetHoldingEnabled(int)
-	?SetHoldingEnabled@CGestureHelper@RT_GestureHelper@@QAEXH@Z @ 19 NONAME ; void RT_GestureHelper::CGestureHelper::SetHoldingEnabled(int)
-	?VisualByCoordinates@HitTest@RT_GestureHelper@@SAPAVCAlfVisual@@ABVCAlfControl@@ABVTPoint@@@Z @ 20 NONAME ; class CAlfVisual * RT_GestureHelper::HitTest::VisualByCoordinates(class CAlfControl const &, class TPoint const &)
+	??1CGestureHelper@RT_GestureHelper@@UAE@XZ @ 1 NONAME ; RT_GestureHelper::CGestureHelper::~CGestureHelper(void)
+	?Cancel@CGestureHelper@RT_GestureHelper@@QAEXXZ @ 2 NONAME ; void RT_GestureHelper::CGestureHelper::Cancel(void)
+	?HandlePointerEventL@CGestureHelper@RT_GestureHelper@@QAEHABUTPointerEvent@@@Z @ 3 NONAME ; int RT_GestureHelper::CGestureHelper::HandlePointerEventL(struct TPointerEvent const &)
+	?IsDoubleTapEnabled@CGestureHelper@RT_GestureHelper@@QBEHXZ @ 4 NONAME ; int RT_GestureHelper::CGestureHelper::IsDoubleTapEnabled(void) const
+	?IsHoldingEnabled@CGestureHelper@RT_GestureHelper@@QBEHXZ @ 5 NONAME ; int RT_GestureHelper::CGestureHelper::IsHoldingEnabled(void) const
+	?NewL@CGestureHelper@RT_GestureHelper@@SAPAV12@AAVMGestureObserver@2@@Z @ 6 NONAME ; class RT_GestureHelper::CGestureHelper * RT_GestureHelper::CGestureHelper::NewL(class RT_GestureHelper::MGestureObserver &)
+	?SetDoubleTapEnabled@CGestureHelper@RT_GestureHelper@@QAEXH@Z @ 7 NONAME ; void RT_GestureHelper::CGestureHelper::SetDoubleTapEnabled(int)
+	?SetHoldingEnabled@CGestureHelper@RT_GestureHelper@@QAEXH@Z @ 8 NONAME ; void RT_GestureHelper::CGestureHelper::SetHoldingEnabled(int)
 
--- a/webengine/webkitutils/rt_gesturehelper/eabi/rt_gesturehelperu.def	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/eabi/rt_gesturehelperu.def	Fri May 08 08:25:06 2009 +0300
@@ -1,30 +1,12 @@
 EXPORTS
-	_ZN16RT_GestureHelper14CGestureHelper11OfferEventLERK9TAlfEvent @ 1 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper17SetHoldingEnabledEi @ 2 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper19HandlePointerEventLERK13TPointerEvent @ 3 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper19SetDoubleTapEnabledEi @ 4 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper25InitAlfredPointerCaptureLER7CAlfEnvR11CAlfDisplayi @ 5 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper4NewLERNS_16MGestureObserverE @ 6 NONAME
-	_ZN16RT_GestureHelper14CGestureHelper6CancelEv @ 7 NONAME
-	_ZN16RT_GestureHelper14CGestureHelperD0Ev @ 8 NONAME
-	_ZN16RT_GestureHelper14CGestureHelperD1Ev @ 9 NONAME
-	_ZN16RT_GestureHelper14CGestureHelperD2Ev @ 10 NONAME
-	_ZN16RT_GestureHelper15CGestureControl10ConstructLERNS_16MGestureObserverER7CAlfEnvR11CAlfDisplayi @ 11 NONAME
-	_ZN16RT_GestureHelper15CGestureControl11OfferEventLERK9TAlfEvent @ 12 NONAME
-	_ZN16RT_GestureHelper15CGestureControl17SetHoldingEnabledEi @ 13 NONAME
-	_ZN16RT_GestureHelper15CGestureControl19SetDoubleTapEnabledEi @ 14 NONAME
-	_ZN16RT_GestureHelper15CGestureControl5NewLCERNS_16MGestureObserverER7CAlfEnvR11CAlfDisplayi @ 15 NONAME
-	_ZN16RT_GestureHelper15CGestureControlC1Ev @ 16 NONAME
-	_ZN16RT_GestureHelper15CGestureControlC2Ev @ 17 NONAME
-	_ZN16RT_GestureHelper15CGestureControlD0Ev @ 18 NONAME
-	_ZN16RT_GestureHelper15CGestureControlD1Ev @ 19 NONAME
-	_ZN16RT_GestureHelper15CGestureControlD2Ev @ 20 NONAME
-	_ZN16RT_GestureHelper7HitTest19VisualByCoordinatesERK11CAlfControlRK6TPoint @ 21 NONAME
-	_ZNK16RT_GestureHelper14CGestureHelper16IsHoldingEnabledEv @ 22 NONAME
-	_ZNK16RT_GestureHelper14CGestureHelper18IsDoubleTapEnabledEv @ 23 NONAME
-	_ZNK16RT_GestureHelper15CGestureControl16IsHoldingEnabledEv @ 24 NONAME
-	_ZNK16RT_GestureHelper15CGestureControl18IsDoubleTapEnabledEv @ 25 NONAME
-	_ZTIN16RT_GestureHelper15CGestureControlE @ 26 NONAME ; #<TI>#
-	_ZTVN16RT_GestureHelper15CGestureControlE @ 27 NONAME ; #<VT>#
-	_ZThn32_N16RT_GestureHelper15CGestureControl11OfferEventLERK9TAlfEvent @ 28 NONAME ; #<thunk>#
+	_ZN16RT_GestureHelper14CGestureHelper17SetHoldingEnabledEi @ 1 NONAME
+	_ZN16RT_GestureHelper14CGestureHelper19HandlePointerEventLERK13TPointerEvent @ 2 NONAME
+	_ZN16RT_GestureHelper14CGestureHelper19SetDoubleTapEnabledEi @ 3 NONAME
+	_ZN16RT_GestureHelper14CGestureHelper4NewLERNS_16MGestureObserverE @ 4 NONAME
+	_ZN16RT_GestureHelper14CGestureHelper6CancelEv @ 5 NONAME
+	_ZN16RT_GestureHelper14CGestureHelperD0Ev @ 6 NONAME
+	_ZN16RT_GestureHelper14CGestureHelperD1Ev @ 7 NONAME
+	_ZN16RT_GestureHelper14CGestureHelperD2Ev @ 8 NONAME
+	_ZNK16RT_GestureHelper14CGestureHelper16IsHoldingEnabledEv @ 9 NONAME
+	_ZNK16RT_GestureHelper14CGestureHelper18IsDoubleTapEnabledEv @ 10 NONAME
 
--- a/webengine/webkitutils/rt_gesturehelper/group/rt_gesturehelper.mmp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/group/rt_gesturehelper.mmp	Fri May 08 08:25:06 2009 +0300
@@ -32,18 +32,14 @@
 SOURCEPATH    ../src
 
 SOURCE        gesture.cpp
-SOURCE        gesturecontrol.cpp
 SOURCE        gesturehelper.cpp
 SOURCE        gesturehelperimpl.cpp
 SOURCE        gesturerecogniser.cpp
-SOURCE        hittest.cpp
 SOURCE        pointarray.cpp
-SOURCE        pointercapturer.cpp
 SOURCE        utils.cpp 
 SOURCE        gestureeventfilter.cpp
 SOURCE        gesturehelpereventsender.cpp
 
-LIBRARY       alfclient.lib
 LIBRARY       avkon.lib
 LIBRARY       cone.lib
 LIBRARY       euser.lib
--- a/webengine/webkitutils/rt_gesturehelper/inc/rt_gesturecontrol.h	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture control
-*
-*/
-
-
-#ifndef _RT_GESTURECONTROL_H_
-#define _RT_GESTURECONTROL_H_
-
-#include <alf/alfcontrol.h>
-
-class CAlfEnv;
-class CAlfDisplay;
-
-namespace RT_GestureHelper
-{
-
-class CGestureHelper;
-class MGestureObserver;
-
-/** 
- * Gesture control provides pointer event forwarding to gesture helper.
- * 
- * Gesture control can be created as
- *  - Stand-alone: This functionality is usable by clients that want to 
- *    capture pointer events from anywhere in the screen. For example, a view 
- *    that wants to know if user tapped anywhere on the screen could use this. 
- *  - Derived: client can use the forward-pointer-events-to-gesture-helper
- *    functionality by deriving from CGestureControl. Client has to create at 
- *    least one visual that captures pointer events. This base class will 
- *    receive the events and forward them to CGestureHelper.
- * 
- * The client can keep other widgets on top of this control, to allow them
- * priority of capturing the pointer events.
- */
-class CGestureControl : public CAlfControl
-    {
-public:
-    /** 
-     * Creates a stand-alone gesture control. 
-     * Creates a full screen visual that captures pointer events. Converts
-     * pointer events to gestures and calls back on aObserver.
-     * @param aFreeControlGroupId control group id that client does not use
-     */
-    IMPORT_C static CGestureControl* NewLC( MGestureObserver& aObserver,
-        CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId );
-    
-    /** Destructor */
-    IMPORT_C ~CGestureControl();
-    
-    // From CAlfControl
-    IMPORT_C TBool OfferEventL( const TAlfEvent& aEvent );
-    
-    /** @see CGestureHelper::SetHoldingEnabled */
-    IMPORT_C void SetHoldingEnabled( TBool aEnabled );
-    /** @see CGestureHelper::IsHoldingEnabled */
-    IMPORT_C TBool IsHoldingEnabled() const;    
-    /** @see CGestureHelper::SetDoubleTapEnabled */
-    IMPORT_C void SetDoubleTapEnabled( TBool aEnabled );
-    /** @see CGestureHelper::IsDoubleTapEnabled */
-    IMPORT_C TBool IsDoubleTapEnabled() const;
-        
-protected:
-    /** Constructor */
-    IMPORT_C CGestureControl();
-    
-    /**
-     * Deriving class is expected to create a visual to receive pointer events.
-     * This base class does not create a visual (unless creates via NewLC, i.e.,
-     * in that case this class is not derived from)
-     * @param aFreeControlGroupId control group id that client does not use
-     */
-    IMPORT_C void ConstructL( MGestureObserver& aObserver,
-        CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId );
-
-private:
-    /// Helper that provides gestures
-    CGestureHelper* iHelper;
-    };
-
-} // namespace RT_GestureHelper
-
-#endif // _RT_GESTURECONTROL_H_
--- a/webengine/webkitutils/rt_gesturehelper/inc/rt_gesturehelper.h	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  RT Gesture helper interface
-*
-*/
-
-
-#ifndef _RT_GESTUREHELPER_H_
-#define _RT_GESTUREHELPER_H_
-
-#include <e32base.h>
-#include <rt_gestureobserver.h>
-
-class CAlfEnv;
-class CAlfDisplay;
-class TAlfEvent;
-struct TPointerEvent;
-
-namespace RT_GestureHelper
-{
-
-class CGestureHelperImpl;
-
-/** 
- * Gesture helper provides functionality to convert a stream of pointer events 
- * into a logical gesture, and to assist clients in calculation of gesture 
- * speed and distance.
- * 
- * Interfaces
- *  - CGestureHelper is a parser of pointer events. Recognises gestures from 
- *    a sequence of pointer events, and converts them to gesture commands. 
- *    For documentation of callbacks, see @ref MGestureObserver. 
- *  - MGestureObserver allows clients to get notified of gestures
- *  - MGestureEvent represents the gesture (event)
- */
-NONSHARABLE_CLASS( CGestureHelper ) : public CBase
-    {
-public:
-    /** 
-     * The helper is expected to be a member variable, hence NewLC is not provided 
-     */
-    IMPORT_C static CGestureHelper* NewL( MGestureObserver& aObserver );
-    
-    /** Destructor */
-    IMPORT_C ~CGestureHelper();
-
-    /**
-     * Specify whether the helper will send hold events. By default, holding is enabled.
-     * "Hold" means user has held stylus/finger on the same position for a longer duration.
-     * 
-     * Clients that require holding to be treated with no special meaning should disable 
-     * holding to simplify their event handling. 
-     * For example, assume the client uses swipe left/right to control navigation, and 
-     * holding is enabled. If user holds, the client gets hold left/right
-     * event, and no swipe event. If user now drags left or right while still pressing 
-     * stylus down, the client will not get a swipe event (since it already received a hold
-     * event). Upon release event, the client no reliable way of knowing whether the 
-     * user swiped left/right or cancelled the swipe. This problem is removed if the
-     * client simply disables holding. In the above scenario while holding disabled,
-     * the client would get only swipe events (and released event).
-     * (Swipe can be cancelled by dragging towards, but not beyond, the starting position.) 
-     */
-    IMPORT_C void SetHoldingEnabled( TBool aEnabled );
-    
-    /**
-     * @return whether sending hold events is currently enabled
-     * ("Hold" means user has held stylus/finger on the same position for a longer duration.)
-     */
-    IMPORT_C TBool IsHoldingEnabled() const;
-    
-    /**
-     * Enables/disables double tap support. Double tap is disabled by default.
-     * When double tap is disabled, gesture helper emits tap events immediately when
-     * user lifts stylus/finger. 
-     * When double tap is enabled, tap events are emitted after the double tap timeout passes. 
-     * The timeout is the maximum time within which the second tap will be treated 
-     * as a double tap. That is, there is a delay (sluggishness) before client receives 
-     * the tap event when double tap is enabled. 
-     * tap + timeout => tap event emitted after timeout
-     * tap + tap before timeout => double tap event emitted immediately after the second tap
-     * tap + swipe => tap + swipe events
-     * (tap + timeout + tap + timeout => two tap events)
-     */
-    IMPORT_C void SetDoubleTapEnabled( TBool aEnabled );
-
-    /**
-     * @return whether double tap is currently enabled. See SetDoubleTapEnabled
-     */
-    IMPORT_C TBool IsDoubleTapEnabled() const;
-    
-    /** 
-     * Initialise pointer capture for Alfred 
-     * This means that helper will receive drag events and pointer events that 
-     * go outside the original visual area
-     */
-    IMPORT_C void InitAlfredPointerCaptureL( CAlfEnv& aEnv, CAlfDisplay& aDisplay,
-        TInt aFreeControlGroupId );
-    
-    /** 
-     * Give a pointer event to the helper, to form a part of a gesture
-     * For AVKON-based client, this interface is the only option.
-     * Alfred-based client should use OfferEventL, as it allows gesture events to
-     * provider the visual on which the pointer event started.
-     * @param aEvent pointer event
-     * @return whether event was consumed or not
-     *         EFalse the event is not a pointer events and if pointer up/drag 
-     *				  event received without pointer down event
-     *         ETrue in all the other cases of pointer event 
-     */
-    IMPORT_C TBool HandlePointerEventL( const TPointerEvent& aEvent );
-    
-    /**
-     * Offer an Alf event. See HandlePointerEventL.
-     * @return whether event was consumed or not
-     *         EFalse the event is not a pointer events and if pointer up/drag 
-     *				  event received without pointer down event
-     *         ETrue in all the other cases of pointer event 
-     */
-    IMPORT_C TBool OfferEventL( const TAlfEvent& aEvent );
-    
-    /** 
-     * Cancel ongoing recognision. Purges all pointer events given earlier, and
-     * starts afresh. It is not necessary to call Cancel before deleting the object.
-     */
-    IMPORT_C void Cancel();
-        
-private:
-    /// interface implementation
-    CGestureHelperImpl* iImpl;
-    };
-
-} // namespace RT_GestureHelper
-
-#endif // _RT_GESTUREHELPER_H_
--- a/webengine/webkitutils/rt_gesturehelper/inc/rt_gestureobserver.h	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  RT Gesture helper interface
-*
-*/
-
-
-#ifndef _RT_GESTUREOBSERVER_H_
-#define _RT_GESTUREOBSERVER_H_
-
-#include <e32std.h>
-
-class CAlfControl;
-class CAlfVisual;
-
-namespace RT_GestureHelper
-{
-
-/// flag that indicates gesture code is a holding code
-/// clients should use MGestureEvent::IsHolding
-const TInt EFlagHold       = 0x10000000;
-
-enum TGestureCode
-    {
-    // states
-    EGestureStart          = 0x00000001, // gesture just started (user pressed stylus down)
-    EGestureDrag           = 0x00000002, // user moved stylus (may be holding or not holding)
-    EGestureReleased       = 0x00000003, // user lifted stylus while user was holding
-    // gestures
-    EGestureUnknown        = 0x00000005, // gesture was not recognised
-    // these codes are sent when user lifts stylus (if holding not started)
-    EGestureTap            = 0x00000006,
-    EGestureDoubleTap      = 0x00000007, // only if double tap is enabled 
-                                         // (via CGestureHelper::SetDoubleTapEnabled or
-                                         // CGestureControl::SetDoubleTapEnabled)
-    EGestureSwipeLeft      = 0x00000008,
-    EGestureSwipeRight     = 0x00000009,
-    EGestureSwipeUp        = 0x0000000A,
-    EGestureSwipeDown      = 0x0000000B,
-    
-    EGestureFlick          = 0x0000000C,
-    EGestureLongTap        = 0x0000000D,
-    EGestureDrop           = 0x0000000E,
-        
-    // these codes are sent when user initiates holding by keeping stylus in
-    // same place for a longer duration
-    EGestureHoldLeft       = EGestureSwipeLeft  | EFlagHold,
-    EGestureHoldRight      = EGestureSwipeRight | EFlagHold,
-    EGestureHoldUp         = EGestureSwipeUp    | EFlagHold,
-    EGestureHoldDown       = EGestureSwipeDown  | EFlagHold
-    };
-
-/**
- * Point of float accuracy
- */
-NONSHARABLE_STRUCT( TRealPoint )
-    {
-    inline TRealPoint();
-    inline TRealPoint( const TRealPoint& aPoint );
-    inline TRealPoint( TReal aX, TReal aY );
-    inline TBool operator==( const TRealPoint& aPoint ) const;
-
-    TReal32 iX;
-    TReal32 iY;
-    };
-
-/**
- * a gesture event
- */
-class MGestureEvent
-    {
-public:
-    /** X and Y axes, or both */
-    enum TAxis
-        {
-        EAxisBoth,
-        EAxisHorizontal,
-        EAxisVertical
-        };
-
-public:
-    /**
-     * @param aRelevantAxis indicates whether only x, y or both coordinates 
-     *        should be considered when determining the code. For example,
-     *        if client specifies EAxisVertical as relevant axis, a swipe
-     *        to left and slightly up would result in an "swipe up" code,
-     *        and not "swipe left" code. If client specifies EAxisHorizontal
-     *        or EAxisBoth, "swipe left" code is returned.
-     * @return gesture code
-     */
-    virtual TGestureCode Code( TAxis aRelevantAxis ) /* const */ = 0;
-    
-    /** 
-     * @return ETrue if user has activated holding 
-     *         (by keeping stylus in the same position for longer time)
-     *         EFalse if holding has not been activated
-     */
-    virtual TBool IsHolding() const = 0;
-    
-    /** 
-     * @return position where gesture started, i.e., where stulys 
-     * was pressed down 
-     */
-    virtual TPoint StartPos() const = 0;
-    
-    /** 
-     * @return current position of the stylus
-     */
-    virtual TPoint CurrentPos() const = 0; 
-    
-    /** 
-     * @return speed of a swipe. unit is pixels per second.
-     */
-    virtual TRealPoint Speed() const = 0;
-    
-    /**
-     * Abstracts the algorithm to calculate speed during swipe and hold. This
-     * algorithm (currently) assumes that max speed is achieved at the edges of an
-     * area.
-     * @param aEdges represents the coordinates of the rectange on which speed is 
-     *               calculated. Speed will reach maximum if stylus is on the edge 
-     *               or beyond the rect. In practise, the value should match the
-     *               area of the layout that contains the scrollable visuals.
-     *               For example, if the control area is the whole screen, the
-     *               rect should be the screen rect.
-     * @returns the speed as a percentage between -100% and 100%
-     */
-    virtual TRealPoint SpeedPercent( const TRect& aEdges ) const = 0;
-    
-    /** 
-     * @return Length of gesture from starting position
-     *         (start pos - current pos)
-     */
-    virtual TPoint Distance() const = 0; 
-    
-    /**
-     * @return visual on which the gesture started
-     *         NULL if not known (e.g., AVKON-based client 
-     */
-    virtual CAlfVisual* Visual() const = 0;
-    };
-    
-/** 
- * Observer that will be notified when user makes gestures
- */
-class MGestureObserver
-    {
-public:
-    /**
-     * Handle the gesture event
-     * @param aEvent event describing the gesture 
-     */
-    virtual void HandleGestureL( const MGestureEvent& aEvent ) = 0;
-    };
-
-/** 
- * static class for finding a visual from a visual tree
- */
-class HitTest
-    {
-public:
-    /** 
-     * @return the leaf-most visual is under aPos, or NULL if not found
-     */
-    IMPORT_C static CAlfVisual* VisualByCoordinates( const CAlfControl& aControl, 
-        const TPoint& aPos );
-    };
-    
-// ----------------------------------------------------------------------------
-// Default constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TRealPoint::TRealPoint()
-        : iX( 0 ), iY( 0 )
-    {    
-    }
-
-// ----------------------------------------------------------------------------
-// Copy constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TRealPoint::TRealPoint( const TRealPoint& aPoint )
-        : iX( aPoint.iX ), iY( aPoint.iY )
-    {    
-    }
-
-// ----------------------------------------------------------------------------
-// Copy constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TRealPoint::TRealPoint( TReal aX, TReal aY )
-        : iX( aX ), iY( aY )
-    {    
-    }
-
-// ----------------------------------------------------------------------------
-// Default constructor for real point
-// ----------------------------------------------------------------------------
-//
-inline TBool TRealPoint::operator==( const TRealPoint& aPoint ) const
-    {    
-    return iX == aPoint.iX && iY == aPoint.iY;
-    }
-
-    
-} // namespace RT_GestureHelper
-
-#endif // _RT_GESTUREOBSERVER_H_
--- a/webengine/webkitutils/rt_gesturehelper/src/gesture.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/src/gesture.cpp	Fri May 08 08:25:06 2009 +0300
@@ -73,7 +73,7 @@
      * @return gesture code by analysing the sequence of points
      */
     TGestureCode CodeFromPoints( const RArray< TPointEntry >& aPoints, 
-            MGestureEvent::TAxis aRelevantAxis ) 
+                                 TAxis aRelevantAxis ) 
         {
         // select the correct filter based on aRelevantAxis
         // these filter_ objects are array decorators that will eliminate either 
@@ -82,8 +82,8 @@
         TYAxisPointArray filterX( aPoints );
         TPointArray filterNone( aPoints );
         TPointArray& filter = 
-            aRelevantAxis == MGestureEvent::EAxisHorizontal ? static_cast< TPointArray& >( filterY ) : 
-            aRelevantAxis == MGestureEvent::EAxisVertical   ? static_cast< TPointArray& >( filterX ) :
+            aRelevantAxis == EAxisHorizontal ? static_cast< TPointArray& >( filterY ) : 
+            aRelevantAxis == EAxisVertical   ? static_cast< TPointArray& >( filterX ) :
             /* otherwise EAxisBoth */                         filterNone;
                             
         // currently the gesture recogniser does not have any state, so it is fast
@@ -126,7 +126,6 @@
     iHoldingState = ENotHolding;
     iState = ENotComplete;
     iHoldingPointIndex = 0;
-    iVisual = NULL;
     iIsDoubleTap = EFalse;
     iIsLongTap = EFalse;
     }
@@ -157,10 +156,7 @@
 // SetVisual
 // ----------------------------------------------------------------------------
 //
-void CGesture::SetVisual( CAlfVisual* aVisual )
-    {
-    iVisual = aVisual;
-    }
+
 
 // ----------------------------------------------------------------------------
 // IsNearHoldingPoint
@@ -273,7 +269,7 @@
 //
 TBool CGesture::IsTap() const
     {
-    return CodeFromPoints( iPoints, MGestureEvent::EAxisBoth ) == EGestureTap;
+    return CodeFromPoints( iPoints, EAxisBoth ) == EGestureTap;
     }
 
 /**
@@ -297,7 +293,7 @@
 // Code
 // ----------------------------------------------------------------------------
 //
-TGestureCode CGesture::Code( MGestureEvent::TAxis aRelevantAxis ) /* const */
+TGestureCode CGesture::Code( TAxis aRelevantAxis ) /* const */
     {
     TGestureCode code;
     
@@ -686,10 +682,6 @@
 // Visual
 // ----------------------------------------------------------------------------
 //
-CAlfVisual* CGesture::Visual() const
-    {
-    return iVisual;
-    }
 
 // ----------------------------------------------------------------------------
 // TimeFromPreviousPoint
--- a/webengine/webkitutils/rt_gesturehelper/src/gesture.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/src/gesture.h	Fri May 08 08:25:06 2009 +0300
@@ -74,7 +74,6 @@
     TInt AddPoint( const TPoint& aPoint, const TTime& eventtime);
     
     /** Set the visual of this gesture. Should be called when gesture starts */
-    void SetVisual( CAlfVisual* aVisual );
     
     /** @return ETrue if the point is very near the holding point */
     TBool IsNearHoldingPoint( const TPoint& aPoint ) const;
@@ -115,14 +114,13 @@
 // From MGestureEvent
     TTime TimeOfLastEntry() const;
     inline TGestureCode PreviousGestureCode() { return iPrevGestureCode; };
-    TGestureCode Code( MGestureEvent::TAxis aRelevantAxis );
+    TGestureCode Code( TAxis aRelevantAxis );
     TBool IsHolding() const;
     TPoint StartPos() const;
     TPoint CurrentPos() const; 
     TRealPoint Speed() const;
     TRealPoint SpeedPercent( const TRect& aEdges ) const;
     TPoint Distance() const; 
-    CAlfVisual* Visual() const;
     
     
     
@@ -186,7 +184,6 @@
     TTime iCompletionTime;
     
     /// visual relevant to this gesture. null if not known.
-    CAlfVisual* iVisual;
     
     TGestureCode iPrevGestureCode;
     
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturecontrol.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,118 +0,0 @@
-/*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture control
-*
-*/
-
-
-// class include
-#include "rt_gesturecontrol.h"
-
-// system includes
-#include <alf/alfevent.h>
-
-// local includes
-#include "rt_gesturehelper.h"
-
-using namespace RT_GestureHelper;
-
-// ----------------------------------------------------------------------------
-// Two-phase constructor
-// ----------------------------------------------------------------------------
-//
-EXPORT_C CGestureControl* CGestureControl::NewLC( MGestureObserver& aObserver,
-        CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId )
-    {
-    CGestureControl* self = new ( ELeave ) CGestureControl;
-    CleanupStack::PushL( self );
-    self->ConstructL( aObserver, aEnv, aDisplay, aFreeControlGroupId );
-    // create a full screen visual to capture pointer events anywhere on screen
-    self->AppendVisualL( EAlfVisualTypeVisual );
-    return self;
-    }
-
-// ----------------------------------------------------------------------------
-// Constructor
-// ----------------------------------------------------------------------------
-//
-EXPORT_C CGestureControl::CGestureControl()
-    {
-    // do nothing
-    }
-
-// ----------------------------------------------------------------------------
-// Second-phase constructor
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CGestureControl::ConstructL( MGestureObserver& aObserver,
-        CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aFreeControlGroupId )
-    {
-    CAlfControl::ConstructL( aEnv );
-    iHelper = CGestureHelper::NewL( aObserver );
-    iHelper->InitAlfredPointerCaptureL( aEnv, aDisplay, aFreeControlGroupId );
-    }
-
-// ----------------------------------------------------------------------------
-// Destructor
-// ----------------------------------------------------------------------------
-//
-EXPORT_C CGestureControl::~CGestureControl()
-    {
-    delete iHelper;
-    }
-
-// ----------------------------------------------------------------------------
-// OfferEventL
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CGestureControl::OfferEventL( const TAlfEvent& aEvent )
-    {
-    return iHelper->OfferEventL( aEvent );
-    }
-
-// ----------------------------------------------------------------------------
-// SetHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CGestureControl::SetHoldingEnabled( TBool aEnabled )
-    {
-    iHelper->SetHoldingEnabled( aEnabled );
-    }
-
-// ----------------------------------------------------------------------------
-// IsHoldingEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CGestureControl::IsHoldingEnabled() const
-    {
-    return iHelper->IsHoldingEnabled();
-    }
-
-// ----------------------------------------------------------------------------
-// SetDoubleTapEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CGestureControl::SetDoubleTapEnabled( TBool aEnabled )
-    {
-    iHelper->SetDoubleTapEnabled( aEnabled );
-    }
-
-// ----------------------------------------------------------------------------
-// IsDoubleTapEnabled
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CGestureControl::IsDoubleTapEnabled() const
-    {
-    return iHelper->IsDoubleTapEnabled();
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelper.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/src/gesturehelper.cpp	Fri May 08 08:25:06 2009 +0300
@@ -82,15 +82,8 @@
     return iImpl->IsDoubleTapEnabled();
     }
     
-// ----------------------------------------------------------------------------
-// InitAlfredPointerEventCaptureL
-// ----------------------------------------------------------------------------
-//
-EXPORT_C void CGestureHelper::InitAlfredPointerCaptureL( CAlfEnv& aEnv, 
-        CAlfDisplay& aDisplay, TInt aFreeControlGroupId )
-    {
-    iImpl->InitAlfredPointerCaptureL( aEnv, aDisplay, aFreeControlGroupId );
-    }
+
+
 
 // ----------------------------------------------------------------------------
 // HandlePointerEventL
@@ -101,14 +94,9 @@
     return iImpl->HandlePointerEventL( aEvent );
     }
 
-// ----------------------------------------------------------------------------
-// OfferEventL
-// ----------------------------------------------------------------------------
-//
-EXPORT_C TBool CGestureHelper::OfferEventL( const TAlfEvent& aEvent )
-    {
-    return iImpl->OfferEventL( aEvent );
-    }
+
+
+
 
 // ----------------------------------------------------------------------------
 // Cancel
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.cpp	Fri May 08 08:25:06 2009 +0300
@@ -17,7 +17,6 @@
 
 #include "gesturehelpereventsender.h"
 #include "gesture.h"
-#include "gestureevent.h"
 
 using namespace RT_GestureHelper;
 
@@ -39,11 +38,15 @@
 
 CGestureEventSender::~CGestureEventSender()
     {
+    if (IsActive()) 
+        {
+        Cancel();
+        }
+
     iEvents.Close();
-    iEvents.ResetAndDestroy();
     }
 
-TInt CGestureEventSender::AddEvent(const CGestureEvent* aGestureEvent)
+TInt CGestureEventSender::AddEvent(const TGestureEvent& aGestureEvent)
     {
     iEvents.Append(aGestureEvent);
     if (iState != EBusy)
@@ -65,7 +68,6 @@
     SetActive();
     }
 
-
 void CGestureEventSender::RunL()
     {
     switch (iState)
@@ -77,9 +79,8 @@
                 TInt count = iEvents.Count();
                 for (int i = 0;  i < count; i++)
                     {
-                    CGestureEvent* gst = iEvents[i];
-                    EmitEventL(*gst);
-                    delete gst;
+                    TGestureEvent& gst = iEvents[i];
+                    EmitEventL(gst);
                     }
                 }
             iEvents.Reset();
@@ -90,8 +91,7 @@
         }
     }
 
-
-void CGestureEventSender::EmitEventL( const CGestureEvent& aGesture )
+void CGestureEventSender::EmitEventL( const TGestureEvent& aGesture )
     {
     iState = EBusy;
     iObserver.HandleGestureL(aGesture);
@@ -100,6 +100,7 @@
 
 TInt CGestureEventSender::RunError(TInt aError)
     {
+    iEvents.Reset();
     return aError;
     }
 
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/src/gesturehelpereventsender.h	Fri May 08 08:25:06 2009 +0300
@@ -38,7 +38,7 @@
         };
     static CGestureEventSender* NewL( MGestureObserver& aObserver );
     ~CGestureEventSender();
-    TInt AddEvent(const CGestureEvent* aGestureEvent);
+    TInt AddEvent(const TGestureEvent& aGestureEvent);
 protected:    
     void RunL();
     void DoCancel();
@@ -46,9 +46,9 @@
 private:
     CGestureEventSender(MGestureObserver& aObserver);
     void Complete();
-    void EmitEventL( const CGestureEvent& aGestureEvent );
+    void EmitEventL( const TGestureEvent& aGestureEvent );
     
-    RPointerArray< CGestureEvent >  iEvents;
+    RArray< TGestureEvent >  iEvents;
     MGestureObserver& iObserver;
     TEventSenderState iState;
     };
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.cpp	Fri May 08 08:25:06 2009 +0300
@@ -18,18 +18,15 @@
 
 #include "gesturehelperimpl.h"
 
-#include <alf/alfevent.h>
 #include <e32base.h>
 #include <w32std.h>
 
 #include "gesture.h"
 #include "gesturedefs.h"
 #include "utils.h"
-#include "pointercapturer.h"
 #include "gestureeventfilter.h"
 #include "gesturehelpereventsender.h"
 #include "flogger.h"
-#include "gestureevent.h"
 
 using namespace RT_GestureHelper;
 
@@ -128,7 +125,7 @@
     // and because the (Alfred) drag events are not local to visual even when
     // coming from the client
     
-    return aEvent.iParentPosition;
+    return aEvent.iPosition;
     }
 
 // ----------------------------------------------------------------------------
@@ -140,14 +137,14 @@
     CGestureHelperImpl* self = new ( ELeave ) CGestureHelperImpl( aObserver );
     CleanupStack::PushL( self );
     self->iEventSender = CGestureEventSender::NewL( aObserver );
-    self->iDoubleTapTimer = CCallbackTimer::NewL( *self, EmitFirstTapEventL, 
+    self->iDoubleTapTimer = CCallbackTimer::NewL( *self, EmitFirstTapEvent, 
             KMaxTapDuration, EFalse ); // double tap is disabled by default
     self->iHoldingTimer = CCallbackTimer::NewL( *self, StartHoldingL, 
         KHoldDuration, EFalse ); // holding is enabled by default
     
-    self->iLongTouchTimer = CCallbackTimer::NewL( *self, HandleLongTouchL, 
+    self->iLongTouchTimer = CCallbackTimer::NewL( *self, HandleLongTouch, 
             KLongTapDuration, ETrue ); // holding is enabled by default
-    self->iPointerCapturer = CPointerCapturer::NewL();    
+    
     self->iGesture = new ( ELeave ) CGesture();
     self->iUnusedGesture = new ( ELeave ) CGesture();
     TInt tapLimit = Mm2Pixels(KFingerSize_mm) / 2;
@@ -176,7 +173,6 @@
     delete iGesture;
     delete iPreviousTapGesture;
     delete iUnusedGesture;
-    delete iPointerCapturer;
     delete iLongTouchTimer;
     delete iEventFilter;
     delete iEventSender;
@@ -219,15 +215,7 @@
     return iDoubleTapTimer->IsEnabled();
     }
     
-// ----------------------------------------------------------------------------
-// InitAlfredPointerEventCaptureL
-// ----------------------------------------------------------------------------
-//
-void CGestureHelperImpl::InitAlfredPointerCaptureL( CAlfEnv& aEnv, 
-        CAlfDisplay& aDisplay, TInt aFreeControlGroupId )
-    {
-    iPointerCapturer->InitForAlfredL(*this, aEnv, aDisplay, aFreeControlGroupId );
-    }
+
 
 // ----------------------------------------------------------------------------
 // Reset state
@@ -238,7 +226,6 @@
     iHoldingTimer->Cancel();
     iLongTouchTimer->Cancel();
     iGesture->Reset();
-    iPointerCapturer->Stop();
     }
 
 /** 
@@ -259,7 +246,6 @@
     SetLastEventTime();
     if (!iEventFilter->FilterDrag(aEvent, iLastEventTime, filterReason))
         {
-        iGesture->SetVisual( NULL );
         return noneAlf_HandlePointerEventL( aEvent );
         }
     else
@@ -275,39 +261,13 @@
         }
     }
 
-// ----------------------------------------------------------------------------
-// OfferEventL
-// ----------------------------------------------------------------------------
-//
-TBool CGestureHelperImpl::OfferEventL( const TAlfEvent& aEvent )
-    {
-    if ( aEvent.IsPointerEvent() )
-        {
-        return HandlePointerEventL( aEvent.PointerEvent(), aEvent.Visual() );
-        }
-    return EFalse;
-    }
-
-
-
-
-
-
-// ----------------------------------------------------------------------------
-// Handle a pointer event
-// ----------------------------------------------------------------------------
-//
-
 
 TBool CGestureHelperImpl::noneAlf_HandlePointerEventL( const TPointerEvent& aEvent)
     {
-    
     switch ( aEvent.iType )
         {
         case TPointerEvent::EButton1Down:
             {
-            
-            iPointerCapturer->StartL();
             HandleTouchDownL(aEvent);
             break;
             }
@@ -318,16 +278,15 @@
             }
         case TPointerEvent::EButton1Up:
             {
-            CleanupStack::PushL( TCleanupItem( &ResetHelper, this ) );
             if (KErrNone == AddPoint( aEvent ))
                 {
-                HandleTouchUpL(aEvent);
+                HandleTouchUp(aEvent);
                 }
             else
                 {
-                EmitCancelEventL();
+                EmitCancelEvent();
                 }
-            CleanupStack::PopAndDestroy( this ); 
+            Reset();
             break;
             }
         default:
@@ -336,162 +295,19 @@
     return ETrue;
     }
 
-
-TBool CGestureHelperImpl::HandlePointerEventL( const TPointerEvent& aEvent,
-        CAlfVisual* aVisual )
-    {  
-    // filter out events that do not start with button down. It is a stray
-    // event from another visual
-    if ( IsIdle() && aEvent.iType != TPointerEvent::EButton1Down )
-        {
-        return EFalse; // don't consume
-        }
-    
-    switch ( aEvent.iType )
-        {
-        case TPointerEvent::EButton1Down:
-            // If no up event was received during previous gesture, cancel 
-            // previous event and reset state
-            if ( !IsIdle() )
-                {
-                // ambiguous what is the right thing when "cancel" event leaves
-                // and "start" does not. Leaving for cancel *after* "start" could 
-                // be unexpected to client, as client would have handled start 
-                // event successfully. Assume that leaving upon cancellation 
-                // can be ignored.
-                TRAP_IGNORE( EmitCancelEventL() );
-                Reset();  
-                }
-            // as long as down event of a double tap comes within the double 
-            // tap timeout, it does not matter how long the user keeps the finger
-            // pressed for the gesture to be a double tap. Therefore, cancel
-            // the timeout, as it is no longer relevant. (Of course, this call
-            // will only do something if the timer is actually running, which
-            // is only if received a tap event very recently.)
-            iDoubleTapTimer->Cancel();
-            // adding the first point implicitly makes the state "not idle"
-            AddPointL( aEvent );
-            iGesture->SetVisual( aVisual );
-            // if pointer capturer leaves, the remaining pointer events will
-            // not be captured if stylus is dragged outside the capturing visual
-            // an error note will be shown, so the potential problem is irrelevant,
-            // assuming client does not (incorrectly) block the leave from reaching 
-            // the framework
-            iPointerCapturer->StartL();
-            // Delay emitting a down event _until_ it is known that this beginning 
-            // gesture is _not_ the second tap of a double tap event.
-            // iPreviousTapGesture is only non-null if very recently received 
-            // a tap event and double tap is enabled. 
-            if ( !iPreviousTapGesture )
-                {
-                EmitEventL( *iGesture );
-                }
-            // else delay emitting an event, as it might be a double tap 
-            // (allow the second tap of a double tap to be anywhere, so don't check
-            // for start pos here)
-            break;
-            
-        case TPointerEvent::EDrag:
-            // While stylus down, the same event is received repeatedly
-            // even if stylus does not move. Filter out by checking if point 
-            // is the same as the latest point
-            if ( !iGesture->IsLatestPoint( Position( aEvent ) ) )
-                {
-                AddPointL( aEvent );
-
-                // as long as the starting gesture is seen as a tap, do not emit any
-                // drag events
-                if ( !iGesture->IsTap() )
-                    {
-                    // if there is a previous tap gesture, getting drag events means that
-                    // the previous gesture is not a double tap. So emit the previous gesture.
-                    if ( iPreviousTapGesture )
-                        {
-                        // this is a second gesture after a tap (double tap is enabled)
-                        EmitFirstTapEventL();
-                        // emit down event for the current gesture (since its down was delayed, until
-                        // it was to be known if the event is a tap. That is known now.)
-                        EmitStartEventL( *iGesture );
-                        }
-                    // restart holding timer every time the current stylus pos changes
-                    StartHoldingTimer( aEvent );
-                    // emit the drag event to client
-                    EmitEventL( *iGesture );
-                    }
-                // else: do not emit drag events until it is known that the gesture is not a tap
-                // (or the second tap of double tap)
-                }
-            break;
-
-        case TPointerEvent::EButton1Up:
-            // reset in case the down event for next gesture is not received for a reason 
-            // in client, and instead drag or up events are received. 
-            // reset via cleanup stack to ensure Reset is run even if
-            // observer leaves
-            CleanupStack::PushL( TCleanupItem( &ResetHelper, this ) );
-            // if adding of the point fails, notify client with a 
-            // cancelled event. It would be wrong to send another
-            // gesture code when the up point is not known
-            if ( KErrNone == AddPoint( aEvent ) )
-                {
-                
-                // if the gesture is a tap, the gesture is either the first tap of a _potential_
-                // double tap, or the second tap of a double tap
-                if ( iDoubleTapTimer->IsEnabled() && iGesture->IsTap() )
-                    {
-                    __ASSERT_DEBUG( !iGesture->IsHolding(), Panic( EGesturePanicIllegalLogic ) );
-                    if ( !iPreviousTapGesture )
-                        {
-                        // First tap. Delay emitting its code evemt and released events until it is known
-                        // whether the tap is a double tap
-                        iPreviousTapGesture = iGesture;
-                        iGesture = NewGesture();
-                        iDoubleTapTimer->Start(); 
-                        }
-                    else
-                        {
-                        // This is a second tap of a double tap. Do not emit anything for the second
-                        // tap. Only down event has been emitted for the first tap. Emit the code 
-                        // event (double tap) and released for the first tap.
-                        iPreviousTapGesture->SetDoubleTap();
-                        EmitFirstTapEventL();
-                        }
-                    }
-                
-                else 
-                    {
-                    // modified iGesture to be "released"
-                    CompleteAndEmitL( *iGesture );
-                    }
-                }
-            else
-                { // adding a point failed
-                EmitCancelEventL();
-                }
-            // reset state
-            CleanupStack::PopAndDestroy( this ); 
-            break;
-            
-        default:
-            break;
-        }
-    return ETrue; // consume
-    }
-
-
 TBool CGestureHelperImpl::IsMovementGesture(TGestureCode aCode)
     {
     return (aCode == EGestureDrag || aCode == EGestureFlick || aCode == EGestureSwipeUp ||
             aCode == EGestureSwipeDown || aCode == EGestureSwipeRight || aCode == EGestureSwipeLeft);
     }
 
-void CGestureHelperImpl::HandleLongTouchL()
+void CGestureHelperImpl::HandleLongTouch()
     {
     iDoubleTapTimer->Cancel();
     iGesture->SetLongTap(ETrue);
     iGesture->SetComplete();
     TPoint startPos = iGesture->StartPos();
-    EmitEventL(*iGesture);
+    EmitEvent(*iGesture);
     iGesture->Reset();
     iGesture->AddPoint( startPos, GetLastEventTime() );
     }
@@ -500,18 +316,25 @@
     {
     TGestureCode prevCode = iGesture->PreviousGestureCode();
     if (prevCode == EGestureStart) return;
+    if (prevCode == EGestureDrag) 
+        {
+        iGesture->Reset();
+        }
     AddPointL( aEvent );
     
+    if (!iLongTouchTimer->IsActive())
+        {
     iLongTouchTimer->Start();
+        }
     if (!iDoubleTapTimer->IsActive())
         {
-            EmitEventL( *iGesture );
+            EmitEvent( *iGesture );
         }
     }
 
 void CGestureHelperImpl::HandleMoveL(const TPointerEvent& aEvent)
     {
-    if (iGesture->IsLatestPoint( iGesture->Visual() ? Position ( aEvent ) : aEvent.iPosition)) return; // I'm not sure we need this
+    if (iGesture->IsLatestPoint( Position(aEvent))) return; // I'm not sure we need this
     //Cancel double tap time - it's neither tap nor double tap 
     iDoubleTapTimer->Cancel();
     iLongTouchTimer->Cancel();
@@ -527,11 +350,11 @@
     
     if (!isFirstPoint)
         {
-        EmitEventL( *iGesture );
+        EmitEvent( *iGesture );
         }
     }
 
-void CGestureHelperImpl::HandleTouchUpL(const TPointerEvent& /*aEvent*/)
+void CGestureHelperImpl::HandleTouchUp(const TPointerEvent& /*aEvent*/)
     {
     TGestureCode prevCode = iGesture->PreviousGestureCode();
     iLongTouchTimer->Cancel();
@@ -547,13 +370,13 @@
     */
     if ( prevCode == EGestureLongTap )
         {
-        EmitReleasedEventL();
+        EmitReleasedEvent();
         }
     else if (IsMovementGesture(prevCode) || 
              !iDoubleTapTimer->IsEnabled() /* || !iGesture->IsTap()*/ ) 
         {
         iGesture->SetComplete();
-        EmitEventL(*iGesture);
+        EmitEvent(*iGesture);
         }
     
     else 
@@ -566,7 +389,7 @@
             // it's a double tap
             iLastTouchUpTime = iLastEventTime;
             iLastDoubleTapTime = iLastEventTime;
-            EmitDoubleTapEventL();
+            EmitDoubleTapEvent();
             }
         else
             {
@@ -586,18 +409,18 @@
 
 
 
-void CGestureHelperImpl::EmitDoubleTapEventL()
+void CGestureHelperImpl::EmitDoubleTapEvent()
     {
     iPreviousTapGesture->SetDoubleTap();
-    EmitFirstTapEventL();
+    EmitFirstTapEvent();
     }
 
 
-void CGestureHelperImpl::EmitReleasedEventL()
+void CGestureHelperImpl::EmitReleasedEvent()
     {
     iGesture->SetComplete();
     iGesture->SetReleased();
-    EmitEventL(*iGesture);
+    EmitEvent(*iGesture);
     }
 
 
@@ -628,7 +451,7 @@
 //
 inline TInt CGestureHelperImpl::AddPoint( const TPointerEvent& aEvent )
     {
-    TPoint pos = iGesture->Visual() ? Position ( aEvent ) : aEvent.iPosition;
+    TPoint pos = Position ( aEvent );
     return iGesture->AddPoint( pos, GetLastEventTime() );
     }
 
@@ -679,7 +502,7 @@
     // otherwise, the holding gesture code will be sent twice
     CleanupStack::PushL( TCleanupItem( &ContinueHolding, iGesture ) );
     
-    EmitEventL( *iGesture );
+    EmitEvent( *iGesture );
     
     // set holding state to "post holding"
     CleanupStack::PopAndDestroy( iGesture );
@@ -699,21 +522,16 @@
 // Emit the remainder of the previous tap event (tap + released)
 // ----------------------------------------------------------------------------
 //
-void CGestureHelperImpl::EmitFirstTapEventL()
+void CGestureHelperImpl::EmitFirstTapEvent()
     {
     // when this function is called, a tap has turned out to _not_ be a double tap
     __ASSERT_DEBUG( IsDoubleTapEnabled(), Panic( EGesturePanicIllegalLogic ) );
     __ASSERT_DEBUG( iPreviousTapGesture, Panic( EGesturePanicIllegalLogic ) );
     
     iDoubleTapTimer->Cancel();
-    
-    // ensure previous tap gesture is reset even if client leaves
-    CleanupStack::PushL( TCleanupItem( &RecyclePreviousTapGesture, this ) );
-    
-    CompleteAndEmitL( *iPreviousTapGesture );
-    
-    // recycle the emitted gesture 
-    CleanupStack::PopAndDestroy( this ); 
+    CompleteAndEmit( *iPreviousTapGesture );
+    RecycleGesture(iPreviousTapGesture);
+     
     }
 
 // ----------------------------------------------------------------------------
@@ -723,7 +541,7 @@
 void CGestureHelperImpl::EmitStartEventL( const CGesture& aGesture )    
     {
     CGesture* startGesture = aGesture.AsStartEventLC();
-    EmitEventL( *startGesture );
+    EmitEvent( *startGesture );
     CleanupStack::PopAndDestroy( startGesture );    
     }
     
@@ -731,7 +549,7 @@
 // EmitCompletionEventsL
 // ----------------------------------------------------------------------------
 //
-void CGestureHelperImpl::CompleteAndEmitL( CGesture& aGesture )
+void CGestureHelperImpl::CompleteAndEmit( CGesture& aGesture )
     {
     aGesture.SetComplete();
     // send gesture code if holding has not been started. If holding has 
@@ -741,48 +559,44 @@
         {
         // if client leaves, the state is automatically reset.
         // In this case the client will not get the released event
-        EmitEventL( aGesture ); 
+        EmitEvent( aGesture ); 
         }
     
     // send an event that stylus was lifted
     aGesture.SetReleased();
-    EmitEventL( aGesture ); 
+    EmitEvent( aGesture ); 
     }
     
 // ----------------------------------------------------------------------------
 // EmitCancelEventL
 // ----------------------------------------------------------------------------
 //
-void CGestureHelperImpl::EmitCancelEventL()
+void CGestureHelperImpl::EmitCancelEvent()
     {
     iDoubleTapTimer->Cancel();
 
-    // ensure previous tap gesture is reset even if client leaves
-    CleanupStack::PushL( TCleanupItem( &RecyclePreviousTapGesture, this ) );
-
+    
     CGesture& gestureToCancel = iPreviousTapGesture ? *iPreviousTapGesture : *iGesture;
     gestureToCancel.SetCancelled();
-    EmitEventL( gestureToCancel );
+    EmitEvent( gestureToCancel );
+    RecycleGesture(iPreviousTapGesture);
     
-    // recycle the emitted gesture 
-    CleanupStack::PopAndDestroy( this ); 
     }
 
 // ----------------------------------------------------------------------------
 // Notify observer
 // ----------------------------------------------------------------------------
 //
-void CGestureHelperImpl::EmitEventL( const CGesture& aGesture )
+void CGestureHelperImpl::EmitEvent( const CGesture& aGesture )
     {
     // deallocation of the event is happening in CGestureEventSender::RunL() 
-    CGestureEvent* event = new(ELeave) CGestureEvent();
-    event->iCode = const_cast<CGesture&>(aGesture).Code(MGestureEvent::EAxisBoth);
-    event->iCurrPos = aGesture.CurrentPos();
-    event->iDistance = aGesture.Distance();
-    event->iStartPos = aGesture.StartPos();
-    event->iIsHolding = aGesture.IsHolding();
-    event->iSpeed = aGesture.Speed();
-    event->iVisual = aGesture.Visual();
+    TGestureEvent event;
+    event.SetCode(const_cast<CGesture&>(aGesture).Code(EAxisBoth));
+    event.SetCurrentPos(aGesture.CurrentPos());
+    event.SetDistance(aGesture.Distance());
+    event.SetStartPos(aGesture.StartPos());
+    event.SetIsHolding(aGesture.IsHolding());
+    event.SetSpeed(aGesture.Speed());
     iEventSender->AddEvent(event);
     }
 
--- a/webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/webkitutils/rt_gesturehelper/src/gesturehelperimpl.h	Fri May 08 08:25:06 2009 +0300
@@ -23,10 +23,6 @@
 #include <coemain.h>
 #include <rt_gesturehelper.h>
 
-class CAlfEnv;
-class CAlfDisplay;
-class CAlfVisual;
-class TAlfEvent;
 
 struct TPointerEvent;
 
@@ -52,8 +48,6 @@
     /** Destructor */
     ~CGestureHelperImpl();    
     
-    void InitAlfredPointerCaptureL( CAlfEnv& aEnv, CAlfDisplay& aDisplay, 
-        TInt aFreeControlGroupId );
     
     /** See @ref CGestureHelper::SetHoldingEnabled */
     void SetHoldingEnabled( TBool aEnabled );
@@ -65,8 +59,7 @@
     TBool IsDoubleTapEnabled() const;
     /** See @ref CGestureHelper::HandlePointerEventL */
     TBool HandlePointerEventL( const TPointerEvent& aEvent );
-    /** See @ref CGestureHelper::OfferEventL */
-    TBool OfferEventL( const TAlfEvent& aEvent );
+    
     /** Reset helper state */
     void Reset();
    
@@ -78,13 +71,7 @@
     /** Constructor */
     CGestureHelperImpl( MGestureObserver& aObserver );
 
-    /**
-     * Analyse how the pointer event affects the current gesture, and potentially
-     * notify the observer. 
-     * @param aVisual visual on which the event fell on or NULL if not known
-     * @return ETrue if the event was consumed
-     */
-    TBool HandlePointerEventL( const TPointerEvent& aEvent, CAlfVisual* aVisual );
+    
     
     TBool noneAlf_HandlePointerEventL( const TPointerEvent& aEvent);
 
@@ -99,27 +86,27 @@
     /* Set previous tag gesture to null (and recycle the gesture object) */
     static void RecyclePreviousTapGesture( TAny* aSelf );
     /** Emits a tap event since second tap of a double tap was not received within timeout */
-    void EmitFirstTapEventL();
+    void EmitFirstTapEvent();
     /** Emit the start gesture event that aGesture would have produced */
     void EmitStartEventL( const CGesture& aGesture );
     /** 
      * Send code event if not holding. Also sets the event to released and emits again.
      * Modifies aGesture! 
      */
-    void CompleteAndEmitL( CGesture& aGesture );
+    void CompleteAndEmit( CGesture& aGesture );
     /** 
      * Send cancel event about the latest gesture client was notified about 
      * Sets the latest gesture to Cancelled.
      */
-    void EmitCancelEventL();
+    void EmitCancelEvent();
     
     /**
      * Send Released event
      */
-    void EmitReleasedEventL();
+    void EmitReleasedEvent();
     
     /** Notify observer of the gesture */
-    void EmitEventL( const CGesture& aGesture );
+    void EmitEvent( const CGesture& aGesture );
     /** 
      * (re)start holding timer at the current point.
      * Does not restart holding if the point (in aEvent) is near enough to where holding 
@@ -138,11 +125,11 @@
     void RecycleGesture( CGesture*& aGesturePointer );
     
     
-    void HandleTouchUpL(const TPointerEvent& aEvent);
+    void HandleTouchUp(const TPointerEvent& aEvent);
     void HandleTouchDownL(const TPointerEvent& aEvent);
     void HandleMoveL(const TPointerEvent& aEvent);
-    void HandleLongTouchL();
-    void EmitDoubleTapEventL();
+    void HandleLongTouch();
+    void EmitDoubleTapEvent();
     TBool IsMovementGesture(TGestureCode aCode);
     
 private:
--- a/webengine/webkitutils/rt_gesturehelper/src/hittest.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
-* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Gesture helper helper functions
-*
-*/
-
-
-#include "rt_gestureobserver.h"
-
-// system includes
-#include <alf/alfcontrol.h>
-#include <alf/alflayout.h>
-
-using namespace RT_GestureHelper;
-
-namespace 
-    {
-    /** @return the leaf-most visual that is under aPos */
-    const CAlfVisual* VisualByCoordinates( const CAlfVisual& aRoot, const TPoint& aPos )
-        {
-        // If it has children, chose any of them is hit first
-        const CAlfLayout* layout = dynamic_cast< const CAlfLayout* >( &aRoot );
-        if ( layout)
-            {
-            TInt i = layout->Count();
-            while( --i >= 0 )
-                {
-                if( VisualByCoordinates( layout->Visual( i ), aPos ) )
-                    {
-                    return &layout->Visual( i );
-                    }
-                }
-            }
-            
-        // children were not hit. is this visual hit?
-        if( TRect( aRoot.DisplayRect() ).Contains( aPos ) )
-            {
-            return &aRoot;
-            }
-            
-        // visual was not found
-        return NULL;
-        }
-        
-    TBool IsRootVisual( const CAlfVisual& aVisual )
-        {
-        return !aVisual.Layout();
-        }
-    } // unnamed namespace 
-    
-// ----------------------------------------------------------------------------
-// VisualByCoordinates
-// ----------------------------------------------------------------------------
-//
-EXPORT_C CAlfVisual* HitTest::VisualByCoordinates( const CAlfControl& aControl, 
-        const TPoint& aPos )
-    {
-    TInt i = aControl.VisualCount();
-    while( --i >= 0 )
-        {
-        // Ask only root visuals, since all children are within the root visuals
-        if ( IsRootVisual( aControl.Visual( i ) ) )
-            {
-            const CAlfVisual* hitVisual = ::VisualByCoordinates( 
-                aControl.Visual( i ), aPos );
-            if ( hitVisual )
-                {
-                return const_cast< CAlfVisual* >( hitVisual );
-                }
-            }
-        }
-    return NULL;
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/pointercapturer.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Alf control group and control for capturing pointer events
-*
-*/
-
-
-#include "pointercapturer.h"
-
-#include <alf/alfcontrol.h>
-#include <alf/alfcontrolgroup.h>
-#include <alf/alfdisplay.h>
-#include <alf/alfenv.h>
-#include <alf/alfevent.h>
-#include <alf/alfroster.h>
-
-#include "gesturehelperimpl.h"
-
-namespace RT_GestureHelper
-{
-
-/**
- * CPointerCaptureControl
- * Gesture control own a gesture helper, and captures any pointer events that 
- * no other control captures. After it captures pointer down event, it will 
- * capture all pointer events until pointer up. It does this by bringing its
- * control group to the top upon pointer down, and lowering the control group
- * to the botton upon pointer up.
- */
-NONSHARABLE_CLASS( CPointerCaptureControl ) : public CAlfControl
-    {
-public: 
-    /** Two-phased constructor */
-    static CPointerCaptureControl* NewLC( CGestureHelperImpl& aHelper, 
-            CAlfEnv& aEnv, CAlfDisplay& aDisplay )
-        {
-        CPointerCaptureControl* self = new ( ELeave ) CPointerCaptureControl( aHelper );
-        CleanupStack::PushL( self );
-        self->ConstructL( aEnv ); // construct base class
-        self->BindDisplay( aDisplay );
-        self->AppendVisualL( EAlfVisualTypeVisual );       
-        return self;
-        }
-    
-    void StartCaptureL()
-        {
-        User::LeaveIfError( Display()->Roster().SetPointerEventObservers( 
-            EAlfPointerEventReportDrag | EAlfPointerEventReportUnhandled, 
-                *this ) );
-        Display()->Roster().ShowL( *ControlGroup(), KAlfRosterShowAtTop );
-        }
-    
-    void StopCapture()
-        {
-        ( void ) Display()->Roster().SetPointerEventObservers( 0, *this );
-        TRAP_IGNORE( Display()->Roster().ShowL( *ControlGroup(), KAlfRosterShowAtBottom ) );
-        }
-    
-private:
-    /** Constructor */
-    CPointerCaptureControl( CGestureHelperImpl& aHelper )
-            : iHelper( aHelper )
-        {
-        }
-    
-    // From CAlfControl
-    TBool OfferEventL( const TAlfEvent& aEvent )
-        {
-        TBool consumed = EFalse;
-        if ( aEvent.IsPointerEvent() )
-            {
-            // pointer down should never come here if everything is working properly. 
-            // if pointer event comes here, stop capturing and allow the event to 
-            // fall to the controls below
-            if ( aEvent.PointerDown() )
-                {
-                StopCapture();
-                }
-            else 
-                {
-                consumed = iHelper.HandlePointerEventL( aEvent.PointerEvent() );
-                }
-            }
-        return consumed;
-        }
-    
-private:    
-    /// gesture helper that analyses pointer sequences. own.
-    CGestureHelperImpl& iHelper;
-    };
-    
-} // namespace RT_GestureHelper
-
-using namespace RT_GestureHelper;
-    
-// ----------------------------------------------------------------------------
-// Two phase constructor
-// ----------------------------------------------------------------------------
-//
-CPointerCapturer* CPointerCapturer::NewL()
-    {
-    return new ( ELeave ) CPointerCapturer();
-    }
-
-// ----------------------------------------------------------------------------
-// Two phase constructor
-// ----------------------------------------------------------------------------
-//
-CPointerCapturer::~CPointerCapturer()
-    {
-    if ( iCaptureControl )
-        {
-        // deleting the control group will also delete the control
-        iCaptureControl->Env().DeleteControlGroup( iControlGroupId );
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// InitForAlfredL
-// ----------------------------------------------------------------------------
-//
-void CPointerCapturer::InitForAlfredL( CGestureHelperImpl& aHelper, 
-        CAlfEnv& aEnv, CAlfDisplay& aDisplay, TInt aControlGroupId )
-    {
-    CAlfControlGroup& group = aEnv.NewControlGroupL( aControlGroupId );
-    CPointerCaptureControl* control = CPointerCaptureControl::NewLC( aHelper, 
-        aEnv, aDisplay );
-    group.AppendL( control );
-    CleanupStack::Pop( control );    
-   
-    // store control only after it has been successfully added to group
-    iCaptureControl = control;
-    iControlGroupId = aControlGroupId;
-    }
-
-// ----------------------------------------------------------------------------
-// StartCaptureL
-// ----------------------------------------------------------------------------
-//
-void CPointerCapturer::StartL()
-    {
-    if ( iCaptureControl )
-        {
-        iCaptureControl->StartCaptureL();
-        }
-    }
-
-// ----------------------------------------------------------------------------
-// StopCapture
-// ----------------------------------------------------------------------------
-//
-void CPointerCapturer::Stop()
-    {
-    if ( iCaptureControl )
-        {
-        iCaptureControl->StopCapture();
-        }
-    }
--- a/webengine/webkitutils/rt_gesturehelper/src/pointercapturer.h	Mon Mar 30 12:54:55 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:  Responsible for capturing pointer events
-*
-*/
-
-
-#ifndef _POINTERCAPTURER_H_
-#define _POINTERCAPTURER_H_
-
-// INCLUDES
-#include <e32std.h>
-#include <e32base.h>
-
-class CAlfControl;
-class CAlfControlGroup;
-class CAlfEnv;
-class CAlfDisplay;
-
-// CLASS DECLARATION
-
-namespace RT_GestureHelper 
-{
-
-class CGestureHelperImpl;
-class CPointerCaptureControl;
-
-/**
- * CPointerCaptureControl
- * Gesture control own a gesture helper, and captures any pointer events that 
- * no other control captures. After it captures pointer down event, it will 
- * capture all pointer events until pointer up. It does this by bringing its
- * control group to the top upon pointer down, and lowering the control group
- * to the botton upon pointer up.
- */
-NONSHARABLE_CLASS( CPointerCapturer ) : public CBase
-    {
-public: 
-    /** Two-phased constructor */
-    static CPointerCapturer* NewL();
-    /** Destructor */
-    ~CPointerCapturer();
-    
-    void InitForAlfredL( CGestureHelperImpl& aHelper, CAlfEnv& aEnv, 
-        CAlfDisplay& aDisplay, TInt aControlGroupId );
-
-    void StartL();
-    void Stop();
-    
-private:    
-    /// 
-    CPointerCaptureControl* iCaptureControl;
-    TInt iControlGroupId;
-    };
-
-} // namespace GestureHelper
-    
-#endif // _POINTERCAPTURER_H_
--- a/webengine/wmlengine/src/fbox/include/nw_fbox_CEpoc32InputBox.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/wmlengine/src/fbox/include/nw_fbox_CEpoc32InputBox.h	Fri May 08 08:25:06 2009 +0300
@@ -32,9 +32,12 @@
 
 #include <fepbase.h>
 #include <aknedsts.h> 
+#include <fepipext.h>
 
 // CONSTANTS
 const TInt KBufLength = 512;
+#define KFepUid 0x100056de
+#define KLineEnterChar 0x21b2
 
 // FORWARD DECLARATIONS
 
@@ -58,7 +61,9 @@
 */
 class CEpoc32InputBox : public CEikBorderedControl, public MEikEdwinObserver, public MCoeFepObserver,
 public MCoeFocusObserver, 
-public MCoeFepAwareTextEditor, public MCoeCaptionRetrieverForFep, private MCoeFepAwareTextEditor_Extension1
+public MCoeFepAwareTextEditor, public MCoeCaptionRetrieverForFep, 
+public TCoeInputCapabilities::MCoeFepSpecificExtensions, 
+private MCoeFepAwareTextEditor_Extension1
     {
     protected:      // Constructors and destructor
         /*
@@ -337,7 +342,12 @@
         // for virtual keyboard
         void UpdateInlineTextL(const TDesC& aText);
         void ClearInlineText();
-
+    
+    private: 
+        
+        virtual TBool IsValidCharacter(TInt aChar);
+        virtual void MCoeFepSpecificExtensions_Reserved_1(){};
+        virtual void MCoeFepSpecificExtensions_Reserved_2(){};
 
     private:        // Data
 
--- a/webengine/wmlengine/src/fbox/src/FBOXCEpoc32InputBox.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/wmlengine/src/fbox/src/FBOXCEpoc32InputBox.cpp	Fri May 08 08:25:06 2009 +0300
@@ -58,7 +58,6 @@
 // CONSTANTS
 
 static const TInt KNumberOfLines = 1000;
-_LIT(KBlankDesC," ");
 
 // ================= STATIC FUNCTIONS =======================
 TInt CEpoc32InputBox::RefreshContents( TAny* aParam )
@@ -277,7 +276,7 @@
         }
     else
         {
-        CreateWindowL( iParent );
+        SetContainerWindowL( *iParent );
         }
 
     // Create formatted editor
@@ -620,6 +619,13 @@
             }
          }
       }
+    else
+        {
+         if ( iEditor )
+           {
+              iEditor->TextView()->FormatTextL();
+           }
+        }
     }
 
 // ---------------------------------------------------------
@@ -1316,7 +1322,7 @@
             {
             return TCoeInputCapabilities(iEditor->InputCapabilities().Capabilities(),
                     (MCoeFepAwareTextEditor*) this,
-                    (MCoeCaptionRetrieverForFep*) this);
+                    (MCoeCaptionRetrieverForFep*) this, TUid::Uid(KFepUid), (TCoeInputCapabilities::MCoeFepSpecificExtensions*)this );
             }
         else
             {
@@ -1628,7 +1634,7 @@
 // -----------------------------------------------------------------------------
 TInt CEpoc32InputBox::DocumentMaximumLengthForFep() const
 {
-    return KMaxTInt;
+    return iMaxLength;
 }
 
 // -----------------------------------------------------------------------------
@@ -1665,12 +1671,12 @@
 //
 // -----------------------------------------------------------------------------
 void CEpoc32InputBox::GetEditorContentForFep(TDes& aEditorContent,TInt aDocumentPosition,TInt aLengthToRetrieve) const
-{
-    aEditorContent = KBlankDesC;
-    if ( iInlineEditText && aDocumentPosition >= 0 && (aDocumentPosition + aLengthToRetrieve) <= iInlineEditText->Length() )
-        {
-        aEditorContent = iInlineEditText->Des().Mid(aDocumentPosition,aLengthToRetrieve);
-        }
+{    
+    aEditorContent = KNullDesC; 
+	if ( iInlineEditText && aDocumentPosition >= 0 && (aDocumentPosition + aLengthToRetrieve) <= iInlineEditText->Length() ) 
+	    {
+	    aEditorContent = iInlineEditText->Des().Mid(aDocumentPosition,aLengthToRetrieve);
+		}
 }
 
 // -----------------------------------------------------------------------------
@@ -1816,6 +1822,17 @@
     }
 }
 
+// -------------------------------------------------------------------------------
+// IsValidCharacter :: interface method of MCoeFepSpecificExtensions
+// 
+// -------------------------------------------------------------------------------
+TBool CEpoc32InputBox::IsValidCharacter(TInt aChar) 
+    {
+    // Single line input box, enter character need not be taken  
+    if ( aChar == KLineEnterChar )
+        return EFalse; 
+    return ETrue; 
+    }
 
 //  End of File
 
--- a/webengine/wmlengine/src/gdi/src/GDIDeviceContext.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/webengine/wmlengine/src/gdi/src/GDIDeviceContext.cpp	Fri May 08 08:25:06 2009 +0300
@@ -1216,13 +1216,18 @@
     InitializeGraphicsContext();
     gc->UseFont(epocFont);
 
+    //Calculate Baseline offset
+    //Baseline is calculated as (Height + ascent in pixels - descent in pixels) /2
+    //iDisplayBounds and iOrigin are kept as it is to make sure drawing is respective to
+    //display bound
+    TInt heightInPixels = epocFont->HeightInPixels();
     TInt descentInPixels = epocFont->DescentInPixels();
-
+    TInt acsentInPixels = epocFont->FontMaxAscent();
+    TInt baseLineOffset = (iDisplayBounds.point.y) + (heightInPixels + acsentInPixels - descentInPixels ) / (2) - iOrigin.y; 
+    
     TPtrC ptrC(string);
-    TPoint point( aLocation->x - iOrigin.x + iDisplayBounds.point.x+1,
-                  aLocation->y + epocFont->HeightInPixels()
-                  - descentInPixels - iOrigin.y +
-                  iDisplayBounds.point.y +1);
+    TPoint point( aLocation->x - iOrigin.x + iDisplayBounds.point.x,
+                  aLocation->y + baseLineOffset);
 
     if (aDecoration & NW_GDI_TextDecoration_Underline) {
       gc->SetUnderlineStyle(EUnderlineOn);
--- a/widgets/widgetapp/inc/WidgetUiObserver.h	Mon Mar 30 12:54:55 2009 +0300
+++ b/widgets/widgetapp/inc/WidgetUiObserver.h	Fri May 08 08:25:06 2009 +0300
@@ -318,6 +318,7 @@
         HBufC*                  iLeftSoftkeyStr;
         //Active Object to collect bitmap
         CIdle* iCollectBitmapTimer;
+        RFs iFs;
     };
 
 #endif      // WIDGEUIOBSERVER_H
--- a/widgets/widgetapp/src/WidgetUiAppUi.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/widgets/widgetapp/src/WidgetUiAppUi.cpp	Fri May 08 08:25:06 2009 +0300
@@ -306,7 +306,8 @@
 
     if ( aEvent.Type() == KAknUidValueEndKeyCloseEvent )
         {
-        // Let the Container::OfferKeyEventL handle the red end key
+        // Close the current active widget
+        iWindowManager->CloseWindowsAsync(EFalse);
         return;
         }
 
--- a/widgets/widgetapp/src/WidgetUiObserver.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/widgets/widgetapp/src/WidgetUiObserver.cpp	Fri May 08 08:25:06 2009 +0300
@@ -183,6 +183,19 @@
             iWindow->SetSoftKeyLabelL( aKeySoftkey, aLabel );
             }
         }
+    
+    if (iWindow->WindowManager().ActiveWindow() && 
+            iWindow->WindowManager().View()->CbaGroup()->IsVisible())
+        {
+        TBrCtlDefs::TBrCtlElementType elementtype =
+                      iWindow->WindowManager().ActiveWindow()->Engine()->FocusedElementType();
+        // Check if focused element type is editing type
+        if ((elementtype != TBrCtlDefs::EElementActivatedInputBox) &&
+                       (elementtype != TBrCtlDefs::EElementActivatedObjectBox))
+            {
+            iWindow->WindowManager().View()->ShowActivatedObject( EFalse );
+            }        
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -231,6 +244,7 @@
         iWindow->WindowManager().WidgetUIClientSession().GetLprojName( lprojName );
         TranslateURLToFilenameL( aEmbeddedUrl, lprojName ); 
         
+		iFs.PrivatePath(iAppPrivatePath);        
         // TRUE if e:/private/10282822/*/* was requested. It may or may not be inside a widget's sandbox.
         TBool isInsidePrivateDir = ( iFileName && ( (*iFileName).FindF(iAppPrivatePath) == KMaxDriveName ) ) ? ETrue : EFalse; 
 
@@ -341,6 +355,7 @@
     iHandler = CDocumentHandler::NewL( CEikonEnv::Static()->Process() ) ;
         // Get WidgetUI's private directory (e.g. c:/private/10282822/)
     iCollectBitmapTimer = CIdle::NewL(CActive::EPriorityLow);
+    iFs.Connect();
     }
 
 // -----------------------------------------------------------------------------
@@ -362,6 +377,7 @@
     delete iSoftkeyExitStr;
     delete iLeftSoftkeyStr;
     delete iCollectBitmapTimer; 
+    iFs.Close(); 
     }
 
 // -----------------------------------------------------------------------------
--- a/widgets/widgetapp/src/WidgetUiWindow.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/widgets/widgetapp/src/WidgetUiWindow.cpp	Fri May 08 08:25:06 2009 +0300
@@ -755,7 +755,7 @@
         // after code above, which may have prompted user, perform a final access check
         if ( EAllow != NetworkAccessGrant( ) )
         {
-        User::Leave( KErrAccessDenied );
+        User::Leave( KErrCancel );
         }
     }
 
--- a/widgets/widgetapp/src/WidgetUiWindowContainer.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/widgets/widgetapp/src/WidgetUiWindowContainer.cpp	Fri May 08 08:25:06 2009 +0300
@@ -313,8 +313,12 @@
                 if (aKeyEvent.iCode == EKeyEnter || aKeyEvent.iCode == EKeyOK ||
                    (aKeyEvent.iScanCode > EStdKeyScrollLock && aKeyEvent.iScanCode < EStdKeyF1))
                     {
-                    iWindowManager.View()->ShowActivatedObject(ETrue, showStausPane);
-                    editing = ETrue;
+                    if ( iWindowManager.ActiveWindow() &&
+          			        iWindowManager.View()->CbaGroup()->IsVisible() )
+                        {
+                        iWindowManager.View()->ShowActivatedObject(ETrue, showStausPane);
+                        editing = ETrue;
+                        }
                     }
                 break;
                 }
--- a/widgets/widgetapp/src/cpspublisher.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/widgets/widgetapp/src/cpspublisher.cpp	Fri May 08 08:25:06 2009 +0300
@@ -22,7 +22,7 @@
 #include <LiwVariant.h>
 #include <LiwGenericParam.h>
 #include <Liwcommon.h>
-
+#include <liwcommon.hrh>
 #include <AknsFrameBackgroundControlContext.h>
 #include <fbs.h>
 #include <aknsdrawutils.h> 
@@ -149,6 +149,9 @@
 
 CCpsPublisher::~CCpsPublisher()
     {
+    
+    TRAP_IGNORE(ExecuteRegistrationCommandL( KLiwOptCancel ));
+    
     if( iCpsInterface )
         {
         iCpsInterface->Close();
@@ -161,6 +164,7 @@
         iServiceHandler = NULL;
         }
     delete iMaskBitmap;
+__UHEAP_MARKEND;    
     }
 
 CLiwDefaultMap* ElementSizeFilterLC()
@@ -196,6 +200,7 @@
 
 void CCpsPublisher::ConstructL()
     {
+    __UHEAP_MARK;
     RDebug::Printf("CCpsPublisher::InitCPS");
     InitCpsInterfaceL();
     RDebug::Printf("CCpsPublisher::Register");
@@ -249,7 +254,6 @@
 void CCpsPublisher::ExecuteRegistrationCommandL( 
     TUint aOption )
     {
-    __UHEAP_MARK;
     CLiwDefaultMap* filter = ElementSizeFilterLC();
     filter->InsertL( KOperation, TLiwVariant( KUpdate ));
     
@@ -270,7 +274,6 @@
     outParamList.Reset();
     inParamList.Reset(); 
     CleanupStack::PopAndDestroy( filter );
-    __UHEAP_MARKEND;
     }
 
 TInt CCpsPublisher::HandleNotifyL(
--- a/widgets/widgetlauncher/src/WidgetLauncher.cpp	Mon Mar 30 12:54:55 2009 +0300
+++ b/widgets/widgetlauncher/src/WidgetLauncher.cpp	Fri May 08 08:25:06 2009 +0300
@@ -131,6 +131,9 @@
 
     // Try to get the size.
     TRAP_IGNORE( aOperation = readStream.ReadInt32L() );
+    
+    delete commandLine;
+    commandLine = NULL;
     }
     
 //===========================================================================