phoneclientserver/aiwdialdata/tsrc/public/basic/aiwdialdatatests/inc/aiwdialdatatests.h
changeset 51 12bc758d6a02
parent 48 78df25012fda
child 53 25b8d29b7c59
equal deleted inserted replaced
48:78df25012fda 51:12bc758d6a02
     1 /*
       
     2 * Copyright (c) 2002 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:  AiwDialDataTests test module.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef AIWDIALDATATESTS_H
       
    21 #define AIWDIALDATATESTS_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "StifTestModule.h"
       
    25 #include <StifLogger.h>
       
    26 
       
    27 
       
    28 // Logging path
       
    29 _LIT( KAiwDialDataTestsLogPath, "\\logs\\testframework\\AiwDialDataTests\\" ); 
       
    30 // Log file
       
    31 _LIT( KAiwDialDataTestsLogFile, "AiwDialDataTests.txt" ); 
       
    32 
       
    33 
       
    34 #define GETPTR &
       
    35 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
       
    36 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
       
    37 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
       
    38 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
       
    39 
       
    40 // FORWARD DECLARATIONS
       
    41 class CAiwDialDataTests;
       
    42 
       
    43 // DATA TYPES
       
    44 
       
    45 typedef TInt (CAiwDialDataTests::* TestFunction)(TTestResult&);
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 /**
       
    50 *  An internal structure containing a test case name and
       
    51 *  the pointer to function doing the test
       
    52 *
       
    53 *  @lib ?library
       
    54 *  @since ?Series60_version
       
    55 */
       
    56 class TCaseInfoInternal
       
    57     {
       
    58     public:
       
    59         const TText*    iCaseName;
       
    60         TestFunction    iMethod;
       
    61         TBool           iIsOOMTest;
       
    62         TInt            iFirstMemoryAllocation;
       
    63         TInt            iLastMemoryAllocation;
       
    64     };
       
    65 
       
    66 // CLASS DECLARATION
       
    67 
       
    68 /**
       
    69 *  A structure containing a test case name and
       
    70 *  the pointer to function doing the test
       
    71 *
       
    72 *  @lib ?library
       
    73 *  @since ?Series60_version
       
    74 */
       
    75 class TCaseInfo
       
    76     {
       
    77     public:
       
    78         TPtrC iCaseName;
       
    79         TestFunction iMethod;
       
    80         TBool           iIsOOMTest;
       
    81         TInt            iFirstMemoryAllocation;
       
    82         TInt            iLastMemoryAllocation;
       
    83 
       
    84     TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
       
    85         {
       
    86         };
       
    87 
       
    88     };
       
    89 
       
    90 
       
    91 // CLASS DECLARATION
       
    92 
       
    93 /**
       
    94 *  This a AiwDialDataTests class.
       
    95 *  ?other_description_lines
       
    96 *
       
    97 *  @lib ?library
       
    98 *  @since ?Series60_version
       
    99 */
       
   100 NONSHARABLE_CLASS(CAiwDialDataTests) : public CTestModuleBase
       
   101     {
       
   102     public:  // Constructors and destructor
       
   103 
       
   104 
       
   105         /**
       
   106         * Two-phased constructor.
       
   107         */
       
   108         static CAiwDialDataTests* NewL();
       
   109 
       
   110         /**
       
   111         * Destructor.
       
   112         */
       
   113         virtual ~CAiwDialDataTests();
       
   114 
       
   115     public: // New functions
       
   116 
       
   117         /**
       
   118         * ?member_description.
       
   119         * @since ?Series60_version
       
   120         * @param ?arg1 ?description
       
   121         * @return ?description
       
   122         */
       
   123         //?type ?member_function( ?type ?arg1 );
       
   124 
       
   125     public: // Functions from base classes
       
   126 
       
   127         /**
       
   128         * From CTestModuleBase InitL is used to initialize the 
       
   129         *       AiwDialDataTests. It is called once for every instance of 
       
   130         *       TestModuleAiwDialDataTests after its creation.
       
   131         * @since ?Series60_version
       
   132         * @param aIniFile Initialization file for the test module (optional)
       
   133         * @param aFirstTime Flag is true when InitL is executed for first 
       
   134         *               created instance of AiwDialDataTests.
       
   135         * @return Symbian OS error code
       
   136         */
       
   137         TInt InitL( TFileName& aIniFile, TBool aFirstTime );
       
   138 
       
   139         /**
       
   140         * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
       
   141         *   from AiwDialDataTests. 
       
   142         * @since ?Series60_version
       
   143         * @param aTestCaseFile Test case file (optional)
       
   144         * @param aTestCases  Array of TestCases returned to test framework
       
   145         * @return Symbian OS error code
       
   146         */
       
   147         TInt GetTestCasesL( const TFileName& aTestCaseFile, 
       
   148                             RPointerArray<TTestCaseInfo>& aTestCases );
       
   149 
       
   150         /**
       
   151         * From CTestModuleBase RunTestCaseL is used to run an individual 
       
   152         *   test case. 
       
   153         * @since ?Series60_version
       
   154         * @param aCaseNumber Test case number
       
   155         * @param aTestCaseFile Test case file (optional)
       
   156         * @param aResult Test case result returned to test framework (PASS/FAIL)
       
   157         * @return Symbian OS error code (test case execution error, which is 
       
   158         *           not reported in aResult parameter as test case failure).
       
   159         */   
       
   160         TInt RunTestCaseL( const TInt aCaseNumber, 
       
   161                            const TFileName& aTestCaseFile,
       
   162                            TTestResult& aResult );
       
   163 
       
   164         /**
       
   165         * From CTestModuleBase; OOMTestQueryL is used to specify is particular
       
   166         * test case going to be executed using OOM conditions
       
   167         * @param aTestCaseFile Test case file (optional)
       
   168         * @param aCaseNumber Test case number (optional)
       
   169         * @param aFailureType OOM failure type (optional)
       
   170         * @param aFirstMemFailure The first heap memory allocation failure value (optional)
       
   171         * @param aLastMemFailure The last heap memory allocation failure value (optional)
       
   172         * @return TBool
       
   173         */
       
   174         virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
       
   175                                      const TInt /* aCaseNumber */, 
       
   176                                      TOOMFailureType& aFailureType, 
       
   177                                      TInt& /* aFirstMemFailure */, 
       
   178                                      TInt& /* aLastMemFailure */ );
       
   179 
       
   180         /**
       
   181         * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
       
   182         * test environment
       
   183         * @param aTestCaseFile Test case file (optional)
       
   184         * @param aCaseNumber Test case number (optional)
       
   185         * @return None
       
   186         */
       
   187         virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
       
   188                                     const TInt /* aCaseNumber */ ); 
       
   189 
       
   190         /**
       
   191         * From CTestModuleBase; OOMHandleWarningL
       
   192         * @param aTestCaseFile Test case file (optional)
       
   193         * @param aCaseNumber Test case number (optional)
       
   194         * @param aFailNextValue FailNextValue for OOM test execution (optional)
       
   195         * @return None
       
   196         *
       
   197         * User may add implementation for OOM test warning handling. Usually no
       
   198         * implementation is required.           
       
   199         */
       
   200         virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
       
   201                                         const TInt /* aCaseNumber */, 
       
   202                                         TInt& /* aFailNextValue */); 
       
   203 
       
   204         /**
       
   205         * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
       
   206         * test environment
       
   207         * @param aTestCaseFile Test case file (optional)
       
   208         * @param aCaseNumber Test case number (optional)
       
   209         * @return None
       
   210         *
       
   211         */
       
   212         virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
       
   213                                        const TInt /* aCaseNumber */ );
       
   214 
       
   215 
       
   216     private:
       
   217 
       
   218         /**
       
   219         * C++ default constructor.
       
   220         */
       
   221         CAiwDialDataTests();
       
   222 
       
   223         /**
       
   224         * By default Symbian 2nd phase constructor is private.
       
   225         */
       
   226         void ConstructL();
       
   227 
       
   228         /**
       
   229         * Function returning test case name and pointer to test case function.
       
   230         * @since ?Series60_version
       
   231         * @param aCaseNumber test case number
       
   232         * @return TCaseInfo 
       
   233         */
       
   234         const TCaseInfo Case ( const TInt aCaseNumber ) const;
       
   235 
       
   236         /**
       
   237         * Actual Hardcoded test case functions are listed below.
       
   238         */
       
   239 
       
   240         /**
       
   241          * Tests CAiwDialData construction.
       
   242          **/
       
   243         TInt ConstructionTestL( TTestResult& aResult );
       
   244         
       
   245         /**
       
   246          * Tests CAiwDialData setting and getting values.
       
   247          */
       
   248         TInt SetAndGetTestL( TTestResult& aResult );
       
   249         
       
   250         /**
       
   251          * Tests CAiwDialDataExt construction.
       
   252          */
       
   253         TInt ExtConstructionTestL( TTestResult& aResult );
       
   254         
       
   255         /**
       
   256          * Tests CAiwDialDataExt setting and getting values.
       
   257          */
       
   258         TInt ExtSetAndGetTestL( TTestResult& aResult );
       
   259 
       
   260 
       
   261     private:    // Data
       
   262         // Pointer to test (function) to be executed
       
   263         TestFunction iMethod;
       
   264 
       
   265         // Pointer to logger
       
   266         CStifLogger * iLog; 
       
   267 
       
   268 
       
   269     };
       
   270 
       
   271 #endif      // AIWDIALDATATESTS_H
       
   272 
       
   273 // End of File