stif/stif_plat/inc/UIEngine.h
branchRCL_3
changeset 59 8ad140f3dd41
parent 0 a03f92240627
equal deleted inserted replaced
49:7fdc9a71d314 59:8ad140f3dd41
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains the header file of the UIEngine.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef UI_ENGINE_H
       
    19 #define UI_ENGINE_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <StifLogger.h>
       
    25 #include <StifTFwIf.h>
       
    26 
       
    27 #include <TestEngineClient.h>
       
    28 #include <StifTFwIfProt.h>
       
    29 
       
    30 
       
    31 // CONSTANTS
       
    32 // Log dir and file
       
    33 _LIT( KUiLogDir, "\\Logs\\TestFramework\\ui\\" );
       
    34 _LIT( KUiLogFile, "ui.txt" );
       
    35 
       
    36 // TestScripter related informations
       
    37 const TInt KTestScripterNameLength = 12;    
       
    38 _LIT( KTestScripterName, "testscripter" );  
       
    39 _LIT( KTestCombinerName, "testcombiner" ); 
       
    40                                             
       
    41 
       
    42 // MACROS
       
    43 // None
       
    44 
       
    45 // DATA TYPES
       
    46 
       
    47 // FUNCTION PROTOTYPES
       
    48 // None
       
    49 
       
    50 // FORWARD DECLARATIONS
       
    51 class CUIEngineContainer;
       
    52 class CUIEngineEvent;
       
    53 class CUIEngineErrorPrinter;
       
    54 
       
    55 // CLASS DECLARATION
       
    56 
       
    57 // DESCRIPTION
       
    58     
       
    59 // CUIIf is the interface class of STIF Test Framework UI engine 
       
    60 class CUIIf 
       
    61     :public CBase
       
    62     {
       
    63     public: // Functions that the derived class may implement.
       
    64 
       
    65         /**
       
    66         * Test case executed.
       
    67         *
       
    68         * Returns Symbian OS error code.
       
    69         */
       
    70         virtual void TestExecuted ( CUIEngineContainer* aContainer,
       
    71                                     TFullTestResult& aFullTestResult ) = 0;
       
    72 
       
    73         /**
       
    74         * Progress information from Test case execution.
       
    75         *
       
    76         * Returns Symbian OS error code.
       
    77         */
       
    78         virtual TInt PrintProg ( CUIEngineContainer* /* aContainer */,
       
    79                                  TTestProgress& /* aProgress */ )
       
    80                                  { return KErrNotSupported; };
       
    81                                  
       
    82         /**
       
    83         * Error information from Test Framework.
       
    84         *
       
    85         * Returns Symbian OS error code.
       
    86         */
       
    87         virtual TInt ErrorPrint ( TErrorNotification& /* aError */ )
       
    88                                   { return KErrNotSupported; };
       
    89     
       
    90         /**
       
    91         * Forward remote messages.
       
    92         */
       
    93         virtual TInt RemoteMsg( CUIEngineContainer* /* aContainer */,
       
    94                                 const TDesC& /* aMessage */ )
       
    95                                  { return KErrNotSupported; };
       
    96 
       
    97         /**
       
    98         * Forward reboot indication.
       
    99         */
       
   100         virtual TInt GoingToReboot( CUIEngineContainer* /* aContainer */,
       
   101                                     TRequestStatus& /* aStatus */ )
       
   102                                  { return KErrNotSupported; };
       
   103 
       
   104         /**
       
   105         * Initialize logger.
       
   106         */
       
   107         virtual void InitializeLogger( CStifLogger* /*aLogger*/ ){};
       
   108                              
       
   109     };
       
   110 
       
   111 
       
   112 // CUIEngine is the main class of STIF Test Framework UI engine 
       
   113 class CUIEngine 
       
   114     :public CBase
       
   115     {
       
   116     public: // Enumerations
       
   117 
       
   118     protected: // Enumerations
       
   119         
       
   120     private: // Enumerations
       
   121 
       
   122     public:  // Constructors and destructor
       
   123         
       
   124         static CUIEngine* NewL( CUIIf* aUi );
       
   125         
       
   126         /**
       
   127         * Destructor.
       
   128         */
       
   129         virtual ~CUIEngine();
       
   130 
       
   131     public: // New functions
       
   132 
       
   133         RTestEngine& TestEngine(){ return iTestEngine; }
       
   134 
       
   135         /**
       
   136         * Used to open TestFramework.
       
   137         *
       
   138         * Returns Symbian OS error code.
       
   139         */
       
   140         TInt Open( const TDesC& aTestFrameworkIni );
       
   141 
       
   142         /**
       
   143         * Used to close TestFramework.
       
   144         *
       
   145         * Returns Symbian OS error code.
       
   146         */
       
   147         TInt Close();
       
   148 
       
   149         /**
       
   150         * Used to add test module to test framework.
       
   151         *
       
   152         * Returns Symbian OS error code.
       
   153         */
       
   154         TInt AddTestModule( const TDesC& aModuleName, 
       
   155                             const TDesC& aIniFile );
       
   156 
       
   157         /**
       
   158         * Used to remove test module to test framework.
       
   159         *
       
   160         * Returns Symbian OS error code.
       
   161         */
       
   162         TInt RemoveTestModule( const TDesC& aModuleName );
       
   163 
       
   164         /**
       
   165         * Used to add test case file for test module.
       
   166         *
       
   167         * Returns Symbian OS error code.
       
   168         */
       
   169         TInt AddTestCaseFile( const TDesC& aModuleName,
       
   170                               const TDesC& aCaseFile );
       
   171 
       
   172         /**
       
   173         * Used to remove test case file from test module.
       
   174         *
       
   175         * Returns Symbian OS error code.
       
   176         */
       
   177         TInt RemoveTestCaseFile( const TDesC& aModuleName,
       
   178                                  const TDesC& aCaseFile );
       
   179 
       
   180         /**
       
   181         * Get testcases from test modules. Returns test case information 
       
   182         * in aTestinfo.
       
   183         * Test module name and test case file can be used to limit the 
       
   184         * set of test cases returned.
       
   185         *
       
   186         * Returns Symbian OS error code.
       
   187         */
       
   188         TInt GetTestCasesL( RPointerArray<CTestInfo>& aTestInfo,
       
   189                             const TDesC& aTestModule = (TDesC&) KNullDesC(),
       
   190                             const TDesC& aTestCaseFile = (TDesC&) KNullDesC() );
       
   191 
       
   192         /**
       
   193         * Start selected test case identified with CTestInfo.
       
   194         * Return TestId, which is handle used in subsequent 
       
   195         * test case execution control.
       
   196         *
       
   197         * Returns Symbian OS error code.
       
   198         */
       
   199         TInt StartTestCase( CUIEngineContainer*& aContainer,
       
   200                             const CTestInfo& aTestInfo );
       
   201     
       
   202         /**
       
   203         * Abort started test case.
       
   204         */
       
   205         void AbortStartedTestCase( CUIEngineContainer* aContainer );
       
   206 
       
   207     protected: // Functions that the derived class may implement.
       
   208 
       
   209     private:
       
   210     
       
   211         /**
       
   212         * C++ default constructor.
       
   213         */
       
   214         CUIEngine( CUIIf* aUi );
       
   215 
       
   216         /**
       
   217         * Second phase constructor.
       
   218         */
       
   219         void ConstructL();
       
   220 
       
   221         /**
       
   222         * Test case executed.
       
   223         *
       
   224         * Returns Symbian OS error code.
       
   225         */
       
   226         void TestExecuted ( CUIEngineContainer* aContainer,
       
   227                             TFullTestResult& aFullTestResult );
       
   228 
       
   229         /**
       
   230         * Progress information from Test case execution.
       
   231         *
       
   232         * Returns Symbian OS error code.
       
   233         */
       
   234         TInt PrintProg ( CUIEngineContainer* aContainer,
       
   235                          TTestProgress& aProgress );
       
   236                          
       
   237         /**
       
   238         * Error information from Test framework.
       
   239         *
       
   240         * Returns Symbian OS error code.
       
   241         */
       
   242         TInt ErrorPrint ( TErrorNotification& aError );
       
   243 
       
   244         /**
       
   245         * Forward remote messages.
       
   246         */
       
   247         TInt RemoteMsg( CUIEngineContainer* aContainer,
       
   248                         const TDesC& aMessage );
       
   249 
       
   250         /**
       
   251         * Forward reboot indication..
       
   252         */
       
   253         TInt GoingToReboot( CUIEngineContainer* aContainer, TRequestStatus& aStatus );
       
   254 
       
   255         
       
   256     public: // Data
       
   257 
       
   258         // Logger 
       
   259         CStifLogger*                            iLogger;
       
   260 
       
   261     protected: // Data
       
   262         // None
       
   263         
       
   264     private: // Data
       
   265         
       
   266         /**
       
   267         * Handle to UI.
       
   268         */
       
   269         CUIIf*                                  iUi; 
       
   270 
       
   271         // Handle to Test Engine Server
       
   272         RTestEngineServer                       iTestEngineServ;
       
   273 
       
   274         // Handle to Test Engine
       
   275         RTestEngine                             iTestEngine;
       
   276         
       
   277         // Container array
       
   278         RPointerArray<CUIEngineContainer>       iContainerArray;
       
   279         
       
   280         // Error printer
       
   281         CUIEngineErrorPrinter*                  iError;
       
   282                 
       
   283     public: // Friend classes
       
   284         // None
       
   285         
       
   286     protected: // Friend classes
       
   287         // None
       
   288 
       
   289     private: // Friend classes
       
   290         friend class CUIEngineContainer;
       
   291         friend class CUIEngineEvent;
       
   292         friend class CUIEngineErrorPrinter;
       
   293     };
       
   294 
       
   295 #endif      // UI_ENGINE_H 
       
   296 
       
   297 // End of File