apicompatanamdw/bcdrivers/os/cellularsrv/BCSmsUtilitiesTest/inc/BCSmsUtilitiesTest.h
changeset 2 0cb2248d0edc
equal deleted inserted replaced
1:61e9400fe245 2:0cb2248d0edc
       
     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:  BCSmsUtilitiesTest test module.
       
    15 *
       
    16 */
       
    17 
       
    18 /* Changed by Vaibhav - 13Aug07 for Removing CodeScanner Warnings - High/medium */
       
    19 
       
    20 
       
    21 #ifndef BCSMSUTILITIESTEST_H
       
    22 #define BCSMSUTILITIESTEST_H
       
    23 
       
    24 // INCLUDES
       
    25 #include "StifTestModule.h"
       
    26 #include <StifLogger.h>
       
    27 #include <Gsmuelem.h>
       
    28 #include <gsmubuf.h>
       
    29 #include <gsmupdu.h>
       
    30 #include <Gsmumsg.h>
       
    31 #include <Gsmuelem.h> 
       
    32 #include <e32def.h>
       
    33 
       
    34 // CONSTANTS
       
    35 // MACROS
       
    36 //#define ?macro ?macro_def
       
    37 #define TEST_MODULE_VERSION_MAJOR 52
       
    38 #define TEST_MODULE_VERSION_MINOR 9
       
    39 #define TEST_MODULE_VERSION_BUILD 50
       
    40 
       
    41 // Logging path
       
    42 _LIT( KBCSmsUtilitiesTestLogPath, "\\logs\\testframework\\BCSmsUtilitiesTest\\" ); 
       
    43 // Log file
       
    44 _LIT( KBCSmsUtilitiesTestLogFile, "BCSmsUtilitiesTest.txt" ); 
       
    45 
       
    46 // Function pointer related internal definitions
       
    47 // Visual studio 6.0 (__VC32__) needs different type of handling 
       
    48 #ifdef __VC32__
       
    49 #define GETPTR
       
    50 #else
       
    51 #define GETPTR &
       
    52 #endif  
       
    53 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
       
    54 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
       
    55 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
       
    56 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
       
    57 
       
    58 class CBCSmsUtilitiesTest;
       
    59 // TInt CBCSmsUtilitiesTest::<NameOfFunction> ( TTestResult& aResult )
       
    60 typedef TInt (CBCSmsUtilitiesTest::* 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 BCSmsUtilitiesTest class.
       
   110 *  ?other_description_lines
       
   111 *
       
   112 *  @lib ?library
       
   113 *  @since ?Series60_version
       
   114 */
       
   115 NONSHARABLE_CLASS(CBCSmsUtilitiesTest) : public CTestModuleBase
       
   116     {
       
   117     public:  // Constructors and destructor
       
   118 
       
   119 
       
   120         /**
       
   121         * Two-phased constructor.
       
   122         */
       
   123         static CBCSmsUtilitiesTest* NewL();
       
   124 
       
   125         /**
       
   126         * Destructor.
       
   127         */
       
   128         virtual ~CBCSmsUtilitiesTest();
       
   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         *       BCSmsUtilitiesTest. It is called once for every instance of 
       
   145         *       TestModuleBCSmsUtilitiesTest 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 BCSmsUtilitiesTest.
       
   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 BCSmsUtilitiesTest. 
       
   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          * Method used to log version of test module
       
   231          */
       
   232         void SendTestModuleVersion();
       
   233 
       
   234     protected:  // New functions
       
   235 
       
   236         /**
       
   237         * ?member_description.
       
   238         * @since ?Series60_version
       
   239         * @param ?arg1 ?description
       
   240         * @return ?description
       
   241         */
       
   242         //?type ?member_function( ?type ?arg1 );
       
   243 
       
   244     protected:  // Functions from base classes
       
   245 
       
   246         /**
       
   247         * From ?base_class ?member_description
       
   248         */
       
   249         //?type ?member_function();
       
   250 
       
   251     private:
       
   252 
       
   253         /**
       
   254         * C++ default constructor.
       
   255         */
       
   256         CBCSmsUtilitiesTest();
       
   257 
       
   258         /**
       
   259         * By default Symbian 2nd phase constructor is private.
       
   260         */
       
   261         void ConstructL();
       
   262 
       
   263         // Prohibit copy constructor if not deriving from CBase.
       
   264         // ?classname( const ?classname& );
       
   265         // Prohibit assigment operator if not deriving from CBase.
       
   266         // ?classname& operator=( const ?classname& );
       
   267 
       
   268         /**
       
   269         * Function returning test case name and pointer to test case function.
       
   270         * @since ?Series60_version
       
   271         * @param aCaseNumber test case number
       
   272         * @return TCaseInfo 
       
   273         */
       
   274         const TCaseInfo Case ( const TInt aCaseNumber ) const;
       
   275 
       
   276         /**
       
   277         * Actual Hardcoded test case functions are listed below.
       
   278         */
       
   279 
       
   280         TInt TestSmsAlphabetConverterL( TTestResult& aResult );
       
   281 		
       
   282 		TInt TestSmsBufferL( TTestResult& aResult );
       
   283 		
       
   284 		TInt TestSmsCommandL( TTestResult& aResult );
       
   285 		
       
   286 		TInt TestSmsDeliverL( TTestResult& aResult );
       
   287 		
       
   288 		TInt TestSmsDeliverReportL( TTestResult& aResult );
       
   289 		
       
   290 		TInt TestSmsEditorBufferL( TTestResult& aResult );
       
   291 		
       
   292 		TInt TestSmsInformationElementL( TTestResult& aResult );
       
   293 		
       
   294 		TInt TestSmsMessageL( TTestResult& aResult );
       
   295 		
       
   296 		TInt TestSmsPDUL( TTestResult& aResult );
       
   297 		
       
   298 		TInt TestSmsStatusReportL( TTestResult& aResult );
       
   299 		
       
   300 		TInt TestSmsSubmitL( TTestResult& aResult );
       
   301 		
       
   302 		TInt TestSmsSubmitReportL( TTestResult& aResult );
       
   303 		
       
   304 		TInt TestSmsUserDataL( TTestResult& aResult );
       
   305 		
       
   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 		RFs iSession;
       
   322         CCnvCharacterSetConverter* iCharSet;
       
   323 
       
   324 		CSmsUserData* iUserData;
       
   325  
       
   326     };
       
   327     
       
   328 #endif
       
   329 // End of File