drm_plat/roap_api/tsrc/inc/RoapTest.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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:  RoapTest test module.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef ROAPTEST_H
       
    21 #define ROAPTEST_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "StifTestModule.h"
       
    25 #include <StifLogger.h>
       
    26 
       
    27 // CONSTANTS
       
    28 //const ?type ?constant_var = ?constant;
       
    29 
       
    30 // MACROS
       
    31 //#define ?macro ?macro_def
       
    32 
       
    33 // Logging path
       
    34 _LIT( KRoapTestLogPath, "\\logs\\testframework\\RoapTest\\" ); 
       
    35 // Log file
       
    36 _LIT( KRoapTestLogFile, "RoapTest.txt" ); 
       
    37 _LIT( KRoapTestLogFileWithTitle, "RoapTest_[%S].txt" );
       
    38 
       
    39 #define GETPTR &
       
    40 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
       
    41 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
       
    42 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c}
       
    43 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c}
       
    44 
       
    45 // FUNCTION PROTOTYPES
       
    46 //?type ?function_name(?arg_list);
       
    47 
       
    48 // FORWARD DECLARATIONS
       
    49 //class ?FORWARD_CLASSNAME;
       
    50 class CRoapTest;
       
    51 
       
    52 // DATA TYPES
       
    53 //enum ?declaration
       
    54 //typedef ?declaration
       
    55 //extern ?data_type;
       
    56 // A typedef for function that does the actual testing,
       
    57 // function is a type 
       
    58 // TInt CRoapTest::<NameOfFunction> ( TTestResult& aResult )
       
    59 typedef TInt (CRoapTest::* TestFunction)(TTestResult&);
       
    60 
       
    61 // CLASS DECLARATION
       
    62 
       
    63 /**
       
    64 *  An internal structure containing a test case name and
       
    65 *  the pointer to function doing the test
       
    66 *
       
    67 *  @lib ?library
       
    68 *  @since ?Series60_version
       
    69 */
       
    70 class TCaseInfoInternal
       
    71     {
       
    72     public:
       
    73         const TText*    iCaseName;
       
    74         TestFunction    iMethod;
       
    75         TBool           iIsOOMTest;
       
    76         TInt            iFirstMemoryAllocation;
       
    77         TInt            iLastMemoryAllocation;
       
    78     };
       
    79 
       
    80 // CLASS DECLARATION
       
    81 
       
    82 /**
       
    83 *  A structure containing a test case name and
       
    84 *  the pointer to function doing the test
       
    85 *
       
    86 *  @lib ?library
       
    87 *  @since ?Series60_version
       
    88 */
       
    89 class TCaseInfo
       
    90     {
       
    91     public:
       
    92         TPtrC iCaseName;
       
    93         TestFunction iMethod;
       
    94         TBool           iIsOOMTest;
       
    95         TInt            iFirstMemoryAllocation;
       
    96         TInt            iLastMemoryAllocation;
       
    97 
       
    98     TCaseInfo( const TText* a ) : iCaseName( (TText*) a )
       
    99         {
       
   100         };
       
   101 
       
   102     };
       
   103 
       
   104 
       
   105 // CLASS DECLARATION
       
   106 
       
   107 /**
       
   108 *  This a RoapTest class.
       
   109 *  ?other_description_lines
       
   110 *
       
   111 *  @lib ?library
       
   112 *  @since ?Series60_version
       
   113 */
       
   114 NONSHARABLE_CLASS(CRoapTest) : public CTestModuleBase
       
   115     {
       
   116     public:  // Constructors and destructor
       
   117 
       
   118 
       
   119         /**
       
   120         * Two-phased constructor.
       
   121         */
       
   122         static CRoapTest* NewL();
       
   123 
       
   124         /**
       
   125         * Destructor.
       
   126         */
       
   127         virtual ~CRoapTest();
       
   128 
       
   129     public: // New functions
       
   130 
       
   131         /**
       
   132         * ?member_description.
       
   133         * @since ?Series60_version
       
   134         * @param ?arg1 ?description
       
   135         * @return ?description
       
   136         */
       
   137         //?type ?member_function( ?type ?arg1 );
       
   138 
       
   139     public: // Functions from base classes
       
   140 
       
   141         /**
       
   142         * From CTestModuleBase InitL is used to initialize the 
       
   143         *       RoapTest. It is called once for every instance of 
       
   144         *       TestModuleRoapTest after its creation.
       
   145         * @since ?Series60_version
       
   146         * @param aIniFile Initialization file for the test module (optional)
       
   147         * @param aFirstTime Flag is true when InitL is executed for first 
       
   148         *               created instance of RoapTest.
       
   149         * @return Symbian OS error code
       
   150         */
       
   151         TInt InitL( TFileName& aIniFile, TBool aFirstTime );
       
   152 
       
   153         /**
       
   154         * From CTestModuleBase GetTestCasesL is used to inquiry test cases 
       
   155         *   from RoapTest. 
       
   156         * @since ?Series60_version
       
   157         * @param aTestCaseFile Test case file (optional)
       
   158         * @param aTestCases  Array of TestCases returned to test framework
       
   159         * @return Symbian OS error code
       
   160         */
       
   161         TInt GetTestCasesL( const TFileName& aTestCaseFile, 
       
   162                             RPointerArray<TTestCaseInfo>& aTestCases );
       
   163 
       
   164         /**
       
   165         * From CTestModuleBase RunTestCaseL is used to run an individual 
       
   166         *   test case. 
       
   167         * @since ?Series60_version
       
   168         * @param aCaseNumber Test case number
       
   169         * @param aTestCaseFile Test case file (optional)
       
   170         * @param aResult Test case result returned to test framework (PASS/FAIL)
       
   171         * @return Symbian OS error code (test case execution error, which is 
       
   172         *           not reported in aResult parameter as test case failure).
       
   173         */   
       
   174         TInt RunTestCaseL( const TInt aCaseNumber, 
       
   175                            const TFileName& aTestCaseFile,
       
   176                            TTestResult& aResult );
       
   177 
       
   178         /**
       
   179         * From CTestModuleBase; OOMTestQueryL is used to specify is particular
       
   180         * test case going to be executed using OOM conditions
       
   181         * @param aTestCaseFile Test case file (optional)
       
   182         * @param aCaseNumber Test case number (optional)
       
   183         * @param aFailureType OOM failure type (optional)
       
   184         * @param aFirstMemFailure The first heap memory allocation failure value (optional)
       
   185         * @param aLastMemFailure The last heap memory allocation failure value (optional)
       
   186         * @return TBool
       
   187         */
       
   188         virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, 
       
   189                                      const TInt /* aCaseNumber */, 
       
   190                                      TOOMFailureType& aFailureType, 
       
   191                                      TInt& /* aFirstMemFailure */, 
       
   192                                      TInt& /* aLastMemFailure */ );
       
   193 
       
   194         /**
       
   195         * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM
       
   196         * test environment
       
   197         * @param aTestCaseFile Test case file (optional)
       
   198         * @param aCaseNumber Test case number (optional)
       
   199         * @return None
       
   200         */
       
   201         virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, 
       
   202                                     const TInt /* aCaseNumber */ ); 
       
   203 
       
   204         /**
       
   205         * From CTestModuleBase; OOMHandleWarningL
       
   206         * @param aTestCaseFile Test case file (optional)
       
   207         * @param aCaseNumber Test case number (optional)
       
   208         * @param aFailNextValue FailNextValue for OOM test execution (optional)
       
   209         * @return None
       
   210         *
       
   211         * User may add implementation for OOM test warning handling. Usually no
       
   212         * implementation is required.           
       
   213         */
       
   214         virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */,
       
   215                                         const TInt /* aCaseNumber */, 
       
   216                                         TInt& /* aFailNextValue */); 
       
   217 
       
   218         /**
       
   219         * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM
       
   220         * test environment
       
   221         * @param aTestCaseFile Test case file (optional)
       
   222         * @param aCaseNumber Test case number (optional)
       
   223         * @return None
       
   224         *
       
   225         */
       
   226         virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, 
       
   227                                        const TInt /* aCaseNumber */ );
       
   228 
       
   229     protected:  // New functions
       
   230 
       
   231         /**
       
   232         * ?member_description.
       
   233         * @since ?Series60_version
       
   234         * @param ?arg1 ?description
       
   235         * @return ?description
       
   236         */
       
   237         //?type ?member_function( ?type ?arg1 );
       
   238 
       
   239     protected:  // Functions from base classes
       
   240 
       
   241         /**
       
   242         * From ?base_class ?member_description
       
   243         */
       
   244         //?type ?member_function();
       
   245 
       
   246     private:
       
   247 
       
   248         /**
       
   249         * C++ default constructor.
       
   250         */
       
   251         CRoapTest();
       
   252 
       
   253         /**
       
   254         * By default Symbian 2nd phase constructor is private.
       
   255         */
       
   256         void ConstructL();
       
   257 
       
   258         // Prohibit copy constructor if not deriving from CBase.
       
   259         // ?classname( const ?classname& );
       
   260         // Prohibit assigment operator if not deriving from CBase.
       
   261         // ?classname& operator=( const ?classname& );
       
   262 
       
   263         /**
       
   264         * Function returning test case name and pointer to test case function.
       
   265         * @since ?Series60_version
       
   266         * @param aCaseNumber test case number
       
   267         * @return TCaseInfo 
       
   268         */
       
   269         const TCaseInfo Case ( const TInt aCaseNumber ) const;
       
   270 
       
   271         /**
       
   272         * [test case declarations] - do not remove
       
   273         */
       
   274   
       
   275         // from CRoapTrigger
       
   276 
       
   277         /**
       
   278         * Construction/Destruction testing of RoapTrigger
       
   279         * @since ?Series60_version
       
   280         * @param aResult Test case result (PASS/FAIL)
       
   281         * @return Symbian OS error code (test case execution error 
       
   282         *   that is not returned as test case result in aResult)
       
   283         */
       
   284         TInt ConstructionDestructionTriggerL( TTestResult& aResult );
       
   285                                   
       
   286         /**
       
   287         * Message exporting of RoapTrigger
       
   288         * @since 3.2
       
   289         * @param aResult Test case result (PASS/FAIL)
       
   290         * @return Symbian OS error code (test case execution error 
       
   291         *   that is not returned as test case result in aResult)
       
   292         */                                
       
   293         TInt MessageAsXmlL( TTestResult& aResult );
       
   294         
       
   295         
       
   296         /**
       
   297         * Trigger validity checking of RoapTrigger
       
   298         * @since 3.2
       
   299         * @param aResult Test case result (PASS/FAIL)
       
   300         * @return Symbian OS error code (test case execution error 
       
   301         *   that is not returned as test case result in aResult)
       
   302         */        
       
   303         TInt ValidTriggerL( TTestResult& aResult );
       
   304 
       
   305         // from CRoapEng
       
   306 
       
   307         /**
       
   308         * Construction/Destruction of RoapEng & RoapEngBase
       
   309         * @since 3.2
       
   310         * @param aResult Test case result (PASS/FAIL)
       
   311         * @return Symbian OS error code (test case execution error 
       
   312         *   that is not returned as test case result in aResult)
       
   313         */ 
       
   314         TInt ConstructionDestructionRoapEngL( TTestResult& aResult );
       
   315         
       
   316 
       
   317         // from CRoapEngBase
       
   318     
       
   319         /**
       
   320         * Setting the trigger testing
       
   321         * @since 3.2
       
   322         * @param aResult Test case result (PASS/FAIL)
       
   323         * @return Symbian OS error code (test case execution error 
       
   324         *   that is not returned as test case result in aResult)
       
   325         */ 
       
   326         
       
   327         TInt SetTriggerL( TTestResult& aResult );
       
   328 
       
   329         /**
       
   330         * Starting the roap operation
       
   331         * @since 3.2
       
   332         * @param aResult Test case result (PASS/FAIL)
       
   333         * @return Symbian OS error code (test case execution error 
       
   334         *   that is not returned as test case result in aResult)
       
   335         */ 
       
   336         TInt AcceptL( TTestResult& aResult );
       
   337         
       
   338         /**
       
   339         * Cancel the roap operation
       
   340         * @since 3.2
       
   341         * @param aResult Test case result (PASS/FAIL)
       
   342         * @return Symbian OS error code (test case execution error 
       
   343         *   that is not returned as test case result in aResult)
       
   344         */ 
       
   345         TInt RejectL( TTestResult& aResult );
       
   346         
       
   347         /**
       
   348         * Cleanup stored data
       
   349         * @since 3.2
       
   350         * @param aResult Test case result (PASS/FAIL)
       
   351         * @return Symbian OS error code (test case execution error 
       
   352         *   that is not returned as test case result in aResult)
       
   353         */ 
       
   354         TInt DoCleanupL( TTestResult& aResult );   
       
   355         
       
   356         /**
       
   357         * Handling one pass RO response
       
   358         * @since 3.2
       
   359         * @param aResult Test case result (PASS/FAIL)
       
   360         * @return Symbian OS error code (test case execution error 
       
   361         *   that is not returned as test case result in aResult)
       
   362         */ 
       
   363         TInt HandleRoReponseL( TTestResult& aResult ); 
       
   364         
       
   365 
       
   366         /**
       
   367         * Retrieve trigger
       
   368         * @since 3.2
       
   369         * @param aResult Test case result (PASS/FAIL)
       
   370         * @return Symbian OS error code (test case execution error 
       
   371         *   that is not returned as test case result in aResult)
       
   372         */ 
       
   373         TInt TriggerL( TTestResult& aResult );
       
   374 
       
   375 
       
   376 
       
   377 
       
   378     public:     // Data
       
   379         // ?one_line_short_description_of_data
       
   380         //?data_declaration;
       
   381 
       
   382     protected:  // Data
       
   383         // ?one_line_short_description_of_data
       
   384         //?data_declaration;
       
   385 
       
   386     private:    // Data
       
   387         // Pointer to test (function) to be executed
       
   388         TestFunction iMethod;
       
   389 
       
   390         // Pointer to logger
       
   391         CStifLogger * iLog; 
       
   392 
       
   393         // Normal logger
       
   394         CStifLogger* iStdLog;
       
   395 
       
   396         // Test case logger
       
   397         CStifLogger* iTCLog;
       
   398 
       
   399         // Flag saying if test case title should be added to log file name
       
   400         TBool iAddTestCaseTitleToLogName;
       
   401 
       
   402         // ?one_line_short_description_of_data
       
   403         //?data_declaration;
       
   404 
       
   405         // Reserved pointer for future extension
       
   406         //TAny* iReserved;
       
   407         CActiveScheduler* iActiveScheduler;
       
   408 
       
   409     public:     // Friend classes
       
   410         //?friend_class_declaration;
       
   411     protected:  // Friend classes
       
   412         //?friend_class_declaration;
       
   413     private:    // Friend classes
       
   414         //?friend_class_declaration;
       
   415 
       
   416     };
       
   417 
       
   418 #endif      // ROAPTEST_H
       
   419 
       
   420 // End of File