2
|
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
|
|
15 |
* CTestCaseController class member functions.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <e32svr.h>
|
|
22 |
#include <e32uid.h>
|
|
23 |
#include <StifLogger.h>
|
|
24 |
#include "StifTFwIfProt.h"
|
|
25 |
#include "TestCaseController.h"
|
|
26 |
#include "TestModuleController.h"
|
|
27 |
#include "TestReport.h"
|
|
28 |
#include "Logging.h"
|
|
29 |
#include "StifHWReset.h"
|
|
30 |
|
|
31 |
// EXTERNAL DATA STRUCTURES
|
|
32 |
// None
|
|
33 |
|
|
34 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
35 |
// None
|
|
36 |
|
|
37 |
// CONSTANTS
|
|
38 |
// None
|
|
39 |
|
|
40 |
// MACROS
|
|
41 |
// None
|
|
42 |
|
|
43 |
// LOCAL CONSTANTS AND MACROS
|
|
44 |
// None
|
|
45 |
|
|
46 |
// MODULE DATA STRUCTURES
|
|
47 |
// None
|
|
48 |
|
|
49 |
// LOCAL FUNCTION PROTOTYPES
|
|
50 |
// None
|
|
51 |
|
|
52 |
// FORWARD DECLARATIONS
|
|
53 |
// None
|
|
54 |
|
|
55 |
// ==================== LOCAL FUNCTIONS =======================================
|
|
56 |
// None
|
|
57 |
|
|
58 |
|
|
59 |
#define LOGGER iEngine->Logger()
|
|
60 |
|
|
61 |
// ================= MEMBER FUNCTIONS =========================================
|
|
62 |
|
|
63 |
/*
|
|
64 |
-------------------------------------------------------------------------------
|
|
65 |
|
|
66 |
Class: CTestCaseController
|
|
67 |
|
|
68 |
Method: CTestCaseController
|
|
69 |
|
|
70 |
Description: Default constructor
|
|
71 |
|
|
72 |
C++ default constructor can NOT contain any code, that
|
|
73 |
might leave.
|
|
74 |
|
|
75 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
76 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
77 |
CAtsLogger& aAtsLogger: in: Reference to CAtsLogger
|
|
78 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
79 |
const TTestInfo& aTestInfo: in: Test Info
|
|
80 |
|
|
81 |
Return Values: None
|
|
82 |
|
|
83 |
Errors/Exceptions: None
|
|
84 |
|
|
85 |
Status: Approved
|
|
86 |
|
|
87 |
-------------------------------------------------------------------------------
|
|
88 |
*/
|
|
89 |
CTestCaseController::CTestCaseController( CTestEngine* aEngine,
|
|
90 |
CTestReport* aTestReport,
|
|
91 |
CAtsLogger& aAtsLogger,
|
|
92 |
RTestExecution aTestExecution,
|
|
93 |
const TTestInfo& aTestInfo ) :
|
|
94 |
CActive( CActive::EPriorityStandard ),
|
|
95 |
iEngine( aEngine ),
|
|
96 |
iTestReport( aTestReport ),
|
|
97 |
iTestExecution( aTestExecution ),
|
|
98 |
iTestInfo( aTestInfo ),
|
|
99 |
iState( ETestCaseIdle ),
|
|
100 |
iResultPckg( iResult ),
|
|
101 |
iAtsLogger( aAtsLogger )
|
|
102 |
{
|
|
103 |
CActiveScheduler::Add( this );
|
|
104 |
|
|
105 |
}
|
|
106 |
|
|
107 |
/*
|
|
108 |
-------------------------------------------------------------------------------
|
|
109 |
|
|
110 |
Class: CTestCaseController
|
|
111 |
|
|
112 |
Method: ConstructL
|
|
113 |
|
|
114 |
Description: Symbian OS second phase constructor
|
|
115 |
|
|
116 |
Symbian OS default constructor can leave.
|
|
117 |
|
|
118 |
Parameters: None
|
|
119 |
|
|
120 |
Return Values: None
|
|
121 |
|
|
122 |
Errors/Exceptions: None
|
|
123 |
|
|
124 |
Status: Proposal
|
|
125 |
|
|
126 |
-------------------------------------------------------------------------------
|
|
127 |
*/
|
|
128 |
void CTestCaseController::ConstructL()
|
|
129 |
{
|
|
130 |
__TRACE( KVerbose, ( _L( "CTestCaseController::ConstructL, [%S]" ), &iTestInfo.iTestCaseInfo.iTitle ) );
|
|
131 |
|
|
132 |
// Logger settings
|
|
133 |
TLoggerSettings loggerSettings;
|
|
134 |
loggerSettings.iCreateLogDirectories = EFalse;
|
|
135 |
loggerSettings.iOverwrite = ETrue;
|
|
136 |
loggerSettings.iTimeStamp = EFalse;
|
|
137 |
loggerSettings.iLineBreak = EFalse;
|
|
138 |
loggerSettings.iEventRanking = EFalse;
|
|
139 |
loggerSettings.iThreadId = EFalse;
|
|
140 |
loggerSettings.iHardwareFormat = CStifLogger::ETxt;
|
|
141 |
loggerSettings.iHardwareOutput = CStifLogger::ERDebug;
|
|
142 |
loggerSettings.iEmulatorFormat = CStifLogger::ETxt;
|
|
143 |
loggerSettings.iEmulatorOutput = CStifLogger::ERDebug;
|
|
144 |
loggerSettings.iUnicode = EFalse;
|
|
145 |
loggerSettings.iAddTestCaseTitle = EFalse;
|
|
146 |
|
|
147 |
iRDebugLogger = CStifLogger::NewL( _L( "" ), _L( "" ), loggerSettings );
|
|
148 |
|
|
149 |
// If timeout is specified, then create timeout handler.
|
|
150 |
if ( iTestInfo.iTestCaseInfo.iTimeout > TTimeIntervalMicroSeconds(0) )
|
|
151 |
{
|
|
152 |
iTimeout = CTestCaseTimeout::NewL ( this,
|
|
153 |
iTestInfo.iTestCaseInfo.iTimeout );
|
|
154 |
}
|
|
155 |
|
|
156 |
}
|
|
157 |
|
|
158 |
/*
|
|
159 |
-------------------------------------------------------------------------------
|
|
160 |
|
|
161 |
Class: CTestCaseController
|
|
162 |
|
|
163 |
Method: NewL
|
|
164 |
|
|
165 |
Description: Two-phased constructor.
|
|
166 |
|
|
167 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
168 |
CTestReport* aTestReport: in: Pointer to CTestReport
|
|
169 |
CAtsLogger& aAtsLogger: in: Reference to CAtsLogger
|
|
170 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
171 |
const TTestInfo& aTestInfo: in: Test Info
|
|
172 |
|
|
173 |
Return Values: CTestCaseController* : pointer to created object
|
|
174 |
|
|
175 |
Errors/Exceptions: Leaves if construction of CTestCaseController fails
|
|
176 |
|
|
177 |
Status: Approved
|
|
178 |
|
|
179 |
-------------------------------------------------------------------------------
|
|
180 |
*/
|
|
181 |
CTestCaseController* CTestCaseController::NewL( CTestEngine* aEngine,
|
|
182 |
CTestReport* aTestReport,
|
|
183 |
CAtsLogger& aAtsLogger,
|
|
184 |
RTestExecution aTestExecution,
|
|
185 |
const TTestInfo& aTestInfo )
|
|
186 |
{
|
|
187 |
CTestCaseController* self = new ( ELeave ) CTestCaseController( aEngine,
|
|
188 |
aTestReport, aAtsLogger, aTestExecution, aTestInfo );
|
|
189 |
CleanupStack::PushL( self );
|
|
190 |
self->ConstructL();
|
|
191 |
CleanupStack::Pop( self );
|
|
192 |
return self;
|
|
193 |
|
|
194 |
}
|
|
195 |
|
|
196 |
/*
|
|
197 |
-------------------------------------------------------------------------------
|
|
198 |
|
|
199 |
Class: CTestCaseController
|
|
200 |
|
|
201 |
Method: ~CTestCaseController
|
|
202 |
|
|
203 |
Description: Destructor
|
|
204 |
|
|
205 |
Parameters: None
|
|
206 |
|
|
207 |
Return Values: None
|
|
208 |
|
|
209 |
Errors/Exceptions: None
|
|
210 |
|
|
211 |
Status: Proposal
|
|
212 |
|
|
213 |
-------------------------------------------------------------------------------
|
|
214 |
*/
|
|
215 |
CTestCaseController::~CTestCaseController()
|
|
216 |
{
|
|
217 |
__TRACE( KVerbose, ( _L( "CTestCaseController::~CTestCaseController" ) ) );
|
|
218 |
Cancel();
|
|
219 |
|
|
220 |
delete iRDebugLogger;
|
|
221 |
delete iTimeout;
|
|
222 |
|
|
223 |
}
|
|
224 |
|
|
225 |
/*
|
|
226 |
-------------------------------------------------------------------------------
|
|
227 |
|
|
228 |
Class: CTestCaseController
|
|
229 |
|
|
230 |
Method: StartL
|
|
231 |
|
|
232 |
Description: Start active object
|
|
233 |
|
|
234 |
Parameters: const RMessage& aMessage: in: Server message
|
|
235 |
|
|
236 |
Return Values: None
|
|
237 |
|
|
238 |
Errors/Exceptions: None
|
|
239 |
|
|
240 |
Status: Proposal
|
|
241 |
|
|
242 |
-------------------------------------------------------------------------------
|
|
243 |
*/
|
|
244 |
void CTestCaseController::StartL( const RMessage2& aMessage )
|
|
245 |
{
|
|
246 |
iRDebugLogger->Log( _L( "Starting testcase [%S]" ), &iTestInfo.iTestCaseInfo.iTitle );
|
|
247 |
__TRACE( KInit, ( _L(" Starting testcase [%S]"), &iTestInfo.iTestCaseInfo.iTitle ) );
|
|
248 |
|
|
249 |
// Check that this request is not pending!!
|
|
250 |
__ASSERT_ALWAYS( iState != ETestCaseRunning,
|
|
251 |
iEngine->PanicClient( EReqPending, aMessage ) );
|
|
252 |
iMessage = aMessage;
|
|
253 |
|
|
254 |
iState = ETestCaseRunning;
|
|
255 |
|
|
256 |
SetActive();
|
|
257 |
|
|
258 |
iTestExecution.RunTestCase( iResultPckg, iStatus );
|
|
259 |
|
|
260 |
// If testcase has timeout (handler), then start it
|
|
261 |
if ( iTimeout )
|
|
262 |
{
|
|
263 |
iTimeout->Start();
|
|
264 |
}
|
|
265 |
|
|
266 |
}
|
|
267 |
|
|
268 |
/*
|
|
269 |
-------------------------------------------------------------------------------
|
|
270 |
|
|
271 |
Class: CTestCaseController
|
|
272 |
|
|
273 |
Method: Timeout
|
|
274 |
|
|
275 |
Description: Timeouts active request.
|
|
276 |
- Cancel request
|
|
277 |
|
|
278 |
Parameters: None
|
|
279 |
|
|
280 |
Return Values: None
|
|
281 |
|
|
282 |
Errors/Exceptions: None
|
|
283 |
|
|
284 |
Status: Proposal
|
|
285 |
|
|
286 |
-------------------------------------------------------------------------------
|
|
287 |
*/
|
|
288 |
void CTestCaseController::Timeout()
|
|
289 |
{
|
|
290 |
if ( iState == ETestCaseRunning )
|
|
291 |
{
|
|
292 |
iState = ETestCaseTimeout;
|
|
293 |
Cancel();
|
|
294 |
}
|
|
295 |
|
|
296 |
}
|
|
297 |
|
|
298 |
/*
|
|
299 |
-------------------------------------------------------------------------------
|
|
300 |
|
|
301 |
Class: CTestCaseController
|
|
302 |
|
|
303 |
Method: RunL
|
|
304 |
|
|
305 |
Description: RunL handles completed requests. Leaves are handled in
|
|
306 |
RunError method
|
|
307 |
|
|
308 |
Parameters: None
|
|
309 |
|
|
310 |
Return Values: None
|
|
311 |
|
|
312 |
Errors/Exceptions: Leaves if AddTestCaseResultL leaves
|
|
313 |
|
|
314 |
Status: Approved
|
|
315 |
|
|
316 |
-------------------------------------------------------------------------------
|
|
317 |
*/
|
|
318 |
void CTestCaseController::RunL()
|
|
319 |
{
|
|
320 |
iState = ETestCaseCompleted;
|
|
321 |
|
|
322 |
|
|
323 |
// "iStatus.Int()" error code is received from system's framework not from
|
|
324 |
// test case execution.
|
|
325 |
if ( iStatus.Int() != KErrNone )
|
|
326 |
{
|
|
327 |
if ( iStatus.Int() == KErrServerTerminated )
|
|
328 |
{
|
|
329 |
// something went badly wrong!
|
|
330 |
__TRACE( KInit, ( CStifLogger::ERed,
|
|
331 |
_L( "TestCase [%S] cannot be executed, STIF panics with[%d]" ),
|
|
332 |
&iTestInfo.iTestCaseInfo.iTitle,
|
|
333 |
iStatus.Int() ) );
|
|
334 |
|
|
335 |
__TRACE( KInit, ( CStifLogger::ERed,
|
|
336 |
_L( "Possible reason: Test case has paniced seriously" ) ) );
|
|
337 |
|
|
338 |
// We don't leave here but we write information to
|
|
339 |
// forward(testreport etc.)
|
|
340 |
_LIT( KLeaveInfo, "Test case execution fails" );
|
|
341 |
// Sets test case to crash category
|
|
342 |
iResult.iCaseExecutionResultCode = iStatus.Int();
|
|
343 |
// Test case result
|
|
344 |
iResult.iTestResult.iResult = iStatus.Int();
|
|
345 |
iResult.iTestResult.iResultDes = KLeaveInfo;
|
|
346 |
|
|
347 |
}
|
|
348 |
|
|
349 |
else
|
|
350 |
{
|
|
351 |
// For example testmodule's NewL or testmodule's constructor has
|
|
352 |
// leaved and STIF cannot connect to test module
|
|
353 |
__TRACE( KInit, ( CStifLogger::ERed,
|
|
354 |
_L( "TestCase [%S] cannot execute, TestModule loading operations fails with[%d]" ),
|
|
355 |
&iTestInfo.iTestCaseInfo.iTitle,
|
|
356 |
iStatus.Int() ) );
|
|
357 |
__TRACE( KInit, ( CStifLogger::ERed,
|
|
358 |
_L( "Possible reason: TestModule's NewL or Constructor has leaved and STIF cannot connect to test module" ) ) );
|
|
359 |
|
|
360 |
// We don't leave here but we write information to
|
|
361 |
// forward(testreport etc.)
|
|
362 |
_LIT( KLeaveInfo, "TestModule loading fails, cannot connect to the TestModule" );
|
|
363 |
// Sets test case to crash category
|
|
364 |
iResult.iCaseExecutionResultCode = iStatus.Int();
|
|
365 |
// Test case result
|
|
366 |
iResult.iTestResult.iResult = iStatus.Int();
|
|
367 |
iResult.iTestResult.iResultDes = KLeaveInfo;
|
|
368 |
}
|
|
369 |
}
|
|
370 |
|
|
371 |
else
|
|
372 |
{
|
|
373 |
|
|
374 |
// Cancel event request, because the testcase is completed
|
|
375 |
iTestExecution.CancelAsyncRequest( ETestExecutionNotifyEvent );
|
|
376 |
}
|
|
377 |
|
|
378 |
// Test case is executed
|
|
379 |
if( iTestInfo.iTestCaseInfo.iTitle.Length() > 0 )
|
|
380 |
{
|
|
381 |
iRDebugLogger->Log( _L( "TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
|
|
382 |
&iTestInfo.iTestCaseInfo.iTitle,
|
|
383 |
iResult.iTestResult.iResult,
|
|
384 |
&(iResult.iTestResult.iResultDes) );
|
|
385 |
|
|
386 |
__TRACE( KInit, ( _L( " TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
|
|
387 |
&iTestInfo.iTestCaseInfo.iTitle,
|
|
388 |
iResult.iTestResult.iResult,
|
|
389 |
&(iResult.iTestResult.iResultDes) ) );
|
|
390 |
}
|
|
391 |
else
|
|
392 |
{
|
|
393 |
iRDebugLogger->Log( _L( "TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
|
|
394 |
iTestInfo.iTestCaseInfo.iCaseNumber,
|
|
395 |
iResult.iTestResult.iResult,
|
|
396 |
&(iResult.iTestResult.iResultDes) );
|
|
397 |
|
|
398 |
__TRACE( KInit, ( _L( " TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
|
|
399 |
iTestInfo.iTestCaseInfo.iCaseNumber,
|
|
400 |
iResult.iTestResult.iResult,
|
|
401 |
&(iResult.iTestResult.iResultDes) ) );
|
|
402 |
}
|
|
403 |
__TRACE( KVerbose, (
|
|
404 |
_L( "CTestCaseController::RunL: iStatus=[%d]" ), iStatus.Int() ));
|
|
405 |
|
|
406 |
GenerateXmlLogL();
|
|
407 |
|
|
408 |
// Report test case result
|
|
409 |
if( iTestReport )
|
|
410 |
{
|
|
411 |
iTestReport->AddTestCaseResultL( iTestInfo, iResult, iStatus.Int() );
|
|
412 |
iTestReport->UpdateReportSummaryL();
|
|
413 |
}
|
|
414 |
|
|
415 |
TRAPD( ret, iMessage.WriteL( 0, iResultPckg ) );
|
|
416 |
|
|
417 |
// Case done
|
|
418 |
iMessage.Complete( ret );
|
|
419 |
|
|
420 |
}
|
|
421 |
|
|
422 |
/*
|
|
423 |
-------------------------------------------------------------------------------
|
|
424 |
|
|
425 |
Class: CTestCaseController
|
|
426 |
|
|
427 |
Method: DoCancel
|
|
428 |
|
|
429 |
Description: Cancel active request
|
|
430 |
|
|
431 |
Parameters: None
|
|
432 |
|
|
433 |
Return Values: None
|
|
434 |
|
|
435 |
Errors/Exceptions: None
|
|
436 |
|
|
437 |
Status: Proposal
|
|
438 |
|
|
439 |
-------------------------------------------------------------------------------
|
|
440 |
*/
|
|
441 |
void CTestCaseController::DoCancel()
|
|
442 |
{
|
|
443 |
|
|
444 |
switch ( iState )
|
|
445 |
{
|
|
446 |
case ETestCaseRunning:
|
|
447 |
iTestExecution.CancelAsyncRequest( ETestExecutionRunTestCase );
|
|
448 |
if( iTestInfo.iTestCaseInfo.iTitle.Length() > 0 )
|
|
449 |
{
|
|
450 |
iRDebugLogger->Log( _L( "TestCase [%S] execution aborted" ),
|
|
451 |
&iTestInfo.iTestCaseInfo.iTitle );
|
|
452 |
|
|
453 |
__TRACE( KInit, ( _L( "TestCase [%S] execution aborted" ),
|
|
454 |
&iTestInfo.iTestCaseInfo.iTitle ) );
|
|
455 |
}
|
|
456 |
else
|
|
457 |
{
|
|
458 |
iRDebugLogger->Log( _L( "TestCase [%S] execution aborted" ),
|
|
459 |
iTestInfo.iTestCaseInfo.iCaseNumber );
|
|
460 |
|
|
461 |
__TRACE( KInit, ( _L( "TestCase [%S] execution aborted" ),
|
|
462 |
iTestInfo.iTestCaseInfo.iCaseNumber ) );
|
|
463 |
}
|
|
464 |
break;
|
|
465 |
case ETestCaseTimeout:
|
|
466 |
iTestExecution.CancelAsyncRequest( ETestExecutionRunTestCase );
|
|
467 |
// Update result to timeout
|
|
468 |
iResult.iCaseExecutionResultType = TFullTestResult::ECaseTimeout;
|
|
469 |
iResult.iTestResult.iResultDes = _L("Test case was timeouted and cancelled");
|
|
470 |
|
|
471 |
if( iTestReport )
|
|
472 |
{
|
|
473 |
iTestReport->AddTestCaseResultL( iTestInfo, iResult, KErrTimedOut );
|
|
474 |
}
|
|
475 |
|
|
476 |
if( iTestInfo.iTestCaseInfo.iTitle.Length() > 0 )
|
|
477 |
{
|
|
478 |
iRDebugLogger->Log( _L( "TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
|
|
479 |
&iTestInfo.iTestCaseInfo.iTitle,
|
|
480 |
iResult.iTestResult.iResult,
|
|
481 |
&(iResult.iTestResult.iResultDes) );
|
|
482 |
|
|
483 |
__TRACE( KInit, ( _L( " TestCase [%S] finished with verdict[%d]. Message:[%S]." ),
|
|
484 |
&iTestInfo.iTestCaseInfo.iTitle,
|
|
485 |
iResult.iTestResult.iResult,
|
|
486 |
&(iResult.iTestResult.iResultDes) ) );
|
|
487 |
}
|
|
488 |
else
|
|
489 |
{
|
|
490 |
iRDebugLogger->Log( _L( "TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
|
|
491 |
iTestInfo.iTestCaseInfo.iCaseNumber,
|
|
492 |
iResult.iTestResult.iResult,
|
|
493 |
&(iResult.iTestResult.iResultDes) );
|
|
494 |
|
|
495 |
__TRACE( KInit, ( _L( " TestCase [%d] finished with verdict[%d]. Message:[%S]." ),
|
|
496 |
iTestInfo.iTestCaseInfo.iCaseNumber,
|
|
497 |
iResult.iTestResult.iResult,
|
|
498 |
&(iResult.iTestResult.iResultDes) ) );
|
|
499 |
}
|
|
500 |
|
|
501 |
break;
|
|
502 |
case ETestCaseSuicided:
|
|
503 |
{
|
|
504 |
//Store current results because cancel operation overwrites it
|
|
505 |
TInt currentTestResult = iResult.iTestResult.iResult;
|
|
506 |
TInt currentExecutionResult = iResult.iCaseExecutionResultCode;
|
|
507 |
iTestExecution.CancelAsyncRequest(ETestExecutionRunTestCase);
|
|
508 |
// Update result to suicide
|
|
509 |
switch(iStopExecutionType)
|
|
510 |
{
|
|
511 |
case EOk:
|
|
512 |
iResult.iCaseExecutionResultType = TFullTestResult::ECaseExecuted;
|
|
513 |
iResult.iTestResult.iResultDes = _L("Test case passed (StopExecution())");
|
|
514 |
break;
|
|
515 |
case EFail:
|
|
516 |
iResult.iCaseExecutionResultType = TFullTestResult::ECaseExecuted;
|
|
517 |
iResult.iTestResult.iResultDes = _L("Test case failed (StopExecution())");
|
|
518 |
break;
|
|
519 |
default: //EAbort
|
|
520 |
iResult.iCaseExecutionResultType = TFullTestResult::ECaseSuicided;
|
|
521 |
iResult.iTestResult.iResultDes = _L("Test case killed (StopExecution())");
|
|
522 |
}
|
|
523 |
iResult.iTestResult.iResult = currentTestResult;
|
|
524 |
iResult.iCaseExecutionResultCode = currentExecutionResult;
|
|
525 |
}
|
|
526 |
if(iTestReport)
|
|
527 |
{
|
|
528 |
iTestReport->AddTestCaseResultL(iTestInfo, iResult, KErrNone);
|
|
529 |
}
|
|
530 |
|
|
531 |
// Log some message
|
|
532 |
if(iTestInfo.iTestCaseInfo.iTitle.Length() > 0)
|
|
533 |
{
|
|
534 |
_LIT(KTestCaseDesc, "TestCase [%S] finished with verdict [%d]. Message:[%S].");
|
|
535 |
switch(iStopExecutionType)
|
|
536 |
{
|
|
537 |
case EOk:
|
|
538 |
{
|
|
539 |
_LIT(KTestCaseResult, "***Testcase PASSED***");
|
|
540 |
|
|
541 |
iRDebugLogger->Log(KTestCaseResult);
|
|
542 |
__TRACE(KInit, (KTestCaseResult));
|
|
543 |
iRDebugLogger->Log(KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
|
|
544 |
__TRACE(KInit, (KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
|
|
545 |
break;
|
|
546 |
}
|
|
547 |
case EFail:
|
|
548 |
{
|
|
549 |
_LIT(KTestCaseResult, "***Testcase FAILED***");
|
|
550 |
|
|
551 |
iRDebugLogger->Log(KTestCaseResult);
|
|
552 |
__TRACE(KInit, (KTestCaseResult));
|
|
553 |
iRDebugLogger->Log(KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
|
|
554 |
__TRACE(KInit, (KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
|
|
555 |
break;
|
|
556 |
}
|
|
557 |
default: //EAbort
|
|
558 |
{
|
|
559 |
_LIT(KTestCaseResult, "***Testcase KILLED***");
|
|
560 |
|
|
561 |
iRDebugLogger->Log(KTestCaseResult);
|
|
562 |
__TRACE(KInit, (KTestCaseResult));
|
|
563 |
iRDebugLogger->Log(KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
|
|
564 |
__TRACE(KInit, (KTestCaseDesc, &iTestInfo.iTestCaseInfo.iTitle, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
|
|
565 |
}
|
|
566 |
}
|
|
567 |
}
|
|
568 |
else
|
|
569 |
{
|
|
570 |
_LIT(KTestCaseDesc, "TestCase [%d] finished with verdict [%d]. Message:[%S].");
|
|
571 |
switch(iStopExecutionType)
|
|
572 |
{
|
|
573 |
case EOk:
|
|
574 |
{
|
|
575 |
_LIT(KTestCaseResult, "***Testcase PASSED***");
|
|
576 |
|
|
577 |
iRDebugLogger->Log(KTestCaseResult);
|
|
578 |
__TRACE(KInit, (KTestCaseResult));
|
|
579 |
iRDebugLogger->Log(KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
|
|
580 |
__TRACE(KInit, (KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
|
|
581 |
break;
|
|
582 |
}
|
|
583 |
case EFail:
|
|
584 |
{
|
|
585 |
_LIT(KTestCaseResult, "***Testcase FAILED***");
|
|
586 |
|
|
587 |
iRDebugLogger->Log(KTestCaseResult);
|
|
588 |
__TRACE(KInit, (KTestCaseResult));
|
|
589 |
iRDebugLogger->Log(KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
|
|
590 |
__TRACE(KInit, (KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
|
|
591 |
break;
|
|
592 |
}
|
|
593 |
default: //EAbort
|
|
594 |
{
|
|
595 |
_LIT(KTestCaseResult, "***Testcase KILLED***");
|
|
596 |
|
|
597 |
iRDebugLogger->Log(KTestCaseResult);
|
|
598 |
__TRACE(KInit, (KTestCaseResult));
|
|
599 |
iRDebugLogger->Log(KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes));
|
|
600 |
__TRACE(KInit, (KTestCaseDesc, iTestInfo.iTestCaseInfo.iCaseNumber, iResult.iTestResult.iResult, &(iResult.iTestResult.iResultDes)));
|
|
601 |
}
|
|
602 |
}
|
|
603 |
}
|
|
604 |
break;
|
|
605 |
case ETestCaseIdle:
|
|
606 |
case ETestCaseCompleted:
|
|
607 |
default:
|
|
608 |
// DoCancel called in wrong state => Panic
|
|
609 |
_LIT( KTestCaseController, "CTestCaseController" );
|
|
610 |
User::Panic( KTestCaseController, EDoCancelDisorder );
|
|
611 |
break;
|
|
612 |
}
|
|
613 |
|
|
614 |
// Write result and complete
|
|
615 |
TRAPD( ret, iMessage.WriteL( 0, iResultPckg ) );
|
|
616 |
|
|
617 |
iMessage.Complete( ret );
|
|
618 |
|
|
619 |
iState = ETestCaseCompleted;
|
|
620 |
|
|
621 |
// Generate xml result log
|
|
622 |
GenerateXmlLogL();
|
|
623 |
|
|
624 |
}
|
|
625 |
|
|
626 |
/*
|
|
627 |
-------------------------------------------------------------------------------
|
|
628 |
|
|
629 |
Class: CTestCaseController
|
|
630 |
|
|
631 |
Method: RunError
|
|
632 |
|
|
633 |
Description: Handle errors.
|
|
634 |
|
|
635 |
Parameters: TInt aError: in: Symbian OS error: Error code
|
|
636 |
|
|
637 |
Return Values: TInt KErrNone: Always returned KErrNone
|
|
638 |
|
|
639 |
Errors/Exceptions: None
|
|
640 |
|
|
641 |
Status: Approved
|
|
642 |
|
|
643 |
-------------------------------------------------------------------------------
|
|
644 |
*/
|
|
645 |
TInt CTestCaseController::RunError( TInt aError )
|
|
646 |
{
|
|
647 |
__TRACE( KError, ( CStifLogger::ERed,
|
|
648 |
_L( "CTestCaseController::RunError: Test case execution has failed! aError=[%d]" ), aError ) );
|
|
649 |
TInt completionError = aError;
|
|
650 |
|
|
651 |
// Write result, because it could include descriptive result for
|
|
652 |
// failed case
|
|
653 |
TRAPD( err, iMessage.WriteL( 0, iResultPckg ); );
|
|
654 |
|
|
655 |
if ( err != KErrNone )
|
|
656 |
{
|
|
657 |
completionError = err;
|
|
658 |
}
|
|
659 |
|
|
660 |
// Complete message with error
|
|
661 |
iMessage.Complete( completionError );
|
|
662 |
|
|
663 |
return KErrNone;
|
|
664 |
|
|
665 |
}
|
|
666 |
|
|
667 |
/*
|
|
668 |
-------------------------------------------------------------------------------
|
|
669 |
|
|
670 |
Class: CTestCaseController
|
|
671 |
|
|
672 |
Method: GenerateXmlLogL
|
|
673 |
|
|
674 |
Description: Generate XML log.
|
|
675 |
|
|
676 |
Parameters: None
|
|
677 |
|
|
678 |
Return Values: None
|
|
679 |
|
|
680 |
Errors/Exceptions: None
|
|
681 |
|
|
682 |
Status: Proposal
|
|
683 |
|
|
684 |
-------------------------------------------------------------------------------
|
|
685 |
*/
|
|
686 |
void CTestCaseController::GenerateXmlLogL()
|
|
687 |
{
|
|
688 |
|
|
689 |
// Report result with AtsLogger
|
|
690 |
iAtsLogger.BeginTestCaseReportL( iTestInfo.iTestCaseInfo.iTitle,
|
|
691 |
KErrNone, // Expected result not supported
|
|
692 |
iResult.iStartTime );
|
|
693 |
|
|
694 |
if( iResult.iCaseExecutionResultCode != KErrNone )
|
|
695 |
{
|
|
696 |
iAtsLogger.SetTestCaseResultL( iResult.iCaseExecutionResultCode );
|
|
697 |
iAtsLogger.TestCaseFailed();
|
|
698 |
if( iResult.iTestResult.iResultDes.Length() > 0 )
|
|
699 |
{
|
|
700 |
iAtsLogger.ErrorL( iResult.iTestResult.iResultDes );
|
|
701 |
}
|
|
702 |
}
|
|
703 |
else
|
|
704 |
{
|
|
705 |
iAtsLogger.SetTestCaseResultL( iResult.iTestResult.iResult );
|
|
706 |
if( iResult.iTestResult.iResult == KErrNone )
|
|
707 |
{
|
|
708 |
iAtsLogger.TestCasePassed();
|
|
709 |
}
|
|
710 |
else
|
|
711 |
{
|
|
712 |
iAtsLogger.TestCaseFailed();
|
|
713 |
if( iResult.iTestResult.iResultDes.Length() > 0 )
|
|
714 |
{
|
|
715 |
iAtsLogger.ErrorL( iResult.iTestResult.iResultDes );
|
|
716 |
}
|
|
717 |
}
|
|
718 |
}
|
|
719 |
// Set test case result to ATS Logger
|
|
720 |
iAtsLogger.EndTestCaseL();
|
|
721 |
|
|
722 |
}
|
|
723 |
|
|
724 |
/*
|
|
725 |
-------------------------------------------------------------------------------
|
|
726 |
|
|
727 |
Class: CTestCaseController
|
|
728 |
|
|
729 |
Method: GetTestCaseInfo
|
|
730 |
|
|
731 |
Description: Get testcase info(test module, config file, test case, etc).
|
|
732 |
|
|
733 |
Parameters: TTestInfo& aTestInfo: inout: Test information
|
|
734 |
|
|
735 |
Return Values: None
|
|
736 |
|
|
737 |
Errors/Exceptions: None
|
|
738 |
|
|
739 |
Status: Proposal
|
|
740 |
|
|
741 |
-------------------------------------------------------------------------------
|
|
742 |
*/
|
|
743 |
void CTestCaseController::GetTestCaseInfo( TTestInfo& aTestInfo )
|
|
744 |
{
|
|
745 |
aTestInfo = iTestInfo;
|
|
746 |
|
|
747 |
}
|
|
748 |
|
|
749 |
/*
|
|
750 |
-------------------------------------------------------------------------------
|
|
751 |
|
|
752 |
Class: CTestCaseController
|
|
753 |
|
|
754 |
Method: Suicide
|
|
755 |
|
|
756 |
Description: Cancels active request.
|
|
757 |
|
|
758 |
Parameters: aCode: the reason of suicide
|
|
759 |
|
|
760 |
Return Values: None
|
|
761 |
|
|
762 |
Errors/Exceptions: None
|
|
763 |
|
|
764 |
Status: Proposal
|
|
765 |
|
|
766 |
-------------------------------------------------------------------------------
|
|
767 |
*/
|
|
768 |
void CTestCaseController::Suicide(TStopExecutionType aType, TInt aCode)
|
|
769 |
{
|
|
770 |
if(iState == ETestCaseRunning)
|
|
771 |
{
|
|
772 |
iStopExecutionType = aType;
|
|
773 |
switch(iStopExecutionType)
|
|
774 |
{
|
|
775 |
case EOk:
|
|
776 |
iResult.iTestResult.iResult = KErrNone;
|
|
777 |
iResult.iCaseExecutionResultCode = KErrNone;
|
|
778 |
break;
|
|
779 |
case EFail:
|
|
780 |
iResult.iTestResult.iResult = aCode;
|
|
781 |
iResult.iCaseExecutionResultCode = KErrNone;
|
|
782 |
break;
|
|
783 |
default: //EAbort
|
|
784 |
iResult.iTestResult.iResult = aCode;
|
|
785 |
iResult.iCaseExecutionResultCode = aCode;
|
|
786 |
}
|
|
787 |
iState = ETestCaseSuicided;
|
|
788 |
Cancel();
|
|
789 |
}
|
|
790 |
}
|
|
791 |
|
|
792 |
/*
|
|
793 |
-------------------------------------------------------------------------------
|
|
794 |
|
|
795 |
DESCRIPTION
|
|
796 |
|
|
797 |
This module contains implementation of CTestProgressNotifier class member
|
|
798 |
functions.
|
|
799 |
|
|
800 |
-------------------------------------------------------------------------------
|
|
801 |
*/
|
|
802 |
|
|
803 |
// ================= MEMBER FUNCTIONS =========================================
|
|
804 |
|
|
805 |
/*
|
|
806 |
-------------------------------------------------------------------------------
|
|
807 |
|
|
808 |
Class: CTestProgressNotifier
|
|
809 |
|
|
810 |
Method: CTestProgressNotifier
|
|
811 |
|
|
812 |
Description: Default constructor
|
|
813 |
|
|
814 |
C++ default constructor can NOT contain any code, that
|
|
815 |
might leave.
|
|
816 |
|
|
817 |
Parameters: None
|
|
818 |
|
|
819 |
Return Values: None
|
|
820 |
|
|
821 |
Errors/Exceptions: None
|
|
822 |
|
|
823 |
Status: Approved
|
|
824 |
|
|
825 |
-------------------------------------------------------------------------------
|
|
826 |
*/
|
|
827 |
CTestProgressNotifier::CTestProgressNotifier( CTestEngine* aEngine,
|
|
828 |
RTestExecution aTestExecution ) :
|
|
829 |
CActive( CActive::EPriorityStandard ),
|
|
830 |
iEngine( aEngine ),
|
|
831 |
iTestExecution( aTestExecution ),
|
|
832 |
iState( ETestProgressIdle ),
|
|
833 |
iProgressPckg( iProgress )
|
|
834 |
{
|
|
835 |
CActiveScheduler::Add( this );
|
|
836 |
|
|
837 |
}
|
|
838 |
|
|
839 |
/*
|
|
840 |
-------------------------------------------------------------------------------
|
|
841 |
|
|
842 |
Class: CTestProgressNotifier
|
|
843 |
|
|
844 |
Method: ConstructL
|
|
845 |
|
|
846 |
Description: Symbian OS second phase constructor
|
|
847 |
|
|
848 |
Symbian OS default constructor can leave.
|
|
849 |
|
|
850 |
Parameters: None
|
|
851 |
|
|
852 |
Return Values: None
|
|
853 |
|
|
854 |
Errors/Exceptions: None
|
|
855 |
|
|
856 |
Status: Approved
|
|
857 |
|
|
858 |
-------------------------------------------------------------------------------
|
|
859 |
*/
|
|
860 |
void CTestProgressNotifier::ConstructL()
|
|
861 |
{
|
|
862 |
__TRACE( KVerbose, ( _L( "CTestProgressNotifier::ConstructL" ) ) );
|
|
863 |
}
|
|
864 |
|
|
865 |
/*
|
|
866 |
-------------------------------------------------------------------------------
|
|
867 |
|
|
868 |
Class: CTestProgressNotifier
|
|
869 |
|
|
870 |
Method: NewL
|
|
871 |
|
|
872 |
Description: Two-phased constructor.
|
|
873 |
|
|
874 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
875 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
876 |
|
|
877 |
Return Values: CTestProgressNotifier* : pointer to created object
|
|
878 |
|
|
879 |
Errors/Exceptions: Leaves if construction of CTestProgressNotifier fails
|
|
880 |
|
|
881 |
Status: Approved
|
|
882 |
|
|
883 |
-------------------------------------------------------------------------------
|
|
884 |
*/
|
|
885 |
CTestProgressNotifier* CTestProgressNotifier::NewL( CTestEngine* aEngine,
|
|
886 |
RTestExecution aTestExecution )
|
|
887 |
{
|
|
888 |
CTestProgressNotifier* self = new ( ELeave ) CTestProgressNotifier(
|
|
889 |
aEngine, aTestExecution );
|
|
890 |
CleanupStack::PushL( self );
|
|
891 |
self->ConstructL();
|
|
892 |
CleanupStack::Pop( self );
|
|
893 |
return self;
|
|
894 |
|
|
895 |
}
|
|
896 |
|
|
897 |
/*
|
|
898 |
-------------------------------------------------------------------------------
|
|
899 |
|
|
900 |
Class: CTestProgressNotifier
|
|
901 |
|
|
902 |
Method: ~CTestProgressNotifier
|
|
903 |
|
|
904 |
Description: Destructor
|
|
905 |
|
|
906 |
Parameters: None
|
|
907 |
|
|
908 |
Return Values: None
|
|
909 |
|
|
910 |
Errors/Exceptions: None
|
|
911 |
|
|
912 |
Status: Approved
|
|
913 |
|
|
914 |
-------------------------------------------------------------------------------
|
|
915 |
*/
|
|
916 |
CTestProgressNotifier::~CTestProgressNotifier()
|
|
917 |
{
|
|
918 |
__TRACE( KVerbose, ( _L( "CTestProgressNotifier::~CTestProgressNotifier" ) ) );
|
|
919 |
Cancel();
|
|
920 |
|
|
921 |
}
|
|
922 |
|
|
923 |
/*
|
|
924 |
-------------------------------------------------------------------------------
|
|
925 |
|
|
926 |
Class: CTestProgressNotifier
|
|
927 |
|
|
928 |
Method: StartL
|
|
929 |
|
|
930 |
Description: Start active object
|
|
931 |
|
|
932 |
Parameters: const RMessage& aMessage: in: Server message
|
|
933 |
|
|
934 |
Return Values: None
|
|
935 |
|
|
936 |
Errors/Exceptions: None
|
|
937 |
|
|
938 |
Status: Approved
|
|
939 |
|
|
940 |
-------------------------------------------------------------------------------
|
|
941 |
*/
|
|
942 |
void CTestProgressNotifier::StartL( const RMessage2& aMessage )
|
|
943 |
{
|
|
944 |
__TRACE( KVerbose, ( _L( "CTestProgressNotifier::StartL" ) ) );
|
|
945 |
// Check that this request is not pending!!
|
|
946 |
__ASSERT_ALWAYS( iState != ETestProgressPending,
|
|
947 |
iEngine->PanicClient( EReqPending, aMessage ) );
|
|
948 |
iMessage = aMessage;
|
|
949 |
|
|
950 |
iState = ETestProgressPending;
|
|
951 |
SetActive();
|
|
952 |
|
|
953 |
iTestExecution.NotifyProgress( iProgressPckg, iStatus );
|
|
954 |
|
|
955 |
}
|
|
956 |
|
|
957 |
/*
|
|
958 |
-------------------------------------------------------------------------------
|
|
959 |
|
|
960 |
Class: CTestProgressNotifier
|
|
961 |
|
|
962 |
Method: RunL
|
|
963 |
|
|
964 |
Description: RunL handles completed requests.
|
|
965 |
|
|
966 |
Parameters: None
|
|
967 |
|
|
968 |
Return Values: None
|
|
969 |
|
|
970 |
Errors/Exceptions: Leaves if WriteL leaves
|
|
971 |
Leaves if iStatus is not KErrNone or KErrEof
|
|
972 |
Leaves are handled in RunError method
|
|
973 |
|
|
974 |
Status: Approved
|
|
975 |
|
|
976 |
-------------------------------------------------------------------------------
|
|
977 |
*/
|
|
978 |
void CTestProgressNotifier::RunL()
|
|
979 |
{
|
|
980 |
__TRACE( KVerbose, (_L("CTestProgressNotifier::RunL: iStatus=[%d]" ), iStatus.Int() ));
|
|
981 |
|
|
982 |
iState = ETestProgressCompleted;
|
|
983 |
|
|
984 |
// Check that request was successful or completed with acceptable error
|
|
985 |
// KErrEof is acceptable error and it means that the test case will not
|
|
986 |
// send progresses anymore (because it is closed)
|
|
987 |
if ( KErrNone == iStatus.Int() )
|
|
988 |
{
|
|
989 |
iMessage.WriteL( 0, iProgressPckg );
|
|
990 |
}
|
|
991 |
else if ( KErrEof != iStatus.Int() )
|
|
992 |
{
|
|
993 |
// Leave, error will be handled in RunError
|
|
994 |
User::Leave( iStatus.Int() );
|
|
995 |
}
|
|
996 |
|
|
997 |
// Complete message
|
|
998 |
iMessage.Complete( iStatus.Int() );
|
|
999 |
|
|
1000 |
}
|
|
1001 |
|
|
1002 |
/*
|
|
1003 |
-------------------------------------------------------------------------------
|
|
1004 |
|
|
1005 |
Class: CTestProgressNotifier
|
|
1006 |
|
|
1007 |
Method: DoCancel
|
|
1008 |
|
|
1009 |
Description: Cancel active request
|
|
1010 |
|
|
1011 |
Parameters: None
|
|
1012 |
|
|
1013 |
Return Values: None
|
|
1014 |
|
|
1015 |
Errors/Exceptions: None
|
|
1016 |
|
|
1017 |
Status: Approved
|
|
1018 |
|
|
1019 |
-------------------------------------------------------------------------------
|
|
1020 |
*/
|
|
1021 |
void CTestProgressNotifier::DoCancel()
|
|
1022 |
{
|
|
1023 |
switch ( iState )
|
|
1024 |
{
|
|
1025 |
case ETestProgressPending:
|
|
1026 |
iTestExecution.CancelAsyncRequest( ETestExecutionNotifyProgress );
|
|
1027 |
iMessage.Complete( KErrCancel );
|
|
1028 |
break;
|
|
1029 |
case ETestProgressIdle:
|
|
1030 |
case ETestProgressCompleted:
|
|
1031 |
default:
|
|
1032 |
// DoCancel called in wrong state => Panic
|
|
1033 |
_LIT( KTestProgressNotifier, "CTestProgressNotifier" );
|
|
1034 |
User::Panic( KTestProgressNotifier, EDoCancelDisorder );
|
|
1035 |
break;
|
|
1036 |
}
|
|
1037 |
iState = ETestProgressIdle;
|
|
1038 |
|
|
1039 |
}
|
|
1040 |
|
|
1041 |
/*
|
|
1042 |
-------------------------------------------------------------------------------
|
|
1043 |
|
|
1044 |
Class: CTestProgressNotifier
|
|
1045 |
|
|
1046 |
Method: RunError
|
|
1047 |
|
|
1048 |
Description: Handle errors.
|
|
1049 |
|
|
1050 |
Parameters: TInt aError: in: Symbian OS error: Error code
|
|
1051 |
|
|
1052 |
Return Values: TInt KErrNone: Always returned KErrNone
|
|
1053 |
|
|
1054 |
Errors/Exceptions: None
|
|
1055 |
|
|
1056 |
Status: Approved
|
|
1057 |
|
|
1058 |
-------------------------------------------------------------------------------
|
|
1059 |
*/
|
|
1060 |
TInt CTestProgressNotifier::RunError( TInt aError )
|
|
1061 |
{
|
|
1062 |
// Complete message with error
|
|
1063 |
iMessage.Complete( aError );
|
|
1064 |
|
|
1065 |
return KErrNone;
|
|
1066 |
|
|
1067 |
}
|
|
1068 |
|
|
1069 |
/*
|
|
1070 |
-------------------------------------------------------------------------------
|
|
1071 |
|
|
1072 |
DESCRIPTION
|
|
1073 |
|
|
1074 |
This module contains implementation of CTestEventNotifier class member
|
|
1075 |
functions.
|
|
1076 |
|
|
1077 |
-------------------------------------------------------------------------------
|
|
1078 |
*/
|
|
1079 |
|
|
1080 |
// ================= MEMBER FUNCTIONS =========================================
|
|
1081 |
|
|
1082 |
/*
|
|
1083 |
-------------------------------------------------------------------------------
|
|
1084 |
|
|
1085 |
Class: CTestEventNotifier
|
|
1086 |
|
|
1087 |
Method: CTestEventNotifier
|
|
1088 |
|
|
1089 |
Description: Default constructor
|
|
1090 |
|
|
1091 |
C++ default constructor can NOT contain any code, that
|
|
1092 |
might leave.
|
|
1093 |
|
|
1094 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
1095 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
1096 |
|
|
1097 |
Return Values: None
|
|
1098 |
|
|
1099 |
Errors/Exceptions: None
|
|
1100 |
|
|
1101 |
Status: Approved
|
|
1102 |
|
|
1103 |
-------------------------------------------------------------------------------
|
|
1104 |
*/
|
|
1105 |
CTestEventNotifier::CTestEventNotifier( CTestEngine* aEngine,
|
|
1106 |
RTestExecution aTestExecution ) :
|
|
1107 |
CActive( CActive::EPriorityStandard ),
|
|
1108 |
iEngine( aEngine ),
|
|
1109 |
iTestExecution( aTestExecution ),
|
|
1110 |
iState( ETestEventIdle ),
|
|
1111 |
iEventPckg( iEvent ),
|
|
1112 |
iEventNotifyPckg( iEventNotify ),
|
|
1113 |
iController( NULL )
|
|
1114 |
{
|
|
1115 |
CActiveScheduler::Add( this );
|
|
1116 |
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
/*
|
|
1120 |
-------------------------------------------------------------------------------
|
|
1121 |
|
|
1122 |
Class: CTestEventNotifier
|
|
1123 |
|
|
1124 |
Method: ConstructL
|
|
1125 |
|
|
1126 |
Description: Symbian OS second phase constructor
|
|
1127 |
|
|
1128 |
Symbian OS default constructor can leave.
|
|
1129 |
|
|
1130 |
Parameters: None
|
|
1131 |
|
|
1132 |
Return Values: None
|
|
1133 |
|
|
1134 |
Errors/Exceptions: None
|
|
1135 |
|
|
1136 |
Status: Approved
|
|
1137 |
|
|
1138 |
-------------------------------------------------------------------------------
|
|
1139 |
*/
|
|
1140 |
void CTestEventNotifier::ConstructL( )
|
|
1141 |
{
|
|
1142 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier::ConstructL" ) ) );
|
|
1143 |
|
|
1144 |
}
|
|
1145 |
|
|
1146 |
/*
|
|
1147 |
-------------------------------------------------------------------------------
|
|
1148 |
|
|
1149 |
Class: CTestEventNotifier
|
|
1150 |
|
|
1151 |
Method: NewL
|
|
1152 |
|
|
1153 |
Description: Two-phased constructor.
|
|
1154 |
|
|
1155 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
1156 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
1157 |
|
|
1158 |
Return Values: CTestEventNotifier* : pointer to created object
|
|
1159 |
|
|
1160 |
Errors/Exceptions: Leaves if construction of CTestEventNotifier fails
|
|
1161 |
|
|
1162 |
Status: Approved
|
|
1163 |
|
|
1164 |
-------------------------------------------------------------------------------
|
|
1165 |
*/
|
|
1166 |
CTestEventNotifier* CTestEventNotifier::NewL( CTestEngine* aEngine,
|
|
1167 |
RTestExecution aTestExecution )
|
|
1168 |
{
|
|
1169 |
CTestEventNotifier* self = new ( ELeave ) CTestEventNotifier(
|
|
1170 |
aEngine, aTestExecution );
|
|
1171 |
CleanupStack::PushL( self );
|
|
1172 |
self->ConstructL();
|
|
1173 |
CleanupStack::Pop( self );
|
|
1174 |
return self;
|
|
1175 |
|
|
1176 |
}
|
|
1177 |
|
|
1178 |
/*
|
|
1179 |
-------------------------------------------------------------------------------
|
|
1180 |
|
|
1181 |
Class: CTestEventNotifier
|
|
1182 |
|
|
1183 |
Method: ~CTestEventNotifier
|
|
1184 |
|
|
1185 |
Description: Destructor
|
|
1186 |
|
|
1187 |
Parameters: None
|
|
1188 |
|
|
1189 |
Return Values: None
|
|
1190 |
|
|
1191 |
Errors/Exceptions: None
|
|
1192 |
|
|
1193 |
Status: Approved
|
|
1194 |
|
|
1195 |
-------------------------------------------------------------------------------
|
|
1196 |
*/
|
|
1197 |
CTestEventNotifier::~CTestEventNotifier()
|
|
1198 |
{
|
|
1199 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier::~CTestEventNotifier" ) ) );
|
|
1200 |
Cancel();
|
|
1201 |
iEventArray.ResetAndDestroy();
|
|
1202 |
iEventArray.Close();
|
|
1203 |
delete iController;
|
|
1204 |
}
|
|
1205 |
|
|
1206 |
/*
|
|
1207 |
-------------------------------------------------------------------------------
|
|
1208 |
|
|
1209 |
Class: CTestEventNotifier
|
|
1210 |
|
|
1211 |
Method: StartL
|
|
1212 |
|
|
1213 |
Description: Start active object
|
|
1214 |
|
|
1215 |
Parameters: None
|
|
1216 |
|
|
1217 |
Return Values: None
|
|
1218 |
|
|
1219 |
Errors/Exceptions: None
|
|
1220 |
|
|
1221 |
Status: Approved
|
|
1222 |
|
|
1223 |
-------------------------------------------------------------------------------
|
|
1224 |
*/
|
|
1225 |
void CTestEventNotifier::Start()
|
|
1226 |
{
|
|
1227 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier::StartL" ) ) );
|
|
1228 |
// Check that this request is not pending!!
|
|
1229 |
__ASSERT_ALWAYS( iState != ETestEventPending,
|
|
1230 |
User::Leave( KErrAlreadyExists ) );
|
|
1231 |
|
|
1232 |
iEvent.SetType( TEventIf::EEnable );
|
|
1233 |
iState = ETestEventPending;
|
|
1234 |
iTestExecution.NotifyEvent( iEventPckg, iStatus );
|
|
1235 |
SetActive();
|
|
1236 |
|
|
1237 |
}
|
|
1238 |
|
|
1239 |
/*
|
|
1240 |
-------------------------------------------------------------------------------
|
|
1241 |
|
|
1242 |
Class: CTestEventNotifier
|
|
1243 |
|
|
1244 |
Method: RunL
|
|
1245 |
|
|
1246 |
Description: RunL handles completed requests.
|
|
1247 |
|
|
1248 |
Parameters: None
|
|
1249 |
|
|
1250 |
Return Values: None
|
|
1251 |
|
|
1252 |
Errors/Exceptions: Leaves if iStatus is not KErrNone
|
|
1253 |
Leaves if iState is not ETestEventPending
|
|
1254 |
Leaves if some leaving method called here leaves
|
|
1255 |
|
|
1256 |
Status: Approved
|
|
1257 |
|
|
1258 |
-------------------------------------------------------------------------------
|
|
1259 |
*/
|
|
1260 |
void CTestEventNotifier::RunL()
|
|
1261 |
{
|
|
1262 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier::RunL: iStatus=[%d]" ), iStatus.Int() ) );
|
|
1263 |
|
|
1264 |
User::LeaveIfError( iStatus.Int() );
|
|
1265 |
|
|
1266 |
switch( iState )
|
|
1267 |
{
|
|
1268 |
case ETestEventPending:
|
|
1269 |
{
|
|
1270 |
iState = ETestEventCompleted;
|
|
1271 |
|
|
1272 |
switch( iEvent.Type() )
|
|
1273 |
{
|
|
1274 |
case TEventIf::EReqEvent:
|
|
1275 |
{
|
|
1276 |
__RDEBUG( ( _L("CTestEventNotifier(ReqEvent) %S"),
|
|
1277 |
&iEvent.Name() ));
|
|
1278 |
if( iEngine->IsStateEventAndSet( iEvent.Name() ) )
|
|
1279 |
{
|
|
1280 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier::RunL: Requested Global event already set" ) ) );
|
|
1281 |
TEventIf event( TEventIf::ESetEvent, iEvent.Name(),
|
|
1282 |
TEventIf::EState );
|
|
1283 |
TEventIfPckg eventPckg( event );
|
|
1284 |
TRequestStatus status;
|
|
1285 |
iTestExecution.NotifyEvent( eventPckg, status );
|
|
1286 |
User::WaitForRequest( status );
|
|
1287 |
}
|
|
1288 |
//add to iEventArray
|
|
1289 |
HBufC* name = iEvent.Name().AllocLC();
|
|
1290 |
if( iEventArray.Append( name ) != KErrNone )
|
|
1291 |
{
|
|
1292 |
User::Leave( KErrNoMemory );
|
|
1293 |
}
|
|
1294 |
CleanupStack::Pop( name );
|
|
1295 |
}
|
|
1296 |
break;
|
|
1297 |
case TEventIf::ERelEvent:
|
|
1298 |
{
|
|
1299 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier(RelEvent) %S" ), &iEvent.Name() ) );
|
|
1300 |
//remove from iEventArray
|
|
1301 |
TInt count = iEventArray.Count();
|
|
1302 |
const TDesC& eventName = iEvent.Name();
|
|
1303 |
TInt i;
|
|
1304 |
for( i = 0; i < count; i++ )
|
|
1305 |
{
|
|
1306 |
TPtrC name = iEventArray[i]->Des();
|
|
1307 |
if( name == eventName )
|
|
1308 |
{
|
|
1309 |
HBufC* tmp = iEventArray[i];
|
|
1310 |
iEventArray.Remove( i );
|
|
1311 |
delete tmp;
|
|
1312 |
break;
|
|
1313 |
}
|
|
1314 |
}
|
|
1315 |
// Check that event was found
|
|
1316 |
if( i == count )
|
|
1317 |
{
|
|
1318 |
User::Leave( KErrGeneral );
|
|
1319 |
}
|
|
1320 |
}
|
|
1321 |
break;
|
|
1322 |
case TEventIf::ESetEvent:
|
|
1323 |
{
|
|
1324 |
__RDEBUG( ( _L("CTestEventNotifier(SetEvent) %S"),
|
|
1325 |
&iEvent.Name() ));
|
|
1326 |
delete iController;
|
|
1327 |
iController = NULL;
|
|
1328 |
iController = iEngine->CtlEventL( iEvent, iStatus );
|
|
1329 |
SetActive();
|
|
1330 |
return;
|
|
1331 |
}
|
|
1332 |
case TEventIf::EUnsetEvent:
|
|
1333 |
{
|
|
1334 |
__RDEBUG( ( _L("CTestEventNotifier(UnsetEvent) %S"),
|
|
1335 |
&iEvent.Name() ));
|
|
1336 |
delete iController;
|
|
1337 |
iController = NULL;
|
|
1338 |
iController = iEngine->CtlEventL( iEvent, iStatus );
|
|
1339 |
SetActive();
|
|
1340 |
return;
|
|
1341 |
}
|
|
1342 |
default:
|
|
1343 |
{
|
|
1344 |
User::Leave( KErrGeneral );
|
|
1345 |
}
|
|
1346 |
}
|
|
1347 |
// Set request again
|
|
1348 |
Start();
|
|
1349 |
// Otherwise request is enabled again later
|
|
1350 |
}
|
|
1351 |
break;
|
|
1352 |
case ETestEventCompleted:
|
|
1353 |
__RDEBUG( ( _L("CTestEventNotifier(Complete)")));
|
|
1354 |
Start();
|
|
1355 |
break;
|
|
1356 |
default:
|
|
1357 |
User::Leave( KErrGeneral );
|
|
1358 |
break;
|
|
1359 |
}
|
|
1360 |
|
|
1361 |
}
|
|
1362 |
|
|
1363 |
/*
|
|
1364 |
-------------------------------------------------------------------------------
|
|
1365 |
|
|
1366 |
Class: CTestEventNotifier
|
|
1367 |
|
|
1368 |
Method: DoCancel
|
|
1369 |
|
|
1370 |
Description: Cancel active request
|
|
1371 |
|
|
1372 |
Parameters: None
|
|
1373 |
|
|
1374 |
Return Values: None
|
|
1375 |
|
|
1376 |
Errors/Exceptions: None
|
|
1377 |
|
|
1378 |
Status: Approved
|
|
1379 |
|
|
1380 |
-------------------------------------------------------------------------------
|
|
1381 |
*/
|
|
1382 |
void CTestEventNotifier::DoCancel()
|
|
1383 |
{
|
|
1384 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier::DoCancel" ) ) );
|
|
1385 |
|
|
1386 |
switch ( iState )
|
|
1387 |
{
|
|
1388 |
case ETestEventPending:
|
|
1389 |
iTestExecution.CancelAsyncRequest( ETestExecutionNotifyEvent );
|
|
1390 |
break;
|
|
1391 |
case ETestEventCompleted:
|
|
1392 |
delete iController;
|
|
1393 |
iController = NULL;
|
|
1394 |
break;
|
|
1395 |
default:
|
|
1396 |
// DoCancel called in wrong state => Panic
|
|
1397 |
_LIT( KTestEventNotifier, "CTestEventNotifier" );
|
|
1398 |
User::Panic( KTestEventNotifier, EDoCancelDisorder );
|
|
1399 |
break;
|
|
1400 |
}
|
|
1401 |
|
|
1402 |
iState = ETestEventIdle;
|
|
1403 |
iEventArray.ResetAndDestroy();
|
|
1404 |
|
|
1405 |
}
|
|
1406 |
|
|
1407 |
/*
|
|
1408 |
-------------------------------------------------------------------------------
|
|
1409 |
|
|
1410 |
Class: CTestEventNotifier
|
|
1411 |
|
|
1412 |
Method: RunError
|
|
1413 |
|
|
1414 |
Description: Handle errors.
|
|
1415 |
|
|
1416 |
Parameters: TInt aError: in: Symbian OS error: Error code
|
|
1417 |
|
|
1418 |
Return Values: TInt KErrNone: Always returned KErrNone
|
|
1419 |
|
|
1420 |
Errors/Exceptions: None
|
|
1421 |
|
|
1422 |
Status: Approved
|
|
1423 |
|
|
1424 |
-------------------------------------------------------------------------------
|
|
1425 |
*/
|
|
1426 |
TInt CTestEventNotifier::RunError( TInt aError )
|
|
1427 |
{
|
|
1428 |
switch ( iState )
|
|
1429 |
{
|
|
1430 |
case ETestEventPending:
|
|
1431 |
if( aError != KErrCancel )
|
|
1432 |
{
|
|
1433 |
__TRACE( KError, ( CStifLogger::ERed, _L( "CTestEventNotifier::RunError %d"), aError) );
|
|
1434 |
}
|
|
1435 |
else
|
|
1436 |
{
|
|
1437 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier stopped")) );
|
|
1438 |
}
|
|
1439 |
|
|
1440 |
// We stop event notifier if we get error here
|
|
1441 |
// Clear requested event list
|
|
1442 |
iEventArray.ResetAndDestroy();
|
|
1443 |
break;
|
|
1444 |
case ETestEventCompleted:
|
|
1445 |
// Do not close here
|
|
1446 |
__TRACE( KError, ( CStifLogger::ERed, _L( "CTestEventNotifier::RunError %d"), aError) );
|
|
1447 |
delete iController;
|
|
1448 |
iController = NULL;
|
|
1449 |
// forward error to testcase
|
|
1450 |
iEvent.SetType( TEventIf::EEnable );
|
|
1451 |
iState = ETestEventPending;
|
|
1452 |
iTestExecution.NotifyEvent( iEventPckg, iStatus, aError );
|
|
1453 |
SetActive();
|
|
1454 |
break;
|
|
1455 |
default:
|
|
1456 |
__TRACE( KError, ( CStifLogger::ERed, _L( "CTestEventNotifier::RunError %d"), aError) );
|
|
1457 |
// DoCancel called in wrong state => Panic
|
|
1458 |
_LIT( KTestEventNotifier, "CTestEventNotifier" );
|
|
1459 |
User::Panic( KTestEventNotifier, EDoCancelDisorder );
|
|
1460 |
break;
|
|
1461 |
}
|
|
1462 |
|
|
1463 |
return KErrNone;
|
|
1464 |
|
|
1465 |
}
|
|
1466 |
|
|
1467 |
/*
|
|
1468 |
-------------------------------------------------------------------------------
|
|
1469 |
|
|
1470 |
Class: CTestEventNotifier
|
|
1471 |
|
|
1472 |
Method: CtlEventL
|
|
1473 |
|
|
1474 |
Description: Controls events
|
|
1475 |
|
|
1476 |
Parameters: const TEventIf& aEvent: in: Event
|
|
1477 |
TRequestStatus& aStatus: in: Request status
|
|
1478 |
|
|
1479 |
Return Values: None
|
|
1480 |
|
|
1481 |
Errors/Exceptions: None
|
|
1482 |
|
|
1483 |
Status: Approved
|
|
1484 |
|
|
1485 |
-------------------------------------------------------------------------------
|
|
1486 |
*/
|
|
1487 |
void CTestEventNotifier::CtlEvent( const TEventIf& aEvent,
|
|
1488 |
TRequestStatus& aStatus )
|
|
1489 |
{
|
|
1490 |
__TRACE( KVerbose, ( _L( "CTestEventNotifier::CtlEventL" ) ) );
|
|
1491 |
const TDesC& eventName = aEvent.Name();
|
|
1492 |
TInt count = iEventArray.Count();
|
|
1493 |
for( TInt i = 0; i < count; i++ )
|
|
1494 |
{
|
|
1495 |
TPtrC name = iEventArray[i]->Des();
|
|
1496 |
if( name == eventName )
|
|
1497 |
{
|
|
1498 |
iEventNotify.Copy( aEvent );
|
|
1499 |
iTestExecution.NotifyEvent( iEventNotifyPckg, aStatus );
|
|
1500 |
return;
|
|
1501 |
}
|
|
1502 |
}
|
|
1503 |
}
|
|
1504 |
|
|
1505 |
/*
|
|
1506 |
-------------------------------------------------------------------------------
|
|
1507 |
|
|
1508 |
Class: CTestEventNotifier
|
|
1509 |
|
|
1510 |
Method: CheckCtlEventL
|
|
1511 |
|
|
1512 |
Description: Checks if CtlEvent should be called
|
|
1513 |
|
|
1514 |
Parameters: const TEventIf& aEvent: in: Event
|
|
1515 |
|
|
1516 |
Return Values: ETrue: If CtlEvent sould be called.
|
|
1517 |
|
|
1518 |
Errors/Exceptions: None
|
|
1519 |
|
|
1520 |
Status: Approved
|
|
1521 |
|
|
1522 |
-------------------------------------------------------------------------------
|
|
1523 |
*/
|
|
1524 |
TBool CTestEventNotifier::CheckCtlEvent( const TEventIf& aEvent )
|
|
1525 |
{
|
|
1526 |
const TDesC& eventName = aEvent.Name();
|
|
1527 |
TInt count = iEventArray.Count();
|
|
1528 |
for( TInt i = 0; i < count; i++ )
|
|
1529 |
{
|
|
1530 |
TPtrC name = iEventArray[i]->Des();
|
|
1531 |
if( name == eventName )
|
|
1532 |
{
|
|
1533 |
return ETrue;
|
|
1534 |
}
|
|
1535 |
}
|
|
1536 |
|
|
1537 |
return EFalse;
|
|
1538 |
}
|
|
1539 |
|
|
1540 |
/*
|
|
1541 |
-------------------------------------------------------------------------------
|
|
1542 |
|
|
1543 |
DESCRIPTION
|
|
1544 |
|
|
1545 |
This module contains implementation of CTestEventController class member
|
|
1546 |
functions.
|
|
1547 |
|
|
1548 |
-------------------------------------------------------------------------------
|
|
1549 |
*/
|
|
1550 |
|
|
1551 |
// ================= MEMBER FUNCTIONS =========================================
|
|
1552 |
|
|
1553 |
/*
|
|
1554 |
-------------------------------------------------------------------------------
|
|
1555 |
|
|
1556 |
Class: CTestEventController
|
|
1557 |
|
|
1558 |
Method: CTestEventController
|
|
1559 |
|
|
1560 |
Description: Default constructor
|
|
1561 |
|
|
1562 |
C++ default constructor can NOT contain any code, that
|
|
1563 |
might leave.
|
|
1564 |
|
|
1565 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
1566 |
const TEventIf& aEvent: in: Event
|
|
1567 |
|
|
1568 |
Return Values: None
|
|
1569 |
|
|
1570 |
Errors/Exceptions: None
|
|
1571 |
|
|
1572 |
Status: Approved
|
|
1573 |
|
|
1574 |
-------------------------------------------------------------------------------
|
|
1575 |
*/
|
|
1576 |
CTestEventController::CTestEventController( CTestEngine* aEngine,
|
|
1577 |
const TEventIf& aEvent ) :
|
|
1578 |
iEngine( aEngine ),
|
|
1579 |
iRequestStatus( NULL ),
|
|
1580 |
iEventPckg( iEvent ),
|
|
1581 |
iActiveEventCmds( 0 )
|
|
1582 |
{
|
|
1583 |
iEvent.Copy( aEvent );
|
|
1584 |
|
|
1585 |
}
|
|
1586 |
|
|
1587 |
/*
|
|
1588 |
-------------------------------------------------------------------------------
|
|
1589 |
|
|
1590 |
Class: CTestEventController
|
|
1591 |
|
|
1592 |
Method: ConstructL
|
|
1593 |
|
|
1594 |
Description: Symbian OS second phase constructor
|
|
1595 |
|
|
1596 |
Symbian OS default constructor can leave.
|
|
1597 |
|
|
1598 |
Parameters: TRequestStatus* aStatus: in: Request status
|
|
1599 |
|
|
1600 |
Return Values: None
|
|
1601 |
|
|
1602 |
Errors/Exceptions: None
|
|
1603 |
|
|
1604 |
Status: Approved
|
|
1605 |
|
|
1606 |
-------------------------------------------------------------------------------
|
|
1607 |
*/
|
|
1608 |
void CTestEventController::ConstructL( TRequestStatus* aStatus )
|
|
1609 |
{
|
|
1610 |
iEngine->Logger()->Log( _L( "CTestEventController::ConstructL" ) );
|
|
1611 |
|
|
1612 |
if( CheckEventsL() == 0 )
|
|
1613 |
{
|
|
1614 |
// No request was pending, complete immediately
|
|
1615 |
User::RequestComplete( aStatus, KErrNone );
|
|
1616 |
}
|
|
1617 |
else
|
|
1618 |
{
|
|
1619 |
iRequestStatus = aStatus;
|
|
1620 |
}
|
|
1621 |
|
|
1622 |
}
|
|
1623 |
|
|
1624 |
/*
|
|
1625 |
-------------------------------------------------------------------------------
|
|
1626 |
|
|
1627 |
Class: CTestEventController
|
|
1628 |
|
|
1629 |
Method: ConstructL
|
|
1630 |
|
|
1631 |
Description: Symbian OS second phase constructor
|
|
1632 |
|
|
1633 |
Symbian OS default constructor can leave.
|
|
1634 |
|
|
1635 |
Parameters: RMessage& aMessage: inout: Message to be handled
|
|
1636 |
|
|
1637 |
Return Values: None
|
|
1638 |
|
|
1639 |
Errors/Exceptions: None
|
|
1640 |
|
|
1641 |
Status: Approved
|
|
1642 |
|
|
1643 |
-------------------------------------------------------------------------------
|
|
1644 |
*/
|
|
1645 |
void CTestEventController::ConstructL( RMessage2& aMessage )
|
|
1646 |
{
|
|
1647 |
iEngine->Logger()->Log( _L( "CTestEventController::ConstructL" ) );
|
|
1648 |
|
|
1649 |
if( CheckEventsL() == 0 )
|
|
1650 |
{
|
|
1651 |
// No request was pending, complete immediately
|
|
1652 |
aMessage.Complete( KErrNone );
|
|
1653 |
}
|
|
1654 |
else
|
|
1655 |
{
|
|
1656 |
iMessage = aMessage;
|
|
1657 |
}
|
|
1658 |
|
|
1659 |
}
|
|
1660 |
|
|
1661 |
/*
|
|
1662 |
-------------------------------------------------------------------------------
|
|
1663 |
|
|
1664 |
Class: CTestEventNotifier
|
|
1665 |
|
|
1666 |
Method: NewL
|
|
1667 |
|
|
1668 |
Description: Two-phased constructor.
|
|
1669 |
|
|
1670 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
1671 |
const TEventIf& aEvent: in: Event
|
|
1672 |
TRequestStatus* aStatus: in: Request status
|
|
1673 |
|
|
1674 |
Return Values: CTestEventController* : pointer to created object
|
|
1675 |
|
|
1676 |
Errors/Exceptions: Leaves if construction of CTestEventController fails
|
|
1677 |
|
|
1678 |
Status: Approved
|
|
1679 |
|
|
1680 |
-------------------------------------------------------------------------------
|
|
1681 |
*/
|
|
1682 |
|
|
1683 |
CTestEventController* CTestEventController::NewL( CTestEngine* aEngine,
|
|
1684 |
const TEventIf& aEvent,
|
|
1685 |
TRequestStatus* aStatus )
|
|
1686 |
{
|
|
1687 |
CTestEventController* self =
|
|
1688 |
new ( ELeave )CTestEventController( aEngine, aEvent );
|
|
1689 |
CleanupStack::PushL( self );
|
|
1690 |
self->ConstructL( aStatus );
|
|
1691 |
CleanupStack::Pop( self );
|
|
1692 |
return self;
|
|
1693 |
|
|
1694 |
}
|
|
1695 |
|
|
1696 |
/*
|
|
1697 |
-------------------------------------------------------------------------------
|
|
1698 |
|
|
1699 |
Class: CTestEventNotifier
|
|
1700 |
|
|
1701 |
Method: NewL
|
|
1702 |
|
|
1703 |
Description: Two-phased constructor.
|
|
1704 |
|
|
1705 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
1706 |
const TEventIf& aEvent: in: Event
|
|
1707 |
RMessage& aMessage: inout: Message to be handled
|
|
1708 |
|
|
1709 |
Return Values: CTestEventController* : pointer to created object
|
|
1710 |
|
|
1711 |
Errors/Exceptions: Leaves if construction of CTestEventController fails
|
|
1712 |
|
|
1713 |
Status: Approved
|
|
1714 |
|
|
1715 |
-------------------------------------------------------------------------------
|
|
1716 |
*/
|
|
1717 |
CTestEventController* CTestEventController::NewL( CTestEngine* aEngine,
|
|
1718 |
const TEventIf& aEvent,
|
|
1719 |
RMessage2& aMessage )
|
|
1720 |
{
|
|
1721 |
CTestEventController* self =
|
|
1722 |
new ( ELeave )CTestEventController( aEngine, aEvent );
|
|
1723 |
CleanupStack::PushL( self );
|
|
1724 |
self->ConstructL( aMessage );
|
|
1725 |
CleanupStack::Pop( self );
|
|
1726 |
return self;
|
|
1727 |
|
|
1728 |
}
|
|
1729 |
|
|
1730 |
/*
|
|
1731 |
-------------------------------------------------------------------------------
|
|
1732 |
|
|
1733 |
Class: CTestEventController
|
|
1734 |
|
|
1735 |
Method: ~CTestEventController
|
|
1736 |
|
|
1737 |
Description: Destructor
|
|
1738 |
|
|
1739 |
Parameters: None
|
|
1740 |
|
|
1741 |
Return Values: None
|
|
1742 |
|
|
1743 |
Errors/Exceptions: None
|
|
1744 |
|
|
1745 |
Status: Proposal
|
|
1746 |
|
|
1747 |
-------------------------------------------------------------------------------
|
|
1748 |
*/
|
|
1749 |
|
|
1750 |
CTestEventController::~CTestEventController()
|
|
1751 |
{
|
|
1752 |
if( iEngine != NULL )
|
|
1753 |
{
|
|
1754 |
if( iEngine->Logger() != NULL )
|
|
1755 |
{
|
|
1756 |
iEngine->Logger()->Log( _L( "CTestEventController::~CTestEventController" ) );
|
|
1757 |
}
|
|
1758 |
}
|
|
1759 |
|
|
1760 |
if( iRequestStatus )
|
|
1761 |
{
|
|
1762 |
// Must be completed if pending, otherwise
|
|
1763 |
// CTestEventNotifier::DoCancel blocks
|
|
1764 |
User::RequestComplete( iRequestStatus, KErrCancel );
|
|
1765 |
}
|
|
1766 |
|
|
1767 |
iEventCallBacks.ResetAndDestroy();
|
|
1768 |
iEventCallBacks.Close();
|
|
1769 |
|
|
1770 |
}
|
|
1771 |
|
|
1772 |
/*
|
|
1773 |
-------------------------------------------------------------------------------
|
|
1774 |
|
|
1775 |
Class: CTestEventController
|
|
1776 |
|
|
1777 |
Method: CheckEventsL
|
|
1778 |
|
|
1779 |
Description: Check all events.
|
|
1780 |
|
|
1781 |
Parameters: None
|
|
1782 |
|
|
1783 |
Return Values: TInt: Active event commands
|
|
1784 |
|
|
1785 |
Errors/Exceptions: Leaves if CtlEventL leaves
|
|
1786 |
Leaves if memory allocation fails
|
|
1787 |
Leaves if unset event not found from pending
|
|
1788 |
state event list
|
|
1789 |
|
|
1790 |
Status: Approved
|
|
1791 |
|
|
1792 |
-------------------------------------------------------------------------------
|
|
1793 |
*/
|
|
1794 |
TInt CTestEventController::CheckEventsL()
|
|
1795 |
{
|
|
1796 |
iEngine->Logger()->Log( _L( "CTestEventController::CheckEventsL" ) );
|
|
1797 |
|
|
1798 |
iActiveEventCmds += CheckClientEventsL();
|
|
1799 |
iActiveEventCmds += CheckTestcaseEventsL();
|
|
1800 |
|
|
1801 |
return iActiveEventCmds;
|
|
1802 |
|
|
1803 |
}
|
|
1804 |
|
|
1805 |
/*
|
|
1806 |
-------------------------------------------------------------------------------
|
|
1807 |
|
|
1808 |
Class: CTestEventController
|
|
1809 |
|
|
1810 |
Method: CheckClientEventsL
|
|
1811 |
|
|
1812 |
Description: Check client events.
|
|
1813 |
|
|
1814 |
Parameters: None
|
|
1815 |
|
|
1816 |
Return Values: TInt: Request of pending
|
|
1817 |
|
|
1818 |
Errors/Exceptions: Leaves if CtlEventL leaves
|
|
1819 |
Leaves if memory allocation fails
|
|
1820 |
Leaves if unset event not found from pending
|
|
1821 |
state event list
|
|
1822 |
|
|
1823 |
Status: Approved
|
|
1824 |
|
|
1825 |
-------------------------------------------------------------------------------
|
|
1826 |
*/
|
|
1827 |
TInt CTestEventController::CheckClientEventsL()
|
|
1828 |
{
|
|
1829 |
iEngine->Logger()->Log( _L( "CTestEventController::CheckClientEventsL" ) );
|
|
1830 |
TInt reqPending = 0;
|
|
1831 |
|
|
1832 |
// Check client event requests
|
|
1833 |
TInt count = iEngine->ClientEvents().Count();
|
|
1834 |
for( TInt index = 0; index < count; index++ )
|
|
1835 |
{
|
|
1836 |
if( iEngine->ClientEvents()[index]->Name() == iEvent.Name() )
|
|
1837 |
{
|
|
1838 |
TEventMsg* event = iEngine->ClientEvents()[index];
|
|
1839 |
if( iEvent.Type() == TEventIf::ESetEvent )
|
|
1840 |
{
|
|
1841 |
// Set found event
|
|
1842 |
event->Set( iEvent.EventType() );
|
|
1843 |
}
|
|
1844 |
else if( iEvent.Type() == TEventIf::EUnsetEvent )
|
|
1845 |
{
|
|
1846 |
// Unset found event
|
|
1847 |
// Create callback for change notifier
|
|
1848 |
TCallBack callBack( EventCallBack, this );
|
|
1849 |
CCallBack* eventCallBack = new (ELeave)CCallBack( callBack,
|
|
1850 |
CActive::EPriorityHigh );
|
|
1851 |
CleanupStack::PushL( eventCallBack );
|
|
1852 |
|
|
1853 |
event->Unset( eventCallBack->Status() );
|
|
1854 |
reqPending++;
|
|
1855 |
eventCallBack->SetActive();
|
|
1856 |
User::LeaveIfError( iEventCallBacks.Append( eventCallBack ) );
|
|
1857 |
CleanupStack::Pop( eventCallBack );
|
|
1858 |
}
|
|
1859 |
break;
|
|
1860 |
}
|
|
1861 |
}
|
|
1862 |
|
|
1863 |
return reqPending;
|
|
1864 |
|
|
1865 |
}
|
|
1866 |
|
|
1867 |
/*
|
|
1868 |
-------------------------------------------------------------------------------
|
|
1869 |
|
|
1870 |
Class: CTestEventController
|
|
1871 |
|
|
1872 |
Method: CheckTestcaseEventsL
|
|
1873 |
|
|
1874 |
Description: Check testcase events.
|
|
1875 |
|
|
1876 |
Parameters: None
|
|
1877 |
|
|
1878 |
Return Values: TInt: Request of pending
|
|
1879 |
|
|
1880 |
Errors/Exceptions: Leaves if CtlEventL leaves
|
|
1881 |
Leaves if memory allocation fails
|
|
1882 |
Leaves if unset event not found from pending
|
|
1883 |
state event list
|
|
1884 |
|
|
1885 |
Status: Approved
|
|
1886 |
|
|
1887 |
-------------------------------------------------------------------------------
|
|
1888 |
*/
|
|
1889 |
TInt CTestEventController::CheckTestcaseEventsL()
|
|
1890 |
{
|
|
1891 |
TInt reqPending = 0;
|
|
1892 |
TCallBack callBack( EventCallBack, this );
|
|
1893 |
CCallBack* eventCallBack = NULL;
|
|
1894 |
|
|
1895 |
// Then check testcase event requests
|
|
1896 |
TInt count = iEngine->TestCaseArray().Count();
|
|
1897 |
eventCallBack = new (ELeave)CCallBack( callBack,
|
|
1898 |
CActive::EPriorityHigh );
|
|
1899 |
CleanupStack::PushL( eventCallBack );
|
|
1900 |
for ( TInt index = 0; index < count; index++ )
|
|
1901 |
{
|
|
1902 |
|
|
1903 |
if( iEngine->TestCaseArray()[index]->CheckCtlEvent( iEvent ))
|
|
1904 |
{
|
|
1905 |
reqPending++;
|
|
1906 |
eventCallBack->SetActive();
|
|
1907 |
iEngine->TestCaseArray()[index]->CtlEvent( iEvent,
|
|
1908 |
eventCallBack->Status() );
|
|
1909 |
User::LeaveIfError( iEventCallBacks.Append( eventCallBack ) );
|
|
1910 |
CleanupStack::Pop( eventCallBack );
|
|
1911 |
eventCallBack = new (ELeave)CCallBack( callBack,
|
|
1912 |
CActive::EPriorityHigh );
|
|
1913 |
CleanupStack::PushL( eventCallBack );
|
|
1914 |
}
|
|
1915 |
}
|
|
1916 |
CleanupStack::PopAndDestroy( eventCallBack );
|
|
1917 |
return reqPending;
|
|
1918 |
|
|
1919 |
}
|
|
1920 |
|
|
1921 |
/*
|
|
1922 |
-------------------------------------------------------------------------------
|
|
1923 |
|
|
1924 |
Class: CTestEventController
|
|
1925 |
|
|
1926 |
Method: EventComplete
|
|
1927 |
|
|
1928 |
Description: EventComplete handles completed event requests.
|
|
1929 |
|
|
1930 |
Parameters: None
|
|
1931 |
|
|
1932 |
Return Values: None
|
|
1933 |
|
|
1934 |
Errors/Exceptions:
|
|
1935 |
|
|
1936 |
Status: Approved
|
|
1937 |
|
|
1938 |
-------------------------------------------------------------------------------
|
|
1939 |
*/
|
|
1940 |
void CTestEventController::EventComplete()
|
|
1941 |
{
|
|
1942 |
iEngine->Logger()->Log( _L( "CTestEventController::EventComplete" ));
|
|
1943 |
|
|
1944 |
iActiveEventCmds--;
|
|
1945 |
|
|
1946 |
if( iActiveEventCmds == 0 )
|
|
1947 |
{
|
|
1948 |
TInt error = KErrNone;
|
|
1949 |
TInt count = iEventCallBacks.Count();
|
|
1950 |
for( TInt i=0; i<count; i++ )
|
|
1951 |
{
|
|
1952 |
if( iEventCallBacks[i]->iStatus.Int() != KErrNone )
|
|
1953 |
{
|
|
1954 |
error = iEventCallBacks[i]->iStatus.Int();
|
|
1955 |
break;
|
|
1956 |
}
|
|
1957 |
}
|
|
1958 |
iEventCallBacks.ResetAndDestroy();
|
|
1959 |
|
|
1960 |
// All event commands are completed
|
|
1961 |
if( iRequestStatus )
|
|
1962 |
{
|
|
1963 |
User::RequestComplete( iRequestStatus, error );
|
|
1964 |
}
|
|
1965 |
else
|
|
1966 |
{
|
|
1967 |
// No request was pending, complete immediately
|
|
1968 |
iMessage.Complete( error );
|
|
1969 |
}
|
|
1970 |
}
|
|
1971 |
|
|
1972 |
}
|
|
1973 |
|
|
1974 |
/*
|
|
1975 |
-------------------------------------------------------------------------------
|
|
1976 |
|
|
1977 |
Class: CTestEventController
|
|
1978 |
|
|
1979 |
Method: EventCallBack
|
|
1980 |
|
|
1981 |
Description: static EventCallBack handles completed event requests.
|
|
1982 |
|
|
1983 |
Parameters: TAny* aTestEventController: in: Test event controller
|
|
1984 |
|
|
1985 |
Return Values: TInt: returns KErrNone
|
|
1986 |
|
|
1987 |
Errors/Exceptions:None
|
|
1988 |
|
|
1989 |
Status: Approved
|
|
1990 |
|
|
1991 |
-------------------------------------------------------------------------------
|
|
1992 |
*/
|
|
1993 |
TInt CTestEventController::EventCallBack( TAny* aTestEventController )
|
|
1994 |
{
|
|
1995 |
CTestEventController* controller =
|
|
1996 |
(CTestEventController*) aTestEventController;
|
|
1997 |
controller->EventComplete();
|
|
1998 |
return KErrNone;
|
|
1999 |
|
|
2000 |
}
|
|
2001 |
|
|
2002 |
|
|
2003 |
/*
|
|
2004 |
-------------------------------------------------------------------------------
|
|
2005 |
|
|
2006 |
DESCRIPTION
|
|
2007 |
|
|
2008 |
This module contains implementation of CTestRemoteCmdNotifier class member
|
|
2009 |
functions.
|
|
2010 |
|
|
2011 |
-------------------------------------------------------------------------------
|
|
2012 |
*/
|
|
2013 |
|
|
2014 |
// ================= MEMBER FUNCTIONS =========================================
|
|
2015 |
|
|
2016 |
/*
|
|
2017 |
-------------------------------------------------------------------------------
|
|
2018 |
|
|
2019 |
Class: CTestProgressNotifier
|
|
2020 |
|
|
2021 |
Method: CTestRemoteCmdNotifier
|
|
2022 |
|
|
2023 |
Description: Default constructor
|
|
2024 |
|
|
2025 |
C++ default constructor can NOT contain any code, that
|
|
2026 |
might leave.
|
|
2027 |
|
|
2028 |
Parameters: None
|
|
2029 |
|
|
2030 |
Return Values: None
|
|
2031 |
|
|
2032 |
Errors/Exceptions: None
|
|
2033 |
|
|
2034 |
Status: Draft
|
|
2035 |
|
|
2036 |
-------------------------------------------------------------------------------
|
|
2037 |
*/
|
|
2038 |
CTestRemoteCmdNotifier::CTestRemoteCmdNotifier( CTestEngine* aEngine,
|
|
2039 |
RTestExecution aTestExecution,
|
|
2040 |
CTestCaseController* aTestCaseController,
|
|
2041 |
CAtsLogger& aAtsLogger ) :
|
|
2042 |
CActive( CActive::EPriorityStandard ),
|
|
2043 |
iEngine( aEngine ),
|
|
2044 |
iTestExecution( aTestExecution ),
|
|
2045 |
iState( ETestProgressIdle ),
|
|
2046 |
iRemoteTypePckg( iRemoteType ),
|
|
2047 |
iMsgSizePckg( iMsgSize ),
|
|
2048 |
iTestCaseController( aTestCaseController ),
|
|
2049 |
iAtsLogger( aAtsLogger )
|
|
2050 |
{
|
|
2051 |
CActiveScheduler::Add( this );
|
|
2052 |
|
|
2053 |
}
|
|
2054 |
|
|
2055 |
/*
|
|
2056 |
-------------------------------------------------------------------------------
|
|
2057 |
|
|
2058 |
Class: CTestRemoteCmdNotifier
|
|
2059 |
|
|
2060 |
Method: ConstructL
|
|
2061 |
|
|
2062 |
Description: Symbian OS second phase constructor
|
|
2063 |
|
|
2064 |
Symbian OS default constructor can leave.
|
|
2065 |
|
|
2066 |
Parameters: None
|
|
2067 |
|
|
2068 |
Return Values: None
|
|
2069 |
|
|
2070 |
Errors/Exceptions: None
|
|
2071 |
|
|
2072 |
Status: Draft
|
|
2073 |
|
|
2074 |
-------------------------------------------------------------------------------
|
|
2075 |
*/
|
|
2076 |
void CTestRemoteCmdNotifier::ConstructL( )
|
|
2077 |
{
|
|
2078 |
__TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::ConstructL" ) ) );
|
|
2079 |
|
|
2080 |
}
|
|
2081 |
|
|
2082 |
/*
|
|
2083 |
-------------------------------------------------------------------------------
|
|
2084 |
|
|
2085 |
Class: CTestRemoteCmdNotifier
|
|
2086 |
|
|
2087 |
Method: NewL
|
|
2088 |
|
|
2089 |
Description: Two-phased constructor.
|
|
2090 |
|
|
2091 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
2092 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
2093 |
|
|
2094 |
Return Values: CTestRemoteCmdNotifier* : pointer to created object
|
|
2095 |
|
|
2096 |
Errors/Exceptions: Leaves if construction of CTestRemoteCmdNotifier fails
|
|
2097 |
|
|
2098 |
Status: Draft
|
|
2099 |
|
|
2100 |
-------------------------------------------------------------------------------
|
|
2101 |
*/
|
|
2102 |
CTestRemoteCmdNotifier* CTestRemoteCmdNotifier::NewL( CTestEngine* aEngine,
|
|
2103 |
RTestExecution aTestExecution,
|
|
2104 |
CTestCaseController* aTestCaseController,
|
|
2105 |
CAtsLogger& aAtsLogger )
|
|
2106 |
{
|
|
2107 |
CTestRemoteCmdNotifier* self = new ( ELeave ) CTestRemoteCmdNotifier(
|
|
2108 |
aEngine, aTestExecution, aTestCaseController, aAtsLogger );
|
|
2109 |
CleanupStack::PushL( self );
|
|
2110 |
self->ConstructL();
|
|
2111 |
CleanupStack::Pop( self );
|
|
2112 |
return self;
|
|
2113 |
|
|
2114 |
}
|
|
2115 |
|
|
2116 |
/*
|
|
2117 |
-------------------------------------------------------------------------------
|
|
2118 |
|
|
2119 |
Class: CTestRemoteCmdNotifier
|
|
2120 |
|
|
2121 |
Method: ~CTestRemoteCmdNotifier
|
|
2122 |
|
|
2123 |
Description: Destructor
|
|
2124 |
|
|
2125 |
Parameters: None
|
|
2126 |
|
|
2127 |
Return Values: None
|
|
2128 |
|
|
2129 |
Errors/Exceptions: None
|
|
2130 |
|
|
2131 |
Status: Draft
|
|
2132 |
|
|
2133 |
-------------------------------------------------------------------------------
|
|
2134 |
*/
|
|
2135 |
CTestRemoteCmdNotifier::~CTestRemoteCmdNotifier()
|
|
2136 |
{
|
|
2137 |
__TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::~CTestRemoteCmdNotifier" ) ) );
|
|
2138 |
Cancel();
|
|
2139 |
|
|
2140 |
delete iReceivedMsg;
|
|
2141 |
iReceivedMsg = 0;
|
|
2142 |
|
|
2143 |
}
|
|
2144 |
|
|
2145 |
/*
|
|
2146 |
-------------------------------------------------------------------------------
|
|
2147 |
|
|
2148 |
Class: CTestRemoteCmdNotifier
|
|
2149 |
|
|
2150 |
Method: EnableReceive
|
|
2151 |
|
|
2152 |
Description: Prepare to start active object
|
|
2153 |
|
|
2154 |
Parameters: const RMessage& aMessage: in: Server message
|
|
2155 |
|
|
2156 |
Return Values: None
|
|
2157 |
|
|
2158 |
Errors/Exceptions: None
|
|
2159 |
|
|
2160 |
Status: Draft
|
|
2161 |
|
|
2162 |
-------------------------------------------------------------------------------
|
|
2163 |
*/
|
|
2164 |
void CTestRemoteCmdNotifier::EnableReceive( const RMessage2& aMessage )
|
|
2165 |
{
|
|
2166 |
__TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::EnableReceive" ) ) );
|
|
2167 |
|
|
2168 |
iMessage = aMessage;
|
|
2169 |
iMessageAvail = ETrue;
|
|
2170 |
|
|
2171 |
Start( aMessage );
|
|
2172 |
|
|
2173 |
}
|
|
2174 |
|
|
2175 |
/*
|
|
2176 |
-------------------------------------------------------------------------------
|
|
2177 |
|
|
2178 |
Class: CTestRemoteCmdNotifier
|
|
2179 |
|
|
2180 |
Method: GetReceivedMsg
|
|
2181 |
|
|
2182 |
Description: Read received message
|
|
2183 |
|
|
2184 |
Parameters: const RMessage& aMessage: in: Server message
|
|
2185 |
|
|
2186 |
Return Values: None
|
|
2187 |
|
|
2188 |
Errors/Exceptions: None
|
|
2189 |
|
|
2190 |
Status: Draft
|
|
2191 |
|
|
2192 |
-------------------------------------------------------------------------------
|
|
2193 |
*/
|
|
2194 |
void CTestRemoteCmdNotifier::GetReceivedMsg( const RMessage2& aMessage )
|
|
2195 |
{
|
|
2196 |
__TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::GetReceivedMsg" ) ) );
|
|
2197 |
|
|
2198 |
TInt ret = KErrNone;
|
|
2199 |
if( iReceivedMsg )
|
|
2200 |
{
|
|
2201 |
TRAP( ret, aMessage.WriteL( 0, iReceivedMsg->Des() ) );
|
|
2202 |
delete iReceivedMsg;
|
|
2203 |
iReceivedMsg = 0;
|
|
2204 |
}
|
|
2205 |
else
|
|
2206 |
{
|
|
2207 |
ret = KErrNotFound;
|
|
2208 |
}
|
|
2209 |
|
|
2210 |
// Complete message
|
|
2211 |
aMessage.Complete( ret );
|
|
2212 |
|
|
2213 |
}
|
|
2214 |
|
|
2215 |
/*
|
|
2216 |
-------------------------------------------------------------------------------
|
|
2217 |
|
|
2218 |
Class: CTestRemoteCmdNotifier
|
|
2219 |
|
|
2220 |
Method: StartL
|
|
2221 |
|
|
2222 |
Description: Start active object
|
|
2223 |
|
|
2224 |
Parameters: None
|
|
2225 |
|
|
2226 |
Return Values: None
|
|
2227 |
|
|
2228 |
Errors/Exceptions: None
|
|
2229 |
|
|
2230 |
Status: Draft
|
|
2231 |
|
|
2232 |
-------------------------------------------------------------------------------
|
|
2233 |
*/
|
|
2234 |
void CTestRemoteCmdNotifier::Start( const RMessage2& aMessage )
|
|
2235 |
{
|
|
2236 |
// Check that this request is not pending!!
|
|
2237 |
__ASSERT_ALWAYS( iState != ETestProgressPending,
|
|
2238 |
iEngine->PanicClient( EReqPending, aMessage ) );
|
|
2239 |
iState = ETestProgressPending;
|
|
2240 |
SetActive();
|
|
2241 |
// Start first phase of the remote command's operations
|
|
2242 |
iTestExecution.NotifyRemoteCmd( iRemoteTypePckg,
|
|
2243 |
iMsgSizePckg,
|
|
2244 |
iStatus );
|
|
2245 |
|
|
2246 |
}
|
|
2247 |
|
|
2248 |
/*
|
|
2249 |
-------------------------------------------------------------------------------
|
|
2250 |
|
|
2251 |
Class: CTestRemoteCmdNotifier
|
|
2252 |
|
|
2253 |
Method: CancelReq
|
|
2254 |
|
|
2255 |
Description: Cancel the request.
|
|
2256 |
|
|
2257 |
Parameters: None
|
|
2258 |
|
|
2259 |
Return Values: None
|
|
2260 |
|
|
2261 |
Errors/Exceptions: None
|
|
2262 |
|
|
2263 |
Status: Draft
|
|
2264 |
|
|
2265 |
-------------------------------------------------------------------------------
|
|
2266 |
*/
|
|
2267 |
void CTestRemoteCmdNotifier::CancelReq()
|
|
2268 |
{
|
|
2269 |
if(iMessageAvail)
|
|
2270 |
{
|
|
2271 |
iMessageAvail = EFalse;
|
|
2272 |
iMessage.Complete( KErrCancel );
|
|
2273 |
}
|
|
2274 |
}
|
|
2275 |
|
|
2276 |
/*
|
|
2277 |
-------------------------------------------------------------------------------
|
|
2278 |
|
|
2279 |
Class: CTestRemoteCmdNotifier
|
|
2280 |
|
|
2281 |
Method: RunL
|
|
2282 |
|
|
2283 |
Description: RunL handles completed requests.
|
|
2284 |
|
|
2285 |
Parameters: None
|
|
2286 |
|
|
2287 |
Return Values: None
|
|
2288 |
|
|
2289 |
Errors/Exceptions: Leaves if WriteL leaves
|
|
2290 |
Leaves if iStatus is not KErrNone or KErrEof
|
|
2291 |
Leaves are handled in RunError method
|
|
2292 |
|
|
2293 |
Status: Approved
|
|
2294 |
|
|
2295 |
-------------------------------------------------------------------------------
|
|
2296 |
*/
|
|
2297 |
void CTestRemoteCmdNotifier::RunL()
|
|
2298 |
{
|
|
2299 |
__TRACE( KVerbose, ( _L( "CTestRemoteCmdNotifier::StartL: iStatus=[%d]" ), iStatus.Int() ) );
|
|
2300 |
|
|
2301 |
User::LeaveIfError( iStatus.Int() );
|
|
2302 |
|
|
2303 |
iState = ETestProgressCompleted;
|
|
2304 |
|
|
2305 |
TInt ret( 0 );
|
|
2306 |
switch( iRemoteType )
|
|
2307 |
{
|
|
2308 |
case EStifCmdSend: // "Sending"
|
|
2309 |
{
|
|
2310 |
if( ( iMessageAvail == EFalse ) ||
|
|
2311 |
( iMsgSize <= 0 ) )
|
|
2312 |
{
|
|
2313 |
User::Leave( KErrGeneral );
|
|
2314 |
}
|
|
2315 |
// Delete previous if exists
|
|
2316 |
delete iReceivedMsg;
|
|
2317 |
iReceivedMsg = 0;
|
|
2318 |
// Create new buffer
|
|
2319 |
iReceivedMsg = HBufC8::NewL( iMsgSize );
|
|
2320 |
|
|
2321 |
// Start second phase of the remote command's operations,
|
|
2322 |
// buffer is read with GetReceivedMsg
|
|
2323 |
TPtr8 tmp = iReceivedMsg->Des();
|
|
2324 |
ret = iTestExecution.ReadRemoteCmdInfo( tmp, iRemoteType );
|
|
2325 |
|
|
2326 |
// Writing received info to UI
|
|
2327 |
iMessage.WriteL( 0, iRemoteTypePckg );
|
|
2328 |
iMessage.WriteL( 1, iMsgSizePckg );
|
|
2329 |
|
|
2330 |
// Complete message
|
|
2331 |
iMessage.Complete( ret );
|
|
2332 |
iMessageAvail = EFalse;
|
|
2333 |
|
|
2334 |
break;
|
|
2335 |
}
|
|
2336 |
case EStifCmdReboot: // "Sending"
|
|
2337 |
{
|
|
2338 |
TRebootParams remoteType;
|
|
2339 |
TRebootParamsPckg remoteTypePckg( remoteType );
|
|
2340 |
// Start second phase of the remote command's operations
|
|
2341 |
ret = iTestExecution.ReadRemoteCmdInfo( remoteTypePckg, iRemoteType );
|
|
2342 |
__TRACE( KInit, ( CStifLogger::ERed, _L("REBOOT PHONE (type %d)" ), remoteType.aType ) );
|
|
2343 |
|
|
2344 |
if( remoteType.aType == CTestModuleIf::EKernelReset )
|
|
2345 |
{
|
|
2346 |
__TRACE( KInit, ( _L("Rebooting with kernel reset" ) ) );
|
|
2347 |
__TRACE( KInit, ( _L("Kernel reset implementation is ongoing, trying different reset..." ) ) );
|
|
2348 |
}
|
|
2349 |
|
|
2350 |
#ifdef __WINS__
|
|
2351 |
__TRACE( KInit, ( _L("Rebooting with Process kill(WINS)" ) ) );
|
|
2352 |
RProcess thisProcess;
|
|
2353 |
//thisProcess.SetSystem( ETrue );
|
|
2354 |
thisProcess.Kill( KErrNone );
|
|
2355 |
thisProcess.Close();
|
|
2356 |
#else // Hardware specific
|
|
2357 |
TInt r( KErrNone );
|
|
2358 |
__TRACE( KInit, ( _L("Rebooting with reset module(HW)" ) ) );
|
|
2359 |
r = DynamicResetModule( remoteType.aType );
|
|
2360 |
if( r != KErrNone )
|
|
2361 |
{
|
|
2362 |
__TRACE( KInit, ( CStifLogger::EError, _L("This reseting type is failed, trying different reset...")) );
|
|
2363 |
}
|
|
2364 |
#endif // Hardware specific
|
|
2365 |
|
|
2366 |
// if( !remoteType.aType == CTestModuleIf::EDefaultReset )
|
|
2367 |
// Note this change needs an error code tranceiver between reboot
|
|
2368 |
// module and engine. (If reboot fails return error code, if reboot
|
|
2369 |
// is default then kill process else error code returning)
|
|
2370 |
|
|
2371 |
// Do process kill as a last option
|
|
2372 |
__TRACE( KInit, ( _L("Rebooting with Process kill" ) ) );
|
|
2373 |
|
|
2374 |
RProcess thisProcess2;
|
|
2375 |
thisProcess2.Kill( KErrNone );
|
|
2376 |
thisProcess2.Close();
|
|
2377 |
|
|
2378 |
// If this text is shown in UI something is wrong and this needs some investigation.
|
|
2379 |
iEngine->ErrorPrint( 0, _L( "Reboot phone...E.g. disconnect battery!!!" ) );
|
|
2380 |
break;
|
|
2381 |
}
|
|
2382 |
case EStifCmdStoreState: // "Sending"
|
|
2383 |
{
|
|
2384 |
if( iMessageAvail == EFalse )
|
|
2385 |
{
|
|
2386 |
User::Leave( KErrGeneral );
|
|
2387 |
}
|
|
2388 |
TRebootStateParams remoteState;
|
|
2389 |
TRebootStateParamsPckg remoteStatePckg( remoteState );
|
|
2390 |
|
|
2391 |
// Start second phase of the remote command's operations
|
|
2392 |
ret = iTestExecution.ReadRemoteCmdInfo( remoteStatePckg,
|
|
2393 |
iRemoteType );
|
|
2394 |
|
|
2395 |
// Get test case information(test module, test case file, etc.)
|
|
2396 |
TTestInfo testInfo;
|
|
2397 |
iTestCaseController->GetTestCaseInfo( testInfo );
|
|
2398 |
|
|
2399 |
// Write state informations to the file
|
|
2400 |
iEngine->WriteRebootParams( testInfo, remoteState.aCode,
|
|
2401 |
remoteState.aName );
|
|
2402 |
|
|
2403 |
// Write ATS loggers buffers to drive
|
|
2404 |
iEngine->FlushAtsLogger();
|
|
2405 |
|
|
2406 |
// Pause test cases that there cannot make e.g. new store state
|
|
2407 |
// calls. iCaseNumber is index type value so increment by one to
|
|
2408 |
// get current test case.
|
|
2409 |
iEngine->PauseAllTestCases();
|
|
2410 |
// Resume current test case
|
|
2411 |
iTestCaseController->iTestExecution.Resume();
|
|
2412 |
|
|
2413 |
// Writing received info to UI
|
|
2414 |
iMessage.WriteL( 0, iRemoteTypePckg );
|
|
2415 |
|
|
2416 |
// Complete message
|
|
2417 |
iMessage.Complete( ret );
|
|
2418 |
iMessageAvail = EFalse;
|
|
2419 |
break;
|
|
2420 |
}
|
|
2421 |
case EStifCmdGetStoredState: // "Reading, this must be done with two phase"
|
|
2422 |
{
|
|
2423 |
// Get test case information(test module, test case file, etc.)
|
|
2424 |
TTestInfo testInfo;
|
|
2425 |
iTestCaseController->GetTestCaseInfo( testInfo );
|
|
2426 |
|
|
2427 |
TGetRebootStoredParams remoteStoredState;
|
|
2428 |
// Read state informations from the file
|
|
2429 |
TInt errorCodeToClient =
|
|
2430 |
iEngine->ReadRebootParams( testInfo,
|
|
2431 |
remoteStoredState.aName,
|
|
2432 |
remoteStoredState.aCode );
|
|
2433 |
|
|
2434 |
TGetRebootStoredParamsPckg remoteStoredPckg( remoteStoredState );
|
|
2435 |
|
|
2436 |
// Start second phase of the remote command's operations
|
|
2437 |
ret = iTestExecution.ReadRemoteCmdInfo( remoteStoredPckg,
|
|
2438 |
iRemoteType,
|
|
2439 |
errorCodeToClient );
|
|
2440 |
|
|
2441 |
Start( iMessage ); // Starts active object
|
|
2442 |
|
|
2443 |
break;
|
|
2444 |
}
|
|
2445 |
case EStifCmdMeasurement: // "Reading, this must be done with two phase"
|
|
2446 |
{
|
|
2447 |
TGetMeasurementOptions remoteMeasurementOptions;
|
|
2448 |
remoteMeasurementOptions.iOptions = iEngine->StifMeasurement();
|
|
2449 |
|
|
2450 |
TGetMeasurementOptionsPckg remoteMeasurementPckg( remoteMeasurementOptions );
|
|
2451 |
|
|
2452 |
// Start second phase of the remote command's operations
|
|
2453 |
ret = iTestExecution.ReadRemoteCmdInfo( remoteMeasurementPckg,
|
|
2454 |
iRemoteType,
|
|
2455 |
KErrNone );
|
|
2456 |
|
|
2457 |
Start( iMessage ); // Starts active object
|
|
2458 |
|
|
2459 |
break;
|
|
2460 |
}
|
|
2461 |
|
|
2462 |
case EStifCmdReceive: // "Reading"
|
|
2463 |
default:
|
|
2464 |
User::Leave( KErrNotFound );
|
|
2465 |
break;
|
|
2466 |
}
|
|
2467 |
|
|
2468 |
}
|
|
2469 |
|
|
2470 |
/*
|
|
2471 |
-------------------------------------------------------------------------------
|
|
2472 |
|
|
2473 |
Class: CTestRemoteCmdNotifier
|
|
2474 |
|
|
2475 |
Method: DoCancel
|
|
2476 |
|
|
2477 |
Description: Cancel active request
|
|
2478 |
|
|
2479 |
Parameters: None
|
|
2480 |
|
|
2481 |
Return Values: None
|
|
2482 |
|
|
2483 |
Errors/Exceptions: None
|
|
2484 |
|
|
2485 |
Status: Draft
|
|
2486 |
|
|
2487 |
-------------------------------------------------------------------------------
|
|
2488 |
*/
|
|
2489 |
void CTestRemoteCmdNotifier::DoCancel()
|
|
2490 |
{
|
|
2491 |
switch ( iState )
|
|
2492 |
{
|
|
2493 |
case ETestProgressPending:
|
|
2494 |
iTestExecution.CancelAsyncRequest( ETestExecutionNotifyRemoteCmd );
|
|
2495 |
//iMessage.Complete( KErrCancel );
|
|
2496 |
break;
|
|
2497 |
case ETestProgressIdle:
|
|
2498 |
case ETestProgressCompleted:
|
|
2499 |
default:
|
|
2500 |
// DoCancel called in wrong state => Panic
|
|
2501 |
_LIT( KTestRemoteCmdNotifier, "CTestRemoteCmdNotifier" );
|
|
2502 |
User::Panic( KTestRemoteCmdNotifier, EDoCancelDisorder );
|
|
2503 |
break;
|
|
2504 |
}
|
|
2505 |
iState = ETestProgressIdle;
|
|
2506 |
|
|
2507 |
}
|
|
2508 |
|
|
2509 |
/*
|
|
2510 |
-------------------------------------------------------------------------------
|
|
2511 |
|
|
2512 |
Class: CTestRemoteCmdNotifier
|
|
2513 |
|
|
2514 |
Method: RunError
|
|
2515 |
|
|
2516 |
Description: Handle errors.
|
|
2517 |
|
|
2518 |
Parameters: TInt aError: in: Symbian OS error: Error code
|
|
2519 |
|
|
2520 |
Return Values: TInt KErrNone: Always returned KErrNone
|
|
2521 |
|
|
2522 |
Errors/Exceptions: None
|
|
2523 |
|
|
2524 |
Status: Draft
|
|
2525 |
|
|
2526 |
-------------------------------------------------------------------------------
|
|
2527 |
*/
|
|
2528 |
TInt CTestRemoteCmdNotifier::RunError( TInt aError )
|
|
2529 |
{
|
|
2530 |
// Complete message with error
|
|
2531 |
if(iMessageAvail)
|
|
2532 |
{
|
|
2533 |
iMessageAvail = EFalse;
|
|
2534 |
iMessage.Complete( aError );
|
|
2535 |
}
|
|
2536 |
|
|
2537 |
return KErrNone;
|
|
2538 |
|
|
2539 |
}
|
|
2540 |
|
|
2541 |
/*
|
|
2542 |
-------------------------------------------------------------------------------
|
|
2543 |
|
|
2544 |
Class: CTestRemoteCmdNotifier
|
|
2545 |
|
|
2546 |
Method: ResetL
|
|
2547 |
|
|
2548 |
Description: Reset HW/WINS. Loads dynamically reset module by name.
|
|
2549 |
|
|
2550 |
Parameters: CTestModuleIf::TRebootType aResetType: in: Reset type
|
|
2551 |
|
|
2552 |
Return Values: TInt: Symbian error code.
|
|
2553 |
|
|
2554 |
Errors/Exceptions: None
|
|
2555 |
|
|
2556 |
Status: Proposal
|
|
2557 |
|
|
2558 |
-------------------------------------------------------------------------------
|
|
2559 |
*/
|
|
2560 |
TInt CTestRemoteCmdNotifier::DynamicResetModule(
|
|
2561 |
CTestModuleIf::TRebootType aResetType )
|
|
2562 |
{
|
|
2563 |
__TRACE( KInit, ( _L( "DynamicResetModule()" ) ) );
|
|
2564 |
RLibrary resetModule;
|
|
2565 |
// Load the module
|
|
2566 |
TPtrC dllName;
|
|
2567 |
dllName.Set( iEngine->GetDeviceResetDllName() );
|
|
2568 |
// Loading should work with and without '.dll' extension.
|
|
2569 |
TInt r = resetModule.Load( dllName );
|
|
2570 |
if ( r != KErrNone )
|
|
2571 |
{
|
|
2572 |
__TRACE( KError, ( CStifLogger::EError, _L("Can't initialize reset module[%S], code = %d"), &dllName, r ) );
|
|
2573 |
return KErrNotFound;
|
|
2574 |
}
|
|
2575 |
else
|
|
2576 |
{
|
|
2577 |
// Print reset module name
|
|
2578 |
__TRACE( KInit, ( _L("Loaded reset module[%S]"), &dllName ) );
|
|
2579 |
}
|
|
2580 |
|
|
2581 |
|
|
2582 |
// Get pointer to first exported function
|
|
2583 |
CTestInterfaceFactory libEntry;
|
|
2584 |
libEntry = (CTestInterfaceFactory) resetModule.Lookup( 1 );
|
|
2585 |
if ( libEntry == NULL )
|
|
2586 |
{
|
|
2587 |
// New instance can't be created
|
|
2588 |
__TRACE ( KError, ( CStifLogger::EError, _L("Can't initialize reset module, NULL libEntry" ) ) );
|
|
2589 |
return KErrNoMemory;
|
|
2590 |
}
|
|
2591 |
else
|
|
2592 |
{
|
|
2593 |
__TRACE ( KInit, ( _L("Pointer to 1st exported received")));
|
|
2594 |
}
|
|
2595 |
|
|
2596 |
CStifHWReset* reset;
|
|
2597 |
reset = NULL;
|
|
2598 |
|
|
2599 |
// initialize test module
|
|
2600 |
__TRACE ( KVerbose, (_L("Calling 1st exported at 0x%x"), (TUint32) libEntry ));
|
|
2601 |
TRAPD ( err, reset = (*libEntry)() );
|
|
2602 |
|
|
2603 |
// Handle leave from test module
|
|
2604 |
if ( err != KErrNone )
|
|
2605 |
{
|
|
2606 |
__TRACE (KError, ( CStifLogger::EError, _L("Leave when calling 1st exported function, code %d"), err));
|
|
2607 |
return err;
|
|
2608 |
}
|
|
2609 |
else if ( reset == NULL ) // Handle NULL from test module init
|
|
2610 |
{
|
|
2611 |
__TRACE (KError, ( CStifLogger::EError, _L("NULL pointer received when constructing test module")));
|
|
2612 |
delete reset;
|
|
2613 |
|
|
2614 |
// Set error codes
|
|
2615 |
return KErrNoMemory;
|
|
2616 |
}
|
|
2617 |
else
|
|
2618 |
{
|
|
2619 |
__TRACE (KInit, (_L("Entrypoint successfully called, test module instance at 0x%x"), (TUint32)reset ) );
|
|
2620 |
}
|
|
2621 |
|
|
2622 |
// Calls dynamically loaded reset module's method.
|
|
2623 |
TInt ret = reset->DoReset( aResetType );
|
|
2624 |
if( ret != KErrNone )
|
|
2625 |
{
|
|
2626 |
__TRACE (KInit, (_L("DynamicResetModule; DoReset fails with error: %d"), ret ) );
|
|
2627 |
return ret;
|
|
2628 |
}
|
|
2629 |
|
|
2630 |
return KErrNone;
|
|
2631 |
|
|
2632 |
}
|
|
2633 |
|
|
2634 |
/*
|
|
2635 |
-------------------------------------------------------------------------------
|
|
2636 |
|
|
2637 |
DESCRIPTION
|
|
2638 |
|
|
2639 |
This module contains implementation of CTestCommandNotifier class member
|
|
2640 |
functions.
|
|
2641 |
|
|
2642 |
-------------------------------------------------------------------------------
|
|
2643 |
*/
|
|
2644 |
|
|
2645 |
// ================= MEMBER FUNCTIONS =========================================
|
|
2646 |
|
|
2647 |
/*
|
|
2648 |
-------------------------------------------------------------------------------
|
|
2649 |
|
|
2650 |
Class: CTestCommandNotifier
|
|
2651 |
|
|
2652 |
Method: CTestCommandNotifier
|
|
2653 |
|
|
2654 |
Description: Default constructor
|
|
2655 |
|
|
2656 |
C++ default constructor can NOT contain any code, that
|
|
2657 |
might leave.
|
|
2658 |
|
|
2659 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
2660 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
2661 |
|
|
2662 |
Return Values: None
|
|
2663 |
|
|
2664 |
Errors/Exceptions: None
|
|
2665 |
|
|
2666 |
Status: Approved
|
|
2667 |
|
|
2668 |
-------------------------------------------------------------------------------
|
|
2669 |
*/
|
|
2670 |
CTestCommandNotifier::CTestCommandNotifier(CTestEngine* aEngine,
|
|
2671 |
RTestExecution aTestExecution):
|
|
2672 |
CActive(CActive::EPriorityStandard),
|
|
2673 |
iEngine(aEngine),
|
|
2674 |
iTestExecution(aTestExecution),
|
|
2675 |
iCommandPckg(iCommand)
|
|
2676 |
{
|
|
2677 |
CActiveScheduler::Add(this);
|
|
2678 |
}
|
|
2679 |
|
|
2680 |
/*
|
|
2681 |
-------------------------------------------------------------------------------
|
|
2682 |
|
|
2683 |
Class: CTestCommandNotifier
|
|
2684 |
|
|
2685 |
Method: ConstructL
|
|
2686 |
|
|
2687 |
Description: Symbian OS second phase constructor
|
|
2688 |
|
|
2689 |
Symbian OS default constructor can leave.
|
|
2690 |
|
|
2691 |
Parameters: None
|
|
2692 |
|
|
2693 |
Return Values: None
|
|
2694 |
|
|
2695 |
Errors/Exceptions: None
|
|
2696 |
|
|
2697 |
Status: Approved
|
|
2698 |
|
|
2699 |
-------------------------------------------------------------------------------
|
|
2700 |
*/
|
|
2701 |
void CTestCommandNotifier::ConstructL( )
|
|
2702 |
{
|
|
2703 |
__TRACE(KVerbose, (_L("CTestCommandNotifier::ConstructL")));
|
|
2704 |
}
|
|
2705 |
|
|
2706 |
/*
|
|
2707 |
-------------------------------------------------------------------------------
|
|
2708 |
|
|
2709 |
Class: CTestCommandNotifier
|
|
2710 |
|
|
2711 |
Method: NewL
|
|
2712 |
|
|
2713 |
Description: Two-phased constructor.
|
|
2714 |
|
|
2715 |
Parameters: CTestEngine* aEngine: in: Pointer to CTestEngine
|
|
2716 |
RTestExecution aTestExecution: in: Handle to RTestExecution
|
|
2717 |
|
|
2718 |
Return Values: CTestCommandNotifier* : pointer to created object
|
|
2719 |
|
|
2720 |
Errors/Exceptions: Leaves if construction of CTestCommandNotifier fails
|
|
2721 |
|
|
2722 |
Status: Approved
|
|
2723 |
|
|
2724 |
-------------------------------------------------------------------------------
|
|
2725 |
*/
|
|
2726 |
CTestCommandNotifier* CTestCommandNotifier::NewL(CTestEngine* aEngine,
|
|
2727 |
RTestExecution aTestExecution)
|
|
2728 |
{
|
|
2729 |
CTestCommandNotifier* self = new (ELeave) CTestCommandNotifier(aEngine, aTestExecution);
|
|
2730 |
CleanupStack::PushL(self);
|
|
2731 |
self->ConstructL();
|
|
2732 |
CleanupStack::Pop(self);
|
|
2733 |
return self;
|
|
2734 |
}
|
|
2735 |
|
|
2736 |
/*
|
|
2737 |
-------------------------------------------------------------------------------
|
|
2738 |
|
|
2739 |
Class: CTestCommandNotifier
|
|
2740 |
|
|
2741 |
Method: ~CTestCommandNotifier
|
|
2742 |
|
|
2743 |
Description: Destructor
|
|
2744 |
|
|
2745 |
Parameters: None
|
|
2746 |
|
|
2747 |
Return Values: None
|
|
2748 |
|
|
2749 |
Errors/Exceptions: None
|
|
2750 |
|
|
2751 |
Status: Approved
|
|
2752 |
|
|
2753 |
-------------------------------------------------------------------------------
|
|
2754 |
*/
|
|
2755 |
CTestCommandNotifier::~CTestCommandNotifier()
|
|
2756 |
{
|
|
2757 |
__TRACE(KVerbose, (_L("CTestEventNotifier::~CTestEventNotifier")));
|
|
2758 |
Cancel();
|
|
2759 |
}
|
|
2760 |
|
|
2761 |
/*
|
|
2762 |
-------------------------------------------------------------------------------
|
|
2763 |
|
|
2764 |
Class: CTestCommandNotifier
|
|
2765 |
|
|
2766 |
Method: StartL
|
|
2767 |
|
|
2768 |
Description: Start active object
|
|
2769 |
|
|
2770 |
Parameters: None
|
|
2771 |
|
|
2772 |
Return Values: None
|
|
2773 |
|
|
2774 |
Errors/Exceptions: None
|
|
2775 |
|
|
2776 |
Status: Approved
|
|
2777 |
|
|
2778 |
-------------------------------------------------------------------------------
|
|
2779 |
*/
|
|
2780 |
void CTestCommandNotifier::Start()
|
|
2781 |
{
|
|
2782 |
__TRACE(KVerbose, (_L("CTestEventNotifier::StartL")));
|
|
2783 |
|
|
2784 |
TInt res = iTestExecution.NotifyCommand2(iCommandPckg, iParamsPckg, iStatus, KErrNone);
|
|
2785 |
SetActive();
|
|
2786 |
}
|
|
2787 |
|
|
2788 |
/*
|
|
2789 |
-------------------------------------------------------------------------------
|
|
2790 |
|
|
2791 |
Class: CTestCommandNotifier
|
|
2792 |
|
|
2793 |
Method: RunL
|
|
2794 |
|
|
2795 |
Description: RunL handles completed requests.
|
|
2796 |
|
|
2797 |
Parameters: None
|
|
2798 |
|
|
2799 |
Return Values: None
|
|
2800 |
|
|
2801 |
Errors/Exceptions: Leaves if iStatus is not KErrNone
|
|
2802 |
Leaves if iState is not ETestEventPending
|
|
2803 |
Leaves if some leaving method called here leaves
|
|
2804 |
|
|
2805 |
Status: Approved
|
|
2806 |
|
|
2807 |
-------------------------------------------------------------------------------
|
|
2808 |
*/
|
|
2809 |
void CTestCommandNotifier::RunL()
|
|
2810 |
{
|
|
2811 |
__TRACE(KVerbose, (_L("CTestCommandNotifier::RunL: iStatus=[%d]"), iStatus.Int()));
|
|
2812 |
|
|
2813 |
User::LeaveIfError(iStatus.Int());
|
|
2814 |
|
|
2815 |
iEngine->ExecuteCommandL(iCommand, iParamsPckg);
|
|
2816 |
|
|
2817 |
// Set request again
|
|
2818 |
Start();
|
|
2819 |
}
|
|
2820 |
|
|
2821 |
/*
|
|
2822 |
-------------------------------------------------------------------------------
|
|
2823 |
|
|
2824 |
Class: CTestCommandNotifier
|
|
2825 |
|
|
2826 |
Method: DoCancel
|
|
2827 |
|
|
2828 |
Description: Cancel active request
|
|
2829 |
|
|
2830 |
Parameters: None
|
|
2831 |
|
|
2832 |
Return Values: None
|
|
2833 |
|
|
2834 |
Errors/Exceptions: None
|
|
2835 |
|
|
2836 |
Status: Approved
|
|
2837 |
|
|
2838 |
-------------------------------------------------------------------------------
|
|
2839 |
*/
|
|
2840 |
void CTestCommandNotifier::DoCancel()
|
|
2841 |
{
|
|
2842 |
__TRACE(KVerbose, (_L( "CTestEventNotifier::DoCancel")));
|
|
2843 |
|
|
2844 |
iTestExecution.CancelAsyncRequest(ETestExecutionNotifyCommand);
|
|
2845 |
}
|
|
2846 |
|
|
2847 |
/*
|
|
2848 |
-------------------------------------------------------------------------------
|
|
2849 |
|
|
2850 |
Class: CTestCommandNotifier
|
|
2851 |
|
|
2852 |
Method: RunError
|
|
2853 |
|
|
2854 |
Description: Handle errors.
|
|
2855 |
|
|
2856 |
Parameters: TInt aError: in: Symbian OS error: Error code
|
|
2857 |
|
|
2858 |
Return Values: TInt KErrNone: Always returned KErrNone
|
|
2859 |
|
|
2860 |
Errors/Exceptions: None
|
|
2861 |
|
|
2862 |
Status: Approved
|
|
2863 |
|
|
2864 |
-------------------------------------------------------------------------------
|
|
2865 |
*/
|
|
2866 |
TInt CTestCommandNotifier::RunError(TInt aError)
|
|
2867 |
{
|
|
2868 |
__TRACE(KError, (CStifLogger::ERed, _L("CTestCommandNotifier::RunError %d"), aError));
|
|
2869 |
return KErrNone;
|
|
2870 |
}
|
|
2871 |
|
|
2872 |
|
|
2873 |
// ================= OTHER EXPORTED FUNCTIONS =================================
|
|
2874 |
|
|
2875 |
// None
|
|
2876 |
|
|
2877 |
// End of File
|