stif/TestEngine/inc/TestCaseController.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 * CTestCaseController, the CTestProgressNotifier and the 
       
    16 * CTestEventNotifier.
       
    17 *
       
    18 */
       
    19 
       
    20 #ifndef TEST_CASE_CONTROLLER_H
       
    21 #define TEST_CASE_CONTROLLER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32std.h>
       
    25 #include <e32base.h>
       
    26 #include <stifinternal/TestServerClient.h>
       
    27 #include <atslogger.h>
       
    28 #include "TestEngine.h"
       
    29 #include "TestCallBack.h"
       
    30 
       
    31 #include "StifHWReset.h"
       
    32 
       
    33 // CONSTANTS
       
    34 // None
       
    35 
       
    36 // MACROS
       
    37 // None
       
    38 
       
    39 // DATA TYPES
       
    40 // None
       
    41 
       
    42 // FUNCTION PROTOTYPES
       
    43 // None
       
    44 typedef CStifHWReset*( *CTestInterfaceFactory )();
       
    45 
       
    46 // FORWARD DECLARATIONS
       
    47 class CTestModuleController;
       
    48 class CTestReport;
       
    49 class CTestCaseTimeout;
       
    50 
       
    51 // CLASS DECLARATION
       
    52 
       
    53 // DESCRIPTION
       
    54 // CTestCaseController is an active object used for running the test case
       
    55 // using the RTestExecution API.
       
    56 class CTestCaseController
       
    57         : public CActive
       
    58     {
       
    59     public:     // Enumerations
       
    60         // None
       
    61 
       
    62     private:    // Enumerations
       
    63 
       
    64         // TTestCaseStatus defines the status of test case
       
    65         enum TTestCaseStatus
       
    66             {
       
    67             ETestCaseIdle,
       
    68             ETestCaseRunning,
       
    69             ETestCaseCompleted,
       
    70             ETestCaseTimeout,
       
    71             ETestCaseSuicided, //test case has killed itself
       
    72             };
       
    73 
       
    74     public:     // Constructors and destructor
       
    75 
       
    76         /**
       
    77         * Two-phased constructor.
       
    78         */
       
    79         static CTestCaseController* NewL( CTestEngine* aEngine,
       
    80             CTestReport* aTestReport,
       
    81             CAtsLogger& aAtsLogger,
       
    82             RTestExecution aTestExecution, 
       
    83             const TTestInfo& aTestInfo );
       
    84 
       
    85         /**
       
    86         * Destructor.
       
    87         */
       
    88         ~CTestCaseController();
       
    89 
       
    90     public:     // New functions
       
    91 
       
    92         /**
       
    93         * StartL starts the CTestCaseController active object.
       
    94         */
       
    95         void StartL( const RMessage2& aMessage );
       
    96 
       
    97         /**
       
    98         * Timeouts a testcase
       
    99         */
       
   100         void Timeout();
       
   101 
       
   102         /**
       
   103         * Kills a testcase
       
   104         */
       
   105         void Suicide(TStopExecutionType aType, TInt aCode);
       
   106 
       
   107     public:     // Functions from base classes
       
   108 
       
   109         /**
       
   110         * RunL derived from CActive handles the completed requests.
       
   111         */
       
   112         void RunL();
       
   113 
       
   114         /**
       
   115         * DoCancel derived from CActive handles the Cancel
       
   116         */
       
   117         void DoCancel();
       
   118 
       
   119         /**
       
   120         * RunError derived from CActive handles errors from active handler.
       
   121         */
       
   122         TInt RunError( TInt aError );
       
   123         
       
   124         /**
       
   125         * Get testcase info(test module, config file, test case, etc).
       
   126         */
       
   127         void GetTestCaseInfo( TTestInfo& aTestInfo );
       
   128 
       
   129     protected:  // New functions
       
   130         // None
       
   131 
       
   132     protected:  // Functions from base classes
       
   133         // None
       
   134 
       
   135     private:
       
   136 
       
   137         /**
       
   138         * By default Symbian OS constructor is private.
       
   139         */
       
   140         void ConstructL();
       
   141 
       
   142         /**
       
   143         * Parametric C++ constructor.
       
   144         */
       
   145         CTestCaseController( CTestEngine* aEngine, 
       
   146                              CTestReport* aTestReport,
       
   147                              CAtsLogger& aAtsLogger,
       
   148                              RTestExecution aTestExecution,
       
   149                              const TTestInfo& aTestInfo );
       
   150         
       
   151         /**
       
   152         * Generates XML log about the test case.
       
   153         */
       
   154         void GenerateXmlLogL();
       
   155 
       
   156     public:     // Data
       
   157         // None
       
   158     
       
   159     protected:  // Data
       
   160         // None
       
   161 
       
   162     private:    // Data
       
   163 
       
   164         // Pointer to CTestEngine
       
   165         CTestEngine*        iEngine;
       
   166 
       
   167         // Pointer to Test Report
       
   168         CTestReport*        iTestReport;
       
   169 
       
   170         // Handle to RTestExecution
       
   171         RTestExecution      iTestExecution;
       
   172 
       
   173         // Pointer to timeout handler
       
   174         CTestCaseTimeout*    iTimeout;
       
   175 
       
   176         // Test Info
       
   177         TTestInfo           iTestInfo;
       
   178 
       
   179         // Test case arguments
       
   180 		HBufC*              iTestCaseArguments;
       
   181         
       
   182         // Internal state
       
   183         TTestCaseStatus     iState;
       
   184 
       
   185         // Test Result
       
   186         TFullTestResult     iResult;
       
   187         TFullTestResultPckg iResultPckg;
       
   188 
       
   189         // Message to be completed when case is finished
       
   190         RMessage2            iMessage;
       
   191 
       
   192         // AtsLogger
       
   193         CAtsLogger&         iAtsLogger;
       
   194 
       
   195         // RDebug logging for testcase status
       
   196         CStifLogger*        iRDebugLogger;
       
   197 
       
   198         // Stop execution type
       
   199         TStopExecutionType  iStopExecutionType;
       
   200 
       
   201     public:     // Friend classes
       
   202         // None
       
   203 
       
   204     protected:  // Friend classes
       
   205         // None
       
   206 
       
   207     private:    // Friend classes
       
   208 
       
   209         friend class CTestRemoteCmdNotifier;
       
   210 
       
   211     };
       
   212 
       
   213 // DESCRIPTION
       
   214 // CTestProgressNotifier is an active object used for notifications called from
       
   215 // Test Module using the RTestExecution API.
       
   216 class CTestProgressNotifier
       
   217         : public CActive
       
   218     {
       
   219     public:     // Enumerations
       
   220         // None
       
   221 
       
   222     private:    // Enumerations
       
   223 
       
   224         // TTestProgressStatus defines the status of notification
       
   225         enum TTestProgressStatus
       
   226             {
       
   227             ETestProgressIdle,
       
   228             ETestProgressPending,
       
   229             ETestProgressCompleted
       
   230             };
       
   231 
       
   232     public:     // Constructors and destructor
       
   233 
       
   234         /**
       
   235         * Two-phased constructor.
       
   236         */
       
   237         static CTestProgressNotifier* NewL( CTestEngine* aEngine, 
       
   238                              RTestExecution aTestExecution );
       
   239 
       
   240         /**
       
   241         * Destructor.
       
   242         */
       
   243         ~CTestProgressNotifier();
       
   244 
       
   245     public:     // New functions
       
   246 
       
   247         /**
       
   248         * StartL starts the CTestProgressNotifier active object.
       
   249         */
       
   250         void StartL( const RMessage2& aMessage );
       
   251 
       
   252     public:     // Functions from base classes
       
   253 
       
   254         /**
       
   255         * RunL derived from CActive handles the completed requests.
       
   256         */
       
   257         void RunL();
       
   258 
       
   259         /**
       
   260         * DoCancel derived from CActive handles the Cancel
       
   261         */
       
   262         void DoCancel();
       
   263 
       
   264         /**
       
   265         * RunError derived from CActive handles errors from active handler.
       
   266         */
       
   267         TInt RunError( TInt aError );
       
   268 
       
   269     protected:  // New functions
       
   270         // None
       
   271 
       
   272     protected:  // Functions from base classes
       
   273         // None
       
   274 
       
   275     private:
       
   276 
       
   277         /**
       
   278         * By default Symbian OS constructor is private.
       
   279         */
       
   280         void ConstructL();
       
   281 
       
   282         /**
       
   283         * Parametric C++ constructor.
       
   284         */
       
   285         CTestProgressNotifier( CTestEngine* aEngine, 
       
   286                                RTestExecution aTestExecution );
       
   287 
       
   288     public:     // Data
       
   289         // None
       
   290 
       
   291     protected:  // Data
       
   292         // None
       
   293 
       
   294     private:    // Data
       
   295 
       
   296         // Pointer to CTestEngine
       
   297         CTestEngine*        iEngine;
       
   298 
       
   299         // Handle to RTestExecution
       
   300         RTestExecution      iTestExecution;
       
   301 
       
   302         // Internal state
       
   303         TTestProgressStatus iState;
       
   304 
       
   305         // Test Progress
       
   306         TTestProgress       iProgress;
       
   307         TTestProgressPckg   iProgressPckg;
       
   308 
       
   309         // Message to be completed when notification is completed
       
   310         RMessage2           iMessage;
       
   311         
       
   312     public:     // Friend classes
       
   313         // None
       
   314 
       
   315     protected:  // Friend classes
       
   316         // None
       
   317 
       
   318     private:    // Friend classes
       
   319         // None
       
   320 
       
   321     };
       
   322 
       
   323 // DESCRIPTION
       
   324 // CTestEventNotifier is an active object used for event notify from
       
   325 // Test Module using the RTestExecution API.
       
   326 class CTestEventNotifier
       
   327         : public CActive
       
   328     {
       
   329     public:     // Enumerations
       
   330         // None
       
   331 
       
   332     private:    // Enumerations
       
   333 
       
   334         // TTestEventStatus defines the status of notification
       
   335         enum TTestEventStatus
       
   336             {
       
   337             ETestEventIdle,
       
   338             ETestEventPending,
       
   339             ETestEventCompleted
       
   340             };
       
   341 
       
   342     public:     // Constructors and destructor
       
   343 
       
   344         /**
       
   345         * Two-phased constructor.
       
   346         */
       
   347         static CTestEventNotifier* NewL( CTestEngine* aEngine,  
       
   348             RTestExecution aTestExecution );
       
   349 
       
   350         /**
       
   351         * Destructor.
       
   352         */
       
   353         ~CTestEventNotifier();
       
   354         
       
   355     public:     // New functions
       
   356 
       
   357         /**
       
   358         * StartL starts the CTestEventNotifier active object.
       
   359         */
       
   360         void Start();
       
   361 
       
   362         /**
       
   363         * For event control.
       
   364         */
       
   365         void CtlEvent( const TEventIf& aEvent, TRequestStatus& aStatus );
       
   366 
       
   367 		/**
       
   368 		* Check if CtlEvent should be called
       
   369 		*/
       
   370         TBool CheckCtlEvent( const TEventIf& aEvent );
       
   371 
       
   372     public:     // Functions from base classes
       
   373 
       
   374         /**
       
   375         * RunL derived from CActive handles the completed requests.
       
   376         */
       
   377         void RunL();
       
   378 
       
   379         /**
       
   380         * DoCancel derived from CActive handles the cancel
       
   381         */
       
   382         void DoCancel();
       
   383 
       
   384         /**
       
   385         * RunError derived from CActive handles errors from active handler.
       
   386         */
       
   387         TInt RunError( TInt aError );
       
   388 
       
   389     protected:      // New functions
       
   390         // None
       
   391 
       
   392     protected:  // Functions from base classes
       
   393         // None
       
   394 
       
   395     private:
       
   396 
       
   397         /**
       
   398         * By default Symbian OS constructor is private.
       
   399         */
       
   400         void ConstructL();
       
   401 
       
   402         /**
       
   403         * Parametric C++ constructor.
       
   404         */
       
   405         CTestEventNotifier( CTestEngine* aEngine,
       
   406              RTestExecution aTestExecution);
       
   407 
       
   408     public:     // Data
       
   409         // None
       
   410 
       
   411     protected:  // Data
       
   412         // None
       
   413 
       
   414     private:    // Data
       
   415 
       
   416         // Pointer to CTestEngine
       
   417         CTestEngine* iEngine;
       
   418 
       
   419         // Handle to RTestExecution
       
   420         RTestExecution iTestExecution;
       
   421 
       
   422         // Internal state
       
   423         TTestEventStatus iState;
       
   424 
       
   425         // Event interface
       
   426         TEventIf iEvent;
       
   427         TEventIfPckg iEventPckg;
       
   428         TEventIf iEventNotify;
       
   429         TEventIfPckg iEventNotifyPckg;
       
   430 
       
   431         // Event array
       
   432         RPointerArray<HBufC> iEventArray;
       
   433 
       
   434         // Associated event controller
       
   435         CTestEventController* iController;
       
   436 
       
   437     public:     // Friend classes
       
   438         // None
       
   439 
       
   440     protected:  // Friend classes
       
   441         // None
       
   442 
       
   443     private:    // Friend classes
       
   444         // None
       
   445 
       
   446     };
       
   447 
       
   448 // DESCRIPTION
       
   449 // CTestEventController is used for event controlling from
       
   450 // TestEngine.
       
   451 class CTestEventController
       
   452         : public CBase
       
   453     {
       
   454     public:     // Enumerations
       
   455         // None
       
   456 
       
   457     private:    // Enumerations
       
   458 
       
   459     public:     // Constructors and destructor
       
   460 
       
   461         /**
       
   462         * Two-phased constructor.
       
   463         */
       
   464         static CTestEventController* NewL( CTestEngine* aEngine,
       
   465                                            const TEventIf& aEvent,
       
   466                                            TRequestStatus* aStatus );
       
   467   
       
   468         static CTestEventController* NewL( CTestEngine* aEngine,
       
   469                                            const TEventIf& aEvent,
       
   470                                            RMessage2& aMessage );
       
   471 
       
   472         /**
       
   473         * Destructor.
       
   474         */
       
   475         ~CTestEventController();
       
   476 
       
   477     public:     // New functions
       
   478         /**
       
   479         * Event complete.
       
   480         */ 
       
   481         void EventComplete();
       
   482 
       
   483     public:     // Functions from base classes
       
   484 
       
   485     protected:  // New functions
       
   486         // None
       
   487 
       
   488     protected:  // Functions from base classes
       
   489         // None
       
   490 
       
   491     private:
       
   492 
       
   493         /**
       
   494         * By default Symbian OS constructor is private.
       
   495         */
       
   496         void ConstructL( TRequestStatus* aStatus );
       
   497 
       
   498         /**
       
   499         * By default Symbian OS constructor is private.
       
   500         */
       
   501         void ConstructL( RMessage2& aMessage );
       
   502 
       
   503         /**
       
   504         * Parametric C++ constructor.
       
   505         */
       
   506         CTestEventController( CTestEngine* aEngine, const TEventIf& aEvent );
       
   507 
       
   508         /**
       
   509         * Check all events.
       
   510         */ 
       
   511         TBool CheckEventsL();
       
   512 
       
   513         /**
       
   514         * Check client events.
       
   515         */ 
       
   516         TBool CheckClientEventsL();
       
   517 
       
   518         /**
       
   519         * Check testcase events.
       
   520         */ 
       
   521         TBool CheckTestcaseEventsL(); 
       
   522 
       
   523         /**
       
   524         * Callback for event controller.
       
   525         */ 
       
   526         static TInt EventCallBack( TAny* aTestEventController );
       
   527 
       
   528     public:     // Data
       
   529         // None
       
   530     
       
   531     protected:  // Data
       
   532         // None
       
   533 
       
   534     private:    // Data
       
   535 
       
   536         // Pointer to CTestEngine
       
   537         CTestEngine*    iEngine;
       
   538 
       
   539         // Either of these is completed when ready
       
   540         // If aRequestStatus exists, it is completed,
       
   541         // otherwise aMessage is completed.
       
   542         TRequestStatus* iRequestStatus;
       
   543         RMessage2        iMessage;
       
   544 
       
   545         // Event interface
       
   546         TEventIf iEvent;
       
   547         TEventIfPckg iEventPckg;
       
   548 
       
   549         // Number of active event commands
       
   550         TInt iActiveEventCmds;
       
   551         
       
   552         RPointerArray<CCallBack> iEventCallBacks;
       
   553 
       
   554     public:     // Friend classes
       
   555         // None
       
   556 
       
   557     protected:  // Friend classes
       
   558         // None
       
   559 
       
   560     private:    // Friend classes
       
   561         // None
       
   562 
       
   563     };
       
   564 
       
   565 // DESCRIPTION
       
   566 // CTestCaseTimeout is used for time controlling
       
   567 class CTestCaseTimeout
       
   568         : public CActive
       
   569     {
       
   570     public:     // Enumerations
       
   571         // None
       
   572 
       
   573     private:    // Enumerations
       
   574         // None
       
   575          
       
   576     public:     // Constructors and destructor
       
   577         
       
   578         /**
       
   579         * Two-phased constructor.
       
   580         */
       
   581         static CTestCaseTimeout* NewL( CTestCaseController* aCase,
       
   582                      TTimeIntervalMicroSeconds aTimeout );
       
   583 
       
   584         /**
       
   585         * Destructor.
       
   586         */
       
   587         ~CTestCaseTimeout();
       
   588         
       
   589     public:     // New functions
       
   590         
       
   591         /**
       
   592         * Starts timeout counting
       
   593         */
       
   594         void Start();
       
   595 
       
   596     public:     // Functions from base classes
       
   597 
       
   598         /**
       
   599         * RunL derived from CActive handles the completed requests.
       
   600         */
       
   601         void RunL();
       
   602 
       
   603         /**
       
   604         * DoCancel derived from CActive handles the cancel
       
   605         */
       
   606         void DoCancel();
       
   607 
       
   608         /**
       
   609         * RunError derived from CActive handles errors from active handler.
       
   610         */
       
   611         TInt RunError( TInt aError );
       
   612 
       
   613     protected:  // New functions
       
   614         // None
       
   615 
       
   616     protected:  // Functions from base classes
       
   617         // None
       
   618 
       
   619     private:
       
   620 
       
   621         /**
       
   622         * By default Symbian OS constructor is private.
       
   623         */
       
   624         void ConstructL(CTestCaseController* aCase,
       
   625                TTimeIntervalMicroSeconds aTimeout );
       
   626 
       
   627         /**
       
   628         * C++ constructor.
       
   629         */
       
   630         CTestCaseTimeout();
       
   631 
       
   632     public:     // Data
       
   633         // None
       
   634     
       
   635     protected:  // Data
       
   636         // None
       
   637 
       
   638     private:    // Data
       
   639         CTestCaseController* iCase;
       
   640         TTimeIntervalMicroSeconds iTimeout;
       
   641         RTimer iTimer;
       
   642         
       
   643         // Storage for testcase timeout.
       
   644         TTime iTestCaseTimeout;
       
   645 
       
   646     public:     // Friend classes
       
   647         // None
       
   648 
       
   649     protected:  // Friend classes
       
   650         // None
       
   651 
       
   652     private:    // Friend classes
       
   653         // None
       
   654 
       
   655     };
       
   656     
       
   657 // DESCRIPTION
       
   658 // CTestProgressNotifier is an active object used for notifications called from
       
   659 // Test Module using the RTestExecution API.
       
   660 class CTestRemoteCmdNotifier
       
   661         : public CActive
       
   662     {
       
   663     public:     // Enumerations
       
   664         // None
       
   665 
       
   666     private:    // Enumerations
       
   667 
       
   668         // TTestProgressStatus defines the status of notification
       
   669         enum TTestProgressStatus
       
   670             {
       
   671             ETestProgressIdle,
       
   672             ETestProgressPending,
       
   673             ETestProgressCompleted
       
   674             };
       
   675 
       
   676     public:     // Constructors and destructor
       
   677 
       
   678         /**
       
   679         * Two-phased constructor.
       
   680         */
       
   681         static CTestRemoteCmdNotifier* NewL( CTestEngine* aEngine, 
       
   682                              RTestExecution aTestExecution ,
       
   683                              CTestCaseController* aTestCaseController,
       
   684                              CAtsLogger& aAtsLogger );
       
   685 
       
   686         /**
       
   687         * Destructor.
       
   688         */
       
   689         ~CTestRemoteCmdNotifier();
       
   690 
       
   691     public:     // New functions
       
   692 
       
   693         /**
       
   694         * StartL starts the CTestRemoteCmdNotifier active object.
       
   695         */
       
   696         //void StartL( const RMessage& aMessage );
       
   697 
       
   698         /**
       
   699         * EnableReceive prepares to start active object
       
   700         */
       
   701         void EnableReceive( const RMessage2& aMessage );
       
   702 
       
   703         /**
       
   704         * GetReceivedMsg get received message.
       
   705         */
       
   706         void GetReceivedMsg( const RMessage2& aMessage );
       
   707 
       
   708         /**
       
   709         * Start starts the CTestCaseController active object.
       
   710         */
       
   711         void Start( const RMessage2& aMessage );
       
   712 
       
   713         /**
       
   714         * CancelReq cancels the request.
       
   715         */
       
   716         void CancelReq();
       
   717 
       
   718     public:     // Functions from base classes
       
   719 
       
   720         /**
       
   721         * RunL derived from CActive handles the completed requests.
       
   722         */
       
   723         void RunL();
       
   724 
       
   725         /**
       
   726         * DoCancel derived from CActive handles the Cancel
       
   727         */
       
   728         void DoCancel();
       
   729 
       
   730         /**
       
   731         * RunError derived from CActive handles errors from active handler.
       
   732         */
       
   733         TInt RunError( TInt aError );
       
   734 
       
   735     protected:  // New functions
       
   736         // None
       
   737 
       
   738     protected:  // Functions from base classes
       
   739         // None
       
   740 
       
   741     private:
       
   742 
       
   743         /**
       
   744         * By default Symbian OS constructor is private.
       
   745         */
       
   746         void ConstructL();
       
   747 
       
   748         /**
       
   749         * Parametric C++ constructor.
       
   750         */
       
   751         CTestRemoteCmdNotifier( CTestEngine* aEngine, 
       
   752                                RTestExecution aTestExecution,
       
   753                                CTestCaseController* aTestCaseController,
       
   754                                CAtsLogger& aAtsLogger );
       
   755 
       
   756         /**
       
   757         * Loads dynamically reset module.
       
   758         */
       
   759         TInt DynamicResetModule( CTestModuleIf::TRebootType aResetType );
       
   760 
       
   761     public:     // Data
       
   762         // None
       
   763 
       
   764     protected:  // Data
       
   765         // None
       
   766 
       
   767     private:    // Data
       
   768 
       
   769         // Pointer to CTestEngine
       
   770         CTestEngine*        iEngine;
       
   771 
       
   772         // Handle to RTestExecution
       
   773         RTestExecution      iTestExecution;
       
   774 
       
   775         // Internal state
       
   776         TTestProgressStatus iState;
       
   777 
       
   778         // Remote command's definition
       
   779         TStifCommand          iRemoteType;
       
   780         TStifCommandPckg      iRemoteTypePckg;
       
   781                 
       
   782         TInt                    iMsgSize;              
       
   783         TPckg<TInt>             iMsgSizePckg;              
       
   784 
       
   785         // Message to be completed when notification is completed
       
   786         RMessage2           iMessage;
       
   787         
       
   788         HBufC8*             iReceivedMsg;
       
   789 
       
   790         TInt                iRebootCode;
       
   791         TName               iRebootName;
       
   792 
       
   793         // Pointer to CTestCaseController
       
   794         CTestCaseController* iTestCaseController;
       
   795 
       
   796         TBool               iMessageAvail;
       
   797         
       
   798         CAtsLogger&         iAtsLogger;
       
   799 
       
   800     public:     // Friend classes
       
   801         // None
       
   802 
       
   803     protected:  // Friend classes
       
   804         // None
       
   805 
       
   806     private:    // Friend classes
       
   807         // None
       
   808 
       
   809     };
       
   810 
       
   811 // DESCRIPTION
       
   812 // CTestCommandNotifier is an active object used for command notify from
       
   813 // Test Module using the RTestExecution API.
       
   814 // It was created to allow test case to kill itself.
       
   815 class CTestCommandNotifier: public CActive
       
   816     {
       
   817     public:     // Enumerations
       
   818         // None
       
   819 
       
   820     private:    // Enumerations
       
   821         // None
       
   822 
       
   823     public:     // Constructors and destructor
       
   824 
       
   825         /**
       
   826         * Two-phased constructor.
       
   827         */
       
   828         static CTestCommandNotifier* NewL(CTestEngine* aEngine, RTestExecution aTestExecution);
       
   829 
       
   830         /**
       
   831         * Destructor.
       
   832         */
       
   833         ~CTestCommandNotifier();
       
   834 
       
   835     public:     // New functions
       
   836 
       
   837         /**
       
   838         * StartL starts the CTestCommandNotifier active object.
       
   839         */
       
   840         void Start();
       
   841 
       
   842     public:     // Functions from base classes
       
   843 
       
   844         /**
       
   845         * RunL derived from CActive handles the completed requests.
       
   846         */
       
   847         void RunL();
       
   848 
       
   849         /**
       
   850         * DoCancel derived from CActive handles the cancel
       
   851         */
       
   852         void DoCancel();
       
   853 
       
   854         /**
       
   855         * RunError derived from CActive handles errors from active handler.
       
   856         */
       
   857         TInt RunError(TInt aError);
       
   858 
       
   859     protected:      // New functions
       
   860         // None
       
   861 
       
   862     protected:  // Functions from base classes
       
   863         // None
       
   864 
       
   865     private:
       
   866 
       
   867         /**
       
   868         * By default Symbian OS constructor is private.
       
   869         */
       
   870         void ConstructL();
       
   871 
       
   872         /**
       
   873         * Parametric C++ constructor.
       
   874         */
       
   875         CTestCommandNotifier(CTestEngine* aEngine, RTestExecution aTestExecution);
       
   876 
       
   877     public:     // Data
       
   878         // None
       
   879 
       
   880     protected:  // Data
       
   881         // None
       
   882 
       
   883     private:    // Data
       
   884 
       
   885         // Pointer to CTestEngine
       
   886         CTestEngine*     iEngine;
       
   887 
       
   888         // Handle to RTestExecution
       
   889         RTestExecution   iTestExecution;
       
   890 
       
   891         // Command to be sent
       
   892         TCommand                        iCommand;
       
   893         TCommandPckg                    iCommandPckg;
       
   894         TBuf8<KMaxCommandParamsLength2>  iParamsPckg;
       
   895 
       
   896     public:     // Friend classes
       
   897         // None
       
   898 
       
   899     protected:  // Friend classes
       
   900         // None
       
   901 
       
   902     private:    // Friend classes
       
   903         // None
       
   904 
       
   905     };
       
   906 
       
   907 
       
   908 #endif // TEST_CASE_CONTROLLER_H
       
   909 
       
   910 // End of File