sysstatemgmt/tsrc/public/basic/mt_rstartersession/MT_RStarterSession.h
branchRCL_3
changeset 21 ccb4f6b3db21
parent 3 a811597961f0
child 22 8cb079868133
equal deleted inserted replaced
20:1ddbe54d0645 21:ccb4f6b3db21
     9 * Initial Contributors:
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    10 * Nokia Corporation - initial contribution.
    11 *
    11 *
    12 * Contributors:
    12 * Contributors:
    13 *
    13 *
    14 * Description:
    14 * Description: Unit test code for RStarterSession class
    15 *
    15 *
    16 */
    16 */
    17 
       
    18 
       
    19 #ifndef __MT_RSTARTERSESSION_H__
    17 #ifndef __MT_RSTARTERSESSION_H__
    20 #define __MT_RSTARTERSESSION_H__
    18 #define __MT_RSTARTERSESSION_H__
    21 
    19 
       
    20 #if defined (_MSC_VER) && (_MSC_VER >= 1000)
       
    21 #pragma once
       
    22 #endif
       
    23 // Function pointer related internal definitions
       
    24 #ifndef __GCC32__
       
    25 #define GETPTR
       
    26 #else
       
    27 #define GETPTR &
       
    28 #endif  
       
    29 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0}
       
    30 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0}
       
    31 
    22 //  EXTERNAL INCLUDES
    32 //  EXTERNAL INCLUDES
    23 #include <CEUnitTestSuiteClass.h>
    33 #include <stiftestmodule.h>
    24 #include <EUnitDecorators.h>
       
    25 
       
    26 
    34 
    27 //  INTERNAL INCLUDES
    35 //  INTERNAL INCLUDES
    28 #include <starterclient.h>
    36 #include <starterclient.h>
    29 
    37 
    30 //  FORWARD DECLARATIONS
    38 // FORWARD DECLARATIONS
    31 
    39 class TCaseInfo;
    32 
    40 class MT_RStarterSession;
       
    41 // DESCRIPTION
       
    42 // This a Test Module interface template
       
    43 // that does not really do anything.
       
    44 typedef TInt ( MT_RStarterSession::*TestFunction )( TTestResult& );
    33 //  CLASS DEFINITION
    45 //  CLASS DEFINITION
    34 /**
    46 /**
    35  *
    47  *
    36  */
    48  */
    37 NONSHARABLE_CLASS( MT_RStarterSession )
    49 NONSHARABLE_CLASS( MT_RStarterSession )
    38 	: public CEUnitTestSuiteClass
    50 	: public CTestModuleBase
    39     {
    51     {
    40     public:     // Constructors and destructors
    52     public:     // Constructors and destructors
    41 
    53 
    42         /**
    54         /**
    43          * Two phase construction
    55          * Two phase construction
    44          */
    56          */
    45         static MT_RStarterSession* NewL();
    57         static MT_RStarterSession* NewL(CTestModuleIf& aTestModuleIf);
    46         static MT_RStarterSession* NewLC();
       
    47         /**
    58         /**
    48          * Destructor
    59          * Destructor
    49          */
    60          */
    50         ~MT_RStarterSession();
    61         ~MT_RStarterSession();
    51 
    62 
    52     private:    // Constructors and destructors
    63     private:    // Constructors and destructors
    53 
    64 
    54         MT_RStarterSession();
    65         MT_RStarterSession( CTestModuleIf& aTestModuleIf );
    55         void ConstructL();
    66         
       
    67         /**
       
    68         * Function returning test case name and pointer to test case function
       
    69         */
       
    70         const TCaseInfo Case( const TInt aCaseNumber ) const;
    56 
    71 
       
    72    	public: // Functions from base classes
       
    73 
       
    74         // @see CTestModuleBase
       
    75         virtual TInt GetTestCasesL( const TFileName& aTestCaseFile,
       
    76         RPointerArray<TTestCaseInfo>& aTestCases );
       
    77 
       
    78         // @see CTestModuleBase
       
    79         virtual TInt RunTestCaseL( const TInt aCaseNumber,
       
    80         const TFileName& aTestCaseFile,
       
    81 		TTestResult& aResult );
       
    82             
    57     private:    // New methods
    83     private:    // New methods
    58 
    84 
    59         void SetupL();
    85         void SetupL();
    60         void SetupEmptyL();
       
    61         void Teardown();
    86         void Teardown();
    62         void TeardownEmpty();
       
    63 
    87 
    64         void T_RStarterSession_ConnectL();
    88         TInt T_RStarterSession_Connect(TTestResult& aResult);
    65         void T_RStarterSession_SetStateL();
    89         TInt T_RStarterSession_SetState(TTestResult& aResult);
    66         void T_RStarterSession_ResetL();
    90         TInt T_RStarterSession_SetStateToNormal(TTestResult& aResult);
    67         void T_RStarterSession_ShutdownL();
    91         TInt T_RStarterSession_SetStateToAlarm(TTestResult& aResult);
    68         void T_RStarterSession_ResetNetworkL();
    92         TInt T_RStarterSession_SetStateToCharging(TTestResult& aResult);
    69         void T_RStarterSession_IsRTCTimeValidL();
    93         TInt T_RStarterSession_SetStateToOffLine(TTestResult& aResult);
    70         void T_RStarterSession_ActivateRfForEmergencyCallL();
    94         TInt T_RStarterSession_SetStateToBTSap(TTestResult& aResult);
    71         void T_RStarterSession_DeactivateRfAfterEmergencyCallL();
    95         TInt T_RStarterSession_Reset(TTestResult& aResult);
    72         void T_RStarterSession_EndSplashScreenL();
    96         TInt T_RStarterSession_Shutdown(TTestResult& aResult);
       
    97         TInt T_RStarterSession_ResetNetwork(TTestResult& aResult);
       
    98         TInt T_RStarterSession_IsRTCTimeValid(TTestResult& aResult);
       
    99         TInt T_RStarterSession_ActivateRfForEmergencyCall(TTestResult& aResult);
       
   100         TInt T_RStarterSession_DeactivateRfAfterEmergencyCall(TTestResult& aResult);
       
   101         TInt T_RStarterSession_EndSplashScreen(TTestResult& aResult);
    73 
   102 
    74     private:    // Data
   103     private:    // Data
    75 		
   104 		TestFunction    iMethod;
    76         RStarterSession iRStarterSession;
   105         RStarterSession iRStarterSession;
    77         EUNIT_DECLARE_TEST_TABLE; 
       
    78 
   106 
       
   107     };
       
   108 
       
   109 // Function pointer related internal definitions
       
   110 
       
   111 // Hack around known GCC bug.
       
   112 #ifndef __GCC32__
       
   113     #define GETPTR
       
   114 #else
       
   115     #define GETPTR &
       
   116 #endif
       
   117 
       
   118 
       
   119 // An internal structure containing a test case name and
       
   120 // the pointer to function doing the test
       
   121 class TCaseInfoInternal
       
   122     {
       
   123     public:
       
   124         const TText* iCaseName;
       
   125         TestFunction iMethod;
       
   126         TBool           iIsOOMTest;
       
   127         TInt            iFirstMemoryAllocation;
       
   128         TInt            iLastMemoryAllocation;
       
   129     };
       
   130 
       
   131 // An internal structure containing a test case name and
       
   132 // the pointer to function doing the test
       
   133 class TCaseInfo
       
   134     {
       
   135     public:
       
   136         TPtrC iCaseName;
       
   137         TestFunction iMethod;
       
   138         TBool           iIsOOMTest;
       
   139         TInt            iFirstMemoryAllocation;
       
   140         TInt            iLastMemoryAllocation;
       
   141     TCaseInfo( const TText* a ) : iCaseName( ( TText* ) a )
       
   142         {
       
   143         };
    79     };
   144     };
    80 
   145 
    81 #endif      //  __MT_RSTARTERSESSION_H__
   146 #endif      //  __MT_RSTARTERSESSION_H__
    82 
   147 
    83 // End of file
   148 // End of file