|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: Stores information for a test sequence |
|
14 // |
|
15 // |
|
16 |
|
17 #include "clbstestsessionsequence.h" |
|
18 |
|
19 /** 2nd Phase constructor |
|
20 * |
|
21 * @param aNgProxy Reference to the Net Protocol Proxy |
|
22 * @param aTestCallback MHybridMultipleTestCallBack, used to access the main test |
|
23 * @param aSequenceNum Number of this sequence |
|
24 * @param aConfigFileName File name of the test ini file |
|
25 * @param aConfigSection Test config section |
|
26 */ |
|
27 CTestSessionSequence* CTestSessionSequence::NewL(CLbsTestNgMessageHandler& aNgProxy, MHybridMultipleTestCallBack& aTestCallback, |
|
28 TInt aSequenceNum, const TDesC& aConfigFileName, const TDesC& aConfigSection) |
|
29 { |
|
30 CTestSessionSequence* self = new (ELeave) CTestSessionSequence(aNgProxy, aTestCallback); |
|
31 CleanupStack::PushL(self); |
|
32 self->ConstructL(aSequenceNum, aConfigFileName, aConfigSection); |
|
33 CleanupStack::Pop(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 /** Destructor |
|
38 */ |
|
39 CTestSessionSequence::~CTestSessionSequence() |
|
40 { |
|
41 if(iCallbackIdle) |
|
42 { |
|
43 iCallbackIdle->Cancel(); |
|
44 delete iCallbackIdle; |
|
45 } |
|
46 iStateSequence.Close(); |
|
47 delete iIniFile; |
|
48 } |
|
49 |
|
50 /** Standard C Constructor |
|
51 */ |
|
52 CTestSessionSequence::CTestSessionSequence(CLbsTestNgMessageHandler& aNgProxy, MHybridMultipleTestCallBack& aTestCallback) |
|
53 :iCurrentPosition(-1), |
|
54 iStartPosition(0), |
|
55 iNgProxy(aNgProxy), |
|
56 iTestCallback(aTestCallback) |
|
57 { |
|
58 } |
|
59 |
|
60 /** Second phase construction |
|
61 */ |
|
62 void CTestSessionSequence::ConstructL(TInt aSequenceNum, const TDesC& aConfigFileName, const TDesC& aConfigSection) |
|
63 { |
|
64 iCallbackIdle = CIdle::NewL((CActive::EPriorityStandard)); |
|
65 |
|
66 //Open up the testdata ini file |
|
67 iIniFile = CIniData::NewL(aConfigFileName); |
|
68 |
|
69 //Extract the data for sequence number: aSequenceNum |
|
70 iSequenceId = aSequenceNum; |
|
71 |
|
72 LogTestStatement(_L("----------------------------- Sequence %d -----------------------------"), 1, iSequenceId); |
|
73 |
|
74 //Read in the Session ID |
|
75 TBuf<11> sessionIdName; |
|
76 sessionIdName.Format(_L("SessionId%d"), iSequenceId); |
|
77 TInt sessionNum; |
|
78 if(iIniFile->FindVar(aConfigSection, sessionIdName, sessionNum)) |
|
79 { |
|
80 iSessionId.SetSessionNum(sessionNum); |
|
81 LogTestStatement(_L("SessionId = %d"), 1, sessionNum); |
|
82 } |
|
83 |
|
84 //Set the Session ID owner to the correct PM ID |
|
85 iPmId = iNgProxy.GetPmId(); |
|
86 _LIT(KPmIniFileName, "c:\\testdata\\configs\\pminfo.ini"); |
|
87 CIniData* pmIniFile = CIniData::NewL(KPmIniFileName); |
|
88 CleanupStack::PushL(pmIniFile); |
|
89 |
|
90 TBuf<4> pmName; |
|
91 pmName.Format(_L("PM%d"), iPmId); |
|
92 |
|
93 TUint32 pmUid; |
|
94 TPtrC pmIdBuf; |
|
95 pmIniFile->FindVar(pmName, _L("UID"), pmIdBuf); |
|
96 TLex lexId(pmIdBuf); |
|
97 User::LeaveIfError(lexId.Val(pmUid, EHex)); |
|
98 iSessionId.SetSessionOwner(TUid::Uid(pmUid)); |
|
99 LogTestStatement(_L("PMUid = %X"), 1, pmUid); |
|
100 CleanupStack::PopAndDestroy(pmIniFile); |
|
101 |
|
102 // Get the starting position of the sequence, if it is not the first 'master' sequence |
|
103 TInt startPosition = 0; |
|
104 if(aSequenceNum != 0) //The first sequence is always the master sequence, hence always set the start position to 0 |
|
105 { |
|
106 TBuf<15> startPositionName; |
|
107 startPositionName.Format(_L("StartPosition%d"), iSequenceId); |
|
108 iIniFile->FindVar(aConfigSection, startPositionName, startPosition); |
|
109 } |
|
110 iStartPosition = startPosition; |
|
111 LogTestStatement(_L("StartPosition = %d"), 1, startPosition); |
|
112 |
|
113 // Read in the actual sequence |
|
114 TBuf<10> sequenceName; |
|
115 sequenceName.Format(_L("Sequence%d"), iSequenceId); |
|
116 TPtrC sequenceString; |
|
117 iIniFile->FindVar(aConfigSection, sequenceName, sequenceString); |
|
118 |
|
119 //Create sequence log buffer, to allow the sequence of messages to be logged to the TestExecute file |
|
120 TBuf<256> sequenceLog; |
|
121 sequenceLog.Append(_L("Sequence = ")); |
|
122 |
|
123 //Loop through the string extracting the values and appending them to the sequence array |
|
124 TLex lex(sequenceString); |
|
125 while(!lex.Eos()) |
|
126 { |
|
127 TPtrC token = lex.NextToken(); |
|
128 TLex con(token); |
|
129 TInt value; |
|
130 if (con.Val(value) == KErrNone) |
|
131 { |
|
132 iStateSequence.Append(value); |
|
133 sequenceLog.AppendNum(value); |
|
134 sequenceLog.Append(_L(" ")); |
|
135 } |
|
136 } |
|
137 iTestCallback.LogTestStatement(sequenceLog); |
|
138 } |
|
139 |
|
140 /** Main test function. This handles the next message in the sequence (either send or receive a message) |
|
141 */ |
|
142 void CTestSessionSequence::HandleMessage() |
|
143 { |
|
144 TInt request = GetCurrentAction(); |
|
145 if(request == KErrArgument) |
|
146 { |
|
147 //This sequence is finished, notify the test |
|
148 iTestCallback.SequenceFinished(); |
|
149 return; |
|
150 } |
|
151 |
|
152 TBuf<256> logStatement; |
|
153 |
|
154 //Identify the next action that needs to be completed: |
|
155 // 1. Send Message (PM -> NG) |
|
156 // 2. Receive Message (NG -> PM) |
|
157 // 3. Receive Privacy Request |
|
158 // 4. Receive NPUD |
|
159 // 5. Receive X3P |
|
160 switch(request) |
|
161 { |
|
162 //------------------------------ |
|
163 //Messages from test code to PM |
|
164 //------------------------------ |
|
165 case ENetMsgProcessStatusUpdate: |
|
166 { |
|
167 LogTestStatement(_L("<- ProcessStatusUpdate() [1006] Sq: %d"), 1, iSequenceId); |
|
168 SendProcessStatusUpdate(); |
|
169 break; |
|
170 } |
|
171 |
|
172 case ENetMsgProcessPrivacyRequest: |
|
173 { |
|
174 LogTestStatement(_L("<- ProcessPrivacyRequest() [1000] Sq: %d"), 1, iSequenceId); |
|
175 SendProcessPrivacyRequest(); |
|
176 break; |
|
177 } |
|
178 |
|
179 case ENetMsgProcessLocationUpdate: |
|
180 { |
|
181 LogTestStatement(_L("<- ProcessLocationUpdate() [1004] Sq: %d"), 1, iSequenceId); |
|
182 SendProcessLocationUpdate(); |
|
183 break; |
|
184 } |
|
185 |
|
186 case ENetMsgProcessAssistanceData: |
|
187 { |
|
188 LogTestStatement(_L("<- ProcessAssistanceData() [1003] Sq: %d"), 1, iSequenceId); |
|
189 SendProcessAssistanceData(); |
|
190 break; |
|
191 } |
|
192 |
|
193 case ENetMsgProcessLocationRequest: |
|
194 { |
|
195 LogTestStatement(_L("<- ProcessLocationRequest() [1001] Sq: %d"), 1, iSequenceId); |
|
196 SendProcessLocationRequest(); |
|
197 break; |
|
198 } |
|
199 |
|
200 case ENetMsgProcessSessionComplete: |
|
201 { |
|
202 LogTestStatement(_L("<- ProcessSessionComplete() [1002] Sq: %d"), 1, iSequenceId); |
|
203 SendProcessSessionComplete(); |
|
204 break; |
|
205 } |
|
206 |
|
207 case ENetTestMsgEndSession: |
|
208 { |
|
209 LogTestStatement(_L("<- ProcessSessionComplete() [1100 (1002)] Sq: %d"), 1, iSequenceId); |
|
210 SendProcessSessionComplete(); |
|
211 LogTestStatement(_L("<- ProcessStatusUpdate() [1100 (1006)] Sq: %d"), 1, iSequenceId); |
|
212 CTestSessionSequence::SendProcessStatusUpdate(); |
|
213 break; |
|
214 } |
|
215 |
|
216 case ENetTestMsgProcessSessionCompleteError: |
|
217 { |
|
218 LogTestStatement(_L("<- ProcessSessionCompleteError() [1101] Sq: %d"), 1, iSequenceId); |
|
219 SendProcessSessionComplete(KErrNotFound); |
|
220 break; |
|
221 } |
|
222 |
|
223 //------------------------------ |
|
224 //Messages from PM to test code |
|
225 //------------------------------ |
|
226 case ENetMsgRespondPrivacyRequest: |
|
227 case ENetMsgRespondLocationRequest: |
|
228 case ENetMsgRequestTransmitLocation: |
|
229 case ENetMsgCancelTransmitLocation: |
|
230 case ENetMsgRequestAssistanceData: |
|
231 case ENetMsgRequestSelfLocation: |
|
232 case ENetMsgCancelSelfLocation: |
|
233 case ENetMsgRequestNetworkLocation: |
|
234 case ENetMsgCancelNetworkLocation: |
|
235 case ENetMsgGetCurrentCapabilitiesResponse: |
|
236 { |
|
237 //Set the current sequence to wait for a message from the NG/LBS |
|
238 WaitForMessage(); |
|
239 |
|
240 break; |
|
241 } |
|
242 |
|
243 //-------------------------------- |
|
244 //Messages from Privacy Controller |
|
245 //-------------------------------- |
|
246 case EProcessNetworkLocationRequest: |
|
247 case EProcessNetworkPositionUpdate: |
|
248 case EProcessRequestComplete: |
|
249 { |
|
250 //Do nothing. This sequence is now in a waiting state. The callback (Privacy Handler) methods |
|
251 // in this class should get called by LBS. When they are called they will allow the sequence |
|
252 // to move onto the next message. |
|
253 break; |
|
254 } |
|
255 |
|
256 //-------------------------------------- |
|
257 //Messages from Test to LBS Self Locate |
|
258 //-------------------------------------- |
|
259 case ERequestSelfLocation: |
|
260 { |
|
261 LogTestStatement(_L("<- SelfLocationRequest [4000] Sq: %d"), 1, iSequenceId); |
|
262 RequestLocationUpdate(); |
|
263 break; |
|
264 } |
|
265 |
|
266 //---------------------------------- |
|
267 // Messages from LBS Self Locate API |
|
268 //---------------------------------- |
|
269 case ENotifyPositionUpdate: |
|
270 case EGetLastKnownLocation: |
|
271 { |
|
272 //Do nothing. This sequence is now in a waiting state. The callback (NPUD) methods in the |
|
273 // CTestMolrSessionSequence should get called by LBS. When they are called they will allow |
|
274 // the sequence to move onto the next message. |
|
275 break; |
|
276 } |
|
277 |
|
278 //------------------------------ |
|
279 //Messages from Test to LBS X3P |
|
280 //------------------------------ |
|
281 case ETransmitPosition: |
|
282 { |
|
283 LogTestStatement(_L("<- TransmitPosition [6000] Sq: %d"), 1, iSequenceId); |
|
284 TransmitPosition(); |
|
285 break; |
|
286 } |
|
287 |
|
288 //-------------------------- |
|
289 // Messages from LBS X3P API |
|
290 //-------------------------- |
|
291 case EX3PRefPositionUpdate: |
|
292 case EX3PPositionUpdate: |
|
293 { |
|
294 //Do nothing. This sequence is now in a waiting state. The callback (X3P) methods in the |
|
295 // CTestX3PSessionSequence should get called by LBS. When they are called they will allow |
|
296 // the sequence to move onto the next message. |
|
297 break; |
|
298 } |
|
299 |
|
300 //Error |
|
301 default: |
|
302 { |
|
303 //Error |
|
304 LogTestStatement(_L("Error - Invalid sequence entry number: %d"), 1, iSequenceId); |
|
305 iTestCallback.StopTest(KErrArgument); |
|
306 } |
|
307 |
|
308 } //End Switch Statement |
|
309 |
|
310 //If the above Handle Message sent a message to LBS and the sequence is not currently |
|
311 // waiting for anything, execute the next statement in the sequence (so this is only |
|
312 // required for certain message types). |
|
313 switch(request) |
|
314 { |
|
315 case ENetMsgProcessPrivacyRequest: |
|
316 case ENetMsgProcessLocationRequest: |
|
317 case ENetMsgProcessSessionComplete: |
|
318 case ENetMsgProcessAssistanceData: |
|
319 case ENetMsgProcessLocationUpdate: |
|
320 case ENetMsgGetCurrentCapabilitiesRequest: |
|
321 case ENetMsgProcessStatusUpdate: |
|
322 case ERequestSelfLocation: |
|
323 case ENetTestMsgEndSession: |
|
324 case ENetTestMsgProcessSessionCompleteError: |
|
325 case ETransmitPosition: |
|
326 { |
|
327 SignalCallbackIdleStart(); |
|
328 break; |
|
329 } |
|
330 } |
|
331 |
|
332 //Check to see whether any new sequences need to be started |
|
333 if(iSequenceId == 0) |
|
334 { |
|
335 iTestCallback.SignalCheckForNewSequences(); |
|
336 } |
|
337 } |
|
338 |
|
339 /** Returns the session ID of the sequence |
|
340 */ |
|
341 TLbsNetSessionId CTestSessionSequence::GetSessionId() |
|
342 { |
|
343 return iSessionId; |
|
344 } |
|
345 |
|
346 /** Returns the ID of the PM used by this session sequence |
|
347 */ |
|
348 TInt CTestSessionSequence::GetPmId() |
|
349 { |
|
350 return iPmId; |
|
351 } |
|
352 |
|
353 /** Returns the current position of the sequence |
|
354 */ |
|
355 TInt CTestSessionSequence::GetCurrentPosition() |
|
356 { |
|
357 return iCurrentPosition; |
|
358 } |
|
359 |
|
360 /** Increments the current position of the sequence to the next entry |
|
361 */ |
|
362 void CTestSessionSequence::IncrementPosition() |
|
363 { |
|
364 iCurrentPosition++; |
|
365 } |
|
366 |
|
367 /** Returns the starting position of the sequence |
|
368 */ |
|
369 TInt CTestSessionSequence::GetStartPosition() |
|
370 { |
|
371 return iStartPosition; |
|
372 } |
|
373 |
|
374 /** Gets the current action from the sequence |
|
375 * Note: The position is NOT incremented automatically. This needs to be manually done |
|
376 * with a call to IncrementPosition() call. This allows the test to see what the next |
|
377 * entry in the sequence is, without consuming that entry. |
|
378 */ |
|
379 TInt CTestSessionSequence::GetCurrentAction() |
|
380 { |
|
381 if((iCurrentPosition >= iStateSequence.Count()) || (iCurrentPosition < 0)) |
|
382 { |
|
383 return KErrArgument; |
|
384 } |
|
385 return iStateSequence[iCurrentPosition]; |
|
386 } |
|
387 |
|
388 /** Prints out the remaining actions in the sequence. This should only be used at the |
|
389 * end of the test. If the test fails, it calls this function to print out what the |
|
390 * sequence was still expecting which can help with debugging where the test stopped. |
|
391 */ |
|
392 void CTestSessionSequence::PrintRemainingActions() |
|
393 { |
|
394 TInt currentAction = GetCurrentAction(); |
|
395 LogTestStatement(_L("Sequence %d; PM ID %d:"), 2, iSequenceId, iPmId); |
|
396 |
|
397 if(currentAction == KErrArgument) |
|
398 { |
|
399 //This sequence is finished |
|
400 iTestCallback.LogTestStatement(_L(" - Test Sequence Completed")); |
|
401 return; |
|
402 } |
|
403 |
|
404 //Loop through the sequence, logging all the remaining actions |
|
405 TBuf<256> sequenceListLog; |
|
406 sequenceListLog.Append(_L(" - ")); |
|
407 while(currentAction != KErrArgument) |
|
408 { |
|
409 sequenceListLog.AppendNum(currentAction); |
|
410 sequenceListLog.Append(_L(" ")); |
|
411 |
|
412 //Increment the position and get the current action |
|
413 IncrementPosition(); |
|
414 currentAction = GetCurrentAction(); |
|
415 } |
|
416 iTestCallback.LogTestStatement(sequenceListLog); |
|
417 } |
|
418 |
|
419 /** Simply calls the NG Protocol Proxy to wait for a message from LBS |
|
420 */ |
|
421 void CTestSessionSequence::WaitForMessage() |
|
422 { |
|
423 //All timeout's are now 60 seconds |
|
424 iNgProxy.WaitForResponseL(60 * 1000 * 1000); |
|
425 } |
|
426 |
|
427 //---------------------------------------------- |
|
428 // NG Message Implementation functions |
|
429 //---------------------------------------------- |
|
430 |
|
431 /* << ProcessAssistanceData() |
|
432 */ |
|
433 void CTestSessionSequence::SendProcessAssistanceData() |
|
434 { |
|
435 TLbsAsistanceDataGroup dataRequestMask = EAssistanceDataReferenceLocation; |
|
436 RLbsAssistanceDataBuilderSet assistanceData; |
|
437 ArgUtils::PopulateLC(assistanceData); |
|
438 TInt reason = KErrNone; |
|
439 iNgProxy.ProtocolProxy()->CallL(ENetMsgProcessAssistanceData, &dataRequestMask, &assistanceData, &reason); |
|
440 CleanupStack::PopAndDestroy(); //assistanceData |
|
441 } |
|
442 |
|
443 /* << ProcessSessionComplete() |
|
444 */ |
|
445 void CTestSessionSequence::SendProcessSessionComplete(TInt aReason) |
|
446 { |
|
447 iNgProxy.ProtocolProxy()->CallL(ENetMsgProcessSessionComplete, &iSessionId, &aReason); |
|
448 } |
|
449 |
|
450 /* << ProcessLocationUpdate() |
|
451 */ |
|
452 void CTestSessionSequence::SendProcessLocationUpdate() |
|
453 { |
|
454 TPositionInfo positionInfo = ArgUtils::ReferencePositionInfo(); |
|
455 iNgProxy.ProtocolProxy()->CallL(ENetMsgProcessLocationUpdate, &iSessionId, &positionInfo); |
|
456 } |
|
457 |
|
458 /** << ProcessPrivacyRequest() |
|
459 */ |
|
460 void CTestSessionSequence::SendProcessPrivacyRequest() |
|
461 { //Implementation is MTLR specific |
|
462 iTestCallback.StopTest(KErrArgument); |
|
463 } |
|
464 |
|
465 /* << ProcessStatusUpdate() |
|
466 */ |
|
467 void CTestSessionSequence::SendProcessStatusUpdate() |
|
468 { |
|
469 MLbsNetworkProtocolObserver::TLbsNetProtocolServiceMask activeServiceMask = MLbsNetworkProtocolObserver::EServiceNone; |
|
470 iNgProxy.ProtocolProxy()->CallL(ENetMsgProcessStatusUpdate, &activeServiceMask); |
|
471 } |
|
472 |
|
473 /* << ProcessLocationRequest() |
|
474 */ |
|
475 void CTestSessionSequence::SendProcessLocationRequest() |
|
476 { |
|
477 //Requires Specific implementation |
|
478 iTestCallback.StopTest(KErrArgument); |
|
479 } |
|
480 |
|
481 //---------------------------------------------- |
|
482 // NG Message Checker functions |
|
483 //---------------------------------------------- |
|
484 |
|
485 /** Checks SelfLocationRequest() |
|
486 */ |
|
487 void CTestSessionSequence::CheckSelfLocationRequest(TLbsNetSessionId* /*aSessionId*/) |
|
488 { |
|
489 //Should only be received on MOLR requests |
|
490 iTestCallback.StopTest(KErrArgument); |
|
491 } |
|
492 |
|
493 /** Checks RequestTransmitLocation() |
|
494 */ |
|
495 void CTestSessionSequence::CheckRequestTransmitLocation(TLbsNetSessionId* /*aSessionId*/, TInt /*aPriority*/, const TDesC16& /*aThirdParty*/) |
|
496 { |
|
497 //Should only be received on X3P requests |
|
498 iTestCallback.StopTest(KErrArgument); |
|
499 } |
|
500 |
|
501 /** Checks NetworkLocationRequest() |
|
502 */ |
|
503 void CTestSessionSequence::CheckNetworkLocationRequest(TLbsNetSessionId* /*aSessionId*/) |
|
504 { |
|
505 //Should only be received on MOLR requests |
|
506 iTestCallback.StopTest(KErrArgument); |
|
507 } |
|
508 |
|
509 /** Checks RespondPrivacyRequest() |
|
510 */ |
|
511 void CTestSessionSequence::CheckRespondPrivacyRequest(CLbsNetworkProtocolBase::TLbsPrivacyResponse /*aPrivacyResponse*/) |
|
512 { |
|
513 //Should only be received on MTLR requests |
|
514 iTestCallback.StopTest(KErrArgument); |
|
515 } |
|
516 |
|
517 //---------------------------------------------- |
|
518 // MOLR Self Location Requests |
|
519 //---------------------------------------------- |
|
520 |
|
521 /** Notify Position Update |
|
522 */ |
|
523 void CTestSessionSequence::RequestLocationUpdate() |
|
524 { |
|
525 //Incorrectly received a request to make a location request |
|
526 iTestCallback.StopTest(KErrArgument); |
|
527 } |
|
528 |
|
529 //---------------------------------------------- |
|
530 // X3P Transmit Location Requests |
|
531 //---------------------------------------------- |
|
532 |
|
533 void CTestSessionSequence::TransmitPosition() |
|
534 { |
|
535 //Incorrectly received a request to make a X3P request |
|
536 iTestCallback.StopTest(KErrArgument); |
|
537 } |
|
538 |
|
539 |
|
540 //------------------------------ |
|
541 // Idle Callback Functions |
|
542 //------------------------------ |
|
543 |
|
544 void CTestSessionSequence::SignalCallbackIdleStart() |
|
545 { |
|
546 //The previous action was sent or received correctly. Always call IncrementPosition so |
|
547 // that the this deals with the next expected action. |
|
548 IncrementPosition(); |
|
549 |
|
550 //Check to make sure the CIdle object is not currently active |
|
551 if(!iCallbackIdle->IsActive()) |
|
552 { |
|
553 iCallbackIdle->Start(TCallBack(HandlerCompleteCallback, this)); |
|
554 } |
|
555 else |
|
556 { |
|
557 //If it is still active, re-call the NG Proxy to listen for another message. The reason for this: |
|
558 // If this sequence's CIdle object is active, this sequence is "between" actions. It has already |
|
559 // been told to deal with the next action, but the CIdle has not been completed and so the HandleMessage() |
|
560 // function has not been called. HOWEVER a message must have arrived on the NG-PM interface that is meant |
|
561 // for this sequence AND since this function was called, it was an expected message. SO this sequence has |
|
562 // "stolen" a WaitForResponse call from another sequence. As such, manually make another call from this |
|
563 // sequence on the same PM to satisfy the action on that other sequence. |
|
564 iNgProxy.WaitForResponseL(60 * 1000 * 1000); |
|
565 } |
|
566 } |
|
567 |
|
568 TInt CTestSessionSequence::HandlerCompleteCallback(TAny* aAny) |
|
569 { |
|
570 reinterpret_cast<CTestSessionSequence*>(aAny)->HandlerCompleteNotify(); |
|
571 |
|
572 return KErrNone; |
|
573 } |
|
574 |
|
575 void CTestSessionSequence::HandlerCompleteNotify() |
|
576 { |
|
577 HandleMessage(); |
|
578 } |
|
579 |
|
580 /** Simple TestSessionSequence logging function. It uses the TestCallBack and passes |
|
581 * in a string to log via the TestExecute logger. |
|
582 */ |
|
583 void CTestSessionSequence::LogTestStatement(const TDesC& aMessage, TInt aCount, ...) |
|
584 { |
|
585 TBuf<256> logStatement; |
|
586 RArray<TInt> values; |
|
587 CleanupClosePushL(values); |
|
588 |
|
589 VA_LIST list; |
|
590 VA_START(list, aCount); |
|
591 for(TInt i=0; i<aCount; ++i) |
|
592 { |
|
593 values.Append(VA_ARG(list, TInt)); |
|
594 } |
|
595 |
|
596 switch(aCount) |
|
597 { |
|
598 case 1: |
|
599 logStatement.Format(aMessage, values[0]); |
|
600 break; |
|
601 |
|
602 case 2: |
|
603 logStatement.Format(aMessage, values[0], values[1]); |
|
604 break; |
|
605 |
|
606 case 3: |
|
607 logStatement.Format(aMessage, values[0], values[1], values[2]); |
|
608 break; |
|
609 } |
|
610 |
|
611 iTestCallback.LogTestStatement(logStatement); |
|
612 |
|
613 CleanupStack::PopAndDestroy(&values); |
|
614 VA_END(list); |
|
615 } |
|
616 |
|
617 |