dosservices/tsrc/dsytesttool/dosservercontrol/inc/ctfdosservercontroltestcase.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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:  Declaration of CTFDosServerControlTestCase class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CTFDOSSERVERCONTROLTESTCASE_H__
       
    20 #define __CTFDOSSERVERCONTROLTESTCASE_H__
       
    21 
       
    22 #include <mtfaactivetest.h>
       
    23 #include "ctfstubtestcase.h"
       
    24 #include "tfdosservertypes.h"
       
    25 
       
    26 class CTFATestTimer;
       
    27 class CTFDosServerControlTestCaseParam;
       
    28 
       
    29 /**
       
    30 * Test case declaration macro
       
    31 */
       
    32 #define TF_DOS_SERVER_CONTROL_TEST_CASE_L( aCaseId, aCaseStates ) \
       
    33     case aCaseId: \
       
    34         { \
       
    35         CTFDosServerControlTestCaseParam* param = new ( ELeave ) CTFDosServerControlTestCaseParam(); \
       
    36         CleanupStack::PushL( param ); \
       
    37         param->ConstructL( aCaseStates, sizeof ( aCaseStates ) / sizeof ( TTFDosServerControlTestCaseState ) ); \
       
    38         returnValue = new ( ELeave ) CTFDosServerControlTestCase( param ); \
       
    39         CleanupStack::Pop(); \
       
    40         CleanupStack::PushL( returnValue ); \
       
    41         STATIC_CAST( CTFDosServerControlTestCase*, returnValue )->ConstructL(); \
       
    42         CleanupStack::Pop(); \
       
    43         } \
       
    44         break
       
    45 
       
    46 NONSHARABLE_CLASS( CTFDosServerControlTestCase ): public CTFStubTestCase, public MTFAActiveTest
       
    47     {
       
    48     public:
       
    49         /**
       
    50         * Constructor
       
    51         */
       
    52         CTFDosServerControlTestCase( CTFDosServerControlTestCaseParam* aParameters );
       
    53 
       
    54         /**
       
    55         * 2nd phase constructor
       
    56         */
       
    57         void ConstructL( void );
       
    58 
       
    59         /**
       
    60         * Destructor
       
    61         */
       
    62         ~CTFDosServerControlTestCase( void );
       
    63     
       
    64     private:
       
    65         /**
       
    66         * Copy constructor is hidden
       
    67         */
       
    68         CTFDosServerControlTestCase( const CTFDosServerControlTestCase& aStub );
       
    69 
       
    70         /**
       
    71         * Assignment operator is hidden
       
    72         */
       
    73         CTFDosServerControlTestCase& operator=( const CTFDosServerControlTestCase& aStub );
       
    74     
       
    75     public:
       
    76         /**
       
    77         * Notifies about a DosServer event
       
    78         */
       
    79         void NotifyDosEvent( TInt aEvent, TInt aParameter );
       
    80 
       
    81     public:
       
    82         /**
       
    83         * Timer callback to cancel test if it takes too long
       
    84         */
       
    85         void ActiveTestRunL( void );
       
    86 
       
    87     protected:
       
    88         /**
       
    89         * Logs this test case
       
    90         */
       
    91         void Log( TInt aDepth );
       
    92 
       
    93         /**
       
    94         * Initializes this test case
       
    95         */
       
    96         void InitL( void );
       
    97 
       
    98         /**
       
    99         * Runs this test case
       
   100         */
       
   101         void RunL( void );
       
   102 
       
   103         /**
       
   104         * Releases this test case
       
   105         */
       
   106         void Teardown( void );
       
   107 
       
   108     protected:
       
   109         /**
       
   110         * Completes this test case with given result
       
   111         */
       
   112         void DoCompleteTest( TInt aResult );
       
   113 
       
   114         /**
       
   115         * Starts the next test case state
       
   116         */
       
   117         void StartNextState( TInt aResult );
       
   118 
       
   119         /**
       
   120         * Calls the DosServer function of the current test case state
       
   121         */
       
   122         void CallCurrentDosFunctionL( void );
       
   123 
       
   124         /**
       
   125         * Gets the index of current state
       
   126         */
       
   127         TInt CurrentStateIndex( void ) const;
       
   128 
       
   129         /**
       
   130         * Gets the test case parameters
       
   131         */
       
   132         CTFDosServerControlTestCaseParam& Parameters( void );
       
   133 
       
   134         /**
       
   135         * Gets the current DosServer function
       
   136         */
       
   137         TTFDosFunction CurrentDosFunction( void ) const;
       
   138 
       
   139         /**
       
   140         * Gets the current argument 1
       
   141         */
       
   142         TInt CurrentArg1( void ) const;
       
   143 
       
   144         /**
       
   145         * Gets the timer
       
   146         */
       
   147         CTFATestTimer* Timer( void );
       
   148 
       
   149     private:
       
   150         /**
       
   151         * Checks a test result
       
   152         */
       
   153         TInt CheckResult( TInt aResult, TBool aIsEvent );
       
   154     
       
   155     private:
       
   156         CTFDosServerControlTestCaseParam* iParameters;
       
   157         TTFDosServerControlTestCaseState iCurrentState;
       
   158         TInt iCurrentStateIndex;
       
   159         CTFATestTimer* iTimer;
       
   160         TBool iCleanupWait;
       
   161         TInt iStoredArg1;
       
   162         TInt iStoredArg2;
       
   163     };
       
   164 
       
   165 #endif