testexecfw/stf/stffw/testsrv/inc/TestServer.h
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     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 
       
    15 * CTestServer.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef TEST_SERVER_H
       
    20 #define TEST_SERVER_H
       
    21 
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include "PrintQueue.h"
       
    27 #include <StifLogger.h>
       
    28 #include "Logging.h"
       
    29 #include <StifTestModule.h>
       
    30 #include <StifTestInterface.h>
       
    31 
       
    32 // CONSTANTS
       
    33 
       
    34 // KDefaultHeapSize needed for creating server thread.
       
    35 const TUint KDefaultHeapSize = 0x10000;
       
    36 const TUint KMaxHeapSize     = 0x20000;
       
    37 
       
    38 // MACROS
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41 typedef CTestModuleBase*( *CTestInterfaceFactory )();
       
    42 
       
    43 // DATA TYPES
       
    44 
       
    45 // Panic reasons
       
    46 enum TTestServerPanic
       
    47     {
       
    48     EBadRequest,
       
    49     EBadDescriptor,
       
    50     EDescriptorNonNumeric,
       
    51     EMainSchedulerError,
       
    52     ESvrCreateServer,
       
    53     ECreateTrapCleanup,
       
    54     EBadRemove, 
       
    55     EBadSubsessionHandle,
       
    56     ENoStartupInformation,
       
    57     EEnumerateHasNotBeenCalled,
       
    58     EClosingWhileTestRunning,
       
    59     EPrintMutexNotFreed,
       
    60     EThreadMutexNotFreed,
       
    61     EEventMutexNotFreed,
       
    62     EEventArrayMutexNotFreed,
       
    63     ETestModuleMutexNotFreed,
       
    64     EInvalidCTestExecution,
       
    65     EPrintQueueBroken,
       
    66     EInvalidRequestCancel,
       
    67     EWrongEventQueueDeleteContext,
       
    68     EReInitializingTestModule,
       
    69     ETestModuleNotInitialized,
       
    70     EInvalidTestModuleOperation,
       
    71     EWrongHeapInUse,
       
    72     ENullTestModuleFunction,
       
    73     ENullTestModuleContainer,
       
    74     ENullTestModule,
       
    75     ECannotCreateEventArray,
       
    76     EPreviousRequestStillOngoing,
       
    77     ECannotOpenServerThread,
       
    78     ENullModuleSession,
       
    79     EInvalidThreadState,
       
    80     EUnknownEventCmd,
       
    81     EUnknownRemoteCmd,
       
    82     ENullTestThreadContainer,
       
    83     ENullExecution,
       
    84     EAlreadyActive,
       
    85     };
       
    86 
       
    87 
       
    88 // FUNCTION PROTOTYPES
       
    89 
       
    90 // FORWARD DECLARATIONS
       
    91 class TEvent;
       
    92 class CTestModule;
       
    93 class CTestModuleContainer;
       
    94 class CTestExecution;
       
    95 class CTestThreadContainer;
       
    96 class CErrorPrintHandler;
       
    97 class CTestThreadContainerRunnerFactory;
       
    98 
       
    99 // CLASS DECLARATION
       
   100 
       
   101 // DESCRIPTION
       
   102 // CUnderTaker class is an active object that handles thread death
       
   103 // notifications.
       
   104 class CUnderTaker 
       
   105         :public CActive
       
   106     {
       
   107 
       
   108     public:  // Enumerations
       
   109 
       
   110     private: // Enumerations
       
   111 
       
   112     public:  // Constructors and destructor
       
   113 
       
   114         /**
       
   115         * NewL is first phase of two-phased constructor.
       
   116         */
       
   117         static CUnderTaker* NewL( CTestModuleContainer* aContainer );
       
   118 
       
   119         /**
       
   120         * Destructor of CUnderTaker.
       
   121         */
       
   122         virtual ~CUnderTaker();
       
   123 
       
   124     public: // New functions
       
   125 
       
   126         /**
       
   127         * Start monitoring
       
   128         */
       
   129         TInt StartL();
       
   130 
       
   131         /**
       
   132         * Is undertaker completed?
       
   133         */
       
   134         TBool Completed();
       
   135 
       
   136 		/**
       
   137         * Sets or unsets local processing mode
       
   138         */
       
   139         void SetSynchronousMode(const TBool aMode);
       
   140 
       
   141     public: // Functions from base classes
       
   142 
       
   143         /**
       
   144         * RunL derived from CActive handles the completed requests.
       
   145         */
       
   146         void RunL();
       
   147 
       
   148         /**
       
   149         * DoCancel derived from CActive handles the Cancel
       
   150         */
       
   151         void DoCancel();
       
   152 
       
   153         /**
       
   154         * RunError derived from CActive handles errors from active handler.
       
   155         */
       
   156         TInt RunError( TInt aError );
       
   157 
       
   158     protected:  // New functions
       
   159         // None
       
   160 
       
   161     protected:  // Functions from base classes
       
   162         // None
       
   163 
       
   164     private:
       
   165 
       
   166         /** 
       
   167         * C++ default constructor.
       
   168         */
       
   169         CUnderTaker();
       
   170        
       
   171         /**
       
   172         * By default Symbian OS constructor is private.
       
   173         */
       
   174         void ConstructL( CTestModuleContainer* aContainer );
       
   175 
       
   176     public:   //Data
       
   177         // None
       
   178     
       
   179     protected:  // Data
       
   180         // None
       
   181 
       
   182     private:    // Data
       
   183          CTestModuleContainer* iModuleContainer;           // Pointer to parent
       
   184          TBool iCancelNeeded;                              // Is cancel needed?
       
   185 		 TBool iSynchronousMode;                           // In synchronous mode
       
   186         
       
   187     public:     // Friend classes
       
   188         // None
       
   189 
       
   190     protected:  // Friend classes
       
   191         // None
       
   192 
       
   193     private:    // Friend classes
       
   194         // None
       
   195 
       
   196     };
       
   197 
       
   198 
       
   199 
       
   200 
       
   201 // DESCRIPTION
       
   202 // CTestModuleContainer is a class, which contains the test execution thread
       
   203 // and interface functions to do operations in that thread context.
       
   204 class CTestModuleContainer 
       
   205        :public CActive  
       
   206     {
       
   207 
       
   208     public: // Enumerations
       
   209         enum TOperation
       
   210             {
       
   211             EInitializeModule,
       
   212             EEnumerateInThread,
       
   213             EExecuteTestInThread,
       
   214             EFreeEnumerationData,
       
   215             EExit,
       
   216             };
       
   217         
       
   218         enum TRequestType
       
   219             {
       
   220             ERqTestCase,
       
   221             ERqErrorPrint,
       
   222             };
       
   223 
       
   224     private: // Enumerations
       
   225 
       
   226     public:  // Constructors and destructor
       
   227 
       
   228         /**
       
   229         * NewL is first phase of two-phased constructor.
       
   230         */
       
   231         static CTestModuleContainer* NewL( const TDesC& aName, 
       
   232                                            CTestModule* aSession,
       
   233                                            const TDesC& aConfig );
       
   234 
       
   235         /**
       
   236         * Destructor of CTestModuleContainer.
       
   237         */
       
   238         virtual ~CTestModuleContainer();
       
   239 
       
   240 
       
   241     public: // New functions
       
   242 
       
   243         /**
       
   244         * Initialize the test module
       
   245         */
       
   246         TInt Initialize( const TFileName& aName,
       
   247                          const TBool aFirstTime );
       
   248 
       
   249         /**
       
   250         * Enumerate test cases
       
   251         */
       
   252         TInt EnumerateTestCases( const TFileName& aName );
       
   253 
       
   254 
       
   255         /**
       
   256         * Frees the enumeration data
       
   257         */
       
   258         TInt FreeEnumerationData();
       
   259 
       
   260         /**
       
   261         * Run a test case
       
   262         */
       
   263         void RunTestCase( const TFileName& aName,
       
   264                           const TInt aCaseNumber,
       
   265                           const RMessage2& aMessage );
       
   266 
       
   267 
       
   268         /**
       
   269         * Changes the operation, can fail
       
   270         */
       
   271         TInt ChangeOperation( const TOperation aOperation, 
       
   272                               const TFileName& aNameBuffer,
       
   273                               const TInt aInt );
       
   274 
       
   275         /**
       
   276         * Changes the operation
       
   277         */
       
   278 		void ChangeOperationNoError( const TOperation aOperation,
       
   279                                      const TInt aInt );
       
   280 
       
   281         /**
       
   282         * Return the operation
       
   283         */
       
   284         //@spe const TOperation Operation();
       
   285         TOperation Operation();
       
   286 
       
   287         /**
       
   288         * Set a new execution subsession
       
   289         */
       
   290         void SetExecutionSubSession( CTestExecution* aExecution );
       
   291 
       
   292         /**
       
   293         * Pauses the thread
       
   294         */
       
   295         TInt PauseThread();
       
   296 
       
   297         /**
       
   298         * Resumes the thread
       
   299         */
       
   300         TInt ResumeThread();
       
   301 
       
   302         /**
       
   303         * Returns pointer to test cases
       
   304         */
       
   305         const RPointerArray<TTestCaseInfo>* TestCases() const;
       
   306 
       
   307         /**
       
   308         * Returns error code from operation
       
   309         */
       
   310         TInt& OperationErrorResult();
       
   311 
       
   312         /**
       
   313         * Returns error code from module
       
   314         */
       
   315         TInt& ModuleResult();
       
   316 
       
   317         /**
       
   318         * Kill the thread
       
   319         */
       
   320         void KillThread( const TInt aCode );
       
   321         
       
   322         /**
       
   323         * Error print handler.
       
   324         */
       
   325         void DoErrorPrint();
       
   326 
       
   327         /**
       
   328         * Make sure that any of the test interference thread's won't stay
       
   329         * to run if test case is crashed of test interference object is not
       
   330         * deleted.
       
   331         */ 
       
   332         void KillTestinterferenceThread();
       
   333 
       
   334         /**
       
   335         * Make sure that any of the test measurement process's won't stay
       
   336         * to run if test case is crashed of test measurement object is not
       
   337         * deleted.
       
   338         */
       
   339         void KillTestMeasurement();
       
   340 
       
   341     public: 
       
   342     
       
   343         /**
       
   344         * Get semaphore handles.
       
   345         */
       
   346         TInt OperationStartSemHandle(){ return iOperationStartSemaphore.Handle(); };
       
   347         TInt OperationChangeSemHandle(){ return iOperationChangeSemaphore.Handle(); };
       
   348     
       
   349         /** 
       
   350         * Access to "shared" memory.
       
   351         * Called from test thread'
       
   352         */
       
   353         void SetThreadContainer( CTestThreadContainer* aThread )
       
   354             { iThreadContainer = aThread; };
       
   355         
       
   356         const TDesC& OperationName(){ return iOperationName; };
       
   357 
       
   358         TDes& OperationText(){ return iOperationText; };
       
   359         
       
   360         TInt& OperationIntBuffer(){ return iOperationIntBuffer; };
       
   361         
       
   362         TOperation OperationType(){ return iOperationType; };
       
   363         
       
   364         const TDesC& TestModuleName();
       
   365         const TDesC& TestModuleIniFile();
       
   366         
       
   367         CTestModuleIf::TExitReason& AllowedExitReason()
       
   368             { return iAllowedExitReason; };   
       
   369 
       
   370         TInt& AllowedExitCode(){ return iAllowedExitCode; };        
       
   371       
       
   372         TThreadId ServerThreadId(){ return iServerThreadId; };
       
   373         
       
   374         CTestExecution* TestExecution()
       
   375             { return iCTestExecution; };
       
   376 
       
   377         TRequestStatus* GetRequest( TRequestType aType );
       
   378         
       
   379         TErrorNotification& ErrorNotification(){ return iErrorPrint; };
       
   380         
       
   381         TInt ErrorPrintSemHandle(){ return iErrorPrintSem.Handle(); };
       
   382         
       
   383         /**
       
   384         * Get title of currently running test case
       
   385         */ 
       
   386         void GetTestCaseTitleL(TDes& aTestCaseTitle);
       
   387 
       
   388         /**
       
   389          * Gets pointer to test module
       
   390          */
       
   391         CTestModule* GetTestModule();        
       
   392         
       
   393     public: // Functions from base classes
       
   394 
       
   395         /**
       
   396         * RunL derived from CActive handles the completed requests.
       
   397         */
       
   398         void RunL();
       
   399 
       
   400         /**
       
   401         * DoCancel derived from CActive handles the Cancel
       
   402         */
       
   403         void DoCancel();
       
   404 
       
   405         /**
       
   406         * RunError derived from CActive handles errors from active handler.
       
   407         */
       
   408         TInt RunError( TInt aError );
       
   409 
       
   410     protected:  // New functions
       
   411 
       
   412         /**
       
   413         * By default Symbian OS constructor is private.
       
   414         */
       
   415         void ConstructL( const TDesC& aName, 
       
   416                          CTestModule* aSession,
       
   417                          const TDesC& aConfig );
       
   418 
       
   419 	private:  // New functions
       
   420 
       
   421 		/**
       
   422         * Start and wait until operation is completed.
       
   423         */
       
   424         TInt StartAndWaitOperation();
       
   425 
       
   426         /**
       
   427         * Completes operation from test execution thread or from undertaker
       
   428         */
       
   429         void Complete(  const TInt aCompletionCode );
       
   430 
       
   431         /**
       
   432         * Function that initialise module in execution thread context.
       
   433         */
       
   434         TInt InitializeModuleInThread( RLibrary& aModule );
       
   435 
       
   436         /**
       
   437         * Function that enumerates test cases in execution thread context.
       
   438         */
       
   439         TInt EnumerateInThread();
       
   440 
       
   441         /**
       
   442         * Function that frees the enumeration data in execution thread context.
       
   443         */
       
   444         void FreeEnumerationDataInThread();
       
   445 
       
   446         /**
       
   447         * Function that executes test case in execution thread context.
       
   448         */
       
   449         TInt ExecuteTestCaseInThread();
       
   450 
       
   451 		
       
   452         /**
       
   453         * Delete a test module instance
       
   454         */
       
   455 		void DeleteTestModule();
       
   456 
       
   457         /**
       
   458         * Function that resolves test case completion code
       
   459         */
       
   460         TInt ResolveCompletionCode( TInt aLeaveCode,
       
   461                                     TInt aErrorCode );
       
   462 
       
   463         /**
       
   464         * Test case execution thread thread function
       
   465         */
       
   466         static TInt ExecutionThread( TAny* aParams );
       
   467 
       
   468         /**
       
   469         * Parse stack and heap information for TestScripter's
       
   470         * test case (config) file.
       
   471         */
       
   472 		TInt ReadParametersFromScriptFileL( const TDesC& aConfig,
       
   473                                             TInt& aStackSize,
       
   474 											TInt& aHeapMinSize,
       
   475 											TInt& aHeapMaxSize );
       
   476 
       
   477         /**
       
   478         * Loads dynamically testmodule and calls SetRequirements()-
       
   479 		* method for test module parameter handling.
       
   480         */
       
   481         TInt ReadParametersFromTestModule( const TDesC& aModuleName,
       
   482 										CTestModuleParam*& aTestModuleParam );
       
   483 
       
   484         /**
       
   485         * Load test module dynamically. If loading is done succesfully
       
   486 		* then get test module's parameters according to version.
       
   487         * Verifies received parameters also.
       
   488         */
       
   489         TInt GetTestModuleParams( const TDesC& aModuleName,
       
   490                                     const TDesC& aConfig,
       
   491 									TInt& aStackSize,
       
   492 									TInt& aHeapMinSize,
       
   493 									TInt& aHeapMaxSize );
       
   494 
       
   495     protected:  // Functions from base classes
       
   496         // None
       
   497 
       
   498     private:
       
   499 
       
   500         /** 
       
   501         * C++ default constructor.
       
   502         */
       
   503         CTestModuleContainer();
       
   504 
       
   505     public:     // Data
       
   506 
       
   507     protected:  // Data
       
   508         // None
       
   509 
       
   510     private:    // Data     
       
   511         CTestExecution* iCTestExecution;         // Handle to "parent" test execution
       
   512         CTestModule* iCTestModule;               // Handle to "parent"  module
       
   513         CUnderTaker* iUnderTaker;                // Pointer to thread undertaker
       
   514         CTestThreadContainer*   iThreadContainer;// Pointer thread container
       
   515 
       
   516         RThread iThread;                         // Thread where test module lives in
       
   517         TBool iUpAndRunning;                     // Is the thread running
       
   518         TOperation iOperationType;               // What to do?
       
   519 
       
   520         RSemaphore iOperationStartSemaphore;     // Used to wait until something to do
       
   521         RSemaphore iOperationChangeSemaphore;    // Protects the operation changes
       
   522 
       
   523         TPtr iOperationName;                     // Operation descriptor buffer
       
   524         HBufC* iModuleNameBuffer;                // HBuffer for module name file;
       
   525      
       
   526         TInt iOperationIntBuffer;                // Transfers operation int to thread
       
   527 
       
   528         RMessage2 iMessage;                      // Message to complete, used in RunTestCase
       
   529 
       
   530         // Results from test module
       
   531         TInt iModuleResult;                      // Low priority result from test module
       
   532         TInt iErrorResult;                       // High priority error from operation
       
   533         TRequestStatus iOperationStatus;         // Operation ongoing?
       
   534         TThreadId iServerThreadId;               // Server thread Id. Used in completion
       
   535 		TBuf<30> iOperationText;                 // Human readable current operation for
       
   536 		
       
   537         CTestModuleIf::TExitReason iAllowedExitReason;          // Allowed exit reason
       
   538         TInt iAllowedExitCode;                   // Allowed exit code
       
   539         
       
   540         // Error print handler	    
       
   541         CErrorPrintHandler*         iErrorPrintHandler;
       
   542         
       
   543         RSemaphore      iErrorPrintSem;          // Synchonize error messages
       
   544         TErrorNotification  iErrorPrint;
       
   545 
       
   546         // Indicates is pause operation executed. This value will be checked
       
   547         // when test case is executed. Resume operation will be reset this
       
   548         // value.
       
   549         TBool  iIsPaused;
       
   550 
       
   551 		// This active scheduler is uses as a nested one        
       
   552         CActiveSchedulerWait*       iNestedActiveScheduler;
       
   553     
       
   554     public:     // Friend classes
       
   555         friend class CUnderTaker;                // Handles the thread deaths
       
   556         friend class CErrorPrintHandler;
       
   557 
       
   558     protected:  // Friend classes
       
   559         // None
       
   560 
       
   561     private:    // Friend classes
       
   562         // None
       
   563     };
       
   564 
       
   565 
       
   566 // DESCRIPTION
       
   567 // CTestServer is a server class.
       
   568 // Contains an object container index which provides subsessions with object containers.
       
   569 class CTestServer
       
   570         :public CServer2
       
   571     {
       
   572     public: // Enumerations
       
   573         enum { ETestServerPriority = CActive::EPriorityHigh };
       
   574 
       
   575     private: // Enumerations
       
   576 
       
   577     public:  // Constructors and destructor
       
   578 
       
   579         /**
       
   580         * NewL is first phase of two-phased constructor.
       
   581         */
       
   582         static CTestServer* NewL( const TFileName& aName );
       
   583 
       
   584         /**
       
   585         * Destructor of CTestServer.
       
   586         */
       
   587         ~CTestServer();
       
   588 
       
   589     public: // New functions
       
   590 
       
   591         /**
       
   592         * ThreadFunction is used to create new thread.
       
   593         */
       
   594         static TInt ThreadFunction( TAny* aStarted );
       
   595 
       
   596         /**
       
   597         * Return object container, guaranteed to produce object containers with
       
   598         * unique ids within the server.
       
   599         */
       
   600         CObjectCon* NewContainerL();
       
   601 
       
   602         /**
       
   603         * Removes a container. Needed to close session properly.
       
   604         */
       
   605         void DeleteContainer( CObjectCon* aContainer );
       
   606                     
       
   607         /**
       
   608         * Inform Server that session is closed.
       
   609         */
       
   610         void SessionClosed();
       
   611         
       
   612         /**
       
   613         * Returns module name
       
   614         */
       
   615         const TDesC& ModuleName() const;
       
   616 
       
   617         /**
       
   618         * Is module inside this server already initialised?
       
   619         */
       
   620         //@spe const TBool FirstTime() const;
       
   621         TBool FirstTime() const;
       
   622 
       
   623         /**
       
   624         * Clears the module first time flag.
       
   625         */
       
   626         void ClearFirstTime();
       
   627 
       
   628         /**
       
   629         * PanicServer panics the CTestServer
       
   630         */
       
   631         static void PanicServer( const TTestServerPanic aPanic );
       
   632 
       
   633         /**
       
   634         * GetServerThreadId for ServerStateHandler Active object usage
       
   635         */
       
   636         TInt GetServerThreadId ();
       
   637         
       
   638         /**
       
   639          * Gets CTestThreadContainerRunner pointer which is used in UI testing
       
   640          */
       
   641         CTestThreadContainerRunnerFactory* GetTestThreadContainerRunnerFactory();
       
   642                 
       
   643         /**
       
   644          * Gets information that testserver supports UI testing or not
       
   645          */
       
   646         TBool IsUiTestingSupported();
       
   647         
       
   648         /**
       
   649          * Gets pointer to UiEnvProxy.
       
   650          */
       
   651         CUiEnvProxy* GetUiEnvProxy();
       
   652     public: // Functions from base classes
       
   653 
       
   654         /**
       
   655         * NewSessionL creates new CTestServer session.
       
   656         */
       
   657         CSession2* NewSessionL( const TVersion &aVersion,
       
   658                                 const RMessage2& aMessage ) const;
       
   659 
       
   660     protected:  // New functions
       
   661         // None
       
   662 
       
   663     protected:  // Functions from base classes
       
   664         // None
       
   665 
       
   666     private:
       
   667 
       
   668         /** 
       
   669         * C++ default constructor.
       
   670         */
       
   671         CTestServer();
       
   672 
       
   673         /**
       
   674         * By default Symbian OS constructor is private.
       
   675         */
       
   676         void ConstructL( const TFileName& aName );
       
   677 
       
   678     public:   //Data
       
   679         // None
       
   680     
       
   681     protected:  // Data
       
   682         // None
       
   683 
       
   684     private:    // Data
       
   685         CObjectConIx* iContainerIndex;           // Pointer to container
       
   686         TPtr iModuleName;                        // Server name
       
   687         HBufC* iModuleNameBuffer;                // HBuffer for module name file;
       
   688         TBool iFirstTime;                        // Is module previously initialized?
       
   689 
       
   690         // Container count
       
   691         TInt                    iSessionCount;
       
   692 
       
   693         TBool iUiTestingSupport;						 // Indicates if it is testserver which supports UI testing
       
   694         CTestThreadContainerRunnerFactory* iTestThreadContainerRunnerFactory; // Pointer to CTestThreadContainerRunnerFactory
       
   695     public:     // Friend classes
       
   696         // None
       
   697 
       
   698     protected:  // Friend classes
       
   699         // None
       
   700 
       
   701     private:    // Friend classes
       
   702         // None
       
   703 
       
   704     };
       
   705 
       
   706 // DESCRIPTION
       
   707 // CTestCasesList is a class, which contains list of test cases assosiated with
       
   708 // specified config file.
       
   709 NONSHARABLE_CLASS( CTestCasesList ): public CBase
       
   710     {
       
   711 public:
       
   712     /**
       
   713     * NewL is first phase of two-phased constructor.
       
   714     */
       
   715     static CTestCasesList* NewL( const TDesC& aConfigFileName );
       
   716 public:
       
   717     /**
       
   718     * Destructor of CTestServer.
       
   719     */
       
   720     ~CTestCasesList();
       
   721 
       
   722     /**
       
   723      * Appends test case.
       
   724      */
       
   725     void AppendTestCaseL( const TDesC& aTestCaseTitle );
       
   726     
       
   727     /**
       
   728      * Returns specified test case title.
       
   729      */
       
   730     const TDesC& GetTestCaseTitleL( TInt aIndex ) const;
       
   731     
       
   732     /**
       
   733      * Returns config file name.
       
   734      */
       
   735     const TDesC& GetConfigFileName() const;
       
   736     
       
   737     /**
       
   738      * Returns count of test cases.
       
   739      */
       
   740     TInt Count() const;
       
   741     
       
   742     /**
       
   743      * Resets list of test cases.
       
   744      */
       
   745     void ResetAndDestroy();
       
   746 private:
       
   747     /** 
       
   748     * C++ default constructor.
       
   749     */
       
   750     CTestCasesList();
       
   751     
       
   752     /**
       
   753     * By default Symbian OS constructor is private.
       
   754     */
       
   755     void ConstructL( const TDesC& aConfigFileName );
       
   756 private:
       
   757     // Config file name
       
   758     HBufC* iConfigFileName;
       
   759     // List of test cases
       
   760     RPointerArray<HBufC> iTestCases;
       
   761     };
       
   762 
       
   763         
       
   764 // DESCRIPTION
       
   765 // CTestModule is a session class.
       
   766 // Session for the CTestServer server, to a single client-side session
       
   767 // a session may own any number of CCounter objects
       
   768 class CTestModule
       
   769         :public CSession2
       
   770     {    
       
   771     public:
       
   772         // None
       
   773 
       
   774     private: // Enumerations
       
   775         // None
       
   776 
       
   777     public:  // Constructors and destructor
       
   778 
       
   779         /**
       
   780         * Construct a test module object.
       
   781         */
       
   782         static CTestModule* NewL( CTestServer* aServer );
       
   783 
       
   784         /**
       
   785         * Destructor
       
   786         */
       
   787         virtual ~CTestModule();
       
   788 
       
   789     public: // New functions
       
   790 
       
   791         /**
       
   792         * Dispatch message
       
   793         */
       
   794         TInt DispatchMessageL( const RMessage2& aMessage );
       
   795 
       
   796         /**
       
   797         * Create Module Session
       
   798         */
       
   799         TInt CreateModuleSessionL( const RMessage2& aMessage );
       
   800 
       
   801         /**
       
   802         * Close the session to CTestServer.
       
   803         */
       
   804         TInt CloseSession( const RMessage2& aMessage );
       
   805 
       
   806 
       
   807         /**
       
   808         * Create CTestExecution subsession.
       
   809         */
       
   810         TInt NewTestExecutionL( const RMessage2& aMessage );
       
   811 
       
   812         /**
       
   813         * Destroy the created CTestExecution subsession.
       
   814         * Cannot fail - can panic client.
       
   815         */
       
   816         void DeleteTestExecution( const TUint aHandle, const RMessage2& aMessage );
       
   817 
       
   818         /**
       
   819         * NumResources is used to provide reserver resources to client.
       
   820         */
       
   821         void NumResources( const RMessage2& aMessage );
       
   822 
       
   823         /**
       
   824         * Return the number of resources owned by the session.
       
   825         */
       
   826         TInt CountResources();
       
   827 
       
   828         /**
       
   829         * Enumerates test cases
       
   830         */
       
   831         TInt EnumerateTestCasesL( const RMessage2& aMessage );
       
   832 
       
   833         /**
       
   834         * Get test cases
       
   835         */
       
   836         TInt GetTestCasesL( const RMessage2& aMessage );
       
   837 
       
   838         /**
       
   839         * Handles error notifications
       
   840         */
       
   841         TInt HandleErrorNotificationL( const RMessage2& aMessage );
       
   842 
       
   843         /**
       
   844         * Get Server Thread Id
       
   845         */
       
   846         TInt GetServerThreadIdL( const RMessage2& aMessage );
       
   847 
       
   848         /**
       
   849         * 
       
   850         */
       
   851         TInt PassEngineSessionSettings( const RMessage2& aMessage );
       
   852 
       
   853         /**
       
   854         * Prints error notification
       
   855         */
       
   856         void ErrorPrint( const TInt aPriority, 
       
   857                          TPtrC aError );
       
   858 
       
   859         /**
       
   860         * Cancels asynchronous request
       
   861         */
       
   862         TInt CancelAsyncRequestL( const RMessage2& aMessage );
       
   863 
       
   864         /**
       
   865         * Frees a test case specific data owned by module( i.e enumeration data )
       
   866         */
       
   867         TInt FreeCaseData();
       
   868 
       
   869         /**
       
   870         * Returns case corresponding handle
       
   871         */
       
   872         CTestExecution* CaseFromHandle( const TUint aHandle, const RMessage2& aMessage ) const;
       
   873 
       
   874         /**
       
   875         * Returns module initialisation file name
       
   876         */
       
   877         const TDesC& IniName() const;
       
   878 
       
   879 		/**
       
   880         * Returns module name
       
   881         */
       
   882 		const TDesC& Name() const;
       
   883 
       
   884         /**
       
   885         * Returns a test module.
       
   886         */
       
   887         TInt GetTestModule( CTestModuleContainer*& aContainer,
       
   888                             const TDesC& aConfig );
       
   889 
       
   890         /**
       
   891         * Frees a test module.
       
   892         */
       
   893         TInt FreeTestModule( CTestModuleContainer* aModule );
       
   894 
       
   895         /**
       
   896         * Write is utility method.
       
   897         */
       
   898         void Write( const TAny* aPtr, const TDesC8& aDes, TInt anOffset = 0 );
       
   899 
       
   900         /**
       
   901         * PanicClient panics the user of CTestModule( RTestModule user )
       
   902         */
       
   903         void PanicClient( TInt aPanic, const RMessage2& aMessage ) const;
       
   904 
       
   905         /**
       
   906         * Get title of currently running test case
       
   907         */ 
       
   908         void GetTestCaseTitleL(TInt aTestCaseNumber, const TDesC& aConfigFile, TDes& aTestCaseTitle);
       
   909 
       
   910         /**
       
   911          * Get pointer to test server
       
   912          */ 
       
   913          CTestServer* GetTestServer();        
       
   914 
       
   915          TBool UiTesting();
       
   916                  
       
   917          TBool SeperateProcesses();         
       
   918          
       
   919     public: // Functions from base classes
       
   920 
       
   921         /**
       
   922         * ServiceL handles the messages to CTestServer
       
   923         */
       
   924         virtual void ServiceL( const RMessage2& aMessage );
       
   925 
       
   926     protected:  // New functions
       
   927         // None
       
   928 
       
   929     protected:  // Functions from base classes
       
   930         // None
       
   931 
       
   932     private:
       
   933 
       
   934         /** 
       
   935         * C++ default constructor.
       
   936         */
       
   937         CTestModule();
       
   938 
       
   939         /**
       
   940         * By default Symbian OS constructor is private.
       
   941         */
       
   942         void ConstructL( CTestServer* aServer );
       
   943 
       
   944     public:   //Data
       
   945         // None
       
   946 
       
   947     
       
   948     protected:  // Data
       
   949         // None
       
   950 
       
   951     private:    // Data
       
   952         RPointerArray<CTestModuleContainer>* iTestModuleInstances; // List of FREE test modules
       
   953         CTestServer* iTestServer;                    // Pointer to "parent"
       
   954         CObjectCon* iContainer;                  // Object container for this session
       
   955         CObjectIx* iTestExecutionHandle;         // Object index( stores CTestExecutions,
       
   956                                                  // (Unclosed)subsession handle )
       
   957 
       
   958         TBool iUiTesting;
       
   959         TBool iSeperateProcesses;
       
   960         
       
   961         TInt iResourceCount;                     // Total number of resources allocated
       
   962         TPtr iIni;                               // Module initialisation( file ) name
       
   963         HBufC* iIniBuffer;                       // HBuffer for ini name file;
       
   964 
       
   965         CTestModuleContainer* iEnumerateModule;  // Module used in enumeration
       
   966 
       
   967         RMessage2 iErrorMessage;                 // Error message
       
   968 
       
   969         TBool iErrorMessageAvailable;            // Error message available?
       
   970         
       
   971         RPointerArray<CTestCasesList> iTestCaseTitlesMap;    //Test case titles
       
   972         
       
   973     public:     // Friend classes
       
   974         // None
       
   975 
       
   976     protected:  // Friend classes
       
   977         // None
       
   978 
       
   979     private:    // Friend classes
       
   980         // None
       
   981 
       
   982     };
       
   983 
       
   984 
       
   985 // CLASS DECLARATION
       
   986 
       
   987 // DESCRIPTION
       
   988 // CPrintHandler class is an active object that handles print
       
   989 // indication from test thread.
       
   990 class CPrintHandler 
       
   991     : public CActive
       
   992     {
       
   993 
       
   994     public:  // Enumerations
       
   995 
       
   996     private: // Enumerations
       
   997 
       
   998     public:  // Constructors and destructor
       
   999 
       
  1000         /**
       
  1001         * NewL is first phase of two-phased constructor.
       
  1002         */
       
  1003         static CPrintHandler* NewL( CTestExecution& aExecution );
       
  1004 
       
  1005         /**
       
  1006         * Destructor of CPrintHandler.
       
  1007         */
       
  1008         virtual ~CPrintHandler();
       
  1009 
       
  1010     public: // New functions
       
  1011 
       
  1012         /**
       
  1013         * Start monitoring
       
  1014         */
       
  1015         void StartL();
       
  1016 
       
  1017     public: // Functions from base classes
       
  1018 
       
  1019         /**
       
  1020         * RunL derived from CActive handles the completed requests.
       
  1021         */
       
  1022         void RunL();
       
  1023 
       
  1024         /**
       
  1025         * DoCancel derived from CActive handles the Cancel
       
  1026         */
       
  1027         void DoCancel();
       
  1028 
       
  1029         /**
       
  1030         * RunError derived from CActive handles errors from active handler.
       
  1031         */
       
  1032         TInt RunError( TInt aError );
       
  1033 
       
  1034     protected:  // New functions
       
  1035         // None
       
  1036 
       
  1037     protected:  // Functions from base classes
       
  1038         // None
       
  1039 
       
  1040     private:
       
  1041 
       
  1042         /** 
       
  1043         * C++ default constructor.
       
  1044         */
       
  1045         CPrintHandler( CTestExecution& aExecution );
       
  1046        
       
  1047         /**
       
  1048         * By default Symbian OS constructor is private.
       
  1049         */
       
  1050         void ConstructL();
       
  1051 
       
  1052     public:   //Data
       
  1053         // None
       
  1054     
       
  1055     protected:  // Data
       
  1056         // None
       
  1057 
       
  1058     private:    // Data
       
  1059          CTestExecution&        iExecution;     // Pointer to parent
       
  1060         
       
  1061     public:     // Friend classes
       
  1062         // None
       
  1063 
       
  1064     protected:  // Friend classes
       
  1065         // None
       
  1066 
       
  1067     private:    // Friend classes
       
  1068         // None
       
  1069 
       
  1070     };
       
  1071 
       
  1072 // CLASS DECLARATION
       
  1073 
       
  1074 // DESCRIPTION
       
  1075 // CEventHandler class is an active object that handles print
       
  1076 // indication from test thread.
       
  1077 class CEventHandler 
       
  1078     : public CActive
       
  1079     {
       
  1080 
       
  1081     public:  // Enumerations
       
  1082 
       
  1083     private: // Enumerations
       
  1084 
       
  1085     public:  // Constructors and destructor
       
  1086 
       
  1087         /**
       
  1088         * NewL is first phase of two-phased constructor.
       
  1089         */
       
  1090         static CEventHandler* NewL( CTestExecution& aExecution );
       
  1091 
       
  1092         /**
       
  1093         * Destructor of CEventHandler.
       
  1094         */
       
  1095         virtual ~CEventHandler();
       
  1096 
       
  1097     public: // New functions
       
  1098 
       
  1099         /**
       
  1100         * Start monitoring
       
  1101         */
       
  1102         void StartL();
       
  1103 
       
  1104     public: // Functions from base classes
       
  1105 
       
  1106         /**
       
  1107         * RunL derived from CActive handles the completed requests.
       
  1108         */
       
  1109         void RunL();
       
  1110 
       
  1111         /**
       
  1112         * DoCancel derived from CActive handles the Cancel
       
  1113         */
       
  1114         void DoCancel();
       
  1115 
       
  1116         /**
       
  1117         * RunError derived from CActive handles errors from active handler.
       
  1118         */
       
  1119         TInt RunError( TInt aError );
       
  1120 
       
  1121     protected:  // New functions
       
  1122         // None
       
  1123 
       
  1124     protected:  // Functions from base classes
       
  1125         // None
       
  1126 
       
  1127     private:
       
  1128 
       
  1129         /** 
       
  1130         * C++ default constructor.
       
  1131         */
       
  1132         CEventHandler( CTestExecution& aExecution );
       
  1133        
       
  1134         /**
       
  1135         * By default Symbian OS constructor is private.
       
  1136         */
       
  1137         void ConstructL();
       
  1138 
       
  1139     public:   //Data
       
  1140         // None
       
  1141     
       
  1142     protected:  // Data
       
  1143         // None
       
  1144 
       
  1145     private:    // Data
       
  1146          CTestExecution&        iExecution;     // Pointer to parent
       
  1147         
       
  1148     public:     // Friend classes
       
  1149         // None
       
  1150 
       
  1151     protected:  // Friend classes
       
  1152         // None
       
  1153 
       
  1154     private:    // Friend classes
       
  1155         // None
       
  1156 
       
  1157     };
       
  1158 
       
  1159 // CLASS DECLARATION
       
  1160 
       
  1161 // DESCRIPTION
       
  1162 // CSndHandler class is an active object that handles print
       
  1163 // indication from test thread.
       
  1164 class CSndHandler 
       
  1165     : public CActive
       
  1166     {
       
  1167 
       
  1168     public:  // Enumerations
       
  1169 
       
  1170     private: // Enumerations
       
  1171 
       
  1172     public:  // Constructors and destructor
       
  1173 
       
  1174         /**
       
  1175         * NewL is first phase of two-phased constructor.
       
  1176         */
       
  1177         static CSndHandler* NewL( CTestExecution& aExecution );
       
  1178 
       
  1179         /**
       
  1180         * Destructor of CSndHandler.
       
  1181         */
       
  1182         virtual ~CSndHandler();
       
  1183 
       
  1184     public: // New functions
       
  1185 
       
  1186         /**
       
  1187         * Start monitoring
       
  1188         */
       
  1189         void StartL();
       
  1190 
       
  1191     public: // Functions from base classes
       
  1192 
       
  1193         /**
       
  1194         * RunL derived from CActive handles the completed requests.
       
  1195         */
       
  1196         void RunL();
       
  1197 
       
  1198         /**
       
  1199         * DoCancel derived from CActive handles the Cancel
       
  1200         */
       
  1201         void DoCancel();
       
  1202 
       
  1203         /**
       
  1204         * RunError derived from CActive handles errors from active handler.
       
  1205         */
       
  1206         TInt RunError( TInt aError );
       
  1207 
       
  1208     protected:  // New functions
       
  1209         // None
       
  1210 
       
  1211     protected:  // Functions from base classes
       
  1212         // None
       
  1213 
       
  1214     private:
       
  1215 
       
  1216         /** 
       
  1217         * C++ default constructor.
       
  1218         */
       
  1219         CSndHandler( CTestExecution& aExecution );
       
  1220        
       
  1221         /**
       
  1222         * By default Symbian OS constructor is private.
       
  1223         */
       
  1224         void ConstructL();
       
  1225 
       
  1226     public:   //Data
       
  1227         // None
       
  1228     
       
  1229     protected:  // Data
       
  1230         // None
       
  1231 
       
  1232     private:    // Data
       
  1233          CTestExecution&        iExecution;     // Pointer to parent
       
  1234         
       
  1235     public:     // Friend classes
       
  1236         // None
       
  1237 
       
  1238     protected:  // Friend classes
       
  1239         // None
       
  1240 
       
  1241     private:    // Friend classes
       
  1242         // None
       
  1243 
       
  1244     };
       
  1245 
       
  1246 // CLASS DECLARATION
       
  1247 
       
  1248 // DESCRIPTION
       
  1249 // CRcvHandler class is an active object that handles print
       
  1250 // indication from test thread.
       
  1251 class CRcvHandler 
       
  1252     : public CActive
       
  1253     {
       
  1254 
       
  1255     public:  // Enumerations
       
  1256 
       
  1257     private: // Enumerations
       
  1258 
       
  1259     public:  // Constructors and destructor
       
  1260 
       
  1261         /**
       
  1262         * NewL is first phase of two-phased constructor.
       
  1263         */
       
  1264         static CRcvHandler* NewL( CTestExecution& aExecution );
       
  1265 
       
  1266         /**
       
  1267         * Destructor of CRcvHandler.
       
  1268         */
       
  1269         virtual ~CRcvHandler();
       
  1270 
       
  1271     public: // New functions
       
  1272 
       
  1273         /**
       
  1274         * Start monitoring
       
  1275         */
       
  1276         void StartL();
       
  1277 
       
  1278     public: // Functions from base classes
       
  1279 
       
  1280         /**
       
  1281         * RunL derived from CActive handles the completed requests.
       
  1282         */
       
  1283         void RunL();
       
  1284 
       
  1285         /**
       
  1286         * DoCancel derived from CActive handles the Cancel
       
  1287         */
       
  1288         void DoCancel();
       
  1289 
       
  1290         /**
       
  1291         * RunError derived from CActive handles errors from active handler.
       
  1292         */
       
  1293         TInt RunError( TInt aError );
       
  1294 
       
  1295     protected:  // New functions
       
  1296         // None
       
  1297 
       
  1298     protected:  // Functions from base classes
       
  1299         // None
       
  1300 
       
  1301     private:
       
  1302 
       
  1303         /** 
       
  1304         * C++ default constructor.
       
  1305         */
       
  1306         CRcvHandler( CTestExecution& aExecution );
       
  1307        
       
  1308         /**
       
  1309         * By default Symbian OS constructor is private.
       
  1310         */
       
  1311         void ConstructL();
       
  1312 
       
  1313     public:   //Data
       
  1314         // None
       
  1315     
       
  1316     protected:  // Data
       
  1317         // None
       
  1318 
       
  1319     private:    // Data
       
  1320          CTestExecution&        iExecution;     // Pointer to parent
       
  1321         
       
  1322     public:     // Friend classes
       
  1323         // None
       
  1324 
       
  1325     protected:  // Friend classes
       
  1326         // None
       
  1327 
       
  1328     private:    // Friend classes
       
  1329         // None
       
  1330 
       
  1331     };
       
  1332         
       
  1333 // CLASS DECLARATION
       
  1334 
       
  1335 // DESCRIPTION
       
  1336 // CErrorPrintHandler class is an active object that handles print
       
  1337 // indication from test thread.
       
  1338 class CErrorPrintHandler 
       
  1339     : public CActive
       
  1340     {
       
  1341 
       
  1342     public:  // Enumerations
       
  1343 
       
  1344     private: // Enumerations
       
  1345 
       
  1346     public:  // Constructors and destructor
       
  1347 
       
  1348         /**
       
  1349         * NewL is first phase of two-phased constructor.
       
  1350         */
       
  1351         static CErrorPrintHandler* NewL( CTestModuleContainer& aContainer );
       
  1352 
       
  1353         /**
       
  1354         * Destructor of CErrorPrintHandler.
       
  1355         */
       
  1356         virtual ~CErrorPrintHandler();
       
  1357 
       
  1358     public: // New functions
       
  1359 
       
  1360         /**
       
  1361         * Start monitoring
       
  1362         */
       
  1363         void StartL();
       
  1364 
       
  1365     public: // Functions from base classes
       
  1366 
       
  1367         /**
       
  1368         * RunL derived from CActive handles the completed requests.
       
  1369         */
       
  1370         void RunL();
       
  1371 
       
  1372         /**
       
  1373         * DoCancel derived from CActive handles the Cancel
       
  1374         */
       
  1375         void DoCancel();
       
  1376 
       
  1377         /**
       
  1378         * RunError derived from CActive handles errors from active handler.
       
  1379         */
       
  1380         TInt RunError( TInt aError );
       
  1381 
       
  1382     protected:  // New functions
       
  1383         // None
       
  1384 
       
  1385     protected:  // Functions from base classes
       
  1386         // None
       
  1387 
       
  1388     private:
       
  1389 
       
  1390         /** 
       
  1391         * C++ default constructor.
       
  1392         */
       
  1393         CErrorPrintHandler( CTestModuleContainer& aContainer );
       
  1394        
       
  1395         /**
       
  1396         * By default Symbian OS constructor is private.
       
  1397         */
       
  1398         void ConstructL();
       
  1399 
       
  1400     public:   //Data
       
  1401         // None
       
  1402     
       
  1403     protected:  // Data
       
  1404         // None
       
  1405 
       
  1406     private:    // Data
       
  1407          CTestModuleContainer&      iContainer;     // Pointer to parent
       
  1408         
       
  1409     public:     // Friend classes
       
  1410         // None
       
  1411 
       
  1412     protected:  // Friend classes
       
  1413         // None
       
  1414 
       
  1415     private:    // Friend classes
       
  1416         // None
       
  1417 
       
  1418     };
       
  1419 
       
  1420 // CLASS DECLARATION
       
  1421 
       
  1422 // DESCRIPTION
       
  1423 // CTestInterferenceHandler class is an active object that handles test
       
  1424 // interference
       
  1425 NONSHARABLE_CLASS( CInterferenceHandler ) 
       
  1426     : public CActive
       
  1427     {
       
  1428 
       
  1429     public:  // Enumerations
       
  1430 
       
  1431     private: // Enumerations
       
  1432 
       
  1433     public:  // Constructors and destructor
       
  1434 
       
  1435         /**
       
  1436         * NewL is first phase of two-phased constructor.
       
  1437         */
       
  1438         static CInterferenceHandler* NewL( CTestExecution& aExecution );
       
  1439 
       
  1440         /**
       
  1441         * Destructor of CInterferenceHandler.
       
  1442         */
       
  1443         virtual ~CInterferenceHandler();
       
  1444 
       
  1445     public: // New functions
       
  1446 
       
  1447         /**
       
  1448         * Start monitoring
       
  1449         */
       
  1450         void StartL();
       
  1451 
       
  1452     public: // Functions from base classes
       
  1453 
       
  1454         /**
       
  1455         * RunL derived from CActive handles the completed requests.
       
  1456         */
       
  1457         void RunL();
       
  1458 
       
  1459         /**
       
  1460         * DoCancel derived from CActive handles the Cancel
       
  1461         */
       
  1462         void DoCancel();
       
  1463 
       
  1464         /**
       
  1465         * RunError derived from CActive handles errors from active handler.
       
  1466         */
       
  1467         TInt RunError( TInt aError );
       
  1468 
       
  1469     protected:  // New functions
       
  1470         // None
       
  1471 
       
  1472     protected:  // Functions from base classes
       
  1473         // None
       
  1474 
       
  1475     private:
       
  1476 
       
  1477         /** 
       
  1478         * C++ default constructor.
       
  1479         */
       
  1480         CInterferenceHandler( CTestExecution& aExecution );
       
  1481        
       
  1482         /**
       
  1483         * By default Symbian OS constructor is private.
       
  1484         */
       
  1485         void ConstructL();
       
  1486 
       
  1487     public:   //Data
       
  1488         // None
       
  1489     
       
  1490     protected:  // Data
       
  1491         // None
       
  1492 
       
  1493     private:    // Data
       
  1494          CTestExecution&        iExecution;     // Pointer to parent
       
  1495         
       
  1496     public:     // Friend classes
       
  1497         // None
       
  1498 
       
  1499     protected:  // Friend classes
       
  1500         // None
       
  1501 
       
  1502     private:    // Friend classes
       
  1503         // None
       
  1504 
       
  1505     };
       
  1506 
       
  1507 
       
  1508 // DESCRIPTION
       
  1509 // CMeasurementHandler class is an active object that handles test
       
  1510 // measurement
       
  1511 NONSHARABLE_CLASS( CMeasurementHandler ) 
       
  1512     : public CActive
       
  1513     {
       
  1514 
       
  1515     public:  // Enumerations
       
  1516 
       
  1517     private: // Enumerations
       
  1518 
       
  1519     public:  // Constructors and destructor
       
  1520 
       
  1521         /**
       
  1522         * NewL is first phase of two-phased constructor.
       
  1523         */
       
  1524         static CMeasurementHandler* NewL( CTestExecution& aExecution );
       
  1525 
       
  1526         /**
       
  1527         * Destructor of CMeasurementHandler.
       
  1528         */
       
  1529         virtual ~CMeasurementHandler();
       
  1530 
       
  1531     public: // New functions
       
  1532 
       
  1533         /**
       
  1534         * Start monitoring
       
  1535         */
       
  1536         void StartL();
       
  1537 
       
  1538     public: // Functions from base classes
       
  1539 
       
  1540         /**
       
  1541         * RunL derived from CActive handles the completed requests.
       
  1542         */
       
  1543         void RunL();
       
  1544 
       
  1545         /**
       
  1546         * DoCancel derived from CActive handles the Cancel
       
  1547         */
       
  1548         void DoCancel();
       
  1549 
       
  1550         /**
       
  1551         * RunError derived from CActive handles errors from active handler.
       
  1552         */
       
  1553         TInt RunError( TInt aError );
       
  1554 
       
  1555     protected:  // New functions
       
  1556         // None
       
  1557 
       
  1558     protected:  // Functions from base classes
       
  1559         // None
       
  1560 
       
  1561     private:
       
  1562 
       
  1563         /** 
       
  1564         * C++ default constructor.
       
  1565         */
       
  1566         CMeasurementHandler( CTestExecution& aExecution );
       
  1567 
       
  1568         /**
       
  1569         * By default Symbian OS constructor is private.
       
  1570         */
       
  1571         void ConstructL();
       
  1572 
       
  1573     public:   //Data
       
  1574         // None
       
  1575 
       
  1576     protected:  // Data
       
  1577         // None
       
  1578 
       
  1579     private:    // Data
       
  1580 
       
  1581         // Pointer to test execution side
       
  1582         CTestExecution&        iExecution;
       
  1583 
       
  1584     public:     // Friend classes
       
  1585         // None
       
  1586 
       
  1587     protected:  // Friend classes
       
  1588         // None
       
  1589 
       
  1590     private:    // Friend classes
       
  1591         // None
       
  1592 
       
  1593     };
       
  1594 
       
  1595 /**
       
  1596 * Check is module TestScripter. Does parsing and returns new module name and
       
  1597 * error codes(Needed operations when creating server sessions to TestScripter).
       
  1598 */
       
  1599 TInt CheckModuleName( TFileName aModuleName, TFileName& aNewModuleName );
       
  1600 
       
  1601 /**
       
  1602 * Remove optional index appended to module name.
       
  1603 * If it is found (@ char) then set new module name without it.
       
  1604 * This feature is used when iSeparateProcesses is set in TestEngine.
       
  1605 */
       
  1606 void RemoveOptionalIndex(const TDesC& aModuleName, TDes& aNewModuleName);
       
  1607 
       
  1608 // DESCRIPTION
       
  1609 // CEventHandler class is an active object that handles print
       
  1610 // indication from test thread.
       
  1611 NONSHARABLE_CLASS(CCommandHandler)
       
  1612     : public CActive
       
  1613     {
       
  1614 
       
  1615     public:  // Enumerations
       
  1616 
       
  1617     private: // Enumerations
       
  1618 
       
  1619     public:  // Constructors and destructor
       
  1620 
       
  1621         /**
       
  1622         * NewL is first phase of two-phased constructor.
       
  1623         */
       
  1624         static CCommandHandler* NewL(CTestExecution& aExecution);
       
  1625 
       
  1626         /**
       
  1627         * Destructor of CCommandHandler.
       
  1628         */
       
  1629         virtual ~CCommandHandler();
       
  1630 
       
  1631     public: // New functions
       
  1632 
       
  1633         /**
       
  1634         * Start monitoring
       
  1635         */
       
  1636         void StartL();
       
  1637 
       
  1638     public: // Functions from base classes
       
  1639 
       
  1640         /**
       
  1641         * RunL derived from CActive handles the completed requests.
       
  1642         */
       
  1643         void RunL();
       
  1644 
       
  1645         /**
       
  1646         * DoCancel derived from CActive handles the Cancel
       
  1647         */
       
  1648         void DoCancel();
       
  1649 
       
  1650         /**
       
  1651         * RunError derived from CActive handles errors from active handler.
       
  1652         */
       
  1653         TInt RunError(TInt aError);
       
  1654 
       
  1655     protected:  // New functions
       
  1656         // None
       
  1657 
       
  1658     protected:  // Functions from base classes
       
  1659         // None
       
  1660 
       
  1661     private:
       
  1662 
       
  1663         /**
       
  1664         * C++ default constructor.
       
  1665         */
       
  1666         CCommandHandler(CTestExecution& aExecution);
       
  1667 
       
  1668         /**
       
  1669         * By default Symbian OS constructor is private.
       
  1670         */
       
  1671         void ConstructL();
       
  1672 
       
  1673     public:   //Data
       
  1674         // None
       
  1675 
       
  1676     protected:  // Data
       
  1677         // None
       
  1678 
       
  1679     private:    // Data
       
  1680          CTestExecution&        iExecution;     // Pointer to parent
       
  1681 
       
  1682     public:     // Friend classes
       
  1683         // None
       
  1684 
       
  1685     protected:  // Friend classes
       
  1686         // None
       
  1687 
       
  1688     private:    // Friend classes
       
  1689         // None
       
  1690 
       
  1691     };
       
  1692 
       
  1693 #endif // TEST_SERVER_H
       
  1694     
       
  1695 // End of File