stif/TestServer/inc/TestServer.h
branchRCL_3
changeset 59 8ad140f3dd41
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 
       
    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 UiTesting();
       
   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 iUiTesting;						 // 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         * Prints error notification
       
   851         */
       
   852         void ErrorPrint( const TInt aPriority, 
       
   853                          TPtrC aError );
       
   854 
       
   855         /**
       
   856         * Cancels asynchronous request
       
   857         */
       
   858         TInt CancelAsyncRequestL( const RMessage2& aMessage );
       
   859 
       
   860         /**
       
   861         * Frees a test case specific data owned by module( i.e enumeration data )
       
   862         */
       
   863         TInt FreeCaseData();
       
   864 
       
   865         /**
       
   866         * Returns case corresponding handle
       
   867         */
       
   868         CTestExecution* CaseFromHandle( const TUint aHandle, const RMessage2& aMessage ) const;
       
   869 
       
   870         /**
       
   871         * Returns module initialisation file name
       
   872         */
       
   873         const TDesC& IniName() const;
       
   874 
       
   875 		/**
       
   876         * Returns module name
       
   877         */
       
   878 		const TDesC& Name() const;
       
   879 
       
   880         /**
       
   881         * Returns a test module.
       
   882         */
       
   883         TInt GetTestModule( CTestModuleContainer*& aContainer,
       
   884                             const TDesC& aConfig );
       
   885 
       
   886         /**
       
   887         * Frees a test module.
       
   888         */
       
   889         TInt FreeTestModule( CTestModuleContainer* aModule );
       
   890 
       
   891         /**
       
   892         * Write is utility method.
       
   893         */
       
   894         void Write( const TAny* aPtr, const TDesC8& aDes, TInt anOffset = 0 );
       
   895 
       
   896         /**
       
   897         * PanicClient panics the user of CTestModule( RTestModule user )
       
   898         */
       
   899         void PanicClient( TInt aPanic, const RMessage2& aMessage ) const;
       
   900 
       
   901         /**
       
   902         * Get title of currently running test case
       
   903         */ 
       
   904         void GetTestCaseTitleL(TInt aTestCaseNumber, const TDesC& aConfigFile, TDes& aTestCaseTitle);
       
   905 
       
   906         /**
       
   907          * Get pointer to test server
       
   908          */ 
       
   909          CTestServer* GetTestServer();        
       
   910         
       
   911     public: // Functions from base classes
       
   912 
       
   913         /**
       
   914         * ServiceL handles the messages to CTestServer
       
   915         */
       
   916         virtual void ServiceL( const RMessage2& aMessage );
       
   917 
       
   918 
       
   919     protected:  // New functions
       
   920         // None
       
   921 
       
   922     protected:  // Functions from base classes
       
   923         // None
       
   924 
       
   925     private:
       
   926 
       
   927         /** 
       
   928         * C++ default constructor.
       
   929         */
       
   930         CTestModule();
       
   931 
       
   932         /**
       
   933         * By default Symbian OS constructor is private.
       
   934         */
       
   935         void ConstructL( CTestServer* aServer );
       
   936 
       
   937     public:   //Data
       
   938         // None
       
   939 
       
   940     
       
   941     protected:  // Data
       
   942         // None
       
   943 
       
   944     private:    // Data
       
   945         RPointerArray<CTestModuleContainer>* iTestModuleInstances; // List of FREE test modules
       
   946         CTestServer* iTestServer;                    // Pointer to "parent"
       
   947         CObjectCon* iContainer;                  // Object container for this session
       
   948         CObjectIx* iTestExecutionHandle;         // Object index( stores CTestExecutions,
       
   949                                                  // (Unclosed)subsession handle )
       
   950 
       
   951         TInt iResourceCount;                     // Total number of resources allocated
       
   952         TPtr iIni;                               // Module initialisation( file ) name
       
   953         HBufC* iIniBuffer;                       // HBuffer for ini name file;
       
   954 
       
   955         CTestModuleContainer* iEnumerateModule;  // Module used in enumeration
       
   956 
       
   957         RMessage2 iErrorMessage;                 // Error message
       
   958 
       
   959         TBool iErrorMessageAvailable;            // Error message available?
       
   960         
       
   961         RPointerArray<CTestCasesList> iTestCaseTitlesMap;    //Test case titles
       
   962         
       
   963     public:     // Friend classes
       
   964         // None
       
   965 
       
   966     protected:  // Friend classes
       
   967         // None
       
   968 
       
   969     private:    // Friend classes
       
   970         // None
       
   971 
       
   972     };
       
   973 
       
   974 
       
   975 // CLASS DECLARATION
       
   976 
       
   977 // DESCRIPTION
       
   978 // CPrintHandler class is an active object that handles print
       
   979 // indication from test thread.
       
   980 class CPrintHandler 
       
   981     : public CActive
       
   982     {
       
   983 
       
   984     public:  // Enumerations
       
   985 
       
   986     private: // Enumerations
       
   987 
       
   988     public:  // Constructors and destructor
       
   989 
       
   990         /**
       
   991         * NewL is first phase of two-phased constructor.
       
   992         */
       
   993         static CPrintHandler* NewL( CTestExecution& aExecution );
       
   994 
       
   995         /**
       
   996         * Destructor of CPrintHandler.
       
   997         */
       
   998         virtual ~CPrintHandler();
       
   999 
       
  1000     public: // New functions
       
  1001 
       
  1002         /**
       
  1003         * Start monitoring
       
  1004         */
       
  1005         void StartL();
       
  1006 
       
  1007     public: // Functions from base classes
       
  1008 
       
  1009         /**
       
  1010         * RunL derived from CActive handles the completed requests.
       
  1011         */
       
  1012         void RunL();
       
  1013 
       
  1014         /**
       
  1015         * DoCancel derived from CActive handles the Cancel
       
  1016         */
       
  1017         void DoCancel();
       
  1018 
       
  1019         /**
       
  1020         * RunError derived from CActive handles errors from active handler.
       
  1021         */
       
  1022         TInt RunError( TInt aError );
       
  1023 
       
  1024     protected:  // New functions
       
  1025         // None
       
  1026 
       
  1027     protected:  // Functions from base classes
       
  1028         // None
       
  1029 
       
  1030     private:
       
  1031 
       
  1032         /** 
       
  1033         * C++ default constructor.
       
  1034         */
       
  1035         CPrintHandler( CTestExecution& aExecution );
       
  1036        
       
  1037         /**
       
  1038         * By default Symbian OS constructor is private.
       
  1039         */
       
  1040         void ConstructL();
       
  1041 
       
  1042     public:   //Data
       
  1043         // None
       
  1044     
       
  1045     protected:  // Data
       
  1046         // None
       
  1047 
       
  1048     private:    // Data
       
  1049          CTestExecution&        iExecution;     // Pointer to parent
       
  1050         
       
  1051     public:     // Friend classes
       
  1052         // None
       
  1053 
       
  1054     protected:  // Friend classes
       
  1055         // None
       
  1056 
       
  1057     private:    // Friend classes
       
  1058         // None
       
  1059 
       
  1060     };
       
  1061 
       
  1062 // CLASS DECLARATION
       
  1063 
       
  1064 // DESCRIPTION
       
  1065 // CEventHandler class is an active object that handles print
       
  1066 // indication from test thread.
       
  1067 class CEventHandler 
       
  1068     : public CActive
       
  1069     {
       
  1070 
       
  1071     public:  // Enumerations
       
  1072 
       
  1073     private: // Enumerations
       
  1074 
       
  1075     public:  // Constructors and destructor
       
  1076 
       
  1077         /**
       
  1078         * NewL is first phase of two-phased constructor.
       
  1079         */
       
  1080         static CEventHandler* NewL( CTestExecution& aExecution );
       
  1081 
       
  1082         /**
       
  1083         * Destructor of CEventHandler.
       
  1084         */
       
  1085         virtual ~CEventHandler();
       
  1086 
       
  1087     public: // New functions
       
  1088 
       
  1089         /**
       
  1090         * Start monitoring
       
  1091         */
       
  1092         void StartL();
       
  1093 
       
  1094     public: // Functions from base classes
       
  1095 
       
  1096         /**
       
  1097         * RunL derived from CActive handles the completed requests.
       
  1098         */
       
  1099         void RunL();
       
  1100 
       
  1101         /**
       
  1102         * DoCancel derived from CActive handles the Cancel
       
  1103         */
       
  1104         void DoCancel();
       
  1105 
       
  1106         /**
       
  1107         * RunError derived from CActive handles errors from active handler.
       
  1108         */
       
  1109         TInt RunError( TInt aError );
       
  1110 
       
  1111     protected:  // New functions
       
  1112         // None
       
  1113 
       
  1114     protected:  // Functions from base classes
       
  1115         // None
       
  1116 
       
  1117     private:
       
  1118 
       
  1119         /** 
       
  1120         * C++ default constructor.
       
  1121         */
       
  1122         CEventHandler( CTestExecution& aExecution );
       
  1123        
       
  1124         /**
       
  1125         * By default Symbian OS constructor is private.
       
  1126         */
       
  1127         void ConstructL();
       
  1128 
       
  1129     public:   //Data
       
  1130         // None
       
  1131     
       
  1132     protected:  // Data
       
  1133         // None
       
  1134 
       
  1135     private:    // Data
       
  1136          CTestExecution&        iExecution;     // Pointer to parent
       
  1137         
       
  1138     public:     // Friend classes
       
  1139         // None
       
  1140 
       
  1141     protected:  // Friend classes
       
  1142         // None
       
  1143 
       
  1144     private:    // Friend classes
       
  1145         // None
       
  1146 
       
  1147     };
       
  1148 
       
  1149 // CLASS DECLARATION
       
  1150 
       
  1151 // DESCRIPTION
       
  1152 // CSndHandler class is an active object that handles print
       
  1153 // indication from test thread.
       
  1154 class CSndHandler 
       
  1155     : public CActive
       
  1156     {
       
  1157 
       
  1158     public:  // Enumerations
       
  1159 
       
  1160     private: // Enumerations
       
  1161 
       
  1162     public:  // Constructors and destructor
       
  1163 
       
  1164         /**
       
  1165         * NewL is first phase of two-phased constructor.
       
  1166         */
       
  1167         static CSndHandler* NewL( CTestExecution& aExecution );
       
  1168 
       
  1169         /**
       
  1170         * Destructor of CSndHandler.
       
  1171         */
       
  1172         virtual ~CSndHandler();
       
  1173 
       
  1174     public: // New functions
       
  1175 
       
  1176         /**
       
  1177         * Start monitoring
       
  1178         */
       
  1179         void StartL();
       
  1180 
       
  1181     public: // Functions from base classes
       
  1182 
       
  1183         /**
       
  1184         * RunL derived from CActive handles the completed requests.
       
  1185         */
       
  1186         void RunL();
       
  1187 
       
  1188         /**
       
  1189         * DoCancel derived from CActive handles the Cancel
       
  1190         */
       
  1191         void DoCancel();
       
  1192 
       
  1193         /**
       
  1194         * RunError derived from CActive handles errors from active handler.
       
  1195         */
       
  1196         TInt RunError( TInt aError );
       
  1197 
       
  1198     protected:  // New functions
       
  1199         // None
       
  1200 
       
  1201     protected:  // Functions from base classes
       
  1202         // None
       
  1203 
       
  1204     private:
       
  1205 
       
  1206         /** 
       
  1207         * C++ default constructor.
       
  1208         */
       
  1209         CSndHandler( CTestExecution& aExecution );
       
  1210        
       
  1211         /**
       
  1212         * By default Symbian OS constructor is private.
       
  1213         */
       
  1214         void ConstructL();
       
  1215 
       
  1216     public:   //Data
       
  1217         // None
       
  1218     
       
  1219     protected:  // Data
       
  1220         // None
       
  1221 
       
  1222     private:    // Data
       
  1223          CTestExecution&        iExecution;     // Pointer to parent
       
  1224         
       
  1225     public:     // Friend classes
       
  1226         // None
       
  1227 
       
  1228     protected:  // Friend classes
       
  1229         // None
       
  1230 
       
  1231     private:    // Friend classes
       
  1232         // None
       
  1233 
       
  1234     };
       
  1235 
       
  1236 // CLASS DECLARATION
       
  1237 
       
  1238 // DESCRIPTION
       
  1239 // CRcvHandler class is an active object that handles print
       
  1240 // indication from test thread.
       
  1241 class CRcvHandler 
       
  1242     : public CActive
       
  1243     {
       
  1244 
       
  1245     public:  // Enumerations
       
  1246 
       
  1247     private: // Enumerations
       
  1248 
       
  1249     public:  // Constructors and destructor
       
  1250 
       
  1251         /**
       
  1252         * NewL is first phase of two-phased constructor.
       
  1253         */
       
  1254         static CRcvHandler* NewL( CTestExecution& aExecution );
       
  1255 
       
  1256         /**
       
  1257         * Destructor of CRcvHandler.
       
  1258         */
       
  1259         virtual ~CRcvHandler();
       
  1260 
       
  1261     public: // New functions
       
  1262 
       
  1263         /**
       
  1264         * Start monitoring
       
  1265         */
       
  1266         void StartL();
       
  1267 
       
  1268     public: // Functions from base classes
       
  1269 
       
  1270         /**
       
  1271         * RunL derived from CActive handles the completed requests.
       
  1272         */
       
  1273         void RunL();
       
  1274 
       
  1275         /**
       
  1276         * DoCancel derived from CActive handles the Cancel
       
  1277         */
       
  1278         void DoCancel();
       
  1279 
       
  1280         /**
       
  1281         * RunError derived from CActive handles errors from active handler.
       
  1282         */
       
  1283         TInt RunError( TInt aError );
       
  1284 
       
  1285     protected:  // New functions
       
  1286         // None
       
  1287 
       
  1288     protected:  // Functions from base classes
       
  1289         // None
       
  1290 
       
  1291     private:
       
  1292 
       
  1293         /** 
       
  1294         * C++ default constructor.
       
  1295         */
       
  1296         CRcvHandler( CTestExecution& aExecution );
       
  1297        
       
  1298         /**
       
  1299         * By default Symbian OS constructor is private.
       
  1300         */
       
  1301         void ConstructL();
       
  1302 
       
  1303     public:   //Data
       
  1304         // None
       
  1305     
       
  1306     protected:  // Data
       
  1307         // None
       
  1308 
       
  1309     private:    // Data
       
  1310          CTestExecution&        iExecution;     // Pointer to parent
       
  1311         
       
  1312     public:     // Friend classes
       
  1313         // None
       
  1314 
       
  1315     protected:  // Friend classes
       
  1316         // None
       
  1317 
       
  1318     private:    // Friend classes
       
  1319         // None
       
  1320 
       
  1321     };
       
  1322         
       
  1323 // CLASS DECLARATION
       
  1324 
       
  1325 // DESCRIPTION
       
  1326 // CErrorPrintHandler class is an active object that handles print
       
  1327 // indication from test thread.
       
  1328 class CErrorPrintHandler 
       
  1329     : public CActive
       
  1330     {
       
  1331 
       
  1332     public:  // Enumerations
       
  1333 
       
  1334     private: // Enumerations
       
  1335 
       
  1336     public:  // Constructors and destructor
       
  1337 
       
  1338         /**
       
  1339         * NewL is first phase of two-phased constructor.
       
  1340         */
       
  1341         static CErrorPrintHandler* NewL( CTestModuleContainer& aContainer );
       
  1342 
       
  1343         /**
       
  1344         * Destructor of CErrorPrintHandler.
       
  1345         */
       
  1346         virtual ~CErrorPrintHandler();
       
  1347 
       
  1348     public: // New functions
       
  1349 
       
  1350         /**
       
  1351         * Start monitoring
       
  1352         */
       
  1353         void StartL();
       
  1354 
       
  1355     public: // Functions from base classes
       
  1356 
       
  1357         /**
       
  1358         * RunL derived from CActive handles the completed requests.
       
  1359         */
       
  1360         void RunL();
       
  1361 
       
  1362         /**
       
  1363         * DoCancel derived from CActive handles the Cancel
       
  1364         */
       
  1365         void DoCancel();
       
  1366 
       
  1367         /**
       
  1368         * RunError derived from CActive handles errors from active handler.
       
  1369         */
       
  1370         TInt RunError( TInt aError );
       
  1371 
       
  1372     protected:  // New functions
       
  1373         // None
       
  1374 
       
  1375     protected:  // Functions from base classes
       
  1376         // None
       
  1377 
       
  1378     private:
       
  1379 
       
  1380         /** 
       
  1381         * C++ default constructor.
       
  1382         */
       
  1383         CErrorPrintHandler( CTestModuleContainer& aContainer );
       
  1384        
       
  1385         /**
       
  1386         * By default Symbian OS constructor is private.
       
  1387         */
       
  1388         void ConstructL();
       
  1389 
       
  1390     public:   //Data
       
  1391         // None
       
  1392     
       
  1393     protected:  // Data
       
  1394         // None
       
  1395 
       
  1396     private:    // Data
       
  1397          CTestModuleContainer&      iContainer;     // Pointer to parent
       
  1398         
       
  1399     public:     // Friend classes
       
  1400         // None
       
  1401 
       
  1402     protected:  // Friend classes
       
  1403         // None
       
  1404 
       
  1405     private:    // Friend classes
       
  1406         // None
       
  1407 
       
  1408     };
       
  1409 
       
  1410 // CLASS DECLARATION
       
  1411 
       
  1412 // DESCRIPTION
       
  1413 // CTestInterferenceHandler class is an active object that handles test
       
  1414 // interference
       
  1415 NONSHARABLE_CLASS( CInterferenceHandler ) 
       
  1416     : public CActive
       
  1417     {
       
  1418 
       
  1419     public:  // Enumerations
       
  1420 
       
  1421     private: // Enumerations
       
  1422 
       
  1423     public:  // Constructors and destructor
       
  1424 
       
  1425         /**
       
  1426         * NewL is first phase of two-phased constructor.
       
  1427         */
       
  1428         static CInterferenceHandler* NewL( CTestExecution& aExecution );
       
  1429 
       
  1430         /**
       
  1431         * Destructor of CInterferenceHandler.
       
  1432         */
       
  1433         virtual ~CInterferenceHandler();
       
  1434 
       
  1435     public: // New functions
       
  1436 
       
  1437         /**
       
  1438         * Start monitoring
       
  1439         */
       
  1440         void StartL();
       
  1441 
       
  1442     public: // Functions from base classes
       
  1443 
       
  1444         /**
       
  1445         * RunL derived from CActive handles the completed requests.
       
  1446         */
       
  1447         void RunL();
       
  1448 
       
  1449         /**
       
  1450         * DoCancel derived from CActive handles the Cancel
       
  1451         */
       
  1452         void DoCancel();
       
  1453 
       
  1454         /**
       
  1455         * RunError derived from CActive handles errors from active handler.
       
  1456         */
       
  1457         TInt RunError( TInt aError );
       
  1458 
       
  1459     protected:  // New functions
       
  1460         // None
       
  1461 
       
  1462     protected:  // Functions from base classes
       
  1463         // None
       
  1464 
       
  1465     private:
       
  1466 
       
  1467         /** 
       
  1468         * C++ default constructor.
       
  1469         */
       
  1470         CInterferenceHandler( CTestExecution& aExecution );
       
  1471        
       
  1472         /**
       
  1473         * By default Symbian OS constructor is private.
       
  1474         */
       
  1475         void ConstructL();
       
  1476 
       
  1477     public:   //Data
       
  1478         // None
       
  1479     
       
  1480     protected:  // Data
       
  1481         // None
       
  1482 
       
  1483     private:    // Data
       
  1484          CTestExecution&        iExecution;     // Pointer to parent
       
  1485         
       
  1486     public:     // Friend classes
       
  1487         // None
       
  1488 
       
  1489     protected:  // Friend classes
       
  1490         // None
       
  1491 
       
  1492     private:    // Friend classes
       
  1493         // None
       
  1494 
       
  1495     };
       
  1496 
       
  1497 
       
  1498 // DESCRIPTION
       
  1499 // CMeasurementHandler class is an active object that handles test
       
  1500 // measurement
       
  1501 NONSHARABLE_CLASS( CMeasurementHandler ) 
       
  1502     : public CActive
       
  1503     {
       
  1504 
       
  1505     public:  // Enumerations
       
  1506 
       
  1507     private: // Enumerations
       
  1508 
       
  1509     public:  // Constructors and destructor
       
  1510 
       
  1511         /**
       
  1512         * NewL is first phase of two-phased constructor.
       
  1513         */
       
  1514         static CMeasurementHandler* NewL( CTestExecution& aExecution );
       
  1515 
       
  1516         /**
       
  1517         * Destructor of CMeasurementHandler.
       
  1518         */
       
  1519         virtual ~CMeasurementHandler();
       
  1520 
       
  1521     public: // New functions
       
  1522 
       
  1523         /**
       
  1524         * Start monitoring
       
  1525         */
       
  1526         void StartL();
       
  1527 
       
  1528     public: // Functions from base classes
       
  1529 
       
  1530         /**
       
  1531         * RunL derived from CActive handles the completed requests.
       
  1532         */
       
  1533         void RunL();
       
  1534 
       
  1535         /**
       
  1536         * DoCancel derived from CActive handles the Cancel
       
  1537         */
       
  1538         void DoCancel();
       
  1539 
       
  1540         /**
       
  1541         * RunError derived from CActive handles errors from active handler.
       
  1542         */
       
  1543         TInt RunError( TInt aError );
       
  1544 
       
  1545     protected:  // New functions
       
  1546         // None
       
  1547 
       
  1548     protected:  // Functions from base classes
       
  1549         // None
       
  1550 
       
  1551     private:
       
  1552 
       
  1553         /** 
       
  1554         * C++ default constructor.
       
  1555         */
       
  1556         CMeasurementHandler( CTestExecution& aExecution );
       
  1557 
       
  1558         /**
       
  1559         * By default Symbian OS constructor is private.
       
  1560         */
       
  1561         void ConstructL();
       
  1562 
       
  1563     public:   //Data
       
  1564         // None
       
  1565 
       
  1566     protected:  // Data
       
  1567         // None
       
  1568 
       
  1569     private:    // Data
       
  1570 
       
  1571         // Pointer to test execution side
       
  1572         CTestExecution&        iExecution;
       
  1573 
       
  1574     public:     // Friend classes
       
  1575         // None
       
  1576 
       
  1577     protected:  // Friend classes
       
  1578         // None
       
  1579 
       
  1580     private:    // Friend classes
       
  1581         // None
       
  1582 
       
  1583     };
       
  1584 
       
  1585 /**
       
  1586 * Check is module TestScripter. Does parsing and returns new module name and
       
  1587 * error codes(Needed operations when creating server sessions to TestScripter).
       
  1588 */
       
  1589 TInt CheckModuleName( TFileName aModuleName, TFileName& aNewModuleName );
       
  1590 
       
  1591 /**
       
  1592 * Remove optional index appended to module name.
       
  1593 * If it is found (@ char) then set new module name without it.
       
  1594 * This feature is used when iSeparateProcesses is set in TestEngine.
       
  1595 */
       
  1596 void RemoveOptionalIndex(const TDesC& aModuleName, TDes& aNewModuleName);
       
  1597 
       
  1598 // DESCRIPTION
       
  1599 // CEventHandler class is an active object that handles print
       
  1600 // indication from test thread.
       
  1601 NONSHARABLE_CLASS(CCommandHandler)
       
  1602     : public CActive
       
  1603     {
       
  1604 
       
  1605     public:  // Enumerations
       
  1606 
       
  1607     private: // Enumerations
       
  1608 
       
  1609     public:  // Constructors and destructor
       
  1610 
       
  1611         /**
       
  1612         * NewL is first phase of two-phased constructor.
       
  1613         */
       
  1614         static CCommandHandler* NewL(CTestExecution& aExecution);
       
  1615 
       
  1616         /**
       
  1617         * Destructor of CCommandHandler.
       
  1618         */
       
  1619         virtual ~CCommandHandler();
       
  1620 
       
  1621     public: // New functions
       
  1622 
       
  1623         /**
       
  1624         * Start monitoring
       
  1625         */
       
  1626         void StartL();
       
  1627 
       
  1628     public: // Functions from base classes
       
  1629 
       
  1630         /**
       
  1631         * RunL derived from CActive handles the completed requests.
       
  1632         */
       
  1633         void RunL();
       
  1634 
       
  1635         /**
       
  1636         * DoCancel derived from CActive handles the Cancel
       
  1637         */
       
  1638         void DoCancel();
       
  1639 
       
  1640         /**
       
  1641         * RunError derived from CActive handles errors from active handler.
       
  1642         */
       
  1643         TInt RunError(TInt aError);
       
  1644 
       
  1645     protected:  // New functions
       
  1646         // None
       
  1647 
       
  1648     protected:  // Functions from base classes
       
  1649         // None
       
  1650 
       
  1651     private:
       
  1652 
       
  1653         /**
       
  1654         * C++ default constructor.
       
  1655         */
       
  1656         CCommandHandler(CTestExecution& aExecution);
       
  1657 
       
  1658         /**
       
  1659         * By default Symbian OS constructor is private.
       
  1660         */
       
  1661         void ConstructL();
       
  1662 
       
  1663     public:   //Data
       
  1664         // None
       
  1665 
       
  1666     protected:  // Data
       
  1667         // None
       
  1668 
       
  1669     private:    // Data
       
  1670          CTestExecution&        iExecution;     // Pointer to parent
       
  1671 
       
  1672     public:     // Friend classes
       
  1673         // None
       
  1674 
       
  1675     protected:  // Friend classes
       
  1676         // None
       
  1677 
       
  1678     private:    // Friend classes
       
  1679         // None
       
  1680 
       
  1681     };
       
  1682 
       
  1683 #endif // TEST_SERVER_H
       
  1684 
       
  1685 // End of File