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 file contains TestModuleIf implementation.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <e32svr.h>
|
|
20 |
#include "StifTFwIfProt.h"
|
|
21 |
#include "StifTestInterface.h"
|
|
22 |
#include "TestServerModuleIf.h"
|
|
23 |
#include "StifTestModule.h"
|
|
24 |
#include "TestThreadContainer.h"
|
|
25 |
#include "STIFMeasurement.h"
|
|
26 |
#include "TestScripterInternal.h"
|
|
27 |
#include <e32property.h>
|
|
28 |
|
|
29 |
// EXTERNAL DATA STRUCTURES
|
|
30 |
// None
|
|
31 |
|
|
32 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
33 |
// None
|
|
34 |
|
|
35 |
// CONSTANTS
|
|
36 |
// None
|
|
37 |
const TUid KPropertyCat =
|
|
38 |
{
|
|
39 |
0x101FB3DE
|
|
40 |
};
|
|
41 |
const TUint KPropertyKey = 0x00000001;
|
|
42 |
|
|
43 |
// MACROS
|
|
44 |
// Debugging is enabled with next define
|
|
45 |
#define __TRACING_ENABLED
|
|
46 |
#ifdef __TRACING_ENABLED
|
|
47 |
#define __RDEBUG(p) RDebug::Print p
|
|
48 |
#else
|
|
49 |
#define __RDEBUG(p)
|
|
50 |
#endif
|
|
51 |
|
|
52 |
// LOCAL CONSTANTS AND MACROS
|
|
53 |
// None
|
|
54 |
|
|
55 |
// MODULE DATA STRUCTURES
|
|
56 |
// None
|
|
57 |
|
|
58 |
// LOCAL FUNCTION PROTOTYPES
|
|
59 |
// None
|
|
60 |
|
|
61 |
static RPointerArray<TScriptObject> *getDict()
|
|
62 |
{
|
|
63 |
TInt script = 0;
|
|
64 |
TInt err = RProperty::Get(KPropertyCat, RProcess().Id().Id(), script);
|
|
65 |
if (err != KErrNone)
|
|
66 |
{
|
|
67 |
return NULL;
|
|
68 |
}
|
|
69 |
return (RPointerArray<TScriptObject> *) script;
|
|
70 |
}
|
|
71 |
|
|
72 |
// FORWARD DECLARATIONS
|
|
73 |
// None
|
|
74 |
|
|
75 |
// ==================== LOCAL FUNCTIONS =======================================
|
|
76 |
|
|
77 |
/*
|
|
78 |
-------------------------------------------------------------------------------
|
|
79 |
|
|
80 |
DESCRIPTION
|
|
81 |
|
|
82 |
TDesOverflowHandler class contains a simple overflow handler implementation.
|
|
83 |
|
|
84 |
-------------------------------------------------------------------------------
|
|
85 |
*/
|
|
86 |
class TDesOverflowHandler : public TDes16Overflow
|
|
87 |
{
|
|
88 |
public:
|
|
89 |
TDesOverflowHandler( CTestModuleIf* aModuleIf,
|
|
90 |
const TInt aPriority,
|
|
91 |
const TDesC& aDefinition)
|
|
92 |
{
|
|
93 |
iModuleIf = aModuleIf;
|
|
94 |
iPriority = aPriority;
|
|
95 |
iDefinition = aDefinition;
|
|
96 |
}
|
|
97 |
|
|
98 |
void Overflow(TDes16& /*aDes*/ )
|
|
99 |
{
|
|
100 |
}
|
|
101 |
|
|
102 |
CTestModuleIf* iModuleIf;
|
|
103 |
TInt iPriority;
|
|
104 |
TStifInfoName iDefinition;
|
|
105 |
};
|
|
106 |
|
|
107 |
/*
|
|
108 |
-------------------------------------------------------------------------------
|
|
109 |
|
|
110 |
DESCRIPTION
|
|
111 |
|
|
112 |
This module contains the implementation of CTestModuleIf class
|
|
113 |
member functions.
|
|
114 |
|
|
115 |
-------------------------------------------------------------------------------
|
|
116 |
*/
|
|
117 |
|
|
118 |
// ================= MEMBER FUNCTIONS =========================================
|
|
119 |
|
|
120 |
/*
|
|
121 |
-------------------------------------------------------------------------------
|
|
122 |
|
|
123 |
Class: CTestModuleIf
|
|
124 |
|
|
125 |
Method: CTestModuleIf
|
|
126 |
|
|
127 |
Description: Default constructor
|
|
128 |
|
|
129 |
C++ default constructor can NOT contain any code, that
|
|
130 |
might leave.
|
|
131 |
|
|
132 |
Parameters: None
|
|
133 |
|
|
134 |
Return Values: None
|
|
135 |
|
|
136 |
Errors/Exceptions: None
|
|
137 |
|
|
138 |
Status: Approved
|
|
139 |
|
|
140 |
-------------------------------------------------------------------------------
|
|
141 |
*/
|
|
142 |
CTestModuleIf::CTestModuleIf( CTestThreadContainer* aTestExecution ) :
|
|
143 |
iTestExecution( aTestExecution )
|
|
144 |
{
|
|
145 |
iNumberInGlbDict = 0;
|
|
146 |
}
|
|
147 |
|
|
148 |
/*
|
|
149 |
-------------------------------------------------------------------------------
|
|
150 |
|
|
151 |
Class: CTestModuleIf
|
|
152 |
|
|
153 |
Method: ConstructL
|
|
154 |
|
|
155 |
Description: Symbian OS second phase constructor
|
|
156 |
|
|
157 |
Symbian OS default constructor can leave.
|
|
158 |
|
|
159 |
Parameters: CTestExecution* aTestExecution: in: Pointer to TestExecution
|
|
160 |
CTestModuleBase* aTestModule: in: Pointer to TestModule
|
|
161 |
|
|
162 |
Return Values: None
|
|
163 |
|
|
164 |
Errors/Exceptions: None
|
|
165 |
|
|
166 |
Status: Approved
|
|
167 |
|
|
168 |
-------------------------------------------------------------------------------
|
|
169 |
*/
|
|
170 |
void CTestModuleIf::ConstructL( CTestModuleBase* aTestModule )
|
|
171 |
{
|
|
172 |
|
|
173 |
if ( aTestModule->iTestModuleIf != NULL)
|
|
174 |
{
|
|
175 |
delete aTestModule->iTestModuleIf;
|
|
176 |
aTestModule->iTestModuleIf = NULL;
|
|
177 |
}
|
|
178 |
aTestModule->iTestModuleIf = this;
|
|
179 |
|
|
180 |
iIsRebootReady = EFalse;
|
|
181 |
iStoreStateCounter = 0;
|
|
182 |
|
|
183 |
// Used to "resets" iTestCaseResults array
|
|
184 |
iAllowTestCaseResultsCount = 0;
|
|
185 |
|
|
186 |
}
|
|
187 |
|
|
188 |
/*
|
|
189 |
-------------------------------------------------------------------------------
|
|
190 |
|
|
191 |
Class: CTestModuleIf
|
|
192 |
|
|
193 |
Method: NewL
|
|
194 |
|
|
195 |
Description: Two-phased constructor.
|
|
196 |
|
|
197 |
Parameters: CTestExecution* aTestExecution: in: Pointer to TestExecution
|
|
198 |
CTestModuleBase* aTestModule: in: Pointer to TestModule
|
|
199 |
|
|
200 |
Return Values: CTestModuleIf object.
|
|
201 |
|
|
202 |
Errors/Exceptions: Leaves if memory allocation fails
|
|
203 |
Leaves if ConstructL leaves
|
|
204 |
|
|
205 |
Status: Approved
|
|
206 |
|
|
207 |
-------------------------------------------------------------------------------
|
|
208 |
*/
|
|
209 |
EXPORT_C CTestModuleIf* CTestModuleIf::NewL( CTestThreadContainer* aExecutionSession,
|
|
210 |
CTestModuleBase* aTestModule )
|
|
211 |
{
|
|
212 |
|
|
213 |
CTestModuleIf* self =
|
|
214 |
new (ELeave) CTestModuleIf( aExecutionSession );
|
|
215 |
|
|
216 |
CleanupStack::PushL( self );
|
|
217 |
self->ConstructL( aTestModule );
|
|
218 |
|
|
219 |
CleanupStack::Pop();
|
|
220 |
|
|
221 |
return self;
|
|
222 |
|
|
223 |
}
|
|
224 |
|
|
225 |
/*
|
|
226 |
-------------------------------------------------------------------------------
|
|
227 |
|
|
228 |
Class: CTestModuleIf
|
|
229 |
|
|
230 |
Method: ~CTestModuleIf
|
|
231 |
|
|
232 |
Description: Destructor
|
|
233 |
|
|
234 |
Parameters: None
|
|
235 |
|
|
236 |
Return Values: None
|
|
237 |
|
|
238 |
Errors/Exceptions: None
|
|
239 |
|
|
240 |
Status: Approved
|
|
241 |
|
|
242 |
-------------------------------------------------------------------------------
|
|
243 |
*/
|
|
244 |
CTestModuleIf::~CTestModuleIf()
|
|
245 |
{
|
|
246 |
iTestExecution = NULL;
|
|
247 |
|
|
248 |
// Used to "resets" iTestCaseResults array
|
|
249 |
iAllowTestCaseResultsCount = 0;
|
|
250 |
}
|
|
251 |
|
|
252 |
/*
|
|
253 |
-------------------------------------------------------------------------------
|
|
254 |
|
|
255 |
Class: CTestModuleIf
|
|
256 |
|
|
257 |
Method: Printf
|
|
258 |
|
|
259 |
Description: Printing
|
|
260 |
|
|
261 |
Printf is used to provide different information up to the UI
|
|
262 |
that can be then printed e.g. to the Console Screen.
|
|
263 |
The priority can be used in the UI to decide if the information
|
|
264 |
received from the Test DLL will be discarded or not in
|
|
265 |
the different performance situations. The priority is also
|
|
266 |
used in the Test DLL server and in the Test Engine to queue
|
|
267 |
the Printf responses.
|
|
268 |
This method is implemented in Test DLL Server and the Test DLL
|
|
269 |
can call it to provide printable information to the UI.
|
|
270 |
|
|
271 |
Parameters: const TInt aPriority: in:
|
|
272 |
Importance of the returned information
|
|
273 |
const TDesC& aDefinition: in:
|
|
274 |
Definition of data to be printed
|
|
275 |
TRefByValue<const TDesC> aFmt: in: Printed data
|
|
276 |
|
|
277 |
Return Values: None
|
|
278 |
|
|
279 |
Errors/Exceptions: None
|
|
280 |
|
|
281 |
Status: Approved
|
|
282 |
|
|
283 |
-------------------------------------------------------------------------------
|
|
284 |
*/
|
|
285 |
EXPORT_C void CTestModuleIf::Printf( const TInt aPriority,
|
|
286 |
const TDesC& aDefinition,
|
|
287 |
TRefByValue<const TDesC> aFmt,
|
|
288 |
...
|
|
289 |
)
|
|
290 |
{
|
|
291 |
|
|
292 |
if( !IsServerAlive() )
|
|
293 |
{
|
|
294 |
return;
|
|
295 |
}
|
|
296 |
|
|
297 |
VA_LIST list;
|
|
298 |
VA_START(list,aFmt);
|
|
299 |
TName aBuf;
|
|
300 |
RBuf buf;
|
|
301 |
TInt ret = buf.Create(1024);
|
|
302 |
if(ret != KErrNone)
|
|
303 |
{
|
|
304 |
__RDEBUG((_L("STF: Printf: Buffer creation failed [%d]"), ret));
|
|
305 |
return;
|
|
306 |
}
|
|
307 |
|
|
308 |
// Cut the description length
|
|
309 |
TInt len = aDefinition.Length();
|
|
310 |
if ( len > KMaxInfoName )
|
|
311 |
{
|
|
312 |
len = KMaxInfoName;
|
|
313 |
}
|
|
314 |
|
|
315 |
TStifInfoName shortDescription = aDefinition.Left(len);
|
|
316 |
|
|
317 |
// Create overflow handler
|
|
318 |
TDesOverflowHandler overFlowHandler (this, aPriority, shortDescription);
|
|
319 |
|
|
320 |
// Parse parameters
|
|
321 |
buf.AppendFormatList(aFmt, list, &overFlowHandler);
|
|
322 |
|
|
323 |
if(buf.Length() == 0)
|
|
324 |
{
|
|
325 |
__RDEBUG((_L("STF: Printf: Unable to prepare print buffer (probably printed string is too long)")));
|
|
326 |
}
|
|
327 |
|
|
328 |
// Print
|
|
329 |
aBuf.Copy(buf.Left(aBuf.MaxLength()));
|
|
330 |
buf.Close();
|
|
331 |
|
|
332 |
iTestExecution->DoNotifyPrint( aPriority, shortDescription, aBuf );
|
|
333 |
|
|
334 |
}
|
|
335 |
|
|
336 |
/*
|
|
337 |
-------------------------------------------------------------------------------
|
|
338 |
|
|
339 |
Class: CTestModuleIf
|
|
340 |
|
|
341 |
Method: Event
|
|
342 |
|
|
343 |
Description: Event control.
|
|
344 |
|
|
345 |
Event function is used to control and use the event system.
|
|
346 |
TEventIf &aEvent encapsulates the request type and
|
|
347 |
the event name, see StifTestEventInterface.h for more information.
|
|
348 |
This method is implemented in Test DLL Server and the Test DLL
|
|
349 |
can call it to control the event system.
|
|
350 |
|
|
351 |
Parameters: TEventIf& aEvent: in: Event command
|
|
352 |
|
|
353 |
Return Values: Symbian OS error code.
|
|
354 |
|
|
355 |
Errors/Exceptions: None
|
|
356 |
|
|
357 |
Status: Approved
|
|
358 |
|
|
359 |
-------------------------------------------------------------------------------
|
|
360 |
*/
|
|
361 |
EXPORT_C TInt CTestModuleIf::Event( TEventIf& aEvent )
|
|
362 |
{
|
|
363 |
|
|
364 |
if( !IsServerAlive() )
|
|
365 |
{
|
|
366 |
return KErrGeneral;
|
|
367 |
}
|
|
368 |
|
|
369 |
// All event commands are handled in testserver and testengine
|
|
370 |
return iTestExecution->DoNotifyEvent( aEvent );
|
|
371 |
|
|
372 |
}
|
|
373 |
|
|
374 |
/*
|
|
375 |
-------------------------------------------------------------------------------
|
|
376 |
|
|
377 |
Class: CTestModuleIf
|
|
378 |
|
|
379 |
Method: Event
|
|
380 |
|
|
381 |
Description: Event control.
|
|
382 |
|
|
383 |
Asynchronous version of event control function.
|
|
384 |
It is used to control and use the event system asynchronously.
|
|
385 |
TEventIf &aEvent encapsulates the request type and
|
|
386 |
the event number, see StifTestEventInterface.h for more information.
|
|
387 |
This method is implemented in Test DLL Server and the Test DLL
|
|
388 |
can call it to control the event system.
|
|
389 |
|
|
390 |
Parameters: TEventIf& aEvent: in: Event command
|
|
391 |
TRequestStatus& aStatus: in: Request status parameter
|
|
392 |
|
|
393 |
Return Values: None.
|
|
394 |
|
|
395 |
Errors/Exceptions: None
|
|
396 |
|
|
397 |
Status: Approved
|
|
398 |
|
|
399 |
-------------------------------------------------------------------------------
|
|
400 |
*/
|
|
401 |
EXPORT_C void CTestModuleIf::Event( TEventIf& aEvent, TRequestStatus& aStatus )
|
|
402 |
{
|
|
403 |
TInt ret = KErrNone;
|
|
404 |
|
|
405 |
if( !IsServerAlive() )
|
|
406 |
{
|
|
407 |
__RDEBUG( (_L("iTestExecution not initialised")));
|
|
408 |
ret = KErrGeneral;
|
|
409 |
}
|
|
410 |
else
|
|
411 |
{
|
|
412 |
aStatus = KRequestPending;
|
|
413 |
|
|
414 |
// All event commands are handled in testserver and testengine
|
|
415 |
ret = iTestExecution->DoNotifyEvent( aEvent, &aStatus );
|
|
416 |
}
|
|
417 |
if( ret != KErrNone )
|
|
418 |
{
|
|
419 |
TRequestStatus* rs = &aStatus;
|
|
420 |
User::RequestComplete( rs, ret );
|
|
421 |
}
|
|
422 |
|
|
423 |
}
|
|
424 |
|
|
425 |
/*
|
|
426 |
-------------------------------------------------------------------------------
|
|
427 |
|
|
428 |
Class: CTestModuleIf
|
|
429 |
|
|
430 |
Method: CancelEvent
|
|
431 |
|
|
432 |
Description: Cancel asynchronous event control call.
|
|
433 |
|
|
434 |
Parameters: TEventIf& aEvent: in: Event command to be cancelled.
|
|
435 |
const TRequestStatus* aStatus: in:
|
|
436 |
Pointer to TRequestStatus parameter that is cancelled
|
|
437 |
|
|
438 |
Return Values: Symbian OS error code.
|
|
439 |
|
|
440 |
Errors/Exceptions: None
|
|
441 |
|
|
442 |
Status: Approved
|
|
443 |
|
|
444 |
-------------------------------------------------------------------------------
|
|
445 |
*/
|
|
446 |
EXPORT_C TInt CTestModuleIf::CancelEvent( TEventIf& aEvent,
|
|
447 |
TRequestStatus* aStatus )
|
|
448 |
{
|
|
449 |
if( !IsServerAlive() )
|
|
450 |
{
|
|
451 |
__RDEBUG( (_L("iTestExecution not initialised")));
|
|
452 |
return KErrGeneral;
|
|
453 |
}
|
|
454 |
|
|
455 |
// All event commands are handled in testserver and testengine
|
|
456 |
iTestExecution->CancelEvent( aEvent, aStatus );
|
|
457 |
|
|
458 |
return KErrNone;
|
|
459 |
|
|
460 |
}
|
|
461 |
|
|
462 |
|
|
463 |
/*
|
|
464 |
-------------------------------------------------------------------------------
|
|
465 |
|
|
466 |
Class: CTestModuleIf
|
|
467 |
|
|
468 |
Method: SetExitReason
|
|
469 |
|
|
470 |
Description: Set exit reason
|
|
471 |
|
|
472 |
Parameters: const TExitReason aExitReason in: Exit reason
|
|
473 |
const TInt aExitCode in: Exit code
|
|
474 |
|
|
475 |
Return Values: None
|
|
476 |
|
|
477 |
Errors/Exceptions: None
|
|
478 |
|
|
479 |
Status: Proposal
|
|
480 |
|
|
481 |
-------------------------------------------------------------------------------
|
|
482 |
*/
|
|
483 |
EXPORT_C void CTestModuleIf::SetExitReason( const CTestModuleIf::TExitReason aExitReason,
|
|
484 |
const TInt aExitCode )
|
|
485 |
|
|
486 |
{
|
|
487 |
|
|
488 |
if( !IsServerAlive() )
|
|
489 |
{
|
|
490 |
__RDEBUG( (_L("iTestExecution not initialised")));
|
|
491 |
return;
|
|
492 |
}
|
|
493 |
|
|
494 |
iTestExecution->SetExitReason( aExitReason, aExitCode );
|
|
495 |
|
|
496 |
}
|
|
497 |
|
|
498 |
/*
|
|
499 |
-------------------------------------------------------------------------------
|
|
500 |
|
|
501 |
Class: CTestModuleIf
|
|
502 |
|
|
503 |
Method: RemoteSend
|
|
504 |
|
|
505 |
Description: RemoteSend is used to send control protocol messages to slaves
|
|
506 |
(e.g. another phone, call box, ...).
|
|
507 |
|
|
508 |
Parameters: const TDesC& aRemoteMsg: in:
|
|
509 |
Remote command protocol message
|
|
510 |
|
|
511 |
Return Values: None
|
|
512 |
|
|
513 |
Errors/Exceptions: None
|
|
514 |
|
|
515 |
Status: Proposal
|
|
516 |
|
|
517 |
-------------------------------------------------------------------------------
|
|
518 |
*/
|
|
519 |
EXPORT_C TInt CTestModuleIf::RemoteSend( const TDesC& aRemoteMsg )
|
|
520 |
{
|
|
521 |
|
|
522 |
if( !IsServerAlive() )
|
|
523 |
{
|
|
524 |
__RDEBUG( ( _L("iTestExecution not initialised") ) );
|
|
525 |
return KErrNotReady;
|
|
526 |
}
|
|
527 |
|
|
528 |
TParams params;
|
|
529 |
params.aRemoteMsgConstRef = &aRemoteMsg;
|
|
530 |
|
|
531 |
TRequestStatus status = KRequestPending;
|
|
532 |
|
|
533 |
// Forward
|
|
534 |
iTestExecution->DoRemoteReceive( EStifCmdSend, params,
|
|
535 |
aRemoteMsg.Length(), status );
|
|
536 |
|
|
537 |
User::WaitForRequest( status );
|
|
538 |
|
|
539 |
return status.Int();
|
|
540 |
|
|
541 |
}
|
|
542 |
|
|
543 |
/*
|
|
544 |
-------------------------------------------------------------------------------
|
|
545 |
|
|
546 |
Class: CTestModuleIf
|
|
547 |
|
|
548 |
Method: RemoteReceive
|
|
549 |
|
|
550 |
Description: RemoteReceive is used to receive control protocol messages to
|
|
551 |
slaves (e.g. another phone, call box, ...).
|
|
552 |
|
|
553 |
Parameters: const TDesC& aRemoteMsg: in:
|
|
554 |
Remote command protocol message
|
|
555 |
TRequestStatus& aStatus: in: Request status parameter
|
|
556 |
|
|
557 |
Return Values: None
|
|
558 |
|
|
559 |
Errors/Exceptions: None
|
|
560 |
|
|
561 |
Status: Proposal
|
|
562 |
|
|
563 |
-------------------------------------------------------------------------------
|
|
564 |
*/
|
|
565 |
EXPORT_C void CTestModuleIf::RemoteReceive( TDes& aRemoteMsg,
|
|
566 |
TRequestStatus& aStatus )
|
|
567 |
{
|
|
568 |
aStatus = KRequestPending;
|
|
569 |
if( !IsServerAlive() )
|
|
570 |
{
|
|
571 |
__RDEBUG( ( _L("iTestExecution not initialised") ) );
|
|
572 |
TRequestStatus* rs = &aStatus;
|
|
573 |
User::RequestComplete( rs, KErrNotReady );
|
|
574 |
}
|
|
575 |
|
|
576 |
TParams params;
|
|
577 |
params.aRemoteMsgRef = &aRemoteMsg;
|
|
578 |
|
|
579 |
iTestExecution->DoRemoteReceive( EStifCmdReceive, params,
|
|
580 |
aRemoteMsg.Length(), aStatus );
|
|
581 |
|
|
582 |
}
|
|
583 |
|
|
584 |
/*
|
|
585 |
-------------------------------------------------------------------------------
|
|
586 |
|
|
587 |
Class: CTestModuleIf
|
|
588 |
|
|
589 |
Method: RemoteReceiveCancel
|
|
590 |
|
|
591 |
Description: RemoteReceiveCancel is used to cancel RemoteReceive.
|
|
592 |
|
|
593 |
Parameters: None
|
|
594 |
|
|
595 |
Return Values: None
|
|
596 |
|
|
597 |
Errors/Exceptions: None
|
|
598 |
|
|
599 |
Status: Proposal
|
|
600 |
|
|
601 |
-------------------------------------------------------------------------------
|
|
602 |
*/
|
|
603 |
EXPORT_C void CTestModuleIf::RemoteReceiveCancel()
|
|
604 |
{
|
|
605 |
if( !IsServerAlive() )
|
|
606 |
{
|
|
607 |
__RDEBUG( ( _L("iTestExecution not initialised") ) );
|
|
608 |
return;
|
|
609 |
}
|
|
610 |
|
|
611 |
// Forward
|
|
612 |
iTestExecution->DoRemoteReceiveCancel();
|
|
613 |
|
|
614 |
}
|
|
615 |
|
|
616 |
/*
|
|
617 |
-------------------------------------------------------------------------------
|
|
618 |
|
|
619 |
Class: CTestModuleIf
|
|
620 |
|
|
621 |
Method: Reboot
|
|
622 |
|
|
623 |
Description: Start a reboot operation.
|
|
624 |
|
|
625 |
Parameters: TInt aType: in: Reboot type
|
|
626 |
|
|
627 |
Return Values: TInt: Symbian OS error code.
|
|
628 |
|
|
629 |
Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
|
|
630 |
KErrNotReady returned if reboot not allowed(Store state
|
|
631 |
not called).
|
|
632 |
|
|
633 |
Status: Proposal
|
|
634 |
|
|
635 |
-------------------------------------------------------------------------------
|
|
636 |
*/
|
|
637 |
EXPORT_C TInt CTestModuleIf::Reboot( TInt aType )
|
|
638 |
{
|
|
639 |
if ( !IsServerAlive() )
|
|
640 |
{
|
|
641 |
__RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
|
|
642 |
return KErrNotReady;
|
|
643 |
}
|
|
644 |
if( !iIsRebootReady )
|
|
645 |
{
|
|
646 |
__RDEBUG( ( _L( "Reboot operation not ready" ) ) );
|
|
647 |
return KErrNotReady;
|
|
648 |
}
|
|
649 |
|
|
650 |
/* switch( aType )
|
|
651 |
{
|
|
652 |
case EDefaultReset:
|
|
653 |
__RDEBUG( ( _L( "Reboot, type default" )) );
|
|
654 |
break;
|
|
655 |
case EKernelReset:
|
|
656 |
__RDEBUG( ( _L( "Reboot, type KernelReset" )) );
|
|
657 |
break;
|
|
658 |
case EDeviceReset0:
|
|
659 |
__RDEBUG( ( _L( "Reboot, type Reset 0" )) );
|
|
660 |
break;
|
|
661 |
case EDeviceReset1:
|
|
662 |
__RDEBUG( ( _L( "Reboot, type Reset 1" )) );
|
|
663 |
break;
|
|
664 |
case EDeviceReset2:
|
|
665 |
__RDEBUG( ( _L( "Reboot, type Reset 2" )) );
|
|
666 |
break;
|
|
667 |
case EDeviceReset3:
|
|
668 |
__RDEBUG( ( _L( "Reboot, type Reset 3" )) );
|
|
669 |
break;
|
|
670 |
case EDeviceReset4:
|
|
671 |
__RDEBUG( ( _L( "Reboot, type Reset 4" )) );
|
|
672 |
break;
|
|
673 |
case EDeviceReset5:
|
|
674 |
__RDEBUG( ( _L( "Reboot, type Reset 5" )) );
|
|
675 |
break;
|
|
676 |
default:
|
|
677 |
__RDEBUG( ( _L( "Reboot type %d not supported" ), aType ) );
|
|
678 |
return KErrNotSupported;
|
|
679 |
}
|
|
680 |
*/
|
|
681 |
|
|
682 |
TParams params;
|
|
683 |
TRebootParams rebootParams;
|
|
684 |
|
|
685 |
params.aRebootType = &rebootParams;
|
|
686 |
rebootParams.aType = ( TRebootType )aType;
|
|
687 |
|
|
688 |
TRequestStatus status = KRequestPending;
|
|
689 |
|
|
690 |
// Forward
|
|
691 |
iTestExecution->DoRemoteReceive( EStifCmdReboot, params, sizeof( aType ), status );
|
|
692 |
|
|
693 |
User::WaitForRequest( status );
|
|
694 |
|
|
695 |
return status.Int();
|
|
696 |
|
|
697 |
}
|
|
698 |
|
|
699 |
/*
|
|
700 |
-------------------------------------------------------------------------------
|
|
701 |
|
|
702 |
Class: CTestModuleIf
|
|
703 |
|
|
704 |
Method: StoreState
|
|
705 |
|
|
706 |
Description: Stores the current state before reboot.
|
|
707 |
|
|
708 |
Parameters: TInt aCode: in: Reboot releated integer value.
|
|
709 |
TName& aName: in: Reboot related string value.
|
|
710 |
|
|
711 |
Return Values: TInt: Symbian OS error code.
|
|
712 |
|
|
713 |
Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
|
|
714 |
KErrOverflow returned if aName length is over TName.
|
|
715 |
KErrInUse returned if method is called more than once.
|
|
716 |
|
|
717 |
Status: Proposal
|
|
718 |
|
|
719 |
-------------------------------------------------------------------------------
|
|
720 |
*/
|
|
721 |
EXPORT_C TInt CTestModuleIf::StoreState( TInt aCode, TName& aName )
|
|
722 |
{
|
|
723 |
iStoreStateCounter++; // Store state counter
|
|
724 |
|
|
725 |
if ( !IsServerAlive() )
|
|
726 |
{
|
|
727 |
__RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
|
|
728 |
return KErrNotReady;
|
|
729 |
}
|
|
730 |
// Check aName length
|
|
731 |
if ( aName.Length() > KMaxName )
|
|
732 |
{
|
|
733 |
__RDEBUG( ( _L( "CTestModuleIf::StoreState(): aName length is not valid" ) ) );
|
|
734 |
return KErrOverflow;
|
|
735 |
}
|
|
736 |
// Only one store state call may be done
|
|
737 |
if( iStoreStateCounter > 1 )
|
|
738 |
{
|
|
739 |
__RDEBUG( ( _L( "Store state allready called" ) ) );
|
|
740 |
return KErrInUse;
|
|
741 |
}
|
|
742 |
|
|
743 |
TParams params;
|
|
744 |
TRebootStateParams rebootStateParams;
|
|
745 |
params.aRebootState = &rebootStateParams;
|
|
746 |
rebootStateParams.aCode = aCode;
|
|
747 |
rebootStateParams.aName = aName;
|
|
748 |
|
|
749 |
TRequestStatus status = KRequestPending;
|
|
750 |
|
|
751 |
// Forward
|
|
752 |
iTestExecution->DoRemoteReceive( EStifCmdStoreState, params,
|
|
753 |
sizeof( TRebootStateParams), status );
|
|
754 |
|
|
755 |
User::WaitForRequest( status );
|
|
756 |
|
|
757 |
// If store state is done successfully reboot operation is allowed
|
|
758 |
if( status.Int() == KErrNone )
|
|
759 |
{
|
|
760 |
iIsRebootReady = ETrue;
|
|
761 |
}
|
|
762 |
|
|
763 |
return status.Int();
|
|
764 |
|
|
765 |
}
|
|
766 |
|
|
767 |
/*
|
|
768 |
-------------------------------------------------------------------------------
|
|
769 |
|
|
770 |
Class: CTestModuleIf
|
|
771 |
|
|
772 |
Method: GetStoredState
|
|
773 |
|
|
774 |
Description: Get saved store information after the reboot.
|
|
775 |
|
|
776 |
Parameters: TInt aCode: inout: Get reboot releated integer value.
|
|
777 |
TName& aName: inout: Get reboot related string value.
|
|
778 |
|
|
779 |
Return Values: TInt: Symbian OS error code.
|
|
780 |
|
|
781 |
Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
|
|
782 |
|
|
783 |
Status: Proposal
|
|
784 |
|
|
785 |
-------------------------------------------------------------------------------
|
|
786 |
*/
|
|
787 |
EXPORT_C TInt CTestModuleIf::GetStoredState( TInt& aCode, TName& aName )
|
|
788 |
{
|
|
789 |
if( !IsServerAlive() )
|
|
790 |
{
|
|
791 |
__RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
|
|
792 |
return KErrNotReady;
|
|
793 |
}
|
|
794 |
|
|
795 |
TInt code;
|
|
796 |
TName name;
|
|
797 |
|
|
798 |
TParams params;
|
|
799 |
TGetRebootStoredParamsRef getRebootStoredParamsRef( code, name );
|
|
800 |
|
|
801 |
params.aRebootStoredRef = &getRebootStoredParamsRef;
|
|
802 |
|
|
803 |
TRequestStatus status = KRequestPending;
|
|
804 |
|
|
805 |
// Forward
|
|
806 |
iTestExecution->DoRemoteReceive( EStifCmdGetStoredState, params,
|
|
807 |
sizeof( TRebootStateParams), status );
|
|
808 |
|
|
809 |
User::WaitForRequest( status );
|
|
810 |
|
|
811 |
// Return results if getting state is done without error
|
|
812 |
if(status.Int() == KErrNone)
|
|
813 |
{
|
|
814 |
aCode = code;
|
|
815 |
aName = name;
|
|
816 |
}
|
|
817 |
|
|
818 |
return status.Int();
|
|
819 |
|
|
820 |
}
|
|
821 |
|
|
822 |
/*
|
|
823 |
-------------------------------------------------------------------------------
|
|
824 |
|
|
825 |
Class: CTestModuleIf
|
|
826 |
|
|
827 |
Method: SetBehavior
|
|
828 |
|
|
829 |
Description: Set test case behavior.
|
|
830 |
|
|
831 |
Parameters: TInt aCode: inout: Get reboot releated integer value.
|
|
832 |
TName& aName: inout: Get reboot related string value.
|
|
833 |
|
|
834 |
Return Values: TInt: Symbian OS error code.
|
|
835 |
|
|
836 |
Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
|
|
837 |
|
|
838 |
Status: Proposal
|
|
839 |
|
|
840 |
-------------------------------------------------------------------------------
|
|
841 |
*/
|
|
842 |
EXPORT_C TInt CTestModuleIf::SetBehavior( TTestBehavior aType, TAny* aPtr )
|
|
843 |
{
|
|
844 |
|
|
845 |
if( !IsServerAlive() )
|
|
846 |
{
|
|
847 |
return KErrGeneral;
|
|
848 |
}
|
|
849 |
|
|
850 |
// All event commands are handled in testserver and testengine
|
|
851 |
return iTestExecution->SetBehavior( aType, aPtr );
|
|
852 |
|
|
853 |
}
|
|
854 |
|
|
855 |
/*
|
|
856 |
-------------------------------------------------------------------------------
|
|
857 |
|
|
858 |
Class: CTestModuleIf
|
|
859 |
|
|
860 |
Method: StifMacroError
|
|
861 |
|
|
862 |
Description: STIF TF's macros. Saves information for later use.
|
|
863 |
|
|
864 |
Parameters: TInt aMacroType: in: Macro type(0:TL, 1:T1L, 2:T2L, etc.)
|
|
865 |
const TText8* aFile: in: Uses __FILE__ macro and this includes
|
|
866 |
path and file name. Maximun length for this is
|
|
867 |
KStifMacroMaxFile. If length is more then cutted from left.
|
|
868 |
char* aFunction: in: Uses __FUNCTION__ macro and this includes
|
|
869 |
function name. Maximun length for this is
|
|
870 |
KStifMacroMaxFunction. If length is more then cutted from
|
|
871 |
rigth.
|
|
872 |
TInt aLine: in: Uses __LINE__ macro and includes line number.
|
|
873 |
TInt aResult: in: Result from called operations.
|
|
874 |
TInt aExpected1: in: Users expected result.
|
|
875 |
TInt aExpected2: in: Users expected result.
|
|
876 |
TInt aExpected3: in: Users expected result.
|
|
877 |
TInt aExpected4: in: Users expected result.
|
|
878 |
TInt aExpected5: in: Users expected result.
|
|
879 |
|
|
880 |
Return Values: Symbian OS error code.
|
|
881 |
|
|
882 |
Errors/Exceptions: None
|
|
883 |
|
|
884 |
Status: Proposal
|
|
885 |
|
|
886 |
-------------------------------------------------------------------------------
|
|
887 |
*/
|
|
888 |
EXPORT_C TInt CTestModuleIf::StifMacroError( TInt aMacroType,
|
|
889 |
const TText8* aFile,
|
|
890 |
const char* aFunction,
|
|
891 |
TInt aLine,
|
|
892 |
TInt aResult,
|
|
893 |
TInt aExpected1,
|
|
894 |
TInt aExpected2,
|
|
895 |
TInt aExpected3,
|
|
896 |
TInt aExpected4,
|
|
897 |
TInt aExpected5 )
|
|
898 |
{
|
|
899 |
if( !IsServerAlive() )
|
|
900 |
{
|
|
901 |
return KErrGeneral;
|
|
902 |
}
|
|
903 |
|
|
904 |
return iTestExecution->StifMacroError( aMacroType, aFile,
|
|
905 |
aFunction, aLine,
|
|
906 |
aResult, aExpected1,
|
|
907 |
aExpected2, aExpected3,
|
|
908 |
aExpected4, aExpected5 );
|
|
909 |
|
|
910 |
}
|
|
911 |
|
|
912 |
/*
|
|
913 |
-------------------------------------------------------------------------------
|
|
914 |
|
|
915 |
Class: CTestModuleIf
|
|
916 |
|
|
917 |
Method: ServerAlive
|
|
918 |
|
|
919 |
Description: Get saved store information after the reboot.
|
|
920 |
|
|
921 |
Parameters: TInt aCode: inout: Get reboot releated integer value.
|
|
922 |
TName& aName: inout: Get reboot related string value.
|
|
923 |
|
|
924 |
Return Values: TInt: Symbian OS error code.
|
|
925 |
|
|
926 |
Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
|
|
927 |
|
|
928 |
Status: Proposal
|
|
929 |
|
|
930 |
-------------------------------------------------------------------------------
|
|
931 |
*/
|
|
932 |
TBool CTestModuleIf::IsServerAlive()
|
|
933 |
{
|
|
934 |
|
|
935 |
if( iTestExecution == NULL )
|
|
936 |
{
|
|
937 |
__RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
|
|
938 |
// Execution not initialized
|
|
939 |
return EFalse;
|
|
940 |
}
|
|
941 |
|
|
942 |
return ETrue;
|
|
943 |
|
|
944 |
}
|
|
945 |
|
|
946 |
/*
|
|
947 |
-------------------------------------------------------------------------------
|
|
948 |
|
|
949 |
Class: CTestModuleIf
|
|
950 |
|
|
951 |
Method: AddInterferenceThread
|
|
952 |
|
|
953 |
Description:
|
|
954 |
|
|
955 |
Parameters: RThread aSTIFTestInterference: in: Handle to RThread
|
|
956 |
|
|
957 |
Return Values: TInt: Symbian OS error code.
|
|
958 |
|
|
959 |
Errors/Exceptions:
|
|
960 |
|
|
961 |
Status: Proposal
|
|
962 |
|
|
963 |
-------------------------------------------------------------------------------
|
|
964 |
*/
|
|
965 |
TInt CTestModuleIf::AddInterferenceThread( RThread aSTIFTestInterference )
|
|
966 |
{
|
|
967 |
// Add thread to Array. Via array can handle test interference thread's
|
|
968 |
// kill in panic etc. cases
|
|
969 |
return iTestExecution->AddInterferenceThread( aSTIFTestInterference );
|
|
970 |
|
|
971 |
}
|
|
972 |
|
|
973 |
/*
|
|
974 |
-------------------------------------------------------------------------------
|
|
975 |
|
|
976 |
Class: CTestModuleIf
|
|
977 |
|
|
978 |
Method: RemoveInterferenceThread
|
|
979 |
|
|
980 |
Description:
|
|
981 |
|
|
982 |
Parameters: RThread aSTIFTestInterference: in: Handle to RThread
|
|
983 |
|
|
984 |
Return Values: TInt: Symbian OS error code.
|
|
985 |
|
|
986 |
Errors/Exceptions:
|
|
987 |
|
|
988 |
Status: Proposal
|
|
989 |
|
|
990 |
-------------------------------------------------------------------------------
|
|
991 |
*/
|
|
992 |
TInt CTestModuleIf::RemoveInterferenceThread( RThread aSTIFTestInterference )
|
|
993 |
{
|
|
994 |
// Remove thread from Array.Test interference thread is stopped and killed
|
|
995 |
// successfully
|
|
996 |
return iTestExecution->RemoveInterferenceThread( aSTIFTestInterference );
|
|
997 |
|
|
998 |
}
|
|
999 |
|
|
1000 |
/*
|
|
1001 |
-------------------------------------------------------------------------------
|
|
1002 |
|
|
1003 |
Class: CTestModuleIf
|
|
1004 |
|
|
1005 |
Method: HandleMeasurementProcess
|
|
1006 |
|
|
1007 |
Description: With this can be stored information about test measurement
|
|
1008 |
to TestServer space.
|
|
1009 |
|
|
1010 |
Parameters: RProcess aTestMeasurement: in: Handle to RProcess
|
|
1011 |
|
|
1012 |
Return Values: TInt: Symbian OS error code.
|
|
1013 |
|
|
1014 |
Errors/Exceptions:
|
|
1015 |
|
|
1016 |
Status: Approved
|
|
1017 |
|
|
1018 |
-------------------------------------------------------------------------------
|
|
1019 |
*/
|
|
1020 |
TInt CTestModuleIf::HandleMeasurementProcess(
|
|
1021 |
CSTIFTestMeasurement::TStifMeasurementStruct aSTIFMeasurementInfo )
|
|
1022 |
{
|
|
1023 |
// Add process to Array. Via array can handle test measurement process's
|
|
1024 |
// kill in panic etc. cases
|
|
1025 |
return iTestExecution->HandleMeasurementProcess( aSTIFMeasurementInfo );
|
|
1026 |
|
|
1027 |
}
|
|
1028 |
|
|
1029 |
/*
|
|
1030 |
-------------------------------------------------------------------------------
|
|
1031 |
|
|
1032 |
Class: CTestModuleIf
|
|
1033 |
|
|
1034 |
Method: GetMeasurementOptions
|
|
1035 |
|
|
1036 |
Description: Get measurement option(s) given from initialization file etc.
|
|
1037 |
|
|
1038 |
Parameters: TInt& aOptions: inout: Get measurement option(s)
|
|
1039 |
|
|
1040 |
Return Values: TInt: Symbian OS error code.
|
|
1041 |
|
|
1042 |
Errors/Exceptions: KErrNotReady returned if iTestExecution is NULL.
|
|
1043 |
|
|
1044 |
Status: Approved
|
|
1045 |
|
|
1046 |
-------------------------------------------------------------------------------
|
|
1047 |
*/
|
|
1048 |
EXPORT_C TInt CTestModuleIf::GetMeasurementOptions( TInt& aOptions )
|
|
1049 |
{
|
|
1050 |
if( !IsServerAlive() )
|
|
1051 |
{
|
|
1052 |
__RDEBUG( ( _L( "iTestExecution not initialised" ) ) );
|
|
1053 |
return KErrNotReady;
|
|
1054 |
}
|
|
1055 |
|
|
1056 |
TParams params;
|
|
1057 |
TGetMeasurementOptionsRef getMeasurementOptionsRef( aOptions );
|
|
1058 |
params.aMeasurementOption = &getMeasurementOptionsRef;
|
|
1059 |
|
|
1060 |
TRequestStatus status = KRequestPending;
|
|
1061 |
|
|
1062 |
// Forward
|
|
1063 |
iTestExecution->DoRemoteReceive( EStifCmdMeasurement, params,
|
|
1064 |
sizeof( TGetMeasurementOptions ), status );
|
|
1065 |
|
|
1066 |
User::WaitForRequest( status );
|
|
1067 |
|
|
1068 |
aOptions = getMeasurementOptionsRef.iOptions;
|
|
1069 |
|
|
1070 |
return status.Int();
|
|
1071 |
|
|
1072 |
}
|
|
1073 |
|
|
1074 |
/*
|
|
1075 |
-------------------------------------------------------------------------------
|
|
1076 |
|
|
1077 |
Class: CTestModuleIf
|
|
1078 |
|
|
1079 |
Method: SetAllowResult
|
|
1080 |
|
|
1081 |
Description: Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to allow
|
|
1082 |
results.
|
|
1083 |
Set test case allow result given by user. In TestScripter
|
|
1084 |
cases allow result can set by 'allownextresult' or
|
|
1085 |
'allowerrorcodes' keywords. In Normal and Hardcoded test
|
|
1086 |
modules allow result can be set with this method, reset should
|
|
1087 |
be done with ResetAllowResult method.
|
|
1088 |
|
|
1089 |
Parameters: TInt aResult: in: Result value to be appended.
|
|
1090 |
|
|
1091 |
Return Values: TInt: Symbian OS error code.
|
|
1092 |
|
|
1093 |
Errors/Exceptions: None
|
|
1094 |
|
|
1095 |
Status: Approved
|
|
1096 |
|
|
1097 |
-------------------------------------------------------------------------------
|
|
1098 |
*/
|
|
1099 |
EXPORT_C TInt CTestModuleIf::SetAllowResult( TInt aResult )
|
|
1100 |
{
|
|
1101 |
for( TInt a = 0; a < iAllowTestCaseResultsCount; a++ )
|
|
1102 |
{
|
|
1103 |
// Check that result is not given already
|
|
1104 |
if ( iTestCaseResults[a] == aResult )
|
|
1105 |
{
|
|
1106 |
return KErrNone;
|
|
1107 |
}
|
|
1108 |
}
|
|
1109 |
// If values are given more that allow(see KSTIFMacroResultArraySize).
|
|
1110 |
// Array starts from 0...9 -> 10 => 10th should fail
|
|
1111 |
if( iAllowTestCaseResultsCount >= KSTIFMacroResultArraySize )
|
|
1112 |
{
|
|
1113 |
__RDEBUG( (
|
|
1114 |
_L( "STIF macro's SetAllowResult() allow only %d results, fails with %d" ),
|
|
1115 |
KSTIFMacroResultArraySize, KErrOverflow ) );
|
|
1116 |
return KErrOverflow;
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
// New result
|
|
1120 |
iAllowTestCaseResultsCount++;
|
|
1121 |
iTestCaseResults[iAllowTestCaseResultsCount-1] = aResult;
|
|
1122 |
|
|
1123 |
return KErrNone;
|
|
1124 |
|
|
1125 |
}
|
|
1126 |
|
|
1127 |
/*
|
|
1128 |
-------------------------------------------------------------------------------
|
|
1129 |
|
|
1130 |
Class: CTestModuleIf
|
|
1131 |
|
|
1132 |
Method: CheckAllowResult
|
|
1133 |
|
|
1134 |
Description: This is mainly used by STIF's TAL-TA5L macros internally.
|
|
1135 |
Check is macros result allowed result.
|
|
1136 |
|
|
1137 |
Parameters: TInt aResult: in: Result value to be checked.
|
|
1138 |
|
|
1139 |
Return Values: TInt: Symbian OS error code.
|
|
1140 |
|
|
1141 |
Errors/Exceptions: None
|
|
1142 |
|
|
1143 |
Status: Approved
|
|
1144 |
|
|
1145 |
-------------------------------------------------------------------------------
|
|
1146 |
*/
|
|
1147 |
EXPORT_C TInt CTestModuleIf::CheckAllowResult( TInt aResult )
|
|
1148 |
{
|
|
1149 |
// Check is result allowed
|
|
1150 |
for( TInt a = 0; a < iAllowTestCaseResultsCount; a++ )
|
|
1151 |
{
|
|
1152 |
if ( iTestCaseResults[a] == aResult )
|
|
1153 |
{
|
|
1154 |
// Result is allow
|
|
1155 |
__RDEBUG( ( _L( "STIF TAL-TA5L macro's result check. Test case result[%d] allowed" ),
|
|
1156 |
aResult ) );
|
|
1157 |
return KErrNone;
|
|
1158 |
}
|
|
1159 |
}
|
|
1160 |
|
|
1161 |
__RDEBUG( (
|
|
1162 |
_L( "STIF TAL-TA5L macro's result check. Test case result[%d] not allowed" ),
|
|
1163 |
aResult ) );
|
|
1164 |
// No match with allow result
|
|
1165 |
return KErrGeneral;
|
|
1166 |
|
|
1167 |
}
|
|
1168 |
|
|
1169 |
/*
|
|
1170 |
-------------------------------------------------------------------------------
|
|
1171 |
|
|
1172 |
Class: CTestModuleIf
|
|
1173 |
|
|
1174 |
Method: ResetAllowResult
|
|
1175 |
|
|
1176 |
Description: Use with TAL, TA1L, TA2L, TA3L, TA4L and TA5L macros to reset
|
|
1177 |
allowed results.
|
|
1178 |
Reset allow result(s) given with SetAllowResult. In
|
|
1179 |
TestScripter cases this will be called automatically by STIF.
|
|
1180 |
Normal and Hardcoded cases this should be called by user.
|
|
1181 |
|
|
1182 |
Parameters: None.
|
|
1183 |
|
|
1184 |
Return Values: TInt: Symbian OS error code.
|
|
1185 |
|
|
1186 |
Errors/Exceptions: None
|
|
1187 |
|
|
1188 |
Status: Approved
|
|
1189 |
|
|
1190 |
-------------------------------------------------------------------------------
|
|
1191 |
*/
|
|
1192 |
EXPORT_C TInt CTestModuleIf::ResetAllowResult()
|
|
1193 |
{
|
|
1194 |
// Used to "resets" iTestCaseResults array
|
|
1195 |
iAllowTestCaseResultsCount = 0;
|
|
1196 |
|
|
1197 |
return KErrNone;
|
|
1198 |
|
|
1199 |
}
|
|
1200 |
|
|
1201 |
/*
|
|
1202 |
-------------------------------------------------------------------------------
|
|
1203 |
|
|
1204 |
Class: CTestModuleIf
|
|
1205 |
|
|
1206 |
Method: StopExecution
|
|
1207 |
|
|
1208 |
Description: Causes that test case is going to be cancelled.
|
|
1209 |
|
|
1210 |
Parameters: None
|
|
1211 |
|
|
1212 |
Return Values: Symbian OS error code.
|
|
1213 |
|
|
1214 |
Errors/Exceptions: None
|
|
1215 |
|
|
1216 |
Status: Approved
|
|
1217 |
|
|
1218 |
-------------------------------------------------------------------------------
|
|
1219 |
*/
|
|
1220 |
EXPORT_C TInt CTestModuleIf::StopExecution(TStopExecutionType aType, TInt aCode)
|
|
1221 |
{
|
|
1222 |
|
|
1223 |
//Check parameters
|
|
1224 |
if((aType == EOk) && (aCode != KErrNone))
|
|
1225 |
{
|
|
1226 |
return KErrArgument;
|
|
1227 |
}
|
|
1228 |
else if((aType != EOk) && (aCode == KErrNone))
|
|
1229 |
{
|
|
1230 |
return KErrArgument;
|
|
1231 |
}
|
|
1232 |
|
|
1233 |
//Check server
|
|
1234 |
if(!IsServerAlive())
|
|
1235 |
{
|
|
1236 |
return KErrGeneral;
|
|
1237 |
}
|
|
1238 |
|
|
1239 |
//Everything is ok, we can continue with processing command
|
|
1240 |
_LIT(KStopExecution, "StopExecution");
|
|
1241 |
const TInt KPrintPriority = 30;
|
|
1242 |
|
|
1243 |
switch(aType)
|
|
1244 |
{
|
|
1245 |
case EOk:
|
|
1246 |
Printf(KPrintPriority, KStopExecution, _L("***Test case PASSED***\n\n"));
|
|
1247 |
break;
|
|
1248 |
case EFail:
|
|
1249 |
Printf(KPrintPriority, KStopExecution, _L("***Test case FAILED***\n\n"));
|
|
1250 |
break;
|
|
1251 |
case EAbort:
|
|
1252 |
Printf(KPrintPriority, KStopExecution, _L("***Test case KILLED***\n\n"));
|
|
1253 |
break;
|
|
1254 |
default:
|
|
1255 |
return KErrNotFound;
|
|
1256 |
}
|
|
1257 |
|
|
1258 |
TStopExecutionCommandParams params;
|
|
1259 |
params.iType = aType;
|
|
1260 |
params.iCode = aCode;
|
|
1261 |
__RDEBUG((_L("CTestModuleIf::StopExecution(): type [%d] code [%d]"), TInt(aType), aCode));
|
|
1262 |
|
|
1263 |
TStopExecutionCommandParamsPckg pckg(params);
|
|
1264 |
|
|
1265 |
TInt res = Command(EStopExecution, pckg);
|
|
1266 |
return res;
|
|
1267 |
}
|
|
1268 |
|
|
1269 |
/*
|
|
1270 |
------------------------------------------------------------------------------
|
|
1271 |
|
|
1272 |
Class: CTestModuleIf
|
|
1273 |
|
|
1274 |
Method: SendTestModuleVersion
|
|
1275 |
|
|
1276 |
Description: SendTestModuleVersion method is used to pass version of test module
|
|
1277 |
|
|
1278 |
------------------------------------------------------------------------------
|
|
1279 |
*/
|
|
1280 |
EXPORT_C TInt CTestModuleIf::SendTestModuleVersion(TVersion aVersion, TFileName aModuleName)
|
|
1281 |
{
|
|
1282 |
if( aModuleName.Length() == 0 )
|
|
1283 |
{
|
|
1284 |
return KErrArgument;
|
|
1285 |
}
|
|
1286 |
|
|
1287 |
//Check server
|
|
1288 |
if(!IsServerAlive())
|
|
1289 |
{
|
|
1290 |
return KErrGeneral;
|
|
1291 |
}
|
|
1292 |
|
|
1293 |
const TInt KPrintPriority = 30;
|
|
1294 |
_LIT(KVersion ,"SendTestModuleVersion");
|
|
1295 |
Printf(KPrintPriority, KVersion, _L("Sending test module version"));
|
|
1296 |
|
|
1297 |
TSendTestModuleVesionCommandParams params;
|
|
1298 |
params.iMajor = aVersion.iMajor;
|
|
1299 |
params.iMinor = aVersion.iMinor;
|
|
1300 |
params.iBuild = aVersion.iBuild;
|
|
1301 |
params.iTestModuleName = aModuleName;
|
|
1302 |
|
|
1303 |
TSendTestModuleVesionCommandParamsPckg pckg(params);
|
|
1304 |
TInt res = Command( ESendTestModuleVersion, pckg );
|
|
1305 |
return res;
|
|
1306 |
}
|
|
1307 |
|
|
1308 |
|
|
1309 |
/*
|
|
1310 |
------------------------------------------------------------------------------
|
|
1311 |
|
|
1312 |
Class: CTestModuleIf
|
|
1313 |
|
|
1314 |
Method: SendTestModuleVersion
|
|
1315 |
|
|
1316 |
Description: SendTestModuleVersion method is used to pass version of test module.
|
|
1317 |
This version uses three parameters to enable the overloading of version with
|
|
1318 |
two parameters. The version with two params has params passed by value which
|
|
1319 |
is incorrect. The "old" version (with two parameters) is left here not to cause
|
|
1320 |
binary break. Only this version (with three parameters) should be used.
|
|
1321 |
|
|
1322 |
------------------------------------------------------------------------------
|
|
1323 |
*/
|
|
1324 |
EXPORT_C TInt CTestModuleIf::SendTestModuleVersion(TVersion& aVersion, const TDesC& aModuleName, TBool /*aNewVersion*/)
|
|
1325 |
{
|
|
1326 |
if( aModuleName.Length() == 0 )
|
|
1327 |
{
|
|
1328 |
return KErrArgument;
|
|
1329 |
}
|
|
1330 |
|
|
1331 |
//Check server
|
|
1332 |
if(!IsServerAlive())
|
|
1333 |
{
|
|
1334 |
return KErrGeneral;
|
|
1335 |
}
|
|
1336 |
|
|
1337 |
const TInt KPrintPriority = 30;
|
|
1338 |
_LIT(KVersion ,"SendTestModuleVersion");
|
|
1339 |
Printf(KPrintPriority, KVersion, _L("Sending test module version"));
|
|
1340 |
|
|
1341 |
TSendTestModuleVesionCommandParams params;
|
|
1342 |
params.iMajor = aVersion.iMajor;
|
|
1343 |
params.iMinor = aVersion.iMinor;
|
|
1344 |
params.iBuild = aVersion.iBuild;
|
|
1345 |
params.iTestModuleName = aModuleName;
|
|
1346 |
|
|
1347 |
TSendTestModuleVesionCommandParamsPckg pckg(params);
|
|
1348 |
TInt res = Command( ESendTestModuleVersion, pckg );
|
|
1349 |
return res;
|
|
1350 |
}
|
|
1351 |
|
|
1352 |
/*
|
|
1353 |
-------------------------------------------------------------------------------
|
|
1354 |
|
|
1355 |
Class: CTestModuleIf
|
|
1356 |
|
|
1357 |
Method: Command
|
|
1358 |
|
|
1359 |
Description: Sends specific command to TestServer.
|
|
1360 |
|
|
1361 |
Parameters: aCommand - command to be send
|
|
1362 |
|
|
1363 |
Return Values: Symbian OS error code.
|
|
1364 |
|
|
1365 |
Errors/Exceptions: None
|
|
1366 |
|
|
1367 |
Status: Approved
|
|
1368 |
|
|
1369 |
-------------------------------------------------------------------------------
|
|
1370 |
*/
|
|
1371 |
TInt CTestModuleIf::Command(TCommand aCommand, const TDesC8& aParamsPckg)
|
|
1372 |
{
|
|
1373 |
TInt res = KErrNone;
|
|
1374 |
|
|
1375 |
if( !IsServerAlive() )
|
|
1376 |
{
|
|
1377 |
return KErrGeneral;
|
|
1378 |
}
|
|
1379 |
|
|
1380 |
switch(aCommand)
|
|
1381 |
{
|
|
1382 |
case EStopExecution:
|
|
1383 |
iTestExecution->DoNotifyCommand(aCommand, aParamsPckg);
|
|
1384 |
break;
|
|
1385 |
case ESendTestModuleVersion:
|
|
1386 |
iTestExecution->DoNotifyCommand(aCommand, aParamsPckg);
|
|
1387 |
break;
|
|
1388 |
default:
|
|
1389 |
__RDEBUG((_L("Command [%d] not recognized."), aCommand));
|
|
1390 |
}
|
|
1391 |
|
|
1392 |
return res;
|
|
1393 |
}
|
|
1394 |
|
|
1395 |
/*
|
|
1396 |
-------------------------------------------------------------------------------
|
|
1397 |
|
|
1398 |
Class: CTestModuleIf
|
|
1399 |
|
|
1400 |
Method: GetTestCaseTitleL
|
|
1401 |
|
|
1402 |
Description: Returns title of current test case.
|
|
1403 |
|
|
1404 |
Parameters: aCommand - command to be send
|
|
1405 |
|
|
1406 |
Return Values: Symbian OS error code.
|
|
1407 |
|
|
1408 |
Errors/Exceptions: None
|
|
1409 |
|
|
1410 |
Status: Approved
|
|
1411 |
|
|
1412 |
-------------------------------------------------------------------------------
|
|
1413 |
*/
|
|
1414 |
EXPORT_C void CTestModuleIf::GetTestCaseTitleL(TDes& aTestCaseTitle)
|
|
1415 |
{
|
|
1416 |
iTestExecution->GetTestCaseTitleL(aTestCaseTitle);
|
|
1417 |
}
|
|
1418 |
|
|
1419 |
/*
|
|
1420 |
-------------------------------------------------------------------------------
|
|
1421 |
|
|
1422 |
Class: CTestModuleIf
|
|
1423 |
|
|
1424 |
Method: UITesting
|
|
1425 |
|
|
1426 |
Description: Gets information if it is UI test or not
|
|
1427 |
|
|
1428 |
Parameters: none
|
|
1429 |
|
|
1430 |
Return Values: True if it is UI test, in other case it returns false.
|
|
1431 |
|
|
1432 |
Errors/Exceptions: None
|
|
1433 |
|
|
1434 |
Status: Approved
|
|
1435 |
|
|
1436 |
-------------------------------------------------------------------------------
|
|
1437 |
*/
|
|
1438 |
EXPORT_C TBool CTestModuleIf::UITesting()
|
|
1439 |
{
|
|
1440 |
return iTestExecution->UITesting();
|
|
1441 |
}
|
|
1442 |
|
|
1443 |
EXPORT_C TBool CTestModuleIf::SeperateProcesses()
|
|
1444 |
{
|
|
1445 |
return iTestExecution->SeperateProcesses();
|
|
1446 |
}
|
|
1447 |
|
|
1448 |
/*
|
|
1449 |
-------------------------------------------------------------------------------
|
|
1450 |
|
|
1451 |
Class: CTestModuleIf
|
|
1452 |
|
|
1453 |
Method: GetUiEnvProxy
|
|
1454 |
|
|
1455 |
Description: Gets UiEnvProxy
|
|
1456 |
|
|
1457 |
Parameters: none
|
|
1458 |
|
|
1459 |
Return Values: Pointer to UiEnvProxy
|
|
1460 |
|
|
1461 |
Errors/Exceptions: None
|
|
1462 |
|
|
1463 |
Status: Approved
|
|
1464 |
|
|
1465 |
-------------------------------------------------------------------------------
|
|
1466 |
*/
|
|
1467 |
EXPORT_C CUiEnvProxy* CTestModuleIf::GetUiEnvProxy()
|
|
1468 |
{
|
|
1469 |
return iTestExecution->GetUiEnvProxy();
|
|
1470 |
}
|
|
1471 |
|
|
1472 |
/*
|
|
1473 |
-------------------------------------------------------------------------------
|
|
1474 |
|
|
1475 |
Class: CTestModuleIf
|
|
1476 |
|
|
1477 |
Method: GetObjFrmDict
|
|
1478 |
|
|
1479 |
Description: Gets CScriptBase
|
|
1480 |
|
|
1481 |
Parameters: none
|
|
1482 |
|
|
1483 |
Return Values: Pointer to CScriptBase
|
|
1484 |
|
|
1485 |
Errors/Exceptions: None
|
|
1486 |
|
|
1487 |
Status: Approved
|
|
1488 |
|
|
1489 |
-------------------------------------------------------------------------------
|
|
1490 |
*/
|
|
1491 |
EXPORT_C CScriptBase* CTestModuleIf::GetObjFrmCaseDict(
|
|
1492 |
const TDesC& aObjectId)
|
|
1493 |
{
|
|
1494 |
RPointerArray<TScriptObject> *Objects = getDict();
|
|
1495 |
if (NULL == Objects)
|
|
1496 |
{
|
|
1497 |
return NULL;
|
|
1498 |
}
|
|
1499 |
TInt count = Objects->Count();
|
|
1500 |
for (TInt i = 0; i < count; i++)
|
|
1501 |
{
|
|
1502 |
if ((*Objects)[i]->ObjectId() == aObjectId)
|
|
1503 |
{
|
|
1504 |
// Found testcase with specified TestId
|
|
1505 |
return (*Objects)[i]->iScript;
|
|
1506 |
}
|
|
1507 |
}
|
|
1508 |
|
|
1509 |
return NULL;
|
|
1510 |
}
|
|
1511 |
|
|
1512 |
/*
|
|
1513 |
-------------------------------------------------------------------------------
|
|
1514 |
|
|
1515 |
Class: CTestModuleIf
|
|
1516 |
|
|
1517 |
Method: AddTestObjToDictL
|
|
1518 |
|
|
1519 |
Description: Add Test Object
|
|
1520 |
|
|
1521 |
Parameters: TScriptObject* aObject
|
|
1522 |
|
|
1523 |
Return Values: Pointer to CScriptBase
|
|
1524 |
|
|
1525 |
Errors/Exceptions: None
|
|
1526 |
|
|
1527 |
Status: Approved
|
|
1528 |
|
|
1529 |
-------------------------------------------------------------------------------
|
|
1530 |
*/
|
|
1531 |
EXPORT_C void CTestModuleIf::AddTestObjToCaseDictL(TScriptObject* aObject)
|
|
1532 |
{
|
|
1533 |
User::LeaveIfNull((TAny*) aObject);
|
|
1534 |
|
|
1535 |
RPointerArray<TScriptObject> *Objects = getDict();
|
|
1536 |
User::LeaveIfNull(Objects);
|
|
1537 |
|
|
1538 |
TInt count = Objects->Count();
|
|
1539 |
for (TInt i = 0; i < count; i++)
|
|
1540 |
{
|
|
1541 |
if ((*Objects)[i]->ObjectId() == aObject->ObjectId())
|
|
1542 |
{
|
|
1543 |
// Found testcase with specified TestId
|
|
1544 |
return;
|
|
1545 |
}
|
|
1546 |
}
|
|
1547 |
|
|
1548 |
User::LeaveIfError(Objects->Append(aObject));
|
|
1549 |
}
|
|
1550 |
|
|
1551 |
/*
|
|
1552 |
-------------------------------------------------------------------------------
|
|
1553 |
|
|
1554 |
Class: CTestModuleIf
|
|
1555 |
|
|
1556 |
Method: DelTestObjFromDict
|
|
1557 |
|
|
1558 |
Description: Delete Test Object
|
|
1559 |
|
|
1560 |
Parameters: TDesC& aObjectId
|
|
1561 |
|
|
1562 |
Return Values: Pointer to CScriptBase
|
|
1563 |
|
|
1564 |
Errors/Exceptions: None
|
|
1565 |
|
|
1566 |
Status: Approved
|
|
1567 |
|
|
1568 |
-------------------------------------------------------------------------------
|
|
1569 |
*/
|
|
1570 |
EXPORT_C void CTestModuleIf::DelTestObjFromCaseDict(const TDesC& aObjectId)
|
|
1571 |
{
|
|
1572 |
RPointerArray<TScriptObject> *Objects = getDict();
|
|
1573 |
if (NULL == Objects)
|
|
1574 |
{
|
|
1575 |
return;
|
|
1576 |
}
|
|
1577 |
|
|
1578 |
TInt count = Objects->Count();
|
|
1579 |
for (TInt i = 0; i < count; i++)
|
|
1580 |
{
|
|
1581 |
if ((*Objects)[i]->ObjectId() == aObjectId)
|
|
1582 |
{
|
|
1583 |
// Found testcase with specified TestId
|
|
1584 |
Objects->Remove(i);
|
|
1585 |
return;
|
|
1586 |
}
|
|
1587 |
}
|
|
1588 |
}
|
|
1589 |
|
|
1590 |
/*
|
|
1591 |
-------------------------------------------------------------------------------
|
|
1592 |
|
|
1593 |
Class: CTestModuleIf
|
|
1594 |
|
|
1595 |
Method: GetTestObjFromDict
|
|
1596 |
|
|
1597 |
Description: Get Test Object
|
|
1598 |
|
|
1599 |
Parameters: TDesC& aObjectId
|
|
1600 |
|
|
1601 |
Return Values: Pointer to CScriptBase
|
|
1602 |
|
|
1603 |
Errors/Exceptions: None
|
|
1604 |
|
|
1605 |
Status: Approved
|
|
1606 |
|
|
1607 |
-------------------------------------------------------------------------------
|
|
1608 |
*/
|
|
1609 |
EXPORT_C TScriptObject* CTestModuleIf::GetTestObjFromCaseDict(
|
|
1610 |
const TDesC& aObjectId) const
|
|
1611 |
{
|
|
1612 |
RPointerArray<TScriptObject> *Objects = getDict();
|
|
1613 |
if (NULL == Objects)
|
|
1614 |
{
|
|
1615 |
return NULL;
|
|
1616 |
}
|
|
1617 |
TInt count = Objects->Count();
|
|
1618 |
for (TInt i = 0; i < count; i++)
|
|
1619 |
{
|
|
1620 |
if ((*Objects)[i]->ObjectId() == aObjectId)
|
|
1621 |
{
|
|
1622 |
// Found testcase with specified TestId
|
|
1623 |
return (*Objects)[i];
|
|
1624 |
}
|
|
1625 |
}
|
|
1626 |
|
|
1627 |
return NULL;
|
|
1628 |
}
|
|
1629 |
|
|
1630 |
EXPORT_C TScriptObject::~TScriptObject()
|
|
1631 |
{
|
|
1632 |
delete iScript;
|
|
1633 |
}
|
|
1634 |
|
|
1635 |
// ================= OTHER EXPORTED FUNCTIONS =================================
|
|
1636 |
|
|
1637 |
|
|
1638 |
/*
|
|
1639 |
-------------------------------------------------------------------------------
|
|
1640 |
|
|
1641 |
DESCRIPTION
|
|
1642 |
|
|
1643 |
This module contains the implementation of CSTIFTestMeasurement class
|
|
1644 |
member functions.
|
|
1645 |
|
|
1646 |
-------------------------------------------------------------------------------
|
|
1647 |
*/
|
|
1648 |
|
|
1649 |
// ================= MEMBER FUNCTIONS =========================================
|
|
1650 |
|
|
1651 |
/*
|
|
1652 |
-------------------------------------------------------------------------------
|
|
1653 |
|
|
1654 |
Class: CSTIFTestMeasurement
|
|
1655 |
|
|
1656 |
Method: CSTIFTestMeasurement
|
|
1657 |
|
|
1658 |
Description: Default constructor
|
|
1659 |
|
|
1660 |
C++ default constructor can NOT contain any code, that
|
|
1661 |
might leave.
|
|
1662 |
|
|
1663 |
Parameters: CTestModuleBase* aTestModuleBase: in: Pointer to STIF
|
|
1664 |
|
|
1665 |
Return Values: None
|
|
1666 |
|
|
1667 |
Errors/Exceptions: None
|
|
1668 |
|
|
1669 |
Status: Approved
|
|
1670 |
|
|
1671 |
-------------------------------------------------------------------------------
|
|
1672 |
*/
|
|
1673 |
CSTIFTestMeasurement::CSTIFTestMeasurement( CTestModuleBase* aTestModuleBase ) :
|
|
1674 |
iTestModuleBase( aTestModuleBase ),
|
|
1675 |
iMeasurementOption( 0 )
|
|
1676 |
{
|
|
1677 |
|
|
1678 |
}
|
|
1679 |
|
|
1680 |
/*
|
|
1681 |
-------------------------------------------------------------------------------
|
|
1682 |
|
|
1683 |
Class: CSTIFTestMeasurement
|
|
1684 |
|
|
1685 |
Method: ConstructL
|
|
1686 |
|
|
1687 |
Description: Symbian OS second phase constructor
|
|
1688 |
|
|
1689 |
Symbian OS default constructor can leave.
|
|
1690 |
|
|
1691 |
Parameters: TSTIFMeasurement aType: in: Measurement type
|
|
1692 |
const TDesC& aConfigurationInfo: in: Configuration issues
|
|
1693 |
|
|
1694 |
Return Values: None
|
|
1695 |
|
|
1696 |
Errors/Exceptions: Leaves if HandleMeasurementProcess returns error code
|
|
1697 |
|
|
1698 |
Status: Approved
|
|
1699 |
|
|
1700 |
-------------------------------------------------------------------------------
|
|
1701 |
*/
|
|
1702 |
void CSTIFTestMeasurement::ConstructL( TSTIFMeasurementType aType,
|
|
1703 |
const TDesC& aConfigurationInfo )
|
|
1704 |
{
|
|
1705 |
// aType into struct here. This is compared to
|
|
1706 |
iMeasurementStruct.iMeasurementType = aType;
|
|
1707 |
|
|
1708 |
// Check that measurement is not disabled(This is given from UI level or
|
|
1709 |
// from TestFramework.ini file)
|
|
1710 |
TInt ret( 0 );
|
|
1711 |
ret = iTestModuleBase->TestModuleIf().GetMeasurementOptions(
|
|
1712 |
iMeasurementOption );
|
|
1713 |
if( ret != KErrNone )
|
|
1714 |
{
|
|
1715 |
__RDEBUG( ( _L( "GetMeasurementOptions() return an error[%d]" ), ret ) );
|
|
1716 |
User::Leave( ret );
|
|
1717 |
}
|
|
1718 |
|
|
1719 |
// Check that measurement is not disabled
|
|
1720 |
if( ( iMeasurementOption & EDisableAll ) == EDisableAll )
|
|
1721 |
{
|
|
1722 |
__RDEBUG( _L( "Measurement disable option [KStifMeasurementDisableAll] is given by user" ) );
|
|
1723 |
return;
|
|
1724 |
}
|
|
1725 |
if( ( ( iMeasurementOption & EMeasurement01 ) == EMeasurement01 ) && aType == KStifMeasurementPlugin01 )
|
|
1726 |
{
|
|
1727 |
__RDEBUG( _L( "Measurement disable option [KStifMeasurement01] is given by user" ) );
|
|
1728 |
return;
|
|
1729 |
}
|
|
1730 |
if( ( ( iMeasurementOption & EMeasurement02 ) == EMeasurement02 ) && aType == KStifMeasurementPlugin02 )
|
|
1731 |
{
|
|
1732 |
__RDEBUG( _L( "Measurement disable option [KStifMeasurement02] is given by user" ) );
|
|
1733 |
return;
|
|
1734 |
}
|
|
1735 |
if( ( ( iMeasurementOption & EMeasurement03 ) == EMeasurement03 ) && aType == KStifMeasurementPlugin03 )
|
|
1736 |
{
|
|
1737 |
__RDEBUG( _L( "Measurement disable option [KStifMeasurement03] is given by user" ) );
|
|
1738 |
return;
|
|
1739 |
}
|
|
1740 |
if( ( ( iMeasurementOption & EMeasurement04 ) == EMeasurement04 ) && aType == KStifMeasurementPlugin04 )
|
|
1741 |
{
|
|
1742 |
__RDEBUG( _L( "Measurement disable option [KStifMeasurement04] is given by user" ) );
|
|
1743 |
return;
|
|
1744 |
}
|
|
1745 |
if( ( ( iMeasurementOption & EMeasurement05 ) == EMeasurement05 ) && aType == KStifMeasurementPlugin05 )
|
|
1746 |
{
|
|
1747 |
__RDEBUG( _L( "Measurement disable option [KStifMeasurement05] is given by user" ) );
|
|
1748 |
return;
|
|
1749 |
}
|
|
1750 |
if( ( ( iMeasurementOption & EBappea ) == EBappea ) && aType == KStifMeasurementBappeaProfiler )
|
|
1751 |
{
|
|
1752 |
__RDEBUG( _L( "Measurement disable option [KStifMeasurementBappea] is given by user" ) );
|
|
1753 |
return;
|
|
1754 |
}
|
|
1755 |
|
|
1756 |
iMeasurementStruct.iConfigurationInfo = aConfigurationInfo;
|
|
1757 |
iMeasurementStruct.iMeasurementOperation = KMeasurementNew;
|
|
1758 |
iMeasurementStruct.iPointerToMeasurementModule = iTestModuleBase;
|
|
1759 |
|
|
1760 |
// Move measurement execution initialization forward to TestServer.
|
|
1761 |
User::LeaveIfError( iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
|
|
1762 |
iMeasurementStruct ) );
|
|
1763 |
|
|
1764 |
}
|
|
1765 |
|
|
1766 |
/*
|
|
1767 |
-------------------------------------------------------------------------------
|
|
1768 |
|
|
1769 |
Class: CSTIFTestMeasurement
|
|
1770 |
|
|
1771 |
Method: NewL
|
|
1772 |
|
|
1773 |
Description: Two-phased constructor.
|
|
1774 |
|
|
1775 |
Parameters: CTestModuleBase* aTestModuleBase: in: Pointer to STIF.
|
|
1776 |
TSTIFMeasurement aType: in: Measurement type.
|
|
1777 |
const TDesC& aConfigurationInfo: in: Configuration info.
|
|
1778 |
|
|
1779 |
Return Values: CSTIFTestMeasurement object.
|
|
1780 |
|
|
1781 |
Errors/Exceptions: Leaves if memory allocation fails
|
|
1782 |
Leaves if ConstructL leaves
|
|
1783 |
|
|
1784 |
Status: Approved
|
|
1785 |
|
|
1786 |
-------------------------------------------------------------------------------
|
|
1787 |
*/
|
|
1788 |
EXPORT_C CSTIFTestMeasurement* CSTIFTestMeasurement::NewL(
|
|
1789 |
CTestModuleBase* aTestModuleBase,
|
|
1790 |
TSTIFMeasurementType aType,
|
|
1791 |
const TDesC& aConfigurationInfo )
|
|
1792 |
{
|
|
1793 |
CSTIFTestMeasurement* self =
|
|
1794 |
new (ELeave) CSTIFTestMeasurement( aTestModuleBase );
|
|
1795 |
|
|
1796 |
CleanupStack::PushL( self );
|
|
1797 |
self->ConstructL( aType, aConfigurationInfo );
|
|
1798 |
|
|
1799 |
CleanupStack::Pop();
|
|
1800 |
|
|
1801 |
return self;
|
|
1802 |
|
|
1803 |
}
|
|
1804 |
|
|
1805 |
/*
|
|
1806 |
-------------------------------------------------------------------------------
|
|
1807 |
|
|
1808 |
Class: CSTIFTestMeasurement
|
|
1809 |
|
|
1810 |
Method: ~CSTIFTestMeasurement
|
|
1811 |
|
|
1812 |
Description: Destructor
|
|
1813 |
|
|
1814 |
Parameters: None
|
|
1815 |
|
|
1816 |
Return Values: None
|
|
1817 |
|
|
1818 |
Errors/Exceptions: None
|
|
1819 |
|
|
1820 |
Status: Approved
|
|
1821 |
|
|
1822 |
-------------------------------------------------------------------------------
|
|
1823 |
*/
|
|
1824 |
CSTIFTestMeasurement::~CSTIFTestMeasurement()
|
|
1825 |
{
|
|
1826 |
// None
|
|
1827 |
|
|
1828 |
}
|
|
1829 |
|
|
1830 |
/*
|
|
1831 |
-------------------------------------------------------------------------------
|
|
1832 |
|
|
1833 |
Class: CSTIFTestMeasurement
|
|
1834 |
|
|
1835 |
Method: Start
|
|
1836 |
|
|
1837 |
Description: Start commant for measurement.
|
|
1838 |
|
|
1839 |
Parameters: None
|
|
1840 |
|
|
1841 |
Return Values: Symbian error code
|
|
1842 |
|
|
1843 |
Errors/Exceptions: None
|
|
1844 |
|
|
1845 |
Status: Approved
|
|
1846 |
|
|
1847 |
-------------------------------------------------------------------------------
|
|
1848 |
*/
|
|
1849 |
EXPORT_C TInt CSTIFTestMeasurement::Start()
|
|
1850 |
{
|
|
1851 |
// Check that measurement is not disabled
|
|
1852 |
if( iMeasurementOption == iMeasurementStruct.iMeasurementType )
|
|
1853 |
{
|
|
1854 |
__RDEBUG( ( _L( "Measurement with type[%d] is disabled by user" ), iMeasurementOption ) );
|
|
1855 |
// Cannot return error code because this causes problems in
|
|
1856 |
// TestScripter and TestCombiner error handling. Now testing continue
|
|
1857 |
// without measurement.
|
|
1858 |
return KErrNone;
|
|
1859 |
}
|
|
1860 |
|
|
1861 |
iMeasurementStruct.iMeasurementOperation = KMeasurementStart;
|
|
1862 |
|
|
1863 |
// Move measurement start execution forward to TestServer.
|
|
1864 |
return iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
|
|
1865 |
iMeasurementStruct );
|
|
1866 |
|
|
1867 |
}
|
|
1868 |
|
|
1869 |
/*
|
|
1870 |
-------------------------------------------------------------------------------
|
|
1871 |
|
|
1872 |
Class: CTestMeasurement
|
|
1873 |
|
|
1874 |
Method: Stop
|
|
1875 |
|
|
1876 |
Description: Stop command for measurement.
|
|
1877 |
|
|
1878 |
Parameters: None
|
|
1879 |
|
|
1880 |
Return Values: Symbian error code
|
|
1881 |
|
|
1882 |
Errors/Exceptions: None
|
|
1883 |
|
|
1884 |
Status: Approved
|
|
1885 |
|
|
1886 |
-------------------------------------------------------------------------------
|
|
1887 |
*/
|
|
1888 |
EXPORT_C TInt CSTIFTestMeasurement::Stop()
|
|
1889 |
{
|
|
1890 |
// Check that measurement is not disabled
|
|
1891 |
if( iMeasurementOption == iMeasurementStruct.iMeasurementType )
|
|
1892 |
{
|
|
1893 |
__RDEBUG( ( _L( "Measurement with type[%d] is disabled by user" ), iMeasurementOption ) );
|
|
1894 |
// Cannot return error code because this causes problems in
|
|
1895 |
// TestScripter and TestCombiner error handling. Now testing continue
|
|
1896 |
// without measurement.
|
|
1897 |
return KErrNone;
|
|
1898 |
}
|
|
1899 |
|
|
1900 |
iMeasurementStruct.iMeasurementOperation = KMeasurementStop;
|
|
1901 |
|
|
1902 |
// Move measurement stop execution forward to TestServer.
|
|
1903 |
return iTestModuleBase->iTestModuleIf->HandleMeasurementProcess(
|
|
1904 |
iMeasurementStruct );
|
|
1905 |
|
|
1906 |
}
|
|
1907 |
|
|
1908 |
// End of File
|