|
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: t_msgstore test module. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef T_MSGSTORE_H |
|
21 #define T_MSGSTORE_H |
|
22 |
|
23 // INCLUDES |
|
24 #include "StifTestModule.h" |
|
25 #include <StifLogger.h> |
|
26 #include <NormalHardcodedAssert.h> |
|
27 |
|
28 // CONSTANTS |
|
29 |
|
30 // MACROS |
|
31 #define TEST_MODULE_VERSION_MAJOR 0 |
|
32 #define TEST_MODULE_VERSION_MINOR 0 |
|
33 #define TEST_MODULE_VERSION_BUILD 0 |
|
34 |
|
35 // Logging path |
|
36 _LIT( Kt_msgstoreLogPath, "\\logs\\testframework\\t_bufferedmsgcreatore\\" ); |
|
37 // Log file |
|
38 _LIT( Kt_msgstoreLogFile, "t_bufferedmsgcreatore.txt" ); |
|
39 _LIT( Kt_msgstoreLogFileWithTitle, "t_bufferedmsgcreatore_[%S].txt" ); |
|
40 |
|
41 #define GETPTR & |
|
42 #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0} |
|
43 #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0} |
|
44 #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c} |
|
45 #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c} |
|
46 |
|
47 // FORWARD DECLARATIONS |
|
48 class Ct_bufferedmsgcreator; |
|
49 |
|
50 // DATA TYPES |
|
51 // A typedef for function that does the actual testing, |
|
52 // function is a type |
|
53 typedef TInt (Ct_bufferedmsgcreator::* TestFunction)(TTestResult&); |
|
54 |
|
55 // CLASS DECLARATION |
|
56 |
|
57 /** |
|
58 * An internal structure containing a test case name and |
|
59 * the pointer to function doing the test |
|
60 */ |
|
61 class TCaseInfoInternal |
|
62 { |
|
63 public: |
|
64 const TText* iCaseName; |
|
65 TestFunction iMethod; |
|
66 TBool iIsOOMTest; |
|
67 TInt iFirstMemoryAllocation; |
|
68 TInt iLastMemoryAllocation; |
|
69 }; |
|
70 |
|
71 // CLASS DECLARATION |
|
72 |
|
73 /** |
|
74 * A structure containing a test case name and |
|
75 * the pointer to function doing the test |
|
76 * |
|
77 * @lib ?library |
|
78 * @since ?Series60_version |
|
79 */ |
|
80 class TCaseInfo |
|
81 { |
|
82 public: |
|
83 TPtrC iCaseName; |
|
84 TestFunction iMethod; |
|
85 TBool iIsOOMTest; |
|
86 TInt iFirstMemoryAllocation; |
|
87 TInt iLastMemoryAllocation; |
|
88 |
|
89 TCaseInfo( const TText* a ) : iCaseName( (TText*) a ) |
|
90 { |
|
91 }; |
|
92 |
|
93 }; |
|
94 |
|
95 |
|
96 // CLASS DECLARATION |
|
97 |
|
98 /** |
|
99 * This a t_msgstore class. |
|
100 * ?other_description_lines |
|
101 * |
|
102 * @lib ?library |
|
103 * @since ?Series60_version |
|
104 */ |
|
105 NONSHARABLE_CLASS(Ct_bufferedmsgcreator) : public CTestModuleBase |
|
106 { |
|
107 public: // Constructors and destructor |
|
108 |
|
109 |
|
110 /** |
|
111 * Two-phased constructor. |
|
112 */ |
|
113 static Ct_bufferedmsgcreator* NewL(); |
|
114 |
|
115 /** |
|
116 * Destructor. |
|
117 */ |
|
118 virtual ~Ct_bufferedmsgcreator(); |
|
119 |
|
120 public: // Functions from base classes |
|
121 |
|
122 /** |
|
123 * From CTestModuleBase InitL is used to initialize the |
|
124 * t_msgstore. It is called once for every instance of |
|
125 * TestModulet_msgstore after its creation. |
|
126 * @since ?Series60_version |
|
127 * @param aIniFile Initialization file for the test module (optional) |
|
128 * @param aFirstTime Flag is true when InitL is executed for first |
|
129 * created instance of t_msgstore. |
|
130 * @return Symbian OS error code |
|
131 */ |
|
132 TInt InitL( TFileName& aIniFile, TBool aFirstTime ); |
|
133 |
|
134 /** |
|
135 * From CTestModuleBase GetTestCasesL is used to inquiry test cases |
|
136 * from t_msgstore. |
|
137 * @since ?Series60_version |
|
138 * @param aTestCaseFile Test case file (optional) |
|
139 * @param aTestCases Array of TestCases returned to test framework |
|
140 * @return Symbian OS error code |
|
141 */ |
|
142 TInt GetTestCasesL( const TFileName& aTestCaseFile, |
|
143 RPointerArray<TTestCaseInfo>& aTestCases ); |
|
144 |
|
145 /** |
|
146 * From CTestModuleBase RunTestCaseL is used to run an individual |
|
147 * test case. |
|
148 * @since ?Series60_version |
|
149 * @param aCaseNumber Test case number |
|
150 * @param aTestCaseFile Test case file (optional) |
|
151 * @param aResult Test case result returned to test framework (PASS/FAIL) |
|
152 * @return Symbian OS error code (test case execution error, which is |
|
153 * not reported in aResult parameter as test case failure). |
|
154 */ |
|
155 TInt RunTestCaseL( const TInt aCaseNumber, |
|
156 const TFileName& aTestCaseFile, |
|
157 TTestResult& aResult ); |
|
158 |
|
159 /** |
|
160 * From CTestModuleBase; OOMTestQueryL is used to specify is particular |
|
161 * test case going to be executed using OOM conditions |
|
162 * @param aTestCaseFile Test case file (optional) |
|
163 * @param aCaseNumber Test case number (optional) |
|
164 * @param aFailureType OOM failure type (optional) |
|
165 * @param aFirstMemFailure The first heap memory allocation failure value (optional) |
|
166 * @param aLastMemFailure The last heap memory allocation failure value (optional) |
|
167 * @return TBool |
|
168 */ |
|
169 virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, |
|
170 const TInt /* aCaseNumber */, |
|
171 TOOMFailureType& aFailureType, |
|
172 TInt& /* aFirstMemFailure */, |
|
173 TInt& /* aLastMemFailure */ ); |
|
174 |
|
175 /** |
|
176 * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM |
|
177 * test environment |
|
178 * @param aTestCaseFile Test case file (optional) |
|
179 * @param aCaseNumber Test case number (optional) |
|
180 * @return None |
|
181 */ |
|
182 virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, |
|
183 const TInt /* aCaseNumber */ ); |
|
184 |
|
185 /** |
|
186 * From CTestModuleBase; OOMHandleWarningL |
|
187 * @param aTestCaseFile Test case file (optional) |
|
188 * @param aCaseNumber Test case number (optional) |
|
189 * @param aFailNextValue FailNextValue for OOM test execution (optional) |
|
190 * @return None |
|
191 * |
|
192 * User may add implementation for OOM test warning handling. Usually no |
|
193 * implementation is required. |
|
194 */ |
|
195 virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, |
|
196 const TInt /* aCaseNumber */, |
|
197 TInt& /* aFailNextValue */); |
|
198 |
|
199 /** |
|
200 * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM |
|
201 * test environment |
|
202 * @param aTestCaseFile Test case file (optional) |
|
203 * @param aCaseNumber Test case number (optional) |
|
204 * @return None |
|
205 * |
|
206 */ |
|
207 virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, |
|
208 const TInt /* aCaseNumber */ ); |
|
209 |
|
210 /** |
|
211 * Method used to log version of test module |
|
212 */ |
|
213 void SendTestModuleVersion(); |
|
214 |
|
215 private: |
|
216 |
|
217 /** |
|
218 * C++ default constructor. |
|
219 */ |
|
220 Ct_bufferedmsgcreator(); |
|
221 |
|
222 /** |
|
223 * By default Symbian 2nd phase constructor is private. |
|
224 */ |
|
225 void ConstructL(); |
|
226 |
|
227 /** |
|
228 * Function returning test case name and pointer to test case function. |
|
229 * @since ?Series60_version |
|
230 * @param aCaseNumber test case number |
|
231 * @return TCaseInfo |
|
232 */ |
|
233 const TCaseInfo Case ( const TInt aCaseNumber ) const; |
|
234 |
|
235 /** |
|
236 * [test case declarations] - do not remove |
|
237 */ |
|
238 //ADD NEW METHOD DEC HERE" |
|
239 |
|
240 TInt Oom1L( TTestResult& aResult ); |
|
241 |
|
242 TInt ErrHandling1L( TTestResult& aResult ); |
|
243 |
|
244 TInt ErrHandling2L( TTestResult& aResult ); |
|
245 |
|
246 |
|
247 private: // Data |
|
248 // Pointer to test (function) to be executed |
|
249 TestFunction iMethod; |
|
250 |
|
251 // Pointer to logger |
|
252 CStifLogger * iLog; |
|
253 |
|
254 // Normal logger |
|
255 CStifLogger* iStdLog; |
|
256 |
|
257 // Test case logger |
|
258 CStifLogger* iTCLog; |
|
259 |
|
260 // Flag saying if test case title should be added to log file name |
|
261 TBool iAddTestCaseTitleToLogName; |
|
262 |
|
263 // Flag saying if version of test module was already sent |
|
264 TBool iVersionLogged; |
|
265 |
|
266 }; |
|
267 |
|
268 #endif // T_MSGSTORE_H |
|
269 |
|
270 // End of File |