# HG changeset patch # User Maciej Seroka # Date 1264085647 0 # Node ID 235c00e46fb7ca648298f125458ac1699f40ab64 # Parent e904b452aa85e76d59ba6db2b6c174e613f00255 Added Symbian3 smoketests diff -r e904b452aa85 -r 235c00e46fb7 Group/bld.inf --- a/Group/bld.inf Thu Jan 21 12:55:15 2010 +0000 +++ b/Group/bld.inf Thu Jan 21 14:54:07 2010 +0000 @@ -21,17 +21,18 @@ #include "../contacts/group/bld.inf" #include "../messaging/Group/bld.inf" #include "../System/Group/bld.inf" -#include "../Timew/Group/bld.inf" +//#include "../Timew/Group/bld.inf" #include "../email/group/bld.inf" #include "../profiles/group/Bld.inf" #include "../notepad/group/bld.inf" #include "../appinstall/group/Bld.inf" -#include "../lbs/group/bld.inf" +//#include "../lbs/group/bld.inf" #include "../uiresources/group/bld.inf" #include "../inputmethods/group/Bld.inf" -#include "../IM/group/bld.inf" -#include "../localisation/uiftestfw/group/BLD.INF" -#include "../localisation/apparchitecture/group/BLD.INF" +//#include "../IM/group/bld.inf" +//#include "../localisation/uiftestfw/group/BLD.INF" +//#include "../localisation/apparchitecture/group/BLD.INF" #include "../graphics/wserv/group/bld.inf" #include "../http/group/bld.inf" -#include "../mediamgmt/group/Bld.inf" \ No newline at end of file +#include "../mediamgmt/group/Bld.inf" +#include "../browser/group/Bld.inf" diff -r e904b452aa85 -r 235c00e46fb7 Group/smoketest.pl --- a/Group/smoketest.pl Thu Jan 21 12:55:15 2010 +0000 +++ b/Group/smoketest.pl Thu Jan 21 14:54:07 2010 +0000 @@ -18,6 +18,7 @@ mkpath "temp/smoketest/localisation/general"; mkpath "temp/smoketest/bitmap/general"; mkpath "temp/smoketest/ethernet/general"; +mkpath "temp/smoketest/web/general"; my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("smoketest.xml", "temp/test.xml"); @@ -139,5 +140,9 @@ copy($epoc . "release/winscw/udeb/MediaMgmtSmokeTestModule.dll", "temp/smoketest/winscw_udeb/MediaMgmtSmokeTestModule.dll"); copy($epoc . "winscw/c/smoketest/UI_MediaMgmtSmokeTestModule.cfg", "temp/smoketest/general/UI_MediaMgmtSmokeTestModule.cfg"); copy($epoc . "winscw/c/smoketest/MediaMgmtSmokeTestModule.cfg", "temp/smoketest/general/MediaMgmtSmokeTestModule.cfg"); +copy($epoc . "data/c/smoketest/web/loadtest2.html", "temp/smoketest/web/general/loadtest2.html"); +copy($epoc . "data/c/smoketest/web/img8.jpg", "temp/smoketest/web/general/img8.jpg"); +copy($epoc . "winscw/c/smoketest/ui_browser_control_smoke.cfg", "temp/smoketest/general/ui_browser_control_smoke.cfg"); +copy($epoc . "release/winscw/udeb/BrCtlApiTest.dll", "temp/smoketest/winscw_udeb/BrCtlApiTest.dll"); system("7z a -tzip smoketest.zip ./temp/*"); diff -r e904b452aa85 -r 235c00e46fb7 Group/smoketest.xml --- a/Group/smoketest.xml Thu Jan 21 12:55:15 2010 +0000 +++ b/Group/smoketest.xml Thu Jan 21 14:54:07 2010 +0000 @@ -65,7 +65,7 @@ - + install @@ -74,7 +74,7 @@ - + install @@ -83,7 +83,7 @@ - + install @@ -92,7 +92,7 @@ - + install @@ -101,7 +101,7 @@ - + install @@ -110,7 +110,7 @@ - + install @@ -119,7 +119,7 @@ - + install @@ -128,7 +128,7 @@ - + install @@ -137,7 +137,7 @@ - + install @@ -146,7 +146,7 @@ - + install @@ -155,7 +155,7 @@ - + install @@ -164,7 +164,7 @@ - + install @@ -173,7 +173,7 @@ - + install @@ -182,7 +182,7 @@ - + install @@ -191,7 +191,7 @@ - + install @@ -200,7 +200,7 @@ - + install @@ -209,7 +209,7 @@ - + install @@ -218,7 +218,7 @@ - + install @@ -227,7 +227,7 @@ - + install @@ -236,7 +236,7 @@ - + install @@ -245,7 +245,7 @@ - + install @@ -254,7 +254,7 @@ - + install @@ -263,7 +263,7 @@ - + install @@ -272,7 +272,7 @@ - + install @@ -281,7 +281,7 @@ - + install @@ -290,7 +290,7 @@ - + install @@ -299,7 +299,7 @@ - + install @@ -308,7 +308,7 @@ - + install @@ -317,7 +317,7 @@ - + install @@ -326,7 +326,7 @@ - + install @@ -335,7 +335,7 @@ - + install @@ -344,7 +344,7 @@ - + install @@ -353,7 +353,7 @@ - + install @@ -362,7 +362,7 @@ - + install @@ -371,7 +371,7 @@ - + install @@ -380,7 +380,7 @@ - + install @@ -389,7 +389,7 @@ - + install @@ -398,7 +398,7 @@ - + install @@ -407,7 +407,7 @@ - + install @@ -479,7 +479,7 @@ - + install @@ -542,7 +542,7 @@ - + install @@ -551,7 +551,7 @@ - + install @@ -560,7 +560,7 @@ - + install @@ -569,7 +569,7 @@ - + install @@ -578,7 +578,7 @@ - + install @@ -587,7 +587,7 @@ - + install @@ -596,7 +596,7 @@ - + install @@ -605,7 +605,7 @@ - + install @@ -614,7 +614,7 @@ - + install @@ -623,7 +623,7 @@ - + install @@ -632,7 +632,7 @@ - + install @@ -641,7 +641,7 @@ - + install @@ -701,7 +701,7 @@ - + @@ -712,7 +712,7 @@ - + @@ -723,7 +723,7 @@ - + @@ -734,18 +734,18 @@ - + - + execute - + @@ -756,23 +756,23 @@ - + - + execute - + - + execute @@ -801,7 +801,7 @@ - + @@ -821,7 +821,7 @@ - + @@ -830,7 +830,7 @@ - + @@ -995,7 +995,7 @@ - + install @@ -1004,7 +1004,7 @@ - + install @@ -1040,13 +1040,49 @@ + + install + + + + + + + + + install + + + + + + + + + install + + + + + + + + + install + + + + + + + execute - + @@ -1055,7 +1091,7 @@ - + @@ -1073,7 +1109,7 @@ - + @@ -1082,16 +1118,16 @@ - + - + execute - + @@ -1103,6 +1139,15 @@ + + execute + + + + + + + @@ -1117,13 +1162,11 @@ smoketest/general/smoketest_createsmsaccount.script smoketest/general/smoketest_mess.ini smoketest/general/smoketest_mess.script - smoketest/general/smoketest_timew.ini - smoketest/general/smoketest_timew.script + smoketest/general/smoketest_email.ini smoketest/general/smoketest_email.script - smoketest/general/smoketest_lbs.ini - smoketest/general/smoketest_lbs.script - smoketest/general/smoketest_language.script + + smoketest/general/smoketest_bitmap.ini smoketest/general/smoketest_bitmap.script smoketest/general/smoketest_http.ini @@ -1132,45 +1175,7 @@ smoketest/general/MachineName.txt smoketest/emailmessage/general/20KBody.txt smoketest/emailsettings/general/popsettings_test908.txt - smoketest/10003a3f/general/openservice1a.rsc - smoketest/10003a3f/general/openservice1b.rsc - smoketest/10003a3f/general/serverapp2_reg.rsc - smoketest/10003a3f/general/serverapp3_reg.rsc - smoketest/10003a3f/general/serverapp4_reg.rsc - smoketest/10003a3f/general/serverapp6_reg.rsc - smoketest/10003a3f/general/serverapp7_reg.rsc - smoketest/10003a3f/general/serverapp_reg.rsc - smoketest/10003a3f/general/t_dataprioritysystem3_reg.rsc - smoketest/10003a3f/general/t_groupname_reg.rsc - smoketest/10003a3f/general/t_groupnamever1_reg.rsc - smoketest/10003a3f/general/t_groupnamever2_reg.rsc - smoketest/10003a3f/general/tctrlpnlapp_reg.rsc - smoketest/10003a3f/general/testtrustedpriorityapp1_reg.rsc - smoketest/10003a3f/general/testtrustedpriorityapp2_reg.rsc - smoketest/resource/general/customisedefaulticonapp_loc.rsc - smoketest/resource/general/default_app_icon.m02 - smoketest/resource/general/serverapp_loc.rsc - smoketest/resource/general/t_groupname_loc.rsc - smoketest/resource/general/t_groupnamever1_loc.rsc - smoketest/resource/general/t_groupnamever2_loc.rsc - smoketest/resource/general/tstapp02.m02 - smoketest/resource/general/tstapp.mbm - smoketest/resource/general/tstapp.rsc - smoketest/resource/general/tstapp_loc.r01 - smoketest/resource/general/tstapp_loc.r02 - smoketest/resource/general/tstapp_loc.r03 - smoketest/resource/general/tstapp_loc.r04 - smoketest/resource/general/tstapp_loc.r05 - smoketest/resource/general/tstapp_loc.rsc - smoketest/resource/general/tstappview - smoketest/resource/general/tstappview01.m01 - smoketest/resource/general/tstappview01.m02 - smoketest/resource/general/tstappview02.k - smoketest/localisation/general/customisedefaulticonapp_reg.rsc - smoketest/localisation/general/testuntrustedpriorityapp1_reg.rsc - smoketest/localisation/general/testuntrustedpriorityapp2_reg.rsc - smoketest/localisation/general/tstapp_reg.rsc - smoketest/localisation/general/tstapp_embedded.rsc + smoketest/bitmap/general/uibench_16bit.mbm smoketest/ethernet/general/delproxy.pl smoketest/winscw_udeb/SmokeTestSecureFSclient.dll @@ -1180,23 +1185,13 @@ smoketest/winscw_udeb/Smoketest_Contacts_Server.exe smoketest/winscw_udeb/Smoketest_Mess_Server.exe smoketest/winscw_udeb/Smoketest_System.exe - smoketest/winscw_udeb/Smoketest_Timew_Server.exe + smoketest/winscw_udeb/SmokeTest_Utils.dll smoketest/winscw_udeb/t_msgutilityserver.dll smoketest/winscw_udeb/t_msgpopserver.exe smoketest/winscw_udeb/t_msgsmtpserver.exe - smoketest/winscw_udeb/lbstestutils.dll - smoketest/winscw_udeb/lbstestclient.dll - smoketest/winscw_udeb/lbstestchannel.dll - smoketest/winscw_udeb/lbstestserver.exe - smoketest/winscw_udeb/ctlbsexeclient.exe - smoketest/winscw_udeb/lbsclienttestserver.exe - smoketest/winscw_udeb/appfwk_test_AppUi.dll - smoketest/winscw_udeb/appfwk_test_utils.dll - smoketest/winscw_udeb/TIconLoaderAndIconArrayForLeaks.dll - smoketest/winscw_udeb/TSTAPP_embedded.dll - smoketest/winscw_udeb/apparctestserver.exe - smoketest/winscw_udeb/tstapp.exe + + smoketest/winscw_udeb/t_animplugin.dll smoketest/winscw_udeb/t_graphicswservapi.exe smoketest/winscw_udeb/twsgraphicshare.exe @@ -1217,10 +1212,13 @@ smoketest/wallpaper/general/symbian_01_320x480.jpg smoketest/winscw_udeb/InputMethodSmokeTestModule.dll smoketest/general/InputMethodSmokeTestModule.cfg - smoketest/winscw_udeb/IMApiTest.dll - smoketest/general/imapitest.ini + smoketest/winscw_udeb/MediaMgmtSmokeTestModule.dll smoketest/general/UI_MediaMgmtSmokeTestModule.cfg smoketest/general/MediaMgmtSmokeTestModule.cfg + smoketest/web/general/loadtest2.html + smoketest/web/general/img8.jpg + smoketest/general/ui_browser_control_smoke.cfg + smoketest/winscw_udeb/BrCtlApiTest.dll diff -r e904b452aa85 -r 235c00e46fb7 apploader/testdata/smoketest_apploader.ini --- a/apploader/testdata/smoketest_apploader.ini Thu Jan 21 12:55:15 2010 +0000 +++ b/apploader/testdata/smoketest_apploader.ini Thu Jan 21 14:54:07 2010 +0000 @@ -11,7 +11,7 @@ program =Clock [SMOKE_APP_RUNNING_0004] -program =Messaging +program =Messages [SMOKE_APP_LAUNCH_0005] program =NSmlDSSync.exe @@ -23,7 +23,7 @@ program =Calendar [SMOKE_APP_RUNNING_0007] -program =Contacts +program =Phonebook 2 [SMOKE_APP_KEYEVENTS_0008] delay1 =2000 @@ -51,4 +51,4 @@ program =Notepad.exe [SMOKE_APP_END_0011] -program =Notes +program =Notepad diff -r e904b452aa85 -r 235c00e46fb7 browser/bwins/BrCtlApiTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/bwins/BrCtlApiTestu.def Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r e904b452aa85 -r 235c00e46fb7 browser/data/img8.jpg Binary file browser/data/img8.jpg has changed diff -r e904b452aa85 -r 235c00e46fb7 browser/data/loadtest2.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/data/loadtest2.html Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,28 @@ + + +Demo + + + + + + +

+ This test tests that LoadData actually works. + If you see this page the test passed. +

