phoneclientserver/phoneclient/tsrc/public/basic/EmergencyCallTests/inc/EmergencyCallTests.h
changeset 0 ff3b6d0fd310
child 19 7d48bed6ce0c
equal deleted inserted replaced
-1:000000000000 0:ff3b6d0fd310
       
     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:  EmergencyCallTests test module.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef EMERGENCYCALLTESTS_H
       
    21 #define EMERGENCYCALLTESTS_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "StifTestModule.h"
       
    25 #include <StifLogger.h>
       
    26 #include <MPhCltEmergencyCallObserver.h>
       
    27 
       
    28 // CONSTANTS
       
    29 //const ?type ?constant_var = ?constant;
       
    30 
       
    31 // MACROS
       
    32 //#define ?macro ?macro_def
       
    33 
       
    34 // Logging path
       
    35 _LIT( KEmergencyCallTestsLogPath, "\\logs\\testframework\\EmergencyCallTests\\" ); 
       
    36 // Log file
       
    37 _LIT( KEmergencyCallTestsLogFile, "EmergencyCallTests.txt" ); 
       
    38 
       
    39 
       
    40 #define GETPTR &
       
    41 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
       
    42 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
       
    43 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
       
    44 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
       
    45 
       
    46 // FUNCTION PROTOTYPES
       
    47 //?type ?function_name(?arg_list);
       
    48 
       
    49 // FORWARD DECLARATIONS
       
    50 //class ?FORWARD_CLASSNAME;
       
    51 class CEmergencyCallTests;
       
    52 
       
    53 // DATA TYPES
       
    54 //enum ?declaration
       
    55 //typedef ?declaration
       
    56 //extern ?data_type;
       
    57 // A typedef for function that does the actual testing,
       
    58 // function is a type 
       
    59 // TInt CEmergencyCallTests::<NameOfFunction> ( TTestResult& aResult )
       
    60 typedef TInt (CEmergencyCallTests::* TestFunction)(TTestResult&);
       
    61 
       
    62 // CLASS DECLARATION
       
    63 
       
    64 /**
       
    65 *  An internal structure containing a test case name and
       
    66 *  the pointer to function doing the test
       
    67 *
       
    68 *  @lib ?library
       
    69 *  @since ?Series60_version
       
    70 */
       
    71 class TCaseInfoInternal
       
    72     {
       
    73     public:
       
    74         const TText*    iCaseName;
       
    75         TestFunction    iMethod;
       
    76         TBool           iIsOOMTest;
       
    77         TInt            iFirstMemoryAllocation;
       
    78         TInt            iLastMemoryAllocation;
       
    79     };
       
    80 
       
    81 // CLASS DECLARATION
       
    82 
       
    83 /**
       
    84 *  A structure containing a test case name and
       
    85 *  the pointer to function doing the test
       
    86 *
       
    87 *  @lib ?library
       
    88 *  @since ?Series60_version
       
    89 */
       
    90 class TCaseInfo
       
    91     {
       
    92     public:
       
    93         TPtrC iCaseName;
       
    94         TestFunction iMethod;
       
    95         TBool           iIsOOMTest;
       
    96         TInt            iFirstMemoryAllocation;
       
    97         TInt            iLastMemoryAllocation;
       
    98 
       
    99     TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
       
   100         {
       
   101         };
       
   102 
       
   103     };
       
   104 
       
   105 
       
   106 // CLASS DECLARATION
       
   107 
       
   108 /**
       
   109 *  This a EmergencyCallTests class.
       
   110 *  ?other_description_lines
       
   111 *
       
   112 *  @lib ?library
       
   113 *  @since ?Series60_version
       
   114 */
       
   115 NONSHARABLE_CLASS(CEmergencyCallTests) : public CTestModuleBase, public MPhCltEmergencyCallObserver
       
   116     {
       
   117     public:  // Constructors and destructor
       
   118 
       
   119 
       
   120         /**
       
   121         * Two-phased constructor.
       
   122         */
       
   123         static CEmergencyCallTests* NewL();
       
   124 
       
   125         /**
       
   126         * Destructor.
       
   127         */
       
   128         virtual ~CEmergencyCallTests();
       
   129 
       
   130     public: // New functions
       
   131 
       
   132         /**
       
   133         * ?member_description.
       
   134         * @since ?Series60_version
       
   135         * @param ?arg1 ?description
       
   136         * @return ?description
       
   137         */
       
   138         //?type ?member_function( ?type ?arg1 );
       
   139 
       
   140     public: // Functions from base classes
       
   141 
       
   142         /**
       
   143         * From CTestModuleBase InitL is used to initialize the 
       
   144         *       EmergencyCallTests. It is called once for every instance of 
       
   145         *       TestModuleEmergencyCallTests after its creation.
       
   146         * @since ?Series60_version
       
   147         * @param aIniFile Initialization file for the test module (optional)
       
   148         * @param aFirstTime Flag is true when InitL is executed for first 
       
   149         *               created instance of EmergencyCallTests.
       
   150         * @return Symbian OS error code
       
   151         */
       
   152         TInt InitL( TFileName& aIniFile, TBool aFirstTime );
       
   153 
       
   154         /**
       
   155         * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
       
   156         *   from EmergencyCallTests. 
       
   157         * @since ?Series60_version
       
   158         * @param aTestCaseFile Test case file (optional)
       
   159         * @param aTestCases  Array of TestCases returned to test framework
       
   160         * @return Symbian OS error code
       
   161         */
       
   162         TInt GetTestCasesL( const TFileName& aTestCaseFile, 
       
   163                             RPointerArray<TTestCaseInfo>& aTestCases );
       
   164 
       
   165         /**
       
   166         * From CTestModuleBase RunTestCaseL is used to run an individual 
       
   167         *   test case. 
       
   168         * @since ?Series60_version
       
   169         * @param aCaseNumber Test case number
       
   170         * @param aTestCaseFile Test case file (optional)
       
   171         * @param aResult Test case result returned to test framework (PASS/FAIL)
       
   172         * @return Symbian OS error code (test case execution error, which is 
       
   173         *           not reported in aResult parameter as test case failure).
       
   174         */   
       
   175         TInt RunTestCaseL( const TInt aCaseNumber, 
       
   176                            const TFileName& aTestCaseFile,
       
   177                            TTestResult& aResult );
       
   178 
       
   179         /**
       
   180         * From CTestModuleBase; OOMTestQueryL is used to specify is particular
       
   181         * test case going to be executed using OOM conditions
       
   182         * @param aTestCaseFile Test case file (optional)
       
   183         * @param aCaseNumber Test case number (optional)
       
   184         * @param aFailureType OOM failure type (optional)
       
   185         * @param aFirstMemFailure The first heap memory allocation failure value (optional)
       
   186         * @param aLastMemFailure The last heap memory allocation failure value (optional)
       
   187         * @return TBool
       
   188         */
       
   189         virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
       
   190                                      const TInt /* aCaseNumber */, 
       
   191                                      TOOMFailureType& aFailureType, 
       
   192                                      TInt& /* aFirstMemFailure */, 
       
   193                                      TInt& /* aLastMemFailure */ );
       
   194 
       
   195         /**
       
   196         * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
       
   197         * test environment
       
   198         * @param aTestCaseFile Test case file (optional)
       
   199         * @param aCaseNumber Test case number (optional)
       
   200         * @return None
       
   201         */
       
   202         virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
       
   203                                     const TInt /* aCaseNumber */ ); 
       
   204 
       
   205         /**
       
   206         * From CTestModuleBase; OOMHandleWarningL
       
   207         * @param aTestCaseFile Test case file (optional)
       
   208         * @param aCaseNumber Test case number (optional)
       
   209         * @param aFailNextValue FailNextValue for OOM test execution (optional)
       
   210         * @return None
       
   211         *
       
   212         * User may add implementation for OOM test warning handling. Usually no
       
   213         * implementation is required.           
       
   214         */
       
   215         virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
       
   216                                         const TInt /* aCaseNumber */, 
       
   217                                         TInt& /* aFailNextValue */); 
       
   218 
       
   219         /**
       
   220         * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
       
   221         * test environment
       
   222         * @param aTestCaseFile Test case file (optional)
       
   223         * @param aCaseNumber Test case number (optional)
       
   224         * @return None
       
   225         *
       
   226         */
       
   227         virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
       
   228                                        const TInt /* aCaseNumber */ );
       
   229 
       
   230     protected:  // New functions
       
   231 
       
   232         
       
   233          void HandleEmergencyDialL( const TInt aStatus );
       
   234         /**
       
   235         * ?member_description.
       
   236         * @since ?Series60_version
       
   237         * @param ?arg1 ?description
       
   238         * @return ?description
       
   239         */
       
   240         //?type ?member_function( ?type ?arg1 );
       
   241 
       
   242     protected:  // Functions from base classes
       
   243 
       
   244         /**
       
   245         * From ?base_class ?member_description
       
   246         */
       
   247         //?type ?member_function();
       
   248 
       
   249     private:
       
   250 
       
   251         /**
       
   252         * C++ default constructor.
       
   253         */
       
   254         CEmergencyCallTests();
       
   255 
       
   256         /**
       
   257         * By default Symbian 2nd phase constructor is private.
       
   258         */
       
   259         void ConstructL();
       
   260 
       
   261         // Prohibit copy constructor if not deriving from CBase.
       
   262         // ?classname( const ?classname& );
       
   263         // Prohibit assigment operator if not deriving from CBase.
       
   264         // ?classname& operator=( const ?classname& );
       
   265 
       
   266         /**
       
   267         * Function returning test case name and pointer to test case function.
       
   268         * @since ?Series60_version
       
   269         * @param aCaseNumber test case number
       
   270         * @return TCaseInfo 
       
   271         */
       
   272         const TCaseInfo Case ( const TInt aCaseNumber ) const;
       
   273 
       
   274         /**
       
   275         * Actual Hardcoded test case functions are listed below.
       
   276         */
       
   277         //ADD NEW METHOD DEC HERE"
       
   278 
       
   279         /**
       
   280         * Printing test case.
       
   281         * @since ?Series60_version
       
   282         * @param aResult Test case result (PASS/FAIL)
       
   283         * @return Symbian OS error code (test case execution error 
       
   284         *   that is not returned as test case result in aResult)
       
   285         */
       
   286         TInt PrintTest( TTestResult& aResult );
       
   287 
       
   288         /**
       
   289         * Printing loop test case.
       
   290         * @since ?Series60_version
       
   291         * @param aResult Test case result (PASS/FAIL)
       
   292         * @return Symbian OS error code (test case execution error 
       
   293         *   that is not returned as test case result in aResult)
       
   294         */
       
   295         TInt LoopTest( TTestResult& aResult );
       
   296         
       
   297         /**
       
   298          * Construction
       
   299          */
       
   300         TInt ConstructionTest( TTestResult& aResult );
       
   301         TInt IsEmergencyPhoneNumber( TTestResult& aResult );
       
   302         TInt FindEmergencyPhoneNumber(TTestResult& aResult );
       
   303         TInt DialEmergencyCall(TTestResult& aResult );
       
   304         TInt IsEmergencyPhoneNumber2( TTestResult& aResult );
       
   305         TInt FindEmergencyPhoneNumber2(TTestResult& aResult );
       
   306 
       
   307     public:     // Data
       
   308         // ?one_line_short_description_of_data
       
   309         //?data_declaration;
       
   310 
       
   311     protected:  // Data
       
   312         // ?one_line_short_description_of_data
       
   313         //?data_declaration;
       
   314 
       
   315     private:    // Data
       
   316         // Pointer to test (function) to be executed
       
   317         TestFunction iMethod;
       
   318 
       
   319         // Pointer to logger
       
   320         CStifLogger * iLog; 
       
   321 
       
   322         // ?one_line_short_description_of_data
       
   323         //?data_declaration;
       
   324 
       
   325         // Reserved pointer for future extension
       
   326         //TAny* iReserved;
       
   327 
       
   328     public:     // Friend classes
       
   329         //?friend_class_declaration;
       
   330     protected:  // Friend classes
       
   331         //?friend_class_declaration;
       
   332     private:    // Friend classes
       
   333         //?friend_class_declaration;
       
   334 
       
   335     };
       
   336 
       
   337 #endif      // EMERGENCYCALLTESTS_H
       
   338 
       
   339 // End of File