1 /* |
|
2 * Copyright (c) 2009 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: This module contains implementation of CTestExecution |
|
15 * class member functions. CTestExecution class handles a test |
|
16 * execution subsession specific operations. |
|
17 * |
|
18 */ |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32std.h> |
|
22 #include <e32svr.h> |
|
23 #include "TestEngineClient.h" |
|
24 #include "StifTFwIfProt.h" |
|
25 #include <stifinternal/TestServerClient.h> |
|
26 #include "TestServer.h" |
|
27 #include "TestServerModuleIf.h" |
|
28 #include "TestServerCommon.h" |
|
29 #include "PrintQueue.h" |
|
30 #include "TestServerEvent.h" |
|
31 #include "TestThreadContainer.h" |
|
32 #include "STIFMeasurement.h" |
|
33 |
|
34 // EXTERNAL DATA STRUCTURES |
|
35 |
|
36 // EXTERNAL FUNCTION PROTOTYPES |
|
37 |
|
38 // CONSTANTS |
|
39 |
|
40 // MACROS |
|
41 |
|
42 // LOCAL CONSTANTS AND MACROS |
|
43 |
|
44 // MODULE DATA STRUCTURES |
|
45 |
|
46 // LOCAL FUNCTION PROTOTYPES |
|
47 |
|
48 // FORWARD DECLARATIONS |
|
49 |
|
50 // ==================== LOCAL FUNCTIONS ======================================= |
|
51 |
|
52 // ================= MEMBER FUNCTIONS ========================================= |
|
53 |
|
54 /* |
|
55 ------------------------------------------------------------------------------- |
|
56 |
|
57 Class: CTestExecution |
|
58 |
|
59 Method: NewL |
|
60 |
|
61 Description: Returns new CTestExecution instance. |
|
62 |
|
63 Parameters: CTestModule* aModuleSession :in: "Parent" module |
|
64 TInt aCaseNumber :in: Test case number |
|
65 const TFileName& aConfig :in: Configuration filename |
|
66 |
|
67 Return Values: CTestExecution* New instance |
|
68 |
|
69 Errors/Exceptions: Function leaves if memory allocation fails or |
|
70 CTestExecution construction leaves. |
|
71 Panics is aModuleSession is NULL. |
|
72 |
|
73 Status: Proposal |
|
74 |
|
75 ------------------------------------------------------------------------------- |
|
76 */ |
|
77 CTestExecution* CTestExecution::NewL( CTestModule* aModuleSession, |
|
78 TInt aCaseNumber, |
|
79 const TFileName& aConfig ) |
|
80 { |
|
81 |
|
82 __ASSERT_ALWAYS ( aModuleSession, |
|
83 CTestServer::PanicServer( ENullModuleSession ) ); |
|
84 |
|
85 CTestExecution* self=new( ELeave ) CTestExecution; |
|
86 CleanupClosePushL( *self ); |
|
87 self->ConstructL( aModuleSession, aCaseNumber, aConfig ); |
|
88 CleanupStack::Pop(); |
|
89 |
|
90 return self; |
|
91 |
|
92 } |
|
93 |
|
94 |
|
95 /* |
|
96 ------------------------------------------------------------------------------- |
|
97 |
|
98 Class: CTestExecution |
|
99 |
|
100 Method: CTestExecution |
|
101 |
|
102 Description: Constructor. |
|
103 Initialises member variables whose default state is not zero or NULL. |
|
104 |
|
105 Parameters: None |
|
106 |
|
107 Return Values: None |
|
108 |
|
109 Errors/Exceptions: None |
|
110 |
|
111 Status: Proposal |
|
112 |
|
113 ------------------------------------------------------------------------------- |
|
114 */ |
|
115 CTestExecution::CTestExecution() : |
|
116 iConfig( 0, 0 ), |
|
117 iTestThreadOpen( EFalse ), |
|
118 iTestThreadFailure( ETestThreadOk ) |
|
119 { |
|
120 |
|
121 iPrintNotifyAvailable = EFalse; |
|
122 iThreadState = ENotStarted; |
|
123 iRemoteSendAvailable = EFalse; |
|
124 iRemoteReceiveAvailable = EFalse; |
|
125 iEventNotifyAvailable = EFalse; |
|
126 iCommandNotifyAvailable = EFalse; |
|
127 |
|
128 } |
|
129 |
|
130 /* |
|
131 ------------------------------------------------------------------------------- |
|
132 |
|
133 Class: CTestExecution |
|
134 |
|
135 Method: ~CTestExecution |
|
136 |
|
137 Description: Destructor |
|
138 |
|
139 Parameters: None |
|
140 |
|
141 Return Values: None |
|
142 |
|
143 Errors/Exceptions: Panics is threadmutex is taken. |
|
144 |
|
145 Status: Approved |
|
146 |
|
147 ------------------------------------------------------------------------------- |
|
148 */ |
|
149 CTestExecution::~CTestExecution() |
|
150 { |
|
151 // Thread must be stopped before CTestExecution can be deleted |
|
152 if( iThreadState == EOnGoing ) |
|
153 { |
|
154 if( iModuleContainer != NULL ) |
|
155 { |
|
156 iModuleContainer->KillThread( KErrCancel ); |
|
157 } |
|
158 delete iModuleContainer; |
|
159 iModuleContainer = NULL; |
|
160 CTestServer::PanicServer( EClosingWhileTestRunning ); |
|
161 } |
|
162 |
|
163 delete iPrintHandler; |
|
164 iPrintHandler = NULL; |
|
165 delete iEventHandler; |
|
166 iEventHandler = NULL; |
|
167 delete iSndHandler; |
|
168 iSndHandler = NULL; |
|
169 delete iRcvHandler; |
|
170 iRcvHandler = NULL; |
|
171 delete iInterferenceHandler; |
|
172 iInterferenceHandler = NULL; |
|
173 delete iMeasurementHandler; |
|
174 iMeasurementHandler = NULL; |
|
175 delete iCommandHandler; |
|
176 iCommandHandler = NULL; |
|
177 |
|
178 // Test interference array(Needed cases when test interference thread is |
|
179 // needed to Kill()) |
|
180 iSTIFTestInterferenceArray.Reset(); |
|
181 iSTIFTestInterferenceArray.Close(); |
|
182 |
|
183 // Reset test measurement array |
|
184 iMeasurementHandlingArray.Reset(); |
|
185 iMeasurementHandlingArray.Close(); |
|
186 |
|
187 // iPrintQueue must be emptied here, because it items are allocated from server heap |
|
188 delete iPrintQueue; |
|
189 iPrintQueue = NULL; |
|
190 |
|
191 // Delete name buffer |
|
192 delete iConfigNameBuffer; |
|
193 iConfigNameBuffer = NULL; |
|
194 |
|
195 delete iTestCaseArgs; |
|
196 iTestCaseArgs = NULL; |
|
197 |
|
198 iStateEvents.ResetAndDestroy(); |
|
199 iStateEvents.Close(); |
|
200 |
|
201 iEventArray.ResetAndDestroy(); |
|
202 iEventArray.Close(); |
|
203 |
|
204 // Close mutexes |
|
205 if ( iPrintMutex.Handle() != 0 ) iPrintMutex.Close(); |
|
206 if ( iEventMutex.Handle() != 0 ) iEventMutex.Close(); |
|
207 if ( iSndMutex.Handle() != 0 ) iSndMutex.Close(); |
|
208 if ( iRcvMutex.Handle() != 0 ) iRcvMutex.Close(); |
|
209 if ( iInterferenceMutex.Handle() != 0 ) iInterferenceMutex.Close(); |
|
210 if ( iMeasurementMutex.Handle() != 0 ) iMeasurementMutex.Close(); |
|
211 if ( iCommandMutex.Handle() != 0 ) iCommandMutex.Close(); |
|
212 |
|
213 // Mutex for testcomplete and cancel operations. Close mutex |
|
214 if ( iTestThreadMutex.Handle() != 0 ) iTestThreadMutex.Close(); |
|
215 |
|
216 // Close semaphores |
|
217 if ( iPrintSem.Handle() != 0 ) iPrintSem.Close(); |
|
218 if ( iEventSem.Handle() != 0 ) iEventSem.Close(); |
|
219 if ( iSndSem.Handle() != 0 ) iSndSem.Close(); |
|
220 if ( iRcvSem.Handle() != 0 ) iRcvSem.Close(); |
|
221 if ( iInterferenceSem.Handle() != 0 ) iInterferenceSem.Close(); |
|
222 if ( iMeasurementSem.Handle() != 0 ) iMeasurementSem.Close(); |
|
223 //if ( iReceiverSem.Handle() != 0 ) iReceiverSem.Close(); |
|
224 if ( iCommandSem.Handle() != 0 ) iCommandSem.Close(); |
|
225 |
|
226 iMessageQueue.Close(); |
|
227 |
|
228 iTestThread.Close(); |
|
229 |
|
230 delete iCommandDef; |
|
231 iCommandDef = NULL; |
|
232 } |
|
233 |
|
234 |
|
235 /* |
|
236 ------------------------------------------------------------------------------- |
|
237 |
|
238 Class: CTestExecution |
|
239 |
|
240 Method: ConstructL |
|
241 |
|
242 Description: Second level constructor |
|
243 |
|
244 Parameters: CTestModule* aModuleSession :in: "Parent" module |
|
245 TInt aCaseNumber :: :in: Test case number |
|
246 const TFileName& aConfig :in: Configuration filename |
|
247 |
|
248 Return Values: None |
|
249 |
|
250 Errors/Exceptions: None |
|
251 |
|
252 Status: Approved |
|
253 |
|
254 ------------------------------------------------------------------------------- |
|
255 */ |
|
256 void CTestExecution::ConstructL( CTestModule *aModuleSession, |
|
257 TInt aCaseNumber, |
|
258 const TFileName& aConfig ) |
|
259 { |
|
260 |
|
261 // Get the parameters |
|
262 iModuleSession = aModuleSession; |
|
263 iCaseNumber = aCaseNumber; |
|
264 |
|
265 // Construct heap buffer for configuration file |
|
266 iConfigNameBuffer = HBufC::NewL( aConfig.Length() ); |
|
267 iConfig.Set ( iConfigNameBuffer->Des() ); |
|
268 iConfig.Copy ( aConfig ); |
|
269 |
|
270 // Create mutexes |
|
271 User::LeaveIfError( iPrintMutex.CreateLocal() ); |
|
272 User::LeaveIfError( iEventMutex.CreateLocal() ); |
|
273 User::LeaveIfError( iSndMutex.CreateLocal() ); |
|
274 User::LeaveIfError( iRcvMutex.CreateLocal() ); |
|
275 User::LeaveIfError( iInterferenceMutex.CreateLocal() ); |
|
276 User::LeaveIfError( iMeasurementMutex.CreateLocal() ); |
|
277 User::LeaveIfError( iCommandMutex.CreateLocal() ); |
|
278 |
|
279 // Mutex for testcomplete and cancel operations. Create mutex |
|
280 User::LeaveIfError( iTestThreadMutex.CreateLocal() ); |
|
281 |
|
282 // Create semaphores |
|
283 User::LeaveIfError( iPrintSem.CreateLocal( 0 ) ); |
|
284 User::LeaveIfError( iEventSem.CreateLocal( 0 ) ); |
|
285 User::LeaveIfError( iSndSem.CreateLocal( 0 ) ); |
|
286 User::LeaveIfError( iRcvSem.CreateLocal( 0 ) ); |
|
287 User::LeaveIfError( iInterferenceSem.CreateLocal( 0 ) ); |
|
288 User::LeaveIfError( iMeasurementSem.CreateLocal( 0 ) ); |
|
289 //User::LeaveIfError( iReceiverSem.CreateLocal( 0 ) ); |
|
290 User::LeaveIfError( iCommandSem.CreateLocal( 0 ) ); |
|
291 |
|
292 // Create handlers |
|
293 iPrintHandler = CPrintHandler::NewL( *this ); |
|
294 iEventHandler = CEventHandler::NewL( *this ); |
|
295 iSndHandler = CSndHandler::NewL( *this ); |
|
296 iRcvHandler = CRcvHandler::NewL( *this ); |
|
297 iInterferenceHandler = CInterferenceHandler::NewL( *this ); |
|
298 iMeasurementHandler = CMeasurementHandler::NewL( *this ); |
|
299 iCommandHandler = CCommandHandler::NewL( *this ); |
|
300 |
|
301 // Create print queue |
|
302 iPrintQueue = CPrintQueue::NewL(); |
|
303 |
|
304 // Start print handler |
|
305 iPrintHandler->StartL(); |
|
306 |
|
307 // Start rcv handler |
|
308 iRcvHandler->StartL(); |
|
309 |
|
310 // Start interference handler |
|
311 iInterferenceHandler->StartL(); |
|
312 |
|
313 // Start measurement handler |
|
314 iMeasurementHandler->StartL(); |
|
315 |
|
316 iCommandDef = CCommandDef::NewL(); |
|
317 } |
|
318 |
|
319 |
|
320 /* |
|
321 ------------------------------------------------------------------------------- |
|
322 |
|
323 Class: CTestExecution |
|
324 |
|
325 Method: RunTestCase |
|
326 |
|
327 Description: Starts to execute test case in separate thread. |
|
328 |
|
329 Parameters: const RMessage& aMessage :in: Message from client. |
|
330 |
|
331 Return Values: TInt Error code |
|
332 |
|
333 Errors/Exceptions: None |
|
334 |
|
335 Status: Proposal |
|
336 |
|
337 ------------------------------------------------------------------------------- |
|
338 */ |
|
339 TInt CTestExecution::RunTestCase( const RMessage2& aMessage ) |
|
340 { |
|
341 |
|
342 __TRACE ( KInit, ( _L( "CTestExecution::RunTestCase in" ) ) ); |
|
343 |
|
344 TInt ret = KErrNone; |
|
345 |
|
346 // Store message to be completed when case is finished |
|
347 iTestExeMessage = aMessage; |
|
348 |
|
349 iFullResult.iStartTime.HomeTime(); |
|
350 |
|
351 delete iTestCaseArgs; |
|
352 iTestCaseArgs = NULL; |
|
353 |
|
354 TInt testCaseArgsLength = iTestExeMessage.GetDesLength( 1 ); |
|
355 if ( ( testCaseArgsLength != KErrArgument ) && ( testCaseArgsLength != KErrBadDescriptor ) ) |
|
356 { |
|
357 iTestCaseArgs = HBufC::New( testCaseArgsLength ); |
|
358 if ( iTestCaseArgs == NULL ) |
|
359 { |
|
360 _LIT(KRunError,"Can't allocate memory for test case arguments"); |
|
361 __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) ); |
|
362 CompleteTestExecution( KErrNone, |
|
363 TFullTestResult::ECaseException, |
|
364 KErrNoMemory, |
|
365 KErrGeneral, |
|
366 KRunError ); |
|
367 return KErrNone; |
|
368 } |
|
369 |
|
370 TPtr testCaseArgsPtr( iTestCaseArgs->Des() ); |
|
371 TRAP( ret, iTestExeMessage.Read( 1, testCaseArgsPtr ) ); |
|
372 if ( ret != KErrNone ) |
|
373 { |
|
374 _LIT(KRunError,"Can't read test case arguments"); |
|
375 __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) ); |
|
376 CompleteTestExecution( KErrNone, |
|
377 TFullTestResult::ECaseException, |
|
378 ret, |
|
379 KErrGeneral, |
|
380 KRunError ); |
|
381 return KErrNone; |
|
382 } |
|
383 } |
|
384 |
|
385 // Get a test module, which executes the test case. |
|
386 // The test module will be freed either when the test case |
|
387 // completes, or the test case is aborted. |
|
388 ret = iModuleSession->GetTestModule( iModuleContainer, iConfig ); |
|
389 if ( ret != KErrNone || iModuleContainer == NULL ) |
|
390 { |
|
391 _LIT(KRunError,"Can't get test module"); |
|
392 __TRACE ( KError, ( CStifLogger::ERed, KRunError() ) ); |
|
393 CompleteTestExecution( KErrNone, |
|
394 TFullTestResult::ECaseException, |
|
395 ret, |
|
396 KErrGeneral, |
|
397 KRunError ); |
|
398 return KErrNone; |
|
399 } |
|
400 |
|
401 |
|
402 // Thread is created, so all thread specific operations are possible, |
|
403 // even if thread is not yet resumed, so mark thread to be "Running" |
|
404 SetThreadState ( EOnGoing ); |
|
405 |
|
406 // Start the test |
|
407 iModuleContainer->SetExecutionSubSession( this ); |
|
408 iModuleContainer->RunTestCase( iConfig, iCaseNumber, aMessage ); |
|
409 |
|
410 __TRACE ( KRunTestCase, ( _L( "CTestExecution::RunTestCase out. Case ongoing" ) ) ); |
|
411 |
|
412 return KErrNone; |
|
413 |
|
414 } |
|
415 |
|
416 |
|
417 /* |
|
418 ------------------------------------------------------------------------------- |
|
419 |
|
420 Class: CTestExecution |
|
421 |
|
422 Method: NotifyPrint |
|
423 |
|
424 Description: Handles print request from engine. If print queue is empty, |
|
425 message is stored to be used later when there is something to |
|
426 print, otherwise the first queue item is returned and request |
|
427 completes immediately. |
|
428 |
|
429 Parameters: const RMessage& aMessage :in: Message from client. |
|
430 |
|
431 Return Values: None |
|
432 |
|
433 Errors/Exceptions: None |
|
434 |
|
435 Status: Proposal |
|
436 |
|
437 ------------------------------------------------------------------------------- |
|
438 */ |
|
439 TInt CTestExecution::NotifyPrint( const RMessage2& aMessage ) |
|
440 { |
|
441 |
|
442 __ASSERT_ALWAYS( iPrintNotifyAvailable == EFalse, |
|
443 CTestServer::PanicServer( EPrintQueueBroken ) ); |
|
444 |
|
445 // Get first item from queue |
|
446 TPrintQueueItem *item = iPrintQueue->Pop(); |
|
447 |
|
448 if ( item == NULL ) |
|
449 { |
|
450 |
|
451 // If thread can't print anymore, and queue is empty, then |
|
452 // complete with Eof, because there will not be any new prints |
|
453 if ( iThreadState == EFinished || iThreadState == ECancelled ) |
|
454 { |
|
455 __TRACE ( KPrint, ( _L( "CTestExecution::NotifyPrint to finished thread" ) ) ); |
|
456 aMessage.Complete ( KErrEof ); |
|
457 } |
|
458 else |
|
459 { |
|
460 // Print request available, do not complete request |
|
461 iNotifyPrintMessage = aMessage; |
|
462 iPrintNotifyAvailable = ETrue; |
|
463 } |
|
464 |
|
465 } |
|
466 else |
|
467 { |
|
468 // Construct message |
|
469 TTestProgress progress; |
|
470 progress.iPosition = item->iPriority; |
|
471 progress.iDescription = item->iData1; |
|
472 progress.iText = item->iData2; |
|
473 |
|
474 iNotifyPrintMessage = aMessage; |
|
475 // Write message to client space and complete request |
|
476 WritePrint( progress ); |
|
477 |
|
478 delete item; |
|
479 } |
|
480 |
|
481 |
|
482 return KErrNone; |
|
483 |
|
484 } |
|
485 /* |
|
486 ------------------------------------------------------------------------------- |
|
487 |
|
488 Class: CTestExecution |
|
489 |
|
490 Method: DoNotifyPrint |
|
491 |
|
492 Description: If print notification available, notification is copied to |
|
493 client memory space and request is completed. |
|
494 Else new print queue item is created and appended to print |
|
495 queue. If queue is full or memory can't be allocated, |
|
496 then message will be discarded. |
|
497 |
|
498 Parameters: None |
|
499 |
|
500 Return Values: None |
|
501 |
|
502 Errors/Exceptions: None |
|
503 |
|
504 Status: Proposal |
|
505 |
|
506 ------------------------------------------------------------------------------- |
|
507 */ |
|
508 void CTestExecution::DoNotifyPrint() |
|
509 { |
|
510 |
|
511 if ( iPrintNotifyAvailable ) |
|
512 { |
|
513 // Write message to client space |
|
514 WritePrint( iProgress ); |
|
515 } |
|
516 else |
|
517 { |
|
518 |
|
519 TPrintQueueItem *item = |
|
520 new TPrintQueueItem( iProgress.iPosition, |
|
521 iProgress.iDescription, |
|
522 iProgress.iText ); |
|
523 |
|
524 if ( item != NULL ) |
|
525 { |
|
526 // Item constructed ok, add it to queue |
|
527 if ( iPrintQueue->Push( *item ) != KErrNone ) |
|
528 { |
|
529 // Queue is full, clean-up |
|
530 delete item; |
|
531 } |
|
532 } |
|
533 // else: Could not construct TPrintQueueItem, no free memory. |
|
534 // drop printing |
|
535 } |
|
536 |
|
537 } |
|
538 |
|
539 /* |
|
540 ------------------------------------------------------------------------------- |
|
541 |
|
542 Class: CTestExecution |
|
543 |
|
544 Method: DoNotifyInterference |
|
545 |
|
546 Description: Handles Test Interference thread append and remove operations. |
|
547 |
|
548 Parameters: None |
|
549 |
|
550 Return Values: None |
|
551 |
|
552 Errors/Exceptions: None |
|
553 |
|
554 Status: Proposal |
|
555 |
|
556 ------------------------------------------------------------------------------- |
|
557 */ |
|
558 void CTestExecution::DoNotifyInterference() |
|
559 { |
|
560 // Information for this context => information is in this thread's heap and |
|
561 // if CUndertaker::RunL is called then test interface thread can called |
|
562 // with function call and kill() test interference thread |
|
563 |
|
564 // Take information from struct given in |
|
565 // CTestThreadContainer::AddInterferenceThread or |
|
566 // CTestThreadContainer::RemoveInterferenceThread |
|
567 |
|
568 RThread thread; |
|
569 TInt ret = thread.Open ( iTestInterference.iThreadId ); |
|
570 if( ret != KErrNone ) |
|
571 { |
|
572 RDebug::Print( _L("CTestExecution::DoNotifyInterference %d"), ret ); |
|
573 User::Panic( _L("CTestExecution::DoNotifyInterference"), ret ); |
|
574 } |
|
575 |
|
576 if ( iTestInterference.iOperation == TTestInterference::EAppend ) |
|
577 { |
|
578 iSTIFTestInterferenceArray.Append( thread ); |
|
579 } |
|
580 else if (iTestInterference.iOperation == TTestInterference::ERemove ) |
|
581 { |
|
582 // Remove thread from Array.Test interference thread is stopped and killed |
|
583 // successfully |
|
584 for( TInt i = 0; i < iSTIFTestInterferenceArray.Count(); i++ ) |
|
585 { |
|
586 if( iSTIFTestInterferenceArray[i].Id() == thread.Id() ) |
|
587 { |
|
588 iSTIFTestInterferenceArray.Remove( i ); |
|
589 break; |
|
590 } |
|
591 } |
|
592 } |
|
593 else |
|
594 { |
|
595 return; |
|
596 } |
|
597 |
|
598 } |
|
599 |
|
600 /* |
|
601 ------------------------------------------------------------------------------- |
|
602 |
|
603 Class: CTestExecution |
|
604 |
|
605 Method: DoNotifyMeasurement |
|
606 |
|
607 Description: Handles test measurement operations: NewL, Start and Stop. |
|
608 |
|
609 Parameters: None |
|
610 |
|
611 Return Values: None |
|
612 |
|
613 Errors/Exceptions: None |
|
614 |
|
615 Status: Approved |
|
616 |
|
617 ------------------------------------------------------------------------------- |
|
618 */ |
|
619 TInt CTestExecution::DoNotifyMeasurement() |
|
620 { |
|
621 // Information for this context => information is in this thread's heap: |
|
622 // From CUndertaker::RunL() or CTestModuleContainer::RunL() method can |
|
623 // handle stop and clean operations if these operations are not done |
|
624 // before. |
|
625 // Erronous cases(CUndertaker::RunL will be called) or when test case is |
|
626 // executed(CTestModuleContainer::RunL() will be called) there can handle |
|
627 // test measurement stop and clean operation. |
|
628 |
|
629 if( iTestMeasurement.iMeasurementStruct.iMeasurementOperation == |
|
630 CSTIFTestMeasurement::KMeasurementNew) |
|
631 { |
|
632 // Check that same measurement module don't try to create several times |
|
633 // Only one measurement type per test is allowed |
|
634 for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ ) |
|
635 { |
|
636 if( iMeasurementHandlingArray[i]->iMeasurementModulePtr->MeasurementType() == |
|
637 iTestMeasurement.iMeasurementStruct.iMeasurementType ) |
|
638 { |
|
639 return KErrAlreadyExists; |
|
640 } |
|
641 } |
|
642 |
|
643 TMeasurementHandling* measurementHandling = NULL; |
|
644 measurementHandling = new TMeasurementHandling(); |
|
645 |
|
646 TBuf<KStifMeasurementTypeLength> modulename; |
|
647 if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 1 ) |
|
648 { |
|
649 modulename.Copy( KStifMeasurement01 ); |
|
650 } |
|
651 else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 2 ) |
|
652 { |
|
653 modulename.Copy( KStifMeasurement02 ); |
|
654 } |
|
655 else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 3 ) |
|
656 { |
|
657 modulename.Copy( KStifMeasurement03 ); |
|
658 } |
|
659 else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 4 ) |
|
660 { |
|
661 modulename.Copy( KStifMeasurement04 ); |
|
662 } |
|
663 else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 5 ) |
|
664 { |
|
665 modulename.Copy( KStifMeasurement05 ); |
|
666 } |
|
667 else if( iTestMeasurement.iMeasurementStruct.iMeasurementType == 6 ) |
|
668 { |
|
669 modulename.Copy( KStifMeasurementBappea ); |
|
670 } |
|
671 else |
|
672 { |
|
673 __TRACE( KError, ( _L("CTestExecution::DoNotifyMeasurement(): unknown measurement type" ) ) ); |
|
674 return KErrArgument; |
|
675 } |
|
676 |
|
677 // Loading should work with and without '.dll' extension. |
|
678 TInt r = measurementHandling->iMeasurementModule.Load( modulename ); |
|
679 if ( r != KErrNone ) |
|
680 { |
|
681 __TRACE( KError, ( CStifLogger::EError, _L("Can't load test measurement module[%S], code = %d"), |
|
682 &modulename, r ) ); |
|
683 delete measurementHandling; |
|
684 return KErrNotFound; |
|
685 } |
|
686 else |
|
687 { |
|
688 //Print test measururement module name |
|
689 __TRACE( KInit, ( _L("Loaded test measurement module[%S]"), |
|
690 &modulename ) ); |
|
691 } |
|
692 |
|
693 // Get pointer to first exported function |
|
694 // Verify that there is function |
|
695 measurementHandling->iMeasurementLibEntry = (CTestMeasurementFactory) measurementHandling->iMeasurementModule.Lookup( 1 ); |
|
696 if ( measurementHandling->iMeasurementLibEntry == NULL ) |
|
697 { |
|
698 // New instance can't be created |
|
699 __TRACE( KInit, (_L( "Test measurement module instance cannot create." ) ) ); |
|
700 measurementHandling->iMeasurementModule.Close(); |
|
701 delete measurementHandling; |
|
702 return KErrNotFound; |
|
703 } |
|
704 else |
|
705 { |
|
706 __TRACE ( KInit, ( _L("Pointer to 1st exported received"))); |
|
707 } |
|
708 |
|
709 CSTIFTestMeasurementImplementation* measurement; |
|
710 measurement = NULL; |
|
711 |
|
712 // initialize test measurement module |
|
713 __TRACE ( KVerbose, (_L("Calling 1st exported at 0x%x"), (TUint32) measurementHandling->iMeasurementLibEntry )); |
|
714 TRAPD ( err, measurement = (*measurementHandling->iMeasurementLibEntry)( |
|
715 iTestMeasurement.iMeasurementStruct.iConfigurationInfo, iTestMeasurement.iMeasurementStruct.iMeasurementType ) ); |
|
716 |
|
717 // Handle leave from test module |
|
718 if ( err != KErrNone ) |
|
719 { |
|
720 __TRACE (KError, ( CStifLogger::EError, _L( "Leave when calling 1st exported function, code %d"), err ) ); |
|
721 delete measurementHandling; |
|
722 return err; |
|
723 } |
|
724 else if ( measurementHandling->iMeasurementLibEntry == NULL ) // Handle NULL from test measurement |
|
725 { |
|
726 __TRACE (KError, ( CStifLogger::EError, _L( "NULL pointer received when constructing test measurement module" ) ) ); |
|
727 delete measurementHandling; |
|
728 // Set error codes |
|
729 return KErrNoMemory; |
|
730 } |
|
731 else |
|
732 { |
|
733 measurementHandling->iMeasurementModulePtr = measurement; |
|
734 __TRACE (KInit, (_L("Entrypoint successfully called, Measurement module instance at 0x%x"), |
|
735 (TUint32)measurementHandling->iMeasurementLibEntry ) ); |
|
736 } |
|
737 iMeasurementHandlingArray.Append( measurementHandling ); |
|
738 } // End of NewL operations |
|
739 |
|
740 else if( iTestMeasurement.iMeasurementStruct.iMeasurementOperation == |
|
741 CSTIFTestMeasurement::KMeasurementStart) |
|
742 { |
|
743 for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ ) |
|
744 { |
|
745 if( iMeasurementHandlingArray[i]->iMeasurementModulePtr->MeasurementType() == iTestMeasurement.iMeasurementStruct.iMeasurementType ) |
|
746 { |
|
747 return iMeasurementHandlingArray[i]->iMeasurementModulePtr->Start(); |
|
748 } |
|
749 } |
|
750 |
|
751 } |
|
752 else if( iTestMeasurement.iMeasurementStruct.iMeasurementOperation == |
|
753 CSTIFTestMeasurement::KMeasurementStop) |
|
754 { |
|
755 for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ ) |
|
756 { |
|
757 if( iMeasurementHandlingArray[i]->iMeasurementModulePtr->MeasurementType() == iTestMeasurement.iMeasurementStruct.iMeasurementType ) |
|
758 { |
|
759 TInt stop_ret = iMeasurementHandlingArray[i]->iMeasurementModulePtr->Stop(); |
|
760 delete iMeasurementHandlingArray[i]; |
|
761 iMeasurementHandlingArray.Remove(i); |
|
762 return stop_ret; |
|
763 } |
|
764 } |
|
765 } |
|
766 else |
|
767 { |
|
768 __TRACE (KError, ( CStifLogger::EError, _L("CTestExecution::DoNotifyMeasurement(): Not supported operation") ) ); |
|
769 return KErrNotSupported; |
|
770 } |
|
771 |
|
772 return KErrNone; |
|
773 |
|
774 } |
|
775 |
|
776 /* |
|
777 ------------------------------------------------------------------------------- |
|
778 |
|
779 Class: CTestExecution |
|
780 |
|
781 Method: WritePrint |
|
782 |
|
783 Description: Writes print notification to client memory space. |
|
784 |
|
785 Parameters: const TInt aPriority :in: Priority |
|
786 const TStifInfoName& aDes :in: Description |
|
787 const TName& aBuffer :in: Value |
|
788 |
|
789 Return Values: TInt Return value from message write |
|
790 |
|
791 Errors/Exceptions: None |
|
792 |
|
793 Status: Proposal |
|
794 |
|
795 ------------------------------------------------------------------------------- |
|
796 */ |
|
797 TInt CTestExecution::WritePrint( TTestProgress& aProgress ) |
|
798 { |
|
799 |
|
800 TTestProgressPckg progressPckg( aProgress ); |
|
801 |
|
802 // Write message to client space |
|
803 TRAPD( res, iNotifyPrintMessage.WriteL( 0, progressPckg ) ); |
|
804 |
|
805 iPrintNotifyAvailable = EFalse; |
|
806 |
|
807 // Complete request with possible error code |
|
808 iNotifyPrintMessage.Complete( res ); |
|
809 |
|
810 return res; |
|
811 |
|
812 } |
|
813 |
|
814 /* |
|
815 ------------------------------------------------------------------------------- |
|
816 |
|
817 Class: CTestExecution |
|
818 |
|
819 Method: NotifyEvent |
|
820 |
|
821 Description: Handles event request from engine. |
|
822 |
|
823 ESetEvent and EUnsetEvent change event status. EEnable enables |
|
824 event notify. |
|
825 |
|
826 Parameters: const RMessage& aMessage :in: Message from client. |
|
827 |
|
828 Return Values: None |
|
829 |
|
830 Errors/Exceptions: None |
|
831 |
|
832 Status: Proposal |
|
833 |
|
834 ------------------------------------------------------------------------------- |
|
835 */ |
|
836 TInt CTestExecution::NotifyEvent( const RMessage2& aMessage ) |
|
837 { |
|
838 |
|
839 TEventIf event; |
|
840 TEventIfPckg eventPckg( event ); |
|
841 |
|
842 TRAPD( res, aMessage.ReadL( 0, eventPckg ) ); |
|
843 |
|
844 if( res != KErrNone ) |
|
845 { |
|
846 __TRACE( KError, ( _L( "CTestExecution::NotifyEvent: ReadL failed" ) )); |
|
847 return res; |
|
848 } |
|
849 |
|
850 switch( event.Type() ) |
|
851 { |
|
852 case TEventIf::ESetEvent: |
|
853 { |
|
854 TInt ind = 0; |
|
855 TInt count = iEventArray.Count(); |
|
856 for( ind=0; ind < count; ind++ ) |
|
857 { |
|
858 if( iEventArray[ind]->Name() == event.Name() ) |
|
859 { |
|
860 __TRACE( KMessage, ( _L( "CTestExecution::NotifyEvent(%d): SetEvent %S ( count %i )" ), |
|
861 this, &event.Name(), count ) ); |
|
862 TEventIf::TEventType etype = TEventIf::EIndication; |
|
863 // To get state events working with testcombiner |
|
864 if( ( event.EventType() == TEventIf::EState ) || |
|
865 ( iEventArray[ind]->EventType() == TEventIf::EState ) ) |
|
866 { |
|
867 etype = TEventIf::EState; |
|
868 } |
|
869 iEventArray[ind]->Set( etype ); |
|
870 } |
|
871 } |
|
872 } |
|
873 break; |
|
874 case TEventIf::EUnsetEvent: |
|
875 { |
|
876 return UnsetEvent( event, aMessage ); |
|
877 } |
|
878 case TEventIf::EEnable: |
|
879 { |
|
880 // Store event message |
|
881 iNotifyEventMessage = aMessage; |
|
882 iEventNotifyAvailable = ETrue; |
|
883 TInt errorFromPreviousCmd = aMessage.Int1(); |
|
884 |
|
885 __TRACE( KMessage, ( _L( "CTestExecution::NotifyEvent: enable (%d) notify %d" ), |
|
886 errorFromPreviousCmd, this ) ); |
|
887 |
|
888 // Complete previous Event command |
|
889 CompleteEvent( errorFromPreviousCmd ); |
|
890 iEventHandler->StartL(); |
|
891 |
|
892 // iNotifyEventMessage is completed from DoNotifyEvent |
|
893 return KErrNone; |
|
894 } |
|
895 |
|
896 default: |
|
897 __TRACE( KError, ( _L( "CTestExecution::NotifyEvent: Unknown command %i" ), |
|
898 event.Type() )); |
|
899 return KErrArgument; |
|
900 } |
|
901 |
|
902 __TRACE( KMessage, ( _L( "CTestExecution::NotifyEvent(%d): Done" ), this ) ); |
|
903 |
|
904 aMessage.Complete( KErrNone ); |
|
905 //User::After(1000); //Stif-95 This pause is needed to let Info::TestFrameworkEngine thread |
|
906 //get some processor time and run exactly at this moment (by calling |
|
907 //CTestEventController::EventCallBack). When Stif is focused on the screen, |
|
908 //there is no problem if this line is absent, however when another |
|
909 //application (like screen saver) is focused this is required. |
|
910 return KErrNone; |
|
911 |
|
912 } |
|
913 |
|
914 /* |
|
915 ------------------------------------------------------------------------------- |
|
916 |
|
917 Class: CTestExecution |
|
918 |
|
919 Method: DoNotifyEvent |
|
920 |
|
921 Description: Forward event request. |
|
922 |
|
923 Parameters: None |
|
924 |
|
925 Return Values: None |
|
926 |
|
927 Errors/Exceptions: Panics if event array can't be created |
|
928 |
|
929 Status: Proposal |
|
930 |
|
931 ------------------------------------------------------------------------------- |
|
932 */ |
|
933 TInt CTestExecution::DoNotifyEvent() |
|
934 { |
|
935 |
|
936 TInt ret = KErrNone; |
|
937 |
|
938 switch( iEventDef.iEvent.Type() ) |
|
939 { |
|
940 case TEventIf::EReqEvent: |
|
941 { |
|
942 __TRACE( KMessage, |
|
943 ( _L( "CTestExecution::DoNotifyEvent(%d): ReqEvent %S" ), |
|
944 this, &iEventDef.iEvent.Name() ) ); |
|
945 ret = RequestEvent( iEventDef.iEvent ); |
|
946 // If error, return error, |
|
947 // otherwise proceed with sending information to engine |
|
948 if( ret != KErrNone ) |
|
949 { |
|
950 iEventHandler->StartL(); |
|
951 return ret; |
|
952 } |
|
953 } |
|
954 break; |
|
955 case TEventIf::EWaitEvent: |
|
956 case TEventIf::ESetWaitPending: |
|
957 { |
|
958 __TRACE( KMessage, |
|
959 ( _L( "CTestExecution::DoNotifyEvent(%d): WaitEvent %S" ), |
|
960 this, &iEventDef.iEvent.Name() ) ); |
|
961 // We return from here, i.e. nothing is sent to engine |
|
962 ret = WaitEvent( iEventDef.iEvent, iEventDef.iStatus ); |
|
963 iEventHandler->StartL(); |
|
964 return ret; |
|
965 } |
|
966 // Add state events to internal array |
|
967 case TEventIf::ESetEvent: |
|
968 case TEventIf::EUnsetEvent: |
|
969 { |
|
970 __TRACE( KMessage, |
|
971 ( _L( "CTestExecution::DoNotifyEvent(%d): Set/UnsetEvent %S" ), |
|
972 this, &iEventDef.iEvent.Name() ) ); |
|
973 EventStateChange( iEventDef.iEvent ); |
|
974 } |
|
975 break; |
|
976 case TEventIf::ERelEvent: |
|
977 // This is handled later |
|
978 __TRACE( KMessage, |
|
979 ( _L( "CTestExecution::DoNotifyEvent(%d): RelEvent %S" ), |
|
980 this, &iEventDef.iEvent.Name() ) ); |
|
981 break; |
|
982 default: |
|
983 iEventHandler->StartL(); |
|
984 return KErrArgument; |
|
985 } |
|
986 |
|
987 // Construct message |
|
988 TEventIfPckg eventPckg( iEventDef.iEvent ); |
|
989 |
|
990 // Write message to client space |
|
991 TRAPD( res, iNotifyEventMessage.WriteL( 0, eventPckg ) ); |
|
992 |
|
993 if( res != KErrNone ) |
|
994 { |
|
995 __TRACE( KError, ( _L( "CTestExecution::DoNotifyEvent: WriteL failed" ) ) ); |
|
996 ret = res; |
|
997 } |
|
998 // Complete request |
|
999 // Complete with WriteL result |
|
1000 // MUST be done before ERelEvent |
|
1001 iEventNotifyAvailable = EFalse; |
|
1002 iNotifyEventMessage.Complete( res ); |
|
1003 User::After(1000); //Stif-95 This pause is needed to let Info::TestFrameworkEngine thread |
|
1004 //get some processor time and run exactly at this moment (by calling |
|
1005 //CTestEventNotifier::RunL). When Stif is focused on the screen, |
|
1006 //there is no problem if this line is absent, however when another |
|
1007 //application (like screen saver) is focused this is required. |
|
1008 |
|
1009 if( iEventDef.iEvent.Type() == TEventIf::ERelEvent ) |
|
1010 { |
|
1011 ret = ReleaseEvent( iEventDef.iEvent ); |
|
1012 if( ret != KErrNone ) |
|
1013 { |
|
1014 // If error, return immediately |
|
1015 return ret; |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 __TRACE( KMessage, ( _L( "CTestExecution::DoNotifyEvent(%d): Done" ), this ) ); |
|
1020 |
|
1021 return ret; |
|
1022 |
|
1023 } |
|
1024 |
|
1025 /* |
|
1026 ------------------------------------------------------------------------------- |
|
1027 |
|
1028 Class: CTestExecution |
|
1029 |
|
1030 Method: RequestEvent |
|
1031 |
|
1032 Description: Handles TestModule event requests. |
|
1033 |
|
1034 Parameters: const TEventIf& aEvent: in: Event requested |
|
1035 |
|
1036 Return Values: TInt: Success/Error code |
|
1037 |
|
1038 Errors/Exceptions: None |
|
1039 |
|
1040 Status: Proposal |
|
1041 |
|
1042 ------------------------------------------------------------------------------- |
|
1043 */ |
|
1044 TInt CTestExecution::RequestEvent( TEventIf& aEvent ) |
|
1045 { |
|
1046 |
|
1047 // Requested events are added to iEventArray |
|
1048 // There can be multiple simultaneous requests for the same event |
|
1049 TEvent* event = new TEvent( iTestThreadId ); |
|
1050 if( !event ) |
|
1051 { |
|
1052 return KErrNoMemory; |
|
1053 } |
|
1054 event->Copy( aEvent ); |
|
1055 if( iEventArray.Append( event ) != KErrNone ) |
|
1056 { |
|
1057 delete event; |
|
1058 return KErrNoMemory; |
|
1059 } |
|
1060 |
|
1061 __TRACE( KMessage,( _L( "CTestExecution::DoNotifyEvent: Req added %S ( count %i )" ), |
|
1062 &aEvent.Name(), iEventArray.Count() )); |
|
1063 |
|
1064 return KErrNone; |
|
1065 } |
|
1066 |
|
1067 /* |
|
1068 ------------------------------------------------------------------------------- |
|
1069 |
|
1070 Class: CTestExecution |
|
1071 |
|
1072 Method: WaitEvent |
|
1073 |
|
1074 Description: Handles TestModule event waits. Waiting is implemented here |
|
1075 and completed in NotifyEvent |
|
1076 |
|
1077 |
|
1078 Parameters: const TEventIf& aEvent: in: Event wait |
|
1079 |
|
1080 Return Values: TInt: Success/Error code |
|
1081 |
|
1082 Errors/Exceptions: None |
|
1083 |
|
1084 Status: Proposal |
|
1085 |
|
1086 ------------------------------------------------------------------------------- |
|
1087 */ |
|
1088 TInt CTestExecution::WaitEvent( TEventIf& aEvent, TRequestStatus* aStatus ) |
|
1089 { |
|
1090 |
|
1091 // Get first "free" event entry from requested events |
|
1092 TInt ind = 0; |
|
1093 TInt count = iEventArray.Count(); |
|
1094 TEvent* event = NULL; |
|
1095 for( ind=0; ind < count; ind++ ) |
|
1096 { |
|
1097 if( ( iEventArray[ind]->Name() == aEvent.Name() ) && |
|
1098 ( iEventArray[ind]->WaitEventPending() == EFalse ) ) |
|
1099 { |
|
1100 // Found event with correct name and one that is still free |
|
1101 // i.e. nobody is waiting for it. |
|
1102 event = iEventArray[ind]; |
|
1103 if( aEvent.Type() == TEventIf::EWaitEvent ) |
|
1104 { |
|
1105 // For EWaitEvent we complete immediately if event is pending |
|
1106 if( event->EventPending() ) |
|
1107 { |
|
1108 // Event was already pending, so we may return immediately |
|
1109 if( aStatus ) |
|
1110 { |
|
1111 TestThreadRequestComplete( aStatus, KErrNone ); |
|
1112 } |
|
1113 return KErrNone; |
|
1114 } |
|
1115 } |
|
1116 } |
|
1117 } |
|
1118 if( event == NULL ) |
|
1119 { |
|
1120 // Event is not in the iEventArray, |
|
1121 // so event is not currently requested |
|
1122 return KErrNotFound; |
|
1123 } |
|
1124 |
|
1125 __TRACE( KMessage,( _L( "CTestExecution::DoNotifyEvent: Waiting %S ( count %i )" ), |
|
1126 &aEvent.Name(), count )); |
|
1127 |
|
1128 // Event is not pending so we have to wait for it |
|
1129 // Set wait pending |
|
1130 TInt ret = event->SetWaitPending( aStatus ); |
|
1131 // event cannot be freed by the test module, |
|
1132 // because it is waiting the event, |
|
1133 |
|
1134 if( ( aStatus == NULL ) && |
|
1135 ( ret == KErrNone ) && |
|
1136 ( aEvent.Type() == TEventIf::EWaitEvent ) ) |
|
1137 { |
|
1138 // This is synchronous wait |
|
1139 // Go waiting, completed from set event |
|
1140 event->Wait(); |
|
1141 } |
|
1142 |
|
1143 return ret; |
|
1144 |
|
1145 } |
|
1146 |
|
1147 /* |
|
1148 ------------------------------------------------------------------------------- |
|
1149 |
|
1150 Class: CTestExecution |
|
1151 |
|
1152 Method: ReleaseEvent |
|
1153 |
|
1154 Description: Handles TestModule event releases. |
|
1155 |
|
1156 Parameters: const TEventIf& aEvent: in: Event released |
|
1157 |
|
1158 Return Values: TInt: Success/Error code |
|
1159 |
|
1160 Errors/Exceptions: None |
|
1161 |
|
1162 Status: Proposal |
|
1163 |
|
1164 ------------------------------------------------------------------------------- |
|
1165 */ |
|
1166 TInt CTestExecution::ReleaseEvent( TEventIf& aEvent ) |
|
1167 { |
|
1168 |
|
1169 // Get last event entry from requested events |
|
1170 TInt ind = 0; |
|
1171 TInt freeFound = 0; |
|
1172 TInt eventIndex = 0; |
|
1173 TInt count = iEventArray.Count(); |
|
1174 for( ind=0; ind < count; ind++ ) |
|
1175 { |
|
1176 if( iEventArray[ind]->Name() == aEvent.Name() ) |
|
1177 { |
|
1178 if( iEventArray[ind]->WaitEventPending() == EFalse ) |
|
1179 { |
|
1180 freeFound++; |
|
1181 eventIndex = ind; |
|
1182 } |
|
1183 } |
|
1184 } |
|
1185 |
|
1186 if( freeFound == 0 ) |
|
1187 { |
|
1188 return KErrNotFound; |
|
1189 } |
|
1190 __TRACE( KMessage,( |
|
1191 _L( "CTestExecution::DoNotifyEvent: Release event %S ( count %i )" ), |
|
1192 &aEvent.Name(), iEventArray.Count() )); |
|
1193 |
|
1194 TEvent* event = iEventArray[eventIndex]; |
|
1195 iEventArray.Remove( eventIndex ); |
|
1196 // Release and free event entry |
|
1197 event->Release(); |
|
1198 |
|
1199 // Delete used event entry |
|
1200 delete event; |
|
1201 |
|
1202 return KErrNone; |
|
1203 } |
|
1204 |
|
1205 /* |
|
1206 ------------------------------------------------------------------------------- |
|
1207 |
|
1208 Class: CTestExecution |
|
1209 |
|
1210 Method: UnsetEvent |
|
1211 |
|
1212 Description: Handles TestModule event unsets. |
|
1213 |
|
1214 Parameters: const TEventIf& aEvent: in: Event unset |
|
1215 |
|
1216 Return Values: TInt: Success/Error code |
|
1217 |
|
1218 Errors/Exceptions: None |
|
1219 |
|
1220 Status: Proposal |
|
1221 |
|
1222 ------------------------------------------------------------------------------- |
|
1223 */ |
|
1224 TInt CTestExecution::UnsetEvent( TEventIf& aEvent, const RMessage2& aMessage ) |
|
1225 { |
|
1226 |
|
1227 TInt ret = KErrNone; |
|
1228 TInt ind = 0; |
|
1229 TInt count = iEventArray.Count(); |
|
1230 TBool activeEventReq = EFalse; |
|
1231 for( ind=0; ind < count; ind++ ) |
|
1232 { |
|
1233 if( iEventArray[ind]->Name() == aEvent.Name() ) |
|
1234 { |
|
1235 __TRACE( KMessage, ( |
|
1236 _L( "CTestExecution::NotifyEvent(%d): UnsetEvent %S ( count %i )" ), |
|
1237 this, &aEvent.Name(), count ) ); |
|
1238 |
|
1239 ret = iEventArray[ind]->Unset( aMessage, this ); |
|
1240 if( ret == KErrNone ) |
|
1241 { |
|
1242 activeEventReq = ETrue; |
|
1243 } |
|
1244 break; |
|
1245 } |
|
1246 } |
|
1247 if( activeEventReq ) |
|
1248 { |
|
1249 // Unset is completed by release |
|
1250 return KErrNone; |
|
1251 } |
|
1252 |
|
1253 // No pending requests or error from unset |
|
1254 aMessage.Complete( ret ); |
|
1255 |
|
1256 return KErrNone; |
|
1257 |
|
1258 } |
|
1259 |
|
1260 /* |
|
1261 ------------------------------------------------------------------------------- |
|
1262 |
|
1263 Class: CTestExecution |
|
1264 |
|
1265 Method: EventStateChange |
|
1266 |
|
1267 Description: Handles event setting and unsetting. Saves status of |
|
1268 state events to enable unsetting of set state events when |
|
1269 killing the testcase abnormally. |
|
1270 |
|
1271 Parameters: const TEventIf& aEvent: in: Event set/unset |
|
1272 |
|
1273 Return Values: TInt: Success/Error code |
|
1274 |
|
1275 Errors/Exceptions: None |
|
1276 |
|
1277 Status: Proposal |
|
1278 |
|
1279 ------------------------------------------------------------------------------- |
|
1280 */ |
|
1281 TInt CTestExecution::EventStateChange( TEventIf& aEvent ) |
|
1282 { |
|
1283 |
|
1284 TInt ret = KErrNotFound; |
|
1285 if( aEvent.EventType() == TEventIf::EState ) |
|
1286 { |
|
1287 |
|
1288 TInt count = iStateEvents.Count(); |
|
1289 TInt index = 0; |
|
1290 for(; index < count; index++ ) |
|
1291 { |
|
1292 TPtrC name = *(iStateEvents[index]); |
|
1293 if( name == aEvent.Name() ) |
|
1294 { |
|
1295 break; |
|
1296 } |
|
1297 } |
|
1298 |
|
1299 |
|
1300 if( aEvent.Type() == TEventIf::ESetEvent ) |
|
1301 { |
|
1302 if( index < count ) |
|
1303 { |
|
1304 ret = KErrAlreadyExists; |
|
1305 } |
|
1306 else |
|
1307 { |
|
1308 // add event to iStateEvents |
|
1309 HBufC* name = aEvent.Name().Alloc(); |
|
1310 if( name == NULL ) |
|
1311 { |
|
1312 ret = KErrNoMemory; |
|
1313 } |
|
1314 else if( iStateEvents.Append( name ) != KErrNone ) |
|
1315 { |
|
1316 delete name; |
|
1317 ret = KErrNoMemory; |
|
1318 } |
|
1319 else |
|
1320 { |
|
1321 ret = KErrNone; |
|
1322 } |
|
1323 } |
|
1324 } |
|
1325 else if( aEvent.Type() == TEventIf::EUnsetEvent ) |
|
1326 { |
|
1327 if( index == count ) |
|
1328 { |
|
1329 ret = KErrNotFound; |
|
1330 } |
|
1331 else |
|
1332 { |
|
1333 ret = KErrNone; |
|
1334 delete iStateEvents[index]; |
|
1335 iStateEvents.Remove( index ); |
|
1336 } |
|
1337 } |
|
1338 } |
|
1339 |
|
1340 return ret; |
|
1341 |
|
1342 } |
|
1343 /* |
|
1344 ------------------------------------------------------------------------------- |
|
1345 |
|
1346 Class: CTestExecution |
|
1347 |
|
1348 Method: CancelEvent |
|
1349 |
|
1350 Description: Cancels pending event request. |
|
1351 |
|
1352 Parameters: None |
|
1353 |
|
1354 Return Values: None |
|
1355 |
|
1356 Errors/Exceptions: None |
|
1357 |
|
1358 Status: Proposal |
|
1359 |
|
1360 ------------------------------------------------------------------------------- |
|
1361 */ |
|
1362 void CTestExecution::CancelEvent() |
|
1363 { |
|
1364 |
|
1365 TInt ret = KErrNotFound; |
|
1366 |
|
1367 __TRACE( KMessage, ( _L( "CTestThreadContainer::CancelEvent(%d): %S [%p]" ), |
|
1368 iEventDef.iEvent.Type(), &iEventDef.iEvent.Name(), iEventDef.iStatus ) ); |
|
1369 |
|
1370 switch( iEventDef.iEvent.Type() ) |
|
1371 { |
|
1372 case TEventIf::EReqEvent: |
|
1373 case TEventIf::ERelEvent: |
|
1374 case TEventIf::ESetEvent: |
|
1375 case TEventIf::EUnsetEvent: |
|
1376 CompleteEvent( KErrCancel ); |
|
1377 break; |
|
1378 case TEventIf::EWaitEvent: |
|
1379 case TEventIf::ESetWaitPending: |
|
1380 { |
|
1381 // Get waited event entry from requested events |
|
1382 TInt ind = 0; |
|
1383 TInt count = iEventArray.Count(); |
|
1384 for( ind=0; ind < count; ind++ ) |
|
1385 { |
|
1386 if( ( iEventArray[ind]->Name() == iEventDef.iEvent.Name() ) && |
|
1387 ( iEventArray[ind]->WaitEventPending() != EFalse ) && |
|
1388 ( iEventArray[ind]->RequestStatus() == iEventDef.iStatus ) ) |
|
1389 { |
|
1390 TEvent* event = iEventArray[ind]; |
|
1391 // Found event with correct name and one that is waited. |
|
1392 event->CompletePendingWait( KErrCancel ); |
|
1393 ret = KErrNone; |
|
1394 break; |
|
1395 } |
|
1396 } |
|
1397 if( ret != KErrNone ) |
|
1398 { |
|
1399 // Request has been already completed, not handled |
|
1400 // by ActiveScheduler yet. |
|
1401 // DoCancel will do the job, don't worry. |
|
1402 __TRACE( KError, ( _L( "CTestThreadContainer::CancelEvent(%d): %S, not found 2" ), |
|
1403 iEventDef.iEvent.Type(), &iEventDef.iEvent.Name() ) ); |
|
1404 } |
|
1405 } |
|
1406 break; |
|
1407 default: |
|
1408 CTestServer::PanicServer( EUnknownEventCmd ); |
|
1409 break; |
|
1410 } |
|
1411 |
|
1412 // Synchonize |
|
1413 iEventHandler->StartL(); |
|
1414 |
|
1415 } |
|
1416 |
|
1417 /* |
|
1418 ------------------------------------------------------------------------------- |
|
1419 |
|
1420 Class: CTestExecution |
|
1421 |
|
1422 Method: NotifyRemoteCmd |
|
1423 |
|
1424 Description: Handles the first phase of the RemoteCmd request from engine. |
|
1425 |
|
1426 Parameters: const RMessage& aMessage: in: Message from client. |
|
1427 |
|
1428 Return Values: Symbian OS error code. |
|
1429 |
|
1430 Errors/Exceptions: None |
|
1431 |
|
1432 Status: Proposal |
|
1433 |
|
1434 ------------------------------------------------------------------------------- |
|
1435 */ |
|
1436 TInt CTestExecution::NotifyRemoteCmd( const RMessage2& aMessage ) |
|
1437 { |
|
1438 |
|
1439 // Store RemoteCmd message |
|
1440 // and the length buffer address |
|
1441 iNotifyRemoteCmdMessage = aMessage; |
|
1442 iRemoteSendAvailable = ETrue; |
|
1443 iSndHandler->StartL(); |
|
1444 |
|
1445 return KErrNone; |
|
1446 |
|
1447 } |
|
1448 |
|
1449 /* |
|
1450 ------------------------------------------------------------------------------- |
|
1451 |
|
1452 Class: CTestExecution |
|
1453 |
|
1454 Method: DoRemoteReceive |
|
1455 |
|
1456 Description: Enable remote receive. |
|
1457 |
|
1458 Parameters: None |
|
1459 |
|
1460 Return Values: None |
|
1461 |
|
1462 Errors/Exceptions: None |
|
1463 |
|
1464 Status: Proposal |
|
1465 |
|
1466 ------------------------------------------------------------------------------- |
|
1467 */ |
|
1468 void CTestExecution::DoRemoteReceive() |
|
1469 { |
|
1470 |
|
1471 switch( iRcvCmdDef.iCommand ) |
|
1472 { |
|
1473 case EStifCmdReceive: // "Receive" |
|
1474 { |
|
1475 // @js If there's pointer in array, we'll send it down |
|
1476 if(iMessageQueue.Count() > 0) |
|
1477 { |
|
1478 HBufC8 * buf = iMessageQueue[0]; |
|
1479 iRcvCmdDef.iParam.aRemoteMsgRef->Copy( iMessageQueue[0]->Des() ); |
|
1480 iMessageQueue.Remove(0); |
|
1481 delete buf; |
|
1482 __TRACE( KMessage, |
|
1483 (_L("CTestExecution::ReadRemoteCmdInfo: complete receive 0x%x"), |
|
1484 iRcvCmdDef.iStatus )); |
|
1485 |
|
1486 // calls the TestCombiner's CRemoteReceiver::RunL() |
|
1487 TestThreadRequestComplete( iRcvCmdDef.iStatus, KErrNone ); |
|
1488 } |
|
1489 else |
|
1490 { |
|
1491 iRemoteReceiveAvailable = ETrue; |
|
1492 } |
|
1493 |
|
1494 break; |
|
1495 } |
|
1496 case EStifCmdReceiveCancel: |
|
1497 if( iRemoteReceiveAvailable ) |
|
1498 { |
|
1499 iRemoteReceiveAvailable = EFalse; |
|
1500 TestThreadRequestComplete( iRcvCmdDef.iStatus, KErrCancel ); |
|
1501 } |
|
1502 break; |
|
1503 default: |
|
1504 CTestServer::PanicServer( EUnknownRemoteCmd ); |
|
1505 break; |
|
1506 } |
|
1507 // Signal test thread |
|
1508 iRcvHandler->StartL(); |
|
1509 |
|
1510 } |
|
1511 |
|
1512 /* |
|
1513 ------------------------------------------------------------------------------- |
|
1514 |
|
1515 Class: CTestExecution |
|
1516 |
|
1517 Method: DoRemoteSend |
|
1518 |
|
1519 Description: Send remote messages. |
|
1520 |
|
1521 Parameters: None |
|
1522 |
|
1523 Return Values: None |
|
1524 |
|
1525 Errors/Exceptions: None |
|
1526 |
|
1527 Status: Approved |
|
1528 |
|
1529 ------------------------------------------------------------------------------- |
|
1530 */ |
|
1531 void CTestExecution::DoRemoteSend() |
|
1532 { |
|
1533 switch( iCmdDef.iCommand ) |
|
1534 { |
|
1535 case EStifCmdSend: // "Send" |
|
1536 case EStifCmdReboot: // "Send" |
|
1537 case EStifCmdStoreState: // "Send" |
|
1538 case EStifCmdGetStoredState: // "Receive, this must be done with two phase" |
|
1539 case EStifCmdMeasurement: // "Receive, this must be done with two phase" |
|
1540 { |
|
1541 if( iRemoteSendAvailable ) |
|
1542 { |
|
1543 TInt ret = KErrNone; |
|
1544 TPckg<TStifCommand> remoteCommandPckg( iCmdDef.iCommand ); |
|
1545 |
|
1546 // Start first phase of the writing message to client space |
|
1547 TRAP( ret, |
|
1548 iNotifyRemoteCmdMessage.WriteL( 0, remoteCommandPckg ) ); |
|
1549 |
|
1550 if( ret != KErrNone ) |
|
1551 { |
|
1552 __TRACE( KError, ( _L( "CTestExecution::DoRemoteSend: WriteL failed" ) ) ); |
|
1553 } |
|
1554 TPckg<TInt> lenPckg( iCmdDef.iLen ); |
|
1555 |
|
1556 TRAP( ret, |
|
1557 iNotifyRemoteCmdMessage.WriteL( 1, lenPckg ) ); |
|
1558 |
|
1559 if( ret != KErrNone ) |
|
1560 { |
|
1561 __TRACE( KError, ( _L( "CTestExecution::DoRemoteSend: WriteL failed" ) ) ); |
|
1562 } |
|
1563 |
|
1564 // Complete request |
|
1565 // Complete with WriteL result |
|
1566 // CTestRemoteCmdNotifier::RunL() will called |
|
1567 iRemoteSendAvailable = EFalse; |
|
1568 iNotifyRemoteCmdMessage.Complete( ret ); |
|
1569 break; |
|
1570 } |
|
1571 } |
|
1572 TestThreadRequestComplete( iCmdDef.iStatus, KErrNotSupported ); |
|
1573 break; |
|
1574 default: |
|
1575 CTestServer::PanicServer( EUnknownRemoteCmd ); |
|
1576 break; |
|
1577 } |
|
1578 |
|
1579 } |
|
1580 |
|
1581 |
|
1582 /* |
|
1583 ------------------------------------------------------------------------------- |
|
1584 |
|
1585 Class: CTestExecution |
|
1586 |
|
1587 Method: ReadRemoteCmdInfo |
|
1588 |
|
1589 Description: Handles the second phase of the RemoteCmd request from engine. |
|
1590 |
|
1591 Parameters: const RMessage& aMessage: in: Message from client. |
|
1592 |
|
1593 Return Values: Symbian OS error code. |
|
1594 |
|
1595 Errors/Exceptions: None |
|
1596 |
|
1597 Status: Proposal |
|
1598 |
|
1599 ------------------------------------------------------------------------------- |
|
1600 */ |
|
1601 TInt CTestExecution::ReadRemoteCmdInfo( const RMessage2& aMessage ) |
|
1602 { |
|
1603 |
|
1604 TInt ret( KErrNone ); |
|
1605 TInt completeSend = EFalse; |
|
1606 TInt returnedErrorCode = KErrNone; |
|
1607 TInt len = 0; |
|
1608 TInt value( aMessage.Int2() ); |
|
1609 if( value < 0 ) |
|
1610 { |
|
1611 returnedErrorCode = value; |
|
1612 } |
|
1613 else |
|
1614 { |
|
1615 len = value; |
|
1616 } |
|
1617 |
|
1618 switch( aMessage.Int1() ) |
|
1619 { |
|
1620 case EStifCmdReceive: // "Receive" |
|
1621 { |
|
1622 |
|
1623 if( len <= 0 ) |
|
1624 { |
|
1625 __TRACE( KError, |
|
1626 (_L("CTestExecution::ReadRemoteCmdInfo: empty message"))); |
|
1627 ret = KErrGeneral; |
|
1628 break; |
|
1629 } |
|
1630 if( iRcvCmdDef.iParam.aRemoteMsgRef->MaxLength() < len ) |
|
1631 { |
|
1632 __TRACE( KError, |
|
1633 (_L("CTestExecution::ReadRemoteCmdInfo: message overflow"))); |
|
1634 ret = KErrGeneral; |
|
1635 break; |
|
1636 } |
|
1637 |
|
1638 HBufC8* buf = HBufC8::New( len ); |
|
1639 if( buf == NULL ) |
|
1640 { |
|
1641 ret = KErrNoMemory; |
|
1642 break; |
|
1643 } |
|
1644 TPtr8 tmp = buf->Des(); |
|
1645 // Read message from client space |
|
1646 TRAP( ret, aMessage.ReadL( 0, tmp ) ); |
|
1647 |
|
1648 |
|
1649 if( ret != KErrNone ) |
|
1650 { |
|
1651 __TRACE( KError, |
|
1652 (_L("CTestExecution::ReadRemoteCmdInfo: ReadL failed"))); |
|
1653 break; |
|
1654 } |
|
1655 |
|
1656 if( iRemoteReceiveAvailable ) |
|
1657 // @js Checking moved here |
|
1658 { |
|
1659 iRcvCmdDef.iParam.aRemoteMsgRef->Copy( buf->Des() ); |
|
1660 delete buf; |
|
1661 |
|
1662 __TRACE( KMessage, |
|
1663 (_L("CTestExecution::ReadRemoteCmdInfo: complete receive 0x%x"), |
|
1664 iRcvCmdDef.iStatus )); |
|
1665 // calls the TestCombiner's CRemoteReceiver::RunL() |
|
1666 TestThreadRequestComplete( iRcvCmdDef.iStatus, ret ); |
|
1667 |
|
1668 iRemoteReceiveAvailable = EFalse; |
|
1669 } |
|
1670 else |
|
1671 // @js Adding buf to RPointerArray, handling it in DoRemoteReceive function |
|
1672 { |
|
1673 iMessageQueue.Append( buf ); |
|
1674 } |
|
1675 |
|
1676 break; |
|
1677 } |
|
1678 case EStifCmdSend: // "Send" |
|
1679 { |
|
1680 HBufC8* buf = HBufC8::New( iCmdDef.iParam.aRemoteMsgConstRef->Length() ); |
|
1681 if( buf == NULL ) |
|
1682 { |
|
1683 ret = KErrNoMemory; |
|
1684 break; |
|
1685 } |
|
1686 TPtr8 tmp = buf->Des(); |
|
1687 tmp.Copy( *iCmdDef.iParam.aRemoteMsgConstRef ); |
|
1688 // Second phase of the writing. Write information to the Engine. |
|
1689 TRAP( ret, aMessage.WriteL( 0, tmp ) ); |
|
1690 |
|
1691 delete buf; |
|
1692 |
|
1693 if( ret != KErrNone ) |
|
1694 { |
|
1695 __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: WriteL failed" ) ) ); |
|
1696 } |
|
1697 completeSend = ETrue; |
|
1698 break; |
|
1699 } |
|
1700 case EStifCmdReboot: // "Send" |
|
1701 { |
|
1702 TRebootParamsPckg remoteTypePckg( *iCmdDef.iParam.aRebootType ); |
|
1703 |
|
1704 // Second phase of the writing. Write information to the Engine. |
|
1705 TRAP( ret, aMessage.WriteL( 0, remoteTypePckg ) ); |
|
1706 |
|
1707 if( ret != KErrNone ) |
|
1708 { |
|
1709 __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: WriteL failed" ) ) ); |
|
1710 } |
|
1711 // Because Reboot must block...Don't complete, so now we wait for |
|
1712 // ever phone booting operation !!!!! |
|
1713 break; |
|
1714 } |
|
1715 case EStifCmdStoreState: // "Send" |
|
1716 { |
|
1717 TRebootStateParamsPckg remoteStatePckg( *iCmdDef.iParam.aRebootState ); |
|
1718 |
|
1719 // Second phase of the writing. Write information to the Engine. |
|
1720 TRAP( ret, aMessage.WriteL( 0, remoteStatePckg ) ); |
|
1721 |
|
1722 if( ret != KErrNone ) |
|
1723 { |
|
1724 __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: WriteL failed" ) ) ); |
|
1725 } |
|
1726 // Completed from EStifCmdRebootProceed |
|
1727 break; |
|
1728 } |
|
1729 case EStifCmdMeasurement: // "Receive" |
|
1730 { |
|
1731 TGetMeasurementOptions getMeasurementOptions; |
|
1732 TGetMeasurementOptionsPckg measurementParamsPckg( getMeasurementOptions ); |
|
1733 |
|
1734 // Read message from client space |
|
1735 TRAP( ret, aMessage.ReadL( 0, measurementParamsPckg ) ); |
|
1736 |
|
1737 if( ret != KErrNone ) |
|
1738 { |
|
1739 __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: ReadL failed" ) ) ); |
|
1740 } |
|
1741 iCmdDef.iParam.aMeasurementOption->iOptions = getMeasurementOptions.iOptions; |
|
1742 |
|
1743 completeSend = ETrue; |
|
1744 break; |
|
1745 } |
|
1746 case EStifCmdGetStoredState: // "Receive" |
|
1747 { |
|
1748 TGetRebootStoredParams getRebootStoredParams; |
|
1749 TGetRebootStoredParamsPckg rebootStoredParamsPckg( getRebootStoredParams ); |
|
1750 |
|
1751 // Read message from client space |
|
1752 TRAP( ret, aMessage.ReadL( 0, rebootStoredParamsPckg ) ); |
|
1753 |
|
1754 if( ret != KErrNone ) |
|
1755 { |
|
1756 __TRACE( KError, ( _L( "CTestExecution::ReadRemoteCmdInfo: ReadL failed" ) ) ); |
|
1757 } |
|
1758 iCmdDef.iParam.aRebootStoredRef->iCode = getRebootStoredParams.aCode; |
|
1759 iCmdDef.iParam.aRebootStoredRef->iName = getRebootStoredParams.aName; |
|
1760 |
|
1761 completeSend = ETrue; |
|
1762 break; |
|
1763 } |
|
1764 case EStifCmdRebootProceed: |
|
1765 { |
|
1766 completeSend = ETrue; // Complete EStifCmdStoreState |
|
1767 } |
|
1768 break; |
|
1769 default: |
|
1770 { |
|
1771 iModuleSession->PanicClient( EUnknownRemoteCmd, aMessage ); |
|
1772 break; |
|
1773 } |
|
1774 } |
|
1775 // Complete request with ret |
|
1776 aMessage.Complete( ret ); |
|
1777 |
|
1778 if( completeSend ) |
|
1779 { |
|
1780 // Calls the TestCombiner's CRemoteReceiver::RunL() and |
|
1781 // returns error code to test module. |
|
1782 TestThreadRequestComplete( iCmdDef.iStatus, returnedErrorCode ); |
|
1783 } |
|
1784 |
|
1785 return KErrNone; |
|
1786 |
|
1787 } |
|
1788 |
|
1789 /* |
|
1790 ------------------------------------------------------------------------------- |
|
1791 |
|
1792 Class: CTestExecution |
|
1793 |
|
1794 Method: Pause |
|
1795 |
|
1796 Description: Pauses a test case |
|
1797 |
|
1798 Only ongoing tests can be paused. If test is not ongoing, then |
|
1799 function does nothing. |
|
1800 |
|
1801 Parameters: const RMessage& aMessage :in: Message from client. |
|
1802 |
|
1803 Return Values: TInt Always KErrNone |
|
1804 |
|
1805 Errors/Exceptions: None |
|
1806 |
|
1807 Status: Proposal |
|
1808 |
|
1809 ------------------------------------------------------------------------------- |
|
1810 */ |
|
1811 TInt CTestExecution::Pause( const RMessage2& aMessage ) |
|
1812 { |
|
1813 |
|
1814 __TRACE ( KThreadOperation, ( _L( "CTestExecution::Pause" ) ) ); |
|
1815 |
|
1816 TInt completionCode = KErrNone; |
|
1817 |
|
1818 // Note that it is allowed to suspend already suspended thread, so |
|
1819 // there is no need for states to verify that thread is really in |
|
1820 // resumed state. |
|
1821 switch ( iThreadState ) |
|
1822 { |
|
1823 case EOnGoing: |
|
1824 completionCode = iModuleContainer->PauseThread(); |
|
1825 break; |
|
1826 |
|
1827 case ENotStarted: |
|
1828 completionCode = KErrNotReady; |
|
1829 break; |
|
1830 |
|
1831 case EFinished: |
|
1832 case ECancelled: |
|
1833 completionCode = KErrCompletion; |
|
1834 break; |
|
1835 |
|
1836 default: |
|
1837 CTestServer::PanicServer( EInvalidThreadState ); |
|
1838 break; |
|
1839 } |
|
1840 |
|
1841 |
|
1842 // Complete the request |
|
1843 aMessage.Complete( completionCode ); |
|
1844 |
|
1845 return KErrNone; |
|
1846 |
|
1847 } |
|
1848 |
|
1849 |
|
1850 /* |
|
1851 ------------------------------------------------------------------------------- |
|
1852 |
|
1853 Class: CTestExecution |
|
1854 |
|
1855 Method: Resume |
|
1856 |
|
1857 Description: Resumes a test case. If test is not ongoing, |
|
1858 then do not resume. |
|
1859 |
|
1860 Parameters: const RMessage& aMessage :in: Message from client. |
|
1861 |
|
1862 Return Values: TInt Always KErrNone |
|
1863 |
|
1864 Errors/Exceptions: None |
|
1865 |
|
1866 Status: Proposal |
|
1867 |
|
1868 ------------------------------------------------------------------------------- |
|
1869 */ |
|
1870 TInt CTestExecution::Resume( const RMessage2& aMessage ) |
|
1871 { |
|
1872 |
|
1873 __TRACE ( KThreadOperation, ( _L( "CTestExecution::Resume" ) ) ); |
|
1874 |
|
1875 TInt completionCode = KErrNone; |
|
1876 |
|
1877 // Note that it is allowed to resume already resumed thread, so |
|
1878 // there is no need for states to verify that thread is really in |
|
1879 // suspended state. |
|
1880 switch ( iThreadState ) |
|
1881 { |
|
1882 case EOnGoing: |
|
1883 completionCode = iModuleContainer->ResumeThread(); |
|
1884 break; |
|
1885 |
|
1886 case ENotStarted: |
|
1887 completionCode = KErrNotReady; |
|
1888 break; |
|
1889 |
|
1890 case EFinished: |
|
1891 case ECancelled: |
|
1892 completionCode = KErrCompletion; |
|
1893 break; |
|
1894 |
|
1895 default: |
|
1896 CTestServer::PanicServer( EInvalidThreadState ); |
|
1897 break; |
|
1898 } |
|
1899 |
|
1900 |
|
1901 // Complete the request |
|
1902 aMessage.Complete( completionCode ); |
|
1903 |
|
1904 return KErrNone; |
|
1905 |
|
1906 } |
|
1907 |
|
1908 /* |
|
1909 ------------------------------------------------------------------------------- |
|
1910 |
|
1911 Class: CTestExecution |
|
1912 |
|
1913 Method: CloseTestExecution |
|
1914 |
|
1915 Description: Closes Test Execution subsession |
|
1916 |
|
1917 Parameters: const RMessage& aMessage :in: Message from client. |
|
1918 |
|
1919 Return Values: TInt Always KErrNone |
|
1920 |
|
1921 Errors/Exceptions: None |
|
1922 |
|
1923 Status: Proposal |
|
1924 |
|
1925 ------------------------------------------------------------------------------- |
|
1926 */ |
|
1927 TInt CTestExecution::CloseTestExecution( const RMessage2& aMessage ) |
|
1928 { |
|
1929 |
|
1930 // Cancel test request |
|
1931 CancelTestRequest(); |
|
1932 |
|
1933 // Cancel print request |
|
1934 CancelPrintRequest(); |
|
1935 |
|
1936 // Cancel event request |
|
1937 CancelEventRequest(); |
|
1938 |
|
1939 // Delete this subsession |
|
1940 const TUint subsession = aMessage.Int3(); |
|
1941 iModuleSession->DeleteTestExecution( subsession, aMessage ); |
|
1942 |
|
1943 // Complete the request |
|
1944 aMessage.Complete( KErrNone ); |
|
1945 |
|
1946 return KErrNone; |
|
1947 |
|
1948 } |
|
1949 |
|
1950 |
|
1951 /* |
|
1952 ------------------------------------------------------------------------------- |
|
1953 |
|
1954 Class: CTestExecution |
|
1955 |
|
1956 Method: CancelPrintRequest |
|
1957 |
|
1958 Description: Cancel print request. Completes ongoing print request |
|
1959 with KErrCancel. |
|
1960 |
|
1961 Parameters: None |
|
1962 |
|
1963 Return Values: TInt Always KErrNone |
|
1964 |
|
1965 Errors/Exceptions: None |
|
1966 |
|
1967 Status: Proposal |
|
1968 |
|
1969 ------------------------------------------------------------------------------- |
|
1970 */ |
|
1971 TInt CTestExecution::CancelPrintRequest() |
|
1972 { |
|
1973 |
|
1974 if ( iPrintNotifyAvailable ) |
|
1975 { |
|
1976 iPrintHandler->Cancel(); |
|
1977 |
|
1978 iPrintNotifyAvailable = EFalse; |
|
1979 iNotifyPrintMessage.Complete ( KErrCancel ); |
|
1980 //@spe iPrintNotifyAvailable = EFalse; |
|
1981 } |
|
1982 |
|
1983 return KErrNone; |
|
1984 |
|
1985 } |
|
1986 |
|
1987 /* |
|
1988 ------------------------------------------------------------------------------- |
|
1989 |
|
1990 Class: CTestExecution |
|
1991 |
|
1992 Method: CancelEventRequest |
|
1993 |
|
1994 Description: Cancel event request. Completes ongoing event request |
|
1995 with KErrCancel. |
|
1996 |
|
1997 Parameters: None |
|
1998 |
|
1999 Return Values: TInt Always KErrNone |
|
2000 |
|
2001 Errors/Exceptions: None |
|
2002 |
|
2003 Status: Proposal |
|
2004 |
|
2005 ------------------------------------------------------------------------------- |
|
2006 */ |
|
2007 TInt CTestExecution::CancelEventRequest() |
|
2008 { |
|
2009 iEventHandler->Cancel(); |
|
2010 |
|
2011 if( iEventNotifyAvailable ) |
|
2012 { |
|
2013 // Cancel request |
|
2014 iEventNotifyAvailable = EFalse; |
|
2015 iNotifyEventMessage.Complete ( KErrCancel ); |
|
2016 } |
|
2017 |
|
2018 return KErrNone; |
|
2019 |
|
2020 } |
|
2021 |
|
2022 /* |
|
2023 ------------------------------------------------------------------------------- |
|
2024 |
|
2025 Class: CTestExecution |
|
2026 |
|
2027 Method: CancelInterferenceRequest |
|
2028 |
|
2029 Description: Cancel print request. Completes ongoing print request |
|
2030 with KErrCancel. |
|
2031 |
|
2032 Parameters: None |
|
2033 |
|
2034 Return Values: TInt: Always KErrNone |
|
2035 |
|
2036 Errors/Exceptions: None |
|
2037 |
|
2038 Status: Proposal |
|
2039 |
|
2040 ------------------------------------------------------------------------------- |
|
2041 */ |
|
2042 TInt CTestExecution::CancelInterferenceRequest() |
|
2043 { |
|
2044 |
|
2045 if ( iInterferenceNotifyAvailable ) |
|
2046 { |
|
2047 iInterferenceHandler->Cancel(); |
|
2048 |
|
2049 iInterferenceNotifyAvailable = EFalse; |
|
2050 iNotifyInterferenceMessage.Complete ( KErrCancel ); |
|
2051 } |
|
2052 |
|
2053 return KErrNone; |
|
2054 |
|
2055 } |
|
2056 |
|
2057 /* |
|
2058 ------------------------------------------------------------------------------- |
|
2059 |
|
2060 Class: CTestExecution |
|
2061 |
|
2062 Method: CancelRemoteCmdRequest |
|
2063 |
|
2064 Description: Cancel RemoteCmd request. Completes ongoing RemoteCmd request |
|
2065 with KErrCancel. |
|
2066 |
|
2067 Parameters: None |
|
2068 |
|
2069 Return Values: TInt: Always KErrNone |
|
2070 |
|
2071 Errors/Exceptions: None |
|
2072 |
|
2073 Status: Proposal |
|
2074 |
|
2075 ------------------------------------------------------------------------------- |
|
2076 */ |
|
2077 TInt CTestExecution::CancelRemoteCmdRequest() |
|
2078 { |
|
2079 iSndHandler->Cancel(); |
|
2080 |
|
2081 // Cancel request |
|
2082 if( iRemoteSendAvailable ) |
|
2083 { |
|
2084 iRemoteSendAvailable = EFalse; |
|
2085 iNotifyRemoteCmdMessage.Complete ( KErrCancel ); |
|
2086 } |
|
2087 |
|
2088 return KErrNone; |
|
2089 |
|
2090 } |
|
2091 |
|
2092 /* |
|
2093 ------------------------------------------------------------------------------- |
|
2094 |
|
2095 Class: CTestExecution |
|
2096 |
|
2097 Method: NotifyCommand |
|
2098 |
|
2099 Description: Handles the first phase of the Command request from engine. |
|
2100 |
|
2101 Parameters: const RMessage& aMessage: in: Message from client. |
|
2102 |
|
2103 Return Values: Symbian OS error code. |
|
2104 |
|
2105 Errors/Exceptions: None |
|
2106 |
|
2107 Status: Proposal |
|
2108 |
|
2109 ------------------------------------------------------------------------------- |
|
2110 */ |
|
2111 TInt CTestExecution::NotifyCommand( const RMessage2& aMessage ) |
|
2112 { |
|
2113 iNotifyCommandMessage = aMessage; |
|
2114 iCommandNotifyAvailable = ETrue; |
|
2115 iCommandHandler->StartL(); |
|
2116 |
|
2117 return KErrNone; |
|
2118 } |
|
2119 |
|
2120 /* |
|
2121 ------------------------------------------------------------------------------- |
|
2122 |
|
2123 Class: CTestExecution |
|
2124 |
|
2125 Method: CancelCommandRequest |
|
2126 |
|
2127 Description: Cancel Command request. Completes ongoing Command request |
|
2128 with KErrCancel. |
|
2129 |
|
2130 Parameters: None |
|
2131 |
|
2132 Return Values: TInt: Always KErrNone |
|
2133 |
|
2134 Errors/Exceptions: None |
|
2135 |
|
2136 Status: Proposal |
|
2137 |
|
2138 ------------------------------------------------------------------------------- |
|
2139 */ |
|
2140 TInt CTestExecution::CancelCommandRequest() |
|
2141 { |
|
2142 iCommandHandler->Cancel(); |
|
2143 |
|
2144 // Cancel request |
|
2145 if(iCommandNotifyAvailable) |
|
2146 { |
|
2147 iCommandNotifyAvailable = EFalse; |
|
2148 iNotifyCommandMessage.Complete(KErrCancel); |
|
2149 } |
|
2150 |
|
2151 return KErrNone; |
|
2152 } |
|
2153 |
|
2154 /* |
|
2155 ------------------------------------------------------------------------------- |
|
2156 |
|
2157 Class: CTestExecution |
|
2158 |
|
2159 Method: GetTestCaseArguments |
|
2160 |
|
2161 Description: Get test case arguments |
|
2162 |
|
2163 Parameters: None |
|
2164 |
|
2165 Return Values: Test case arguments |
|
2166 |
|
2167 Errors/Exceptions: None |
|
2168 |
|
2169 Status: Proposal |
|
2170 |
|
2171 ------------------------------------------------------------------------------- |
|
2172 */ |
|
2173 const TDesC& CTestExecution::GetTestCaseArguments() const |
|
2174 { |
|
2175 if ( iTestCaseArgs != NULL ) |
|
2176 { |
|
2177 return *iTestCaseArgs; |
|
2178 } |
|
2179 return KNullDesC; |
|
2180 } |
|
2181 |
|
2182 /* |
|
2183 ------------------------------------------------------------------------------- |
|
2184 |
|
2185 Class: CTestExecution |
|
2186 |
|
2187 Method: CancelTestRequest |
|
2188 |
|
2189 Description: Cancel test execution request. |
|
2190 If thread is not in OnGoing state, function does not do anything. |
|
2191 |
|
2192 Otherwise following operations are done: |
|
2193 1 ) Obtain access to both PrintMutex and EventMutex to make sure that |
|
2194 thread can't be accessing print queue or events. |
|
2195 2 ) Kill the thread |
|
2196 3 ) Complete original "RunTestCase" request with KErrCancel |
|
2197 4 ) If print queue is empty, complete print request |
|
2198 5 ) Give up mutexes |
|
2199 6 ) Delete module container |
|
2200 |
|
2201 Parameters: None |
|
2202 |
|
2203 Return Values: TInt: Always KErrNone |
|
2204 |
|
2205 Errors/Exceptions: None |
|
2206 |
|
2207 Status: Approved |
|
2208 |
|
2209 ------------------------------------------------------------------------------- |
|
2210 */ |
|
2211 TInt CTestExecution::CancelTestRequest() |
|
2212 { |
|
2213 // This mutex block and make sure that cancel operation is done succesfully |
|
2214 // and test case e.g. cannot complete at the same time. Get mutex. |
|
2215 iTestThreadMutex.Wait(); |
|
2216 |
|
2217 // iModuleContainer is an active object, check is active. |
|
2218 if ( iModuleContainer == NULL || ( iModuleContainer != NULL && !iModuleContainer->IsActive() ) ) |
|
2219 { |
|
2220 // Test case is already ready, return. |
|
2221 iTestThreadMutex.Signal(); |
|
2222 return KErrNone; |
|
2223 } |
|
2224 |
|
2225 if ( iThreadState == EOnGoing ) |
|
2226 { |
|
2227 // Print mutex access is required to make sure that the dying thread |
|
2228 // does not have access to print queue. Same is true for event queue. |
|
2229 |
|
2230 // NOTE: iEventArrayMutex is now taken, so the ongoing thread |
|
2231 // can't set any events so queue will be empty. |
|
2232 iPrintHandler->Cancel(); |
|
2233 iEventHandler->Cancel(); |
|
2234 iInterferenceHandler->Cancel(); |
|
2235 iCommandHandler->Cancel(); |
|
2236 |
|
2237 // Kill the thread |
|
2238 iModuleContainer->KillThread( KErrCancel ); |
|
2239 |
|
2240 // Complete the test execution request |
|
2241 CompleteTestExecution( KErrCancel, TFullTestResult::ECaseCancelled, |
|
2242 KErrCancel, KErrCancel, _L( "Cancelled" ) ); |
|
2243 iThreadState = ECancelled; |
|
2244 |
|
2245 |
|
2246 /** |
|
2247 * Removed, because may block in certain situations. Implemented now in |
|
2248 * TestCombiner instead. |
|
2249 // Unset all pending state events, |
|
2250 // because we have killed the testcase abnormally |
|
2251 // UnsetStateEvents(); |
|
2252 */ |
|
2253 |
|
2254 // Complete print request if queue is empty |
|
2255 CompletePrintRequestIfQueueEmpty(); |
|
2256 |
|
2257 // Delete the module containter |
|
2258 delete iModuleContainer; |
|
2259 iModuleContainer = NULL; |
|
2260 } |
|
2261 |
|
2262 // Relinquish mutex. |
|
2263 iTestThreadMutex.Signal(); |
|
2264 |
|
2265 return KErrNone; |
|
2266 |
|
2267 } |
|
2268 |
|
2269 /* |
|
2270 ------------------------------------------------------------------------------- |
|
2271 |
|
2272 Class: CTestExecution |
|
2273 |
|
2274 Method: CancelRequestL |
|
2275 |
|
2276 Description: Cancel asynchronous request |
|
2277 |
|
2278 Parameters: const RMessage& aMessage :in: Message from client. |
|
2279 |
|
2280 Return Values: TInt Error code from CancelXXX- |
|
2281 function |
|
2282 |
|
2283 Errors/Exceptions: Function panics the client, if invalid message |
|
2284 received. |
|
2285 |
|
2286 Status: Proposal |
|
2287 |
|
2288 ------------------------------------------------------------------------------- |
|
2289 */ |
|
2290 TInt CTestExecution::CancelRequestL( const RMessage2& aMessage ) |
|
2291 { |
|
2292 TInt r = KErrNone; |
|
2293 |
|
2294 switch ( aMessage.Int0() ) |
|
2295 { |
|
2296 case ETestExecutionRunTestCase: |
|
2297 { |
|
2298 r = CancelTestRequest(); |
|
2299 break; |
|
2300 } |
|
2301 case ETestExecutionNotifyProgress: |
|
2302 { |
|
2303 r = CancelPrintRequest(); |
|
2304 break; |
|
2305 } |
|
2306 case ETestExecutionNotifyEvent: |
|
2307 { |
|
2308 r = CancelEventRequest(); |
|
2309 break; |
|
2310 } |
|
2311 case ETestExecutionNotifyRemoteCmd: |
|
2312 { |
|
2313 r = CancelRemoteCmdRequest(); |
|
2314 break; |
|
2315 } |
|
2316 case ETestExecutionNotifyCommand: |
|
2317 { |
|
2318 r = CancelCommandRequest(); |
|
2319 break; |
|
2320 } |
|
2321 default: |
|
2322 iModuleSession->PanicClient( EInvalidRequestCancel, aMessage ); |
|
2323 break; |
|
2324 } |
|
2325 |
|
2326 aMessage.Complete( r ); |
|
2327 |
|
2328 return r; |
|
2329 |
|
2330 } |
|
2331 |
|
2332 /* |
|
2333 ------------------------------------------------------------------------------- |
|
2334 |
|
2335 Class: CTestExecution |
|
2336 |
|
2337 Method: SetThreadState |
|
2338 |
|
2339 Description: A multithread safe thread state modification function |
|
2340 |
|
2341 Parameters: const TTestState aState :in: New state |
|
2342 |
|
2343 Return Values: None |
|
2344 |
|
2345 Errors/Exceptions: None |
|
2346 |
|
2347 Status: Proposal |
|
2348 |
|
2349 ------------------------------------------------------------------------------- |
|
2350 */ |
|
2351 void CTestExecution::SetThreadState( const TTestState aState ) |
|
2352 { |
|
2353 |
|
2354 iThreadState = aState; |
|
2355 |
|
2356 } |
|
2357 |
|
2358 /* |
|
2359 ------------------------------------------------------------------------------- |
|
2360 |
|
2361 Class: CTestExecution |
|
2362 |
|
2363 Method: Complete event |
|
2364 |
|
2365 Description: Completes pending event request. Must be |
|
2366 called with iEventSem taken. |
|
2367 |
|
2368 Parameters: None |
|
2369 |
|
2370 Return Values: None |
|
2371 |
|
2372 Errors/Exceptions: None |
|
2373 |
|
2374 Status: Proposal |
|
2375 |
|
2376 ------------------------------------------------------------------------------- |
|
2377 */ |
|
2378 void CTestExecution::CompleteEvent( TInt aError ) |
|
2379 { |
|
2380 if( iEventDef.iStatus ) |
|
2381 { |
|
2382 __TRACE( KMessage,(_L("Comp Stat %d, %x (error %d)"), |
|
2383 this, iEventDef.iStatus, aError)); |
|
2384 TestThreadRequestComplete( iEventDef.iStatus, aError ); |
|
2385 |
|
2386 iEventDef.iStatus = NULL; |
|
2387 |
|
2388 } |
|
2389 |
|
2390 } |
|
2391 |
|
2392 /* |
|
2393 ------------------------------------------------------------------------------- |
|
2394 |
|
2395 Class: CTestExecution |
|
2396 |
|
2397 Method: CompletePrintRequestIfQueueEmpty |
|
2398 |
|
2399 Description: Completes print request if queue is empty. |
|
2400 |
|
2401 Parameters: None |
|
2402 |
|
2403 Return Values: None |
|
2404 |
|
2405 Errors/Exceptions: None |
|
2406 |
|
2407 Status: Proposal |
|
2408 |
|
2409 ------------------------------------------------------------------------------- |
|
2410 */ |
|
2411 void CTestExecution::CompletePrintRequestIfQueueEmpty() |
|
2412 { |
|
2413 |
|
2414 if ( iPrintNotifyAvailable && iPrintQueue->Count() == 0 ) |
|
2415 { |
|
2416 iNotifyPrintMessage.Complete ( KErrEof ); |
|
2417 iPrintNotifyAvailable = EFalse; |
|
2418 } |
|
2419 |
|
2420 } |
|
2421 |
|
2422 /* |
|
2423 ------------------------------------------------------------------------------- |
|
2424 |
|
2425 Class: CTestExecution |
|
2426 |
|
2427 Method: CleanupEvents |
|
2428 |
|
2429 Description: Cleanups Events. |
|
2430 |
|
2431 Parameters: None |
|
2432 |
|
2433 Return Values: None |
|
2434 |
|
2435 Errors/Exceptions: None |
|
2436 |
|
2437 Status: Proposal |
|
2438 |
|
2439 ------------------------------------------------------------------------------- |
|
2440 */ |
|
2441 void CTestExecution::CleanupEvents() |
|
2442 { |
|
2443 |
|
2444 iEventArray.ResetAndDestroy(); |
|
2445 |
|
2446 } |
|
2447 |
|
2448 /* |
|
2449 ------------------------------------------------------------------------------- |
|
2450 |
|
2451 Class: CTestExecution |
|
2452 |
|
2453 Method: GetRq |
|
2454 |
|
2455 Description: Get request pointers. |
|
2456 |
|
2457 Parameters: None |
|
2458 |
|
2459 Return Values: TRequestStatus* |
|
2460 |
|
2461 Errors/Exceptions: None |
|
2462 |
|
2463 Status: Approved |
|
2464 |
|
2465 ------------------------------------------------------------------------------- |
|
2466 */ |
|
2467 TRequestStatus* CTestExecution::GetRq( TRequestType aType ) |
|
2468 { |
|
2469 |
|
2470 TRequestStatus* status = NULL; |
|
2471 |
|
2472 switch( aType ) |
|
2473 { |
|
2474 case ERqPrint: |
|
2475 status = &iPrintHandler->iStatus; |
|
2476 break; |
|
2477 case ERqEvent: |
|
2478 status = &iEventHandler->iStatus; |
|
2479 break; |
|
2480 case ERqSnd: |
|
2481 status = &iSndHandler->iStatus; |
|
2482 break; |
|
2483 case ERqRcv: |
|
2484 status = &iRcvHandler->iStatus; |
|
2485 break; |
|
2486 case ERqInterference: |
|
2487 status = &iInterferenceHandler->iStatus; |
|
2488 break; |
|
2489 case ERqMeasurement: |
|
2490 status = &iMeasurementHandler->iStatus; |
|
2491 break; |
|
2492 case ERqCommand: |
|
2493 status = &iCommandHandler->iStatus; |
|
2494 break; |
|
2495 default: |
|
2496 break; |
|
2497 } |
|
2498 |
|
2499 return status; |
|
2500 |
|
2501 } |
|
2502 |
|
2503 |
|
2504 /* |
|
2505 ------------------------------------------------------------------------------- |
|
2506 |
|
2507 Class: CTestExecution |
|
2508 |
|
2509 Method: CompleteTestExecution |
|
2510 |
|
2511 Description: Completes test execution |
|
2512 |
|
2513 Parameters: const TInt aCompletionCode :in: Request completion code |
|
2514 const TInt aCaseExecutionCode in: Case execution code |
|
2515 const TFullTestResult::TCaseExecutionResult aCaseExecutionType, |
|
2516 const TInt aCaseResult :in: Case result |
|
2517 const TDesC& aText :in: Completion text |
|
2518 |
|
2519 Return Values: None |
|
2520 |
|
2521 Errors/Exceptions: None |
|
2522 |
|
2523 Status: Proposal |
|
2524 |
|
2525 ------------------------------------------------------------------------------- |
|
2526 */ |
|
2527 void CTestExecution::CompleteTestExecution( const TInt aCompletionCode, |
|
2528 const TFullTestResult::TCaseExecutionResult aCaseExecutionType, |
|
2529 const TInt aCaseExecutionCode, |
|
2530 const TInt aCaseResult, |
|
2531 const TDesC& aText ) |
|
2532 { |
|
2533 |
|
2534 TInt completionCode = aCompletionCode; |
|
2535 |
|
2536 if( iModuleContainer != NULL ) |
|
2537 { |
|
2538 // Fill the description |
|
2539 iFullResult.iEndTime.HomeTime(); |
|
2540 iFullResult.iCaseExecutionResultType = aCaseExecutionType; |
|
2541 iFullResult.iCaseExecutionResultCode = aCaseExecutionCode; |
|
2542 iFullResult.iTestResult.iResult = aCaseResult; |
|
2543 iFullResult.iTestResult.iResultDes = aText; |
|
2544 CompleteTestExecution( aCompletionCode ); |
|
2545 return; |
|
2546 } |
|
2547 else |
|
2548 { |
|
2549 completionCode = KErrGeneral; |
|
2550 __TRACE ( KError, ( CStifLogger::ERed, |
|
2551 _L("CTestExecution::CompleteTestExecution: ModuleContainer NULL") ) ); |
|
2552 } |
|
2553 |
|
2554 iTestExeMessage.Complete ( completionCode ); |
|
2555 |
|
2556 } |
|
2557 |
|
2558 /* |
|
2559 ------------------------------------------------------------------------------- |
|
2560 |
|
2561 Class: CTestExecution |
|
2562 |
|
2563 Method: CompleteTestExecution |
|
2564 |
|
2565 Description: Completes test execution |
|
2566 |
|
2567 Parameters: const TInt aCompletionCode: in: completion code |
|
2568 TFullTestResult&: in: test case result |
|
2569 |
|
2570 Return Values: None |
|
2571 |
|
2572 Errors/Exceptions: None |
|
2573 |
|
2574 Status: Proposal |
|
2575 |
|
2576 ------------------------------------------------------------------------------- |
|
2577 */ |
|
2578 void CTestExecution::CompleteTestExecution( const TInt aCompletionCode ) |
|
2579 { |
|
2580 |
|
2581 TInt completionCode = aCompletionCode; |
|
2582 |
|
2583 TFullTestResultPckg fullResultPckg( iFullResult ); |
|
2584 TRAPD( res, iTestExeMessage.WriteL( 0, fullResultPckg ) ); |
|
2585 if ( res != KErrNone ) |
|
2586 { |
|
2587 completionCode = res; |
|
2588 } |
|
2589 |
|
2590 iTestExeMessage.Complete ( completionCode ); |
|
2591 |
|
2592 // @js Now it returns completionCode, used to return res |
|
2593 |
|
2594 } |
|
2595 |
|
2596 /* |
|
2597 ------------------------------------------------------------------------------- |
|
2598 |
|
2599 Class: CTestExecution |
|
2600 |
|
2601 Method: UnsetStateEvents |
|
2602 |
|
2603 Description: Unsets all state events. Must be done if testcase is exited |
|
2604 abnormally (i.e. aborted by the user). |
|
2605 |
|
2606 Parameters: None |
|
2607 |
|
2608 Return Values: None |
|
2609 |
|
2610 Errors/Exceptions: None |
|
2611 |
|
2612 Status: Proposal |
|
2613 |
|
2614 ------------------------------------------------------------------------------- |
|
2615 */ |
|
2616 void CTestExecution::UnsetStateEvents() |
|
2617 { |
|
2618 |
|
2619 |
|
2620 // Unset all state events that are set currently |
|
2621 TInt count = iStateEvents.Count(); |
|
2622 TEventIf event; |
|
2623 for( TInt i = 0; i < count; i++ ) |
|
2624 { |
|
2625 TPtrC name = *(iStateEvents[i]); |
|
2626 event.Set( TEventIf::EUnsetEvent, name, TEventIf::EState ); |
|
2627 |
|
2628 // Construct message |
|
2629 TEventIfPckg eventPckg( event ); |
|
2630 |
|
2631 // Write message to client space |
|
2632 TRAPD( res, iNotifyEventMessage.WriteL( 0, eventPckg ) ); |
|
2633 |
|
2634 // Complete with WriteL result |
|
2635 iEventNotifyAvailable = EFalse; |
|
2636 iNotifyEventMessage.Complete( res ); |
|
2637 if( res != KErrNone ) |
|
2638 { |
|
2639 __TRACE( KError,( _L( "CTestExecution::UnsetStateEvents: WriteL failed" ) )); |
|
2640 break; |
|
2641 } |
|
2642 } |
|
2643 |
|
2644 } |
|
2645 |
|
2646 /* |
|
2647 ------------------------------------------------------------------------------- |
|
2648 |
|
2649 Class: CTestExecution |
|
2650 |
|
2651 Method: TestThreadRequestComplete |
|
2652 |
|
2653 Description: Complete test thread request. |
|
2654 |
|
2655 Parameters: None |
|
2656 |
|
2657 Return Values: None |
|
2658 |
|
2659 Errors/Exceptions: None |
|
2660 |
|
2661 Status: Proposal |
|
2662 |
|
2663 ------------------------------------------------------------------------------- |
|
2664 */ |
|
2665 void CTestExecution::TestThreadRequestComplete( TRequestStatus* aStatus, |
|
2666 TInt aCode) |
|
2667 { |
|
2668 |
|
2669 if( iThreadState != EOnGoing ) |
|
2670 { |
|
2671 __TRACE( KError, |
|
2672 ( _L( "CTestExecution::TestThreadRequestComplete: test thread killed" ) )); |
|
2673 return; |
|
2674 } |
|
2675 |
|
2676 if( iTestThreadOpen == EFalse ) |
|
2677 { |
|
2678 if( iTestThread.Open( iTestThreadId ) != KErrNone ) |
|
2679 { |
|
2680 __TRACE( KError, |
|
2681 ( _L( "CTestExecution::TestThreadRequestComplete: test thread cannot be opened" ) )); |
|
2682 return; |
|
2683 } |
|
2684 iTestThreadOpen = ETrue; |
|
2685 } |
|
2686 if( iTestThread.ExitType() != EExitPending ) |
|
2687 { |
|
2688 // test thread has died |
|
2689 __TRACE( KError, |
|
2690 ( _L( "CTestExecution::TestThreadRequestComplete: test thread has died" ) )); |
|
2691 return; |
|
2692 } |
|
2693 |
|
2694 iTestThread.RequestComplete( aStatus, aCode ); |
|
2695 |
|
2696 } |
|
2697 |
|
2698 /* |
|
2699 ------------------------------------------------------------------------------- |
|
2700 |
|
2701 Class: CTestExecution |
|
2702 |
|
2703 Method: CancelTestExecution |
|
2704 |
|
2705 Description: Cancels test(s) execution in special cases e.g. timeout, |
|
2706 exit etc. |
|
2707 |
|
2708 Parameters: None |
|
2709 |
|
2710 Return Values: TInt: Symbian error code. |
|
2711 |
|
2712 Errors/Exceptions: None |
|
2713 |
|
2714 Status: Approved |
|
2715 |
|
2716 ------------------------------------------------------------------------------- |
|
2717 */ |
|
2718 TInt CTestExecution::CancelTestExecution() |
|
2719 { |
|
2720 TInt ret( KErrNone ); |
|
2721 ret = CancelTestRequest(); |
|
2722 |
|
2723 return ret; |
|
2724 |
|
2725 } |
|
2726 |
|
2727 /* |
|
2728 ------------------------------------------------------------------------------- |
|
2729 |
|
2730 Class: CTestExecution |
|
2731 |
|
2732 Method: KillTestinterferenceThread |
|
2733 |
|
2734 Description: Make sure that any of the test interference thread's won't |
|
2735 stay to run if test case is crashed of test interference |
|
2736 object is not deleted. |
|
2737 |
|
2738 Parameters: None |
|
2739 |
|
2740 Return Values: TInt: Symbian OS error code. |
|
2741 |
|
2742 Errors/Exceptions: None |
|
2743 |
|
2744 Status: Proposal |
|
2745 |
|
2746 ------------------------------------------------------------------------------- |
|
2747 */ |
|
2748 TInt CTestExecution::KillTestinterferenceThread() |
|
2749 { |
|
2750 for( TInt i = 0; i < iSTIFTestInterferenceArray.Count(); i++ ) |
|
2751 { |
|
2752 RDebug::Print( |
|
2753 _L( "Test interference's thread[%x] killed by STIF" ), (TInt)iSTIFTestInterferenceArray[i].Id() ); |
|
2754 __TRACE( KInit, |
|
2755 ( _L( "Test interference's thread[%x] killed by STIF" ), (TInt)iSTIFTestInterferenceArray[i].Id() ) ); |
|
2756 iSTIFTestInterferenceArray[i].Kill( KErrCancel ); |
|
2757 //iSTIFTestInterferenceArray.Remove( i ); |
|
2758 } |
|
2759 |
|
2760 iSTIFTestInterferenceArray.Reset(); |
|
2761 iSTIFTestInterferenceArray.Close(); |
|
2762 |
|
2763 return KErrNone; |
|
2764 |
|
2765 } |
|
2766 |
|
2767 /* |
|
2768 ------------------------------------------------------------------------------- |
|
2769 |
|
2770 Class: CTestExecution |
|
2771 |
|
2772 Method: DoNotifyCommand |
|
2773 |
|
2774 Description: Completes command message. |
|
2775 |
|
2776 Parameters: None. |
|
2777 |
|
2778 Return Values: Symbian OS error code. |
|
2779 |
|
2780 Errors/Exceptions: None |
|
2781 |
|
2782 Status: Proposal |
|
2783 |
|
2784 ------------------------------------------------------------------------------- |
|
2785 */ |
|
2786 TInt CTestExecution::DoNotifyCommand() |
|
2787 { |
|
2788 if(!iCommandNotifyAvailable) |
|
2789 { |
|
2790 __TRACE(KPrint, (_L("CTestExecution::DoNotifyCommand(): unable to complete notification"))) |
|
2791 return KErrNone; |
|
2792 } |
|
2793 |
|
2794 TInt ret = KErrNone; |
|
2795 |
|
2796 switch(iCommandDef->iCommand) |
|
2797 { |
|
2798 case EStopExecution: |
|
2799 { |
|
2800 //Unpack received parameters |
|
2801 TStopExecutionCommandParams par; |
|
2802 TStopExecutionCommandParamsPckg parPack(par); |
|
2803 parPack.Copy(iCommandDef->iParamsPckg); |
|
2804 |
|
2805 //Set test case handle |
|
2806 par.iTestCaseHandle = iNotifyCommandMessage.Int3(); |
|
2807 |
|
2808 __TRACE(KPrint, (_L("CTestExecution::DoNotifyCommand(): command [%d] type [%d] code [%d] test handle [%d]"), TInt(iCommandDef->iCommand), TInt(par.iType), TInt(par.iCode), par.iTestCaseHandle)); |
|
2809 iCommandDef->iParamsPckg.Copy(parPack); |
|
2810 break; |
|
2811 } |
|
2812 case ESendTestModuleVersion: |
|
2813 { |
|
2814 TSendTestModuleVesionCommandParams par; |
|
2815 TSendTestModuleVesionCommandParamsPckg parPack(par); |
|
2816 parPack.Copy(iCommandDef->iParamsPckg); |
|
2817 |
|
2818 __TRACE(KPrint, (_L("CTestExecution::DoNotifyCommand(): command ESendTestModuleVersion"))); |
|
2819 break; |
|
2820 } |
|
2821 default: |
|
2822 __TRACE(KError, (_L("CTestExecution::DoNotifyCommand(): Unknown command [%d]"), TInt(iCommandDef->iCommand))); |
|
2823 return KErrNotFound; |
|
2824 } |
|
2825 // Construct message |
|
2826 TPckg<TCommand> commandPckg(iCommandDef->iCommand); |
|
2827 |
|
2828 // Start first phase of the writing message to client space |
|
2829 TRAP(ret, iNotifyCommandMessage.WriteL(0, commandPckg)); |
|
2830 if(ret != KErrNone) |
|
2831 { |
|
2832 __TRACE(KError, (_L( "CTestExecution::DoNotifyCommand(): WriteL failed (0)"))); |
|
2833 } |
|
2834 |
|
2835 TRAP(ret, iNotifyCommandMessage.WriteL(1, iCommandDef->iParamsPckg)); |
|
2836 if(ret != KErrNone) |
|
2837 { |
|
2838 __TRACE(KError, (_L( "CTestExecution::DoNotifyCommand(): WriteL failed (1)"))); |
|
2839 } |
|
2840 |
|
2841 // Complete request with WriteL result |
|
2842 iCommandNotifyAvailable = EFalse; |
|
2843 iNotifyCommandMessage.Complete(ret); |
|
2844 |
|
2845 return KErrNone; |
|
2846 } |
|
2847 |
|
2848 /* |
|
2849 ------------------------------------------------------------------------------- |
|
2850 |
|
2851 Class: CTestExecution |
|
2852 |
|
2853 Method: KillTestMeasurement |
|
2854 |
|
2855 Description: Make sure that any of the test measurement operations won't |
|
2856 stay to run if test case is crashed or test measurement object |
|
2857 is not stopped by user. |
|
2858 |
|
2859 Parameters: None |
|
2860 |
|
2861 Return Values: TInt: Symbian OS error code. |
|
2862 |
|
2863 Errors/Exceptions: None |
|
2864 |
|
2865 Status: Approved |
|
2866 |
|
2867 ------------------------------------------------------------------------------- |
|
2868 */ |
|
2869 TInt CTestExecution::KillTestMeasurement() |
|
2870 { |
|
2871 for( TInt i = 0; i < iMeasurementHandlingArray.Count(); i++ ) |
|
2872 { |
|
2873 iMeasurementHandlingArray[i]->iMeasurementModulePtr->Stop(); |
|
2874 } |
|
2875 |
|
2876 iMeasurementHandlingArray.ResetAndDestroy(); |
|
2877 iMeasurementHandlingArray.Close(); |
|
2878 |
|
2879 return KErrNone; |
|
2880 |
|
2881 } |
|
2882 |
|
2883 /* |
|
2884 ------------------------------------------------------------------------------- |
|
2885 |
|
2886 DESCRIPTION |
|
2887 |
|
2888 This module contains implementation of CPrintHandler class member functions. |
|
2889 CPrintHandler listens print notifications from test thread. |
|
2890 |
|
2891 ------------------------------------------------------------------------------- |
|
2892 */ |
|
2893 |
|
2894 // ================= MEMBER FUNCTIONS ========================================= |
|
2895 |
|
2896 |
|
2897 /* |
|
2898 ------------------------------------------------------------------------------- |
|
2899 |
|
2900 Class: CPrintHandler |
|
2901 |
|
2902 Method: NewL |
|
2903 |
|
2904 Description: Constructs a new CPrintHandler object. |
|
2905 |
|
2906 Parameters: CTestExecution& aExecution: in: "Parent" |
|
2907 |
|
2908 Return Values: CPrintHandler*: New undertaker |
|
2909 |
|
2910 Errors/Exceptions: Leaves if memory allocation or ConstructL leaves. |
|
2911 |
|
2912 Status: Proposal |
|
2913 |
|
2914 ------------------------------------------------------------------------------- |
|
2915 */ |
|
2916 CPrintHandler* CPrintHandler::NewL( CTestExecution& aExecution ) |
|
2917 { |
|
2918 |
|
2919 CPrintHandler* self = new( ELeave ) CPrintHandler( aExecution ); |
|
2920 CleanupStack::PushL( self ); |
|
2921 self->ConstructL(); |
|
2922 CleanupStack::Pop( self ); |
|
2923 return self; |
|
2924 |
|
2925 } |
|
2926 |
|
2927 /* |
|
2928 ------------------------------------------------------------------------------- |
|
2929 |
|
2930 Class: CPrintHandler |
|
2931 |
|
2932 Method: ConstructL |
|
2933 |
|
2934 Description: Second level constructor. |
|
2935 |
|
2936 Parameters: None |
|
2937 |
|
2938 Return Values: None |
|
2939 |
|
2940 Errors/Exceptions: None |
|
2941 |
|
2942 Status: Proposal |
|
2943 |
|
2944 ------------------------------------------------------------------------------- |
|
2945 */ |
|
2946 void CPrintHandler::ConstructL() |
|
2947 { |
|
2948 |
|
2949 } |
|
2950 |
|
2951 /* |
|
2952 ------------------------------------------------------------------------------- |
|
2953 |
|
2954 Class: CPrintHandler |
|
2955 |
|
2956 Method: CPrintHandler |
|
2957 |
|
2958 Description: Constructor |
|
2959 |
|
2960 Parameters: CTestModuleContainer& aExecution :in: "Parent" |
|
2961 |
|
2962 Return Values: None |
|
2963 |
|
2964 Errors/Exceptions: None |
|
2965 |
|
2966 Status: Proposal |
|
2967 |
|
2968 ------------------------------------------------------------------------------- |
|
2969 */ |
|
2970 CPrintHandler::CPrintHandler( CTestExecution& aExecution ) : |
|
2971 CActive( CActive::EPriorityStandard ), |
|
2972 iExecution( aExecution ) |
|
2973 { |
|
2974 |
|
2975 CActiveScheduler::Add ( this ); |
|
2976 |
|
2977 } |
|
2978 |
|
2979 /* |
|
2980 ------------------------------------------------------------------------------- |
|
2981 |
|
2982 Class: CPrintHandler |
|
2983 |
|
2984 Method: ~CPrintHandler |
|
2985 |
|
2986 Description: Destructor. |
|
2987 Cancels active request. |
|
2988 |
|
2989 Parameters: None |
|
2990 |
|
2991 Return Values: None |
|
2992 |
|
2993 Errors/Exceptions: None |
|
2994 |
|
2995 Status: Proposal |
|
2996 |
|
2997 ------------------------------------------------------------------------------- |
|
2998 */ |
|
2999 CPrintHandler::~CPrintHandler() |
|
3000 { |
|
3001 |
|
3002 Cancel(); |
|
3003 |
|
3004 } |
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 /* |
|
3010 ------------------------------------------------------------------------------- |
|
3011 |
|
3012 Class: CPrintHandler |
|
3013 |
|
3014 Method: StartL |
|
3015 |
|
3016 Description: Starts to monitor thread. |
|
3017 |
|
3018 Parameters: None |
|
3019 |
|
3020 Return Values: TInt Always KErrNone |
|
3021 |
|
3022 Errors/Exceptions: None |
|
3023 |
|
3024 Status: Proposal |
|
3025 |
|
3026 ------------------------------------------------------------------------------- |
|
3027 */ |
|
3028 void CPrintHandler::StartL() |
|
3029 { |
|
3030 |
|
3031 __TRACE( KPrint, ( _L( "CPrintHandler::StartL" ) ) ); |
|
3032 |
|
3033 if( IsActive() ) |
|
3034 { |
|
3035 CTestServer::PanicServer( EAlreadyActive ); |
|
3036 } |
|
3037 |
|
3038 iStatus = KRequestPending; |
|
3039 SetActive(); |
|
3040 |
|
3041 // Signal test thread |
|
3042 iExecution.iPrintSem.Signal(); |
|
3043 |
|
3044 } |
|
3045 |
|
3046 /* |
|
3047 ------------------------------------------------------------------------------- |
|
3048 |
|
3049 Class: CPrintHandler |
|
3050 |
|
3051 Method: RunL |
|
3052 |
|
3053 Description: Handles thread death. |
|
3054 Function does: |
|
3055 1 ) Stops monitoring thread |
|
3056 1 ) Marks thread death |
|
3057 2 ) Completes ongoing requests |
|
3058 3 ) Cleans the memory |
|
3059 |
|
3060 Parameters: None |
|
3061 |
|
3062 Return Values: None |
|
3063 |
|
3064 Errors/Exceptions: None |
|
3065 |
|
3066 Status: Proposal |
|
3067 |
|
3068 ------------------------------------------------------------------------------- |
|
3069 */ |
|
3070 void CPrintHandler::RunL() |
|
3071 { |
|
3072 |
|
3073 __TRACE( KPrint, ( _L( "CPrintHandler::RunL [%d]" ), iStatus.Int() ) ); |
|
3074 |
|
3075 iExecution.DoNotifyPrint(); |
|
3076 |
|
3077 // enable print request |
|
3078 //@speiExecution.iPrintHandler->StartL(); |
|
3079 StartL(); |
|
3080 } |
|
3081 |
|
3082 |
|
3083 /* |
|
3084 ------------------------------------------------------------------------------- |
|
3085 |
|
3086 Class: CPrintHandler |
|
3087 |
|
3088 Method: DoCancel |
|
3089 |
|
3090 Description: Stops print notification listening. |
|
3091 |
|
3092 Parameters: None |
|
3093 |
|
3094 Return Values: None |
|
3095 |
|
3096 Errors/Exceptions: None |
|
3097 |
|
3098 Status: Proposal |
|
3099 |
|
3100 ------------------------------------------------------------------------------- |
|
3101 */ |
|
3102 |
|
3103 void CPrintHandler::DoCancel() |
|
3104 { |
|
3105 |
|
3106 __TRACE( KPrint, ( _L( "CPrintHandler::DoCancel" ) ) ); |
|
3107 |
|
3108 iExecution.iPrintMutex.Wait(); // Take mutex and check test case print |
|
3109 // operation. If pending take print semaphore |
|
3110 // and complete |
|
3111 if( iStatus == KRequestPending ) |
|
3112 { |
|
3113 // Signal test thread |
|
3114 // @remove iExecution.iPrintSem.Wait(); |
|
3115 |
|
3116 TRequestStatus* status = &iStatus; |
|
3117 User::RequestComplete( status, KErrCancel ); |
|
3118 } |
|
3119 |
|
3120 iExecution.iPrintMutex.Signal(); |
|
3121 } |
|
3122 |
|
3123 /* |
|
3124 ------------------------------------------------------------------------------- |
|
3125 |
|
3126 Class: CPrintHandler |
|
3127 |
|
3128 Method: RunError |
|
3129 |
|
3130 Description: Handle errors. RunL function does not leave, so one should |
|
3131 never come here. |
|
3132 |
|
3133 Print trace and let framework handle error( i.e to do Panic ) |
|
3134 |
|
3135 Parameters: TInt aError: :in: Error code |
|
3136 |
|
3137 Return Values: TInt Error code |
|
3138 |
|
3139 Errors/Exceptions: None |
|
3140 |
|
3141 Status: Proposal |
|
3142 |
|
3143 ------------------------------------------------------------------------------- |
|
3144 */ |
|
3145 TInt CPrintHandler::RunError( TInt aError ) |
|
3146 { |
|
3147 |
|
3148 __TRACE( KError,( _L( "CPrintHandler::RunError" ) ) ); |
|
3149 |
|
3150 return aError; |
|
3151 |
|
3152 } |
|
3153 |
|
3154 /* |
|
3155 ------------------------------------------------------------------------------- |
|
3156 |
|
3157 DESCRIPTION |
|
3158 |
|
3159 This module contains implementation of CEventHandler class member functions. |
|
3160 CEventHandler listens print notifications from test thread. |
|
3161 |
|
3162 ------------------------------------------------------------------------------- |
|
3163 */ |
|
3164 |
|
3165 // ================= MEMBER FUNCTIONS ========================================= |
|
3166 |
|
3167 |
|
3168 /* |
|
3169 ------------------------------------------------------------------------------- |
|
3170 |
|
3171 Class: CEventHandler |
|
3172 |
|
3173 Method: NewL |
|
3174 |
|
3175 Description: Constructs a new CEventHandler object. |
|
3176 |
|
3177 Parameters: CTestExecution& aExecution: in: "Parent" |
|
3178 |
|
3179 Return Values: CEventHandler*: New undertaker |
|
3180 |
|
3181 Errors/Exceptions: Leaves if memory allocation or ConstructL leaves. |
|
3182 |
|
3183 Status: Proposal |
|
3184 |
|
3185 ------------------------------------------------------------------------------- |
|
3186 */ |
|
3187 CEventHandler* CEventHandler::NewL( CTestExecution& aExecution ) |
|
3188 { |
|
3189 |
|
3190 CEventHandler* self = new( ELeave ) CEventHandler( aExecution ); |
|
3191 CleanupStack::PushL( self ); |
|
3192 self->ConstructL(); |
|
3193 CleanupStack::Pop( self ); |
|
3194 return self; |
|
3195 |
|
3196 } |
|
3197 |
|
3198 /* |
|
3199 ------------------------------------------------------------------------------- |
|
3200 |
|
3201 Class: CEventHandler |
|
3202 |
|
3203 Method: ConstructL |
|
3204 |
|
3205 Description: Second level constructor. |
|
3206 |
|
3207 Parameters: None |
|
3208 |
|
3209 Return Values: None |
|
3210 |
|
3211 Errors/Exceptions: None |
|
3212 |
|
3213 Status: Proposal |
|
3214 |
|
3215 ------------------------------------------------------------------------------- |
|
3216 */ |
|
3217 void CEventHandler::ConstructL() |
|
3218 { |
|
3219 |
|
3220 } |
|
3221 |
|
3222 /* |
|
3223 ------------------------------------------------------------------------------- |
|
3224 |
|
3225 Class: CEventHandler |
|
3226 |
|
3227 Method: CEventHandler |
|
3228 |
|
3229 Description: Constructor |
|
3230 |
|
3231 Parameters: CTestModuleContainer& aExecution :in: "Parent" |
|
3232 |
|
3233 Return Values: None |
|
3234 |
|
3235 Errors/Exceptions: None |
|
3236 |
|
3237 Status: Proposal |
|
3238 |
|
3239 ------------------------------------------------------------------------------- |
|
3240 */ |
|
3241 CEventHandler::CEventHandler( CTestExecution& aExecution ) : |
|
3242 CActive( CActive::EPriorityStandard ), |
|
3243 iExecution( aExecution ) |
|
3244 { |
|
3245 |
|
3246 CActiveScheduler::Add ( this ); |
|
3247 |
|
3248 } |
|
3249 |
|
3250 /* |
|
3251 ------------------------------------------------------------------------------- |
|
3252 |
|
3253 Class: CEventHandler |
|
3254 |
|
3255 Method: ~CEventHandler |
|
3256 |
|
3257 Description: Destructor. |
|
3258 Cancels active request. |
|
3259 |
|
3260 Parameters: None |
|
3261 |
|
3262 Return Values: None |
|
3263 |
|
3264 Errors/Exceptions: None |
|
3265 |
|
3266 Status: Proposal |
|
3267 |
|
3268 ------------------------------------------------------------------------------- |
|
3269 */ |
|
3270 CEventHandler::~CEventHandler() |
|
3271 { |
|
3272 |
|
3273 Cancel(); |
|
3274 |
|
3275 } |
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 /* |
|
3281 ------------------------------------------------------------------------------- |
|
3282 |
|
3283 Class: CEventHandler |
|
3284 |
|
3285 Method: StartL |
|
3286 |
|
3287 Description: Starts to monitor thread. |
|
3288 |
|
3289 Parameters: None |
|
3290 |
|
3291 Return Values: TInt Always KErrNone |
|
3292 |
|
3293 Errors/Exceptions: None |
|
3294 |
|
3295 Status: Proposal |
|
3296 |
|
3297 ------------------------------------------------------------------------------- |
|
3298 */ |
|
3299 void CEventHandler::StartL() |
|
3300 { |
|
3301 |
|
3302 __TRACE( KPrint, ( _L( "CEventHandler::StartL" ) ) ); |
|
3303 |
|
3304 if( IsActive() ) |
|
3305 { |
|
3306 CTestServer::PanicServer( EAlreadyActive ); |
|
3307 } |
|
3308 |
|
3309 iStatus = KRequestPending; |
|
3310 SetActive(); |
|
3311 |
|
3312 // Signal test thread |
|
3313 iExecution.iEventSem.Signal(); |
|
3314 |
|
3315 } |
|
3316 |
|
3317 /* |
|
3318 ------------------------------------------------------------------------------- |
|
3319 |
|
3320 Class: CEventHandler |
|
3321 |
|
3322 Method: RunL |
|
3323 |
|
3324 Description: Handles thread death. |
|
3325 Function does: |
|
3326 1 ) Stops monitoring thread |
|
3327 1 ) Marks thread death |
|
3328 2 ) Completes ongoing requests |
|
3329 3 ) Cleans the memory |
|
3330 |
|
3331 Parameters: None |
|
3332 |
|
3333 Return Values: None |
|
3334 |
|
3335 Errors/Exceptions: None |
|
3336 |
|
3337 Status: Proposal |
|
3338 |
|
3339 ------------------------------------------------------------------------------- |
|
3340 */ |
|
3341 void CEventHandler::RunL() |
|
3342 { |
|
3343 |
|
3344 __TRACE( KPrint, ( _L( "CEventHandler::RunL [%d]" ), iStatus.Int() ) ); |
|
3345 |
|
3346 switch( iExecution.EventDef().iType ) |
|
3347 { |
|
3348 case TEventDef::EEventCmd: |
|
3349 iExecution.DoNotifyEvent(); |
|
3350 break; |
|
3351 case TEventDef::EEventCmdCancel: |
|
3352 iExecution.CancelEvent(); |
|
3353 break; |
|
3354 default: |
|
3355 CTestServer::PanicServer( EUnknownEventCmd ); |
|
3356 break; |
|
3357 } |
|
3358 |
|
3359 } |
|
3360 |
|
3361 |
|
3362 /* |
|
3363 ------------------------------------------------------------------------------- |
|
3364 |
|
3365 Class: CEventHandler |
|
3366 |
|
3367 Method: DoCancel |
|
3368 |
|
3369 Description: Stops print notification listening. |
|
3370 |
|
3371 Parameters: None |
|
3372 |
|
3373 Return Values: None |
|
3374 |
|
3375 Errors/Exceptions: None |
|
3376 |
|
3377 Status: Proposal |
|
3378 |
|
3379 ------------------------------------------------------------------------------- |
|
3380 */ |
|
3381 |
|
3382 void CEventHandler::DoCancel() |
|
3383 { |
|
3384 |
|
3385 __TRACE( KPrint, ( _L( "CEventHandler::DoCancel" ) ) ); |
|
3386 |
|
3387 iExecution.iEventMutex.Wait(); // Take mutex and check test case event |
|
3388 // operation. If pending take event |
|
3389 // semaphore and complete |
|
3390 if( iStatus == KRequestPending ) |
|
3391 { |
|
3392 // Signal test thread |
|
3393 // @remove iExecution.iEventSem.Wait(); |
|
3394 |
|
3395 TRequestStatus* status = &iStatus; |
|
3396 User::RequestComplete( status, KErrCancel ); |
|
3397 |
|
3398 } |
|
3399 |
|
3400 iExecution.iEventMutex.Signal(); |
|
3401 |
|
3402 } |
|
3403 |
|
3404 /* |
|
3405 ------------------------------------------------------------------------------- |
|
3406 |
|
3407 Class: CEventHandler |
|
3408 |
|
3409 Method: RunError |
|
3410 |
|
3411 Description: Handle errors. RunL function does not leave, so one should |
|
3412 never come here. |
|
3413 |
|
3414 Print trace and let framework handle error( i.e to do Panic ) |
|
3415 |
|
3416 Parameters: TInt aError: :in: Error code |
|
3417 |
|
3418 Return Values: TInt Error code |
|
3419 |
|
3420 Errors/Exceptions: None |
|
3421 |
|
3422 Status: Proposal |
|
3423 |
|
3424 ------------------------------------------------------------------------------- |
|
3425 */ |
|
3426 TInt CEventHandler::RunError( TInt aError ) |
|
3427 { |
|
3428 |
|
3429 __TRACE( KError,( _L( "CEventHandler::RunError" ) ) ); |
|
3430 |
|
3431 return aError; |
|
3432 |
|
3433 } |
|
3434 |
|
3435 /* |
|
3436 ------------------------------------------------------------------------------- |
|
3437 |
|
3438 DESCRIPTION |
|
3439 |
|
3440 This module contains implementation of CSndHandler class member functions. |
|
3441 CSndHandler listens print notifications from test thread. |
|
3442 |
|
3443 ------------------------------------------------------------------------------- |
|
3444 */ |
|
3445 |
|
3446 // ================= MEMBER FUNCTIONS ========================================= |
|
3447 |
|
3448 |
|
3449 /* |
|
3450 ------------------------------------------------------------------------------- |
|
3451 |
|
3452 Class: CSndHandler |
|
3453 |
|
3454 Method: NewL |
|
3455 |
|
3456 Description: Constructs a new CSndHandler object. |
|
3457 |
|
3458 Parameters: CTestExecution& aExecution: in: "Parent" |
|
3459 |
|
3460 Return Values: CSndHandler*: New undertaker |
|
3461 |
|
3462 Errors/Exceptions: Leaves if memory allocation or ConstructL leaves. |
|
3463 |
|
3464 Status: Proposal |
|
3465 |
|
3466 ------------------------------------------------------------------------------- |
|
3467 */ |
|
3468 CSndHandler* CSndHandler::NewL( CTestExecution& aExecution ) |
|
3469 { |
|
3470 |
|
3471 CSndHandler* self = new( ELeave ) CSndHandler( aExecution ); |
|
3472 CleanupStack::PushL( self ); |
|
3473 self->ConstructL(); |
|
3474 CleanupStack::Pop( self ); |
|
3475 return self; |
|
3476 |
|
3477 } |
|
3478 |
|
3479 /* |
|
3480 ------------------------------------------------------------------------------- |
|
3481 |
|
3482 Class: CSndHandler |
|
3483 |
|
3484 Method: ConstructL |
|
3485 |
|
3486 Description: Second level constructor. |
|
3487 |
|
3488 Parameters: None |
|
3489 |
|
3490 Return Values: None |
|
3491 |
|
3492 Errors/Exceptions: None |
|
3493 |
|
3494 Status: Proposal |
|
3495 |
|
3496 ------------------------------------------------------------------------------- |
|
3497 */ |
|
3498 void CSndHandler::ConstructL() |
|
3499 { |
|
3500 |
|
3501 } |
|
3502 |
|
3503 /* |
|
3504 ------------------------------------------------------------------------------- |
|
3505 |
|
3506 Class: CSndHandler |
|
3507 |
|
3508 Method: CSndHandler |
|
3509 |
|
3510 Description: Constructor |
|
3511 |
|
3512 Parameters: CTestModuleContainer& aExecution :in: "Parent" |
|
3513 |
|
3514 Return Values: None |
|
3515 |
|
3516 Errors/Exceptions: None |
|
3517 |
|
3518 Status: Proposal |
|
3519 |
|
3520 ------------------------------------------------------------------------------- |
|
3521 */ |
|
3522 CSndHandler::CSndHandler( CTestExecution& aExecution ) : |
|
3523 CActive( CActive::EPriorityStandard ), |
|
3524 iExecution( aExecution ) |
|
3525 { |
|
3526 |
|
3527 CActiveScheduler::Add ( this ); |
|
3528 |
|
3529 } |
|
3530 |
|
3531 /* |
|
3532 ------------------------------------------------------------------------------- |
|
3533 |
|
3534 Class: CSndHandler |
|
3535 |
|
3536 Method: ~CSndHandler |
|
3537 |
|
3538 Description: Destructor. |
|
3539 Cancels active request. |
|
3540 |
|
3541 Parameters: None |
|
3542 |
|
3543 Return Values: None |
|
3544 |
|
3545 Errors/Exceptions: None |
|
3546 |
|
3547 Status: Proposal |
|
3548 |
|
3549 ------------------------------------------------------------------------------- |
|
3550 */ |
|
3551 CSndHandler::~CSndHandler() |
|
3552 { |
|
3553 |
|
3554 Cancel(); |
|
3555 |
|
3556 } |
|
3557 |
|
3558 |
|
3559 |
|
3560 |
|
3561 /* |
|
3562 ------------------------------------------------------------------------------- |
|
3563 |
|
3564 Class: CSndHandler |
|
3565 |
|
3566 Method: StartL |
|
3567 |
|
3568 Description: Starts to monitor thread. |
|
3569 |
|
3570 Parameters: None |
|
3571 |
|
3572 Return Values: TInt Always KErrNone |
|
3573 |
|
3574 Errors/Exceptions: None |
|
3575 |
|
3576 Status: Proposal |
|
3577 |
|
3578 ------------------------------------------------------------------------------- |
|
3579 */ |
|
3580 void CSndHandler::StartL() |
|
3581 { |
|
3582 |
|
3583 __TRACE( KPrint, ( _L( "CSndHandler::StartL" ) ) ); |
|
3584 |
|
3585 if( IsActive() ) |
|
3586 { |
|
3587 CTestServer::PanicServer( EAlreadyActive ); |
|
3588 } |
|
3589 |
|
3590 iStatus = KRequestPending; |
|
3591 SetActive(); |
|
3592 |
|
3593 // Signal test thread |
|
3594 iExecution.iSndSem.Signal(); |
|
3595 |
|
3596 } |
|
3597 |
|
3598 /* |
|
3599 ------------------------------------------------------------------------------- |
|
3600 |
|
3601 Class: CSndHandler |
|
3602 |
|
3603 Method: RunL |
|
3604 |
|
3605 Description: Handles thread death. |
|
3606 Function does: |
|
3607 1 ) Stops monitoring thread |
|
3608 1 ) Marks thread death |
|
3609 2 ) Completes ongoing requests |
|
3610 3 ) Cleans the memory |
|
3611 |
|
3612 Parameters: None |
|
3613 |
|
3614 Return Values: None |
|
3615 |
|
3616 Errors/Exceptions: None |
|
3617 |
|
3618 Status: Proposal |
|
3619 |
|
3620 ------------------------------------------------------------------------------- |
|
3621 */ |
|
3622 void CSndHandler::RunL() |
|
3623 { |
|
3624 |
|
3625 __TRACE( KPrint, ( _L( "CSndHandler::RunL [%d]" ), iStatus.Int() ) ); |
|
3626 |
|
3627 iExecution.DoRemoteSend(); |
|
3628 |
|
3629 } |
|
3630 |
|
3631 |
|
3632 /* |
|
3633 ------------------------------------------------------------------------------- |
|
3634 |
|
3635 Class: CSndHandler |
|
3636 |
|
3637 Method: DoCancel |
|
3638 |
|
3639 Description: Stops print notification listening. |
|
3640 |
|
3641 Parameters: None |
|
3642 |
|
3643 Return Values: None |
|
3644 |
|
3645 Errors/Exceptions: None |
|
3646 |
|
3647 Status: Proposal |
|
3648 |
|
3649 ------------------------------------------------------------------------------- |
|
3650 */ |
|
3651 |
|
3652 void CSndHandler::DoCancel() |
|
3653 { |
|
3654 |
|
3655 __TRACE( KPrint, ( _L( "CSndHandler::DoCancel" ) ) ); |
|
3656 |
|
3657 iExecution.iSndMutex.Wait(); // Take mutex and check test case send |
|
3658 // operation. If pending take send |
|
3659 // semaphore and complete |
|
3660 if( iStatus == KRequestPending ) |
|
3661 { |
|
3662 // Signal test thread |
|
3663 // @remove iExecution.iSndSem.Wait(); |
|
3664 |
|
3665 TRequestStatus* status = &iStatus; |
|
3666 User::RequestComplete( status, KErrCancel ); |
|
3667 |
|
3668 } |
|
3669 |
|
3670 iExecution.iSndMutex.Signal(); |
|
3671 |
|
3672 } |
|
3673 |
|
3674 /* |
|
3675 ------------------------------------------------------------------------------- |
|
3676 |
|
3677 Class: CSndHandler |
|
3678 |
|
3679 Method: RunError |
|
3680 |
|
3681 Description: Handle errors. RunL function does not leave, so one should |
|
3682 never come here. |
|
3683 |
|
3684 Print trace and let framework handle error( i.e to do Panic ) |
|
3685 |
|
3686 Parameters: TInt aError: :in: Error code |
|
3687 |
|
3688 Return Values: TInt Error code |
|
3689 |
|
3690 Errors/Exceptions: None |
|
3691 |
|
3692 Status: Proposal |
|
3693 |
|
3694 ------------------------------------------------------------------------------- |
|
3695 */ |
|
3696 TInt CSndHandler::RunError( TInt aError ) |
|
3697 { |
|
3698 |
|
3699 __TRACE( KError,( _L( "CSndHandler::RunError" ) ) ); |
|
3700 |
|
3701 return aError; |
|
3702 |
|
3703 } |
|
3704 |
|
3705 /* |
|
3706 ------------------------------------------------------------------------------- |
|
3707 |
|
3708 DESCRIPTION |
|
3709 |
|
3710 This module contains implementation of CSndHandler class member functions. |
|
3711 CRcvHandler listens print notifications from test thread. |
|
3712 |
|
3713 ------------------------------------------------------------------------------- |
|
3714 */ |
|
3715 |
|
3716 // ================= MEMBER FUNCTIONS ========================================= |
|
3717 |
|
3718 |
|
3719 /* |
|
3720 ------------------------------------------------------------------------------- |
|
3721 |
|
3722 Class: CRcvHandler |
|
3723 |
|
3724 Method: NewL |
|
3725 |
|
3726 Description: Constructs a new CRcvHandler object. |
|
3727 |
|
3728 Parameters: CTestExecution& aExecution: in: "Parent" |
|
3729 |
|
3730 Return Values: CRcvHandler*: New undertaker |
|
3731 |
|
3732 Errors/Exceptions: Leaves if memory allocation or ConstructL leaves. |
|
3733 |
|
3734 Status: Proposal |
|
3735 |
|
3736 ------------------------------------------------------------------------------- |
|
3737 */ |
|
3738 CRcvHandler* CRcvHandler::NewL( CTestExecution& aExecution ) |
|
3739 { |
|
3740 |
|
3741 CRcvHandler* self = new( ELeave ) CRcvHandler( aExecution ); |
|
3742 CleanupStack::PushL( self ); |
|
3743 self->ConstructL(); |
|
3744 CleanupStack::Pop( self ); |
|
3745 return self; |
|
3746 |
|
3747 } |
|
3748 |
|
3749 /* |
|
3750 ------------------------------------------------------------------------------- |
|
3751 |
|
3752 Class: CRcvHandler |
|
3753 |
|
3754 Method: ConstructL |
|
3755 |
|
3756 Description: Second level constructor. |
|
3757 |
|
3758 Parameters: None |
|
3759 |
|
3760 Return Values: None |
|
3761 |
|
3762 Errors/Exceptions: None |
|
3763 |
|
3764 Status: Proposal |
|
3765 |
|
3766 ------------------------------------------------------------------------------- |
|
3767 */ |
|
3768 void CRcvHandler::ConstructL() |
|
3769 { |
|
3770 |
|
3771 } |
|
3772 |
|
3773 /* |
|
3774 ------------------------------------------------------------------------------- |
|
3775 |
|
3776 Class: CRcvHandler |
|
3777 |
|
3778 Method: CRcvHandler |
|
3779 |
|
3780 Description: Constructor |
|
3781 |
|
3782 Parameters: CTestModuleContainer& aExecution :in: "Parent" |
|
3783 |
|
3784 Return Values: None |
|
3785 |
|
3786 Errors/Exceptions: None |
|
3787 |
|
3788 Status: Proposal |
|
3789 |
|
3790 ------------------------------------------------------------------------------- |
|
3791 */ |
|
3792 CRcvHandler::CRcvHandler( CTestExecution& aExecution ) : |
|
3793 CActive( CActive::EPriorityStandard ), |
|
3794 iExecution( aExecution ) |
|
3795 { |
|
3796 |
|
3797 CActiveScheduler::Add ( this ); |
|
3798 |
|
3799 } |
|
3800 |
|
3801 /* |
|
3802 ------------------------------------------------------------------------------- |
|
3803 |
|
3804 Class: CRcvHandler |
|
3805 |
|
3806 Method: ~CRcvHandler |
|
3807 |
|
3808 Description: Destructor. |
|
3809 Cancels active request. |
|
3810 |
|
3811 Parameters: None |
|
3812 |
|
3813 Return Values: None |
|
3814 |
|
3815 Errors/Exceptions: None |
|
3816 |
|
3817 Status: Proposal |
|
3818 |
|
3819 ------------------------------------------------------------------------------- |
|
3820 */ |
|
3821 CRcvHandler::~CRcvHandler() |
|
3822 { |
|
3823 |
|
3824 Cancel(); |
|
3825 |
|
3826 } |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 /* |
|
3832 ------------------------------------------------------------------------------- |
|
3833 |
|
3834 Class: CRcvHandler |
|
3835 |
|
3836 Method: StartL |
|
3837 |
|
3838 Description: Starts to monitor thread. |
|
3839 |
|
3840 Parameters: None |
|
3841 |
|
3842 Return Values: TInt Always KErrNone |
|
3843 |
|
3844 Errors/Exceptions: None |
|
3845 |
|
3846 Status: Proposal |
|
3847 |
|
3848 ------------------------------------------------------------------------------- |
|
3849 */ |
|
3850 void CRcvHandler::StartL() |
|
3851 { |
|
3852 |
|
3853 __TRACE( KPrint, ( _L( "CRcvHandler::StartL" ) ) ); |
|
3854 |
|
3855 if( IsActive() ) |
|
3856 { |
|
3857 CTestServer::PanicServer( EAlreadyActive ); |
|
3858 } |
|
3859 iStatus = KRequestPending; |
|
3860 SetActive(); |
|
3861 |
|
3862 // Signal test thread |
|
3863 iExecution.iRcvSem.Signal(); |
|
3864 |
|
3865 } |
|
3866 |
|
3867 /* |
|
3868 ------------------------------------------------------------------------------- |
|
3869 |
|
3870 Class: CRcvHandler |
|
3871 |
|
3872 Method: RunL |
|
3873 |
|
3874 Description: Handles thread death. |
|
3875 Function does: |
|
3876 1 ) Stops monitoring thread |
|
3877 1 ) Marks thread death |
|
3878 2 ) Completes ongoing requests |
|
3879 3 ) Cleans the memory |
|
3880 |
|
3881 Parameters: None |
|
3882 |
|
3883 Return Values: None |
|
3884 |
|
3885 Errors/Exceptions: None |
|
3886 |
|
3887 Status: Proposal |
|
3888 |
|
3889 ------------------------------------------------------------------------------- |
|
3890 */ |
|
3891 void CRcvHandler::RunL() |
|
3892 { |
|
3893 |
|
3894 __TRACE( KPrint, ( _L( "CRcvHandler::RunL [%d]" ), iStatus.Int() ) ); |
|
3895 |
|
3896 iExecution.DoRemoteReceive(); |
|
3897 |
|
3898 } |
|
3899 |
|
3900 |
|
3901 /* |
|
3902 ------------------------------------------------------------------------------- |
|
3903 |
|
3904 Class: CRcvHandler |
|
3905 |
|
3906 Method: DoCancel |
|
3907 |
|
3908 Description: Stops print notification listening. |
|
3909 |
|
3910 Parameters: None |
|
3911 |
|
3912 Return Values: None |
|
3913 |
|
3914 Errors/Exceptions: None |
|
3915 |
|
3916 Status: Proposal |
|
3917 |
|
3918 ------------------------------------------------------------------------------- |
|
3919 */ |
|
3920 |
|
3921 void CRcvHandler::DoCancel() |
|
3922 { |
|
3923 |
|
3924 __TRACE( KPrint, ( _L( "CRcvHandler::DoCancel" ) ) ); |
|
3925 |
|
3926 iExecution.iRcvMutex.Wait(); // Take mutex and check test case receive |
|
3927 // operation. If pending take reveive |
|
3928 // semaphore and complete |
|
3929 if( iStatus == KRequestPending ) |
|
3930 { |
|
3931 // Signal test thread |
|
3932 // @remove iExecution.iRcvSem.Wait(); |
|
3933 |
|
3934 TRequestStatus* status = &iStatus; |
|
3935 User::RequestComplete( status, KErrCancel ); |
|
3936 } |
|
3937 |
|
3938 iExecution.iRcvMutex.Signal(); |
|
3939 |
|
3940 } |
|
3941 |
|
3942 /* |
|
3943 ------------------------------------------------------------------------------- |
|
3944 |
|
3945 Class: CRcvHandler |
|
3946 |
|
3947 Method: RunError |
|
3948 |
|
3949 Description: Handle errors. RunL function does not leave, so one should |
|
3950 never come here. |
|
3951 |
|
3952 Print trace and let framework handle error( i.e to do Panic ) |
|
3953 |
|
3954 Parameters: TInt aError: :in: Error code |
|
3955 |
|
3956 Return Values: TInt Error code |
|
3957 |
|
3958 Errors/Exceptions: None |
|
3959 |
|
3960 Status: Proposal |
|
3961 |
|
3962 ------------------------------------------------------------------------------- |
|
3963 */ |
|
3964 TInt CRcvHandler::RunError( TInt aError ) |
|
3965 { |
|
3966 |
|
3967 __TRACE( KError,( _L( "CRcvHandler::RunError" ) ) ); |
|
3968 |
|
3969 return aError; |
|
3970 |
|
3971 } |
|
3972 |
|
3973 |
|
3974 /* |
|
3975 ------------------------------------------------------------------------------- |
|
3976 |
|
3977 DESCRIPTION |
|
3978 |
|
3979 This module contains implementation of CTestInterferenceHandler class |
|
3980 member functions. CTestInterferenceHandler listens print notifications from |
|
3981 test thread. |
|
3982 |
|
3983 ------------------------------------------------------------------------------- |
|
3984 */ |
|
3985 |
|
3986 // ================= MEMBER FUNCTIONS ========================================= |
|
3987 |
|
3988 |
|
3989 /* |
|
3990 ------------------------------------------------------------------------------- |
|
3991 |
|
3992 Class: CInterferenceHandler |
|
3993 |
|
3994 Method: NewL |
|
3995 |
|
3996 Description: Constructs a new CInterferenceHandler object. |
|
3997 |
|
3998 Parameters: CTestExecution& aExecution: in: "Parent" |
|
3999 |
|
4000 Return Values: CInterferenceHandler*: New undertaker |
|
4001 |
|
4002 Errors/Exceptions: Leaves if memory allocation or ConstructL leaves. |
|
4003 |
|
4004 Status: Proposal |
|
4005 |
|
4006 ------------------------------------------------------------------------------- |
|
4007 */ |
|
4008 CInterferenceHandler* CInterferenceHandler::NewL( |
|
4009 CTestExecution& aExecution ) |
|
4010 { |
|
4011 CInterferenceHandler* self = |
|
4012 new( ELeave ) CInterferenceHandler( aExecution ); |
|
4013 CleanupStack::PushL( self ); |
|
4014 self->ConstructL(); |
|
4015 CleanupStack::Pop( self ); |
|
4016 return self; |
|
4017 |
|
4018 } |
|
4019 |
|
4020 /* |
|
4021 ------------------------------------------------------------------------------- |
|
4022 |
|
4023 Class: CInterferenceHandler |
|
4024 |
|
4025 Method: ConstructL |
|
4026 |
|
4027 Description: Second level constructor. |
|
4028 |
|
4029 Parameters: None |
|
4030 |
|
4031 Return Values: None |
|
4032 |
|
4033 Errors/Exceptions: None |
|
4034 |
|
4035 Status: Proposal |
|
4036 |
|
4037 ------------------------------------------------------------------------------- |
|
4038 */ |
|
4039 void CInterferenceHandler::ConstructL() |
|
4040 { |
|
4041 |
|
4042 } |
|
4043 |
|
4044 /* |
|
4045 ------------------------------------------------------------------------------- |
|
4046 |
|
4047 Class: CInterferenceHandler |
|
4048 |
|
4049 Method: CInterferenceHandler |
|
4050 |
|
4051 Description: Constructor |
|
4052 |
|
4053 Parameters: CTestModuleContainer& aExecution :in: "Parent" |
|
4054 |
|
4055 Return Values: None |
|
4056 |
|
4057 Errors/Exceptions: None |
|
4058 |
|
4059 Status: Proposal |
|
4060 |
|
4061 ------------------------------------------------------------------------------- |
|
4062 */ |
|
4063 CInterferenceHandler::CInterferenceHandler( CTestExecution& aExecution ) : |
|
4064 CActive( CActive::EPriorityStandard ), |
|
4065 iExecution( aExecution ) |
|
4066 { |
|
4067 CActiveScheduler::Add ( this ); |
|
4068 |
|
4069 } |
|
4070 |
|
4071 /* |
|
4072 ------------------------------------------------------------------------------- |
|
4073 |
|
4074 Class: CInterferenceHandler |
|
4075 |
|
4076 Method: ~CInterferenceHandler |
|
4077 |
|
4078 Description: Destructor. |
|
4079 Cancels active request. |
|
4080 |
|
4081 Parameters: None |
|
4082 |
|
4083 Return Values: None |
|
4084 |
|
4085 Errors/Exceptions: None |
|
4086 |
|
4087 Status: Proposal |
|
4088 |
|
4089 ------------------------------------------------------------------------------- |
|
4090 */ |
|
4091 CInterferenceHandler::~CInterferenceHandler() |
|
4092 { |
|
4093 Cancel(); |
|
4094 |
|
4095 } |
|
4096 |
|
4097 /* |
|
4098 ------------------------------------------------------------------------------- |
|
4099 |
|
4100 Class: CInterferenceHandler |
|
4101 |
|
4102 Method: StartL |
|
4103 |
|
4104 Description: Starts to monitor thread. |
|
4105 |
|
4106 Parameters: None |
|
4107 |
|
4108 Return Values: TInt: Always KErrNone |
|
4109 |
|
4110 Errors/Exceptions: None |
|
4111 |
|
4112 Status: Proposal |
|
4113 |
|
4114 ------------------------------------------------------------------------------- |
|
4115 */ |
|
4116 void CInterferenceHandler::StartL() |
|
4117 { |
|
4118 __TRACE( KPrint, ( _L( "CInterferenceHandler::StartL" ) ) ); |
|
4119 |
|
4120 if( IsActive() ) |
|
4121 { |
|
4122 CTestServer::PanicServer( EAlreadyActive ); |
|
4123 } |
|
4124 |
|
4125 iStatus = KRequestPending; |
|
4126 SetActive(); |
|
4127 |
|
4128 // Signal test thread, Notify test thread that operation is done. |
|
4129 iExecution.iInterferenceSem.Signal(); |
|
4130 |
|
4131 } |
|
4132 |
|
4133 /* |
|
4134 ------------------------------------------------------------------------------- |
|
4135 |
|
4136 Class: CInterferenceHandler |
|
4137 |
|
4138 Method: RunL |
|
4139 |
|
4140 Description: Handles thread death. |
|
4141 Function does: |
|
4142 1 ) Stops monitoring thread |
|
4143 1 ) Marks thread death |
|
4144 2 ) Completes ongoing requests |
|
4145 3 ) Cleans the memory |
|
4146 |
|
4147 Parameters: None |
|
4148 |
|
4149 Return Values: None |
|
4150 |
|
4151 Errors/Exceptions: None |
|
4152 |
|
4153 Status: Proposal |
|
4154 |
|
4155 ------------------------------------------------------------------------------- |
|
4156 */ |
|
4157 void CInterferenceHandler::RunL() |
|
4158 { |
|
4159 __TRACE( KPrint, ( _L( "CInterferenceHandler::RunL [%d]" ), iStatus.Int() ) ); |
|
4160 |
|
4161 iExecution.DoNotifyInterference(); |
|
4162 |
|
4163 StartL(); |
|
4164 |
|
4165 } |
|
4166 |
|
4167 /* |
|
4168 ------------------------------------------------------------------------------- |
|
4169 |
|
4170 Class: CInterferenceHandler |
|
4171 |
|
4172 Method: DoCancel |
|
4173 |
|
4174 Description: Stops interference notification listening. |
|
4175 |
|
4176 Parameters: None |
|
4177 |
|
4178 Return Values: None |
|
4179 |
|
4180 Errors/Exceptions: None |
|
4181 |
|
4182 Status: Proposal |
|
4183 |
|
4184 ------------------------------------------------------------------------------- |
|
4185 */ |
|
4186 void CInterferenceHandler::DoCancel() |
|
4187 { |
|
4188 __TRACE( KPrint, ( _L( "CInterferenceHandler::DoCancel" ) ) ); |
|
4189 |
|
4190 iExecution.iInterferenceMutex.Wait(); // Take mutex and check test |
|
4191 // interference operation. If |
|
4192 // pending take interference |
|
4193 // semaphore and complete |
|
4194 if( iStatus == KRequestPending ) |
|
4195 { |
|
4196 |
|
4197 TRequestStatus* status = &iStatus; |
|
4198 User::RequestComplete( status, KErrCancel ); |
|
4199 } |
|
4200 |
|
4201 iExecution.iInterferenceMutex.Signal(); |
|
4202 |
|
4203 } |
|
4204 |
|
4205 /* |
|
4206 ------------------------------------------------------------------------------- |
|
4207 |
|
4208 Class: CInterferenceHandler |
|
4209 |
|
4210 Method: RunError |
|
4211 |
|
4212 Description: Handle errors. RunL function does not leave, so one should |
|
4213 never come here. |
|
4214 |
|
4215 Print trace and let framework handle error( i.e to do Panic ) |
|
4216 |
|
4217 Parameters: TInt aError: in: Error code |
|
4218 |
|
4219 Return Values: TInt: Error code |
|
4220 |
|
4221 Errors/Exceptions: None |
|
4222 |
|
4223 Status: Proposal |
|
4224 |
|
4225 ------------------------------------------------------------------------------- |
|
4226 */ |
|
4227 TInt CInterferenceHandler::RunError( TInt aError ) |
|
4228 { |
|
4229 __TRACE( KError,( _L( "CTestInterferenceHandler::RunError" ) ) ); |
|
4230 |
|
4231 return aError; |
|
4232 |
|
4233 } |
|
4234 |
|
4235 /* |
|
4236 ------------------------------------------------------------------------------- |
|
4237 |
|
4238 DESCRIPTION |
|
4239 |
|
4240 This module contains implementation of CMeasurementHandler class |
|
4241 member functions. CMeasurementHandler handles test measurement operations |
|
4242 that comes from test execution side to TestServer side. |
|
4243 |
|
4244 ------------------------------------------------------------------------------- |
|
4245 */ |
|
4246 |
|
4247 // ================= MEMBER FUNCTIONS ========================================= |
|
4248 |
|
4249 |
|
4250 /* |
|
4251 ------------------------------------------------------------------------------- |
|
4252 |
|
4253 Class: CMeasurementHandler |
|
4254 |
|
4255 Method: NewL |
|
4256 |
|
4257 Description: Constructs a new CMeasurementHandler object. |
|
4258 |
|
4259 Parameters: CTestExecution& aExecution: in: Pointer to test execution side. |
|
4260 |
|
4261 Return Values: CMeasurementHandler*: New undertaker |
|
4262 |
|
4263 Errors/Exceptions: Leaves if memory allocation or ConstructL leaves. |
|
4264 |
|
4265 Status: Approved |
|
4266 |
|
4267 ------------------------------------------------------------------------------- |
|
4268 */ |
|
4269 CMeasurementHandler* CMeasurementHandler::NewL( CTestExecution& aExecution ) |
|
4270 { |
|
4271 CMeasurementHandler* self = |
|
4272 new( ELeave ) CMeasurementHandler( aExecution ); |
|
4273 CleanupStack::PushL( self ); |
|
4274 self->ConstructL(); |
|
4275 CleanupStack::Pop( self ); |
|
4276 return self; |
|
4277 |
|
4278 } |
|
4279 |
|
4280 /* |
|
4281 ------------------------------------------------------------------------------- |
|
4282 |
|
4283 Class: CMeasurementHandler |
|
4284 |
|
4285 Method: ConstructL |
|
4286 |
|
4287 Description: Second level constructor. |
|
4288 |
|
4289 Parameters: None |
|
4290 |
|
4291 Return Values: None |
|
4292 |
|
4293 Errors/Exceptions: None |
|
4294 |
|
4295 Status: Approved |
|
4296 |
|
4297 ------------------------------------------------------------------------------- |
|
4298 */ |
|
4299 void CMeasurementHandler::ConstructL() |
|
4300 { |
|
4301 |
|
4302 } |
|
4303 |
|
4304 /* |
|
4305 ------------------------------------------------------------------------------- |
|
4306 |
|
4307 Class: CMeasurementHandler |
|
4308 |
|
4309 Method: CMeasurementHandler |
|
4310 |
|
4311 Description: Constructor |
|
4312 |
|
4313 Parameters: CTestModuleContainer& aExecution :in: Pointer to test |
|
4314 execution side. |
|
4315 |
|
4316 Return Values: None |
|
4317 |
|
4318 Errors/Exceptions: None |
|
4319 |
|
4320 Status: Approved |
|
4321 |
|
4322 ------------------------------------------------------------------------------- |
|
4323 */ |
|
4324 CMeasurementHandler::CMeasurementHandler( CTestExecution& aExecution ) : |
|
4325 CActive( CActive::EPriorityStandard ), |
|
4326 iExecution( aExecution ) |
|
4327 { |
|
4328 CActiveScheduler::Add ( this ); |
|
4329 |
|
4330 } |
|
4331 |
|
4332 /* |
|
4333 ------------------------------------------------------------------------------- |
|
4334 |
|
4335 Class: CMeasurementHandler |
|
4336 |
|
4337 Method: ~CMeasurementHandler |
|
4338 |
|
4339 Description: Destructor. |
|
4340 Cancels active request. |
|
4341 |
|
4342 Parameters: None |
|
4343 |
|
4344 Return Values: None |
|
4345 |
|
4346 Errors/Exceptions: None |
|
4347 |
|
4348 Status: Approved |
|
4349 |
|
4350 ------------------------------------------------------------------------------- |
|
4351 */ |
|
4352 CMeasurementHandler::~CMeasurementHandler() |
|
4353 { |
|
4354 Cancel(); |
|
4355 |
|
4356 } |
|
4357 |
|
4358 /* |
|
4359 ------------------------------------------------------------------------------- |
|
4360 |
|
4361 Class: CMeasurementHandler |
|
4362 |
|
4363 Method: StartL |
|
4364 |
|
4365 Description: Starts to monitor thread. |
|
4366 |
|
4367 Parameters: None |
|
4368 |
|
4369 Return Values: TInt: Always KErrNone |
|
4370 |
|
4371 Errors/Exceptions: None |
|
4372 |
|
4373 Status: Approved |
|
4374 |
|
4375 ------------------------------------------------------------------------------- |
|
4376 */ |
|
4377 void CMeasurementHandler::StartL() |
|
4378 { |
|
4379 __TRACE( KPrint, ( _L( "CMeasurementHandler::StartL" ) ) ); |
|
4380 |
|
4381 if( IsActive() ) |
|
4382 { |
|
4383 CTestServer::PanicServer( EAlreadyActive ); |
|
4384 } |
|
4385 |
|
4386 iStatus = KRequestPending; |
|
4387 SetActive(); |
|
4388 |
|
4389 // Do not Signal here because synchronous operations will be executed and we |
|
4390 // don't want to signal at first time: iExecution.iMeasurementSem.Signal(); |
|
4391 // Signal() operation will be handled in RunL in this case. |
|
4392 |
|
4393 } |
|
4394 |
|
4395 /* |
|
4396 ------------------------------------------------------------------------------- |
|
4397 |
|
4398 Class: CMeasurementHandler |
|
4399 |
|
4400 Method: RunL |
|
4401 |
|
4402 Description: Derived from CActive, handles test measurement execution. |
|
4403 |
|
4404 Parameters: None |
|
4405 |
|
4406 Return Values: None |
|
4407 |
|
4408 Errors/Exceptions: None |
|
4409 |
|
4410 Status: Approved |
|
4411 |
|
4412 ------------------------------------------------------------------------------- |
|
4413 */ |
|
4414 void CMeasurementHandler::RunL() |
|
4415 { |
|
4416 __TRACE( KPrint, ( _L( "CMeasurementHandler::RunL [%d]" ), iStatus.Int() ) ); |
|
4417 |
|
4418 TInt ret( 0 ); |
|
4419 ret = iExecution.DoNotifyMeasurement(); |
|
4420 |
|
4421 // ret value is copied to struct so it can be handled later. |
|
4422 iExecution.iTestMeasurement.iMeasurementStruct.iOperationResult = ret; |
|
4423 |
|
4424 // SetActive again |
|
4425 StartL(); |
|
4426 |
|
4427 // TestServer side operations are done, Signal that operation is done. |
|
4428 iExecution.iMeasurementSem.Signal(); |
|
4429 |
|
4430 } |
|
4431 |
|
4432 /* |
|
4433 ------------------------------------------------------------------------------- |
|
4434 |
|
4435 Class: CMeasurementHandler |
|
4436 |
|
4437 Method: DoCancel |
|
4438 |
|
4439 Description: Stops measurement notification listening. |
|
4440 |
|
4441 Parameters: None |
|
4442 |
|
4443 Return Values: None |
|
4444 |
|
4445 Errors/Exceptions: None |
|
4446 |
|
4447 Status: Approved |
|
4448 |
|
4449 ------------------------------------------------------------------------------- |
|
4450 */ |
|
4451 void CMeasurementHandler::DoCancel() |
|
4452 { |
|
4453 __TRACE( KPrint, ( _L( "CMeasurementHandler::DoCancel" ) ) ); |
|
4454 |
|
4455 iExecution.iMeasurementMutex.Wait(); // Take mutex and check test |
|
4456 // measurement operation. If |
|
4457 // pending take measurement |
|
4458 // semaphore and complete |
|
4459 if( iStatus == KRequestPending ) |
|
4460 { |
|
4461 |
|
4462 TRequestStatus* status = &iStatus; |
|
4463 User::RequestComplete( status, KErrCancel ); |
|
4464 } |
|
4465 |
|
4466 iExecution.iMeasurementMutex.Signal(); |
|
4467 |
|
4468 } |
|
4469 |
|
4470 /* |
|
4471 ------------------------------------------------------------------------------- |
|
4472 |
|
4473 Class: CMeasurementHandler |
|
4474 |
|
4475 Method: RunError |
|
4476 |
|
4477 Description: Handle errors. RunL function does not leave, so one should |
|
4478 never come here. |
|
4479 |
|
4480 Print trace and let framework handle error( i.e to do Panic ) |
|
4481 |
|
4482 Parameters: TInt aError: in: Error code |
|
4483 |
|
4484 Return Values: TInt: Error code |
|
4485 |
|
4486 Errors/Exceptions: None |
|
4487 |
|
4488 Status: Approved |
|
4489 |
|
4490 ------------------------------------------------------------------------------- |
|
4491 */ |
|
4492 TInt CMeasurementHandler::RunError( TInt aError ) |
|
4493 { |
|
4494 __TRACE( KError,( |
|
4495 _L( "CMeasurementHandler::RunError with error: %d" ), aError ) ); |
|
4496 |
|
4497 return aError; |
|
4498 |
|
4499 } |
|
4500 |
|
4501 /* |
|
4502 ------------------------------------------------------------------------------- |
|
4503 |
|
4504 DESCRIPTION |
|
4505 |
|
4506 This module contains implementation of CCommandHandler class member functions. |
|
4507 CCommandHandler listens command notifications from test thread. |
|
4508 |
|
4509 ------------------------------------------------------------------------------- |
|
4510 */ |
|
4511 |
|
4512 // ================= MEMBER FUNCTIONS ========================================= |
|
4513 |
|
4514 |
|
4515 /* |
|
4516 ------------------------------------------------------------------------------- |
|
4517 |
|
4518 Class: CCommandHandler |
|
4519 |
|
4520 Method: NewL |
|
4521 |
|
4522 Description: Constructs a new CCommandHandler object. |
|
4523 |
|
4524 Parameters: CTestExecution& aExecution: in: "Parent" |
|
4525 |
|
4526 Return Values: CCommandHandler*: New object |
|
4527 |
|
4528 Errors/Exceptions: Leaves if memory allocation or ConstructL leaves. |
|
4529 |
|
4530 Status: Proposal |
|
4531 |
|
4532 ------------------------------------------------------------------------------- |
|
4533 */ |
|
4534 CCommandHandler* CCommandHandler::NewL(CTestExecution& aExecution) |
|
4535 { |
|
4536 CCommandHandler* self = new (ELeave) CCommandHandler(aExecution); |
|
4537 CleanupStack::PushL(self); |
|
4538 self->ConstructL(); |
|
4539 CleanupStack::Pop(self); |
|
4540 return self; |
|
4541 } |
|
4542 |
|
4543 /* |
|
4544 ------------------------------------------------------------------------------- |
|
4545 |
|
4546 Class: CCommandHandler |
|
4547 |
|
4548 Method: ConstructL |
|
4549 |
|
4550 Description: Second level constructor. |
|
4551 |
|
4552 Parameters: None |
|
4553 |
|
4554 Return Values: None |
|
4555 |
|
4556 Errors/Exceptions: None |
|
4557 |
|
4558 Status: Proposal |
|
4559 |
|
4560 ------------------------------------------------------------------------------- |
|
4561 */ |
|
4562 void CCommandHandler::ConstructL() |
|
4563 { |
|
4564 } |
|
4565 |
|
4566 /* |
|
4567 ------------------------------------------------------------------------------- |
|
4568 |
|
4569 Class: CCommandHandler |
|
4570 |
|
4571 Method: CCommandHandler |
|
4572 |
|
4573 Description: Constructor |
|
4574 |
|
4575 Parameters: CTestExecution& aExecution :in: "Parent" |
|
4576 |
|
4577 Return Values: None |
|
4578 |
|
4579 Errors/Exceptions: None |
|
4580 |
|
4581 Status: Proposal |
|
4582 |
|
4583 ------------------------------------------------------------------------------- |
|
4584 */ |
|
4585 CCommandHandler::CCommandHandler(CTestExecution& aExecution): |
|
4586 CActive(CActive::EPriorityStandard), |
|
4587 iExecution(aExecution) |
|
4588 { |
|
4589 CActiveScheduler::Add (this); |
|
4590 } |
|
4591 |
|
4592 /* |
|
4593 ------------------------------------------------------------------------------- |
|
4594 |
|
4595 Class: CCommandHandler |
|
4596 |
|
4597 Method: ~CCommandHandler |
|
4598 |
|
4599 Description: Destructor. |
|
4600 Cancels active request. |
|
4601 |
|
4602 Parameters: None |
|
4603 |
|
4604 Return Values: None |
|
4605 |
|
4606 Errors/Exceptions: None |
|
4607 |
|
4608 Status: Proposal |
|
4609 |
|
4610 ------------------------------------------------------------------------------- |
|
4611 */ |
|
4612 CCommandHandler::~CCommandHandler() |
|
4613 { |
|
4614 Cancel(); |
|
4615 } |
|
4616 |
|
4617 /* |
|
4618 ------------------------------------------------------------------------------- |
|
4619 |
|
4620 Class: CCommandHandler |
|
4621 |
|
4622 Method: StartL |
|
4623 |
|
4624 Description: Starts to monitor thread. |
|
4625 |
|
4626 Parameters: None |
|
4627 |
|
4628 Return Values: None |
|
4629 |
|
4630 Errors/Exceptions: None |
|
4631 |
|
4632 Status: Proposal |
|
4633 |
|
4634 ------------------------------------------------------------------------------- |
|
4635 */ |
|
4636 void CCommandHandler::StartL() |
|
4637 { |
|
4638 __TRACE(KPrint, (_L( "CCommandHandler::StartL" ))); |
|
4639 |
|
4640 if(IsActive()) |
|
4641 { |
|
4642 CTestServer::PanicServer(EAlreadyActive); |
|
4643 } |
|
4644 iStatus = KRequestPending; |
|
4645 SetActive(); |
|
4646 |
|
4647 // Signal test thread |
|
4648 iExecution.iCommandSem.Signal(); |
|
4649 } |
|
4650 |
|
4651 /* |
|
4652 ------------------------------------------------------------------------------- |
|
4653 |
|
4654 Class: CCommandHandler |
|
4655 |
|
4656 Method: RunL |
|
4657 |
|
4658 Description: |
|
4659 |
|
4660 Parameters: None |
|
4661 |
|
4662 Return Values: None |
|
4663 |
|
4664 Errors/Exceptions: None |
|
4665 |
|
4666 Status: Proposal |
|
4667 |
|
4668 ------------------------------------------------------------------------------- |
|
4669 */ |
|
4670 void CCommandHandler::RunL() |
|
4671 { |
|
4672 __TRACE(KPrint, (_L( "CCommandHandler::RunL [%d]"), iStatus.Int())); |
|
4673 |
|
4674 iExecution.DoNotifyCommand(); |
|
4675 // StartL(); |
|
4676 } |
|
4677 |
|
4678 |
|
4679 /* |
|
4680 ------------------------------------------------------------------------------- |
|
4681 |
|
4682 Class: CCommandHandler |
|
4683 |
|
4684 Method: DoCancel |
|
4685 |
|
4686 Description: Stops command notification listening. |
|
4687 |
|
4688 Parameters: None |
|
4689 |
|
4690 Return Values: None |
|
4691 |
|
4692 Errors/Exceptions: None |
|
4693 |
|
4694 Status: Proposal |
|
4695 |
|
4696 ------------------------------------------------------------------------------- |
|
4697 */ |
|
4698 |
|
4699 void CCommandHandler::DoCancel() |
|
4700 { |
|
4701 __TRACE(KPrint, (_L("CCommandHandler::DoCancel"))); |
|
4702 |
|
4703 iExecution.iCommandMutex.Wait(); // Take mutex and check test case receive |
|
4704 // operation. If pending take reveive |
|
4705 // semaphore and complete |
|
4706 if(iStatus == KRequestPending) |
|
4707 { |
|
4708 TRequestStatus* status = &iStatus; |
|
4709 User::RequestComplete(status, KErrCancel); |
|
4710 } |
|
4711 |
|
4712 iExecution.iCommandMutex.Signal(); |
|
4713 } |
|
4714 |
|
4715 /* |
|
4716 ------------------------------------------------------------------------------- |
|
4717 |
|
4718 Class: CCommandHandler |
|
4719 |
|
4720 Method: RunError |
|
4721 |
|
4722 Description: Handle errors. RunL function does not leave, so one should |
|
4723 never come here. |
|
4724 |
|
4725 Print trace and let framework handle error( i.e to do Panic ) |
|
4726 |
|
4727 Parameters: TInt aError: :in: Error code |
|
4728 |
|
4729 Return Values: TInt Error code |
|
4730 |
|
4731 Errors/Exceptions: None |
|
4732 |
|
4733 Status: Proposal |
|
4734 |
|
4735 ------------------------------------------------------------------------------- |
|
4736 */ |
|
4737 TInt CCommandHandler::RunError(TInt aError) |
|
4738 { |
|
4739 __TRACE(KError, (_L("CCommandHandler::RunError"))); |
|
4740 |
|
4741 return aError; |
|
4742 } |
|
4743 |
|
4744 /* |
|
4745 ------------------------------------------------------------------------------- |
|
4746 |
|
4747 Class: CCommandDef |
|
4748 |
|
4749 Method: CCommandDef |
|
4750 |
|
4751 Description: private constructor |
|
4752 |
|
4753 Return Values: void |
|
4754 |
|
4755 ------------------------------------------------------------------------------- |
|
4756 */ |
|
4757 |
|
4758 CCommandDef::CCommandDef() |
|
4759 { |
|
4760 } |
|
4761 |
|
4762 /* |
|
4763 ------------------------------------------------------------------------------- |
|
4764 |
|
4765 Class: CCommandDef |
|
4766 |
|
4767 Method: ConstructL |
|
4768 |
|
4769 Description: Second phase constructor |
|
4770 |
|
4771 Return Values: void |
|
4772 |
|
4773 ------------------------------------------------------------------------------- |
|
4774 */ |
|
4775 |
|
4776 void CCommandDef::ConstructL() |
|
4777 { |
|
4778 |
|
4779 } |
|
4780 |
|
4781 /* |
|
4782 ------------------------------------------------------------------------------- |
|
4783 |
|
4784 Class: CCommandDef |
|
4785 |
|
4786 Method: NewL |
|
4787 |
|
4788 Description: First phase constructor |
|
4789 |
|
4790 Return Values: void |
|
4791 |
|
4792 ------------------------------------------------------------------------------- |
|
4793 */ |
|
4794 |
|
4795 CCommandDef* CCommandDef::NewL() |
|
4796 { |
|
4797 CCommandDef* self = new(ELeave) CCommandDef; |
|
4798 CleanupStack::PushL(self); |
|
4799 self->ConstructL(); |
|
4800 CleanupStack::Pop(self); |
|
4801 return self; |
|
4802 } |
|
4803 |
|
4804 /* |
|
4805 ------------------------------------------------------------------------------- |
|
4806 |
|
4807 Class: CCommandDef |
|
4808 |
|
4809 Method: ~CCommandDef |
|
4810 |
|
4811 Description: destructor |
|
4812 |
|
4813 ------------------------------------------------------------------------------- |
|
4814 */ |
|
4815 |
|
4816 CCommandDef::~CCommandDef() |
|
4817 { |
|
4818 |
|
4819 } |
|
4820 |
|
4821 // End of File |
|