0
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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:
|
|
15 |
* @file
|
|
16 |
* This contains CTestBlockController
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
/**
|
|
23 |
@prototype
|
|
24 |
@test
|
|
25 |
*/
|
|
26 |
|
|
27 |
#include "TestBlockController.h"
|
|
28 |
#include "DataWrapper.h"
|
|
29 |
|
|
30 |
_LIT(KName, "name");
|
|
31 |
|
|
32 |
|
|
33 |
// Errors
|
|
34 |
_LIT(KErrNotExist, "Object does not exist.");
|
|
35 |
_LIT(KErrNoCleanup, "Object does not have a cleanup operation.");
|
|
36 |
_LIT(KErrNoName, "No name provided.");
|
|
37 |
_LIT(KErrNoFunction, "No function provided.");
|
|
38 |
_LIT(KErrSharedData, "Test server needs to be loaded in -SharedData mode.");
|
|
39 |
_LIT(KErrCmdUnknown, "Unknown command.");
|
|
40 |
_LIT(KErrWrapperCreate, "Can't create an object wrapper of type %S");
|
|
41 |
_LIT(KErrBlockCorrupt, "Corrupt block of commands.");
|
|
42 |
_LIT(KErrActiveSched, "Active Scheduler, error = %d");
|
|
43 |
_LIT(KErrSharedMode, "-SharedData mode required.");
|
|
44 |
_LIT(KErrSchedulerLoc, "SHARED_ACTIVE_SCHEDULER command must be first in block.");
|
|
45 |
_LIT(KLocalScheduler, "Creating a local active scheduler.");
|
|
46 |
_LIT(KSharedScheduler, "Creating a shared active scheduler.");
|
|
47 |
_LIT(KSharedServer, "Error accessing the test server.");
|
|
48 |
_LIT(KErrOutstanding, "Outstanding failed with error %d.");
|
|
49 |
|
|
50 |
// Defaults
|
|
51 |
const TInt KDefaultDelay = 1000000;
|
|
52 |
const TInt KDefaultInterval = 1000000;
|
|
53 |
|
|
54 |
EXPORT_C CTestBlockController::CTestBlockController()
|
|
55 |
/**
|
|
56 |
* Constructor
|
|
57 |
*/
|
|
58 |
: iBlockArray(NULL)
|
|
59 |
, iCommandProcessor(NULL)
|
|
60 |
, iActiveScheduler(NULL)
|
|
61 |
, iTimer(NULL)
|
|
62 |
, iPeriodic(NULL)
|
|
63 |
, iAsyncTimer(EFalse)
|
|
64 |
, iTimerActive(EFalse)
|
|
65 |
, iCommandIndex(0)
|
|
66 |
, iAsyncCount(0)
|
|
67 |
, iSharedData(NULL)
|
|
68 |
, iDeleteSharedScheduler(ETrue)
|
|
69 |
{
|
|
70 |
}
|
|
71 |
|
|
72 |
EXPORT_C CTestBlockController::~CTestBlockController()
|
|
73 |
/**
|
|
74 |
* Destructor
|
|
75 |
*/
|
|
76 |
{
|
|
77 |
if( iTimer )
|
|
78 |
{
|
|
79 |
delete iTimer;
|
|
80 |
iTimer=NULL;
|
|
81 |
}
|
|
82 |
|
|
83 |
if( iPeriodic )
|
|
84 |
{
|
|
85 |
delete iPeriodic;
|
|
86 |
iPeriodic=NULL;
|
|
87 |
}
|
|
88 |
|
|
89 |
if( iCommandProcessor )
|
|
90 |
{
|
|
91 |
delete iCommandProcessor;
|
|
92 |
iCommandProcessor=NULL;
|
|
93 |
}
|
|
94 |
|
|
95 |
if( iActiveScheduler )
|
|
96 |
{
|
|
97 |
delete iActiveScheduler;
|
|
98 |
iActiveScheduler=NULL;
|
|
99 |
}
|
|
100 |
|
|
101 |
if( IsSharedDataMode() && iDeleteSharedScheduler && iSharedData)
|
|
102 |
{
|
|
103 |
TRAP_IGNORE(iSharedData->DeleteActiveSchedulerL());
|
|
104 |
}
|
|
105 |
|
|
106 |
}
|
|
107 |
|
|
108 |
EXPORT_C TVerdict CTestBlockController::doTestStepPreambleL()
|
|
109 |
{
|
|
110 |
TVerdict ret = CTestStep::doTestStepPreambleL();
|
|
111 |
|
|
112 |
if( !iSharedData )
|
|
113 |
{
|
|
114 |
ERR_PRINTF1(KSharedServer);
|
|
115 |
User::Leave(KErrBadHandle);
|
|
116 |
}
|
|
117 |
|
|
118 |
// Test for a persistent active scheduler command
|
|
119 |
if( ETEFSharedActiveScheduler == iBlockArray->At(iCommandIndex).iItemType )
|
|
120 |
{
|
|
121 |
if( IsSharedDataMode() )
|
|
122 |
{
|
|
123 |
INFO_PRINTF1(KSharedScheduler);
|
|
124 |
iSharedData->CreateActiveSchedulerL();
|
|
125 |
}
|
|
126 |
else
|
|
127 |
{
|
|
128 |
iBlockArray->At(iCommandIndex).iError = KErrNotSupported;
|
|
129 |
ERR_PRINTF1(KErrSharedMode);
|
|
130 |
|
|
131 |
// Create a new active scheduler
|
|
132 |
INFO_PRINTF1(KLocalScheduler);
|
|
133 |
iDeleteSharedScheduler = EFalse;
|
|
134 |
iActiveScheduler=new (ELeave) CBlockActiveScheduler(*this);
|
|
135 |
CActiveScheduler::Install(iActiveScheduler);
|
|
136 |
}
|
|
137 |
iBlockArray->At(iCommandIndex).iExecuted = ETrue;
|
|
138 |
iCommandIndex++;
|
|
139 |
}
|
|
140 |
else
|
|
141 |
{
|
|
142 |
if( IsSharedDataMode() )
|
|
143 |
{
|
|
144 |
// Ensure there is no persistent active scheduler if in -SharedData mode
|
|
145 |
iSharedData->DeleteActiveSchedulerL();
|
|
146 |
}
|
|
147 |
|
|
148 |
// Create a new active scheduler
|
|
149 |
INFO_PRINTF1(KLocalScheduler);
|
|
150 |
iDeleteSharedScheduler = EFalse;
|
|
151 |
iActiveScheduler=new (ELeave) CBlockActiveScheduler(*this);
|
|
152 |
CActiveScheduler::Install(iActiveScheduler);
|
|
153 |
}
|
|
154 |
|
|
155 |
iCommandProcessor=CCommandProcessor::NewL(*this);
|
|
156 |
iTimer=CTEFTimer::NewL(*this);
|
|
157 |
iPeriodic=CPeriodic::NewL(CActive::EPriorityStandard);
|
|
158 |
|
|
159 |
return ret;
|
|
160 |
}
|
|
161 |
|
|
162 |
EXPORT_C TVerdict CTestBlockController::doTestStepL()
|
|
163 |
{
|
|
164 |
// Execute oommands
|
|
165 |
StartCommands();
|
|
166 |
CActiveScheduler::Start();
|
|
167 |
|
|
168 |
return TestStepResult();
|
|
169 |
}
|
|
170 |
|
|
171 |
EXPORT_C TVerdict CTestBlockController::doTestStepPostambleL()
|
|
172 |
{
|
|
173 |
iDataDictionary.Empty();
|
|
174 |
return TestStepResult();
|
|
175 |
}
|
|
176 |
|
|
177 |
EXPORT_C void CTestBlockController::SetBlockArray( TTEFItemArray* aBlockArray )
|
|
178 |
{
|
|
179 |
iBlockArray = aBlockArray;
|
|
180 |
}
|
|
181 |
|
|
182 |
EXPORT_C void CTestBlockController::SetSharedData( MSharedData* aSharedData )
|
|
183 |
{
|
|
184 |
iSharedData = aSharedData;
|
|
185 |
}
|
|
186 |
|
|
187 |
EXPORT_C void CTestBlockController::SetError(const TInt aError)
|
|
188 |
{
|
|
189 |
iBlockArray->At(iCommandIndex).iError = aError;
|
|
190 |
}
|
|
191 |
|
|
192 |
EXPORT_C void CTestBlockController::SetAsyncError(const TInt aIndex, const TInt aError)
|
|
193 |
{
|
|
194 |
iBlockArray->At(aIndex).iAsyncError = aError;
|
|
195 |
}
|
|
196 |
|
|
197 |
EXPORT_C void CTestBlockController::SetBlockResult(const TVerdict aResult)
|
|
198 |
{
|
|
199 |
SetTestStepResult(aResult);
|
|
200 |
}
|
|
201 |
|
|
202 |
EXPORT_C TVerdict CTestBlockController::BlockResult()
|
|
203 |
{
|
|
204 |
return TestStepResult();
|
|
205 |
}
|
|
206 |
|
|
207 |
EXPORT_C TBool CTestBlockController::DoCommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex)
|
|
208 |
{
|
|
209 |
TBool synchronous = ETrue;
|
|
210 |
|
|
211 |
if( ETEFCreateObject==aCommand.iItemType )
|
|
212 |
{
|
|
213 |
CreateObjectL(aCommand);
|
|
214 |
}
|
|
215 |
else if( ETEFRestoreObject==aCommand.iItemType )
|
|
216 |
{
|
|
217 |
RestoreObjectL(aCommand);
|
|
218 |
}
|
|
219 |
else if( ETEFStore==aCommand.iItemType )
|
|
220 |
{
|
|
221 |
StoreL(aCommand);
|
|
222 |
}
|
|
223 |
else if( ETEFDelay==aCommand.iItemType )
|
|
224 |
{
|
|
225 |
User::After(aCommand.iTime?aCommand.iTime:KDefaultDelay );
|
|
226 |
}
|
|
227 |
else if( ETEFAsyncDelay==aCommand.iItemType )
|
|
228 |
{
|
|
229 |
synchronous=EFalse;
|
|
230 |
StartTimer(aCommand);
|
|
231 |
}
|
|
232 |
else if( ETEFOutstanding==aCommand.iItemType )
|
|
233 |
{
|
|
234 |
synchronous=EFalse;
|
|
235 |
iPeriodic->Start( 0,
|
|
236 |
aCommand.iTime?aCommand.iTime:KDefaultInterval,
|
|
237 |
TCallBack(OutstandingCallback,this));
|
|
238 |
}
|
|
239 |
else if( ETEFSharedActiveScheduler==aCommand.iItemType )
|
|
240 |
{
|
|
241 |
aCommand.iError = KErrNotSupported;
|
|
242 |
ERR_PRINTF1(KErrSchedulerLoc);
|
|
243 |
}
|
|
244 |
else if( ETEFStoreActiveScheduler==aCommand.iItemType )
|
|
245 |
{
|
|
246 |
StoreActiveScheduler(aCommand);
|
|
247 |
}
|
|
248 |
else if( ETEFCommand==aCommand.iItemType )
|
|
249 |
{
|
|
250 |
CommandL(aCommand, aAsyncErrorIndex);
|
|
251 |
}
|
|
252 |
else
|
|
253 |
{
|
|
254 |
ERR_PRINTF1(KErrCmdUnknown);
|
|
255 |
aCommand.iError = KErrNotSupported;
|
|
256 |
}
|
|
257 |
|
|
258 |
// Update the iExecuted flag
|
|
259 |
aCommand.iExecuted = ETrue;
|
|
260 |
|
|
261 |
return synchronous;
|
|
262 |
}
|
|
263 |
|
|
264 |
|
|
265 |
void CTestBlockController::CreateObjectL(TTEFBlockItem& aCommand)
|
|
266 |
{
|
|
267 |
// Retrieve the object name from the ini file
|
|
268 |
TPtrC name;
|
|
269 |
if( GetStringFromConfig(aCommand.iSection, KName, name) &&
|
|
270 |
0 != aCommand.iSection.Compare(KTEFNull) )
|
|
271 |
{
|
|
272 |
// Create the wrapper
|
|
273 |
CDataWrapper* data = CreateDataL(aCommand.iObjectType);
|
|
274 |
if( NULL != data)
|
|
275 |
{
|
|
276 |
CleanupStack::PushL(data);
|
|
277 |
data->SetTestBlockController(this);
|
|
278 |
data->SetDataDictionary(&iDataDictionary);
|
|
279 |
data->InitialiseL();
|
|
280 |
// Add it to the dictionary with the lookup name provided
|
|
281 |
iDataDictionary.AddDataL(name, data);
|
|
282 |
CleanupStack::Pop(data);
|
|
283 |
}
|
|
284 |
else
|
|
285 |
{
|
|
286 |
aCommand.iError = KErrNotFound;
|
|
287 |
ERR_PRINTF2( KErrWrapperCreate, &name );
|
|
288 |
}
|
|
289 |
}
|
|
290 |
else
|
|
291 |
{
|
|
292 |
ERR_PRINTF1(KErrNoName);
|
|
293 |
aCommand.iError = KErrNotFound;
|
|
294 |
}
|
|
295 |
}
|
|
296 |
|
|
297 |
void CTestBlockController::RestoreObjectL(TTEFBlockItem& aCommand)
|
|
298 |
{
|
|
299 |
if( IsSharedDataMode() )
|
|
300 |
{
|
|
301 |
// Retrieve the object name from the ini file
|
|
302 |
TPtrC name;
|
|
303 |
if( 0 != aCommand.iSection.Compare(KTEFNull) &&
|
|
304 |
GetStringFromConfig(aCommand.iSection, KName, name) )
|
|
305 |
{
|
|
306 |
// Create the wrapper
|
|
307 |
CDataWrapper* data = CreateDataL(aCommand.iObjectType);
|
|
308 |
|
|
309 |
if( NULL != data)
|
|
310 |
{
|
|
311 |
CleanupStack::PushL(data);
|
|
312 |
data->SetTestBlockController(this);
|
|
313 |
data->SetDataDictionary(&iDataDictionary);
|
|
314 |
data->InitialiseL();
|
|
315 |
|
|
316 |
// Add it to the dictionary with the lookup name provided
|
|
317 |
iDataDictionary.AddDataL(name, data);
|
|
318 |
|
|
319 |
// Retrieve the object from the persistent store
|
|
320 |
TAny* object = NULL;
|
|
321 |
TRAPD( err, object = iSharedData->GetObjectAndOwnL(name) );
|
|
322 |
if( KErrNone == err )
|
|
323 |
{
|
|
324 |
CleanupStack::PushL(object);
|
|
325 |
// Update the object contained within the wrapper
|
|
326 |
iDataDictionary.SetObjectL(name, object);
|
|
327 |
CleanupStack::Pop(object);
|
|
328 |
}
|
|
329 |
else
|
|
330 |
{
|
|
331 |
ERR_PRINTF1(KErrNotExist);
|
|
332 |
iDataDictionary.DeleteDataL(name);
|
|
333 |
aCommand.iError = KErrNotFound;
|
|
334 |
}
|
|
335 |
CleanupStack::Pop(data);
|
|
336 |
}
|
|
337 |
else
|
|
338 |
{
|
|
339 |
aCommand.iError = KErrNotFound;
|
|
340 |
ERR_PRINTF2( KErrWrapperCreate, &name );
|
|
341 |
}
|
|
342 |
}
|
|
343 |
else
|
|
344 |
{
|
|
345 |
ERR_PRINTF1(KErrNoName);
|
|
346 |
aCommand.iError = KErrNotFound;
|
|
347 |
}
|
|
348 |
}
|
|
349 |
else
|
|
350 |
{
|
|
351 |
ERR_PRINTF1(KErrSharedData);
|
|
352 |
aCommand.iError = KErrNotSupported;
|
|
353 |
}
|
|
354 |
}
|
|
355 |
|
|
356 |
void CTestBlockController::StoreL(TTEFBlockItem& aCommand)
|
|
357 |
{
|
|
358 |
if( IsSharedDataMode() )
|
|
359 |
{
|
|
360 |
// Retrieve the object name from the ini file
|
|
361 |
TPtrC name;
|
|
362 |
if( 0 != aCommand.iSection.Compare(KTEFNull) &&
|
|
363 |
GetStringFromConfig(aCommand.iSection, KName, name) )
|
|
364 |
{
|
|
365 |
// Lookup the wrapper
|
|
366 |
CDataWrapper* data = iDataDictionary.GetDataL( name );
|
|
367 |
|
|
368 |
// Retrieve the object being wrapped
|
|
369 |
TAny* object = data->GetObject();
|
|
370 |
if ( object!=NULL )
|
|
371 |
{
|
|
372 |
// Add it to the persistent store
|
|
373 |
TCleanupOperation operation=data->CleanupOperation();
|
|
374 |
if ( operation!=NULL )
|
|
375 |
{
|
|
376 |
iSharedData->PutAndDisownL(name, object, operation);
|
|
377 |
data->DisownObjectL();
|
|
378 |
}
|
|
379 |
else
|
|
380 |
{
|
|
381 |
ERR_PRINTF1(KErrNoCleanup);
|
|
382 |
aCommand.iError = KErrNotFound;
|
|
383 |
}
|
|
384 |
}
|
|
385 |
else
|
|
386 |
{
|
|
387 |
ERR_PRINTF1(KErrNotExist);
|
|
388 |
aCommand.iError = KErrNotFound;
|
|
389 |
}
|
|
390 |
}
|
|
391 |
else
|
|
392 |
{
|
|
393 |
ERR_PRINTF1(KErrNoName);
|
|
394 |
SetTestStepResult(EFail);
|
|
395 |
}
|
|
396 |
}
|
|
397 |
else
|
|
398 |
{
|
|
399 |
ERR_PRINTF1(KErrSharedData);
|
|
400 |
aCommand.iError = KErrNotSupported;
|
|
401 |
}
|
|
402 |
}
|
|
403 |
|
|
404 |
void CTestBlockController::StoreActiveScheduler(TTEFBlockItem& aCommand)
|
|
405 |
{
|
|
406 |
if( IsSharedDataMode() )
|
|
407 |
{
|
|
408 |
// Don't delete the persistent active scheduler
|
|
409 |
iDeleteSharedScheduler = EFalse;
|
|
410 |
}
|
|
411 |
else
|
|
412 |
{
|
|
413 |
aCommand.iError = KErrNotSupported;
|
|
414 |
ERR_PRINTF1(KErrSharedMode);
|
|
415 |
}
|
|
416 |
}
|
|
417 |
|
|
418 |
void CTestBlockController::CommandL(TTEFBlockItem& aCommand, const TInt aAsyncErrorIndex)
|
|
419 |
{
|
|
420 |
// Retrieve the object name from the ini file
|
|
421 |
TPtrC name;
|
|
422 |
if( 0 != aCommand.iCommand.iObject.Compare(KTEFNull) &&
|
|
423 |
GetStringFromConfig(aCommand.iCommand.iObject, KName, name) )
|
|
424 |
{
|
|
425 |
CDataWrapper* data = iDataDictionary.GetDataL(name);
|
|
426 |
if( data!=NULL )
|
|
427 |
{
|
|
428 |
TBool cmdExists = EFalse;
|
|
429 |
TRAPD(err, cmdExists = data->DoCommandL(aCommand.iCommand.iFunction, aCommand.iSection, aAsyncErrorIndex));
|
|
430 |
if (KErrNone != err)
|
|
431 |
{
|
|
432 |
ERR_PRINTF4(_L("Command \"%S\" of the object \"%S\" leaves with error code %d"), &aCommand.iCommand.iFunction, &aCommand.iCommand.iObject, err);
|
|
433 |
aCommand.iError = err;
|
|
434 |
SetBlockResult(EFail);
|
|
435 |
}
|
|
436 |
else if( !cmdExists )
|
|
437 |
{
|
|
438 |
ERR_PRINTF1(KErrNoFunction);
|
|
439 |
aCommand.iError = KErrNotFound;
|
|
440 |
}
|
|
441 |
}
|
|
442 |
else
|
|
443 |
{
|
|
444 |
ERR_PRINTF1(KErrNotExist);
|
|
445 |
aCommand.iError = KErrNotFound;
|
|
446 |
}
|
|
447 |
}
|
|
448 |
else
|
|
449 |
{
|
|
450 |
ERR_PRINTF1(KErrNoName);
|
|
451 |
aCommand.iError = KErrNotFound;
|
|
452 |
}
|
|
453 |
}
|
|
454 |
|
|
455 |
EXPORT_C void CTestBlockController::StartTimer(const TTEFBlockItem& aCommand)
|
|
456 |
{
|
|
457 |
iTimer->After(aCommand.iTime?aCommand.iTime:KDefaultDelay);
|
|
458 |
}
|
|
459 |
|
|
460 |
EXPORT_C void CTestBlockController::CancelTimer()
|
|
461 |
{
|
|
462 |
if ( iTimerActive )
|
|
463 |
{
|
|
464 |
iTimer->Cancel();
|
|
465 |
}
|
|
466 |
}
|
|
467 |
|
|
468 |
EXPORT_C void CTestBlockController::TimerCompleted()
|
|
469 |
{
|
|
470 |
if( iAsyncTimer )
|
|
471 |
{
|
|
472 |
DecAsyncCount();
|
|
473 |
}
|
|
474 |
iTimerActive=EFalse;
|
|
475 |
StartCommands();
|
|
476 |
}
|
|
477 |
|
|
478 |
EXPORT_C TBool CTestBlockController::OutstandingCallback( TAny* aAny )
|
|
479 |
{
|
|
480 |
CTestBlockController* self = STATIC_CAST(CTestBlockController*,aAny);
|
|
481 |
if( self )
|
|
482 |
{
|
|
483 |
self->OutstandingCallback();
|
|
484 |
}
|
|
485 |
return EFalse;
|
|
486 |
}
|
|
487 |
|
|
488 |
EXPORT_C void CTestBlockController::OutstandingCallback()
|
|
489 |
{
|
|
490 |
TBool ok=ETrue;
|
|
491 |
TTEFBlockItem& block=iBlockArray->At(iCommandIndex-1);
|
|
492 |
|
|
493 |
TPtrC name(KTEFNull);
|
|
494 |
if( 0 != block.iSection.Compare(KTEFNull) )
|
|
495 |
{
|
|
496 |
if ( !GetStringFromConfig(block.iSection, KName, name) )
|
|
497 |
{
|
|
498 |
block.iError = KErrNotFound;
|
|
499 |
ERR_PRINTF1(KErrNoName);
|
|
500 |
ERR_PRINTF1(block.iSection);
|
|
501 |
ok=EFalse;
|
|
502 |
}
|
|
503 |
}
|
|
504 |
|
|
505 |
if ( ok )
|
|
506 |
{
|
|
507 |
TBool moreToDo;
|
|
508 |
TInt err=iDataDictionary.Outstanding(name, moreToDo);
|
|
509 |
if( err!=KErrNone )
|
|
510 |
{
|
|
511 |
block.iError = err;
|
|
512 |
ERR_PRINTF2(KErrOutstanding, err);
|
|
513 |
}
|
|
514 |
if ( !moreToDo )
|
|
515 |
{
|
|
516 |
iPeriodic->Cancel();
|
|
517 |
DecAsyncCount();
|
|
518 |
StartCommands();
|
|
519 |
}
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
EXPORT_C CTestBlockController::CBlockActiveScheduler::CBlockActiveScheduler(CTestBlockController& aTestStep)
|
|
524 |
: CActiveScheduler()
|
|
525 |
, iTestStep(aTestStep)
|
|
526 |
{
|
|
527 |
}
|
|
528 |
|
|
529 |
EXPORT_C CTestBlockController::CBlockActiveScheduler::~CBlockActiveScheduler()
|
|
530 |
{
|
|
531 |
}
|
|
532 |
|
|
533 |
EXPORT_C void CTestBlockController::CBlockActiveScheduler::Error(TInt aError) const
|
|
534 |
{
|
|
535 |
if ( KErrNone != aError )
|
|
536 |
{
|
|
537 |
iTestStep.ERR_PRINTF2(KErrActiveSched, aError);
|
|
538 |
iTestStep.SetTestStepResult(EFail);
|
|
539 |
}
|
|
540 |
CActiveScheduler::Error(aError);
|
|
541 |
}
|
|
542 |
|
|
543 |
EXPORT_C void CTestBlockController::StartCommands()
|
|
544 |
{
|
|
545 |
iCommandProcessor->KickState();
|
|
546 |
}
|
|
547 |
|
|
548 |
EXPORT_C void CTestBlockController::NextCommandL()
|
|
549 |
{
|
|
550 |
if( iBlockArray )
|
|
551 |
{
|
|
552 |
if( iCommandIndex < iBlockArray->Count() )
|
|
553 |
{
|
|
554 |
TInt synchronous = EFalse;
|
|
555 |
synchronous = DoCommandL(iBlockArray->At(iCommandIndex), iCommandIndex);
|
|
556 |
if( synchronous )
|
|
557 |
{
|
|
558 |
StartCommands();
|
|
559 |
}
|
|
560 |
else
|
|
561 |
{
|
|
562 |
IncAsyncCount();
|
|
563 |
}
|
|
564 |
iCommandIndex++;
|
|
565 |
}
|
|
566 |
else
|
|
567 |
{
|
|
568 |
CActiveScheduler::Stop();
|
|
569 |
}
|
|
570 |
}
|
|
571 |
else
|
|
572 |
{
|
|
573 |
ERR_PRINTF1(KErrBlockCorrupt);
|
|
574 |
SetTestStepResult(EFail);
|
|
575 |
CActiveScheduler::Stop();
|
|
576 |
}
|
|
577 |
}
|