resourcemgmt/hwrmtargetmodifierplugin/tsrc/hwrmtargetmodifierplugintest/inc/hwrmtargetmodifierplugintest.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2008 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:  ?Description
       
    15 *  %version:  bh1dsgas#4 %, % date_modified: % by %derived_by: ravindrr %
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 #ifndef HWRMTARGETMODIFIERPLUGINTESTS_H
       
    22 #define HWRMTARGETMODIFIERPLUGINTESTS_H
       
    23 
       
    24 // INCLUDES
       
    25 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
       
    26 #pragma once
       
    27 #endif
       
    28 
       
    29 #include "StifTestModule.h"
       
    30 
       
    31 // CONSTANTS
       
    32 // None
       
    33 
       
    34 // MACROS
       
    35 // None
       
    36 
       
    37 // DATA TYPES
       
    38 // None
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41 // None
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 // None
       
    45 
       
    46 // CLASS DECLARATION
       
    47 class CHwrmTargetModifierPluginTests;
       
    48 class TCaseInfo;
       
    49 // DESCRIPTION
       
    50 // This a Test Module interface template 
       
    51 // that does not really do anything.
       
    52 
       
    53 typedef TInt (CHwrmTargetModifierPluginTests::* TestFunction)(TTestResult&);    
       
    54 
       
    55 NONSHARABLE_CLASS(CHwrmTargetModifierPluginTests) 
       
    56         :public CTestModuleBase
       
    57     {
       
    58     public: // Enumerations
       
    59        
       
    60     private: // Enumerations
       
    61        
       
    62     public: // Constructors and destructor
       
    63         
       
    64         /**
       
    65         * Two-phased constructor.
       
    66         */
       
    67         static CHwrmTargetModifierPluginTests* NewL();
       
    68         
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         ~CHwrmTargetModifierPluginTests();
       
    73 
       
    74     public: // New functions
       
    75        
       
    76     public: // Functions from base classes
       
    77         
       
    78         /**
       
    79         * Init is used to initialize the Test Module. The Test Modules 
       
    80         * can use the configure file to read parameters for Test Module 
       
    81         * initialization but they can also have their own configure file 
       
    82         * or some other routine to initialize themselves.
       
    83         */
       
    84         TInt InitL( TFileName& aIniFile, TBool aFirstTime );
       
    85 
       
    86         /**
       
    87         * Test cases are inquired from the Test Module by calling GetTestCases. 
       
    88         * Test cases are read from the config file specified by aConfigFile. 
       
    89         * If the Test Module does not use config files for test case definition 
       
    90         * it does not use aConfigFile parameter. Test cases are appended 
       
    91         * to CArrayPtrFlat<RTestEngine::TTestCaseInfo> that is a list 
       
    92         * consisting of several TTestCaseInfo objects.
       
    93         * TTestCaseInfo class defines individual test cases and, if needed, 
       
    94         * a test set where the test case belongs to. TTestCaseInfo is 
       
    95         * defined in Table 9.
       
    96         * The Test Framework will be the owner of the data in the 
       
    97         * RPointerArray and it does the memory deallocation.
       
    98         */
       
    99         TInt GetTestCasesL( const TFileName& aConfigFile, 
       
   100             RPointerArray<TTestCaseInfo>& aTestCases );
       
   101 
       
   102         /**
       
   103         * RunTestCase is used to run an individual test case specified 
       
   104         * by aTestCase. Test cases that can be run may be requested from 
       
   105         * Test Module by GetTestCases method before calling RunTestCase.
       
   106         * This method is synchronous and test case result is returned as 
       
   107         * reference parameter aResult value. The function shall return 
       
   108         * KErrNone if case is succesfully started.
       
   109         * If test case is not available (i.e invalid configuration file or
       
   110         * or case number), then function shall return the error code (i.e
       
   111         * (KErrNotFound)                
       
   112         */
       
   113         TInt RunTestCaseL( const TInt aCaseNumber, 
       
   114             const TFileName& aConfig,
       
   115             TTestResult& aResult );
       
   116         
       
   117     protected: // New functions
       
   118 
       
   119         TInt CreateAndDestroy(TTestResult& aResult);
       
   120         TInt GetFullSystemTarget(TTestResult& aResult);
       
   121         TInt ModifyTarget(TTestResult& aResult);
       
   122 
       
   123     protected: // Functions from base classes
       
   124 
       
   125     public:
       
   126         
       
   127     private:
       
   128 
       
   129 		 /**
       
   130         * C++ default constructor.
       
   131         */
       
   132         CHwrmTargetModifierPluginTests();
       
   133 
       
   134         /**
       
   135         * By default Symbian OS constructor is private.
       
   136         */
       
   137         void ConstructL();
       
   138 
       
   139 		/**
       
   140         * Function returning test case name and pointer to test case function
       
   141         */
       
   142 		const TCaseInfo Case ( const TInt aCaseNumber ) const;
       
   143 
       
   144     public: // Data
       
   145         
       
   146     protected: // Data
       
   147         
       
   148     private: // Data
       
   149 			
       
   150 			// Pointer to test (function) to be executed
       
   151 			TestFunction iMethod;			
       
   152 
       
   153     public: // Friend classes
       
   154         
       
   155     protected: // Friend classes
       
   156         
       
   157     private: // Friend classes
       
   158       
       
   159     };
       
   160 
       
   161 // Function pointer related internal definitions
       
   162 
       
   163 #ifndef __GCC32__
       
   164     #define GETPTR
       
   165 #else
       
   166     #define GETPTR &
       
   167 #endif  
       
   168 
       
   169 
       
   170 // An internal structure containing a test case name and
       
   171 // the pointer to function doing the test
       
   172 class TCaseInfoInternal
       
   173     {
       
   174     public:
       
   175         const TText* iCaseName;
       
   176         TestFunction iMethod;
       
   177     };
       
   178 
       
   179 // An internal structure containing a test case name and
       
   180 // the pointer to function doing the test
       
   181 class TCaseInfo
       
   182     {
       
   183     public:
       
   184         TPtrC iCaseName;    
       
   185         TestFunction iMethod;
       
   186 
       
   187     TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
       
   188         {        
       
   189         };
       
   190 
       
   191     };
       
   192 
       
   193 
       
   194 #endif // HWRMTARGETMODIFIERPLUGINTESTS_H
       
   195             
       
   196 // End of File