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: Unit test code for RStarterSession class |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
|
17 |
|
18 |
17 #ifndef __MT_RSTARTERSESSION_H__ |
19 #ifndef __MT_RSTARTERSESSION_H__ |
18 #define __MT_RSTARTERSESSION_H__ |
20 #define __MT_RSTARTERSESSION_H__ |
19 |
21 |
20 #if defined (_MSC_VER) && (_MSC_VER >= 1000) |
22 // EXTERNAL INCLUDES |
21 #pragma once |
23 #include <CEUnitTestSuiteClass.h> |
22 #endif |
24 #include <EUnitDecorators.h> |
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 |
25 |
32 // EXTERNAL INCLUDES |
|
33 #include <stiftestmodule.h> |
|
34 |
26 |
35 // INTERNAL INCLUDES |
27 // INTERNAL INCLUDES |
36 #include <starterclient.h> |
28 #include <starterclient.h> |
37 |
29 |
38 // FORWARD DECLARATIONS |
30 // FORWARD DECLARATIONS |
39 class TCaseInfo; |
31 |
40 class MT_RStarterSession; |
32 |
41 // DESCRIPTION |
|
42 // This a Test Module interface template |
|
43 // that does not really do anything. |
|
44 typedef TInt ( MT_RStarterSession::*TestFunction )( TTestResult& ); |
|
45 // CLASS DEFINITION |
33 // CLASS DEFINITION |
46 /** |
34 /** |
47 * |
35 * |
48 */ |
36 */ |
49 NONSHARABLE_CLASS( MT_RStarterSession ) |
37 NONSHARABLE_CLASS( MT_RStarterSession ) |
50 : public CTestModuleBase |
38 : public CEUnitTestSuiteClass |
51 { |
39 { |
52 public: // Constructors and destructors |
40 public: // Constructors and destructors |
53 |
41 |
54 /** |
42 /** |
55 * Two phase construction |
43 * Two phase construction |
56 */ |
44 */ |
57 static MT_RStarterSession* NewL(CTestModuleIf& aTestModuleIf); |
45 static MT_RStarterSession* NewL(); |
|
46 static MT_RStarterSession* NewLC(); |
58 /** |
47 /** |
59 * Destructor |
48 * Destructor |
60 */ |
49 */ |
61 ~MT_RStarterSession(); |
50 ~MT_RStarterSession(); |
62 |
51 |
63 private: // Constructors and destructors |
52 private: // Constructors and destructors |
64 |
53 |
65 MT_RStarterSession( CTestModuleIf& aTestModuleIf ); |
54 MT_RStarterSession(); |
66 |
55 void ConstructL(); |
67 /** |
|
68 * Function returning test case name and pointer to test case function |
|
69 */ |
|
70 const TCaseInfo Case( const TInt aCaseNumber ) const; |
|
71 |
56 |
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 |
|
83 private: // New methods |
57 private: // New methods |
84 |
58 |
85 void SetupL(); |
59 void SetupL(); |
|
60 void SetupEmptyL(); |
86 void Teardown(); |
61 void Teardown(); |
|
62 void TeardownEmpty(); |
87 |
63 |
88 TInt T_RStarterSession_Connect(TTestResult& aResult); |
64 void T_RStarterSession_ConnectL(); |
89 TInt T_RStarterSession_SetState(TTestResult& aResult); |
65 void T_RStarterSession_SetStateL(); |
90 TInt T_RStarterSession_SetStateToNormal(TTestResult& aResult); |
66 void T_RStarterSession_ResetL(); |
91 TInt T_RStarterSession_SetStateToAlarm(TTestResult& aResult); |
67 void T_RStarterSession_ShutdownL(); |
92 TInt T_RStarterSession_SetStateToCharging(TTestResult& aResult); |
68 void T_RStarterSession_ResetNetworkL(); |
93 TInt T_RStarterSession_SetStateToOffLine(TTestResult& aResult); |
69 void T_RStarterSession_IsRTCTimeValidL(); |
94 TInt T_RStarterSession_SetStateToBTSap(TTestResult& aResult); |
70 void T_RStarterSession_ActivateRfForEmergencyCallL(); |
95 TInt T_RStarterSession_Reset(TTestResult& aResult); |
71 void T_RStarterSession_DeactivateRfAfterEmergencyCallL(); |
96 TInt T_RStarterSession_Shutdown(TTestResult& aResult); |
72 void T_RStarterSession_EndSplashScreenL(); |
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); |
|
102 |
73 |
103 private: // Data |
74 private: // Data |
104 TestFunction iMethod; |
75 |
105 RStarterSession iRStarterSession; |
76 RStarterSession iRStarterSession; |
|
77 EUNIT_DECLARE_TEST_TABLE; |
106 |
78 |
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 }; |
|
144 }; |
79 }; |
145 |
80 |
146 #endif // __MT_RSTARTERSESSION_H__ |
81 #endif // __MT_RSTARTERSESSION_H__ |
147 |
82 |
148 // End of file |
83 // End of file |