homescreensrv_plat/hs_widget_publisher_api/tsrc/inc/TestHspApi.h
changeset 0 79c6a41cd166
equal deleted inserted replaced
-1:000000000000 0:79c6a41cd166
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef TESTHSPAPI_H
       
    21 #define TESTHSPAPI_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <StifLogger.h>
       
    25 #include <TestScripterInternal.h>
       
    26 #include <StifTestModule.h>
       
    27 #include <liwservicehandler.h>
       
    28 #include <liwvariant.h>
       
    29 #include <liwgenericparam.h>
       
    30 #include <liwcommon.h>
       
    31 #include "hsdataobserver.h"
       
    32 #include <string>
       
    33 #include "hswidgetpublisher.h"
       
    34 
       
    35 // CONSTANTS
       
    36 //const ?type ?constant_var = ?constant;
       
    37 
       
    38 // MACROS
       
    39 //#define ?macro ?macro_def
       
    40 // Logging path
       
    41 _LIT( KTestHspApiLogPath, "\\logs\\testframework\\TestHspApi\\" ); 
       
    42 // Log file
       
    43 _LIT( KTestHspApiLogFile, "TestHspApi.txt" ); 
       
    44 
       
    45 // FUNCTION PROTOTYPES
       
    46 //?type ?function_name(?arg_list);
       
    47 
       
    48 // FORWARD DECLARATIONS
       
    49 //class ?FORWARD_CLASSNAME;
       
    50 class CTestHspApi;
       
    51 
       
    52 // DATA TYPES
       
    53 //enum ?declaration
       
    54 //typedef ?declaration
       
    55 //extern ?data_type;
       
    56 
       
    57 // CLASS DECLARATION
       
    58 
       
    59 /**
       
    60 *  CTestHspApi test class for STIF Test Framework TestScripter.
       
    61 *  ?other_description_lines
       
    62 *
       
    63 *  @lib ?library
       
    64 *  @since ?Series60_version
       
    65 */
       
    66 NONSHARABLE_CLASS(CTestHspApi) : public CScriptBase, public Hs::IHsDataObserver, public MLiwNotifyCallback
       
    67     {
       
    68     public:  // Constructors and destructor
       
    69         
       
    70         /**
       
    71         * Two-phased constructor.
       
    72         */
       
    73         static CTestHspApi* NewL( CTestModuleIf& aTestModuleIf );
       
    74         
       
    75         /**
       
    76         * Destructor.
       
    77         */
       
    78         virtual ~CTestHspApi();
       
    79 
       
    80     public: // New functions
       
    81         
       
    82         /**
       
    83         * ?member_description.
       
    84         * @since ?Series60_version
       
    85         * @param ?arg1 ?description
       
    86         * @return ?description
       
    87         */
       
    88         //?type ?member_function( ?type ?arg1 );
       
    89 
       
    90     public: // Functions from base classes
       
    91 
       
    92         /**
       
    93         * From CScriptBase Runs a script line.
       
    94         * @since ?Series60_version
       
    95         * @param aItem Script line containing method name and parameters
       
    96         * @return Symbian OS error code
       
    97         */
       
    98         virtual TInt RunMethodL( CStifItemParser& aItem );
       
    99                 
       
   100     protected:  // New functions
       
   101         
       
   102         /**
       
   103         * ?member_description.
       
   104         * @since ?Series60_version
       
   105         * @param ?arg1 ?description
       
   106         * @return ?description
       
   107         */
       
   108         //?type ?member_function( ?type ?arg1 );
       
   109 
       
   110     protected:  // Functions from base classes
       
   111         
       
   112         /**
       
   113         * From ?base_class ?member_description
       
   114         */
       
   115         //?type ?member_function();
       
   116 
       
   117     private:
       
   118 
       
   119         /**
       
   120         * C++ default constructor.
       
   121         */
       
   122         CTestHspApi( CTestModuleIf& aTestModuleIf );
       
   123 
       
   124         /**
       
   125         * By default Symbian 2nd phase constructor is private.
       
   126         */
       
   127         void ConstructL();
       
   128 
       
   129         // Prohibit copy constructor if not deriving from CBase.
       
   130         // ?classname( const ?classname& );
       
   131         // Prohibit assigment operator if not deriving from CBase.
       
   132         // ?classname& operator=( const ?classname& );
       
   133     
       
   134         /**
       
   135         * Frees all resources allocated from test methods.
       
   136         * @since ?Series60_version
       
   137         */
       
   138         void Delete();
       
   139         
       
   140         /**
       
   141         * Test methods are listed below. 
       
   142         */
       
   143         
       
   144         TInt TestHspApiConstrL( CStifItemParser& aItem );
       
   145         TInt TestHspWidgetAddWidgetItem1L( CStifItemParser& aItem );
       
   146         TInt TestHspWidgetAddWidgetItem2L( CStifItemParser& aItem );
       
   147 		TInt TestHspWidgetAddWidgetItem3L( CStifItemParser& aItem );
       
   148         TInt TestHspApiDeleteWidgetL( CStifItemParser& aItem );
       
   149         TInt TestHspApiSetDataObserver1L( CStifItemParser& aItem );
       
   150 		TInt TestHspApiSetDataObserver2L( CStifItemParser& aItem );
       
   151         TInt TestHspApiGetWidgetL( CStifItemParser& aItem );
       
   152         TInt TestHspApiWidgetRemoveItem1L( CStifItemParser& aItem );
       
   153 		TInt TestHspApiWidgetRemoveItem2L( CStifItemParser& aItem );
       
   154         TInt TestHspApiExceptionL( CStifItemParser& aItem );
       
   155 
       
   156     	// from IHSPDataObserver
       
   157     	void handleItemEvent( std::string aWidgetName, std::string aTemplateItemName, Hs::IHsDataObserver::EItemEvent aAction);
       
   158     	void handleEvent( std::string aWidgetName, Hs::IHsDataObserver::EEvent aAction );
       
   159     	
       
   160     	MLiwInterface* GetServiceInterfaceL();
       
   161     	
       
   162     	CLiwGenericParamList* GetListL( std::string& aContentType, 
       
   163     			std::string& aIdentifier, std::string& aWidgetName );
       
   164     	
       
   165     	CLiwGenericParamList* ExecuteActionL( std::string& aContentType, 
       
   166     			std::string& aIdentifier, std::string& aWidgetName );
       
   167 
       
   168     	CLiwGenericParamList* ExecuteActionSelectedL( std::string& aContentType, 
       
   169     			std::string& aIdentifier, std::string& aWidgetName );
       
   170 
       
   171 		TInt CTestHspApi::ExtractItemCountL(
       
   172     	      const CLiwGenericParamList& aInParamList );
       
   173 
       
   174     	TInt ExtractItemL( const CLiwGenericParamList& aInParamList,
       
   175     			const TDesC8& aItemName, RBuf& aItemValue );
       
   176     	
       
   177     	void AddTemplate( Hs::HsWidgetPublisher* aHspApi, std::string& aContentType, 
       
   178     			std::string& aIdentifier, std::string& aWidgetName );
       
   179     	
       
   180     	void SendFakeActivateEvent( std::string& aIdentifier );
       
   181     	
       
   182     	void AddExistingTemplate( Hs::HsWidgetPublisher* aHspApi, std::string& aContentType, 
       
   183     			std::string& aIdentifier, std::string& aWidgetName );
       
   184     	
       
   185     	void AddAndRemoveTemplateItem1( Hs::HsWidgetPublisher* aHspApi, std::string& aContentType, 
       
   186     			std::string& aIdentifier, std::string& aWidgetName );
       
   187     	
       
   188     	void AddAndRemoveTemplateItem2( Hs::HsWidgetPublisher* aHspApi, std::string& aContentType, 
       
   189     			std::string& aIdentifier, std::string& aWidgetName );
       
   190 				
       
   191     	void WaitL(TInt aMicroSec);
       
   192     	
       
   193     	// from MLiwNotifyCallback
       
   194     	TInt HandleNotifyL( TInt /*aCmdId*/, TInt /*aEventId*/, 
       
   195     			CLiwGenericParamList& aEventParamList,
       
   196     			const CLiwGenericParamList& /*aInParamList*/ );
       
   197     	
       
   198     	void ThrowHspException();
       
   199     	
       
   200     private:    // Data
       
   201     	
       
   202     	CLiwServiceHandler* mServiceHandler;
       
   203     	MLiwInterface* mServiceInterface;
       
   204     	TInt iItemActionStatus;
       
   205     	TInt iActionStatus;
       
   206 
       
   207     };
       
   208 
       
   209 #endif      // TESTHSPAPI_H
       
   210             
       
   211 // End of File