+ + +
+ + +
+ + + + diff -r e904b452aa85 -r 235c00e46fb7 browser/data/ui_browser_control_smoke.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/data/ui_browser_control_smoke.cfg Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,9 @@ +[Test] +title BrCtl Smoke Test +create BrCtlApiTest container +container CreateBrowserControl +container BrCtlSubscribeToMenuItems +pause 3000 +container DestroyBrowserControl +delete container +[Endtest] diff -r e904b452aa85 -r 235c00e46fb7 browser/eabi/BrCtlApiTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/eabi/BrCtlApiTestu.def Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,11 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI21CBrCtlApiTestObserver @ 2 NONAME ; ## + _ZTI22CBrCtlApiTestContainer @ 3 NONAME ; ## + _ZTI28CBrowserDialogsProviderProxy @ 4 NONAME ; ## + _ZTI32CBrCtlApiTestStateChangeObserver @ 5 NONAME ; ## + _ZTV21CBrCtlApiTestObserver @ 6 NONAME ; ## + _ZTV22CBrCtlApiTestContainer @ 7 NONAME ; ## + _ZTV28CBrowserDialogsProviderProxy @ 8 NONAME ; ## + _ZTV32CBrCtlApiTestStateChangeObserver @ 9 NONAME ; ## + diff -r e904b452aa85 -r 235c00e46fb7 browser/group/Bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/group/Bld.inf Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,41 @@ +/* +* 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_TESTEXPORTS +//../init/testframework.ini /epoc32/winscw/c/TestFramework/testframework.ini + +../data/ui_browser_control_smoke.cfg c:/smoketest/ui_browser_control_smoke.cfg + +../data/loadtest2.html c:/smoketest/web/loadtest2.html + +../data/img8.jpg c:/smoketest/web/img8.jpg + +PRJ_EXPORTS +// Nothing to do + +PRJ_TESTMMPFILES +BrCtlApiTest.mmp + +PRJ_MMPFILES +// Nothing to do + +// End of File \ No newline at end of file diff -r e904b452aa85 -r 235c00e46fb7 browser/group/BrCtlApiTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/group/BrCtlApiTest.mmp Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,63 @@ +/* +* 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 +#include + +TARGET BrCtlApiTest.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 BrCtlApiTest.def + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +MW_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . +MW_LAYER_ECOM_SYSTEMINCLUDE + +SOURCEPATH ../src +SOURCE BrCtlApiTest.cpp BrCtlApiTestBlocks.cpp +SOURCE BrCtlApiTestContainer.cpp BrCtlApiTestObserver.cpp +SOURCE BrCtlApiTestStateChangeObserver.cpp BrCtlApiTestDialogsProvider.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 + +#ifdef __S60_32__ +LANG sc +#else +LANGUAGE_IDS +#endif + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/inc/BrCtlApiTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/inc/BrCtlApiTest.h Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,176 @@ +/* +* Copyright (c) 2002 - 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: ?Description +* +*/ + + + +#ifndef BRCTLAPITEST_H +#define BRCTLAPITEST_H + +// INCLUDES +#include +#include +#include + +#include +#include "BrCtlApiTestContainer.h" + +// CONSTANTS +//const ?type ?constant_var = ?constant; + +// MACROS +//#define ?macro ?macro_def +#define TEST_CLASS_VERSION_MAJOR 0 +#define TEST_CLASS_VERSION_MINOR 0 +#define TEST_CLASS_VERSION_BUILD 0 + +// Logging path +_LIT( KBrCtlApiTestLogPath, "\\logs\\testframework\\BrCtlApiTest\\" ); +// Log file +_LIT( KBrCtlApiTestLogFile, "BrCtlApiTest.txt" ); +_LIT( KBrCtlApiTestLogFileWithTitle, "BrCtlApiTest_[%S].txt" ); + +// FUNCTION PROTOTYPES +//?type ?function_name(?arg_list); + +// FORWARD DECLARATIONS +//class ?FORWARD_CLASSNAME; +class CBrowserControlApiTest; + +// DATA TYPES +//enum ?declaration +//typedef ?declaration +//extern ?data_type; + +// CLASS DECLARATION + +/** +* CBrowserControlApiTest test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CBrowserControlApiTest) : public CScriptBase + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBrowserControlApiTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CBrowserControlApiTest(); + + public: // New functions + + /** + * ?member_description. + * @since ?Series60_version + * @param ?arg1 ?description + * @return ?description + */ + //?type ?member_function( ?type ?arg1 ); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + private: + + /** + * C++ default constructor. + */ + CBrowserControlApiTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + /** + * Example test method. + * @since ?Series60_version + * @param aItem Script line containing parameters. + * @return Symbian OS error code. + */ + virtual TInt ExampleL( CStifItemParser& aItem ); + virtual TInt CreateBrCtlL( CStifItemParser& aItem ); + virtual TInt DestroyBrowserControlL( CStifItemParser& aItem ); + virtual TInt ZoomLevels( CStifItemParser& aItem ); + virtual TInt HandleCommandL( CStifItemParser& aItem ); + virtual TInt LoadData( CStifItemParser& aItem ); + virtual TInt SavedPageL( CStifItemParser& aItem ); + virtual TInt CertInfo( CStifItemParser& aItem ); + virtual TInt SetSelfDownloadContentTypes( CStifItemParser& aItem ); + virtual TInt NavigationAvailable( CStifItemParser& aItem ); + virtual TInt PageInfo( CStifItemParser& aItem ); + virtual TInt EmptyCache( CStifItemParser& aItem ); + virtual TInt GetBitmapData( CStifItemParser& aResult ); + virtual TInt SaveToFile( CStifItemParser& aResult ); + virtual TInt OkToExit( CStifItemParser& aResult ); + virtual TInt OfferKeyEvent( CStifItemParser& aResult ); + virtual TInt MinimumSize( CStifItemParser& aResult ); + virtual TInt FocusedElementType( CStifItemParser& aResult ); + virtual TInt ContentSize( CStifItemParser& aResult ); + virtual TInt BrCtlSetParam( CStifItemParser& aResult ); + virtual TInt BrCtlSubscribeToMenuItemsL( CStifItemParser& aResult ); + virtual TInt FocusedImage( CStifItemParser& aResult ); + virtual TInt BrCtlSettings( CStifItemParser& aResult ); + virtual TInt FindKeyword( CStifItemParser& aResult ); + virtual TInt CommandObserver( CStifItemParser& aResult ); + virtual TInt AddOptionMenuItems( CStifItemParser& aResult ); + virtual TInt BrCtlInitLoadData( CStifItemParser& aResult ); + virtual TInt HandleDownloadCommand( CStifItemParser& aResult ); + virtual TInt VersionInfo( CStifItemParser& aResult ); + virtual TInt WmlOptionMenuItems( CStifItemParser& aResult ); + virtual TInt ImageCount( CStifItemParser& aResult); + virtual TInt PostUrlL( CStifItemParser& aResult); + virtual TInt CreateBrCtlWithWidgetExtensionL( CStifItemParser& aItem ); // Added for Widget Extension Test + virtual TInt TestHistoryHandlerL( CStifItemParser& aItem ); + virtual TInt TestWMLLoadL( CStifItemParser& aItem ); + + /** + * Method used to log version of test class + */ + void SendTestClassVersion(); + + private: // Data + CBrCtlApiTestContainer* iBrCtlTestContainer; + }; + +#endif // BRCTLAPITEST_H + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/inc/BrCtlApiTestContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/inc/BrCtlApiTestContainer.h Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2004 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: CBrCtlApiTestContainer from BrCtlBCTestContainer.h +* +*/ + +#ifndef BRCTLBCTESTCONTAINER_H +#define BRCTLBCTESTCONTAINER_H + +// INCLUDES +#include +#include // interface under test + +#include "BrCtlApiTestObserver.h" +#include "BrCtlApiTestStateChangeObserver.h" +#include "BrCtlApiTestDialogsProvider.h" + +// CONSTATNS +const TInt KThisAppUid = 0xA0000181; + +_LIT( KUrlLoadTestHtml, "c:\\BrCtlTest\\loadtest.html" ); +_LIT( KUrlLoadTestHtml2, "file:///c:\\smoketest\\web\\loadtest2.html" ); +_LIT( KUrlHistoryHandlerHtml1, "file:///c:\\BrCtlTest\\historytest1.html" ); +_LIT( KUrlHistoryHandlerHtml2, "file:///c:\\BrCtlTest\\historytest2.html" ); +_LIT( KUrlHistoryHandlerHtml3, "file:///c:\\BrCtlTest\\historytest3.html" ); +_LIT( KUrlLoadTestWml1, "file:///c:\\BrCtlTest\\loadtest1.wml" ); +_LIT( KUrlLoadTestWml2, "file:///c:\\BrCtlTest\\loadtest2.wml" ); +_LIT( KUrlLoadTestWml3, "file:///c:\\BrCtlTest\\loadtest3.wml" ); + +enum TBrCtlFindResponseExpected + { + EFindNoMatchesExpected = 0, ///< Reserved for future use + EFindMatchExpected, ///< Reserved for future use + EFindMoreMatchesExpected ///< Reserved for future use + }; + + + +// FORWARD DECLARATIONS +//class CBrCtlInterface; + +// CLASS DECLARATION + +/** +* CBrCtlApiTestContainer container control class. +* +*/ +class CBrCtlApiTestContainer : public CCoeControl, + MCoeControlObserver, + MBrCtlDataLoadSupplier, + MBrCtlCommandObserver, + MWidgetCallback // Added for WidgetExtension Test + { + public: // Constructors and destructor + void ConstructL (const TRect& aRect ); + ~CBrCtlApiTestContainer(); + + private: // Functions from base classes + void HandleCommandL( TBrCtlDefs::TBrCtlClientCommands aCommand, const CArrayFix& aAttributesNames, + const CArrayFix& aAttributeValues ); + void SizeChanged(); + TInt CountComponentControls() const; + CCoeControl* ComponentControl( TInt aIndex ) const; + void Draw( const TRect& aRect ) const; + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ); + + /** + * From MBrCtlDataLoadSupplier, Cancel an on-going load + */ + void CancelLoad(); + + // Functions from MWidgetCallback class + TBool DialogMimeFileSelectLC(HBufC*& aSelectedFileName, + const TDesC& aMimeType); + + /** + * Called to show or hide softkeys + * @since 3.1 + * @param aVisible ETrue to show softkeys, EFalse when full screen is needed + */ + void SetSoftkeysVisible(TBool aVisible); + + /** + * Called to change the display orientation to landscape + * @since 3.1 + */ + void SetDisplayMode(TBrCtlDefs::TBrCtlOrientation aOrientation); + + //Reserved for future use + TInt Reserved_1(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_2(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_3(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_4(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_5(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_6(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_7(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_8(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_9(TAny*& a0, TAny* a1, TAny* a2); + TInt Reserved_10(TAny*& a0, TAny* a1, TAny* a2); + + + + public: // New functions + void DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ); + TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); + + public: // Functions utility + HBufC8* ReadFileLC( const TDesC& aFileName ); + void HandleControlEventL( CCoeControl* aControl,TCoeEvent aEventType ); + void RunAllTestsL(); + + public: // Functions to test CBrCtlInterface + void CreateBrowserControlInterfaceL(TInt aBrCtlConfig); //Change done to take a parameter + TInt LoadPageL(); + TInt HandleCommandL(TInt aCommand ); + TInt LoadDataL(); + TInt ClearCacheTest(); + TBool IsUrlInCacheTest( TDesC16& aUrl ); + TInt ClearItemInCacheTest(); + TInt PageInfoLC( TBrCtlDefs::TBrCtlPageInfo aType ); + TInt CertInfo(); + TInt NavigationAvailableTest(); + TInt GetBitmapData(); + TInt SaveToFileL(); + TInt OkToExit(); + TInt FindKeyword( TPtrC aHtml , TPtrC aKeyword , TInt aMatch ); + TInt FindKeywordAgain( TInt aMatch ); + TInt SetFocus(); + TInt OfferKeyEvent(); + TInt BrCtlMinimumSize(); + TInt BrCtlSubscribeToMenuItemsL(); + TInt BrCtlContentSize(); + TInt BrowserSettingL( TUint& aSetting ); + TInt SetBrowserSettingL(); + TInt FocusedImageL(); + TInt AddCommandObserverL(); + TInt RemoveCommandObserver(); + TInt ImageCountL(); + TInt BrCtlFocusedElementTypeL(); + TInt BrCtlSetParam(); + TInt LoadSavedPageL(); + TInt SetSelfDownloadContentTypes(); + TInt ZoomLevels(); + TInt AddOptionMenuItems(); + TInt BrCtlInitLoadDataL(); + TInt HandleDownloadCommand(); + TInt VersionInfoL(); + TInt WmlOptionMenuItemsL(); + TInt BrCtlPostL(); + TInt CreateBrCtlInterfaceAndWidgetExtensionL(); // Added for WidgetExtension Test + TInt HistoryLoad1L(); + TInt HistoryLoad2L(); + TInt HistoryLoad3L(); + TInt WMLLoad1L(); + TInt WMLLoad2L(); + TInt WMLLoad3L(); + + private: //data + CBrCtlInterface* iBrCtlInterface; + TInt iCommandBase; + CBrCtlApiTestObserver* iBrCtlApiTestObserver; + CBrCtlApiTestStateChangeObserver* iBrCtlApiTestStateChangeObserver; + CBrowserDialogsProviderProxy* iBrCtlDialogs; + CEikMenuPane* iMenuPane; + TBool iCancelInitDataLoad; + + // Added for Widget Extension Test + MWidgetExtension* iWidgetExtension; + }; + +#endif // BRCTLBCTESTCONTAINER_H + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/inc/BrCtlApiTestDialogsProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/inc/BrCtlApiTestDialogsProvider.h Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,268 @@ +/* +* 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: Forwards Dialog requests to the BrowserDialogsProvider +* +*/ + + + +#ifndef BROWSERDIALOGSPROVIDERPROXY_H +#define BROWSERDIALOGSPROVIDERPROXY_H + +// INCLUDES + +// User includes + +// System Includes +#include +//#include +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CBrCtlDialogsProvider; +class CBrowserDialogsProviderBlocker; +class CBrowserWindowFocusNotifier; +class CBrowserWindow; +class MBrowserDialogsProviderObserver; + +// CLASS DECLARATION + +/** +* Provide dialogs needed for browser operation +* +* @since 3.0 +*/ +class CBrowserDialogsProviderProxy : public CBase, + public MBrCtlDialogsProvider + { + // Construction/Destruction + public: + + // Two stage constructor + static CBrowserDialogsProviderProxy* NewL( ); + + // Destructor + virtual ~CBrowserDialogsProviderProxy(); + + protected: + + // 1st stage Constructor + CBrowserDialogsProviderProxy( ); + + + // 2nd stage constructor + void ConstructL(); + + public: // From MBrCtlDialogsProvider + + /** + * Notify the user of an error + * @since 3.0 + * @param aErrCode The error that occured + * @return void + */ + virtual void DialogNotifyErrorL( TInt aErrCode ); + + /** + * Notify the user of an http error + * @since 3.0 + * @param aErrCode The error that occured + * @param aUri The uri of the request that failed + * @return void + */ + virtual void DialogNotifyHttpErrorL( TInt aErrCode, + const TDesC& aUri ); + + /** + * File selection dialog + * @since 3.0 + * @param aStartPath The initial displayed directory + * @param aRootPath The top most directory that the user can go up to + * @param aSelectedFileName The selected file name. + * Returned on cleanup stack. Browser control will free the buffer + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogFileSelectLC( const TDesC& aStartPath, + const TDesC& aRootPath, + HBufC*& aSelectedFileName); + + /** + * List selection dialog + * @since 3.0 + * @param aTitle The title, could be empty + * @param aBrowserSelectOptionType The type of the list box + * @param aOptions A list of options to display + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogSelectOptionL( + const TDesC& aTitle, + TBrCtlSelectOptionType aBrowserSelectOptionType, + CArrayFix& aOptions ); + + /** + * User Authentication dialog. + * User name and password are returned on cleanup stack + * @since 3.0 + * @param aUrl The url requiring authentication + * @param aRealm The realm requiring authentication + * @param aDefaultUser/Name The user name that was used before for this + * realm and path, if any + * @param aReturnedUserName The user name entered by the user + * @param aReturnedPasswd The password entered by the user + * @param aBasicAuthentication A flag if basic authentication was used + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogUserAuthenticationLC( + const TDesC& aUrl, + const TDesC& aRealm, + const TDesC& aDefaultUserName, + HBufC*& aReturnedUserName, + HBufC*& aReturnedPasswd, + TBool aBasicAuthentication = EFalse); + + /** + * Display a note to the user. No softkeys + * @since 3.0 + * @param aMessage The message to display + * @return void + */ + virtual void DialogNoteL( const TDesC& aMessage ); + + /** + * Display a note to the user with ok softkey only + * @since 3.0 + * @param aTitle The title, could be empty + * @param aMessage The message to display + * @return void + */ + virtual void DialogAlertL( const TDesC& aTitle, + const TDesC& aMessage ); + + /** + * Display confirmation message to the user + * @since 3.0 + * @param aTitle The title, could be empty + * @param aMessage The message to display + * @param aYesMessage The text to display on left softkey + * @param aNoMessage The text to display on right softkey + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogConfirmL( const TDesC& aTitle, + const TDesC& aMessage, + const TDesC& aYesMessage, + const TDesC& aNoMessage); + + /** + * Display input dialog to the user + * @since 3.0 + * @param aTitle The title, could be empty + * @param aMessage The message to display + * @param aDefaultInput The default input if available + * @param aReturnedInput The input entered by the user + * Returned on the cleanup stack, owned by the calling application + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogPromptLC(const TDesC& aTitle, + const TDesC& aMessage, + const TDesC& aDefaultInput, + HBufC*& aReturnedInput); + + /** + * Display object info and ask confirmation before download + * @since 3.0 + * @param aBrCtlObjectInfo The object info + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogDownloadObjectL( + CBrCtlObjectInfo* aBrCtlObjectInfo ); + + /** + * DIsplay the images that appear in the current page + * @since 3.0 + * @param aPageImages The images that appear in this page + * @return vois + */ + virtual void DialogDisplayPageImagesL( + CArrayFixFlat& aPageImages); + + /** + * Cancel any dialog that is being displayed due to + * e.g. Browser exit or page was destroyed + * @since 3.0 + * @return void + */ + virtual void CancelAll(); + + /** + * Display search on page dialog + * @since 3.0 + * @return void + */ + virtual void DialogFindL() { /* TODO: implement this body!!! */ } ; + + /** + * Mime File selection dialog for specific mime type files + * @since 3.2 + * @param aSelectedFileName The selected file name. + * @param aMimeType The accepted mime type + * Returned on cleanup stack. Browser control will free the buffer + * @return EFalse if the user canceled, ETrue otherwise + */ + virtual TBool DialogMimeFileSelectLC( HBufC*& aSelectedFileName, + const TDesC& aMimeType ); + + + public: // New functions + + /** + * Display a tooltip (info popup note) + * @since 3.0 + * @return void + */ + void ShowTooltipL( const TDesC& aText, TInt aDuration, TInt aDelay ); + + /** + * Display a dialog which tracks upload progress + * @since 3.0 + * @param aTotalSize the total size of a file being uploaded + * @param aChunkSize the size of the current chunk being uploaded + * @param aIsLastChunk boolean value indicating whether the current + * @param aObserver an observer for the upload progress dialog + * chunk is the last one in the entire download + * @return void + */ + void UploadProgressNoteL( + TInt32 aTotalSize, + TInt32 aChunkSize, + TBool aIsLastChunk, + MBrowserDialogsProviderObserver* aObserver ); + + /** + * Callback from Window, indicating that the window is now active + * @since 3.0 + */ + void WindowActivated(); + + // DATA MEMBERS + private: + + TBool iCancelWaitingDialogs; // ETrue means that waiting dialogs should not be displayed when flushed + + }; + +#endif // BROWSERDIALOGSPROVIDERPROXY_H + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/inc/BrCtlApiTestObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/inc/BrCtlApiTestObserver.h Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,296 @@ +/* +* 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: Handle scrollbar and tab events +* +*/ + + + +#ifndef BRCTLBCTESTOBSERVER_H +#define BRCTLBCTESTOBSERVER_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +class CBrCtlApiTestObserver : + public CBase, + public MBrCtlLayoutObserver, + public MBrCtlSoftkeysObserver, + public MBrCtlSpecialLoadObserver, + public MBrCtlLoadEventObserver, + public MBrCtlLinkResolver, + public MBrCtlDownloadObserver, + public MBrCtlWindowObserver // Added for Widget Extension Test + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBrCtlApiTestObserver* NewL(); + + /** + * Destructor. + */ + ~CBrCtlApiTestObserver(); + + + /** + * Update the position of vertical scrollbar. + * @since 2.8 + * @param aDocumentHeight The total height of the markup page + * @param aDisplayHeight The height of the display + * @param aDisplayPosY The current Y position + * @return void + */ + void UpdateBrowserVScrollBarL(TInt /*aDocumentHeight*/, + TInt /*aDisplayHeight*/, + TInt /*aDisplayPosY*/ ) ; + + /** + * Update the position of horizontal scrollbar. + * @since 2.8 + * @param aDocumentWidth The total width of the markup page + * @param aDisplayWidth The width of the display + * @param aDisplayPosX The current X position + * @return void + */ + void UpdateBrowserHScrollBarL(TInt /*aDocumentWidth*/, + TInt /*aDisplayWidth*/, + TInt /*aDisplayPosX*/ ) ; + + /** + * Inform the layout of the page: right to left or left to right. Useful when the application draws the scrollbar itself. + * @since 2.8 + * @param aNewLayout RTL or LTR + * @return void + */ + void NotifyLayoutChange( TBrCtlLayout /*aNewLayout*/ ) ; + + /** + * Update the title of the page in history view + * @since 3.0 + * @param aTitle Title of the page + * @return void + */ + void UpdateTitleL( const TDesC& aTitle ); + + /** + * Browser Control requests to update a softkey + * @since 2.8 + * @param aKeySoftkey Update the left softkey or the right softkey + * @param aLabel The label associated with the softkey update + * @param aCommandId The command to use if the softkey is selected by the user + * @param aBrCtlSoftkeyChangeReason The reason for the softkey change + * @return void + */ + void UpdateSoftkeyL(TBrCtlKeySoftkey /*aKeySoftkey*/, + const TDesC& /*aLabel*/, + TUint32 /*aCommandId*/, + TBrCtlSoftkeyChangeReason /*aBrCtlSoftkeyChangeReason*/) ; + + /** + * Request to create a network connection. + * @since 2.8 + * @param aConnectionPtr A pointer to the new connection. If NULL, the proxy filter will automatically create a network connection + * @param aSockSvrHandle A handle to the socket server. + * @param aNewConn A flag if a new connection was created. If the connection is not new, proxy filter optimization will not read the proxy again from CommsBd + * @param aBearerType The bearer type of the new connection + * @return void + */ + void NetworkConnectionNeededL(TInt* /*aConnectionPtr*/, + TInt* /*aSockSvrHandle*/, + TBool* /*aNewConn*/, + TApBearerType* /*aBearerType*/) ; + + /** + * Request the host applicaion to handle non-http request. + * @since 2.8 + * @param aUrl The non-http(s) or file URL + * @param aParamList Parameters to pass to the host application. Contain referer header. It could be NULL + * @return ETrue is handled by the host application. EFlase if not + */ + TBool HandleRequestL(RArray* aTypeArray, CDesCArrayFlat* aDesArray); + + /** + * Request the host applicaion to handle downloads + * @since 2.8 + * @param aTypeArray array of download parameter types + * @param aDesArray array of values associated with the types in the type array + * @return ETrue is handled by the host application. EFlase if not + */ + TBool HandleDownloadL(RArray* aTypeArray, CDesCArrayFlat* aDesArray); + + /** + * A load events notification + * @since 2.8 + * @param aLoadEvent The load event + * @param aSize Size depends on the event + * @param aTransactionId The transaction id of the transaction that had this event + * @return void + */ + void HandleBrowserLoadEventL(TBrCtlDefs::TBrCtlLoadEvent aLoadEvent, TUint aSize, TUint16 aTransactionId) ; + + /** + * Browser plug-in calls this method when embedded link is found. Used with ECapabilityClientResolveEmbeddedURL + * @since 2.8 + * @param aEmbeddedUrl The url of the embedded content + * @param aCurrentUrl The url of the current page + * @param aLoadContentType The expected type of the embedded content + * @param aEmbeddedLinkContent a callback interface to return the embedded content + * @return EFalse, browser will resolve the link + */ + TBool ResolveEmbeddedLinkL(const TDesC& aEmbeddedUrl, + const TDesC& aCurrentUrl, + TBrCtlLoadContentType aLoadContentType, + MBrCtlLinkContent& aEmbeddedLinkContent) ; + + /** + * Browser plug-in calls this method when the user requests to load content via selecting a link, or any other way. Used with ECapabilityClientNotifyURL + * @since 2.8 + * @param aUrl The requested url + * @param aCurrentUrl The url of the current page + * @param aBrCtlLinkContent a callback interface to return the embedded content + * @return EFalse, browser will resolve the link + */ + TBool ResolveLinkL(const TDesC& aUrl, const TDesC& aCurrentUrl, + MBrCtlLinkContent& aBrCtlLinkContent) ; + + /** + * Cancel all outstanding resolving operations + * @since 2.8 + * @return void + */ + void CancelAll() ; + + /** + * Inform the host application that a new download has started using the Download Manager + * @since 3.0 + * @param aTransactionID The ID of the transaction, it is unique as long as the transaction is on-going + * @param aFileName The name of file in which the content is stored/ + * @param aContentType The content type of the downloaded content + * @param aUrl The Url of the request to be done in the new window + * @return Return ETrue if the file is handled progressively, EFalse otherwise + */ + TBool NewDownloadL(TUint aTransactionID, + const TDesC& aFileName, + const TDesC& aContentType, + const TDesC& aUrl); + + + /** + * Inform the host application that a new download has started using the Download Manager + * @since 3.0 + * @param aTransactionID The ID of the transaction, it is unique as long as the transaction is on-going + * @param aFileName The name of file in which the content is stored/ + * @param aContentType The content type of the downloaded content + * @param aUrl The Url of the request to be done in the new window + * @return Return ETrue if the file is handled progressively, EFalse otherwise + */ + void ResumeDownloadL(TUint aTransactionID, + TUint aLength, + const TDesC& aFileName, + const TDesC& aContentType, + const TDesC& aUrl); + + /** + * Inform the host application of a progress event related to a download + * @since 3.0 + * @param aTransactionID The ID of the transaction, it is unique as long as the transaction is on-going + * @param aDownloadEvent The event to be reported + * @param aValue The value depends on the event + * @return void + */ + void HandleDownloadEventL(TUint aTransactionID, + TBrCtlDownloadEvent aDownloadEvent, + TUint aValue); + + // Functions from CBrCtlWindowObserver class - Added for Widget Extension Test + + /** + * Request the host applicaion to open the URL in a new window + * @since 3.0 + * @param aUrl The Url of the request to be done in the new window + * @param aTargetName The name of the new window + * @param aUserInitiated ETrue if the new window is initiated by a user event (click) + * @param aMethod The method to be used for fetching the supplied url + * @param aContentType If the method is POST, this is the content type of the data to be posted + * @param aPostData If the method is POST, this is the data to be posted + * @param aBoundary The boundary used if the content is multipart/form-data + * @param aReserved For future use + * @return Return Value is the new browser control associated with the new window + */ + CBrCtlInterface* OpenWindowL(TDesC& aUrl, TDesC* aTargetName, TBool aUserInitiated, + TAny* aReserved); + + /** + * Find a window by target name + * @since 3.0 + * @param aTargetName name of the window to find + * @return Return Value is the browser control associated with the window name + */ + CBrCtlInterface* FindWindowL( const TDesC& aTargetName ) const; + + /** + * Handle window events such as close/focus etc + * @since 3.0 + * @param aTargetName name of the window to send the event to + * @param aCommand Command to pass to the window + * @return void + */ + void HandleWindowCommandL( const TDesC& aTargetName, TBrCtlWindowCommand aCommand ); + + private: + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Find if the scheme if file:// + */ + TBool IsFileScheme(const TDesC& aFileName); + + /** + * Read the file. + */ + HBufC8* ReadFileLC(const TDesC& aFileName); + + /** + * Rcognize the mime type. + */ + HBufC* RecognizeLC(const TDesC& aFileName, const TDesC8& aData); + + /** + * Translate the file name from a URL to a valid file name in the system.. + */ + TBool GetFileNameL(const TDesC& aFileName); + + private: // data + + // The loaded file's name. This is different from the URL. It does not contain the scheme. + HBufC* iFileName; + CDocumentHandler* iHandler; + }; + +#endif // BRCTLBCTESTOBSERVER_H + +// End of File + diff -r e904b452aa85 -r 235c00e46fb7 browser/inc/BrCtlApiTestStateChangeObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/inc/BrCtlApiTestStateChangeObserver.h Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,74 @@ +/* +* 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: Handle state changed events +* +*/ + + + +#ifndef BRCTLBCTESTSTATECHANGEOBSERVER_H +#define BRCTLBCTESTSTATECHANGEOBSERVER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CBrCtlApiTestContainer; + +// CLASS DECLARATION + +/** +* CBrCtlApiTestStateChangeObserver class. +* This class inherits from the MBrCtlStateChangeObserver interface which is used to +* receive state-changed events. +*/ +class CBrCtlApiTestStateChangeObserver : public CBase, public MBrCtlStateChangeObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CBrCtlApiTestStateChangeObserver* NewL(CBrCtlApiTestContainer* aContainer); + + /** + * Destructor. + */ + ~CBrCtlApiTestStateChangeObserver(); + + /** + * A state change events notification + * @since 2.8 + * @param aState The state, currently the only state is EStateImageMapView + * @param aValue This value will be true if we going to image map view and + * it will be false if we are returning from image map view + * @return void + */ + void StateChanged(TBrCtlDefs::TBrCtlState aState, TInt aValue); + + private: + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(CBrCtlApiTestContainer* aContainer); + + private: // data + // Pointer to the container class associated with this observer + CBrCtlApiTestContainer* iContainer; + }; + +#endif // BRCTLBCTESTSTATECHANGEOBSERVER_H + +// End of File + diff -r e904b452aa85 -r 235c00e46fb7 browser/init/testframework.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/init/testframework.ini Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,166 @@ +# +# 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 + +UITestingSupport= Yes +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= MyExampleMyExampleMyExample +# 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= testscripter +TestCaseFile= c:\testframework\ui_browser_control_api.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= TXT # 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 diff -r e904b452aa85 -r 235c00e46fb7 browser/src/BrCtlApiTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/src/BrCtlApiTest.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,153 @@ +/* +* 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 FILES +#include +#include "BrCtlApiTest.h" +#include + +// ============================= LOCAL FUNCTIONS =============================== + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::CBrowserControlApiTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CBrowserControlApiTest::CBrowserControlApiTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CBrowserControlApiTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KBrCtlApiTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KBrCtlApiTestLogFile); + } + + iLog = CStifLogger::NewL( KBrCtlApiTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + SendTestClassVersion(); + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CBrowserControlApiTest* CBrowserControlApiTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CBrowserControlApiTest* self = new (ELeave) CBrowserControlApiTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + + } + +// Destructor +CBrowserControlApiTest::~CBrowserControlApiTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +//----------------------------------------------------------------------------- +// CBrowserControlApiTest::SendTestClassVersion +// Method used to send version of test class +//----------------------------------------------------------------------------- +// +void CBrowserControlApiTest::SendTestClassVersion() + { + TVersion moduleVersion; + moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; + moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; + moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; + + TFileName moduleName; + moduleName = _L("BrCtlApiTest.dll"); + + TBool newVersionOfMethod = ETrue; + TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CBrowserControlApiTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/src/BrCtlApiTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/src/BrCtlApiTestBlocks.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,1209 @@ +/* +* Copyright (c) 2002 - 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: ?Description +* +*/ + + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "BrCtlApiTest.h" + +#define RETURN_FAILURE_ON_ERROR \ + if ( err ) \ + { \ + return KErrNone; \ + } + +// ============================= LOCAL FUNCTIONS =============================== + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CBrowserControlApiTest::Delete() + { + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::RunMethodL(CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "Example", CBrowserControlApiTest::ExampleL ), + ENTRY( "CreateBrowserControl", CBrowserControlApiTest::CreateBrCtlL ), + ENTRY( "DestroyBrowserControl", CBrowserControlApiTest::DestroyBrowserControlL ), + ENTRY( "ZoomLevels", CBrowserControlApiTest::ZoomLevels ), + ENTRY( "HandleCommand", CBrowserControlApiTest::HandleCommandL ), + ENTRY( "SavedPage", CBrowserControlApiTest::SavedPageL ), + ENTRY( "LoadData", CBrowserControlApiTest::LoadData ), + ENTRY( "CertInfo", CBrowserControlApiTest::CertInfo ), + ENTRY( "NavigationAvailable", CBrowserControlApiTest::NavigationAvailable ), + ENTRY( "PageInfo", CBrowserControlApiTest::PageInfo ), + ENTRY( "EmptyCache", CBrowserControlApiTest::EmptyCache ), + ENTRY( "GetBitmapData", CBrowserControlApiTest::GetBitmapData ), + ENTRY( "SaveToFile", CBrowserControlApiTest::SaveToFile ), + ENTRY( "OkToExit", CBrowserControlApiTest::OkToExit ), + ENTRY( "FindKeyword", CBrowserControlApiTest::FindKeyword ), + ENTRY( "MinimumSize", CBrowserControlApiTest::MinimumSize ), + ENTRY( "OfferKeyEvent", CBrowserControlApiTest::OfferKeyEvent ), + ENTRY( "BrCtlSubscribeToMenuItems", CBrowserControlApiTest::BrCtlSubscribeToMenuItemsL ), + ENTRY( "ContentSize", CBrowserControlApiTest::ContentSize ), + ENTRY( "BrCtlSettings", CBrowserControlApiTest::BrCtlSettings ), + ENTRY( "FocusedImage", CBrowserControlApiTest::FocusedImage ), + ENTRY( "CommandObserver", CBrowserControlApiTest::CommandObserver ), + ENTRY( "FocusedElementType", CBrowserControlApiTest::FocusedElementType ), + ENTRY( "BrCtlSetParam", CBrowserControlApiTest::BrCtlSetParam ), + ENTRY( "SetSelfDownloadContentTypes", CBrowserControlApiTest::SetSelfDownloadContentTypes ), + ENTRY( "AddOptionMenuItems", CBrowserControlApiTest::AddOptionMenuItems ), + ENTRY( "BrCtlInitLoadData", CBrowserControlApiTest::BrCtlInitLoadData ), + ENTRY( "HandleDownloadCommand", CBrowserControlApiTest::HandleDownloadCommand ), + ENTRY( "VersionInfo", CBrowserControlApiTest::VersionInfo ), + ENTRY( "WmlOptionMenuItems", CBrowserControlApiTest::WmlOptionMenuItems ), + ENTRY( "ImageCount", CBrowserControlApiTest::ImageCount), + ENTRY( "PostUrl", CBrowserControlApiTest::PostUrlL), + // Added for Widget Extension Test + ENTRY( "CreateBrCtlWithWidgetExtension", CBrowserControlApiTest::CreateBrCtlWithWidgetExtensionL), + ENTRY( "HistoryHandler", CBrowserControlApiTest::TestHistoryHandlerL ), + ENTRY( "WMLLoad", CBrowserControlApiTest::TestWMLLoadL ) + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + +// TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksMem ); +// TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); +// TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); + + return RunInternalL( KFunctions, count, aItem ); + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::ExampleL +// Example test method function. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::ExampleL( CStifItemParser& aItem ) + { + + // Print to UI + _LIT( KMyExample, "MyExample" ); + _LIT( KExample, "In ExampleL" ); + TestModuleIf().Printf( 0, KMyExample, KExample ); + // Print to log file + iLog->Log( KExample ); + + TInt i = 0; + TPtrC string; + _LIT( KParam, "Param[%i]: %S" ); + while ( aItem.GetNextString ( string ) == KErrNone ) + { + TestModuleIf().Printf( i, KMyExample, + KParam, i, &string ); + i++; + } + + // test block + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::CreateBrCtlL +// Creates a browser control contained within iBrCtlTestContainer +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::CreateBrCtlL( + CStifItemParser& aItem ) + { + TInt err( KErrNone ); + TInt aBrCtlConfig = 0x0000; + + TPtrC string; + + TPoint base( 0, 0 ); + TPoint extent( 252, 195 ); + TRect rect( base, extent ); + + + // To test for different configurations of the Browser control + + while ( aItem.GetNextString ( string ) == KErrNone ) + { + if ( string.Compare(_L("DisplayScrollBar"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilityDisplayScrollBar; + } + if ( string.Compare(_L("ClientResolveEmbeddedURL"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilityClientResolveEmbeddedURL; + } + if ( string.Compare(_L("ClientNotifyURL"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilityClientNotifyURL ; + } + if ( string.Compare(_L("DisableInputAndPlugins"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilityDisableInputAndPlugins; + } + if ( string.Compare(_L("FindItem"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilityFindItem; + } + if ( string.Compare(_L("LoadHttpFw"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilityLoadHttpFw; + } + if ( string.Compare(_L("SavedPage"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilitySavedPage; + } + if ( string.Compare(_L("GraphicalHistory"))==0) + { + aBrCtlConfig = aBrCtlConfig | TBrCtlDefs::ECapabilityGraphicalHistory; + } + + } + + if ( aBrCtlConfig == 0x0000 ) + aBrCtlConfig = TBrCtlDefs::ECapabilityDisplayScrollBar | + TBrCtlDefs::ECapabilityClientResolveEmbeddedURL | + TBrCtlDefs::ECapabilityLoadHttpFw | + TBrCtlDefs::ECapabilitySavedPage | + TBrCtlDefs::ECapabilityDisplayScrollBar ; + + TRAP( err, + iBrCtlTestContainer = new (ELeave) CBrCtlApiTestContainer; + iBrCtlTestContainer->ConstructL( rect ); + iBrCtlTestContainer->CreateBrowserControlInterfaceL(aBrCtlConfig); + ); + + if ( err ) + { + delete iBrCtlTestContainer; + iBrCtlTestContainer = 0; + return KErrNone; + } + + // Great, now set the focus of the browser control + iBrCtlTestContainer->SetFocus(); + iBrCtlTestContainer->DrawNow(); + + // test block executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::DestroyBrowserControlL +// Deletes iBrCtlTestContainer which causes the browser control to be deleted. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::DestroyBrowserControlL( + CStifItemParser& /* aItem */ ) + { + delete iBrCtlTestContainer; + iBrCtlTestContainer = 0; + + // test block executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::ZoomLevels +// BC Test that ZoomLevels() works. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::ZoomLevels( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->ZoomLevels(); + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::HandleCommandL +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::HandleCommandL( CStifItemParser& aItem ) + { + TPtrC string; + if ( iBrCtlTestContainer ) + if ( aItem.GetNextString ( string ) == KErrNone ) + { + if (string.Compare(_L("Disconnect1"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandDisconnect ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("CancelFetch"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandCancelFetch ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Open"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandOpen ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Reload"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandReload ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Back"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandBack ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Forward"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandForward ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ClearHistory"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandClearHistory ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ShowHistory"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandShowHistory ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Disconnect2"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandDisconnect ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Accept"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandAccept ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Cancel"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandCancel ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("OpenToViewer1"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandOpenToViewer ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("AddToPhoneBook"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandAddToPhoneBook ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("MakeCall"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandMakeCall ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("RemoveFileName"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandRemoveFileName ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ShowImages"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandShowImages ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("LoadImages"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandLoadImages ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("GainFocus"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandGainFocus ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("LoseFocus"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandLoseFocus ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FindItem"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandFindItem ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FindItemPhoneNumber"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandFindItemPhoneNumber ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FindItemEMail"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandFindItemEMail ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FindItemAddress"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandFindItemAddress ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FindKeyword"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandFindKeyword ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ClearFind"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandClearFind ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ShowThumbnailView"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandShowThumbnailView ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("OneStepBack"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandOneStepBack ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ShowHistory"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandShowHistory ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("AppForeground"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandAppForeground ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("AppBackground"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandAppBackground ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("OpenNewWindow"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandOpenNewWindow ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("OpenToViewer2"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandOpenToViewer ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ClearAutoFormFillData"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandClearAutoFormFillData ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ClearAutoFormFillPasswordData"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandClearAutoFormFillPasswordData ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("RemoveFileName"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandRemoveFileName ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FreeMemory"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandFreeMemory ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("MemoryGood"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandMemoryGood ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("DumpRenderTree"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandDumpRenderTree ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("UnloadWMLEngine"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandUnloadWMLEngine ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("SmartLinkMakeCall"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandSmartLinkMakeCall ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("SmartLinkSendMessage"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandSmartLinkSendMessage ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("SmartLinkAddToPhoneBook"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandSmartLinkAddToPhoneBook ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ShowToolBar"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandShowToolBar ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("SmartLinkSendEmail"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandSmartLinkSendEmail ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("UnLoadPluginWindows"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandUnLoadPluginWindows ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FindItemVoIPAddress"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandFindItemVoIPAddress ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("SmartLinkMakeVoipCall"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandSmartLinkMakeVoipCall ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ZoomSliderHide"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandZoomSliderHide ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("EnterFullscreenBrowsing"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandEnterFullscreenBrowsing ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("LeaveFullscreenBrowsing"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandLeaveFullscreenBrowsing ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ShowDownloads"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandShowDownloads ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("SaveLaunchParams"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandSaveLaunchParams ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ShowAnchorHref"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandShowAnchorHref ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("LoadFocusedImage"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandLoadFocusedImage ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("ZoomSliderShow"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandZoomSliderShow ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("HistoryNavigateForward"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandHistoryNavigateForward ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("HistoryNavigateBack"))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL( TBrCtlDefs::ECommandHistoryNavigateBack ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L(""))==0) + { + TRAPD( err, iBrCtlTestContainer->HandleCommandL(NULL) ); + RETURN_FAILURE_ON_ERROR + } + } + + // test block + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::LoadData +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::LoadData( CStifItemParser& /* aItem */ ) + { + TInt err( KErrNone ); + if ( iBrCtlTestContainer ) + { + TRAP( err, iBrCtlTestContainer->LoadDataL() ); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::SavedPageL +// BC Test that LoadSavedPageL works. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::SavedPageL( CStifItemParser& /* aItem */) + { + iBrCtlTestContainer->LoadSavedPageL(); + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::CertInfo +// BC Test that CertInfo works. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::CertInfo( CStifItemParser& /* aItem */) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->CertInfo(); + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::SetSelfDownloadContentTypes +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::SetSelfDownloadContentTypes( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->SetSelfDownloadContentTypes(); + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::NavigationAvailable +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::NavigationAvailable( CStifItemParser& /* aItem */) + { + TInt err = iBrCtlTestContainer->NavigationAvailableTest(); + RETURN_FAILURE_ON_ERROR + + // Now load first page - still should not be able to go back... + TRAP(err, iBrCtlTestContainer->LoadSavedPageL() ); + RETURN_FAILURE_ON_ERROR + err = iBrCtlTestContainer->NavigationAvailableTest(); + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::PageInfo +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::PageInfo( CStifItemParser& aItem ) + { + TPtrC string; + if ( iBrCtlTestContainer ) + if ( aItem.GetNextString ( string ) == KErrNone ) + { + if (string.Compare(_L("Title"))==0) + { + TRAPD( err, iBrCtlTestContainer->PageInfoLC( TBrCtlDefs::EPageInfoTitle ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Url"))==0) + { + TRAPD( err, iBrCtlTestContainer->PageInfoLC( TBrCtlDefs::EPageInfoUrl ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("FocusedNodeUrl"))==0) + { + TRAPD( err, iBrCtlTestContainer->PageInfoLC( TBrCtlDefs::EPageInfoFocusedNodeUrl ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Content"))==0) + { + TRAPD( err, iBrCtlTestContainer->PageInfoLC( TBrCtlDefs::EPageInfoContent ) ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("SavedPage"))==0) + { + TRAPD( err, iBrCtlTestContainer->PageInfoLC( TBrCtlDefs::EPageInfoSavedPage ) ); + RETURN_FAILURE_ON_ERROR + } + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::EmptyCache +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::EmptyCache( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TInt err = iBrCtlTestContainer->ClearCacheTest(); + RETURN_FAILURE_ON_ERROR + TBool inCache = iBrCtlTestContainer->IsUrlInCacheTest( ( TDesC16 & )KUrlLoadTestHtml() ); + if ( inCache ) + { + return KErrNone; + } + err = iBrCtlTestContainer->ClearItemInCacheTest(); + RETURN_FAILURE_ON_ERROR + + // Now try loading a page + TRAP( err, iBrCtlTestContainer->LoadDataL() ); + RETURN_FAILURE_ON_ERROR + // Now the url should be in the cache + inCache = iBrCtlTestContainer->IsUrlInCacheTest( ( TDesC16 & )KUrlLoadTestHtml() ); + if ( !inCache ) + { + return KErrNone; + } + err = iBrCtlTestContainer->ClearItemInCacheTest(); + RETURN_FAILURE_ON_ERROR + // Now the url should expunged from the cache + inCache = iBrCtlTestContainer->IsUrlInCacheTest( ( TDesC16 & )KUrlLoadTestHtml() ); + if ( inCache ) + { + return KErrNone; + } + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::GetBitmapData +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::GetBitmapData( CStifItemParser& /* aItem */ ) + { + TRAPD( err, iBrCtlTestContainer->LoadDataL() ); + RETURN_FAILURE_ON_ERROR + + TRAP( err, + if ( iBrCtlTestContainer ) + { + err = iBrCtlTestContainer->GetBitmapData(); + } + ) + // test executed + return err; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::SaveToFile +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::SaveToFile( CStifItemParser& /* aItem */ ) + { + TInt err( KErrNone ); + if ( iBrCtlTestContainer ) + { + TRAP( err, iBrCtlTestContainer->SaveToFileL() ); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::OkToExit +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::OkToExit( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->OkToExit(); + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::OfferKeyEvent +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::OfferKeyEvent( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->OfferKeyEvent(); + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::MinimumSize +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::MinimumSize( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->BrCtlMinimumSize(); + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::FocusedElementType +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::FocusedElementType( CStifItemParser& /* aItem */ ) + { + TInt err( KErrNone ); + if ( iBrCtlTestContainer ) + { + TRAP( err, err = iBrCtlTestContainer->BrCtlFocusedElementTypeL() ); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::ContentSize +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::ContentSize( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->BrCtlContentSize(); + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::BrCtlSetParam +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::BrCtlSetParam( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + iBrCtlTestContainer->BrCtlSetParam(); + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::BrCtlSubscribeToMenuItemsL +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::BrCtlSubscribeToMenuItemsL( CStifItemParser& /* aItem */ ) + { + TInt err( KErrNone ); + if ( iBrCtlTestContainer ) + { + TRAP(err, err = iBrCtlTestContainer->BrCtlSubscribeToMenuItemsL() ); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::FocusedImage +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::FocusedImage( CStifItemParser& /* aItem */ ) + { + TRAPD( err, err = iBrCtlTestContainer->FocusedImageL() ); + RETURN_FAILURE_ON_ERROR + + const TInt KExpectedImageCount( 1 ); + + TInt actualCount( KErrNotFound ); + + TRAP( err, actualCount = iBrCtlTestContainer->ImageCountL() ); + if ( err || ( actualCount != KExpectedImageCount ) ) + { + return KErrNone; + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::BrCtlSettings +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::BrCtlSettings( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TRAPD(err, + err = iBrCtlTestContainer->SetBrowserSettingL(); + RETURN_FAILURE_ON_ERROR + TUint result = 0; + err = iBrCtlTestContainer->BrowserSettingL( result ); + if ( err || result ) + { + return KErrNone; + } + ) // TRAP + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::FindKeyword +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::FindKeyword( CStifItemParser& aItem ) + { + + TPtrC html; + TPtrC keyword; + TInt match; + + TInt err ( KErrNone ); + + if ( iBrCtlTestContainer ) + { + + //if ( aItem.GetNextString ( html ) == KErrNone ) + if ( (err = aItem.GetNextString ( keyword )) == KErrNone ) + if ( (err = aItem.GetNextInt ( match )) == KErrNone ) + { + + } + + err = iBrCtlTestContainer->FindKeyword( html, keyword, match ); + RETURN_FAILURE_ON_ERROR + err = iBrCtlTestContainer->FindKeywordAgain( match ); + RETURN_FAILURE_ON_ERROR + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::CommandObserver +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::CommandObserver( CStifItemParser& /* aItem */ ) + { + TInt ret(KErrGeneral); + + if ( iBrCtlTestContainer ) + { + TRAPD(err, ret = iBrCtlTestContainer->AddCommandObserverL() ); + if ( err || !ret ) + { + err = iBrCtlTestContainer->RemoveCommandObserver(); + return KErrNone; + } + err = iBrCtlTestContainer->RemoveCommandObserver(); + RETURN_FAILURE_ON_ERROR + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::AddOptionMenuItems +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::AddOptionMenuItems( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TRAPD(err, iBrCtlTestContainer->LoadDataL() ); + RETURN_FAILURE_ON_ERROR + + err = iBrCtlTestContainer->AddOptionMenuItems(); + RETURN_FAILURE_ON_ERROR + } + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::BrCtlInitLoadData +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::BrCtlInitLoadData( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TRAPD(err, iBrCtlTestContainer->BrCtlInitLoadDataL() ); + RETURN_FAILURE_ON_ERROR + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::HandleDownloadCommand +// BC Test that all browser commands work. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::HandleDownloadCommand( CStifItemParser& /* aItem */) + { + if ( iBrCtlTestContainer ) + { + TInt err = iBrCtlTestContainer->HandleDownloadCommand(); + RETURN_FAILURE_ON_ERROR + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::VersionInfo +// This BrCtl API function does nothing! +// BC Test that this function still works. +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::VersionInfo( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TRAPD( err, err = iBrCtlTestContainer->VersionInfoL() ); + RETURN_FAILURE_ON_ERROR + } + + // test executed + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::WmlOptionMenuItem +// +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::WmlOptionMenuItems( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TRAPD( err, err = iBrCtlTestContainer->WmlOptionMenuItemsL() ); + RETURN_FAILURE_ON_ERROR + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::ImageCount +// +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::ImageCount( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TRAPD( err, err = iBrCtlTestContainer->ImageCountL() ); + RETURN_FAILURE_ON_ERROR + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::PostUrlL +// +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::PostUrlL( CStifItemParser& /* aItem */ ) + { + if ( iBrCtlTestContainer ) + { + TRAPD( err, err = iBrCtlTestContainer->BrCtlPostL() ); + RETURN_FAILURE_ON_ERROR + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::CreateBrCtlWithWidgetExtensionL +// Creates a browser control with widget extension contained within iBrCtlTestContainer +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::CreateBrCtlWithWidgetExtensionL( + CStifItemParser& aItem ) + { + TInt err( KErrNone ); + + TInt aBrCtlConfig = 0x0000; + + TPtrC string; + + TPoint base( 0, 0 ); + TPoint extent( 252, 195 ); + TRect rect( base, extent ); + + TRAP( err, + iBrCtlTestContainer = new (ELeave) CBrCtlApiTestContainer; + iBrCtlTestContainer->ConstructL( rect ); + err = iBrCtlTestContainer->CreateBrCtlInterfaceAndWidgetExtensionL(); + ); + + if ( err ) + { + delete iBrCtlTestContainer; + iBrCtlTestContainer = 0; + return KErrNone; + } + + // Great, now set the focus of the browser control + iBrCtlTestContainer->SetFocus(); + iBrCtlTestContainer->DrawNow(); + + // test block executed + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::TestHistoryHandlerL +// Load several pages in an attempt to indirectly exercise History Handler +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::TestHistoryHandlerL( CStifItemParser& aItem ) + { + TPtrC string; + if ( iBrCtlTestContainer ) + { + if ( aItem.GetNextString ( string ) == KErrNone ) + { + if (string.Compare(_L("Page1"))==0) + { + TRAPD( err, iBrCtlTestContainer->HistoryLoad1L() ); + RETURN_FAILURE_ON_ERROR + } + + if (string.Compare(_L("Page2"))==0) + { + TRAPD( err, iBrCtlTestContainer->HistoryLoad2L() ); + RETURN_FAILURE_ON_ERROR + } + + if (string.Compare(_L("Page3"))==0) + { + TRAPD( err, iBrCtlTestContainer->HistoryLoad3L() ); + RETURN_FAILURE_ON_ERROR + } + } + } + + // test executed + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CBrowserControlApiTest::TestWMLLoadL +// Load a WML page in an attempt to indirectly exercise WML functionality +// ----------------------------------------------------------------------------- +// +TInt CBrowserControlApiTest::TestWMLLoadL( CStifItemParser& aItem ) + { + TPtrC string; + if ( iBrCtlTestContainer ) + { + if ( aItem.GetNextString ( string ) == KErrNone ) + { + if (string.Compare(_L("Page1"))==0) + { + TRAPD( err, iBrCtlTestContainer->WMLLoad1L() ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Page2"))==0) + { + TRAPD( err, iBrCtlTestContainer->WMLLoad2L() ); + RETURN_FAILURE_ON_ERROR + } + if (string.Compare(_L("Page3"))==0) + { + TRAPD( err, iBrCtlTestContainer->WMLLoad3L() ); + RETURN_FAILURE_ON_ERROR + } + } + } + + // test executed + return KErrNone; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r e904b452aa85 -r 235c00e46fb7 browser/src/BrCtlApiTestContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/src/BrCtlApiTestContainer.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,941 @@ +/* +* 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: CBrCtlApiTestContainer from BrCtlBCTestContainer.h +* +*/ + +// INCLUDE FILES +#include "BrCtlApiTestContainer.h" + +#include // for example label control +#include +#include +#include +#include +#include "BrCtlApiTestObserver.h" +#include + +_LIT8( KContentDataType, "text/html" ); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrCtlApiTestContainer::ConstructL(const TRect& aRect) +// EPOC two phased constructor +// --------------------------------------------------------- +// +void CBrCtlApiTestContainer::ConstructL(const TRect& aRect) + { + iBrCtlApiTestObserver = CBrCtlApiTestObserver::NewL(); + iBrCtlApiTestStateChangeObserver = CBrCtlApiTestStateChangeObserver::NewL( this ); + iBrCtlDialogs = CBrowserDialogsProviderProxy::NewL(); + iCommandBase = TBrCtlDefs::ECommandIdBase; + CreateWindowL(); + SetRect(aRect); + ActivateL(); + } + +// Destructor +CBrCtlApiTestContainer::~CBrCtlApiTestContainer() + { + + if (iBrCtlInterface) + { + iBrCtlInterface->RemoveLoadEventObserver(iBrCtlApiTestObserver); + iBrCtlInterface->RemoveStateChangeObserver(iBrCtlApiTestStateChangeObserver); + delete iBrCtlInterface; + } + + delete iBrCtlApiTestStateChangeObserver; + delete iBrCtlApiTestObserver; + delete iBrCtlDialogs; + } + +void CBrCtlApiTestContainer::CancelLoad() + { + iCancelInitDataLoad = ETrue; + } + +TInt CBrCtlApiTestContainer::LoadPageL() + { + if(iBrCtlInterface) + { + iBrCtlInterface->LoadUrlL(KUrlLoadTestHtml2); + } + + return KErrNone; + } + +// --------------------------------------------------------- +// CBrCtlApiTestContainer::SizeChanged() +// Called by framework when the view size is changed +// --------------------------------------------------------- +// +void CBrCtlApiTestContainer::SizeChanged() + { + if (iBrCtlInterface) + { + iBrCtlInterface->SetRect(Rect()); + } + } + +// --------------------------------------------------------- +// CBrCtlApiTestContainer::CountComponentControls() const +// --------------------------------------------------------- +// +TInt CBrCtlApiTestContainer::CountComponentControls() const + { + if (iBrCtlInterface) + return 1; + return 0; + } + +// --------------------------------------------------------- +// CBrCtlApiTestContainer::ComponentControl(TInt aIndex) const +// --------------------------------------------------------- +// +CCoeControl* CBrCtlApiTestContainer::ComponentControl(TInt aIndex) const + { + switch ( aIndex ) + { + case 0: + return iBrCtlInterface; // Could be NULL + default: + return NULL; + } + } + +// --------------------------------------------------------- +// CBrCtlApiTestContainer::Draw(const TRect& aRect) const +// --------------------------------------------------------- +// +void CBrCtlApiTestContainer::Draw(const TRect& aRect) const + { + CWindowGc& gc = SystemGc(); + // TODO: Add your drawing code here + // example code... + gc.SetPenStyle(CGraphicsContext::ENullPen); + gc.SetBrushColor(KRgbGray); + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.DrawRect(aRect); + + } + +// --------------------------------------------------------- +// CBrCtlApiTestContainer::HandleControlEventL( +// CCoeControl* aControl,TCoeEvent aEventType) +// --------------------------------------------------------- +// +void CBrCtlApiTestContainer::HandleControlEventL( + CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/) + { + // TODO: Add your control event handler code here + } + + + +// ---------------------------------------------------- +// CBrCtlApiTestContainer::HandleKeyEventL( +// const TKeyEvent& aKeyEvent,TEventCode /*aType*/) +// ?implementation_description +// ---------------------------------------------------- +// +TKeyResponse CBrCtlApiTestContainer::HandleKeyEventL( + const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// ---------------------------------------------------- +// CBrCtlApiTestContainer::HandleCommandL(TInt aCommand) +// ?implementation_description +// ---------------------------------------------------- +// +TInt CBrCtlApiTestContainer::HandleCommandL( TInt aCommand ) + { + const TInt KCommandIdBase( 15000 ); + iBrCtlInterface->HandleCommandL( aCommand + KCommandIdBase ); + return KErrNone; + } + +TKeyResponse CBrCtlApiTestContainer::OfferKeyEventL(const TKeyEvent& /* aKeyEvent */, + TEventCode /* aType */ ) + { + return EKeyWasConsumed; + } + +void CBrCtlApiTestContainer::HandleCommandL( + TBrCtlDefs::TBrCtlClientCommands /* aCommand */, + const CArrayFix& /* aAttributesNames */, + const CArrayFix& /* aAttributeValues */ ) + { + } + + +void CBrCtlApiTestContainer::CreateBrowserControlInterfaceL(TInt aBrCtlConfig) + { + TPoint base( 0, 0 ); + TPoint extent( 352, 295 ); + TRect rect( base, extent ); + + iBrCtlInterface = CreateBrowserControlL( this, rect, + aBrCtlConfig, + iCommandBase, iBrCtlApiTestObserver, iBrCtlApiTestObserver, + iBrCtlApiTestObserver, iBrCtlApiTestObserver, iBrCtlDialogs, NULL, iBrCtlApiTestObserver ); + + iBrCtlInterface->MakeVisible( ETrue ); + + } + +HBufC8* CBrCtlApiTestContainer::ReadFileLC( const TDesC& aFileName ) + { + RFs rfs; + RFile file; + User::LeaveIfError( rfs.Connect() ); + CleanupClosePushL( rfs ); + User::LeaveIfError( file.Open( rfs, aFileName, EFileRead ) ); + CleanupClosePushL( file ); + TInt size; + User::LeaveIfError( file.Size( size ) ); + HBufC8* buf = HBufC8::NewLC( size ); + TPtr8 bufPtr( buf->Des() ); + User::LeaveIfError( file.Read( bufPtr ) ); + CleanupStack::Pop(); // buf + CleanupStack::PopAndDestroy( 2 ); // file, rfs + CleanupStack::PushL( buf ); + return buf; + } + +TInt CBrCtlApiTestContainer::LoadDataL() + { + HBufC8* data = ReadFileLC( KUrlLoadTestHtml ); + TDataType dataType( KContentDataType() ); + TUid uid; + uid.iUid = KCharacterSetIdentifierIso88591; + TRAPD( err, iBrCtlInterface->LoadDataL( KUrlLoadTestHtml, *data, dataType, uid ) ); + + CleanupStack::PopAndDestroy( data ); + + return err; + } + +TInt CBrCtlApiTestContainer::ClearCacheTest() + { + const TUint result = iBrCtlInterface->ClearCache(); + + return KErrNone; + } + +TBool CBrCtlApiTestContainer::IsUrlInCacheTest( TDesC16& aUrl ) + { + const TBool result = iBrCtlInterface->IsUrlInCache( aUrl ); // ( TDesC16 & )KUrlLoadTestHtml() ); + + return result; + } + +TInt CBrCtlApiTestContainer::ClearItemInCacheTest() + { + TInt result = iBrCtlInterface->ClearItemInCache( (TDesC16 &) KUrlLoadTestHtml() ); + + if ( ( result == KErrNotFound ) || ( result == KErrNone ) ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::PageInfoLC( TBrCtlDefs::TBrCtlPageInfo aType ) + { + iBrCtlInterface->LoadFileL( KUrlLoadTestHtml ); + + TRAPD( err, + HBufC* url = iBrCtlInterface->PageInfoLC( aType ); + CleanupStack::PopAndDestroy( url ); + ) + + return err; + } + +TInt CBrCtlApiTestContainer::CertInfo() + { + const TCertInfo* certInfo = iBrCtlInterface->CertInfo(); + + if ( !certInfo ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::NavigationAvailableTest() + { + const TBool nav = iBrCtlInterface->NavigationAvailable( + TBrCtlDefs::ENavigationBack ); + + if ( nav == 0 || nav == 1 ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::GetBitmapData() + { + + TRAPD( err, iBrCtlInterface->LoadUrlL(KUrlLoadTestHtml2) ); + + //waits for browser control to load the page + User::After(4000000); + + CGulIcon* icon = iBrCtlInterface->GetBitmapData( KUrlLoadTestHtml, TBrCtlDefs::EBitmapFavicon ); + icon = iBrCtlInterface->GetBitmapData( KUrlLoadTestHtml, TBrCtlDefs::EBitmapThumbnail ); + return err; + } + +TInt CBrCtlApiTestContainer::SaveToFileL() + { + HBufC8* data = ReadFileLC( KUrlLoadTestHtml ); + TDataType dataType( KContentDataType() ); + TUid uid; + uid.iUid = KCharacterSetIdentifierIso88591; + TRAPD( err, iBrCtlInterface->LoadDataL( KUrlLoadTestHtml, *data, dataType, uid ) ); + + TUint16 NoOfBytesSaved = iBrCtlInterface->SaveToFileL( KUrlLoadTestHtml ); + + CleanupStack::PopAndDestroy( data ); + return err; + } + +TInt CBrCtlApiTestContainer::OkToExit() + { + const TBool res = iBrCtlInterface->OkToExit(); + + if ( res ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::FindKeyword( TPtrC aHtml, TPtrC aKeyword, TInt aMatch) + { + TRAP_IGNORE( iBrCtlInterface->LoadFileL( KUrlLoadTestHtml2 ) ); + + TInt result = iBrCtlInterface->FindKeyword( aKeyword ); + + if ( result == TBrCtlDefs::EFindNoMatches && aMatch == EFindNoMatchesExpected ) + { + return KErrNone; + } + else if ( result == TBrCtlDefs::EFindMatch && ( aMatch == EFindMatchExpected || aMatch == EFindMoreMatchesExpected ) ) + { + return KErrNone; + } + else + { + return KErrNotFound; + } + } + +TInt CBrCtlApiTestContainer::FindKeywordAgain( TInt aMatch ) + { + TBrCtlDefs::TBrCtlFindResponse result = iBrCtlInterface->FindKeywordAgain( ETrue ); + + if ( result == TBrCtlDefs::EFindNoMatches && ( aMatch == EFindNoMatchesExpected || aMatch == EFindMatchExpected ) ) + { + return KErrNone; + } + else if ( result == TBrCtlDefs::EFindMatch && aMatch == EFindMoreMatchesExpected ) + { + return KErrNone; + } + else + { + return KErrNotFound; + } + } + +TInt CBrCtlApiTestContainer::SetFocus() + { + iBrCtlInterface->SetFocus( ETrue, EDrawNow ); + + return KErrNone; + } + +TInt CBrCtlApiTestContainer::OfferKeyEvent() + { + TKeyEvent key; + key.iCode = 0; + key.iScanCode = 0; + key.iModifiers = 0; + key.iRepeats = 0; + + TRAPD( err, iBrCtlInterface->OfferKeyEventL( key, EEventNull ) ); + + return err; + } + +TInt CBrCtlApiTestContainer::BrCtlMinimumSize() + { + const TSize testSize = iBrCtlInterface->MinimumSize(); + + if ( testSize.iWidth > 0 && testSize.iHeight > 0 ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::BrCtlSubscribeToMenuItemsL() + { + TRAPD( err, iBrCtlInterface->LoadUrlL( KUrlLoadTestHtml2 ) ); + + const RPointerArray &ptr = iBrCtlInterface->SubscribeToMenuItemsL(); + + return err; + } + +TInt CBrCtlApiTestContainer::BrCtlContentSize() + { + TBool testPassed = EFalse; + TSize testSize; + + if ( iBrCtlInterface ) + { + testSize = iBrCtlInterface->ContentSize(); + + if ( testSize.iWidth == 0 && testSize.iHeight == 0 ) + { + testPassed = ETrue; + } + } + + return testPassed; + } + +TInt CBrCtlApiTestContainer::SetBrowserSettingL() + { + iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, 0 ); + + return KErrNone; + } + +TInt CBrCtlApiTestContainer::BrowserSettingL( TUint& aSetting ) + { + // value returned + aSetting = iBrCtlInterface->BrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages ); + + return KErrNone; + } + +TInt CBrCtlApiTestContainer::FocusedImageL() + { + iBrCtlInterface->LoadFileL( KUrlLoadTestHtml ); + + iBrCtlInterface->SetFocus( ETrue, EDrawNow ); + + TBrCtlImageCarrier* res = iBrCtlInterface->FocusedImageLC(); + CleanupStack::PopAndDestroy( res ); + + if ( res ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::AddCommandObserverL() + { + iBrCtlInterface->AddCommandObserverL( this ); + return KErrNone; + } + +TInt CBrCtlApiTestContainer::RemoveCommandObserver() + { + iBrCtlInterface->RemoveCommandObserver( this ); + return KErrNone; + } + +TInt CBrCtlApiTestContainer::ImageCountL() + { + return iBrCtlInterface->ImageCountL(); + } + +TInt CBrCtlApiTestContainer::BrCtlFocusedElementTypeL() + { + + iBrCtlInterface->LoadUrlL( KUrlLoadTestHtml2 ); + + iBrCtlInterface->SetFocus( ETrue, EDrawNow ); + + iBrCtlInterface->FocusedElementType(); + + return KErrNone; + } + +TInt CBrCtlApiTestContainer::BrCtlSetParam() + { + _LIT( KContentType, "text/html"); + TRAPD( err, iBrCtlInterface->SetParamL( TBrCtlDefs::EParamsSelfDownoadableTypes, KContentType ) ) + + return err; + } + +TInt CBrCtlApiTestContainer::LoadSavedPageL() + { + _LIT( KUid, "savedpage://4" ); + _LIT( KSavedUrl, "c:\\BrCtlTest\\loadtest.saved" ); + + HBufC8* databuf = ReadFileLC( KSavedUrl ); + HBufC16* bigbuf = HBufC::NewL( databuf->Des().Length() ); + + bigbuf->Des().Copy( databuf->Des() ); + + iBrCtlInterface->LoadSavedPageL( KUid, *bigbuf ); + + delete bigbuf; + CleanupStack::PopAndDestroy( databuf ); + + return KErrNone; + } + +TInt CBrCtlApiTestContainer::SetSelfDownloadContentTypes() + { + TRAPD( err, iBrCtlInterface->SetSelfDownloadContentTypesL( (TDesC16&)KContentDataType() ) ); + + return err; + } + +TInt CBrCtlApiTestContainer::ZoomLevels() + { + RArray* zoom = iBrCtlInterface->ZoomLevels(); + + if ( zoom->Count() > 0 ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::AddOptionMenuItems() + { + TRAPD( err, iBrCtlInterface->AddOptionMenuItemsL( *iMenuPane, 0, 0 ) ); + + return err; + } + +TInt CBrCtlApiTestContainer::BrCtlInitLoadDataL() + { + HBufC8* data = ReadFileLC( KUrlLoadTestHtml ); + TDataType dataType( KContentDataType() ); + MBrCtlDataLoadConsumer* brCtlDataLoadConsumer = NULL; + TUid uid; + uid.iUid = KCharacterSetIdentifierIso88591; + TRAPD( err, iBrCtlInterface->InitLoadDataL( KUrlLoadTestHtml, dataType, uid, data->Length(), + this, &brCtlDataLoadConsumer ) ); + + if ( brCtlDataLoadConsumer ) + { + brCtlDataLoadConsumer->HandleNextDataChunk( *data ); + if ( !iCancelInitDataLoad ) + { + brCtlDataLoadConsumer->HandleLoadComplete(); + } + } + + iCancelInitDataLoad = EFalse; + + CleanupStack::PopAndDestroy( data ); + + return err; + } + +TInt CBrCtlApiTestContainer::HandleDownloadCommand() + { + TBool testPassed = EFalse; + + if ( iBrCtlInterface ) + { + TRAPD( err, iBrCtlInterface->HandleDownloadCommandL( 0, TBrCtlDefs::EDownloadCmdMarkAsProgressive ) ); + + if ( err == KErrNone ) + { + testPassed = ETrue; + } + } + + if ( testPassed ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + } + +TInt CBrCtlApiTestContainer::VersionInfoL() + { + + _LIT(KName, "S60 browser"); + _LIT(KVersion, "5.0"); + _LIT(KBuild, "0516"); + + HBufC* verinfo = iBrCtlInterface->VersionInfoLC( TBrCtlDefs::EVersionInfoName ); + + if(!verinfo) + { + return KErrGeneral; + } + if (verinfo->Compare(KName()) != 0) + { + CleanupStack::PopAndDestroy( verinfo ); + return KErrGeneral; + } + CleanupStack::PopAndDestroy( verinfo ); + verinfo = 0; + verinfo = iBrCtlInterface->VersionInfoLC( TBrCtlDefs::EVersionInfoVersion ); + if(!verinfo) + { + return KErrGeneral; + } + if(verinfo->Compare(KVersion()) != 0) + { + CleanupStack::PopAndDestroy( verinfo ); + return KErrGeneral; + } + CleanupStack::PopAndDestroy( verinfo ); + verinfo = 0; + verinfo = iBrCtlInterface->VersionInfoLC( TBrCtlDefs::EVersionInfoBuild ); + if(!verinfo) + { + return KErrGeneral; + } + if(verinfo->Compare(KBuild()) != 0) + { + CleanupStack::PopAndDestroy( verinfo ); + return KErrGeneral; + } + CleanupStack::PopAndDestroy( verinfo ); + return KErrNone; + } +TInt CBrCtlApiTestContainer::WmlOptionMenuItemsL() + { + + iBrCtlInterface->WMLOptionMenuItemsL(); + return KErrNone; + + } + +TInt CBrCtlApiTestContainer::BrCtlPostL() + { + + RFs rfs; + RFile file; + User::LeaveIfError( rfs.Connect() ); + CleanupClosePushL( rfs ); + User::LeaveIfError( file.Open( rfs, KUrlLoadTestHtml(), EFileShareReadersOnly ) ); + CleanupClosePushL( file ); + + int size; + User::LeaveIfError( file.Size( size ) ); + HBufC8* data = NULL; + data = HBufC8::NewLC( size ); + TPtr8 dataPtr( data->Des() ); + User::LeaveIfError( file.Read( dataPtr ) ); + + //parse url + HBufC* url16 = NULL; + int pos = dataPtr.Find( _L8("\r\n") ); + if ( pos != KErrNotFound ) + { + url16 = HBufC::NewLC( pos ); + url16->Des().Copy( dataPtr.Mid( 0, pos ) ); + } + else + { + CleanupStack::PushL( url16 ); + } + + //parse content type + HBufC8* contenttype = NULL; + int pos2 = dataPtr.Mid( pos+2 ).Find( _L8("\r\n") ); + if ( pos2 != KErrNotFound ) + { + contenttype = HBufC8::NewLC( pos2 ); + contenttype->Des().Copy( dataPtr.Mid( pos+2, pos2 ) ); + } + else + { + CleanupStack::PushL( contenttype ); + } + + //parse post data + HBufC8* postdata = NULL; + int pos3 = dataPtr.Mid( pos+2+pos2+2 ).Find( _L8("\r\n") ); + if ( pos3 != KErrNotFound ) + { + postdata = HBufC8::NewLC( pos3 ); + postdata->Des().Copy( dataPtr.Mid( pos+2+pos2+2, pos3 ) ); + } + else + { + CleanupStack::PushL( postdata ); + } + + //parse boundry + HBufC8* boundry = NULL; + int pos4 = dataPtr.Mid( pos+2+pos2+2+pos3+2 ).Find( _L8("\r\n") ); + if ( pos4 != KErrNotFound ) + { + boundry = HBufC8::NewLC( pos4 ); + boundry->Des().Copy( dataPtr.Mid(pos+2+pos2+2+pos3+2 , pos4) ); + } + else + { + CleanupStack::PushL( boundry ); + } + + TAny* any = NULL; + + TRAPD( error, iBrCtlInterface->PostUrlL ( *url16, + *contenttype, + *postdata, + boundry, + any ) ); + +/* HBufC* urlTest = NULL; + + TRAP( error, iBrCtlInterface->PostUrlL ( *urlTest, + *contenttype, + *postdata, + boundry, + any ) ); + + HBufC8* contenttypeTest = NULL; + + TRAP( error, iBrCtlInterface->PostUrlL ( *url16, + *contenttypeTest, + *postdata, + boundry, + any ) ); +*/ + + CleanupStack::PopAndDestroy( boundry ); + CleanupStack::PopAndDestroy( postdata ); + CleanupStack::PopAndDestroy( contenttype ); + CleanupStack::PopAndDestroy( url16 ); + CleanupStack::PopAndDestroy( data ); + CleanupStack::PopAndDestroy( 2 ); // file, rfs + + return error; + } + +// Added for Widget Extension Test +TInt CBrCtlApiTestContainer::CreateBrCtlInterfaceAndWidgetExtensionL() + { + TPoint base( 0, 0 ); + TPoint extent( 352, 295 ); + TRect rect( base, extent ); + + iBrCtlInterface = CreateBrowserControlL( + this, + rect, + TBrCtlDefs::ECapabilityLoadHttpFw | + TBrCtlDefs::ECapabilityCursorNavigation| + TBrCtlDefs::ECapabilityWebKitLite | + TBrCtlDefs::ECapabilityClientResolveEmbeddedURL, + TBrCtlDefs::ECommandIdBase, + iBrCtlApiTestObserver, /* softkeys */ + iBrCtlApiTestObserver, /* link resolver */ + iBrCtlApiTestObserver, /* special load observer */ + iBrCtlApiTestObserver, /* layout observer */ + iBrCtlDialogs, //iWidgetUiDialogsProviderProxy, + iBrCtlApiTestObserver, /* window observer */ + iBrCtlApiTestObserver /* download observer */ + ); + + iBrCtlInterface->AddLoadEventObserverL( iBrCtlApiTestObserver ); + iBrCtlInterface->AddStateChangeObserverL( iBrCtlApiTestStateChangeObserver ); + iBrCtlInterface->SetComponentsToInheritVisibility(); + + iWidgetExtension = iBrCtlInterface->CreateWidgetExtensionL( *this ); + + if ( iWidgetExtension ) + { + return KErrNone; + } + else + { + return KErrGeneral; + } + + } + +TInt CBrCtlApiTestContainer::HistoryLoad1L() + { + TInt err( KErrNone ); + if(iBrCtlInterface) + { + TRAP(err, iBrCtlInterface->LoadUrlL(KUrlHistoryHandlerHtml1)); + } + + return err; + } + +TInt CBrCtlApiTestContainer::HistoryLoad2L() + { + TInt err( KErrNone ); + if(iBrCtlInterface) + { + TRAP(err, iBrCtlInterface->LoadUrlL(KUrlHistoryHandlerHtml2)); + } + + return err; + } + +TInt CBrCtlApiTestContainer::HistoryLoad3L() + { + TInt err( KErrNone ); + if(iBrCtlInterface) + { + TRAP(err, iBrCtlInterface->LoadUrlL(KUrlHistoryHandlerHtml3)); + } + + return err; + } + +TInt CBrCtlApiTestContainer::WMLLoad1L() + { + TInt err( KErrNone ); + if(iBrCtlInterface) + { + TRAP(err, iBrCtlInterface->LoadUrlL(KUrlLoadTestWml1)); + } + + return err; + } + +TInt CBrCtlApiTestContainer::WMLLoad2L() + { + TInt err( KErrNone ); + if(iBrCtlInterface) + { + TRAP(err, iBrCtlInterface->LoadUrlL(KUrlLoadTestWml2)); + } + + return err; + } + +TInt CBrCtlApiTestContainer::WMLLoad3L() + { + TInt err( KErrNone ); + if(iBrCtlInterface) + { + TRAP(err, iBrCtlInterface->LoadUrlL(KUrlLoadTestWml3)); + } + + return err; + } + +// Dummy function definitions for the MWidgetCallback functions +TBool CBrCtlApiTestContainer::DialogMimeFileSelectLC(HBufC*& /* aSelectedFileName */, + const TDesC& /* aMimeType */) + { + + } + +/** +* Called to show or hide softkeys +* @since 3.1 +* @param aVisible ETrue to show softkeys, EFalse when full screen is needed +*/ +void CBrCtlApiTestContainer::SetSoftkeysVisible(TBool /* aVisible */) + { + + } + +/** +* Called to change the display orientation to landscape +* @since 3.1 +*/ +void CBrCtlApiTestContainer::SetDisplayMode(TBrCtlDefs::TBrCtlOrientation /* aOrientation */) + { + + } + +//Reserved for future use +TInt CBrCtlApiTestContainer::Reserved_1(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_2(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_3(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_4(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_5(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_6(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_7(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_8(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_9(TAny*& a0, TAny* a1, TAny* a2) + { + + } +TInt CBrCtlApiTestContainer::Reserved_10(TAny*& a0, TAny* a1, TAny* a2) + { + + } + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/src/BrCtlApiTestDialogsProvider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/src/BrCtlApiTestDialogsProvider.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2005-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: Implementation of the CBrowserDialogsProviderProxy class. +* +*/ + + +// INCLUDE Files + +// System includes +#include +#include + +// User includes +#include "BrCtlApiTestDialogsProvider.h" + + +// CONSTANTS + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::CBrowserDialogsProviderProxy +//----------------------------------------------------------------------------- +CBrowserDialogsProviderProxy::CBrowserDialogsProviderProxy() + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::~CBrowserDialogsProviderProxy +//----------------------------------------------------------------------------- +CBrowserDialogsProviderProxy::~CBrowserDialogsProviderProxy() + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy* CBrowserDialogsProviderProxy::NewL +//----------------------------------------------------------------------------- +CBrowserDialogsProviderProxy* CBrowserDialogsProviderProxy::NewL() + { + CBrowserDialogsProviderProxy* self = new (ELeave) + CBrowserDialogsProviderProxy( ); + + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop( self ); // self + return self; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::ConstructL +// +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::ConstructL() + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogNotifyErrorL +// +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogNotifyErrorL( TInt /* aErrCode */ ) + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogNotifyHttpErrorL( + TInt /* aErrCode */ , const TDesC& /* aUri */ ) + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogFileSelectLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogFileSelectLC( + const TDesC& /* aStartPath */, + const TDesC& /* aRootPath */, + HBufC*& /* aSelectedFileName */ ) + { + TBool retVal( EFalse ); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogSelectOptionL +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogSelectOptionL( + const TDesC& /* aTitle */, + TBrCtlSelectOptionType /* aBrCtlSelectOptionType */, + CArrayFix& /* aOptions */ ) + { + TBool retVal( EFalse ); + + return retVal; + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogUserAuthenticationLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogUserAuthenticationLC( + const TDesC& /* aUrl */, + const TDesC& /* aRealm */, + const TDesC& /* aDefaultUserName */, + HBufC*& /* aReturnedUserName */, + HBufC*& /* aReturnedPasswd */, + TBool /* aBasicAuthentication */ ) + { + TBool retVal( EFalse ); + return retVal; + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogNoteL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogNoteL( const TDesC& /* aMessage */) + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogAlertL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogAlertL( const TDesC& /* aTitle */, + const TDesC& /* aMessage */ ) + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogConfirmL +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogConfirmL( const TDesC& /* aTitle */, + const TDesC& /* aMessage */, + const TDesC& /* aYesMessage */, + const TDesC& /* aNoMessage */ ) + { + TBool retVal( EFalse ); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogPromptLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogPromptLC( const TDesC& /* aTitle */, + const TDesC& /* aMessage */, + const TDesC& /* aDefaultInput */, + HBufC*& /* aReturnedInput */ ) + { + TBool retVal( EFalse ); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogDownloadObjectL +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogDownloadObjectL( + CBrCtlObjectInfo* /* aBrCtlObjectInfo */ ) + { + TBool retVal( EFalse ); + + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogDisplayPageImagesL +//----------------------------------------------------------------------------- +void CBrowserDialogsProviderProxy::DialogDisplayPageImagesL( + CArrayFixFlat& /* aPageImages */ ) + { + } + + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::CancelAll +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::CancelAll() + { + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::DialogMimeFileSelectLC +//----------------------------------------------------------------------------- +TBool CBrowserDialogsProviderProxy::DialogMimeFileSelectLC( + HBufC*& /* aSelectedFileName */, + const TDesC& /* aMimeType */ ) + { + TBool retVal( EFalse ); + return retVal; + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::ShowTooltipL +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::ShowTooltipL( const TDesC& /* aText */, + TInt /* aDuration */, + TInt /* aDelay */ ) + { + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::UploadProgressNoteL +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::UploadProgressNoteL( + TInt32 /* aTotalSize */, + TInt32 /* aChunkSize */, + TBool /* aIsLastChunk */, + MBrowserDialogsProviderObserver* /* aObserver */ ) + { + } + +//----------------------------------------------------------------------------- +// CBrowserDialogsProviderProxy::WindowActivated() +//----------------------------------------------------------------------------- +// +void CBrowserDialogsProviderProxy::WindowActivated() + { + } + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/src/BrCtlApiTestObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/src/BrCtlApiTestObserver.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,530 @@ +/* +* 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: BrCtlApiTest +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include "BrCtlApiTestObserver.h" +#include +#include + +#ifndef RD_PF_SEC_APPARC +//#include +#else +#include "AiwGenericParam.h" +#endif + + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::UpdateBrowserVScrollBarL +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::UpdateBrowserVScrollBarL(TInt /* aDocumentHeight */, + TInt /* aDisplayHeight */, + TInt /* aDisplayPosY */ ) + { + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::UpdateBrowserHScrollBarL +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::UpdateBrowserHScrollBarL(TInt /* aDocumentWidth */, + TInt /* aDisplayWidth */, + TInt /* aDisplayPosX */ ) + { + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::NotifyLayoutChange +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::NotifyLayoutChange( TBrCtlLayout /* aNewLayout */) + { + } + +// --------------------------------------------------------- +// CBrCtlSampleAppLayoutObserver::UpdateTitle +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::UpdateTitleL( const TDesC& /*aTitle*/ ) + { + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::UpdateSoftkeyL +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::UpdateSoftkeyL(TBrCtlKeySoftkey /* aKeySoftkey */, + const TDesC& /* aLabel */, + TUint32 /* aCommandId */, + TBrCtlSoftkeyChangeReason /* aBrCtlSoftkeyChangeReason */) + { + return; + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::NetworkConnectionNeededL +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::NetworkConnectionNeededL(TInt* /*aConnectionPtr*/, + TInt* /*aSockSvrHandle*/, + TBool* /*aNewConn*/, + TApBearerType* /*aBearerType*/) + { + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::HandleRequestL +// --------------------------------------------------------- +// +TBool CBrCtlApiTestObserver::HandleRequestL(RArray* aTypeArray, CDesCArrayFlat* aDesArray) + { + + TInt i; + + // The 2 arrays must be in sync. Each element in iTypeArray + // identifies the type of the corresponding element in iDesArray. + if( aTypeArray->Count() != aDesArray->Count() ) + { + User::Leave( KErrArgument ); + } + + // get url + HBufC* url = NULL; + // Serach url in the param list + for(i = 0; i < aTypeArray->Count(); i++) + { + if( (*aTypeArray)[i] == EParamRequestUrl ) + { + // the url is found + url = HBufC::NewLC( (*aDesArray)[i].Length() ); + url->Des().Copy( (*aDesArray)[i] ); + break; + } + } + if( !url ) + { + // The url wasn't found. + User::Leave( KErrArgument ); + } + + // get referrer header + HBufC* refererHeader = NULL; + // Serach url in the param list + for( i = 0; i < aTypeArray->Count(); i++ ) + { + if( (*aTypeArray)[i] == EParamRefererHeader ) + { + // the referer Header is found + refererHeader = HBufC::NewLC( (*aDesArray)[i].Length() ); + refererHeader->Des().Copy( (*aDesArray)[i] ); + break; + } + } + + if( refererHeader ) + { + CleanupStack::PopAndDestroy( 1 ); // refererHeader + } + + CleanupStack::PopAndDestroy( 1 ); // url + + return ETrue; + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::HandleDownloadL +// --------------------------------------------------------- +// +TBool CBrCtlApiTestObserver::HandleDownloadL(RArray* aTypeArray, CDesCArrayFlat* aDesArray) + { + TInt i = 0; + TInt count = aTypeArray->Count(); + for (i = 0; i < count; i++) + { + if ((*aTypeArray)[i] == EParamLocalFileName && aDesArray[i].Length() > 0) + { + TInt j = 0; + for (j = 0; j < count; j++) + { + if ((*aTypeArray)[j] == EParamReceivedContentType) + { + HBufC8* dataType8 = HBufC8::NewLC((*aDesArray)[j].Length()); + dataType8->Des().Copy((*aDesArray)[j]); + TDataType dataType(*dataType8); + iHandler->OpenFileEmbeddedL((*aDesArray)[i], dataType); + CleanupStack::PopAndDestroy(); + break; + } + } + break; + } + } + return EFalse; + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::HandleBrowserLoadEventL +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::HandleBrowserLoadEventL( TBrCtlDefs::TBrCtlLoadEvent /* aLoadEvent */, + TUint /* aSize */, TUint16 /* aTransactionId */ ) + { + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::ResolveEmbeddedLinkL +// --------------------------------------------------------- +// +TBool CBrCtlApiTestObserver::ResolveEmbeddedLinkL(const TDesC& aEmbeddedUrl, + const TDesC& /* aCurrentUrl */, + TBrCtlLoadContentType /* aLoadContentType */, + MBrCtlLinkContent& aEmbeddedLinkContent) + { + if (IsFileScheme(aEmbeddedUrl)) + { + GetFileNameL(aEmbeddedUrl); + HBufC8* buf = ReadFileLC(*iFileName); + HBufC* contentType = NULL; + TPtrC p(NULL, 0); + contentType = RecognizeLC(*iFileName, *buf); + aEmbeddedLinkContent.HandleResolveComplete(*contentType, p, buf); + CleanupStack::PopAndDestroy(2); // contentType, buf + return ETrue; + } + return EFalse; + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::ResolveLinkL +// --------------------------------------------------------- +// +TBool CBrCtlApiTestObserver::ResolveLinkL(const TDesC& aUrl, const TDesC& /* aCurrentUrl */, + MBrCtlLinkContent& aBrCtlLinkContent) + { + if (IsFileScheme(aUrl)) + { + GetFileNameL(aUrl); + HBufC8* buf = ReadFileLC(*iFileName); + HBufC* contentType = NULL; + TPtrC p(NULL, 0); + contentType = RecognizeLC(*iFileName, *buf); + aBrCtlLinkContent.HandleResolveComplete(*contentType, p, buf); + CleanupStack::PopAndDestroy(2); // contentType, buf + return ETrue; + } + return EFalse; + } + + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::CancelAll +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::CancelAll() + { + } + + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::ConstructL +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::ConstructL() + { + iHandler = CDocumentHandler::NewL(CEikonEnv::Static()->Process()) ; + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::~CBrCtlApiTestObserver +// --------------------------------------------------------- +// +CBrCtlApiTestObserver::~CBrCtlApiTestObserver() + { + delete iFileName; + delete iHandler; + } + + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::NewL +// --------------------------------------------------------- +// +CBrCtlApiTestObserver* CBrCtlApiTestObserver::NewL() +{ + CBrCtlApiTestObserver* self = new(ELeave)CBrCtlApiTestObserver; + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::IsFileScheme +// --------------------------------------------------------- +// + +TBool CBrCtlApiTestObserver::IsFileScheme(const TDesC& aFileName) + { + _LIT(KFileScheme, "file://"); + if (aFileName.Length() > 0 && aFileName.Ptr() != NULL) + { + if (aFileName.FindF(KFileScheme) == 0) + { + return ETrue; + } + } + return EFalse; + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::ReadFile +// --------------------------------------------------------- +// +HBufC8* CBrCtlApiTestObserver::ReadFileLC(const TDesC& aFileName) + { + RFs rfs; + RFile file; + User::LeaveIfError(rfs.Connect()); + CleanupClosePushL(rfs); + User::LeaveIfError(file.Open(rfs, aFileName, EFileRead)); + CleanupClosePushL(file); + TInt size; + User::LeaveIfError(file.Size(size)); + HBufC8* buf = HBufC8::NewLC(size); + TPtr8 bufPtr(buf->Des()); + User::LeaveIfError(file.Read(bufPtr)); + CleanupStack::Pop(); // buf + CleanupStack::PopAndDestroy(2); // file, rfs + CleanupStack::PushL(buf); + return buf; + } + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::RecognizeL +// --------------------------------------------------------- +// +HBufC* CBrCtlApiTestObserver::RecognizeLC(const TDesC& aFileName, const TDesC8& aData) + { + TDataRecognitionResult dataType; + RApaLsSession apaSession; + TInt ret; + HBufC* contentTypeString = NULL; + + User::LeaveIfError(apaSession.Connect()); + // Ask the application architecture to find the file type + ret = apaSession.RecognizeData(aFileName, aData, dataType); + apaSession.Close(); + + if (ret == KErrNone && + (dataType.iConfidence == CApaDataRecognizerType::ECertain) || + (dataType.iConfidence == CApaDataRecognizerType::EProbable)) + { + // If the file type was found, try to match it to a known file type + TPtrC8 mimeTypePtr = dataType.iDataType.Des8(); + TInt len = mimeTypePtr.Length() + 1; + contentTypeString = HBufC::NewL(len); + contentTypeString->Des().Copy(mimeTypePtr); + contentTypeString->Des().ZeroTerminate(); + } + CleanupStack::PushL(contentTypeString); + return contentTypeString; + } + +// ----------------------------------------------------------------------------- +// CBrCtlApiTestObserver::GetFileNameL +// Translate the file name from a URL to a valid file name in the system. +// ----------------------------------------------------------------------------- +// +TBool CBrCtlApiTestObserver::GetFileNameL(const TDesC& aFileName) + { + // This function accepts URLs in the following format: + // file://filename.xxx + // file:///filename.xxx + // file://c:/filename.xxx + // file:///c:/filename.xxx + // + _LIT(KFileScheme, "file://"); + _LIT(KDefaultDrivePath, "C:\\"); + _LIT(KPathChar, "\\"); + + TInt count; + TInt index = 0; + TBool drvLetter = EFalse; + TUint16 c; + + // Verify the file scheme + TPtrC urlPtr(aFileName); + if (urlPtr.FindF(KFileScheme) != 0) + { + return EFalse; + } + urlPtr.Set(urlPtr.Mid(KFileScheme().Length())); + + // make sure there are enough characters in the filename before + // trying to check them + count = urlPtr.Length(); + if(count == 0) + { + return EFalse; // no filename, so can't look at urlPtr[0] + } + + // Skip the first '/' if there is one + if (urlPtr[0] == '/') + { + urlPtr.Set(urlPtr.Mid(1)); + } + count = urlPtr.Length(); + + // Is there a drive letter? + if(count > 1) + { + // can check for drive letter + if (urlPtr[1 + index] == ':') + { + drvLetter = ETrue; + } + } + if(drvLetter == EFalse) + { + // 3 additional characters for the string "c:\" + count = urlPtr.Length() + 3; + } + iFileName = HBufC::NewL(count); + if (!drvLetter) + { + iFileName->Des().Append(KDefaultDrivePath); + } + + TBool fragment(EFalse); + // Convert relative path containing /./ and /../ to absolute path + for (; index < urlPtr.Length() && !fragment; index ++) + { + switch(urlPtr[index]) + { + case '#': //Check if there is a fragment '#' + { + fragment = ETrue; + continue; // Just stop there + } + + case '/': + { + iFileName->Des().Append(KPathChar); + break; + } + case '.': + { + if (index > 1 && urlPtr[index - 1] == '/') + { + if (index < count - 1 && urlPtr[index + 1] == '/') + { + index ++; // skip ./ + break; + } + if (index > 2 && index < count - 3 && + urlPtr[index + 1] == '.' && urlPtr[index + 2] == '/') + { + TInt i = index - 2; + + for (; i > 0 && urlPtr[i] != '/'; i--) {} // skip /../ + + iFileName->Des().SetLength(iFileName->Des().Length() - (index - i)); + index += 2; + break; + } + } + } + // no break + //lint -fallthrough + + default: + { + c = urlPtr[index]; + iFileName->Des().Append(&c, 1); + break; + } + } // end of switch + } + return ETrue; +} + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::NewDownloadL +// --------------------------------------------------------- +// +TBool CBrCtlApiTestObserver::NewDownloadL(TUint /* aTransactionID */, + const TDesC& /* aFileName */, + const TDesC& /* aContentType */, + const TDesC& /* aUrl */) +{ + return ETrue; +} + +void CBrCtlApiTestObserver::ResumeDownloadL(TUint /* aTransactionID */, + TUint /* aLength */, + const TDesC& /* aFileName */, + const TDesC& /* aContentType */, + const TDesC& /* aUrl */) +{ +} + +void CBrCtlApiTestObserver::HandleDownloadEventL( TUint /* aTransactionID */, + TBrCtlDownloadEvent /* aDownloadEvent */, + TUint /* aValue*/ ) +{ +} + +// Dummy function definitions for the functions from CBrCtlWindowObserver class - Added for Widget Extension Test + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::OpenWindowL +// --------------------------------------------------------- +// +CBrCtlInterface* CBrCtlApiTestObserver::OpenWindowL(TDesC& aUrl, TDesC* aTargetName, TBool aUserInitiated, + TAny* aReserved) +{ + +} + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::FindWindowL +// --------------------------------------------------------- +// +CBrCtlInterface* CBrCtlApiTestObserver::FindWindowL( const TDesC& aTargetName ) const +{ + +} + +// --------------------------------------------------------- +// CBrCtlApiTestObserver::HandleWindowCommandL +// --------------------------------------------------------- +// +void CBrCtlApiTestObserver::HandleWindowCommandL( const TDesC& aTargetName, TBrCtlWindowCommand aCommand ) +{ + +} + + + +// End of File diff -r e904b452aa85 -r 235c00e46fb7 browser/src/BrCtlApiTestStateChangeObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/src/BrCtlApiTestStateChangeObserver.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -0,0 +1,83 @@ +/* +* 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: Handle state changed events +* +*/ + + +// INCLUDE FILES +#include "BrCtlApiTestContainer.h" +#include "BrCtlApiTestStateChangeObserver.h" + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// CBrCtlApiTestStateChangeObserver::StateChanged +// --------------------------------------------------------- +// +void +CBrCtlApiTestStateChangeObserver::StateChanged(TBrCtlDefs::TBrCtlState /* aState */, + TInt /* aValue */) + { + // Here we are creating a string to be displayed on the screen, but you would + // implement this method to have code that would be executed when the observer + // receives state changed events. + TBuf16<256> tgt; + TPoint point(0, 120); + +// _LIT(KHandleBrowserStateChange, "State Change event = %d, value = %d"); + +// tgt.AppendFormat(KHandleBrowserStateChange, aState, aValue); + +// iContainer->SetPoint(point); +// iContainer->SetText(tgt); + + iContainer->DrawNow(); + } + +// --------------------------------------------------------- +// CBrCtlApiTestStateChangeObserver::ConstructL +// --------------------------------------------------------- +// +void +CBrCtlApiTestStateChangeObserver::ConstructL(CBrCtlApiTestContainer* aContainer) + { + iContainer = aContainer; + } + +// --------------------------------------------------------- +// CBrCtlApiTestStateChangeObserver::~CBrCtlApiTestStateChangeObserver +// --------------------------------------------------------- +// +CBrCtlApiTestStateChangeObserver::~CBrCtlApiTestStateChangeObserver() + { + } + + +// --------------------------------------------------------- +// CBrCtlApiTestStateChangeObserver::NewL +// --------------------------------------------------------- +// +CBrCtlApiTestStateChangeObserver* +CBrCtlApiTestStateChangeObserver::NewL(CBrCtlApiTestContainer* aContainer) +{ + CBrCtlApiTestStateChangeObserver* self = new(ELeave)CBrCtlApiTestStateChangeObserver; + CleanupStack::PushL(self); + self->ConstructL(aContainer); + CleanupStack::Pop(); + return self; +} + +// End of File + diff -r e904b452aa85 -r 235c00e46fb7 email/testutils/src/T_UtilsEnumConverter.cpp --- a/email/testutils/src/T_UtilsEnumConverter.cpp Thu Jan 21 12:55:15 2010 +0000 +++ b/email/testutils/src/T_UtilsEnumConverter.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -1417,7 +1417,7 @@ STR_CASE(KStrBearerTypeCdma2000) { - bearerTypes = KCommDbBearerCdma2000; +// bearerTypes = KCommDbBearerCdma2000; break; } diff -r e904b452aa85 -r 235c00e46fb7 graphics/fbserv/src/T_DataFbsSession.cpp --- a/graphics/fbserv/src/T_DataFbsSession.cpp Thu Jan 21 12:55:15 2010 +0000 +++ b/graphics/fbserv/src/T_DataFbsSession.cpp Thu Jan 21 14:54:07 2010 +0000 @@ -104,13 +104,13 @@ _LIT(KFbsMessBitmapBgCompress, "EFbsMessBitmapBgCompress"); _LIT(KFbsSetSystemDefaultTypefaceName, "EFbsSetSystemDefaultTypefaceName"); _LIT(KFbsGetAllBitmapHandles, "EFbsGetAllBitmapHandles"); -_LIT(KFbsMessCreateLinkedTypeface, "EFbsMessCreateLinkedTypeface"); +//_LIT(KFbsMessCreateLinkedTypeface, "EFbsMessCreateLinkedTypeface"); _LIT(KFbsMessSetHeapFail, "EFbsMessSetHeapFail"); _LIT(KFbsMessHeapCount, "EFbsMessHeapCount"); _LIT(KFbsMessSetHeapReset, "EFbsMessSetHeapReset"); _LIT(KFbsMessSetHeapCheck, "EFbsMessSetHeapCheck"); _LIT(KFbsMessHeap, "EFbsMessHeap"); -_LIT(KFbsMessLinkedCache, "EFbsMessLinkedCache"); +//_LIT(KFbsMessLinkedCache, "EFbsMessLinkedCache"); _LIT(KFbsMessBitmapClean, "EFbsMessBitmapClean"); /*@}*/ @@ -707,10 +707,10 @@ { aMessage = EFbsGetAllBitmapHandles; } - else if ( fbsMessage==KFbsMessCreateLinkedTypeface ) +/* else if ( fbsMessage==KFbsMessCreateLinkedTypeface ) { aMessage = EFbsMessCreateLinkedTypeface; - } + } */ else if ( fbsMessage==KFbsMessSetHeapFail ) { aMessage = EFbsMessSetHeapFail; @@ -731,10 +731,10 @@ { aMessage = EFbsMessHeap; } - else if ( fbsMessage==KFbsMessLinkedCache ) +/* else if ( fbsMessage==KFbsMessLinkedCache ) { aMessage = EFbsMessLinkedCache; - } + } */ else if ( fbsMessage==KFbsMessBitmapClean ) { aMessage = EFbsMessBitmapClean; diff -r e904b452aa85 -r 235c00e46fb7 lbs/lbstestutils/group/lbstestutils.mmp --- a/lbs/lbstestutils/group/lbstestutils.mmp Thu Jan 21 12:55:15 2010 +0000 +++ b/lbs/lbstestutils/group/lbstestutils.mmp Thu Jan 21 14:54:07 2010 +0000 @@ -48,7 +48,8 @@ LIBRARY efsrv.lib // LBS libraries. -LIBRARY lbsselflocate.lib +//LIBRARY lbsselflocate.lib +LIBRARY lbs.lib LIBRARY lbsloccommon.lib LIBRARY lbsassistancedata.lib LIBRARY lbsloggerapi.lib