|
1 /* |
|
2 * Copyright (c) 2008 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 the License "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: DownloadMgrClientApiTest class member functions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <Stiftestinterface.h> |
|
22 #include "DownloadMgrClientApiTest.h" |
|
23 |
|
24 // EXTERNAL DATA STRUCTURES |
|
25 //extern ?external_data; |
|
26 |
|
27 // EXTERNAL FUNCTION PROTOTYPES |
|
28 //extern ?external_function( ?arg_type,?arg_type ); |
|
29 |
|
30 // CONSTANTS |
|
31 |
|
32 // MACROS |
|
33 |
|
34 // LOCAL CONSTANTS AND MACROS |
|
35 //const ?type ?constant_var = ?constant; |
|
36 //#define ?macro_name ?macro_def |
|
37 |
|
38 // MODULE DATA STRUCTURES |
|
39 //enum ?declaration |
|
40 //typedef ?declaration |
|
41 |
|
42 // LOCAL FUNCTION PROTOTYPES |
|
43 //?type ?function_name( ?arg_type, ?arg_type ); |
|
44 |
|
45 // FORWARD DECLARATIONS |
|
46 //class ?FORWARD_CLASSNAME; |
|
47 |
|
48 // ============================= LOCAL FUNCTIONS =============================== |
|
49 |
|
50 // --------------------------------------------------------- |
|
51 // DeleteFileL |
|
52 // --------------------------------------------------------- |
|
53 // |
|
54 void DeleteFileL( const TDesC& aFile, RFs& aFs ) |
|
55 { |
|
56 TParse file; |
|
57 User::LeaveIfError( aFs.Parse( aFile, file ) ); |
|
58 TUint att; |
|
59 TInt res = aFs.Att( file.FullName(), att ); |
|
60 if ( res == KErrNone ) |
|
61 { |
|
62 User::LeaveIfError( aFs.Delete( file.FullName() ) ); |
|
63 } |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------- |
|
67 // CopyFileL |
|
68 // --------------------------------------------------------- |
|
69 // |
|
70 void CopyFileL( const TDesC& aSrc, const TDesC& aDst, RFs& aFs ) |
|
71 { |
|
72 RFile src; |
|
73 RFile dst; |
|
74 TBuf8<256> buf; |
|
75 |
|
76 User::LeaveIfError( src.Open |
|
77 ( aFs, aSrc, EFileRead | EFileShareReadersOnly | EFileStream ) ); |
|
78 CleanupClosePushL<RFile>( src ); |
|
79 (void)aFs.MkDirAll( aDst ); |
|
80 (void)aFs.SetAtt( aDst, 0, KEntryAttReadOnly ); // Overwrite read-only. |
|
81 User::LeaveIfError( dst.Replace |
|
82 ( aFs, aDst, EFileWrite | EFileShareExclusive | EFileStream ) ); |
|
83 CleanupClosePushL<RFile>( dst ); |
|
84 FOREVER |
|
85 { |
|
86 User::LeaveIfError( src.Read( buf ) ); |
|
87 if ( !buf.Length() ) |
|
88 { |
|
89 break; |
|
90 } |
|
91 User::LeaveIfError( dst.Write( buf ) ); |
|
92 } |
|
93 CleanupStack::PopAndDestroy( 2 ); // close dst, src |
|
94 } |
|
95 |
|
96 |
|
97 // ============================ MEMBER FUNCTIONS =============================== |
|
98 |
|
99 // ----------------------------------------------------------------------------- |
|
100 // CDownloadMgrClientApiTest::CDownloadMgrClientApiTest |
|
101 // C++ default constructor can NOT contain any code, that |
|
102 // might leave. |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 CDownloadMgrClientApiTest::CDownloadMgrClientApiTest() |
|
106 { |
|
107 |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CDownloadMgrClientApiTest::ConstructL |
|
112 // Symbian 2nd phase constructor can leave. |
|
113 // Note: If OOM test case uses STIF Logger, then STIF Logger must be created |
|
114 // with static buffer size parameter (aStaticBufferSize). Otherwise Logger |
|
115 // allocates memory from heap and therefore causes error situations with OOM |
|
116 // testing. For more information about STIF Logger construction, see STIF Users |
|
117 // Guide. |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CDownloadMgrClientApiTest::ConstructL() |
|
121 { |
|
122 iLog = CStifLogger::NewL( KDownloadMgrClientApiTestLogPath, |
|
123 KDownloadMgrClientApiTestLogFile); |
|
124 |
|
125 User::LeaveIfError( iFileSystem.Connect() ); |
|
126 |
|
127 iDownloadManager.ConnectL( TUid::Uid( KThisAppUid ), *this, EFalse ); |
|
128 } |
|
129 |
|
130 // ----------------------------------------------------------------------------- |
|
131 // CDownloadMgrClientApiTest::NewL |
|
132 // Two-phased constructor. |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 CDownloadMgrClientApiTest* CDownloadMgrClientApiTest::NewL() |
|
136 { |
|
137 CDownloadMgrClientApiTest* self = new (ELeave) CDownloadMgrClientApiTest; |
|
138 |
|
139 CleanupStack::PushL( self ); |
|
140 self->ConstructL(); |
|
141 CleanupStack::Pop(); |
|
142 |
|
143 return self; |
|
144 |
|
145 } |
|
146 |
|
147 // Destructor |
|
148 CDownloadMgrClientApiTest::~CDownloadMgrClientApiTest() |
|
149 { |
|
150 iDownloadManager.Close(); |
|
151 iFileSystem.Close(); |
|
152 delete iLog; |
|
153 } |
|
154 |
|
155 // ----------------------------------------------------------------------------- |
|
156 // CDownloadMgrClientApiTest::InitL |
|
157 // InitL is used to initialize the Test Module. |
|
158 // ----------------------------------------------------------------------------- |
|
159 // |
|
160 TInt CDownloadMgrClientApiTest::InitL( |
|
161 TFileName& /*aIniFile*/, |
|
162 TBool /*aFirstTime*/ ) |
|
163 { |
|
164 return KErrNone; |
|
165 |
|
166 } |
|
167 |
|
168 /* |
|
169 ------------------------------------------------------------------------------- |
|
170 |
|
171 Class: CDemoModule |
|
172 |
|
173 Method: Case |
|
174 |
|
175 Description: Returns a test case by number. |
|
176 |
|
177 This function contains an array of all available test cases |
|
178 i.e pair of case name and test function. If case specified by parameter |
|
179 aCaseNumber is found from array, then that item is returned. |
|
180 |
|
181 The reason for this rather complicated function is to specify all the |
|
182 test cases only in one place. It is not necessary to understand how |
|
183 function pointers to class member functions works when adding new test |
|
184 cases. See function body for instructions how to add new test case. |
|
185 |
|
186 Parameters: const TInt aCaseNumber :in: Test case number |
|
187 |
|
188 Return Values: const TCaseInfo Struct containing case name & function |
|
189 |
|
190 Errors/Exceptions: None |
|
191 |
|
192 Status: Approved |
|
193 |
|
194 ------------------------------------------------------------------------------- |
|
195 */ |
|
196 const TCaseInfo CDownloadMgrClientApiTest::Case ( |
|
197 const TInt aCaseNumber ) const |
|
198 { |
|
199 |
|
200 /* |
|
201 * To add new test cases, implement new test case function and add new |
|
202 * line to KCases array specify the name of the case and the function |
|
203 * doing the test case |
|
204 * In practice, do following |
|
205 * |
|
206 * 1) Make copy of existing test case function and change its name |
|
207 * and functionality. Note that the function must be added to |
|
208 * OOMHard.cpp file and to OOMHard.h |
|
209 * header file. |
|
210 * |
|
211 * 2) Add entry to following KCases array either by using: |
|
212 * |
|
213 * 2.1: FUNCENTRY or ENTRY macro |
|
214 * ENTRY macro takes two parameters: test case name and test case |
|
215 * function name. |
|
216 * |
|
217 * FUNCENTRY macro takes only test case function name as a parameter and |
|
218 * uses that as a test case name and test case function name. |
|
219 * |
|
220 * Or |
|
221 * |
|
222 * 2.2: OOM_FUNCENTRY or OOM_ENTRY macro. Note that these macros are used |
|
223 * only with OOM (Out-Of-Memory) testing! |
|
224 * |
|
225 * OOM_ENTRY macro takes five parameters: test case name, test case |
|
226 * function name, TBool which specifies is method supposed to be run using |
|
227 * OOM conditions, TInt value for first heap memory allocation failure and |
|
228 * TInt value for last heap memory allocation failure. |
|
229 * |
|
230 * OOM_FUNCENTRY macro takes test case function name as a parameter and uses |
|
231 * that as a test case name, TBool which specifies is method supposed to be |
|
232 * run using OOM conditions, TInt value for first heap memory allocation |
|
233 * failure and TInt value for last heap memory allocation failure. |
|
234 */ |
|
235 |
|
236 static TCaseInfoInternal const KCases[] = |
|
237 { |
|
238 // To add new test cases, add new items to this array |
|
239 |
|
240 // NOTE: When compiled to GCCE, there must be Classname:: |
|
241 // declaration in front of the method name, e.g. |
|
242 // CDemoModule::PrintTest. Otherwise the compiler |
|
243 // gives errors. |
|
244 |
|
245 ENTRY( "Download Start test", CDownloadMgrClientApiTest::DownloadStartTest ), |
|
246 ENTRY( "Download Pause test", CDownloadMgrClientApiTest::DownloadPauseTest ), |
|
247 ENTRY( "Download Reset test", CDownloadMgrClientApiTest::DownloadResetTest ), |
|
248 ENTRY( "Download Delete test", CDownloadMgrClientApiTest::DownloadDeleteTest ), |
|
249 ENTRY( "Download Move test", CDownloadMgrClientApiTest::DownloadMoveTest ), |
|
250 ENTRY( "Download GetIntAttribute test", CDownloadMgrClientApiTest::DownloadGetIntAttributeTest ), |
|
251 ENTRY( "Download GetBoolAttribute test", CDownloadMgrClientApiTest::DownloadGetBoolAttributeTest ), |
|
252 ENTRY( "Download GetStringAttribute test with TDes16 argument", CDownloadMgrClientApiTest::DownloadGetStringAttribute16Test ), |
|
253 ENTRY( "Download GetStringAttribute test with TDes8 argument", CDownloadMgrClientApiTest::DownloadGetStringAttribute8Test ), |
|
254 ENTRY( "Download GetFileHandleAttribute test", CDownloadMgrClientApiTest::DownloadGetFileHandleAttributeTest ), |
|
255 ENTRY( "Download SetIntAttribute test", CDownloadMgrClientApiTest::DownloadSetIntAttributeTest ), |
|
256 ENTRY( "Download SetBoolAttribute test", CDownloadMgrClientApiTest::DownloadSetBoolAttributeTest ), |
|
257 ENTRY( "Download SetStringAttribute test with TDes16 argument", CDownloadMgrClientApiTest::DownloadSetStringAttribute16Test ), |
|
258 ENTRY( "Download SetStringAttribute test with TDes8 argument", CDownloadMgrClientApiTest::DownloadSetStringAttribute8Test ), |
|
259 ENTRY( "Download SetFileHandleAttribute test with TDes8 argument", CDownloadMgrClientApiTest::DownloadSetFileHandleAttributeTest ), |
|
260 ENTRY( "Manager ConnectL test", CDownloadMgrClientApiTest::ManagerConnectLTest ), |
|
261 ENTRY( "Manager Version test", CDownloadMgrClientApiTest::ManagerVersionTest ), |
|
262 ENTRY( "Manager Close test", CDownloadMgrClientApiTest::ManagerCloseTest ), |
|
263 ENTRY( "Manager CurrentDownloads test", CDownloadMgrClientApiTest::ManagerCurrentDownloadsTest ), |
|
264 ENTRY( "Manager CreateDownloadL test with Bool argument", CDownloadMgrClientApiTest::ManagerCreateDownloadLWithBoolTest ), |
|
265 ENTRY( "Manager CreateDownloadL test", CDownloadMgrClientApiTest::ManagerCreateDownloadLTest ), |
|
266 ENTRY( "Manager CreateCodDownloadL test", CDownloadMgrClientApiTest::ManagerCreateCodDownloadLTest ), |
|
267 ENTRY( "Manager FindDownload test", CDownloadMgrClientApiTest::ManagerFindDownloadTest ), |
|
268 ENTRY( "Manager PauseAll test", CDownloadMgrClientApiTest::ManagerPauseAllTest ), |
|
269 ENTRY( "Manager StartAll test", CDownloadMgrClientApiTest::ManagerStartAllTest ), |
|
270 ENTRY( "Manager ResetAll test", CDownloadMgrClientApiTest::ManagerResetAllTest ), |
|
271 ENTRY( "Manager DeleteAll test", CDownloadMgrClientApiTest::ManagerDeleteAllTest ), |
|
272 ENTRY( "Manager Disconnect test", CDownloadMgrClientApiTest::ManagerDisconnectTest ), |
|
273 ENTRY( "Manager GetIntAttribute test", CDownloadMgrClientApiTest::ManagerGetIntAttributeTest ), |
|
274 ENTRY( "Manager GetBoolAttribute test", CDownloadMgrClientApiTest::ManagerGetBoolAttributeTest ), |
|
275 ENTRY( "Manager GetStringAttribute test with TDesC16 argument", CDownloadMgrClientApiTest::ManagerGetStringAttribute16Test ), |
|
276 ENTRY( "Manager SetIntAttribute test", CDownloadMgrClientApiTest::ManagerSetIntAttributeTest ), |
|
277 ENTRY( "Manager SetBoolAttribute test", CDownloadMgrClientApiTest::ManagerSetBoolAttributeTest ), |
|
278 ENTRY( "Manager SetStringAttribute test with TDesC16 argument", CDownloadMgrClientApiTest::ManagerSetStringAttribute16Test ), |
|
279 ENTRY( "Manager SetDefaultIntAttribute test", CDownloadMgrClientApiTest::ManagerSetDefaultIntAttributeTest ), |
|
280 ENTRY( "Manager SetDefaultBoolAttribute test", CDownloadMgrClientApiTest::ManagerSetDefaultBoolAttributeTest ), |
|
281 ENTRY( "Manager SetDefaultStringAttribute test with TDesc16 argument", CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute16Test ), |
|
282 ENTRY( "Manager SetDefaultStringAttribute test with TDesc8 argument", CDownloadMgrClientApiTest::ManagerSetDefaultStringAttribute8Test ), |
|
283 ENTRY( "Manager AddObserverL test", CDownloadMgrClientApiTest::ManagerAddObserverLTest ), |
|
284 ENTRY( "Manager RemoveObserver test", CDownloadMgrClientApiTest::ManagerRemoveObserverTest ), |
|
285 ENTRY( "Manager SetNextUriObserver test", CDownloadMgrClientApiTest::ManagerSetNextUriObserverTest ), |
|
286 }; |
|
287 |
|
288 // Verify that case number is valid |
|
289 if( (TUint) aCaseNumber >= sizeof( KCases ) / |
|
290 sizeof( TCaseInfoInternal ) ) |
|
291 { |
|
292 |
|
293 // Invalid case, construct empty object |
|
294 TCaseInfo null( (const TText*) L"" ); |
|
295 null.iMethod = NULL; |
|
296 null.iIsOOMTest = EFalse; |
|
297 null.iFirstMemoryAllocation = 0; |
|
298 null.iLastMemoryAllocation = 0; |
|
299 return null; |
|
300 |
|
301 } |
|
302 |
|
303 // Construct TCaseInfo object and return it |
|
304 TCaseInfo tmp ( KCases[ aCaseNumber ].iCaseName ); |
|
305 tmp.iMethod = KCases[ aCaseNumber ].iMethod; |
|
306 tmp.iIsOOMTest = KCases[ aCaseNumber ].iIsOOMTest; |
|
307 tmp.iFirstMemoryAllocation = KCases[ aCaseNumber ].iFirstMemoryAllocation; |
|
308 tmp.iLastMemoryAllocation = KCases[ aCaseNumber ].iLastMemoryAllocation; |
|
309 return tmp; |
|
310 |
|
311 } |
|
312 |
|
313 void CDownloadMgrClientApiTest::HandleDMgrEventL( RHttpDownload& /*aDownload*/, THttpDownloadEvent /*aEvent*/ ) |
|
314 { |
|
315 |
|
316 } |
|
317 |
|
318 void CDownloadMgrClientApiTest::NextUriL( RHttpDownload& /*aDownload*/, const TDesC8& /*aUri*/ ) |
|
319 { |
|
320 |
|
321 } |
|
322 |
|
323 |
|
324 // ----------------------------------------------------------------------------- |
|
325 // CDownloadMgrClientApiTest::GetTestCasesL |
|
326 // GetTestCases is used to inquire test cases from the Test Module. Test |
|
327 // cases are stored to array of test cases. The Test Framework will be |
|
328 // the owner of the data in the RPointerArray after GetTestCases return |
|
329 // and it does the memory deallocation. |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 TInt CDownloadMgrClientApiTest::GetTestCasesL( |
|
333 const TFileName& /*aConfig*/, |
|
334 RPointerArray<TTestCaseInfo>& aTestCases ) |
|
335 { |
|
336 |
|
337 // Loop through all test cases and create new |
|
338 // TTestCaseInfo items and append items to aTestCase array |
|
339 for( TInt i = 0; Case(i).iMethod != NULL; i++ ) |
|
340 { |
|
341 // Allocate new TTestCaseInfo from heap for a testcase definition. |
|
342 TTestCaseInfo* newCase = new( ELeave ) TTestCaseInfo(); |
|
343 |
|
344 // PushL TTestCaseInfo to CleanupStack. |
|
345 CleanupStack::PushL( newCase ); |
|
346 |
|
347 // Set number for the testcase. |
|
348 // When the testcase is run, this comes as a parameter to RunTestCaseL. |
|
349 newCase->iCaseNumber = i; |
|
350 |
|
351 // Set title for the test case. This is shown in UI to user. |
|
352 newCase->iTitle.Copy( Case(i).iCaseName ); |
|
353 |
|
354 // Append TTestCaseInfo to the testcase array. After appended |
|
355 // successfully the TTestCaseInfo object is owned (and freed) |
|
356 // by the TestServer. |
|
357 User::LeaveIfError(aTestCases.Append ( newCase ) ); |
|
358 |
|
359 // Pop TTestCaseInfo from the CleanupStack. |
|
360 CleanupStack::Pop( newCase ); |
|
361 } |
|
362 |
|
363 return KErrNone; |
|
364 |
|
365 } |
|
366 |
|
367 // ----------------------------------------------------------------------------- |
|
368 // CDownloadMgrClientApiTest::RunTestCaseL |
|
369 // RunTestCaseL is used to run an individual test case specified |
|
370 // by aTestCase. Test cases that can be run may be requested from |
|
371 // Test Module by GetTestCases method before calling RunTestCase. |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 TInt CDownloadMgrClientApiTest::RunTestCaseL( |
|
375 const TInt aCaseNumber, |
|
376 const TFileName& /*aConfig*/, |
|
377 TTestResult& aResult ) |
|
378 { |
|
379 // Return value |
|
380 TInt execStatus = KErrNone; |
|
381 |
|
382 // Get the pointer to test case function |
|
383 TCaseInfo tmp = Case ( aCaseNumber ); |
|
384 |
|
385 _LIT( KLogInfo, "Starting testcase [%S]" ); |
|
386 iLog->Log( KLogInfo, &tmp.iCaseName); |
|
387 |
|
388 // Check that case number was valid |
|
389 if ( tmp.iMethod != NULL ) |
|
390 { |
|
391 // Valid case was found, call it via function pointer |
|
392 iMethod = tmp.iMethod; |
|
393 execStatus = ( this->*iMethod )( aResult ); |
|
394 } |
|
395 else |
|
396 { |
|
397 // Valid case was not found, return error. |
|
398 execStatus = KErrNotFound; |
|
399 } |
|
400 |
|
401 // Return case execution status (not the result of the case execution) |
|
402 return execStatus; |
|
403 |
|
404 } |
|
405 |
|
406 // ----------------------------------------------------------------------------- |
|
407 // CDownloadMgrClientApiTest::OOMTestQueryL |
|
408 // Used to check if a particular test case should be run in OOM conditions and |
|
409 // which memory allocations should fail. |
|
410 // |
|
411 // NOTE: This method is virtual and must be implemented only if test case |
|
412 // should be executed using OOM conditions. |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
|
415 TBool CDownloadMgrClientApiTest::OOMTestQueryL( |
|
416 const TFileName& /* aTestCaseFile */, |
|
417 const TInt /* aCaseNumber */, |
|
418 TOOMFailureType& /* aFailureType */, |
|
419 TInt& /* aFirstMemFailure */, |
|
420 TInt& /* aLastMemFailure */ ) |
|
421 { |
|
422 _LIT( KOOMTestQueryL, "CDownloadMgrClientApiTest::OOMTestQueryL" ); |
|
423 iLog->Log( KOOMTestQueryL ); |
|
424 |
|
425 return EFalse; |
|
426 |
|
427 } |
|
428 |
|
429 // ----------------------------------------------------------------------------- |
|
430 // CDownloadMgrClientApiTest::OOMTestInitializeL |
|
431 // Used to perform the test environment setup for a particular OOM test case. |
|
432 // Test Modules may use the initialization file to read parameters for Test |
|
433 // Module initialization but they can also have their own configure file or |
|
434 // some other routine to initialize themselves. |
|
435 // |
|
436 // NOTE: This method is virtual and must be implemented only if test case |
|
437 // should be executed using OOM conditions. |
|
438 // ----------------------------------------------------------------------------- |
|
439 // |
|
440 void CDownloadMgrClientApiTest::OOMTestInitializeL( |
|
441 const TFileName& /* aTestCaseFile */, |
|
442 const TInt /* aCaseNumber */ ) |
|
443 { |
|
444 } |
|
445 |
|
446 // ----------------------------------------------------------------------------- |
|
447 // CDownloadMgrClientApiTest::OOMHandleWarningL |
|
448 // In some cases the heap memory allocation should be skipped, either due to |
|
449 // problems in the OS code or components used by the code being tested, or even |
|
450 // inside the tested components which are implemented this way on purpose (by |
|
451 // design), so it is important to give the tester a way to bypass allocation |
|
452 // failures. |
|
453 // |
|
454 // NOTE: This method is virtual and must be implemented only if test case |
|
455 // should be executed using OOM conditions. |
|
456 // ----------------------------------------------------------------------------- |
|
457 // |
|
458 void CDownloadMgrClientApiTest::OOMHandleWarningL( |
|
459 const TFileName& /* aTestCaseFile */, |
|
460 const TInt /* aCaseNumber */, |
|
461 TInt& /* aFailNextValue */ ) |
|
462 { |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CDownloadMgrClientApiTest::OOMTestFinalizeL |
|
467 // Used to perform the test environment cleanup for a particular OOM test case. |
|
468 // |
|
469 // NOTE: This method is virtual and must be implemented only if test case |
|
470 // should be executed using OOM conditions. |
|
471 // ----------------------------------------------------------------------------- |
|
472 // |
|
473 void CDownloadMgrClientApiTest::OOMTestFinalizeL( |
|
474 const TFileName& /* aTestCaseFile */, |
|
475 const TInt /* aCaseNumber */ ) |
|
476 { |
|
477 } |
|
478 |
|
479 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
480 |
|
481 // ----------------------------------------------------------------------------- |
|
482 // LibEntryL is a polymorphic Dll entry point |
|
483 // Returns: CTestModuleBase*: Pointer to Test Module object |
|
484 // ----------------------------------------------------------------------------- |
|
485 // |
|
486 EXPORT_C CTestModuleBase* LibEntryL() |
|
487 { |
|
488 return CDownloadMgrClientApiTest::NewL(); |
|
489 |
|
490 } |
|
491 |
|
492 // ----------------------------------------------------------------------------- |
|
493 // SetRequirements handles test module parameters(implements evolution |
|
494 // version 1 for test module's heap and stack sizes configuring). |
|
495 // Returns: TInt: Symbian error code. |
|
496 // ----------------------------------------------------------------------------- |
|
497 // |
|
498 EXPORT_C TInt SetRequirements( CTestModuleParam*& /*aTestModuleParam*/, |
|
499 TUint32& /*aParameterValid*/ ) |
|
500 { |
|
501 |
|
502 /* --------------------------------- NOTE --------------------------------- |
|
503 USER PANICS occurs in test thread creation when: |
|
504 1) "The panic occurs when the value of the stack size is negative." |
|
505 2) "The panic occurs if the minimum heap size specified is less |
|
506 than KMinHeapSize". |
|
507 KMinHeapSize: "Functions that require a new heap to be allocated will |
|
508 either panic, or will reset the required heap size to this value if |
|
509 a smaller heap size is specified". |
|
510 3) "The panic occurs if the minimum heap size specified is greater than |
|
511 the maximum size to which the heap can grow". |
|
512 Other: |
|
513 1) Make sure that your hardware or Symbian OS is supporting given sizes. |
|
514 e.g. Hardware might support only sizes that are divisible by four. |
|
515 ------------------------------- NOTE end ------------------------------- */ |
|
516 |
|
517 // Normally STIF uses default heap and stack sizes for test thread, see: |
|
518 // KTestThreadMinHeap, KTestThreadMinHeap and KStackSize. |
|
519 // If needed heap and stack sizes can be configured here by user. Remove |
|
520 // comments and define sizes. |
|
521 |
|
522 /* |
|
523 aParameterValid = KStifTestModuleParameterChanged; |
|
524 |
|
525 CTestModuleParamVer01* param = CTestModuleParamVer01::NewL(); |
|
526 // Stack size |
|
527 param->iTestThreadStackSize= 16384; // 16K stack |
|
528 // Heap sizes |
|
529 param->iTestThreadMinHeap = 4096; // 4K heap min |
|
530 param->iTestThreadMaxHeap = 1048576;// 1M heap max |
|
531 |
|
532 aTestModuleParam = param; |
|
533 */ |
|
534 return KErrNone; |
|
535 |
|
536 } |
|
537 |
|
538 // ----------------------------------------------------------------------------- |
|
539 // E32Dll is a DLL entry point function |
|
540 // Returns: KErrNone: No error |
|
541 // ----------------------------------------------------------------------------- |
|
542 // |
|
543 #ifndef EKA2 // Hide Dll entry point to EKA2 |
|
544 GLDEF_C TInt E32Dll( |
|
545 TDllReason /*aReason*/) // Reason |
|
546 { |
|
547 return(KErrNone); |
|
548 |
|
549 } |
|
550 #endif // EKA2 |
|
551 |
|
552 // End of File |