|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Tests GetSuplInfoL in various scenarios. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <epos_comasuplposhandlerbase.h> |
|
19 #include <epos_comasuplpossessionbase.h> |
|
20 #include <epos_comasuplinforequestlist.h> |
|
21 #include <epos_comasuplinforequestlist.h> |
|
22 #include <epos_comasuplreqasstdata.h> |
|
23 #include <epos_comasuplsetcapabilities.h> |
|
24 #include <epos_comasuplposition.h> |
|
25 #include <epos_comasuplpospayload.h> |
|
26 #include <epos_comasuplvelocity.h> |
|
27 #include <epos_eomasuplposerrors.h> |
|
28 #include <ecom/ecom.h> |
|
29 |
|
30 #include "epos_comasuplsessiontest.h" |
|
31 #include "epos_comasuplpostesterlogger.h" |
|
32 #include "epos_comasupltesthandler.h" |
|
33 #include "epos_comasuplgetsuplinfomanager.h" |
|
34 |
|
35 /** Constant used for logging information about test*/ |
|
36 _LIT8(KSessionTestComplete, "Info: Session Test Complete."); |
|
37 |
|
38 /** Constant used for logging information about test*/ |
|
39 _LIT8(KSessionTestAborted, "Error: Session Test Aborted"); |
|
40 |
|
41 /** Constant used for logging information about test*/ |
|
42 _LIT8(KReqBeforeSessionInitialize, "Info: Requesting GetSuplInfo before \ |
|
43 Initializing POS session."); |
|
44 |
|
45 /** Constant used for logging information about test*/ |
|
46 _LIT8(KPositionReqBeforeSessionInitialize, "Info: Requesting GetPositionL\ |
|
47 before initializing POS session."); |
|
48 |
|
49 /** Constant used for logging information about test*/ |
|
50 _LIT8(KGetSuplInfoSessionEndRequest, "Info: GetPositionL requested after \ |
|
51 Session End."); |
|
52 |
|
53 /** Constant used for logging information about test*/ |
|
54 _LIT8(KGetSuplInfoWarning, "Warning: POS session is Not initialized.\ |
|
55 GetSuplInfoL() completed with KErrNone."); |
|
56 |
|
57 /** Constant used for logging information about test*/ |
|
58 _LIT8(KPosInactiveInfo, "Info: GetSuplInfoL() completed with status \ |
|
59 KErrOMASuplPosInActive"); |
|
60 |
|
61 /** Constant used for logging information about test*/ |
|
62 _LIT8(KGetSuplInfoInfo, "Info: GetSuplInfoL() completed with status \ |
|
63 KErrNone."); |
|
64 |
|
65 /** Constant used for logging information about test*/ |
|
66 _LIT8(KGetPositionInfo, "Info: GetPositionL() completed with status "); |
|
67 |
|
68 /** Constant used for logging information about test*/ |
|
69 _LIT8(KGetPositionWarn, "Warning: GetPositionL() completed with status "); |
|
70 |
|
71 /** Constant used for logging information about test*/ |
|
72 _LIT8(KGetSuplError, "Error: GetSuplInfoL() completed with status "); |
|
73 |
|
74 /** Constant used for logging information about test*/ |
|
75 _LIT8(KGetPositionError, "Error: GetPositionL() completed with status "); |
|
76 |
|
77 /** Constant used for logging information about test*/ |
|
78 _LIT8(KGetPositionInfoErr, "Error: Could not provide value to some \ |
|
79 mandatory fields. GetPositionL() completed with status "); |
|
80 |
|
81 /** Constant used for logging information about test*/ |
|
82 _LIT8(KRequestAfterSessionInit, "Info: Requesting GetSuplInfo after \ |
|
83 Initializing POS session."); |
|
84 |
|
85 /** Constant used for logging information about test*/ |
|
86 _LIT8(KGetPositionSessionInitRequest, "Info: Requesting for GetPositionL().\ |
|
87 Session is initialized."); |
|
88 |
|
89 /** Constant used for logging information about test*/ |
|
90 _LIT8(KPositionEndSessionRequest, "Info: Requesting for GetPositionL() \ |
|
91 after ending POS Session."); |
|
92 |
|
93 /** Constant used for logging information about test*/ |
|
94 _LIT8(KEndSession, "Info: Ending POS Session."); |
|
95 |
|
96 /** Constant used for logging information about test*/ |
|
97 _LIT8(KEndSessionComplete, "Info: Ending POS Session complete."); |
|
98 |
|
99 /** Constant used for logging information about test*/ |
|
100 _LIT8(KExistingSessionTest, "Info: Running test on an existing session."); |
|
101 |
|
102 // --------------------------------------------------------------------------- |
|
103 // Named constructor |
|
104 // --------------------------------------------------------------------------- |
|
105 // |
|
106 COMASuplSessionTest* COMASuplSessionTest::NewL( |
|
107 COMASuplPosHandlerBase& aPosHandler |
|
108 , COMASuplPosTesterCategory* aCallBack ) |
|
109 { |
|
110 COMASuplSessionTest* self = new( ELeave )COMASuplSessionTest( |
|
111 aPosHandler, aCallBack ); |
|
112 CleanupStack::PushL( self ); |
|
113 self->ConstructL(); |
|
114 CleanupStack::Pop( self ); |
|
115 return self; |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // Constructor |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 COMASuplSessionTest::COMASuplSessionTest( |
|
123 COMASuplPosHandlerBase& aPosHandler |
|
124 , COMASuplPosTesterCategory* aCallBack ) |
|
125 :COMASuplGetSuplInfoManager(aPosHandler, aCallBack) |
|
126 { |
|
127 iSessionState = ESessionUninitialized; |
|
128 iExistingSessionTestDone = EFalse; |
|
129 CActiveScheduler::Add( this ); |
|
130 } |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // Second phase constructor |
|
134 // --------------------------------------------------------------------------- |
|
135 // |
|
136 void COMASuplSessionTest::ConstructL() |
|
137 { |
|
138 iRequestList = COMASuplInfoRequestList::NewL(); |
|
139 iPosition = COMASuplPosition::NewL(); |
|
140 } |
|
141 |
|
142 // --------------------------------------------------------------------------- |
|
143 // Destructor |
|
144 // --------------------------------------------------------------------------- |
|
145 // |
|
146 COMASuplSessionTest::~COMASuplSessionTest() |
|
147 { |
|
148 delete iPosition; |
|
149 } |
|
150 |
|
151 // --------------------------------------------------------------------------- |
|
152 // This function is called by test handler. It is entry point of execution |
|
153 // of a test case. |
|
154 // --------------------------------------------------------------------------- |
|
155 // |
|
156 void COMASuplSessionTest::StartTestingL() |
|
157 { |
|
158 if(iCallBack) |
|
159 { |
|
160 iLogger->WriteTestHeader(KSessionTest, iTestNo); |
|
161 } |
|
162 iNextInSeq = EStartTest; |
|
163 __ASSERT_ALWAYS(!IsActive(),User::Panic(KPanicSetActive, KErrAlreadyExists)); |
|
164 DummyRequest(iStatus); |
|
165 SetActive(); |
|
166 } |
|
167 |
|
168 // --------------------------------------------------------------------------- |
|
169 // Handles an active object's request completion event. |
|
170 // --------------------------------------------------------------------------- |
|
171 // |
|
172 void COMASuplSessionTest::RunL() |
|
173 { |
|
174 switch( iNextInSeq ) |
|
175 { |
|
176 case EStartTest: |
|
177 { |
|
178 iLogger->GetRequestStartTime(); |
|
179 TRAPD( err, iSessionBase = iPosHandler.CreateNewSessionL( this ) ); |
|
180 if( KErrNone != err ) |
|
181 { |
|
182 iError++; |
|
183 iLogger->WriteLine(KCreatingSessionFail, iTestNo); |
|
184 User::Leave(err); |
|
185 } |
|
186 iInfo++; |
|
187 iLogger->LogExecutionTime(KExecCreateNewSessionL); |
|
188 iInfo++; |
|
189 iLogger->WriteLine(KSessionCreated, iTestNo); |
|
190 __ASSERT_ALWAYS(!IsActive(),User::Panic(KPanicSetActive, KErrAlreadyExists)); |
|
191 iNextInSeq = EGetSuplInfoSessionNotInitRequest; |
|
192 DummyRequest(iStatus); |
|
193 SetActive(); |
|
194 break; |
|
195 } |
|
196 case EGetSuplInfoSessionNotInitRequest: |
|
197 { |
|
198 iInfo++; |
|
199 iLogger->WriteLine(KReqBeforeSessionInitialize, iTestNo); |
|
200 iNextInSeq = EGetSuplInfoSessionNotInitRequestComplete; |
|
201 GetSuplInfoRequestL(); |
|
202 break; |
|
203 } |
|
204 case EGetSuplInfoSessionNotInitRequestComplete: |
|
205 { |
|
206 iNextInSeq = EGetPositionSessionNotInitRequest; |
|
207 GetSuplInfoRequestCompleteL(); |
|
208 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
209 DummyRequest(iStatus); |
|
210 SetActive(); |
|
211 break; |
|
212 } |
|
213 case EGetPositionSessionNotInitRequest: |
|
214 { |
|
215 iNextInSeq = EGetPositionSessionNotInitRequestComplete; |
|
216 iInfo++; |
|
217 iLogger->WriteLine(KPositionReqBeforeSessionInitialize, iTestNo); |
|
218 GetPositionRequestL(); |
|
219 break; |
|
220 } |
|
221 case EGetPositionSessionNotInitRequestComplete: |
|
222 { |
|
223 iNextInSeq = EInitializeSessionRequest; |
|
224 GetPositionRequestComplete(); |
|
225 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
226 DummyRequest(iStatus); |
|
227 SetActive(); |
|
228 break; |
|
229 } |
|
230 case EInitializeSessionRequest: |
|
231 { |
|
232 iNextInSeq = EinitializeSessionRequestComplete; |
|
233 iInfo++; |
|
234 iLogger->WriteLine(KInitializingSession, iTestNo); |
|
235 InitializeSessionRequestL(); |
|
236 break; |
|
237 } |
|
238 case EinitializeSessionRequestComplete: |
|
239 { |
|
240 iNextInSeq = EGetSuplInfoSessionInitRequest; |
|
241 InitializeSessionRequestCompleteL(); |
|
242 break; |
|
243 } |
|
244 case EGetSuplInfoSessionInitRequest: |
|
245 { |
|
246 iNextInSeq = EGetSuplInfoSessionInitRequestComplete; |
|
247 //log "Info: Requesting for GetSuplInfoL(). Session is initialized." |
|
248 iInfo++; |
|
249 iLogger->WriteLine(KRequestAfterSessionInit, iTestNo); |
|
250 GetSuplInfoRequestL(); |
|
251 break; |
|
252 } |
|
253 case EGetSuplInfoSessionInitRequestComplete: |
|
254 { |
|
255 iNextInSeq = EGetPositionSessionInitRequest; |
|
256 GetSuplInfoRequestCompleteL(); |
|
257 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
258 DummyRequest(iStatus); |
|
259 SetActive(); |
|
260 break; |
|
261 } |
|
262 case EGetPositionSessionInitRequest: |
|
263 { |
|
264 iNextInSeq = EGetPositionSessionInitRequestComplete; |
|
265 iInfo++; |
|
266 iLogger->WriteLine(KGetPositionSessionInitRequest, iTestNo); |
|
267 GetPositionRequestL(); |
|
268 break; |
|
269 } |
|
270 case EGetPositionSessionInitRequestComplete: |
|
271 { |
|
272 iNextInSeq = EEndSessionRequest; |
|
273 GetPositionRequestComplete(); |
|
274 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
275 DummyRequest(iStatus); |
|
276 SetActive(); |
|
277 break; |
|
278 } |
|
279 case EEndSessionRequest: |
|
280 { |
|
281 iNextInSeq = EEndSessionRequestComplete; |
|
282 //log "Info: Ending POS session." |
|
283 iInfo++; |
|
284 iLogger->WriteLine(KEndSession, iTestNo); |
|
285 EndSession(); |
|
286 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
287 DummyRequest(iStatus); |
|
288 SetActive(); |
|
289 break; |
|
290 } |
|
291 case EEndSessionRequestComplete: |
|
292 { |
|
293 iNextInSeq = EGetSuplInfoSessionEndRequest; |
|
294 //log "Info: POS Session Ended." |
|
295 iInfo++; |
|
296 iLogger->WriteLine(KEndSessionComplete, iTestNo); |
|
297 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
298 DummyRequest(iStatus); |
|
299 SetActive(); |
|
300 break; |
|
301 } |
|
302 case EGetSuplInfoSessionEndRequest: |
|
303 { |
|
304 iNextInSeq = EGetSuplInfoSessionEndRequestComplete; |
|
305 //log "Requesting for GetSuplInfoL(). Session is ended." |
|
306 iInfo++; |
|
307 iLogger->WriteLine(KGetSuplInfoSessionEndRequest, iTestNo); |
|
308 GetSuplInfoRequestL(); |
|
309 break; |
|
310 } |
|
311 case EGetSuplInfoSessionEndRequestComplete: |
|
312 { |
|
313 iNextInSeq = EGetPositionSessionEndRequest; |
|
314 GetSuplInfoRequestCompleteL(); |
|
315 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
316 DummyRequest(iStatus); |
|
317 SetActive(); |
|
318 break; |
|
319 } |
|
320 case EGetPositionSessionEndRequest: |
|
321 { |
|
322 iNextInSeq = EGetPositionSessionEndRequestComplete; |
|
323 iInfo++; |
|
324 iLogger->WriteLine(KPositionEndSessionRequest, iTestNo); |
|
325 GetPositionRequestL(); |
|
326 break; |
|
327 } |
|
328 case EGetPositionSessionEndRequestComplete: |
|
329 { |
|
330 iNextInSeq = EExistingSessionTest; |
|
331 GetPositionRequestComplete(); |
|
332 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
333 DummyRequest(iStatus); |
|
334 SetActive(); |
|
335 break; |
|
336 } |
|
337 case EExistingSessionTest: |
|
338 { |
|
339 if(iExistingSessionTestDone) |
|
340 { |
|
341 iNextInSeq = ETestingComplete; |
|
342 } |
|
343 else |
|
344 { |
|
345 iExistingSessionTestDone = ETrue; |
|
346 iInfo++; |
|
347 iLogger->WriteLine(KExistingSessionTest, iTestNo); |
|
348 iNextInSeq = EInitializeSessionRequest; |
|
349 } |
|
350 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
351 DummyRequest(iStatus); |
|
352 SetActive(); |
|
353 break; |
|
354 } |
|
355 case ETestingComplete: |
|
356 { |
|
357 TestingComplete(KSessionTestComplete); |
|
358 break; |
|
359 } |
|
360 } |
|
361 } |
|
362 |
|
363 // --------------------------------------------------------------------------- |
|
364 // Implements cancellation of an outstanding request. |
|
365 // --------------------------------------------------------------------------- |
|
366 // |
|
367 void COMASuplSessionTest::DoCancel() |
|
368 { |
|
369 if(EGetSuplInfoSessionNotInitRequestComplete == iNextInSeq |
|
370 || EGetSuplInfoSessionInitRequestComplete == iNextInSeq |
|
371 ||EGetSuplInfoSessionEndRequestComplete == iNextInSeq) |
|
372 { |
|
373 //Cancel GetSuplInfoL() |
|
374 iSessionBase->CancelSuplInfoRequest(); |
|
375 } |
|
376 if(EGetPositionSessionNotInitRequestComplete == iNextInSeq |
|
377 || EGetPositionSessionInitRequestComplete == iNextInSeq |
|
378 || EGetPositionSessionEndRequestComplete == iNextInSeq) |
|
379 { |
|
380 // Cancel GetPositionL() |
|
381 iSessionBase->CancelGetPosition(); |
|
382 } |
|
383 if(EinitializeSessionRequestComplete == iNextInSeq) |
|
384 { |
|
385 //Cancel session initialization |
|
386 iSessionBase->CancelInitialize(); |
|
387 } |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // Handles a leave occurring in the request completion event handler RunL(). |
|
392 // --------------------------------------------------------------------------- |
|
393 // |
|
394 TInt COMASuplSessionTest::RunError( TInt aError ) |
|
395 { |
|
396 if(EStartTest == iNextInSeq) |
|
397 { |
|
398 iError++; |
|
399 iLogger->WriteStatus(KLeaveInCreateNewSession, aError, iTestNo); |
|
400 } |
|
401 else if(EGetSuplInfoSessionNotInitRequestComplete == iNextInSeq |
|
402 || EGetSuplInfoSessionInitRequestComplete == iNextInSeq |
|
403 ||EGetSuplInfoSessionEndRequestComplete == iNextInSeq) |
|
404 { |
|
405 //Cancel GetSuplInfoL() |
|
406 iError++; |
|
407 iLogger->WriteStatus(KLeaveInGetSuplInfo, aError, iTestNo); |
|
408 } |
|
409 else if(EGetPositionSessionNotInitRequestComplete == iNextInSeq |
|
410 || EGetPositionSessionInitRequestComplete == iNextInSeq |
|
411 || EGetPositionSessionEndRequestComplete == iNextInSeq) |
|
412 { |
|
413 // Cancel GetPositionL() |
|
414 iError++; |
|
415 iLogger->WriteStatus(KLeaveInGetPosition, aError, iTestNo); |
|
416 } |
|
417 else if(EinitializeSessionRequestComplete == iNextInSeq) |
|
418 { |
|
419 //Cancel session initialization |
|
420 iError++; |
|
421 iLogger->WriteStatus(KLeaveInSessionInit, aError, iTestNo); |
|
422 } |
|
423 TestingAborted(KSessionTestAborted); |
|
424 return KErrNone; |
|
425 } |
|
426 |
|
427 // --------------------------------------------------------------------------- |
|
428 // Requests for GetSuplInfoL. |
|
429 // --------------------------------------------------------------------------- |
|
430 // |
|
431 void COMASuplSessionTest::GetSuplInfoRequestL() |
|
432 { |
|
433 ResetLists(); |
|
434 TRAPD(err, CreateRequestListL()); |
|
435 if(KErrNone != err) |
|
436 { |
|
437 iError++; |
|
438 iLogger->WriteStatus(KLeaveRequestListCreation(), err, iTestNo); |
|
439 TestingAborted(KSessionTestAborted); |
|
440 return; |
|
441 } |
|
442 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
443 iSessionBase->GetSuplInfoL(iRequestList, iStatus); |
|
444 SetActive(); |
|
445 } |
|
446 |
|
447 // --------------------------------------------------------------------------- |
|
448 // Logs the completion status of GetsuplinfoL. |
|
449 // --------------------------------------------------------------------------- |
|
450 // |
|
451 void COMASuplSessionTest::GetSuplInfoRequestCompleteL() |
|
452 { |
|
453 TInt diff = -1; |
|
454 if(!MatchLists(diff)) |
|
455 { |
|
456 iError++; |
|
457 iLogger->WriteStatus(KMatchError, diff, iTestNo, &KNULL()); |
|
458 } |
|
459 |
|
460 switch (iStatus.Int()) |
|
461 { |
|
462 case KErrNone: |
|
463 { |
|
464 if(ESessionInitialized == iSessionState) |
|
465 { |
|
466 //info |
|
467 iInfo++; |
|
468 iLogger->WriteLine(KGetSuplInfoInfo, iTestNo); |
|
469 } |
|
470 else |
|
471 { |
|
472 //warning |
|
473 iWarning++; |
|
474 iLogger->WriteLine(KGetSuplInfoWarning, iTestNo); |
|
475 } |
|
476 iLogger->LogRequestList(*iRequestList); |
|
477 break; |
|
478 } |
|
479 case KErrOMASuplPosInActive: |
|
480 { |
|
481 if(ESessionInitialized == iSessionState) |
|
482 { |
|
483 //warning |
|
484 iWarning++; |
|
485 iLogger->WriteLine(_L8("Warning: GetSuplInfo completed with status KErrNone. Session is initialized."), iTestNo); |
|
486 } |
|
487 else |
|
488 { |
|
489 //info |
|
490 iInfo++; |
|
491 iLogger->WriteLine(KPosInactiveInfo, iTestNo); |
|
492 } |
|
493 break; |
|
494 } |
|
495 case KErrOMASuplParamNotSet: |
|
496 { |
|
497 //warning |
|
498 iWarning++; |
|
499 iLogger->WriteLine(_L8("Warning: Parameter not set."), iTestNo); |
|
500 iLogger->LogRequestList(*iRequestList); |
|
501 break; |
|
502 } |
|
503 default: |
|
504 { |
|
505 //Error |
|
506 iWarning++; |
|
507 iLogger->WriteStatus(KGetSuplError(), iStatus.Int(), iTestNo |
|
508 , &KNULL()); |
|
509 break; |
|
510 } |
|
511 } |
|
512 } |
|
513 |
|
514 // --------------------------------------------------------------------------- |
|
515 // Initializes the POS session. |
|
516 // --------------------------------------------------------------------------- |
|
517 // |
|
518 void COMASuplSessionTest::InitializeSessionRequestL() |
|
519 { |
|
520 __ASSERT_ALWAYS( !IsActive(), User::Panic(KPanicSetActive, 1)); |
|
521 // Set the status as session is initialized. |
|
522 iSessionState = ESessionInitialized; |
|
523 iSessionBase->InitializeL(iRequestID, iStatus); |
|
524 SetActive(); |
|
525 } |
|
526 |
|
527 // --------------------------------------------------------------------------- |
|
528 // Logs the completion status of session initialization. |
|
529 // Leaves if session initialization is not complete with KErrNone. |
|
530 // --------------------------------------------------------------------------- |
|
531 // |
|
532 void COMASuplSessionTest::InitializeSessionRequestCompleteL() |
|
533 { |
|
534 if(iStatus != KErrNone) |
|
535 { |
|
536 iError++; |
|
537 iLogger->WriteStatus(KError, iStatus.Int(), iTestNo, &KSessionInitResult()); |
|
538 TestingAborted(KSessionTestAborted); |
|
539 return; |
|
540 } |
|
541 iInfo++; |
|
542 iLogger->WriteLine(KSessionInitialized, iTestNo); |
|
543 __ASSERT_ALWAYS(!IsActive(), User::Panic(KPanicSetActive, 1)); |
|
544 DummyRequest(iStatus); |
|
545 SetActive(); |
|
546 } |
|
547 |
|
548 void COMASuplSessionTest::ResetPositionL() |
|
549 { |
|
550 delete iPosition; |
|
551 iPosition = NULL; |
|
552 iPosition = COMASuplPosition::NewL(); |
|
553 } |
|
554 // --------------------------------------------------------------------------- |
|
555 // Requests for GetPositionL(). |
|
556 // --------------------------------------------------------------------------- |
|
557 // |
|
558 void COMASuplSessionTest::GetPositionRequestL() |
|
559 { |
|
560 TRAPD(err, ResetPositionL()); |
|
561 if(KErrNone != err) |
|
562 { |
|
563 iError++; |
|
564 iLogger->WriteStatus(KLeaveResettingPosition(), err, iTestNo); |
|
565 TestingAborted(KSessionTestAborted); |
|
566 return; |
|
567 } |
|
568 __ASSERT_ALWAYS(!IsActive(), User::Panic(KPanicSetActive, 1)); |
|
569 iSessionBase->GetPositionL(iStatus, iPosition); |
|
570 SetActive(); |
|
571 } |
|
572 |
|
573 // --------------------------------------------------------------------------- |
|
574 // Logs the completion status of GetPositionL(). |
|
575 // --------------------------------------------------------------------------- |
|
576 // |
|
577 void COMASuplSessionTest::GetPositionRequestComplete() |
|
578 { |
|
579 TInt diff = -1; |
|
580 if(!MatchLists(diff)) |
|
581 { |
|
582 iError++; |
|
583 iLogger->WriteStatus(KMatchError, diff, iTestNo, &KNULL()); |
|
584 } |
|
585 switch (iStatus.Int()) |
|
586 { |
|
587 case KErrNone: |
|
588 { |
|
589 if(iSessionState != ESessionInitialized) |
|
590 { |
|
591 //warning |
|
592 iWarning++; |
|
593 iLogger->WriteStatus(KGetPositionWarn, iStatus.Int() |
|
594 , iTestNo, &KNULL()); |
|
595 } |
|
596 else |
|
597 { |
|
598 iInfo++; |
|
599 iLogger->WriteStatus(KGetPositionInfo, iStatus.Int() |
|
600 , iTestNo, &KNULL()); |
|
601 } |
|
602 break; |
|
603 } |
|
604 case KErrOMASuplPosInfo: |
|
605 { |
|
606 //Error |
|
607 iError++; |
|
608 iLogger->WriteStatus(KGetPositionInfoErr, iStatus.Int() |
|
609 , iTestNo, &KNULL()); |
|
610 break; |
|
611 } |
|
612 case KErrOMASuplPosInActive: |
|
613 { |
|
614 if(iSessionState != ESessionInitialized) |
|
615 { |
|
616 //info |
|
617 iInfo++; |
|
618 iLogger->WriteStatus(KGetPositionInfo, iStatus.Int() |
|
619 , iTestNo, &KNULL()); |
|
620 } |
|
621 else |
|
622 { |
|
623 //warning |
|
624 iWarning++; |
|
625 iLogger->WriteStatus(KGetPositionWarn, iStatus.Int() |
|
626 , iTestNo, &KNULL()); |
|
627 } |
|
628 break; |
|
629 } |
|
630 default: |
|
631 { |
|
632 iError++; |
|
633 iLogger->WriteStatus(KGetPositionError, iStatus.Int() |
|
634 , iTestNo, &KNULL()); |
|
635 break; |
|
636 } |
|
637 } |
|
638 iLogger->LogSuplPosition(iPosition); |
|
639 } |
|
640 |
|
641 // --------------------------------------------------------------------------- |
|
642 // Ends a POS Session. |
|
643 // --------------------------------------------------------------------------- |
|
644 // |
|
645 void COMASuplSessionTest::EndSession() |
|
646 { |
|
647 __ASSERT_ALWAYS(!IsActive(), User::Panic(KPanicSetActive, 1)); |
|
648 iSessionState = ESessionEnded; |
|
649 iSessionBase->SessionEnd(); |
|
650 } |