testexecfw/stf/api/api_platform/inc/StifKernelTestClassBase.h
changeset 2 8bb370ba6d1d
equal deleted inserted replaced
1:bbd31066657e 2:8bb370ba6d1d
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description: This file contains the header file of the STIF 
       
    15 * kernel testclass declaration
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef STIFKERNELTESTCLASSBASE_H
       
    20 #define STIFKERNELTESTCLASSBASE_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <kernel.h>    
       
    24 
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 // MACROS
       
    29 
       
    30 
       
    31 // In EKA2 kernel only 8bit descriptors are allowed, because of that C++'s 
       
    32 // L makro cannot be used.
       
    33 
       
    34 // ENTRY macro is modified and now it stores data as 8bit descriptor.
       
    35 // In EKA2 kernel TText is 8bit descriptor.
       
    36 
       
    37 #define ENTRY(A,B) \
       
    38 	{ (TText*) A, (StifTestFunction) &B }
       
    39 
       
    40 
       
    41 // FUNCTION PROTOTYPES
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 class DStifKernelTestClassBase;
       
    45 
       
    46 // DATA TYPES
       
    47 typedef TInt (DStifKernelTestClassBase::* StifTestFunction)( const TDesC& );    
       
    48 
       
    49 // CLASS DECLARATION
       
    50 
       
    51 /**
       
    52 *  An internal structure containing a test case name and
       
    53 *  the pointer to function doing the test
       
    54 *
       
    55 *  @lib ?library
       
    56 *  @since ?Series60_version
       
    57 */
       
    58 class TStifFunctionInfo
       
    59     {
       
    60     public:            
       
    61         const TText*           iFunctionName;
       
    62         StifTestFunction       iMethod;    
       
    63     };
       
    64     
       
    65 // CLASS DECLARATION
       
    66 
       
    67 /**
       
    68 * DStifKernelTestClassBaseDriver is the device driver factory that will
       
    69 * instantiate the physical channel, which is the actual
       
    70 * physical driver.
       
    71 *
       
    72 *  @lib ?library
       
    73 *  @since ?Series60_version
       
    74 */
       
    75 class DStifKernelTestClassBaseDriver : public DLogicalDevice
       
    76     {
       
    77 
       
    78     public:
       
    79         IMPORT_C DStifKernelTestClassBaseDriver( const TDesC& aName );
       
    80         IMPORT_C virtual ~DStifKernelTestClassBaseDriver();
       
    81 
       
    82         IMPORT_C virtual TInt Install();
       
    83         IMPORT_C virtual void GetCaps(TDes8 &aDes) const;
       
    84 
       
    85         virtual TInt Create(DLogicalChannelBase*& aChannel)=0;
       
    86   
       
    87     private:
       
    88         TName   iName;
       
    89     
       
    90     };
       
    91 
       
    92 
       
    93 // CLASS DECLARATION
       
    94 
       
    95 /**
       
    96 *  DStifKernelTestClassBase is a base class for kernel test class 
       
    97 *  for STIF Test Framework TestScripter.
       
    98 *  ?other_description_lines
       
    99 *
       
   100 *  @lib ?library
       
   101 *  @since ?Series60_version
       
   102 */
       
   103 class DStifKernelTestClassBase : public DLogicalChannel
       
   104     {
       
   105 
       
   106     public:
       
   107         IMPORT_C DStifKernelTestClassBase( DLogicalDevice* aDevice );
       
   108         IMPORT_C virtual ~DStifKernelTestClassBase();
       
   109         
       
   110     public:     
       
   111         /**
       
   112         * Runs a script line. Derived class must implement
       
   113         */
       
   114         virtual TInt RunMethodL( const TDesC& aMethod, const TDesC& aParams ) = 0;  
       
   115         
       
   116         /**
       
   117         * Called from destructor. Derived class may implement.
       
   118         */
       
   119         virtual void Delete(){};  
       
   120         
       
   121         // Processes a message for this logical channel
       
   122         IMPORT_C virtual void HandleMsg( TMessageBase* aMsg );
       
   123     protected: // Derived class uses
       
   124         
       
   125         // Internal fuction to run specified method.              
       
   126         IMPORT_C virtual TInt RunInternalL( 
       
   127                         const TStifFunctionInfo* const aFunctions, 
       
   128                         TInt aCount, 
       
   129                         const TDesC& aMethod, 
       
   130                         const TDesC& aParams );
       
   131 
       
   132     private: 
       
   133 
       
   134         // No need to export DoControl in EKA2, because it is called
       
   135         // from HandleMsg
       
   136         TInt DoControl( TInt aFunction,TAny* a1,TAny* a2 );
       
   137      
       
   138         // Asynchronous command are not supported
       
   139         void DoCancel( TInt ){};
       
   140                   
       
   141     private:
       
   142      
       
   143         DThread*         iThread;                
       
   144      
       
   145     };
       
   146 
       
   147 #endif      // STIFKERNELTESTCLASSBASE_H
       
   148             
       
   149 // End of File