|
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 testclass implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 // [INCLUDE FILES] - do not remove |
|
19 #include <e32svr.h> |
|
20 #include <StifParser.h> |
|
21 #include <Stiftestinterface.h> |
|
22 |
|
23 #include "LocInfoConversionUnitTest.h" |
|
24 #include "rlbslocmonitorsession.h" |
|
25 #include "rlbslocinfoconverter.h" |
|
26 #include "rlbslocmonitorareapositioner.h" |
|
27 #include <lbs/lbslocationinfo.h> |
|
28 #include <lbs/lbslocationcommon.h> |
|
29 #include "lbsposition.h" |
|
30 |
|
31 |
|
32 // Plug in |
|
33 const TInt KDummyPluginId = 537007117; |
|
34 const TInt KSuplPluginId = 537028467; |
|
35 |
|
36 // ============================ MEMBER FUNCTIONS =============================== |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CLocInfoConversionUnitTest::Delete |
|
40 // Delete here all resources allocated and opened from test methods. |
|
41 // Called from destructor. |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 void CLocInfoConversionUnitTest::Delete() |
|
45 { |
|
46 |
|
47 } |
|
48 |
|
49 // ----------------------------------------------------------------------------- |
|
50 // CLocInfoConversionUnitTest::RunMethodL |
|
51 // Run specified method. Contains also table of test mothods and their names. |
|
52 // ----------------------------------------------------------------------------- |
|
53 // |
|
54 TInt CLocInfoConversionUnitTest::RunMethodL( |
|
55 CStifItemParser& aItem ) |
|
56 { |
|
57 |
|
58 static TStifFunctionInfo const KFunctions[] = |
|
59 { |
|
60 ENTRY( "UnitTest1", CLocInfoConversionUnitTest::RLbsLocInfoConverter_Connect1L ), |
|
61 ENTRY( "UnitTest2", CLocInfoConversionUnitTest::RLbsLocInfoConverter_Connect2L ), |
|
62 ENTRY( "UnitTest3", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo1L ), |
|
63 ENTRY( "UnitTest4", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo2L ), |
|
64 ENTRY( "UnitTest5", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo3L ), |
|
65 ENTRY( "UnitTest6", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo4L ), |
|
66 ENTRY( "UnitTest7", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo5L ), |
|
67 ENTRY( "UnitTest8", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo6L ), |
|
68 ENTRY( "UnitTest9", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo7L ), |
|
69 ENTRY( "UnitTest10", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo8L ), |
|
70 ENTRY( "UnitTest11", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo9L ), |
|
71 ENTRY( "UnitTest12", CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo10L ), |
|
72 ENTRY( "UnitTest13", CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel1L ), |
|
73 ENTRY( "UnitTest14", CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel2L ), |
|
74 ENTRY( "UnitTest15", CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel3L ), |
|
75 ENTRY( "UnitTest16", CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel4L ), |
|
76 }; |
|
77 |
|
78 const TInt count = sizeof( KFunctions ) / |
|
79 sizeof( TStifFunctionInfo ); |
|
80 |
|
81 return RunInternalL( KFunctions, count, aItem ); |
|
82 |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_Connect1 |
|
87 // simple session and subsession. |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_Connect1L(CStifItemParser& /*aItem*/ ) |
|
91 { |
|
92 TInt error; |
|
93 RLbsLocMonitorSession locMonitorSession; |
|
94 error = locMonitorSession.Connect(); |
|
95 if( error != KErrNone ) |
|
96 { |
|
97 return error; |
|
98 } |
|
99 CleanupClosePushL( locMonitorSession ); |
|
100 RLbsLocInfoConverter locInfoConverter; |
|
101 CleanupClosePushL( locInfoConverter ); |
|
102 locInfoConverter.OpenL( locMonitorSession ); |
|
103 locInfoConverter.Close(); |
|
104 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
105 return KErrNone; |
|
106 } |
|
107 |
|
108 // ----------------------------------------------------------------------------- |
|
109 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_Connect2 |
|
110 // Opening multiple subsession from single session |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_Connect2L(CStifItemParser& /*aItem*/ ) |
|
114 { |
|
115 RLbsLocMonitorSession locMonitorSession; |
|
116 TInt error = locMonitorSession.Connect(); |
|
117 if( error != KErrNone ) |
|
118 { |
|
119 return error; |
|
120 } |
|
121 CleanupClosePushL( locMonitorSession ); |
|
122 RLbsLocInfoConverter locInfoConverter; |
|
123 CleanupClosePushL( locInfoConverter ); |
|
124 RLbsLocInfoConverter locInfoConverter1; |
|
125 CleanupClosePushL( locInfoConverter1 ); |
|
126 |
|
127 locInfoConverter.OpenL( locMonitorSession ); |
|
128 locInfoConverter1.OpenL( locMonitorSession ); |
|
129 locInfoConverter.Close(); |
|
130 locInfoConverter1.Close(); |
|
131 |
|
132 CleanupStack::PopAndDestroy( 3 ); //locInfoConverter1,locInfoConverter and |
|
133 //locMonitorSession |
|
134 return KErrNone; |
|
135 } |
|
136 |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo1L |
|
140 // This test case tests the simple and corner case related |
|
141 // to RLbsLocInfoConverter::ConvertLocationInfoL |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo1L(CStifItemParser& /*aItem*/ ) |
|
145 { |
|
146 RLbsLocMonitorSession locMonitorSession; |
|
147 TInt error = locMonitorSession.Connect(); |
|
148 if( error != KErrNone ) |
|
149 { |
|
150 return error; |
|
151 } |
|
152 CleanupClosePushL( locMonitorSession ); |
|
153 RLbsLocInfoConverter locInfoConverter; |
|
154 CleanupClosePushL( locInfoConverter ); |
|
155 locInfoConverter.OpenL( locMonitorSession ); |
|
156 |
|
157 |
|
158 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
159 |
|
160 /** |
|
161 * Case 1: where NULL pointer is passed instead of location info |
|
162 */ |
|
163 error = KErrNone; |
|
164 CLbsLocationInfo* locationInfo = CLbsLocationInfo::NewL(); |
|
165 CleanupStack::PushL( locationInfo ); |
|
166 TRAP( error,locInfoConverter.ConvertLocationInfoL( |
|
167 *locationInfo,ELbsConversionNotDefined,ELbsConversionOutputPosition, |
|
168 conversionModuleId,iConversionHandler->iStatus )); |
|
169 if( error!= KErrArgument ) |
|
170 { |
|
171 User::Leave( KErrArgument ); |
|
172 } |
|
173 |
|
174 /** |
|
175 * Case 2: where we pass location info.This is |
|
176 * just test where this method completes without leaving. |
|
177 */ |
|
178 |
|
179 // Here we append gsmcell info object to the existing location info object. |
|
180 AppendAreaInfoObjectToLocationInfoL( locationInfo,ELbsAreaGsmCellInfoClass ); |
|
181 |
|
182 locInfoConverter.ConvertLocationInfoL( |
|
183 *locationInfo,ELbsConversionNotDefined, |
|
184 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
185 iConversionHandler->Start(); |
|
186 locInfoConverter.CancelConvertLocationInfo(); |
|
187 iConversionHandler->Cancel(); |
|
188 CleanupStack::PopAndDestroy( locationInfo ); |
|
189 |
|
190 /** |
|
191 * Case 3. Empty location info array is passed. |
|
192 */ |
|
193 error = KErrNone; |
|
194 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
195 CleanupClosePushL( locationInfoArray ); |
|
196 TRAP( error,locInfoConverter.ConvertLocationInfoL( |
|
197 locationInfoArray,ELbsConversionNotDefined, |
|
198 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus )); |
|
199 |
|
200 if( error != KErrArgument ) |
|
201 { |
|
202 User::Leave( KErrArgument ); |
|
203 } |
|
204 |
|
205 /** |
|
206 * Case 4: where we pass location info array.This is |
|
207 * just test where this method completes without leaving. |
|
208 */ |
|
209 |
|
210 // Here we create locationInfo object with gsm cell info object contained in it. |
|
211 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
212 locationInfoArray.Append( locationInfo1 ); |
|
213 |
|
214 locInfoConverter.ConvertLocationInfoL( |
|
215 locationInfoArray,ELbsConversionNotDefined, |
|
216 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
217 iConversionHandler->Start(); |
|
218 locInfoConverter.CancelConvertLocationInfo(); |
|
219 iConversionHandler->Cancel(); |
|
220 |
|
221 CleanupStack::Pop( 2 ); //locationInfo1,locationInfoArray |
|
222 locationInfoArray.ResetAndDestroy(); |
|
223 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
224 return KErrNone; |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo2L |
|
229 // This test case tests ConvertLocationInfo when expected information is |
|
230 // of type ECoordinate |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo2L(CStifItemParser& /*aItem*/ ) |
|
234 { |
|
235 RLbsLocMonitorSession locMonitorSession; |
|
236 TInt error = locMonitorSession.Connect(); |
|
237 if( error != KErrNone ) |
|
238 { |
|
239 return error; |
|
240 } |
|
241 CleanupClosePushL( locMonitorSession ); |
|
242 RLbsLocInfoConverter locInfoConverter; |
|
243 CleanupClosePushL( locInfoConverter ); |
|
244 locInfoConverter.OpenL( locMonitorSession ); |
|
245 |
|
246 |
|
247 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
248 CleanupClosePushL( locationInfoArray ); |
|
249 |
|
250 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
251 |
|
252 /** |
|
253 * case 1: Any information regarding the area is passed and |
|
254 * coordinate corresponding to that area info is expected. |
|
255 */ |
|
256 |
|
257 // Here GSM cell info is passed as input area. |
|
258 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
259 |
|
260 locInfoConverter.ConvertLocationInfoL( |
|
261 *locationInfo,ELbsConversionNotDefined,ELbsConversionOutputPosition |
|
262 ,conversionModuleId,iConversionHandler->iStatus ); |
|
263 iConversionHandler->Start(); |
|
264 CActiveScheduler::Start(); |
|
265 |
|
266 error = iConversionHandler->iStatus.Int(); |
|
267 // If the conversion status is KErrNone, check for the corresponding |
|
268 // converted info. |
|
269 if( error == KErrNone ) |
|
270 { |
|
271 CheckPositionConvertedInfoL( locationInfo ); |
|
272 } |
|
273 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
274 else if( !( error == KErrNotSupported || error == KErrNotFound ) ) |
|
275 { |
|
276 User::Leave( KErrArgument ); |
|
277 } |
|
278 |
|
279 /** |
|
280 * case 2: Pass any information related to multiple area and we expect coordinate information |
|
281 * corresponding to each area information. |
|
282 */ |
|
283 |
|
284 // Create one more location info object which holds wlan info for which corresponding coordinate |
|
285 // is expected. |
|
286 CLbsLocationInfo* locationInfo2 = CreateLocationInfoObjectLC( ELbsAreaWlanInfoClass ); |
|
287 |
|
288 // Before pushing location info object, remove the converted info from it. |
|
289 // We had requested for coordinate info, hence we need to clear it before |
|
290 // we use it as input for next conversion. |
|
291 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
292 locationInfoArray.Append( locationInfo ); |
|
293 |
|
294 locationInfoArray.Append( locationInfo2 ); |
|
295 |
|
296 locInfoConverter.ConvertLocationInfoL( |
|
297 locationInfoArray,ELbsConversionNotDefined, |
|
298 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
299 iConversionHandler->Start(); |
|
300 |
|
301 // This is just to block the control till the call back method is called. |
|
302 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
303 // is called in the HandleLocationConversion method. |
|
304 CActiveScheduler::Start(); |
|
305 |
|
306 error = iConversionHandler->iStatus.Int(); |
|
307 // Iterate through the array and check for converted info. |
|
308 if( error == KErrNone ) |
|
309 { |
|
310 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
311 { |
|
312 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
313 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
314 CheckPositionConvertedInfoL( locationInfo ); |
|
315 } |
|
316 } |
|
317 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
318 else if( !( error == KErrNotSupported || error == KErrNotFound ) ) |
|
319 { |
|
320 User::Leave( KErrArgument ); |
|
321 } |
|
322 |
|
323 CleanupStack::Pop( 3 ); // locationInfo,locationInfo1,locationInfoArray |
|
324 locationInfoArray.ResetAndDestroy(); |
|
325 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
326 return KErrNone; |
|
327 } |
|
328 |
|
329 |
|
330 // ----------------------------------------------------------------------------- |
|
331 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo3L |
|
332 // This test case tests ConvertLocationInfo when expected information is |
|
333 // of type EGsm |
|
334 // ----------------------------------------------------------------------------- |
|
335 // |
|
336 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo3L(CStifItemParser& /*aItem*/ ) |
|
337 { |
|
338 RLbsLocMonitorSession locMonitorSession; |
|
339 TInt error = locMonitorSession.Connect(); |
|
340 if( error != KErrNone ) |
|
341 { |
|
342 return error; |
|
343 } |
|
344 CleanupClosePushL( locMonitorSession ); |
|
345 RLbsLocInfoConverter locInfoConverter; |
|
346 CleanupClosePushL( locInfoConverter ); |
|
347 locInfoConverter.OpenL( locMonitorSession ); |
|
348 |
|
349 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
350 CleanupClosePushL( locationInfoArray ); |
|
351 |
|
352 TUid conversionModuleId = TUid::Uid( KDummyPluginId );; |
|
353 |
|
354 /** |
|
355 * case 1: Pass any area info and we expect GSM cell info |
|
356 */ |
|
357 |
|
358 // Here WLAN info is passed as input area. |
|
359 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaWlanInfoClass ); |
|
360 |
|
361 locInfoConverter.ConvertLocationInfoL( |
|
362 *locationInfo,ELbsConversionCacheOnly,ELbsConversionOutputGsm, |
|
363 conversionModuleId,iConversionHandler->iStatus ); |
|
364 iConversionHandler->Start(); |
|
365 |
|
366 // This is just to block the control till the call back method is called. |
|
367 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
368 // is called in the HandleLocationConversion method. |
|
369 CActiveScheduler::Start(); |
|
370 |
|
371 error = iConversionHandler->iStatus.Int(); |
|
372 // If the conversion status is success, check for the corresponding |
|
373 // converted info. |
|
374 if( error == KErrNone ) |
|
375 { |
|
376 CheckGsmCellConvertedInfoL( locationInfo ); |
|
377 } |
|
378 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
379 else if( !( error == KErrNotSupported || error == KErrNotFound ) ) |
|
380 { |
|
381 User::Leave( KErrArgument ); |
|
382 } |
|
383 |
|
384 /** |
|
385 * case 2: Pass any information related to multiple area and we expect GSM cell info |
|
386 * corresponding to each area information. |
|
387 */ |
|
388 |
|
389 // Create one more location info object which holds coordinate info for which corresponding GSM |
|
390 // cell info is expected. |
|
391 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaPositionInfoClass ); |
|
392 |
|
393 // Before pushing location info object, remove the converted info from it. |
|
394 // We had requested for GSM cell info, hence we need to clear it before |
|
395 // we use it for next conversion. |
|
396 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsGsmInfo ); |
|
397 locationInfoArray.Append( locationInfo ); |
|
398 locationInfoArray.Append( locationInfo1 ); |
|
399 |
|
400 locInfoConverter.ConvertLocationInfoL( |
|
401 locationInfoArray,ELbsConversionCacheOnly,ELbsConversionOutputGsm, |
|
402 conversionModuleId,iConversionHandler->iStatus ); |
|
403 iConversionHandler->Start(); |
|
404 |
|
405 // This is just to block the control till the call back method is called. |
|
406 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
407 // is called in the HandleLocationConversion method. |
|
408 CActiveScheduler::Start(); |
|
409 |
|
410 error = iConversionHandler->iStatus.Int(); |
|
411 // Iterate through the array and check for converted info. |
|
412 if( error == KErrNone ) |
|
413 { |
|
414 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
415 { |
|
416 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
417 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
418 CheckGsmCellConvertedInfoL( locationInfo ); |
|
419 } |
|
420 } |
|
421 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
422 else if( !( error == KErrNotSupported || error == KErrNotFound ) ) |
|
423 { |
|
424 User::Leave( KErrArgument ); |
|
425 } |
|
426 CleanupStack::Pop( 3 ); // locationInfo,locationInfo1,locationInfoArray |
|
427 locationInfoArray.ResetAndDestroy(); |
|
428 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
429 return KErrNone; |
|
430 } |
|
431 |
|
432 |
|
433 // ----------------------------------------------------------------------------- |
|
434 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo4L |
|
435 //This test case tests ConvertLocationInfo when expected information is |
|
436 // of type EWcdma |
|
437 // ----------------------------------------------------------------------------- |
|
438 // |
|
439 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo4L(CStifItemParser& /*aItem*/ ) |
|
440 { |
|
441 RLbsLocMonitorSession locMonitorSession; |
|
442 TInt error = locMonitorSession.Connect(); |
|
443 if( error != KErrNone ) |
|
444 { |
|
445 return error; |
|
446 } |
|
447 CleanupClosePushL( locMonitorSession ); |
|
448 RLbsLocInfoConverter locInfoConverter; |
|
449 CleanupClosePushL( locInfoConverter ); |
|
450 locInfoConverter.OpenL( locMonitorSession ); |
|
451 |
|
452 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
453 CleanupClosePushL( locationInfoArray ); |
|
454 |
|
455 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
456 |
|
457 /** |
|
458 * case 1: Pass any area info pointer and we expect EWcdma type |
|
459 */ |
|
460 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaPositionInfoClass ); |
|
461 |
|
462 locInfoConverter.ConvertLocationInfoL( |
|
463 *locationInfo,ELbsConversionSilent,ELbsConversionOutputWcdma, |
|
464 conversionModuleId,iConversionHandler->iStatus ); |
|
465 iConversionHandler->Start(); |
|
466 |
|
467 // This is just to block the control till the call back method is called. |
|
468 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
469 // is called in the HandleLocationConversion method. |
|
470 CActiveScheduler::Start(); |
|
471 |
|
472 error = iConversionHandler->iStatus.Int(); |
|
473 // If the conversion status is success, check for the corresponding |
|
474 // converted info. |
|
475 if( error == KErrNone ) |
|
476 { |
|
477 CheckWcdmaCellConvertedInfoL( locationInfo ); |
|
478 } |
|
479 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
480 else if( !( error == KErrNotSupported || error == KErrNotFound ) ) |
|
481 { |
|
482 User::Leave( KErrArgument ); |
|
483 } |
|
484 |
|
485 /** |
|
486 * case 2: Pass any information related to multiple area and we expect wcdma information |
|
487 * corresponding to each area information. |
|
488 */ |
|
489 |
|
490 // Create one more location info object which holds wlan info for which corresponding WCDMA |
|
491 // cell info is expected. |
|
492 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaWlanInfoClass ); |
|
493 |
|
494 // Before pushing location info object, remove the converted info from it. |
|
495 // We had requested for WCDMA info, hence we need to clear it before |
|
496 // we use it as input for next conversion. |
|
497 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsWcdmaInfo ); |
|
498 locationInfoArray.Append( locationInfo ); |
|
499 locationInfoArray.Append( locationInfo1 ); |
|
500 |
|
501 locInfoConverter.ConvertLocationInfoL( |
|
502 locationInfoArray,ELbsConversionSilent,ELbsConversionOutputWcdma, |
|
503 conversionModuleId,iConversionHandler->iStatus ); |
|
504 |
|
505 iConversionHandler->Start(); |
|
506 |
|
507 // This is just to block the control till the call back method is called. |
|
508 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
509 // is called in the HandleLocationConversion method. |
|
510 CActiveScheduler::Start(); |
|
511 |
|
512 error = iConversionHandler->iStatus.Int(); |
|
513 // Iterate through the array and check for converted info. |
|
514 if( error == KErrNone ) |
|
515 { |
|
516 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
517 { |
|
518 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
519 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
520 CheckWcdmaCellConvertedInfoL( locationInfo ); |
|
521 } |
|
522 } |
|
523 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
524 else if( !( error == KErrNotSupported || error == KErrNotFound ) ) |
|
525 { |
|
526 User::Leave( KErrArgument ); |
|
527 } |
|
528 |
|
529 CleanupStack::Pop( 3 ); // locationInfo,locationInfo1,locationInfoArray |
|
530 locationInfoArray.ResetAndDestroy(); |
|
531 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
532 return KErrNone; |
|
533 } |
|
534 |
|
535 |
|
536 // ----------------------------------------------------------------------------- |
|
537 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo5L |
|
538 // This test case tests ConvertLocationInfo when expected information is |
|
539 // of type EWlan |
|
540 // ----------------------------------------------------------------------------- |
|
541 // |
|
542 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo5L(CStifItemParser& /*aItem*/ ) |
|
543 { |
|
544 RLbsLocMonitorSession locMonitorSession; |
|
545 TInt error = locMonitorSession.Connect(); |
|
546 if( error != KErrNone ) |
|
547 { |
|
548 return error; |
|
549 } |
|
550 CleanupClosePushL( locMonitorSession ); |
|
551 RLbsLocInfoConverter locInfoConverter; |
|
552 CleanupClosePushL( locInfoConverter ); |
|
553 locInfoConverter.OpenL( locMonitorSession ); |
|
554 |
|
555 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
556 CleanupClosePushL( locationInfoArray ); |
|
557 |
|
558 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
559 |
|
560 /** |
|
561 * case 1: Pass any area info pointer and we expect EWlan type |
|
562 */ |
|
563 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaWcmdaCellInfoClass ); |
|
564 |
|
565 locInfoConverter.ConvertLocationInfoL( |
|
566 *locationInfo,ELbsConversionCacheOnly,ELbsConversionOutputWlan,conversionModuleId,iConversionHandler->iStatus ); |
|
567 iConversionHandler->Start(); |
|
568 |
|
569 // This is just to block the control till the call back method is called. |
|
570 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
571 // is called in the HandleLocationConversion method. |
|
572 CActiveScheduler::Start(); |
|
573 |
|
574 // If the conversion status is success, check for the corresponding |
|
575 // converted info. |
|
576 if( iConversionHandler->iStatus == KErrNone ) |
|
577 { |
|
578 CheckWlanConvertedInfoL( locationInfo ); |
|
579 } |
|
580 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
581 else if( !( iConversionHandler->iStatus == KErrNotSupported || iConversionHandler->iStatus == KErrNotFound ) ) |
|
582 { |
|
583 User::Leave( KErrArgument ); |
|
584 } |
|
585 |
|
586 /** |
|
587 * Case 2: Pass any information related to multiple area and we expect Wlan info |
|
588 * corresponding to each area information. |
|
589 */ |
|
590 |
|
591 // Create one more location info object which holds coordinate info for which corresponding |
|
592 // Wlan info is expected. |
|
593 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaPositionInfoClass ); |
|
594 |
|
595 // Before pushing location info object, remove the converted info from it. |
|
596 // We had requested for wlan info, hence we need to clear it before |
|
597 // we use it for next conversion. |
|
598 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsWlanInfo ); |
|
599 locationInfoArray.Append( locationInfo ); |
|
600 locationInfoArray.Append( locationInfo1 ); |
|
601 |
|
602 TRequestStatus status; |
|
603 locInfoConverter.ConvertLocationInfoL( |
|
604 locationInfoArray,ELbsConversionCacheOnly,ELbsConversionOutputWlan,conversionModuleId,iConversionHandler->iStatus); |
|
605 iConversionHandler->Start(); |
|
606 |
|
607 // This is just to block the control till the call back method is called. |
|
608 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
609 // is called in the HandleLocationConversion method. |
|
610 CActiveScheduler::Start(); |
|
611 |
|
612 // Iterate through the array and check for converted info. |
|
613 if( iConversionHandler->iStatus == KErrNone ) |
|
614 { |
|
615 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
616 { |
|
617 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
618 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
619 CheckWlanConvertedInfoL( locationInfo ); |
|
620 } |
|
621 } |
|
622 // KErrNotSupported and KErrNotFound are allowed error codes. |
|
623 else if( !( iConversionHandler->iStatus == KErrNotSupported || iConversionHandler->iStatus == KErrNotFound ) ) |
|
624 { |
|
625 User::Leave( KErrArgument ); |
|
626 } |
|
627 CleanupStack::Pop( 3 ); // locationInfo,locationInfo1,locationInfoArray |
|
628 locationInfoArray.ResetAndDestroy(); |
|
629 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
630 return KErrNone; |
|
631 } |
|
632 |
|
633 // ----------------------------------------------------------------------------- |
|
634 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo6L |
|
635 // This test case tests the scenario when user tries to request new single |
|
636 // conversion without waiting for completion of previous one. |
|
637 // ----------------------------------------------------------------------------- |
|
638 // |
|
639 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo6L(CStifItemParser& /*aItem*/ ) |
|
640 { |
|
641 RLbsLocMonitorSession locMonitorSession; |
|
642 TInt error = locMonitorSession.Connect(); |
|
643 if( error != KErrNone ) |
|
644 { |
|
645 return error; |
|
646 } |
|
647 CleanupClosePushL( locMonitorSession ); |
|
648 RLbsLocInfoConverter locInfoConverter; |
|
649 CleanupClosePushL( locInfoConverter ); |
|
650 locInfoConverter.OpenL( locMonitorSession ); |
|
651 |
|
652 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
653 |
|
654 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
655 |
|
656 // Here in this case input area doesnt matter |
|
657 locInfoConverter.ConvertLocationInfoL( |
|
658 *locationInfo,ELbsConversionNotDefined, |
|
659 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
660 iConversionHandler->Start(); |
|
661 |
|
662 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaWcmdaCellInfoClass ); |
|
663 |
|
664 error = KErrNone; |
|
665 TRequestStatus status; |
|
666 TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 0); |
|
667 locInfoConverter.ConvertLocationInfoL( |
|
668 *locationInfo1,ELbsConversionNotDefined, |
|
669 ELbsConversionOutputPosition,conversionModuleId,status ); |
|
670 |
|
671 CleanupStack::PopAndDestroy( 2 ); // locationInfo1,locationInfo |
|
672 return KErrNone; |
|
673 } |
|
674 |
|
675 // ----------------------------------------------------------------------------- |
|
676 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo7L |
|
677 // This test case tests the scenario when user tries to request new batch |
|
678 // conversion without waiting for completion of previous one. |
|
679 // ----------------------------------------------------------------------------- |
|
680 // |
|
681 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo7L(CStifItemParser& /*aItem*/ ) |
|
682 { |
|
683 RLbsLocMonitorSession locMonitorSession; |
|
684 TInt error = locMonitorSession.Connect(); |
|
685 if( error != KErrNone ) |
|
686 { |
|
687 return error; |
|
688 } |
|
689 CleanupClosePushL( locMonitorSession ); |
|
690 RLbsLocInfoConverter locInfoConverter; |
|
691 CleanupClosePushL( locInfoConverter ); |
|
692 locInfoConverter.OpenL( locMonitorSession ); |
|
693 |
|
694 TUid conversionModuleId = TUid::Uid( KNullUidValue );; |
|
695 |
|
696 // Here in this case input area doesnt matter |
|
697 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
698 CleanupClosePushL( locationInfoArray ); |
|
699 |
|
700 RPointerArray<CLbsLocationInfoBase> locationInfoArray1; |
|
701 CleanupClosePushL( locationInfoArray1 ); |
|
702 |
|
703 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
704 |
|
705 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaWlanInfoClass ); |
|
706 |
|
707 locationInfoArray.Append( locationInfo ); |
|
708 |
|
709 locInfoConverter.ConvertLocationInfoL( |
|
710 locationInfoArray,ELbsConversionNotDefined, |
|
711 ELbsConversionOutputPosition,conversionModuleId ,iConversionHandler->iStatus ); |
|
712 iConversionHandler->Start(); |
|
713 |
|
714 locationInfoArray1.Append( locationInfo1 ); |
|
715 |
|
716 TRequestStatus status; |
|
717 TestModuleIf().SetExitReason( CTestModuleIf::EPanic, 0); |
|
718 locInfoConverter.ConvertLocationInfoL( |
|
719 locationInfoArray1,ELbsConversionNotDefined, |
|
720 ELbsConversionOutputPosition,conversionModuleId,status ); |
|
721 |
|
722 CleanupStack::Pop(4); // locationInfo1,locationInfoArray1,locationInfo,locationInfoArray |
|
723 locationInfoArray.ResetAndDestroy(); |
|
724 locationInfoArray1.ResetAndDestroy(); |
|
725 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
726 return KErrNone; |
|
727 } |
|
728 |
|
729 |
|
730 // ----------------------------------------------------------------------------- |
|
731 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo8L |
|
732 // This test case tests the scenario when user tries to request two conversion |
|
733 // using two subsessions simultaneously specifying same plugin. |
|
734 // ----------------------------------------------------------------------------- |
|
735 // |
|
736 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo8L(CStifItemParser& /*aItem*/ ) |
|
737 { |
|
738 RLbsLocMonitorSession locMonitorSession; |
|
739 TInt error = locMonitorSession.Connect(); |
|
740 if( error != KErrNone ) |
|
741 { |
|
742 return error; |
|
743 } |
|
744 CleanupClosePushL( locMonitorSession ); |
|
745 |
|
746 // Here we need to open two subsessions. |
|
747 RLbsLocInfoConverter locInfoConverter,locInfoConverter1; |
|
748 CleanupClosePushL( locInfoConverter ); |
|
749 locInfoConverter.OpenL( locMonitorSession ); |
|
750 |
|
751 CleanupClosePushL( locInfoConverter1 ); |
|
752 locInfoConverter1.OpenL( locMonitorSession ); |
|
753 |
|
754 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
755 CleanupClosePushL( locationInfoArray ); |
|
756 |
|
757 RPointerArray<CLbsLocationInfoBase> locationInfoArray1; |
|
758 CleanupClosePushL( locationInfoArray1 ); |
|
759 |
|
760 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
761 |
|
762 /** |
|
763 * Case 1: Users tries to request 2 simultaneous single conversion |
|
764 * using 2 subsession specifying same conversion uid. |
|
765 */ |
|
766 |
|
767 // Here type of area input doesnt matter. |
|
768 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
769 |
|
770 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
771 |
|
772 locInfoConverter.ConvertLocationInfoL( |
|
773 *locationInfo,ELbsConversionNotDefined, |
|
774 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
775 iConversionHandler->Start(); |
|
776 |
|
777 locInfoConverter1.ConvertLocationInfoL( |
|
778 *locationInfo1,ELbsConversionNotDefined, |
|
779 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler1->iStatus ); |
|
780 iConversionHandler1->Start(); |
|
781 |
|
782 // This is just to block the control till the call back method is called. |
|
783 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
784 // is called in the HandleLocationConversion method. |
|
785 CActiveScheduler::Start(); |
|
786 |
|
787 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
788 // till the 2nd request completes. |
|
789 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
790 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
791 { |
|
792 CActiveScheduler::Start(); |
|
793 } |
|
794 |
|
795 // Check the converted values in both the conversions. |
|
796 error = iConversionHandler->iStatus.Int(); |
|
797 if( error == KErrNone ) |
|
798 { |
|
799 CheckPositionConvertedInfoL( locationInfo ); |
|
800 } |
|
801 else |
|
802 { |
|
803 User::Leave( KErrArgument ); |
|
804 } |
|
805 |
|
806 error = iConversionHandler1->iStatus.Int(); |
|
807 if( error == KErrNone ) |
|
808 { |
|
809 CheckPositionConvertedInfoL( locationInfo1 ); |
|
810 } |
|
811 else |
|
812 { |
|
813 User::Leave( KErrArgument ); |
|
814 } |
|
815 |
|
816 /** |
|
817 * Case 2: Users tries to request 2 simultaneous bulk conversion |
|
818 * using 2 subsession specifying same conversion uid. |
|
819 */ |
|
820 |
|
821 // Before we append the location info object to the info array, |
|
822 // we need to clear the converted info in each object. |
|
823 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo); |
|
824 locationInfo1->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
825 |
|
826 locationInfoArray.Append( locationInfo ); |
|
827 locationInfoArray1.Append( locationInfo1 ); |
|
828 |
|
829 locInfoConverter.ConvertLocationInfoL( |
|
830 locationInfoArray,ELbsConversionNotDefined, |
|
831 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
832 iConversionHandler->Start(); |
|
833 |
|
834 locInfoConverter1.ConvertLocationInfoL( |
|
835 locationInfoArray1,ELbsConversionNotDefined, |
|
836 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler1->iStatus ); |
|
837 iConversionHandler1->Start(); |
|
838 |
|
839 // This is just to block the control till the call back method is called. |
|
840 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
841 // is called in the HandleLocationConversion method. |
|
842 CActiveScheduler::Start(); |
|
843 |
|
844 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
845 // till the 2nd request completes. |
|
846 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
847 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
848 { |
|
849 CActiveScheduler::Start(); |
|
850 } |
|
851 |
|
852 // Check the converted values in both the conversions. |
|
853 // Iterate through the array and check for converted info. |
|
854 error = iConversionHandler->iStatus.Int(); |
|
855 if( error == KErrNone ) |
|
856 { |
|
857 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
858 { |
|
859 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
860 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
861 CheckPositionConvertedInfoL( locationInfo ); |
|
862 } |
|
863 } |
|
864 else |
|
865 { |
|
866 User::Leave( KErrArgument ); |
|
867 } |
|
868 |
|
869 error = iConversionHandler1->iStatus.Int(); |
|
870 if( error == KErrNone ) |
|
871 { |
|
872 for( TInt i=0;i<locationInfoArray1.Count();i++ ) |
|
873 { |
|
874 CLbsLocationInfoBase* locationInfobase = locationInfoArray1[i]; |
|
875 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
876 CheckPositionConvertedInfoL( locationInfo ); |
|
877 } |
|
878 } |
|
879 else |
|
880 { |
|
881 User::Leave( KErrArgument ); |
|
882 } |
|
883 |
|
884 CleanupStack::Pop(4); // locationInfo1,locationInfoArray1,locationInfo,locationInfoArray |
|
885 locationInfoArray.ResetAndDestroy(); |
|
886 locationInfoArray1.ResetAndDestroy(); |
|
887 CleanupStack::PopAndDestroy( 3 ); // locInfoConverter,locInfoConverter1,locMonitorSession |
|
888 return KErrNone; |
|
889 } |
|
890 |
|
891 |
|
892 // ----------------------------------------------------------------------------- |
|
893 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo9L |
|
894 // This test case tests the scenario when user tries to request two conversion |
|
895 // using two subsessions simultaneously specifying different plugin. |
|
896 // ----------------------------------------------------------------------------- |
|
897 // |
|
898 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo9L(CStifItemParser& /*aItem*/ ) |
|
899 { |
|
900 RLbsLocMonitorSession locMonitorSession; |
|
901 TInt error = locMonitorSession.Connect(); |
|
902 if( error != KErrNone ) |
|
903 { |
|
904 return error; |
|
905 } |
|
906 CleanupClosePushL( locMonitorSession ); |
|
907 |
|
908 // Here we need two subsessions |
|
909 RLbsLocInfoConverter locInfoConverter,locInfoConverter1; |
|
910 CleanupClosePushL( locInfoConverter ); |
|
911 locInfoConverter.OpenL( locMonitorSession ); |
|
912 |
|
913 CleanupClosePushL( locInfoConverter1 ); |
|
914 locInfoConverter1.OpenL( locMonitorSession ); |
|
915 |
|
916 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
917 CleanupClosePushL( locationInfoArray ); |
|
918 |
|
919 RPointerArray<CLbsLocationInfoBase> locationInfoArray1; |
|
920 CleanupClosePushL( locationInfoArray1 ); |
|
921 |
|
922 TUid conversionModuleId1 = TUid::Uid( KDummyPluginId ); |
|
923 TUid conversionModuleId2 = TUid::Uid( KSuplPluginId ); |
|
924 |
|
925 /** |
|
926 * Case 1: Users tries to request 2 simultaneous single conversion |
|
927 * using 2 subsession specifying different conversion uid. |
|
928 */ |
|
929 |
|
930 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaWcmdaCellInfoClass ); |
|
931 |
|
932 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaWlanInfoClass ); |
|
933 |
|
934 locInfoConverter.ConvertLocationInfoL( |
|
935 *locationInfo,ELbsConversionNotDefined, |
|
936 ELbsConversionOutputPosition,conversionModuleId1,iConversionHandler->iStatus ); |
|
937 iConversionHandler->Start(); |
|
938 |
|
939 locInfoConverter1.ConvertLocationInfoL( |
|
940 *locationInfo1,ELbsConversionNotDefined, |
|
941 ELbsConversionOutputPosition,conversionModuleId2,iConversionHandler1->iStatus ); |
|
942 iConversionHandler1->Start(); |
|
943 |
|
944 // This is just to block the control till the call back method is called. |
|
945 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
946 // is called in the HandleLocationConversion method. |
|
947 CActiveScheduler::Start(); |
|
948 |
|
949 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
950 // till the 2nd request completes. |
|
951 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
952 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
953 { |
|
954 CActiveScheduler::Start(); |
|
955 } |
|
956 |
|
957 // Check the converted values in both the conversions. |
|
958 error = iConversionHandler->iStatus.Int(); |
|
959 if( error == KErrNone ) |
|
960 { |
|
961 CheckPositionConvertedInfoL( locationInfo ); |
|
962 } |
|
963 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
964 { |
|
965 User::Leave( KErrArgument ); |
|
966 } |
|
967 |
|
968 error = iConversionHandler1->iStatus.Int(); |
|
969 if( error == KErrNone ) |
|
970 { |
|
971 CheckPositionConvertedInfoL( locationInfo1 ); |
|
972 } |
|
973 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
974 { |
|
975 User::Leave( KErrArgument ); |
|
976 } |
|
977 |
|
978 /** |
|
979 * Case 2: Users tries to request 2 simultaneous bulk conversion |
|
980 * using 2 subsession specifying same conversion uid. |
|
981 */ |
|
982 |
|
983 // Before we append the location info object to the info array, |
|
984 // we need to clear the converted info in each object. |
|
985 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
986 locationInfo1->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
987 |
|
988 locationInfoArray.Append( locationInfo ); |
|
989 locationInfoArray1.Append( locationInfo1 ); |
|
990 |
|
991 locInfoConverter.ConvertLocationInfoL( |
|
992 locationInfoArray,ELbsConversionNotDefined, |
|
993 ELbsConversionOutputPosition,conversionModuleId1,iConversionHandler->iStatus ); |
|
994 iConversionHandler->Start(); |
|
995 |
|
996 locInfoConverter1.ConvertLocationInfoL( |
|
997 locationInfoArray1,ELbsConversionNotDefined, |
|
998 ELbsConversionOutputPosition,conversionModuleId2,iConversionHandler1->iStatus ); |
|
999 iConversionHandler1->Start(); |
|
1000 |
|
1001 // This is just to block the control till the call back method is called. |
|
1002 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1003 // is called in the HandleLocationConversion method. |
|
1004 CActiveScheduler::Start(); |
|
1005 |
|
1006 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
1007 // till the 2nd request completes. |
|
1008 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
1009 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
1010 { |
|
1011 CActiveScheduler::Start(); |
|
1012 } |
|
1013 |
|
1014 // Check the converted values in both the conversions. |
|
1015 // Iterate through the array and check for converted info. |
|
1016 error = iConversionHandler->iStatus.Int(); |
|
1017 if( error == KErrNone ) |
|
1018 { |
|
1019 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
1020 { |
|
1021 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
1022 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1023 CheckPositionConvertedInfoL( locationInfo ); |
|
1024 } |
|
1025 } |
|
1026 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
1027 { |
|
1028 User::Leave( KErrArgument ); |
|
1029 } |
|
1030 |
|
1031 error = iConversionHandler1->iStatus.Int(); |
|
1032 if( error == KErrNone ) |
|
1033 { |
|
1034 for( TInt i=0;i<locationInfoArray1.Count();i++ ) |
|
1035 { |
|
1036 CLbsLocationInfoBase* locationInfobase = locationInfoArray1[i]; |
|
1037 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1038 CheckPositionConvertedInfoL( locationInfo ); |
|
1039 } |
|
1040 } |
|
1041 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
1042 { |
|
1043 User::Leave( KErrArgument ); |
|
1044 } |
|
1045 |
|
1046 |
|
1047 CleanupStack::Pop(4); // locationInfo1,locationInfoArray1,locationInfo,locationInfoArray |
|
1048 locationInfoArray.ResetAndDestroy(); |
|
1049 locationInfoArray1.ResetAndDestroy(); |
|
1050 CleanupStack::PopAndDestroy( 3 ); // locInfoConverter,locInfoConverter1,locMonitorSession |
|
1051 return KErrNone; |
|
1052 } |
|
1053 |
|
1054 // ----------------------------------------------------------------------------- |
|
1055 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo10L |
|
1056 // This test case tests following unsuccessful conversion scenarios: |
|
1057 // 1. Conversion preference not supported by plugin. |
|
1058 // 2. Conversion request by specifying input area type same as requested type. |
|
1059 // ----------------------------------------------------------------------------- |
|
1060 // |
|
1061 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_ConvertLocationInfo10L(CStifItemParser& /*aItem*/ ) |
|
1062 { |
|
1063 RLbsLocMonitorSession locMonitorSession; |
|
1064 TInt error = locMonitorSession.Connect(); |
|
1065 if( error != KErrNone ) |
|
1066 { |
|
1067 return error; |
|
1068 } |
|
1069 CleanupClosePushL( locMonitorSession ); |
|
1070 |
|
1071 // Here we need two subsessions |
|
1072 RLbsLocInfoConverter locInfoConverter; |
|
1073 CleanupClosePushL( locInfoConverter ); |
|
1074 locInfoConverter.OpenL( locMonitorSession ); |
|
1075 |
|
1076 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
1077 /** |
|
1078 * Case 1: Users tries to request conversion by specifying conversion |
|
1079 * preference not supported by plugin. Example plugin doesnt |
|
1080 * support conversion using cache. |
|
1081 */ |
|
1082 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaWcmdaCellInfoClass ); |
|
1083 |
|
1084 locInfoConverter.ConvertLocationInfoL( |
|
1085 *locationInfo,ELbsConversionCacheOnly, |
|
1086 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
1087 iConversionHandler->Start(); |
|
1088 |
|
1089 // This is just to block the control till the call back method is called. |
|
1090 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1091 // is called in the HandleLocationConversion method. |
|
1092 CActiveScheduler::Start(); |
|
1093 |
|
1094 // Check the converted values in both the conversions. |
|
1095 error = iConversionHandler->iStatus.Int(); |
|
1096 if( error != KErrNotSupported ) |
|
1097 { |
|
1098 User::Leave( KErrArgument ); |
|
1099 } |
|
1100 |
|
1101 /** |
|
1102 * Case 2: Users tries to request for coordinate info by specifying |
|
1103 * only coordinate info. |
|
1104 */ |
|
1105 locationInfo->ResetAreaInfo(); |
|
1106 AppendAreaInfoObjectToLocationInfoL( locationInfo,ELbsAreaPositionInfoClass ); |
|
1107 locInfoConverter.ConvertLocationInfoL( |
|
1108 *locationInfo,ELbsConversionNotDefined, |
|
1109 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
1110 iConversionHandler->Start(); |
|
1111 // This is just to block the control till the call back method is called. |
|
1112 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1113 // is called in the HandleLocationConversion method. |
|
1114 CActiveScheduler::Start(); |
|
1115 |
|
1116 // Check the converted values in both the conversions. |
|
1117 error = iConversionHandler->iStatus.Int(); |
|
1118 if( error != KErrNotSupported ) |
|
1119 { |
|
1120 User::Leave( KErrArgument ); |
|
1121 } |
|
1122 |
|
1123 /** |
|
1124 * Case 3: Users tries to request for gsm cell info by specifying |
|
1125 * only gsm cell info. |
|
1126 */ |
|
1127 locationInfo->ResetAreaInfo(); |
|
1128 AppendAreaInfoObjectToLocationInfoL( locationInfo,ELbsAreaGsmCellInfoClass ); |
|
1129 locInfoConverter.ConvertLocationInfoL( |
|
1130 *locationInfo,ELbsConversionNotDefined, |
|
1131 ELbsConversionOutputGsm,conversionModuleId,iConversionHandler->iStatus ); |
|
1132 iConversionHandler->Start(); |
|
1133 // This is just to block the control till the call back method is called. |
|
1134 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1135 // is called in the HandleLocationConversion method. |
|
1136 CActiveScheduler::Start(); |
|
1137 |
|
1138 // Check the converted values in both the conversions. |
|
1139 error = iConversionHandler->iStatus.Int(); |
|
1140 if( error != KErrNotSupported ) |
|
1141 { |
|
1142 User::Leave( KErrArgument ); |
|
1143 } |
|
1144 |
|
1145 /** |
|
1146 * Case 4: Users tries to request for wcdma cell info by specifying |
|
1147 * only wcdma cell info. |
|
1148 */ |
|
1149 locationInfo->ResetAreaInfo(); |
|
1150 AppendAreaInfoObjectToLocationInfoL( locationInfo,ELbsAreaWcmdaCellInfoClass ); |
|
1151 locInfoConverter.ConvertLocationInfoL( |
|
1152 *locationInfo,ELbsConversionNotDefined, |
|
1153 ELbsConversionOutputWcdma,conversionModuleId,iConversionHandler->iStatus ); |
|
1154 iConversionHandler->Start(); |
|
1155 // This is just to block the control till the call back method is called. |
|
1156 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1157 // is called in the HandleLocationConversion method. |
|
1158 CActiveScheduler::Start(); |
|
1159 |
|
1160 // Check the converted values in both the conversions. |
|
1161 error = iConversionHandler->iStatus.Int(); |
|
1162 if( error != KErrNotSupported ) |
|
1163 { |
|
1164 User::Leave( KErrArgument ); |
|
1165 } |
|
1166 |
|
1167 /** |
|
1168 * Case 5: Users tries to request for wlan info by specifying |
|
1169 * only wlan info. |
|
1170 */ |
|
1171 locationInfo->ResetAreaInfo(); |
|
1172 AppendAreaInfoObjectToLocationInfoL( locationInfo,ELbsAreaWlanInfoClass ); |
|
1173 locInfoConverter.ConvertLocationInfoL( |
|
1174 *locationInfo,ELbsConversionNotDefined, |
|
1175 ELbsConversionOutputWlan,conversionModuleId,iConversionHandler->iStatus ); |
|
1176 iConversionHandler->Start(); |
|
1177 // This is just to block the control till the call back method is called. |
|
1178 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1179 // is called in the HandleLocationConversion method. |
|
1180 CActiveScheduler::Start(); |
|
1181 |
|
1182 // Check the converted values in both the conversions. |
|
1183 error = iConversionHandler->iStatus.Int(); |
|
1184 if( error != KErrNotSupported ) |
|
1185 { |
|
1186 User::Leave( KErrArgument ); |
|
1187 } |
|
1188 |
|
1189 CleanupStack::PopAndDestroy( 3 ); // locationInfo,locInfoConverter,locMonitorSession |
|
1190 return KErrNone; |
|
1191 } |
|
1192 |
|
1193 |
|
1194 |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel1L |
|
1197 // This test case tests the scenario when user tries to cancel the request before |
|
1198 // and after the conversion request complete for both single and batch conversion. |
|
1199 // ----------------------------------------------------------------------------- |
|
1200 // |
|
1201 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel1L(CStifItemParser& /*aItem*/ ) |
|
1202 { |
|
1203 |
|
1204 RLbsLocMonitorSession locMonitorSession; |
|
1205 TInt error = locMonitorSession.Connect(); |
|
1206 if( error != KErrNone ) |
|
1207 { |
|
1208 return error; |
|
1209 } |
|
1210 CleanupClosePushL( locMonitorSession ); |
|
1211 RLbsLocInfoConverter locInfoConverter; |
|
1212 CleanupClosePushL( locInfoConverter ); |
|
1213 locInfoConverter.OpenL( locMonitorSession ); |
|
1214 |
|
1215 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
1216 CleanupClosePushL( locationInfoArray ); |
|
1217 |
|
1218 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
1219 |
|
1220 // This can can be done for any area type here EGsm to ECoordinate conversion has |
|
1221 // been used. |
|
1222 |
|
1223 /** |
|
1224 * Case 1: Here single location information conversion is requested |
|
1225 * and cancel is called before the conversion completes. |
|
1226 */ |
|
1227 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
1228 |
|
1229 locInfoConverter.ConvertLocationInfoL( |
|
1230 *locationInfo,ELbsConversionNotDefined,ELbsConversionOutputPosition |
|
1231 ,conversionModuleId,iConversionHandler->iStatus ); |
|
1232 iConversionHandler->Start(); |
|
1233 locInfoConverter.CancelConvertLocationInfo(); |
|
1234 iConversionHandler->Cancel(); |
|
1235 |
|
1236 error = iConversionHandler->iStatus.Int(); |
|
1237 // Request should be completed with the error code KErrCancel and |
|
1238 // location info should not have converted information. |
|
1239 if( error == KErrCancel ) |
|
1240 { |
|
1241 CheckPositionConvertedInfoL( locationInfo,ENegative ); |
|
1242 } |
|
1243 else |
|
1244 { |
|
1245 User::Leave( KErrArgument ); |
|
1246 } |
|
1247 |
|
1248 /** |
|
1249 * case 2: Here single location information conversion is requested |
|
1250 * and cancel is called after the conversion completes. |
|
1251 */ |
|
1252 locInfoConverter.ConvertLocationInfoL( |
|
1253 *locationInfo,ELbsConversionNotDefined,ELbsConversionOutputPosition |
|
1254 ,conversionModuleId,iConversionHandler->iStatus ); |
|
1255 iConversionHandler->Start(); |
|
1256 CActiveScheduler::Start(); |
|
1257 locInfoConverter.CancelConvertLocationInfo(); |
|
1258 iConversionHandler->Cancel(); |
|
1259 |
|
1260 error = iConversionHandler->iStatus.Int(); |
|
1261 // Request should be completed with the error code KErrNone and |
|
1262 // location info should have converted information. |
|
1263 if( error == KErrNone ) |
|
1264 { |
|
1265 CheckPositionConvertedInfoL( locationInfo ); |
|
1266 } |
|
1267 else |
|
1268 { |
|
1269 User::Leave( KErrArgument ); |
|
1270 } |
|
1271 |
|
1272 // case 3: Here mutiple location information conversion is |
|
1273 // requested and cancel is called before the conversion completes. |
|
1274 |
|
1275 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
1276 |
|
1277 // We had requested for coordinate info, hence we need to clear it before |
|
1278 // we use it as input for next conversion. |
|
1279 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
1280 locationInfoArray.Append( locationInfo ); |
|
1281 |
|
1282 locationInfoArray.Append( locationInfo1 ); |
|
1283 |
|
1284 locInfoConverter.ConvertLocationInfoL( |
|
1285 locationInfoArray,ELbsConversionNotDefined, |
|
1286 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
1287 iConversionHandler->Start(); |
|
1288 locInfoConverter.CancelConvertLocationInfo(); |
|
1289 iConversionHandler->Cancel(); |
|
1290 |
|
1291 // Request should be completed with the error code KErrCancel and |
|
1292 // location info should not have converted information. |
|
1293 error = iConversionHandler->iStatus.Int(); |
|
1294 |
|
1295 if( error == KErrCancel ) |
|
1296 { |
|
1297 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
1298 { |
|
1299 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
1300 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1301 CheckPositionConvertedInfoL( locationInfo,ENegative ); |
|
1302 } |
|
1303 } |
|
1304 else |
|
1305 { |
|
1306 User::Leave( KErrArgument ); |
|
1307 } |
|
1308 |
|
1309 |
|
1310 /** |
|
1311 * case 4: Here mutiple location information conversion is |
|
1312 * requested and cancel is called after the conversion completes. |
|
1313 */ |
|
1314 |
|
1315 locInfoConverter.ConvertLocationInfoL( |
|
1316 locationInfoArray,ELbsConversionNotDefined, |
|
1317 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
1318 iConversionHandler->Start(); |
|
1319 CActiveScheduler::Start(); |
|
1320 locInfoConverter.CancelConvertLocationInfo(); |
|
1321 iConversionHandler->Cancel(); |
|
1322 |
|
1323 // Request should be completed with the error code KErrNone and |
|
1324 // location info should have converted information. |
|
1325 error = iConversionHandler->iStatus.Int(); |
|
1326 |
|
1327 if( error == KErrNone ) |
|
1328 { |
|
1329 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
1330 { |
|
1331 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
1332 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1333 CheckPositionConvertedInfoL( locationInfo ); |
|
1334 } |
|
1335 } |
|
1336 else |
|
1337 { |
|
1338 User::Leave( KErrArgument ); |
|
1339 } |
|
1340 |
|
1341 CleanupStack::Pop( 3 ); // locationInfo,locationInfo1,locationInfoArray |
|
1342 locationInfoArray.ResetAndDestroy(); |
|
1343 CleanupStack::PopAndDestroy( 2 ); // locInfoConverter,locMonitorSession |
|
1344 return KErrNone; |
|
1345 } |
|
1346 |
|
1347 |
|
1348 |
|
1349 // ----------------------------------------------------------------------------- |
|
1350 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel2L |
|
1351 // This test case tests the scenario when user tries to cancel the conversion request |
|
1352 // from the different subsession for both single and multiple conversion. |
|
1353 // ----------------------------------------------------------------------------- |
|
1354 // |
|
1355 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel2L(CStifItemParser& /*aItem*/ ) |
|
1356 { |
|
1357 |
|
1358 RLbsLocMonitorSession locMonitorSession; |
|
1359 TInt error = locMonitorSession.Connect(); |
|
1360 if( error != KErrNone ) |
|
1361 { |
|
1362 return error; |
|
1363 } |
|
1364 CleanupClosePushL( locMonitorSession ); |
|
1365 |
|
1366 // Here we need to subsessions. |
|
1367 RLbsLocInfoConverter locInfoConverter,locInfoConverter1; |
|
1368 CleanupClosePushL( locInfoConverter ); |
|
1369 locInfoConverter.OpenL( locMonitorSession ); |
|
1370 |
|
1371 CleanupClosePushL( locInfoConverter1 ); |
|
1372 locInfoConverter1.OpenL( locMonitorSession ); |
|
1373 |
|
1374 |
|
1375 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
1376 CleanupClosePushL( locationInfoArray ); |
|
1377 |
|
1378 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
1379 |
|
1380 // This can can be done for any area type here EGsm to ECoordinate conversion has |
|
1381 // been used. |
|
1382 |
|
1383 /** |
|
1384 * Case 1: Here single location information conversion is |
|
1385 * requested and cancel is called the different subsession. |
|
1386 */ |
|
1387 |
|
1388 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
1389 |
|
1390 locInfoConverter.ConvertLocationInfoL( |
|
1391 *locationInfo,ELbsConversionNotDefined,ELbsConversionOutputPosition |
|
1392 ,conversionModuleId,iConversionHandler->iStatus ); |
|
1393 iConversionHandler->Start(); |
|
1394 locInfoConverter1.CancelConvertLocationInfo(); |
|
1395 CActiveScheduler::Start(); |
|
1396 |
|
1397 error = iConversionHandler->iStatus.Int(); |
|
1398 // Request should be completed with the error code KErrNone and |
|
1399 // location info should have converted information. |
|
1400 if( error == KErrNone ) |
|
1401 { |
|
1402 CheckPositionConvertedInfoL( locationInfo ); |
|
1403 } |
|
1404 else |
|
1405 { |
|
1406 User::Leave( KErrArgument ); |
|
1407 } |
|
1408 |
|
1409 /** |
|
1410 * Case 2: Here mutiple location information conversion is requested |
|
1411 * and cancel is called from the different subsession. |
|
1412 */ |
|
1413 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
1414 |
|
1415 // We had requested for coordinate info, hence we need to clear it before |
|
1416 // we use it as input for next conversion. |
|
1417 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
1418 locationInfoArray.Append( locationInfo ); |
|
1419 |
|
1420 locationInfoArray.Append( locationInfo1 ); |
|
1421 |
|
1422 locInfoConverter.ConvertLocationInfoL( |
|
1423 locationInfoArray,ELbsConversionNotDefined, |
|
1424 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
1425 iConversionHandler->Start(); |
|
1426 locInfoConverter1.CancelConvertLocationInfo(); |
|
1427 CActiveScheduler::Start(); |
|
1428 |
|
1429 // Request should be completed with the error code KErrNone and |
|
1430 // location info should have converted information. |
|
1431 error = iConversionHandler->iStatus.Int(); |
|
1432 |
|
1433 if( error == KErrNone ) |
|
1434 { |
|
1435 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
1436 { |
|
1437 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
1438 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1439 CheckPositionConvertedInfoL( locationInfo ); |
|
1440 } |
|
1441 } |
|
1442 else |
|
1443 { |
|
1444 User::Leave( KErrArgument ); |
|
1445 } |
|
1446 CleanupStack::Pop( 3 ); // locationInfo,locationInfo1,locationInfoArray |
|
1447 locationInfoArray.ResetAndDestroy(); |
|
1448 CleanupStack::PopAndDestroy( 3 ); // locInfoConverter,locInfoConverter1,locMonitorSession |
|
1449 return KErrNone; |
|
1450 } |
|
1451 |
|
1452 // ----------------------------------------------------------------------------- |
|
1453 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel3L |
|
1454 // This test case tests the scenario when user tries to request two conversion |
|
1455 // using two subsessions simultaneously specifying same plugin and we cancel one request |
|
1456 // of two requests. |
|
1457 // ----------------------------------------------------------------------------- |
|
1458 // |
|
1459 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel3L(CStifItemParser& /*aItem*/ ) |
|
1460 { |
|
1461 RLbsLocMonitorSession locMonitorSession; |
|
1462 TInt error = locMonitorSession.Connect(); |
|
1463 if( error != KErrNone ) |
|
1464 { |
|
1465 return error; |
|
1466 } |
|
1467 CleanupClosePushL( locMonitorSession ); |
|
1468 |
|
1469 // Here we need to open two subsessions. |
|
1470 RLbsLocInfoConverter locInfoConverter,locInfoConverter1; |
|
1471 CleanupClosePushL( locInfoConverter ); |
|
1472 locInfoConverter.OpenL( locMonitorSession ); |
|
1473 |
|
1474 CleanupClosePushL( locInfoConverter1 ); |
|
1475 locInfoConverter1.OpenL( locMonitorSession ); |
|
1476 |
|
1477 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
1478 CleanupClosePushL( locationInfoArray ); |
|
1479 |
|
1480 RPointerArray<CLbsLocationInfoBase> locationInfoArray1; |
|
1481 CleanupClosePushL( locationInfoArray1 ); |
|
1482 |
|
1483 TUid conversionModuleId = TUid::Uid( KDummyPluginId ); |
|
1484 |
|
1485 /** |
|
1486 * Case 1: Users tries to request 2 simultaneous single conversion |
|
1487 * using 2 subsession specifying same conversion uid and |
|
1488 * anyone conversion request is cancelled. |
|
1489 */ |
|
1490 |
|
1491 // Here type of area input doesnt matter. |
|
1492 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
1493 |
|
1494 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaGsmCellInfoClass ); |
|
1495 |
|
1496 locInfoConverter.ConvertLocationInfoL( |
|
1497 *locationInfo,ELbsConversionNotDefined, |
|
1498 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
1499 iConversionHandler->Start(); |
|
1500 |
|
1501 locInfoConverter1.ConvertLocationInfoL( |
|
1502 *locationInfo1,ELbsConversionNotDefined, |
|
1503 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler1->iStatus ); |
|
1504 iConversionHandler1->Start(); |
|
1505 |
|
1506 // Here first request is called. |
|
1507 locInfoConverter.CancelConvertLocationInfo(); |
|
1508 |
|
1509 // This is just to block the control till the call back method is called. |
|
1510 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1511 // is called in the HandleLocationConversion method. |
|
1512 CActiveScheduler::Start(); |
|
1513 |
|
1514 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
1515 // till the 2nd request completes. |
|
1516 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
1517 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
1518 { |
|
1519 CActiveScheduler::Start(); |
|
1520 } |
|
1521 |
|
1522 // Check the converted values in both the conversions. |
|
1523 error = iConversionHandler->iStatus.Int(); |
|
1524 if( error == KErrCancel ) |
|
1525 { |
|
1526 CheckPositionConvertedInfoL( locationInfo,ENegative ); |
|
1527 } |
|
1528 else |
|
1529 { |
|
1530 User::Leave( KErrArgument ); |
|
1531 } |
|
1532 |
|
1533 error = iConversionHandler1->iStatus.Int(); |
|
1534 if( error == KErrNone ) |
|
1535 { |
|
1536 CheckPositionConvertedInfoL( locationInfo1 ); |
|
1537 } |
|
1538 else |
|
1539 { |
|
1540 User::Leave( KErrArgument ); |
|
1541 } |
|
1542 |
|
1543 /** |
|
1544 * Case 2: Users tries to request 2 simultaneous bulk conversion |
|
1545 * using 2 subsession specifying same conversion uid and |
|
1546 * any one conversion request is cancelled. |
|
1547 */ |
|
1548 |
|
1549 // Before we append the location info object to the info array, |
|
1550 // we need to clear the converted info in each object. |
|
1551 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
1552 locationInfo1->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
1553 |
|
1554 locationInfoArray.Append( locationInfo ); |
|
1555 locationInfoArray1.Append( locationInfo1 ); |
|
1556 |
|
1557 locInfoConverter.ConvertLocationInfoL( |
|
1558 locationInfoArray,ELbsConversionNotDefined, |
|
1559 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler->iStatus ); |
|
1560 iConversionHandler->Start(); |
|
1561 |
|
1562 locInfoConverter1.ConvertLocationInfoL( |
|
1563 locationInfoArray1,ELbsConversionNotDefined, |
|
1564 ELbsConversionOutputPosition,conversionModuleId,iConversionHandler1->iStatus ); |
|
1565 iConversionHandler1->Start(); |
|
1566 |
|
1567 // Here second request is called. |
|
1568 locInfoConverter1.CancelConvertLocationInfo(); |
|
1569 |
|
1570 // This is just to block the control till the call back method is called. |
|
1571 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1572 // is called in the HandleLocationConversion method. |
|
1573 CActiveScheduler::Start(); |
|
1574 |
|
1575 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
1576 // till the 2nd request completes. |
|
1577 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
1578 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
1579 { |
|
1580 CActiveScheduler::Start(); |
|
1581 } |
|
1582 |
|
1583 // Check the converted values in both the conversions. |
|
1584 // Iterate through the array and check for converted info. |
|
1585 error = iConversionHandler->iStatus.Int(); |
|
1586 if( error == KErrNone ) |
|
1587 { |
|
1588 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
1589 { |
|
1590 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
1591 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1592 CheckPositionConvertedInfoL( locationInfo ); |
|
1593 } |
|
1594 } |
|
1595 else |
|
1596 { |
|
1597 User::Leave( KErrArgument ); |
|
1598 } |
|
1599 |
|
1600 error = iConversionHandler1->iStatus.Int(); |
|
1601 if( error == KErrCancel ) |
|
1602 { |
|
1603 for( TInt i=0;i<locationInfoArray1.Count();i++ ) |
|
1604 { |
|
1605 CLbsLocationInfoBase* locationInfobase = locationInfoArray1[i]; |
|
1606 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1607 CheckPositionConvertedInfoL( locationInfo,ENegative ); |
|
1608 } |
|
1609 } |
|
1610 else |
|
1611 { |
|
1612 User::Leave( KErrArgument ); |
|
1613 } |
|
1614 |
|
1615 CleanupStack::Pop(4); // locationInfo1,locationInfoArray1,locationInfo,locationInfoArray |
|
1616 locationInfoArray.ResetAndDestroy(); |
|
1617 locationInfoArray1.ResetAndDestroy(); |
|
1618 CleanupStack::PopAndDestroy( 3 ); // locInfoConverter,locInfoConverter1,locMonitorSession |
|
1619 return KErrNone; |
|
1620 } |
|
1621 |
|
1622 // ----------------------------------------------------------------------------- |
|
1623 // CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel4L |
|
1624 // This test case tests the scenario when user tries to request two conversion |
|
1625 // using two subsessions simultaneously specifying different plugin. |
|
1626 // ----------------------------------------------------------------------------- |
|
1627 // |
|
1628 TInt CLocInfoConversionUnitTest::RLbsLocInfoConverter_Cancel4L(CStifItemParser& /*aItem*/ ) |
|
1629 { |
|
1630 RLbsLocMonitorSession locMonitorSession; |
|
1631 TInt error = locMonitorSession.Connect(); |
|
1632 if( error != KErrNone ) |
|
1633 { |
|
1634 return error; |
|
1635 } |
|
1636 CleanupClosePushL( locMonitorSession ); |
|
1637 |
|
1638 // Here we need two subsessions |
|
1639 RLbsLocInfoConverter locInfoConverter,locInfoConverter1; |
|
1640 CleanupClosePushL( locInfoConverter ); |
|
1641 locInfoConverter.OpenL( locMonitorSession ); |
|
1642 |
|
1643 CleanupClosePushL( locInfoConverter1 ); |
|
1644 locInfoConverter1.OpenL( locMonitorSession ); |
|
1645 |
|
1646 RPointerArray<CLbsLocationInfoBase> locationInfoArray; |
|
1647 CleanupClosePushL( locationInfoArray ); |
|
1648 |
|
1649 RPointerArray<CLbsLocationInfoBase> locationInfoArray1; |
|
1650 CleanupClosePushL( locationInfoArray1 ); |
|
1651 |
|
1652 TUid conversionModuleId1 = TUid::Uid( KDummyPluginId ); |
|
1653 TUid conversionModuleId2 = TUid::Uid( KSuplPluginId ); |
|
1654 |
|
1655 /** |
|
1656 * Case 1: Users tries to request 2 simultaneous single conversion |
|
1657 * using 2 subsession specifying different conversion uid |
|
1658 * any one request is cancelled. |
|
1659 */ |
|
1660 |
|
1661 CLbsLocationInfo* locationInfo = CreateLocationInfoObjectLC( ELbsAreaWcmdaCellInfoClass ); |
|
1662 |
|
1663 CLbsLocationInfo* locationInfo1 = CreateLocationInfoObjectLC( ELbsAreaWlanInfoClass ); |
|
1664 |
|
1665 locInfoConverter.ConvertLocationInfoL( |
|
1666 *locationInfo,ELbsConversionNotDefined, |
|
1667 ELbsConversionOutputPosition,conversionModuleId1,iConversionHandler->iStatus ); |
|
1668 iConversionHandler->Start(); |
|
1669 |
|
1670 |
|
1671 locInfoConverter1.ConvertLocationInfoL( |
|
1672 *locationInfo1,ELbsConversionNotDefined, |
|
1673 ELbsConversionOutputPosition,conversionModuleId2,iConversionHandler1->iStatus ); |
|
1674 iConversionHandler1->Start(); |
|
1675 |
|
1676 // Here first request is cancelled. |
|
1677 locInfoConverter.CancelConvertLocationInfo(); |
|
1678 |
|
1679 // This is just to block the control till the call back method is called. |
|
1680 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1681 // is called in the HandleLocationConversion method. |
|
1682 CActiveScheduler::Start(); |
|
1683 |
|
1684 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
1685 // till the 2nd request completes. |
|
1686 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
1687 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
1688 { |
|
1689 CActiveScheduler::Start(); |
|
1690 } |
|
1691 |
|
1692 // Check the converted values in both the conversions. |
|
1693 error = iConversionHandler->iStatus.Int(); |
|
1694 if( error == KErrCancel ) |
|
1695 { |
|
1696 CheckPositionConvertedInfoL( locationInfo,ENegative ); |
|
1697 } |
|
1698 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
1699 { |
|
1700 User::Leave( KErrArgument ); |
|
1701 } |
|
1702 |
|
1703 error = iConversionHandler1->iStatus.Int(); |
|
1704 if( error == KErrNone ) |
|
1705 { |
|
1706 CheckPositionConvertedInfoL( locationInfo1 ); |
|
1707 } |
|
1708 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
1709 { |
|
1710 User::Leave( KErrArgument ); |
|
1711 } |
|
1712 |
|
1713 /** |
|
1714 * Case 2: Users tries to request 2 simultaneous bulk conversion |
|
1715 * using 2 subsession specifying same conversion uid and |
|
1716 * one conversion request is cancelled. |
|
1717 */ |
|
1718 |
|
1719 // Before we append the location info object to the info array, |
|
1720 // we need to clear the converted info in each object. |
|
1721 locationInfo->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
1722 locationInfo1->ResetAreaInfo( CLbsLocationInfo::ELbsPosInfo ); |
|
1723 |
|
1724 locationInfoArray.Append( locationInfo ); |
|
1725 locationInfoArray1.Append( locationInfo1 ); |
|
1726 |
|
1727 locInfoConverter.ConvertLocationInfoL( |
|
1728 locationInfoArray,ELbsConversionNotDefined, |
|
1729 ELbsConversionOutputPosition,conversionModuleId1,iConversionHandler->iStatus ); |
|
1730 iConversionHandler->Start(); |
|
1731 |
|
1732 locInfoConverter1.ConvertLocationInfoL( |
|
1733 locationInfoArray1,ELbsConversionNotDefined, |
|
1734 ELbsConversionOutputPosition,conversionModuleId2,iConversionHandler1->iStatus ); |
|
1735 iConversionHandler1->Start(); |
|
1736 |
|
1737 // Here we cancel 2nd request |
|
1738 locInfoConverter1.CancelConvertLocationInfo(); |
|
1739 |
|
1740 // This is just to block the control till the call back method is called. |
|
1741 // Code after this statement will be resumed when Stop on CActiveScheduler |
|
1742 // is called in the HandleLocationConversion method. |
|
1743 CActiveScheduler::Start(); |
|
1744 |
|
1745 // Here we need to wait till both the request completes.Hence we need to block it once again |
|
1746 // till the 2nd request completes. |
|
1747 if( iConversionHandler->iStatus.Int() == KRequestPending || |
|
1748 iConversionHandler1->iStatus.Int() == KRequestPending ) |
|
1749 { |
|
1750 CActiveScheduler::Start(); |
|
1751 } |
|
1752 |
|
1753 // Check the converted values in both the conversions. |
|
1754 // Iterate through the array and check for converted info. |
|
1755 error = iConversionHandler->iStatus.Int(); |
|
1756 if( error == KErrNone ) |
|
1757 { |
|
1758 for( TInt i=0;i<locationInfoArray.Count();i++ ) |
|
1759 { |
|
1760 CLbsLocationInfoBase* locationInfobase = locationInfoArray[i]; |
|
1761 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1762 CheckPositionConvertedInfoL( locationInfo ); |
|
1763 } |
|
1764 } |
|
1765 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
1766 { |
|
1767 User::Leave( KErrArgument ); |
|
1768 } |
|
1769 |
|
1770 error = iConversionHandler1->iStatus.Int(); |
|
1771 if( error == KErrCancel ) |
|
1772 { |
|
1773 for( TInt i=0;i<locationInfoArray1.Count();i++ ) |
|
1774 { |
|
1775 CLbsLocationInfoBase* locationInfobase = locationInfoArray1[i]; |
|
1776 CLbsLocationInfo* locationInfo = static_cast<CLbsLocationInfo*> ( locationInfobase ); |
|
1777 CheckPositionConvertedInfoL( locationInfo,ENegative ); |
|
1778 } |
|
1779 } |
|
1780 else if( !( error == KErrNotFound || error == KErrNotSupported ) ) |
|
1781 { |
|
1782 User::Leave( KErrArgument ); |
|
1783 } |
|
1784 |
|
1785 |
|
1786 CleanupStack::Pop(4); // locationInfo1,locationInfoArray1,locationInfo,locationInfoArray |
|
1787 locationInfoArray.ResetAndDestroy(); |
|
1788 locationInfoArray1.ResetAndDestroy(); |
|
1789 CleanupStack::PopAndDestroy( 3 ); // locInfoConverter,locInfoConverter1,locMonitorSession |
|
1790 return KErrNone; |
|
1791 } |
|
1792 |
|
1793 |
|
1794 // Helper methods |
|
1795 |
|
1796 // ----------------------------------------------------------------------------- |
|
1797 // CLocInfoConversionUnitTest::CreatePositionObjectLC |
|
1798 // ----------------------------------------------------------------------------- |
|
1799 // |
|
1800 CLbsPositionInfo* CLocInfoConversionUnitTest::CreatePositionInfoObjectLC() |
|
1801 { |
|
1802 TLocality locality; |
|
1803 locality.SetCoordinate( 62.5285,23.9385 ); |
|
1804 locality.SetAccuracy( 100,0.0 ); |
|
1805 CLbsPositionInfo* positionInfo = CLbsPositionInfo::NewL( locality ); |
|
1806 CleanupStack::PushL( positionInfo ); |
|
1807 return positionInfo; |
|
1808 } |
|
1809 |
|
1810 // ----------------------------------------------------------------------------- |
|
1811 // CLocInfoConversionUnitTest::CreateGsmCellInfoObjectLC |
|
1812 // ----------------------------------------------------------------------------- |
|
1813 // |
|
1814 CLbsGsmCellInfo* CLocInfoConversionUnitTest::CreateGsmCellInfoObjectLC() |
|
1815 { |
|
1816 CLbsGsmCellInfo* gsmCellInfo = CLbsGsmCellInfo::NewL( 100,101,102,103); |
|
1817 CleanupStack::PushL( gsmCellInfo ); |
|
1818 return gsmCellInfo; |
|
1819 } |
|
1820 |
|
1821 // ----------------------------------------------------------------------------- |
|
1822 // CLocInfoConversionUnitTest::CreateWcdmaCellInfoObjectLC |
|
1823 // ----------------------------------------------------------------------------- |
|
1824 // |
|
1825 CLbsWcdmaCellInfo* CLocInfoConversionUnitTest::CreateWcdmaCellInfoObjectLC() |
|
1826 { |
|
1827 CLbsWcdmaCellInfo* wcdmaCellInfo = CLbsWcdmaCellInfo::NewL( 100,101,102 ); |
|
1828 CleanupStack::PushL( wcdmaCellInfo ); |
|
1829 return wcdmaCellInfo; |
|
1830 } |
|
1831 |
|
1832 // ----------------------------------------------------------------------------- |
|
1833 // CLocInfoConversionUnitTest::CreateWlanInfoObjectLC |
|
1834 // ----------------------------------------------------------------------------- |
|
1835 // |
|
1836 CLbsWlanInfo* CLocInfoConversionUnitTest::CreateWlanInfoObjectLC() |
|
1837 { |
|
1838 TLbsWlanMacAddress macAddress(_L8("10.0.1")); |
|
1839 CLbsWlanInfo* wlanInfo = CLbsWlanInfo::NewL( macAddress,10.1 ); |
|
1840 CleanupStack::PushL( wlanInfo ); |
|
1841 return wlanInfo; |
|
1842 } |
|
1843 |
|
1844 |
|
1845 // ----------------------------------------------------------------------------- |
|
1846 // CLocInfoConversionUnitTest::CreateLocationInfoObjectLC |
|
1847 // ----------------------------------------------------------------------------- |
|
1848 // |
|
1849 CLbsLocationInfo* CLocInfoConversionUnitTest::CreateLocationInfoObjectLC( |
|
1850 TLbsAreaInfoClassType aAreaType ) |
|
1851 { |
|
1852 CLbsLocationInfo* locationInfo = CLbsLocationInfo::NewL(); |
|
1853 CleanupStack::PushL( locationInfo ); |
|
1854 AppendAreaInfoObjectToLocationInfoL( locationInfo,aAreaType ); |
|
1855 return locationInfo; |
|
1856 } |
|
1857 |
|
1858 // ----------------------------------------------------------------------------- |
|
1859 // CLocInfoConversionUnitTest::AppendAreaInfoObjectToLocationInfoL |
|
1860 // ----------------------------------------------------------------------------- |
|
1861 // |
|
1862 void CLocInfoConversionUnitTest::AppendAreaInfoObjectToLocationInfoL( |
|
1863 CLbsLocationInfo* aLocationInfo, |
|
1864 TLbsAreaInfoClassType aAreaType ) |
|
1865 { |
|
1866 switch( aAreaType ) |
|
1867 { |
|
1868 case ELbsAreaPositionInfoClass: |
|
1869 CLbsPositionInfo* positionInfo = NULL; |
|
1870 positionInfo = CreatePositionInfoObjectLC(); |
|
1871 aLocationInfo->AddAreaInfoL( positionInfo ); |
|
1872 CleanupStack::Pop( positionInfo ); |
|
1873 break; |
|
1874 |
|
1875 case ELbsAreaGsmCellInfoClass: |
|
1876 CLbsGsmCellInfo* gsmCellInfo = NULL; |
|
1877 gsmCellInfo = CreateGsmCellInfoObjectLC(); |
|
1878 aLocationInfo->AddAreaInfoL( gsmCellInfo ); |
|
1879 CleanupStack::Pop( gsmCellInfo ); |
|
1880 break; |
|
1881 |
|
1882 case ELbsAreaWcmdaCellInfoClass: |
|
1883 CLbsWcdmaCellInfo* wcdmaCellInfo = NULL; |
|
1884 wcdmaCellInfo = CreateWcdmaCellInfoObjectLC(); |
|
1885 aLocationInfo->AddAreaInfoL( wcdmaCellInfo ); |
|
1886 CleanupStack::Pop( wcdmaCellInfo ); |
|
1887 break; |
|
1888 |
|
1889 case ELbsAreaWlanInfoClass: |
|
1890 CLbsWlanInfo* wlanInfo = NULL; |
|
1891 wlanInfo = CreateWlanInfoObjectLC(); |
|
1892 aLocationInfo->AddAreaInfoL( wlanInfo ); |
|
1893 CleanupStack::Pop( wlanInfo ); |
|
1894 break; |
|
1895 |
|
1896 default: |
|
1897 break; |
|
1898 } |
|
1899 } |
|
1900 |
|
1901 // ----------------------------------------------------------------------------- |
|
1902 // CLocInfoConversionUnitTest::CheckPositionConvertedInfoL |
|
1903 // ----------------------------------------------------------------------------- |
|
1904 // |
|
1905 void CLocInfoConversionUnitTest::CheckPositionConvertedInfoL( CLbsLocationInfo* |
|
1906 aLocationInfo, |
|
1907 TTestType |
|
1908 aTestType ) |
|
1909 { |
|
1910 RLbsAreaInfoBaseArray areaInfoArray; |
|
1911 aLocationInfo->GetAreaInfo( areaInfoArray,CLbsLocationInfo::ELbsPosInfo ); |
|
1912 TInt count = areaInfoArray.Count(); |
|
1913 areaInfoArray.Reset(); |
|
1914 if( aTestType == EPositive ) |
|
1915 { |
|
1916 if( !count ) |
|
1917 { |
|
1918 User::Leave( KErrArgument ); |
|
1919 } |
|
1920 } |
|
1921 else |
|
1922 { |
|
1923 if( count ) |
|
1924 { |
|
1925 User::Leave( KErrArgument ); |
|
1926 } |
|
1927 } |
|
1928 } |
|
1929 |
|
1930 |
|
1931 // ----------------------------------------------------------------------------- |
|
1932 // CLocInfoConversionUnitTest::CheckGsmCellConvertedInfoL |
|
1933 // ----------------------------------------------------------------------------- |
|
1934 // |
|
1935 void CLocInfoConversionUnitTest::CheckGsmCellConvertedInfoL( CLbsLocationInfo* |
|
1936 aLocationInfo, |
|
1937 TTestType |
|
1938 aTestType ) |
|
1939 { |
|
1940 RLbsAreaInfoBaseArray areaInfoArray; |
|
1941 aLocationInfo->GetAreaInfo( areaInfoArray,CLbsLocationInfo::ELbsGsmInfo ); |
|
1942 TInt count = areaInfoArray.Count(); |
|
1943 areaInfoArray.Reset(); |
|
1944 if( aTestType == EPositive ) |
|
1945 { |
|
1946 if( !count ) |
|
1947 { |
|
1948 User::Leave( KErrArgument ); |
|
1949 } |
|
1950 } |
|
1951 else |
|
1952 { |
|
1953 if( count ) |
|
1954 { |
|
1955 User::Leave( KErrArgument ); |
|
1956 } |
|
1957 } |
|
1958 } |
|
1959 |
|
1960 // ----------------------------------------------------------------------------- |
|
1961 // CLocInfoConversionUnitTest::CheckWcdmaCellConvertedInfoL |
|
1962 // ----------------------------------------------------------------------------- |
|
1963 // |
|
1964 void CLocInfoConversionUnitTest::CheckWcdmaCellConvertedInfoL( CLbsLocationInfo* |
|
1965 aLocationInfo, |
|
1966 TTestType |
|
1967 aTestType ) |
|
1968 { |
|
1969 RLbsAreaInfoBaseArray areaInfoArray; |
|
1970 aLocationInfo->GetAreaInfo( areaInfoArray,CLbsLocationInfo::ELbsWcdmaInfo ); |
|
1971 TInt count = areaInfoArray.Count(); |
|
1972 areaInfoArray.Reset(); |
|
1973 if( aTestType == EPositive ) |
|
1974 { |
|
1975 if( !count ) |
|
1976 { |
|
1977 User::Leave( KErrArgument ); |
|
1978 } |
|
1979 } |
|
1980 else |
|
1981 { |
|
1982 if( count ) |
|
1983 { |
|
1984 User::Leave( KErrArgument ); |
|
1985 } |
|
1986 } |
|
1987 } |
|
1988 |
|
1989 // ----------------------------------------------------------------------------- |
|
1990 // CLocInfoConversionUnitTest::CheckWlanConvertedInfoL |
|
1991 // ----------------------------------------------------------------------------- |
|
1992 // |
|
1993 void CLocInfoConversionUnitTest::CheckWlanConvertedInfoL( CLbsLocationInfo* |
|
1994 aLocationInfo, |
|
1995 TTestType |
|
1996 aTestType ) |
|
1997 { |
|
1998 RLbsAreaInfoBaseArray areaInfoArray; |
|
1999 aLocationInfo->GetAreaInfo( areaInfoArray,CLbsLocationInfo::ELbsWlanInfo ); |
|
2000 TInt count = areaInfoArray.Count(); |
|
2001 areaInfoArray.ResetAndDestroy(); |
|
2002 if( aTestType == EPositive ) |
|
2003 { |
|
2004 if( !count ) |
|
2005 { |
|
2006 User::Leave( KErrArgument ); |
|
2007 } |
|
2008 } |
|
2009 else |
|
2010 { |
|
2011 if( count ) |
|
2012 { |
|
2013 User::Leave( KErrArgument ); |
|
2014 } |
|
2015 } |
|
2016 } |
|
2017 // [End of File] |