diff -r 2b7283837edb -r 3104fc151679 uiservicetab/vimpstcmdprocess/tsrc/vimpstcmdprocess_utest/data/branch_coverage/indexD3.html --- a/uiservicetab/vimpstcmdprocess/tsrc/vimpstcmdprocess_utest/data/branch_coverage/indexD3.html Thu Aug 19 09:41:53 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,476 +0,0 @@ - -
-Start/ | End/ | |||
True | False | - | Line | Source |
1 | /* | |||
2 | * ============================================================================== | |||
3 | * Name : vimpstcmdprocess_processarray_utest.cpp | |||
4 | * Part of : vimpstcmdprocess_utest | |||
5 | * | |||
6 | * Description : vimpstcmdprocess_utest class member functions | |||
7 | * Version: %version: 3 % | |||
8 | * | |||
9 | * Copyright (C) 2002 - 2007 Nokia Corporation. | |||
10 | * This material, including documentation and any related | |||
11 | * computer programs, is protected by copyright controlled by | |||
12 | * Nokia Corporation. All rights are reserved. Copying, | |||
13 | * including reproducing, storing, adapting or translating, any | |||
14 | * or all of this material requires the prior written consent of | |||
15 | * Nokia Corporation. This material also contains confidential | |||
16 | * information which may not be disclosed to others without the | |||
17 | * prior written consent of Nokia Corporation. | |||
18 | * | |||
19 | * ============================================================================ | |||
20 | */ | |||
21 | ||||
22 | ||||
23 | // INCLUDE FILES | |||
24 | #include <Stiftestinterface.h> | |||
25 | #include "vimpstcmdprocess_utest.h" | |||
26 | #include <e32math.h> | |||
27 | ||||
28 | #include "cvimpstcmdfactory.h" | |||
29 | #include "cvimpstprocessarray.h" | |||
30 | #include "cvimpstprocessfriendrequestitem.h" | |||
31 | #include "s_vimpstengin.h" | |||
32 | #include "s_vimpststoragecontact.h" | |||
33 | #include "s_vimpststoragecontactlist.h" | |||
34 | #include "s_vimpstcmdobserver.h" | |||
35 | //#include "s_cvimpstprocessfriendrequestitem.h" | |||
36 | #include "mvimpstcmd.h" | |||
37 | #include "tvimpstconsts.h" | |||
38 | #include "s_vimpstprocessarrayItem.h" | |||
39 | #include "s_processarrayobserver.h" | |||
40 | #include "s_vimpststorageserviceview.h" | |||
41 | #include "s_storageitemmodel.h" | |||
42 | #include "s_mccaconnection.h" | |||
43 | ||||
44 | ||||
45 | // EXTERNAL DATA STRUCTURES | |||
46 | //extern ?external_data; | |||
47 | ||||
48 | // EXTERNAL FUNCTION PROTOTYPES | |||
49 | //extern ?external_function( ?arg_type,?arg_type ); | |||
50 | ||||
51 | // CONSTANTS | |||
52 | //const ?type ?constant_var = ?constant; | |||
53 | ||||
54 | // MACROS | |||
55 | //#define ?macro ?macro_def | |||
56 | ||||
57 | // LOCAL CONSTANTS AND MACROS | |||
58 | //const ?type ?constant_var = ?constant; | |||
59 | //#define ?macro_name ?macro_def | |||
60 | ||||
61 | // MODULE DATA STRUCTURES | |||
62 | //enum ?declaration | |||
63 | //typedef ?declaration | |||
64 | ||||
65 | // LOCAL FUNCTION PROTOTYPES | |||
66 | //?type ?function_name( ?arg_type, ?arg_type ); | |||
67 | ||||
68 | // FORWARD DECLARATIONS | |||
69 | //class ?FORWARD_CLASSNAME; | |||
70 | ||||
71 | // ============================= LOCAL FUNCTIONS =============================== | |||
72 | ||||
73 | // ----------------------------------------------------------------------------- | |||
74 | // ?function_name ?description. | |||
75 | // ?description | |||
76 | // Returns: ?value_1: ?description | |||
77 | // ?value_n: ?description_line1 | |||
78 | // ?description_line2 | |||
79 | // ----------------------------------------------------------------------------- | |||
80 | // | |||
81 | /* | |||
82 | ?type ?function_name( | |||
83 | ?arg_type arg, // ?description | |||
84 | ?arg_type arg) // ?description | |||
85 | { | |||
86 | ||||
87 | ?code // ?comment | |||
88 | ||||
89 | // ?comment | |||
90 | ?code | |||
91 | } | |||
92 | */ | |||
93 | ||||
94 | // ============================ MEMBER FUNCTIONS =============================== | |||
95 | ||||
96 | // ----------------------------------------------------------------------------- | |||
97 | // Cvimpstcmdprocess_utest::Cvimpstcmdprocess_utest | |||
98 | // C++ default constructor can NOT contain any code, that | |||
99 | // might leave. | |||
100 | // ----------------------------------------------------------------------------- | |||
101 | // | |||
1 | 1 | 102 | Cvimpstcmdprocess_utest::Cvimpstcmdprocess_utest() | |
103 | { | |||
104 | ||||
105 | } | |||
106 | ||||
107 | // ----------------------------------------------------------------------------- | |||
108 | // Cvimpstcmdprocess_utest::ConstructL | |||
109 | // Symbian 2nd phase constructor can leave. | |||
110 | // | |||
111 | // Note: If OOM test case uses STIF Logger, then STIF Logger must be created | |||
112 | // with static buffer size parameter (aStaticBufferSize). Otherwise Logger | |||
113 | // allocates memory from heap and therefore causes error situations with OOM | |||
114 | // testing. For more information about STIF Logger construction, see STIF Users | |||
115 | // Guide. | |||
116 | // ----------------------------------------------------------------------------- | |||
117 | // | |||
1 | 1 | 118 | void Cvimpstcmdprocess_utest::ConstructL() | |
119 | { | |||
120 | iLog = CStifLogger::NewL( Kvimpstcmdprocess_utestLogPath, | |||
121 | Kvimpstcmdprocess_utestLogFile); | |||
122 | ||||
123 | // Sample how to use logging | |||
124 | _LIT( KLogStart, "vimpstcmdprocess_utest logging starts!" ); | |||
125 | iLog->Log( KLogStart ); | |||
126 | ||||
127 | iVersionLogged = EFalse; | |||
128 | iNumberOfTestCases = 0; | |||
129 | } | |||
130 | ||||
131 | // ----------------------------------------------------------------------------- | |||
132 | // Cvimpstcmdprocess_utest::NewL | |||
133 | // Two-phased constructor. | |||
134 | // ----------------------------------------------------------------------------- | |||
135 | // | |||
1 | 0 | 136 | Cvimpstcmdprocess_utest* Cvimpstcmdprocess_utest::NewL() | |
137 | { | |||
138 | Cvimpstcmdprocess_utest* self = new (ELeave) Cvimpstcmdprocess_utest; | |||
139 | ||||
140 | CleanupStack::PushL( self ); | |||
141 | self->ConstructL(); | |||
142 | CleanupStack::Pop(); | |||
143 | ||||
1 | 144 | return self; | ||
145 | ||||
146 | } | |||
147 | ||||
148 | // Destructor | |||
1 | 1 | 149 | Cvimpstcmdprocess_utest::~Cvimpstcmdprocess_utest() | |
150 | { | |||
151 | delete iLog; | |||
152 | } | |||
153 | ||||
154 | // ----------------------------------------------------------------------------- | |||
155 | // Cvimpstcmdprocess_utest::InitL | |||
156 | // InitL is used to initialize the Test Module. | |||
157 | // ----------------------------------------------------------------------------- | |||
158 | // | |||
1 | 0 | 159 | TInt Cvimpstcmdprocess_utest::InitL( | |
160 | TFileName& /*aIniFile*/, | |||
161 | TBool /*aFirstTime*/ ) | |||
162 | { | |||
1 | 163 | return KErrNone; | ||
164 | ||||
165 | } | |||
166 | ||||
167 | // ----------------------------------------------------------------------------- | |||
168 | // Cvimpstcmdprocess_utest::GetTestCasesL | |||
169 | // GetTestCases is used to inquire test cases from the Test Module. Test | |||
170 | // cases are stored to array of test cases. The Test Framework will be | |||
171 | // the owner of the data in the RPointerArray after GetTestCases return | |||
172 | // and it does the memory deallocation. | |||
173 | // ----------------------------------------------------------------------------- | |||
174 | // | |||
1 | 0 | 175 | TInt Cvimpstcmdprocess_utest::GetTestCasesL( | |
176 | const TFileName& /*aConfig*/, | |||
177 | RPointerArray<TTestCaseInfo>& aTestCases ) | |||
178 | { | |||
179 | TTestResult dummyResult; | |||
1 | 180 | return MainTestL(Cvimpstcmdprocess_utest::EEnumerateTestCases, -1, aTestCases, dummyResult); | ||
181 | } | |||
182 | ||||
183 | // ----------------------------------------------------------------------------- | |||
184 | // Cvimpstcmdprocess_utest::RunTestCaseL | |||
185 | // RunTestCaseL is used to run an individual test case specified | |||
186 | // by aTestCase. Test cases that can be run may be requested from | |||
187 | // Test Module by GetTestCases method before calling RunTestCase. | |||
188 | // ----------------------------------------------------------------------------- | |||
189 | // | |||
65 | 0 | 190 | TInt Cvimpstcmdprocess_utest::RunTestCaseL( | |
191 | const TInt aCaseNumber, | |||
192 | const TFileName& /*aConfig*/, | |||
193 | TTestResult& aResult ) | |||
194 | { | |||
1 | 64 | 195 | if(!iVersionLogged) | |
196 | { | |||
197 | SendTestModuleVersion(); | |||
198 | iVersionLogged = ETrue; | |||
199 | } | |||
200 | ||||
201 | RPointerArray<TTestCaseInfo> aTestCases; //temporary | |||
202 | ||||
203 | /** | |||
204 | * SetupL is responsible for inicialization of all fields (etc.) common for all testcases | |||
205 | * MainTestL starts required testcase | |||
206 | * TeardownL destroys all data that was created by SetupL | |||
207 | */ | |||
208 | TInt errSetup = KErrNone; | |||
209 | TInt errTestcase = KErrNone; | |||
210 | ||||
0 | 65 | - | 211 | if(aCaseNumber > iNumberOfTestCases) |
0 | - | 212 | return KErrNotFound; | |
213 | ||||
214 | ||||
215 | TRAP(errSetup, MainTestL(Cvimpstcmdprocess_utest::ERunTestCase, STIF_RUN_SETUP, aTestCases, aResult); TRAP(errTestcase, MainTestL(Cvimpstcmdprocess_utest::ERunTestCase, aCaseNumber, aTestCases, aResult))\ | |||
65 | 65 | 216 | MainTestL(Cvimpstcmdprocess_utest::ERunTestCase, STIF_RUN_TEARDOWN, aTestCases, aResult)); | |
65 | 65 | 216 | try | |
0 | - | 216 | catch (XLeaveException & l) | |
0 | - | 216 | catch (...) | |
0 | - | 216 | catch (XLeaveException & l) | |
0 | - | 216 | catch (...) | |
217 | ||||
218 | ||||
0 | 65 | - | 219 | if(errTestcase != KErrNone) |
220 | { | |||
221 | aResult.SetResult(errTestcase, _L("Testcase failed")); | |||
222 | } | |||
0 | 65 | - | 223 | if(errSetup != KErrNone) |
224 | { | |||
225 | aResult.SetResult(errSetup, _L("Setup or teardown failed")); | |||
226 | } | |||
227 | ||||
65 | 228 | return KErrNone; | ||
229 | } | |||
230 | ||||
231 | // ----------------------------------------------------------------------------- | |||
232 | // Cvimpstcmdprocess_utest::OOMTestQueryL | |||
233 | // Used to check if a particular test case should be run in OOM conditions and | |||
234 | // which memory allocations should fail. | |||
235 | // ----------------------------------------------------------------------------- | |||
236 | // | |||
65 | 0 | 237 | TBool Cvimpstcmdprocess_utest::OOMTestQueryL( | |
238 | const TFileName& /* aTestCaseFile */, | |||
239 | const TInt /*aCaseNumber*/, | |||
240 | TOOMFailureType& /* aFailureType */, | |||
241 | TInt& /*aFirstMemFailure*/, | |||
242 | TInt& /*aLastMemFailure*/ ) | |||
243 | { | |||
65 | 244 | return EFalse; | ||
245 | } | |||
246 | ||||
247 | // ----------------------------------------------------------------------------- | |||
248 | // Cvimpstcmdprocess_utest::OOMTestInitializeL | |||
249 | // Used to perform the test environment setup for a particular OOM test case. | |||
250 | // Test Modules may use the initialization file to read parameters for Test | |||
251 | // Module initialization but they can also have their own configure file or | |||
252 | // some other routine to initialize themselves. | |||
253 | // | |||
254 | // NOTE: User may add implementation for OOM test environment initialization. | |||
255 | // Usually no implementation is required. | |||
256 | // ----------------------------------------------------------------------------- | |||
257 | // | |||
0 | 0 | - | 258 | void Cvimpstcmdprocess_utest::OOMTestInitializeL( |
259 | const TFileName& /* aTestCaseFile */, | |||
260 | const TInt /* aCaseNumber */ ) | |||
261 | { | |||
262 | } | |||
263 | ||||
264 | // ----------------------------------------------------------------------------- | |||
265 | // Cvimpstcmdprocess_utest::OOMHandleWarningL | |||
266 | // In some cases the heap memory allocation should be skipped, either due to | |||
267 | // problems in the OS code or components used by the code being tested, or even | |||
268 | // inside the tested components which are implemented this way on purpose (by | |||
269 | // design), so it is important to give the tester a way to bypass allocation | |||
270 | // failures. | |||
271 | // | |||
272 | // NOTE: User may add implementation for OOM test warning handling. Usually no | |||
273 | // implementation is required. | |||
274 | // ----------------------------------------------------------------------------- | |||
275 | // | |||
0 | 0 | - | 276 | void Cvimpstcmdprocess_utest::OOMHandleWarningL( |
277 | const TFileName& /* aTestCaseFile */, | |||
278 | const TInt /* aCaseNumber */, | |||
279 | TInt& /* aFailNextValue */ ) | |||
280 | { | |||
281 | } | |||
282 | ||||
283 | // ----------------------------------------------------------------------------- | |||
284 | // Cvimpstcmdprocess_utest::OOMTestFinalizeL | |||
285 | // Used to perform the test environment cleanup for a particular OOM test case. | |||
286 | // | |||
287 | // NOTE: User may add implementation for OOM test environment finalization. | |||
288 | // Usually no implementation is required. | |||
289 | // ----------------------------------------------------------------------------- | |||
290 | // | |||
0 | 0 | - | 291 | void Cvimpstcmdprocess_utest::OOMTestFinalizeL( |
292 | const TFileName& /* aTestCaseFile */, | |||
293 | const TInt /* aCaseNumber */ ) | |||
294 | { | |||
295 | } | |||
296 | ||||
297 | //----------------------------------------------------------------------------- | |||
298 | // Cvimpstcmdprocess_utest::SendTestModuleVersion | |||
299 | // Method used to send version of test module | |||
300 | //----------------------------------------------------------------------------- | |||
301 | // | |||
1 | 1 | 302 | void Cvimpstcmdprocess_utest::SendTestModuleVersion() | |
303 | { | |||
304 | TVersion moduleVersion; | |||
305 | moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR; | |||
306 | moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR; | |||
307 | moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD; | |||
308 | ||||
309 | TFileName moduleName; | |||
310 | moduleName = _L("vimpstcmdprocess_utest.dll"); | |||
311 | ||||
312 | TBool newVersionOfMethod = ETrue; | |||
313 | TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); | |||
314 | } | |||
315 | ||||
316 | // ========================== OTHER EXPORTED FUNCTIONS ========================= | |||
317 | ||||
318 | // ----------------------------------------------------------------------------- | |||
319 | // LibEntryL is a polymorphic Dll entry point | |||
320 | // Returns: CTestModuleBase*: Pointer to Test Module object | |||
321 | // ----------------------------------------------------------------------------- | |||
322 | // | |||
1 | 0 | 323 | EXPORT_C CTestModuleBase* LibEntryL() | |
324 | { | |||
1 | 325 | return Cvimpstcmdprocess_utest::NewL(); | ||
326 | ||||
327 | } | |||
328 | ||||
329 | // ----------------------------------------------------------------------------- | |||
330 | // SetRequirements handles test module parameters(implements evolution | |||
331 | // version 1 for test module's heap and stack sizes configuring). | |||
332 | // Returns: TInt: Symbian error code. | |||
333 | // ----------------------------------------------------------------------------- | |||
334 | // | |||
1 | 0 | 335 | EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, | |
336 | TUint32& /*aParameterValid*/ ) | |||
337 | { | |||
338 | ||||
339 | /* --------------------------------- NOTE --------------------------------- | |||
340 | USER PANICS occurs in test thread creation when: | |||
341 | 1) "The panic occurs when the value of the stack size is negative." | |||
342 | 2) "The panic occurs if the minimum heap size specified is less | |||
343 | than KMinHeapSize". | |||
344 | KMinHeapSize: "Functions that require a new heap to be allocated will | |||
345 | either panic, or will reset the required heap size to this value if | |||
346 | a smaller heap size is specified". | |||
347 | 3) "The panic occurs if the minimum heap size specified is greater than | |||
348 | the maximum size to which the heap can grow". | |||
349 | Other: | |||
350 | 1) Make sure that your hardware or Symbian OS is supporting given sizes. | |||
351 | e.g. Hardware might support only sizes that are divisible by four. | |||
352 | ------------------------------- NOTE end ------------------------------- */ | |||
353 | ||||
354 | // Normally STIF uses default heap and stack sizes for test thread, see: | |||
355 | // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize. | |||
356 | // If needed heap and stack sizes can be configured here by user. Remove | |||
357 | // comments and define sizes. | |||
358 | ||||
359 | /* | |||
360 | aParameterValid = KStifTestModuleParameterChanged; | |||
361 | ||||
362 | CTestModuleParamVer01* param = CTestModuleParamVer01::NewL(); | |||
363 | // Stack size | |||
364 | param->iTestThreadStackSize= 16384; // 16K stack | |||
365 | // Heap sizes | |||
366 | param->iTestThreadMinHeap = 4096; // 4K heap min | |||
367 | param->iTestThreadMaxHeap = 1048576;// 1M heap max | |||
368 | ||||
369 | aTestModuleParam = param; | |||
370 | */ | |||
1 | 371 | return KErrNone; | ||
372 | ||||
373 | } | |||
374 | ||||
375 | // ----------------------------------------------------------------------------- | |||
376 | // Cvimpstcmdprocess_utest::MainTestL | |||
377 | // Method responsible for enumerating and running test cases (and also setup and teardown activities before | |||
378 | // and after each test case). | |||
379 | // | |||
380 | // arguments: | |||
381 | // Cvimpstcmdprocess_utest::TCallReason aRunReason - defines aim of a call - enumeration or run of test cases | |||
382 | // TInt aTestToRun - in case of running test case - defines number of test case to run | |||
383 | // RPointerArray<TTestCaseInfo>& aTestCases - in case of enumerating test cases - array to locate test cases infos in | |||
384 | // ----------------------------------------------------------------------------- | |||
385 | // | |||
196 | 0 | 386 | TInt Cvimpstcmdprocess_utest::MainTestL(Cvimpstcmdprocess_utest::TCallReason aRunReason, | |
387 | TInt aTestToRun, | |||
388 | RPointerArray<TTestCaseInfo>& aTestCases, | |||
389 | TTestResult& aResult) | |||
390 | { | |||
195 | 1 | 391 | if(aRunReason == Cvimpstcmdprocess_utest::ERunTestCase) | |
392 | { | |||
130 | 65 | 393 | if(aTestToRun < 0) | |
394 | { | |||
395 | iLog->Log(_L("Running setup or teardown")); | |||
396 | } | |||
397 | else | |||
398 | { | |||
399 | iLog->Log(_L("Running test case #%d"), aTestToRun); | |||
400 | } | |||
401 | } | |||
402 | else | |||
403 | { | |||
404 | iLog->Log(_L("Enumerating test cases.")); | |||
405 | } | |||
406 | ||||
407 | TInt _test_case_no = -1; | |||
408 | ||||
409 | //test cases, setup and teardown include | |||
410 | #define TEST_CASES | |||
411 | #include "..\src\t_vimpstcmdprocess_processarray_utest.cpp" | |||
412 | #include "..\src\t_vimpstcmdprocess_cmdfactory_utestCases.cpp" | |||
413 | #undef TEST_CASES | |||
414 | ||||
415 | ||||
416 | ||||
417 | ||||
1 | 195 | 418 | if(aRunReason != Cvimpstcmdprocess_utest::ERunTestCase) | |
419 | { | |||
420 | iNumberOfTestCases = _test_case_no; | |||
421 | iLog->Log(_L("Enumeration completed.")); | |||
422 | } | |||
423 | ||||
424 | // Test case was executed | |||
196 | 425 | return KErrNone; | ||
426 | } | |||
427 | ||||
428 | // End of File | |||
***TER 75% (33/44) of SOURCE FILE vimpstcmdprocess_utest.cpp |