|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "tcustomapitsytesthelper.h" |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 * Constructor |
|
22 */ |
|
23 TCustomApiTsyTestHelper::TCustomApiTsyTestHelper(CCTSYIntegrationTestSuiteStepBase& aTestStep) |
|
24 : TTsyTestHelperBase( aTestStep ) |
|
25 { |
|
26 } |
|
27 /** |
|
28 * Notify reset for RMmCustomAPI::NotifyAlsBlockedChanged |
|
29 */ |
|
30 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyAlsBlockedChanged( |
|
31 RMmCustomAPI& aMmCustomAPI, |
|
32 TEtelRequestBase& aRequestStatus, |
|
33 RMmCustomAPI::TGetAlsBlockStatus& aBlockStatus, |
|
34 RMmCustomAPI::TGetAlsBlockStatus aExpectedBlockStatus, |
|
35 TInt aWantedStatus ) |
|
36 |
|
37 { |
|
38 // Wait for the request to complete |
|
39 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
40 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyAlsBlockedChanged did not complete")) |
|
41 |
|
42 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
43 && aBlockStatus != aExpectedBlockStatus ) |
|
44 { |
|
45 // Request has completed with incorrect result. Consume any outstanding |
|
46 // Repost notification until timeout or we get the right result. |
|
47 |
|
48 aMmCustomAPI.NotifyAlsBlockedChanged(aRequestStatus, aBlockStatus); |
|
49 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
50 } |
|
51 |
|
52 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyAlsBlockedChanged Wrong completion status")) |
|
53 ASSERT_EQUALS(aBlockStatus, aExpectedBlockStatus, |
|
54 _L("RMmCustomAPI::NotifyAlsBlockedChanged Wrong result")) |
|
55 |
|
56 // Cancel request if it is still pending |
|
57 if (aRequestStatus.Int() == KRequestPending) |
|
58 { |
|
59 aRequestStatus.Cancel(); |
|
60 } |
|
61 } |
|
62 |
|
63 |
|
64 /** |
|
65 * Notify reset for RMmCustomAPI::NotifyCellInfoChange |
|
66 */ |
|
67 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyCellInfoChange( |
|
68 RMmCustomAPI& aMmCustomAPI, |
|
69 TEtelRequestBase& aRequestStatus, |
|
70 TCmpBase<RMmCustomAPI::TMmCellInfo> &aMmCellInfo, |
|
71 TInt aWantedStatus ) |
|
72 |
|
73 { |
|
74 // Wait for the request to complete |
|
75 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
76 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyCellInfoChange did not complete")) |
|
77 |
|
78 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
79 && !aMmCellInfo.IsEqual(ENoLogError) ) |
|
80 { |
|
81 // Request has completed with incorrect result. Consume any outstanding |
|
82 // Repost notification until timeout or we get the right result. |
|
83 RMmCustomAPI::TMmCellInfoPckg pkgParam( aMmCellInfo.GetValue() ); |
|
84 aMmCustomAPI.NotifyCellInfoChange(aRequestStatus, pkgParam); |
|
85 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
86 } |
|
87 |
|
88 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyCellInfoChange Wrong completion status")) |
|
89 ASSERT_TRUE(aMmCellInfo.IsEqual(ELogError), |
|
90 _L("RMmCustomAPI::NotifyCellInfoChange Wrong result")) |
|
91 |
|
92 // Cancel request if it is still pending |
|
93 if (aRequestStatus.Int() == KRequestPending) |
|
94 { |
|
95 aRequestStatus.Cancel(); |
|
96 } |
|
97 } |
|
98 |
|
99 |
|
100 /** |
|
101 * Notify reset for RMmCustomAPI::NotifyCipheringInfoChange |
|
102 */ |
|
103 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyCipheringInfoChange( |
|
104 RMmCustomAPI& aMmCustomAPI, |
|
105 TEtelRequestBase& aRequestStatus, |
|
106 TCmpBase<RMmCustomAPI::TCipheringInfo>& aCipheringInfo, |
|
107 TInt aWantedStatus ) |
|
108 |
|
109 { |
|
110 // Wait for the request to complete |
|
111 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
112 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyCipheringInfoChange did not complete")) |
|
113 |
|
114 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
115 && !aCipheringInfo.IsEqual(ENoLogError)) |
|
116 { |
|
117 // Request has completed with incorrect result. Consume any outstanding |
|
118 // Repost notification until timeout or we get the right result. |
|
119 |
|
120 aMmCustomAPI.NotifyCipheringInfoChange(aRequestStatus, aCipheringInfo.GetValue()); |
|
121 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
122 } |
|
123 |
|
124 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyCipheringInfoChange Wrong completion status")) |
|
125 ASSERT_TRUE(aCipheringInfo.IsEqual(ELogError), |
|
126 _L("RMmCustomAPI::NotifyCipheringInfoChange Wrong result")) |
|
127 |
|
128 // Cancel request if it is still pending |
|
129 if (aRequestStatus.Int() == KRequestPending) |
|
130 { |
|
131 aRequestStatus.Cancel(); |
|
132 } |
|
133 } |
|
134 |
|
135 |
|
136 /** |
|
137 * Notify reset for RMmCustomAPI::NotifyDtmfEvent |
|
138 */ |
|
139 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyDtmfEvent( |
|
140 RMmCustomAPI& aMmCustomAPI, |
|
141 TEtelRequestBase& aRequestStatus, |
|
142 TCmpBase<RMmCustomAPI::TDtmfInfo>& aInfo, |
|
143 TInt aWantedStatus ) |
|
144 |
|
145 { |
|
146 // Wait for the request to complete |
|
147 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
148 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyDtmfEvent did not complete")) |
|
149 |
|
150 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
151 && !aInfo.IsEqual(ENoLogError)) |
|
152 { |
|
153 // Request has completed with incorrect result. Consume any outstanding |
|
154 // Repost notification until timeout or we get the right result. |
|
155 |
|
156 aMmCustomAPI.NotifyDtmfEvent(aRequestStatus, aInfo.GetValue()); |
|
157 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
158 } |
|
159 |
|
160 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyDtmfEvent Wrong completion status")) |
|
161 ASSERT_TRUE(aInfo.IsEqual(ELogError), |
|
162 _L("RMmCustomAPI::NotifyDtmfEvent Wrong result")); |
|
163 |
|
164 // Cancel request if it is still pending |
|
165 if (aRequestStatus.Int() == KRequestPending) |
|
166 { |
|
167 aRequestStatus.Cancel(); |
|
168 } |
|
169 } |
|
170 |
|
171 |
|
172 /** |
|
173 * Notify reset for RMmCustomAPI::NotifyEGprsInfoChange |
|
174 */ |
|
175 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyEGprsInfoChange( |
|
176 RMmCustomAPI& aMmCustomAPI, |
|
177 TEtelRequestBase& aRequestStatus, |
|
178 TCmpBase<RMmCustomAPI::TGprsInformationType> &aGprsInformationType, |
|
179 TInt aWantedStatus ) |
|
180 |
|
181 { |
|
182 // Wait for the request to complete |
|
183 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
184 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyEGprsInfoChange did not complete")) |
|
185 |
|
186 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
187 && !aGprsInformationType.IsEqual(ENoLogError) ) |
|
188 { |
|
189 // Request has completed with incorrect result. Consume any outstanding |
|
190 // Repost notification until timeout or we get the right result. |
|
191 TPckg<RMmCustomAPI::TGprsInformationType> pkgParam( aGprsInformationType.GetValue() ); |
|
192 aMmCustomAPI.NotifyEGprsInfoChange(aRequestStatus, pkgParam); |
|
193 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
194 } |
|
195 |
|
196 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyEGprsInfoChange Wrong completion status")) |
|
197 ASSERT_TRUE(aGprsInformationType.IsEqual(ELogError), |
|
198 _L("RMmCustomAPI::NotifyEGprsInfoChange Wrong result")) |
|
199 |
|
200 // Cancel request if it is still pending |
|
201 if (aRequestStatus.Int() == KRequestPending) |
|
202 { |
|
203 aRequestStatus.Cancel(); |
|
204 } |
|
205 } |
|
206 |
|
207 |
|
208 /** |
|
209 * Notify reset for RMmCustomAPI::NotifyHSxPAStatus |
|
210 */ |
|
211 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyHSxPAStatus( |
|
212 RMmCustomAPI& aMmCustomAPI, |
|
213 TEtelRequestBase& aRequestStatus, |
|
214 RMmCustomAPI::THSxPAStatus& aHSxPAStatus, |
|
215 RMmCustomAPI::THSxPAStatus aExpectedHSxPAStatus, |
|
216 TInt aWantedStatus ) |
|
217 |
|
218 { |
|
219 // Wait for the request to complete |
|
220 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
221 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyHSxPAStatus did not complete")) |
|
222 |
|
223 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
224 && aHSxPAStatus != aExpectedHSxPAStatus ) |
|
225 { |
|
226 // Request has completed with incorrect result. Consume any outstanding |
|
227 // Repost notification until timeout or we get the right result. |
|
228 |
|
229 aMmCustomAPI.NotifyHSxPAStatus(aRequestStatus, aHSxPAStatus); |
|
230 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
231 } |
|
232 |
|
233 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyHSxPAStatus Wrong completion status")) |
|
234 ASSERT_EQUALS(aHSxPAStatus, aExpectedHSxPAStatus, |
|
235 _L("RMmCustomAPI::NotifyHSxPAStatus Wrong result")) |
|
236 |
|
237 // Cancel request if it is still pending |
|
238 if (aRequestStatus.Int() == KRequestPending) |
|
239 { |
|
240 aRequestStatus.Cancel(); |
|
241 } |
|
242 } |
|
243 |
|
244 |
|
245 /** |
|
246 * Notify reset for RMmCustomAPI::NotifyIccCallForwardingStatusChange |
|
247 */ |
|
248 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyIccCallForwardingStatusChange( |
|
249 RMmCustomAPI& aMmCustomAPI, |
|
250 TEtelRequestBase& aRequestStatus, |
|
251 TCmpBase<RMmCustomAPI::TCFIndicators> &aCFIndicators, |
|
252 TInt aWantedStatus ) |
|
253 |
|
254 { |
|
255 // Wait for the request to complete |
|
256 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
257 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyIccCallForwardingStatusChange did not complete")) |
|
258 |
|
259 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
260 && !aCFIndicators.IsEqual(ENoLogError) ) |
|
261 { |
|
262 // Request has completed with incorrect result. Consume any outstanding |
|
263 // Repost notification until timeout or we get the right result. |
|
264 RMmCustomAPI::TCFIndicatorsPckg pkgParam( aCFIndicators.GetValue() ); |
|
265 aMmCustomAPI.NotifyIccCallForwardingStatusChange(aRequestStatus, pkgParam); |
|
266 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
267 } |
|
268 |
|
269 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyIccCallForwardingStatusChange Wrong completion status")) |
|
270 ASSERT_TRUE(aCFIndicators.IsEqual(ELogError), |
|
271 _L("RMmCustomAPI::NotifyIccCallForwardingStatusChange Wrong result")) |
|
272 |
|
273 // Cancel request if it is still pending |
|
274 if (aRequestStatus.Int() == KRequestPending) |
|
275 { |
|
276 aRequestStatus.Cancel(); |
|
277 } |
|
278 } |
|
279 |
|
280 |
|
281 /** |
|
282 * Notify reset for RMmCustomAPI::NotifyNetworkConnectionFailure |
|
283 */ |
|
284 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyNetworkConnectionFailure( |
|
285 TEtelRequestBase& aRequestStatus, |
|
286 TInt aWantedStatus ) |
|
287 |
|
288 { |
|
289 // Wait for the request to complete |
|
290 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
291 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyNetworkConnectionFailure did not complete")) |
|
292 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyNetworkConnectionFailure Wrong completion status")) |
|
293 // Cancel request if it is still pending |
|
294 if (aRequestStatus.Int() == KRequestPending) |
|
295 { |
|
296 aRequestStatus.Cancel(); |
|
297 } |
|
298 } |
|
299 |
|
300 |
|
301 /** |
|
302 * Notify reset for RMmCustomAPI::NotifyNSPSStatus |
|
303 */ |
|
304 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyNSPSStatus( |
|
305 RMmCustomAPI& aMmCustomAPI, |
|
306 TEtelRequestBase& aRequestStatus, |
|
307 RMmCustomAPI::TNspsStatus& aNspsStatus, |
|
308 RMmCustomAPI::TNspsStatus aExpectedNspsStatus, |
|
309 TInt aWantedStatus ) |
|
310 |
|
311 { |
|
312 // Wait for the request to complete |
|
313 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
314 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyNSPSStatus did not complete")) |
|
315 |
|
316 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
317 && aNspsStatus != aExpectedNspsStatus ) |
|
318 { |
|
319 // Request has completed with incorrect result. Consume any outstanding |
|
320 // Repost notification until timeout or we get the right result. |
|
321 |
|
322 aMmCustomAPI.NotifyNSPSStatus(aRequestStatus, aNspsStatus); |
|
323 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
324 } |
|
325 |
|
326 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyNSPSStatus Wrong completion status")) |
|
327 ASSERT_EQUALS(aNspsStatus, aExpectedNspsStatus, |
|
328 _L("RMmCustomAPI::NotifyNSPSStatus Wrong result")) |
|
329 |
|
330 // Cancel request if it is still pending |
|
331 if (aRequestStatus.Int() == KRequestPending) |
|
332 { |
|
333 aRequestStatus.Cancel(); |
|
334 } |
|
335 } |
|
336 |
|
337 |
|
338 /** |
|
339 * Notify reset for RMmCustomAPI::NotifyPndCacheReady |
|
340 */ |
|
341 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyPndCacheReady( |
|
342 RMmCustomAPI& aMmCustomAPI, |
|
343 TEtelRequestBase& aRequestStatus, |
|
344 TName& aPndName, |
|
345 TName aExpectedPndName, |
|
346 TInt aWantedStatus ) |
|
347 |
|
348 { |
|
349 // Wait for the request to complete |
|
350 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
351 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyPndCacheReady did not complete")) |
|
352 |
|
353 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
354 && aPndName != aExpectedPndName ) |
|
355 { |
|
356 // Request has completed with incorrect result. Consume any outstanding |
|
357 // Repost notification until timeout or we get the right result. |
|
358 |
|
359 aMmCustomAPI.NotifyPndCacheReady(aRequestStatus, aPndName); |
|
360 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
361 } |
|
362 |
|
363 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyPndCacheReady Wrong completion status")) |
|
364 ASSERT_EQUALS_DES16(aPndName, aExpectedPndName, |
|
365 _L("RMmCustomAPI::NotifyPndCacheReady Wrong result")) |
|
366 |
|
367 // Cancel request if it is still pending |
|
368 if (aRequestStatus.Int() == KRequestPending) |
|
369 { |
|
370 aRequestStatus.Cancel(); |
|
371 } |
|
372 } |
|
373 |
|
374 |
|
375 /** |
|
376 * Notify reset for RMmCustomAPI::NotifyProgrammableOperatorLogoChange |
|
377 */ |
|
378 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyProgrammableOperatorLogoChange( |
|
379 RMmCustomAPI& aMmCustomAPI, |
|
380 TEtelRequestBase& aRequestStatus, |
|
381 TCmpBase<RMmCustomAPI::TOperatorId>& aOperatorId, |
|
382 TInt aWantedStatus ) |
|
383 |
|
384 { |
|
385 // Wait for the request to complete |
|
386 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
387 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyProgrammableOperatorLogoChange did not complete")) |
|
388 |
|
389 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
390 && !aOperatorId.IsEqual(ENoLogError)) |
|
391 { |
|
392 // Request has completed with incorrect result. Consume any outstanding |
|
393 // Repost notification until timeout or we get the right result. |
|
394 |
|
395 aMmCustomAPI.NotifyProgrammableOperatorLogoChange(aRequestStatus, aOperatorId.GetValue()); |
|
396 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
397 } |
|
398 |
|
399 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyProgrammableOperatorLogoChange Wrong completion status")) |
|
400 ASSERT_TRUE(aOperatorId.IsEqual(ELogError), |
|
401 _L("RMmCustomAPI::NotifyProgrammableOperatorLogoChange Wrong result")) |
|
402 |
|
403 // Cancel request if it is still pending |
|
404 if (aRequestStatus.Int() == KRequestPending) |
|
405 { |
|
406 aRequestStatus.Cancel(); |
|
407 } |
|
408 } |
|
409 |
|
410 |
|
411 /** |
|
412 * Notify reset for RMmCustomAPI::NotifyRauEvent |
|
413 */ |
|
414 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifyRauEvent( |
|
415 RMmCustomAPI& aMmCustomAPI, |
|
416 TEtelRequestBase& aRequestStatus, |
|
417 RMmCustomAPI::TRauEventStatus& aEventStatus, |
|
418 RMmCustomAPI::TRauEventStatus aExpectedEventStatus, |
|
419 TInt aWantedStatus ) |
|
420 |
|
421 { |
|
422 // Wait for the request to complete |
|
423 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
424 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifyRauEvent did not complete")) |
|
425 |
|
426 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
427 && aEventStatus != aExpectedEventStatus ) |
|
428 { |
|
429 // Request has completed with incorrect result. Consume any outstanding |
|
430 // Repost notification until timeout or we get the right result. |
|
431 |
|
432 aMmCustomAPI.NotifyRauEvent(aRequestStatus, aEventStatus); |
|
433 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
434 } |
|
435 |
|
436 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifyRauEvent Wrong completion status")) |
|
437 ASSERT_EQUALS(aEventStatus, aExpectedEventStatus, |
|
438 _L("RMmCustomAPI::NotifyRauEvent Wrong result")) |
|
439 |
|
440 // Cancel request if it is still pending |
|
441 if (aRequestStatus.Int() == KRequestPending) |
|
442 { |
|
443 aRequestStatus.Cancel(); |
|
444 } |
|
445 } |
|
446 |
|
447 |
|
448 /** |
|
449 * Notify reset for RMmCustomAPI::NotifySimCardStatus |
|
450 */ |
|
451 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifySimCardStatus( |
|
452 RMmCustomAPI& aMmCustomAPI, |
|
453 TEtelRequestBase& aRequestStatus, |
|
454 RMmCustomAPI::TSIMCardStatus& aCardStatus, |
|
455 RMmCustomAPI::TSIMCardStatus aExpectedCardStatus, |
|
456 TInt aWantedStatus ) |
|
457 |
|
458 { |
|
459 // Wait for the request to complete |
|
460 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
461 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifySimCardStatus did not complete")) |
|
462 |
|
463 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
464 && aCardStatus != aExpectedCardStatus ) |
|
465 { |
|
466 // Request has completed with incorrect result. Consume any outstanding |
|
467 // Repost notification until timeout or we get the right result. |
|
468 |
|
469 aMmCustomAPI.NotifySimCardStatus(aRequestStatus, aCardStatus); |
|
470 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
471 } |
|
472 |
|
473 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifySimCardStatus Wrong completion status")) |
|
474 ASSERT_EQUALS(aCardStatus, aExpectedCardStatus, |
|
475 _L("RMmCustomAPI::NotifySimCardStatus Wrong result")) |
|
476 |
|
477 // Cancel request if it is still pending |
|
478 if (aRequestStatus.Int() == KRequestPending) |
|
479 { |
|
480 aRequestStatus.Cancel(); |
|
481 } |
|
482 } |
|
483 |
|
484 |
|
485 /** |
|
486 * Notify reset for RMmCustomAPI::NotifySsNetworkEvent |
|
487 */ |
|
488 void TCustomApiTsyTestHelper::WaitForMmCustomAPINotifySsNetworkEvent( |
|
489 RMmCustomAPI& aMmCustomAPI, |
|
490 TEtelRequestBase& aRequestStatus, |
|
491 TCmpBase<RMmCustomAPI::TSsTypeAndMode>& aSsTypeAndMode, |
|
492 RMmCustomAPI::TSsInfo &aSsInfo, |
|
493 TInt aWantedStatus ) |
|
494 |
|
495 { |
|
496 // Wait for the request to complete |
|
497 TInt err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
498 ASSERT_EQUALS(err, KErrNone, _L("RMmCustomAPI::NotifySsNetworkEvent did not complete")) |
|
499 |
|
500 while ( err == KErrNone && aRequestStatus.Int() == KErrNone |
|
501 && !aSsTypeAndMode.IsEqual(ENoLogError)) |
|
502 { |
|
503 // Request has completed with incorrect result. Consume any outstanding |
|
504 // Repost notification until timeout or we get the right result. |
|
505 |
|
506 aMmCustomAPI.NotifySsNetworkEvent(aRequestStatus, aSsTypeAndMode.GetValue(), aSsInfo); |
|
507 err = iTestStep.WaitForRequestWithTimeOut(aRequestStatus, ETimeShort); |
|
508 } |
|
509 |
|
510 ASSERT_EQUALS(aRequestStatus.Int(), aWantedStatus, _L("RMmCustomAPI::NotifySsNetworkEvent Wrong completion status")) |
|
511 ASSERT_TRUE(aSsTypeAndMode.IsEqual(ELogError), |
|
512 _L("RMmCustomAPI::NotifySsNetworkEvent Wrong result")); |
|
513 |
|
514 // Cancel request if it is still pending |
|
515 if (aRequestStatus.Int() == KRequestPending) |
|
516 { |
|
517 aRequestStatus.Cancel(); |
|
518 } |
|
519 } |
|
520 |
|
521 |