|
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 // The TEFUnit test suite for CallBarring in the Common TSY. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 |
|
23 #include "cctsycallbarringfu.h" |
|
24 #include <etel.h> |
|
25 #include <etelmm.h> |
|
26 #include <et_clsvr.h> |
|
27 #include <mmlist.h> |
|
28 #include <ctsy/mmtsy_names.h> |
|
29 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
30 #include "tmockltsydata.h" |
|
31 #include <ctsy/serviceapi/gsmerror.h> |
|
32 #include "cctsyactiveretriever.h" |
|
33 |
|
34 |
|
35 |
|
36 CTestSuite* CCTsyCallBarringFU::CreateSuiteL(const TDesC& aName) |
|
37 { |
|
38 SUB_SUITE; |
|
39 |
|
40 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestStart0001L); |
|
41 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestStart0002L); |
|
42 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestStart0003L); |
|
43 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestStart0004L); |
|
44 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestStart0005L); |
|
45 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetSSPassword0001L); |
|
46 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetSSPassword0002L); |
|
47 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetSSPassword0003L); |
|
48 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetSSPassword0004L); |
|
49 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetSSPassword0005L); |
|
50 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestGetCompMethodName0001L); |
|
51 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetCallBarringStatus0001L); |
|
52 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetCallBarringStatus0002L); |
|
53 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetCallBarringStatus0003L); |
|
54 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetCallBarringStatus0004L); |
|
55 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetCallBarringStatus0005L); |
|
56 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestSetCallBarringPassword0001L); |
|
57 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestNotifyCallBarringStatusChange0001L); |
|
58 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestNotifyCallBarringStatusChange0002L); |
|
59 ADD_TEST_STEP_ISO_CPP(CCTsyCallBarringFU, TestNotifyCallBarringStatusChange0004L); |
|
60 |
|
61 END_SUITE; |
|
62 } |
|
63 |
|
64 void CCTsyCallBarringFU::OpenPhoneCBListLC() |
|
65 { |
|
66 iCBList = CRetrieveMobilePhoneCBList::NewL(iPhone); |
|
67 CleanupStack::PushL(iCBList); |
|
68 } |
|
69 |
|
70 // |
|
71 // Actual test cases |
|
72 // |
|
73 |
|
74 |
|
75 /** |
|
76 @SYMTestCaseID BA-CTSY-CBAR-RMPCB-0001 |
|
77 @SYMComponent telephony_ctsy |
|
78 @SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneCBList::Start |
|
79 @SYMTestPriority High |
|
80 @SYMTestActions Invokes CRetrieveMobilePhoneCBList::Start |
|
81 @SYMTestExpectedResults Pass |
|
82 @SYMTestType CT |
|
83 */ |
|
84 void CCTsyCallBarringFU::TestStart0001L() |
|
85 { |
|
86 OpenEtelServerL(EUseExtendedError); |
|
87 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
88 OpenPhoneL(); |
|
89 |
|
90 RBuf8 data; |
|
91 CleanupClosePushL(data); |
|
92 |
|
93 RBuf8 dataComplete; |
|
94 CleanupClosePushL(dataComplete); |
|
95 |
|
96 CFilteringActiveScheduler scheduler; |
|
97 CActiveScheduler::Install(&scheduler); |
|
98 |
|
99 OpenPhoneCBListLC(); |
|
100 |
|
101 CActiveRetriever::ResetRequestsNumber(); |
|
102 CActiveRetriever* activeRetriever = CActiveRetriever::NewLC(*iCBList); |
|
103 scheduler.AddRetrieverL(*activeRetriever); |
|
104 |
|
105 |
|
106 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
107 |
|
108 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData(condition); |
|
109 conditionData.SerialiseL(data); |
|
110 |
|
111 CMobilePhoneCBList* cbList = CMobilePhoneCBList::NewL(); |
|
112 CleanupStack::PushL(cbList); |
|
113 RMobilePhone::TMobilePhoneCBInfoEntryV1 listEntry; |
|
114 listEntry.iStatus = RMobilePhone::ECallBarringStatusActive; |
|
115 listEntry.iCondition = RMobilePhone::EBarAllIncoming; |
|
116 listEntry.iServiceGroup = RMobilePhone::EVoiceService; |
|
117 cbList->AddEntryL(listEntry); |
|
118 |
|
119 CBufBase* completeCBListBuf = cbList->StoreLC(); |
|
120 dataComplete.Create(completeCBListBuf->Ptr(0)); |
|
121 CleanupStack::PopAndDestroy(completeCBListBuf); |
|
122 |
|
123 //------------------------------------------------------------------------- |
|
124 // TEST A: failure to dispatch request to LTSY |
|
125 //------------------------------------------------------------------------- |
|
126 |
|
127 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data, KErrNotSupported); |
|
128 iCBList->Start(activeRetriever->Status(), condition); |
|
129 activeRetriever->Activate(); |
|
130 scheduler.StartScheduler(); |
|
131 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()) |
|
132 ASSERT_EQUALS(KErrNotSupported, activeRetriever->Status().Int()) |
|
133 |
|
134 AssertMockLtsyStatusL(); |
|
135 //------------------------------------------------------------------------- |
|
136 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
137 //------------------------------------------------------------------------- |
|
138 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data); |
|
139 iMockLTSY.CompleteL(EMobilePhoneGetBarringStatusPhase1, KErrGeneral); |
|
140 iCBList->Start(activeRetriever->Status(), condition); |
|
141 activeRetriever->Activate(); |
|
142 scheduler.StartScheduler(); |
|
143 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()) |
|
144 ASSERT_EQUALS(KErrGeneral, activeRetriever->Status().Int()) |
|
145 AssertMockLtsyStatusL(); |
|
146 |
|
147 //------------------------------------------------------------------------- |
|
148 // TEST B1: cover condition branch for KErrNotFound |
|
149 //------------------------------------------------------------------------- |
|
150 |
|
151 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data); |
|
152 iMockLTSY.CompleteL(EMobilePhoneGetBarringStatusPhase1, KErrNone, KNullDesC8); |
|
153 iCBList->Start(activeRetriever->Status(), condition); |
|
154 activeRetriever->Activate(); |
|
155 scheduler.StartScheduler(); |
|
156 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()) |
|
157 ASSERT_EQUALS(KErrNotFound, activeRetriever->Status().Int()) |
|
158 AssertMockLtsyStatusL(); |
|
159 |
|
160 //------------------------------------------------------------------------- |
|
161 // TEST C: Successful completion request of |
|
162 // CRetrieveMobilePhoneCBList::Start when result is not cached. |
|
163 //------------------------------------------------------------------------- |
|
164 |
|
165 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data); |
|
166 iMockLTSY.CompleteL(EMobilePhoneGetBarringStatusPhase1, KErrNone, dataComplete); |
|
167 iCBList->Start(activeRetriever->Status(), condition); |
|
168 activeRetriever->Activate(); |
|
169 scheduler.StartScheduler(); |
|
170 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()) |
|
171 ASSERT_EQUALS(KErrNone, activeRetriever->Status().Int()) |
|
172 CMobilePhoneCBList* resList = iCBList->RetrieveListL(); |
|
173 CBufBase* resCBListBuf = resList->StoreLC(); |
|
174 completeCBListBuf = cbList->StoreLC(); |
|
175 ASSERT_EQUALS(completeCBListBuf->Ptr(0), resCBListBuf->Ptr(0)) |
|
176 CleanupStack::PopAndDestroy(2); //resCBListBuf, completeCBListBuf |
|
177 AssertMockLtsyStatusL(); |
|
178 |
|
179 //------------------------------------------------------------------------- |
|
180 // TEST E: Unsolicited completion of CRetrieveMobilePhoneCBList::Start |
|
181 // from LTSY. |
|
182 //------------------------------------------------------------------------- |
|
183 |
|
184 TRequestStatus mockLtsyStatus; |
|
185 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
186 |
|
187 iMockLTSY.CompleteL(EMobilePhoneGetBarringStatusPhase1, KErrNone); |
|
188 User::WaitForRequest(mockLtsyStatus); |
|
189 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()) |
|
190 AssertMockLtsyStatusL(); |
|
191 |
|
192 //------------------------------------------------------------------------- |
|
193 // for coverage increasing |
|
194 //------------------------------------------------------------------------- |
|
195 |
|
196 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data, KErrNotSupported); |
|
197 iCBList->Start(activeRetriever->Status(), condition, RMobilePhone::EInfoLocationCache); |
|
198 activeRetriever->Activate(); |
|
199 scheduler.StartScheduler(); |
|
200 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()) |
|
201 ASSERT_EQUALS(KErrNotFound, activeRetriever->Status().Int()) |
|
202 |
|
203 CleanupStack::PopAndDestroy(3); |
|
204 CActiveScheduler::Install(NULL); |
|
205 CleanupStack::PopAndDestroy(3, this); // data, this |
|
206 } |
|
207 |
|
208 /** |
|
209 @SYMTestCaseID BA-CTSY-CBAR-RMPCB-0002 |
|
210 @SYMComponent telephony_ctsy |
|
211 @SYMTestCaseDesc Test support in CTSY for cancelling of CRetrieveMobilePhoneCBList::Start |
|
212 @SYMTestPriority High |
|
213 @SYMTestActions Invokes cancelling of CRetrieveMobilePhoneCBList::Start |
|
214 @SYMTestExpectedResults Pass |
|
215 @SYMTestType CT |
|
216 */ |
|
217 void CCTsyCallBarringFU::TestStart0002L() |
|
218 { |
|
219 |
|
220 OpenEtelServerL(EUseExtendedError); |
|
221 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
222 OpenPhoneL(); |
|
223 |
|
224 TRequestStatus mockLtsyStatus; |
|
225 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
226 |
|
227 RBuf8 data; |
|
228 CleanupClosePushL(data); |
|
229 |
|
230 RBuf8 dataComplete; |
|
231 CleanupClosePushL(dataComplete); |
|
232 |
|
233 CFilteringActiveScheduler scheduler; |
|
234 CActiveScheduler::Install(&scheduler); |
|
235 |
|
236 OpenPhoneCBListLC(); |
|
237 |
|
238 CActiveRetriever::ResetRequestsNumber(); |
|
239 CActiveRetriever* activeRetriever = CActiveRetriever::NewLC(*iCBList); |
|
240 scheduler.AddRetrieverL(*activeRetriever); |
|
241 |
|
242 |
|
243 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
244 |
|
245 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData(condition); |
|
246 conditionData.SerialiseL(data); |
|
247 |
|
248 CMobilePhoneCBList* cbList = CMobilePhoneCBList::NewL(); |
|
249 CleanupStack::PushL(cbList); |
|
250 RMobilePhone::TMobilePhoneCBInfoEntryV1 listEntry; |
|
251 listEntry.iStatus = RMobilePhone::ECallBarringStatusActive; |
|
252 listEntry.iCondition = RMobilePhone::EBarAllIncoming; |
|
253 listEntry.iServiceGroup = RMobilePhone::EVoiceService; |
|
254 cbList->AddEntryL(listEntry); |
|
255 |
|
256 CBufBase* completeCBListBuf = cbList->StoreLC(); |
|
257 dataComplete.Create(completeCBListBuf->Ptr(0)); |
|
258 CleanupStack::PopAndDestroy(completeCBListBuf); |
|
259 |
|
260 //------------------------------------------------------------------------- |
|
261 // Test cancelling of CRetrieveMobilePhoneCBList::Start |
|
262 //------------------------------------------------------------------------- |
|
263 |
|
264 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data); |
|
265 iMockLTSY.CompleteL(EMobilePhoneGetBarringStatusPhase1, KErrNone, dataComplete, 20); |
|
266 iCBList->Start(activeRetriever->Status(), condition); |
|
267 activeRetriever->Activate(); |
|
268 iCBList->Cancel(); |
|
269 scheduler.StartScheduler(); |
|
270 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
271 ASSERT_EQUALS(KErrCancel, activeRetriever->Status().Int()) |
|
272 |
|
273 User::WaitForRequest(mockLtsyStatus); |
|
274 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()) |
|
275 AssertMockLtsyStatusL(); |
|
276 |
|
277 // Cancel the second phase |
|
278 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data); |
|
279 iMockLTSY.CompleteL(EMobilePhoneGetBarringStatusPhase1, KErrNone, dataComplete); |
|
280 iCBList->Start(activeRetriever->Status(), condition); |
|
281 activeRetriever->Activate(CActiveRetriever::ECasePhase2Cancel); |
|
282 scheduler.StartScheduler(); |
|
283 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
284 ASSERT_EQUALS(KErrCancel, activeRetriever->Status().Int()) |
|
285 |
|
286 AssertMockLtsyStatusL(); |
|
287 |
|
288 |
|
289 CleanupStack::PopAndDestroy(3); |
|
290 CActiveScheduler::Install(NULL); |
|
291 CleanupStack::PopAndDestroy(3, this); // data, this |
|
292 |
|
293 } |
|
294 |
|
295 /** |
|
296 @SYMTestCaseID BA-CTSY-CBAR-RMPCB-0003 |
|
297 @SYMComponent telephony_ctsy |
|
298 @SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneCBList::Start with bad parameter data |
|
299 @SYMTestPriority High |
|
300 @SYMTestActions Invokes CRetrieveMobilePhoneCBList::Start with bad parameter data |
|
301 @SYMTestExpectedResults Pass |
|
302 @SYMTestType CT |
|
303 */ |
|
304 void CCTsyCallBarringFU::TestStart0003L() |
|
305 { |
|
306 |
|
307 OpenEtelServerL(EUseExtendedError); |
|
308 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
309 OpenPhoneL(); |
|
310 |
|
311 CFilteringActiveScheduler scheduler; |
|
312 CActiveScheduler::Install(&scheduler); |
|
313 |
|
314 OpenPhoneCBListLC(); |
|
315 |
|
316 CActiveRetriever::ResetRequestsNumber(); |
|
317 CActiveRetriever* activeRetriever = CActiveRetriever::NewLC(*iCBList); |
|
318 scheduler.AddRetrieverL(*activeRetriever); |
|
319 |
|
320 |
|
321 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllCases; |
|
322 |
|
323 //------------------------------------------------------------------------- |
|
324 // Test passing wrong condition to CRetrieveMobilePhoneCBList::Start |
|
325 //------------------------------------------------------------------------- |
|
326 |
|
327 iCBList->Start(activeRetriever->Status(), condition); |
|
328 activeRetriever->Activate(); |
|
329 scheduler.StartScheduler(); |
|
330 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
331 ASSERT_EQUALS(KErrArgument, activeRetriever->Status().Int()) |
|
332 |
|
333 AssertMockLtsyStatusL(); |
|
334 CleanupStack::PopAndDestroy(); |
|
335 CActiveScheduler::Install(NULL); |
|
336 CleanupStack::PopAndDestroy(2, this); // data, this |
|
337 |
|
338 } |
|
339 |
|
340 |
|
341 |
|
342 /** |
|
343 @SYMTestCaseID BA-CTSY-CBAR-RMPCB-0004 |
|
344 @SYMComponent telephony_ctsy |
|
345 @SYMTestCaseDesc Test support in CTSY for multiple client requests to CRetrieveMobilePhoneCBList::Start |
|
346 @SYMTestPriority High |
|
347 @SYMTestActions Invokes multiple client requests to CRetrieveMobilePhoneCBList::Start |
|
348 @SYMTestExpectedResults Pass |
|
349 @SYMTestType CT |
|
350 */ |
|
351 void CCTsyCallBarringFU::TestStart0004L() |
|
352 { |
|
353 |
|
354 |
|
355 OpenEtelServerL(EUseExtendedError); |
|
356 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
357 OpenPhoneL(); |
|
358 |
|
359 RBuf8 data; |
|
360 CleanupClosePushL(data); |
|
361 |
|
362 RBuf8 dataComplete; |
|
363 CleanupClosePushL(dataComplete); |
|
364 |
|
365 // Open second client |
|
366 RTelServer telServer2; |
|
367 TInt ret = telServer2.Connect(); |
|
368 ASSERT_EQUALS(KErrNone, ret); |
|
369 CleanupClosePushL(telServer2); |
|
370 |
|
371 RMobilePhone phone2; |
|
372 ret = phone2.Open(iTelServer,KMmTsyPhoneName); |
|
373 ASSERT_EQUALS(KErrNone, ret); |
|
374 CleanupClosePushL(phone2); |
|
375 |
|
376 |
|
377 CFilteringActiveScheduler scheduler; |
|
378 CActiveScheduler::Install(&scheduler); |
|
379 |
|
380 OpenPhoneCBListLC(); |
|
381 |
|
382 CRetrieveMobilePhoneCBList* retrieveCBList2 = CRetrieveMobilePhoneCBList::NewL(phone2); |
|
383 CleanupStack::PushL(retrieveCBList2); |
|
384 |
|
385 CActiveRetriever::ResetRequestsNumber(); |
|
386 CActiveRetriever* activeRetriever = CActiveRetriever::NewLC(*iCBList); |
|
387 scheduler.AddRetrieverL(*activeRetriever); |
|
388 |
|
389 CActiveRetriever* activeRetriever2 = CActiveRetriever::NewLC(*retrieveCBList2); |
|
390 scheduler.AddRetrieverL(*activeRetriever2); |
|
391 |
|
392 |
|
393 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
394 |
|
395 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData(condition); |
|
396 conditionData.SerialiseL(data); |
|
397 |
|
398 CMobilePhoneCBList* cbList = CMobilePhoneCBList::NewL(); |
|
399 CleanupStack::PushL(cbList); |
|
400 RMobilePhone::TMobilePhoneCBInfoEntryV1 listEntry; |
|
401 listEntry.iStatus = RMobilePhone::ECallBarringStatusActive; |
|
402 listEntry.iCondition = RMobilePhone::EBarAllIncoming; |
|
403 listEntry.iServiceGroup = RMobilePhone::EVoiceService; |
|
404 cbList->AddEntryL(listEntry); |
|
405 |
|
406 CBufBase* completeCBListBuf = cbList->StoreLC(); |
|
407 dataComplete.Create(completeCBListBuf->Ptr(0)); |
|
408 CleanupStack::PopAndDestroy(completeCBListBuf); |
|
409 |
|
410 RMobilePhone::TMobilePhoneCBCondition condition2 = RMobilePhone::EBarIncomingRoaming; |
|
411 |
|
412 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData2(condition2); |
|
413 //------------------------------------------------------------------------- |
|
414 // Test A: Test multiple clients requesting CRetrieveMobilePhoneCBList::Start |
|
415 //------------------------------------------------------------------------- |
|
416 |
|
417 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data); |
|
418 iMockLTSY.CompleteL(EMobilePhoneGetBarringStatusPhase1, KErrNone, dataComplete); |
|
419 |
|
420 iCBList->Start(activeRetriever->Status(), condition); |
|
421 activeRetriever->Activate(); |
|
422 |
|
423 retrieveCBList2->Start(activeRetriever2->Status(), condition2); |
|
424 activeRetriever2->Activate(); |
|
425 |
|
426 scheduler.StartScheduler(); |
|
427 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
428 ASSERT_EQUALS(KErrNone, activeRetriever->Status().Int()) |
|
429 ASSERT_EQUALS(KErrServerBusy, activeRetriever2->Status().Int()) |
|
430 AssertMockLtsyStatusL(); |
|
431 |
|
432 CleanupStack::PopAndDestroy(5); |
|
433 CActiveScheduler::Install(NULL); |
|
434 CleanupStack::PopAndDestroy(5, this); // phone2, telServer2, data, this |
|
435 |
|
436 } |
|
437 |
|
438 |
|
439 /** |
|
440 @SYMTestCaseID BA-CTSY-CBAR-RMPCB-0005 |
|
441 @SYMComponent telephony_ctsy |
|
442 @SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneCBList::Start with timeout |
|
443 @SYMTestPriority High |
|
444 @SYMTestActions Invokes CRetrieveMobilePhoneCBList::Start and tests for timeout |
|
445 @SYMTestExpectedResults Pass |
|
446 @SYMTestType CT |
|
447 */ |
|
448 void CCTsyCallBarringFU::TestStart0005L() |
|
449 { |
|
450 |
|
451 |
|
452 OpenEtelServerL(EUseExtendedError); |
|
453 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
454 OpenPhoneL(); |
|
455 |
|
456 RBuf8 data; |
|
457 CleanupClosePushL(data); |
|
458 |
|
459 CFilteringActiveScheduler scheduler; |
|
460 CActiveScheduler::Install(&scheduler); |
|
461 |
|
462 OpenPhoneCBListLC(); |
|
463 |
|
464 CActiveRetriever::ResetRequestsNumber(); |
|
465 CActiveRetriever* activeRetriever = CActiveRetriever::NewLC(*iCBList); |
|
466 scheduler.AddRetrieverL(*activeRetriever); |
|
467 |
|
468 |
|
469 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
470 |
|
471 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData(condition); |
|
472 conditionData.SerialiseL(data); |
|
473 |
|
474 //------------------------------------------------------------------------- |
|
475 // Test A: Test timeout of CRetrieveMobilePhoneCBList::Start |
|
476 //------------------------------------------------------------------------- |
|
477 |
|
478 |
|
479 iMockLTSY.ExpectL(EMobilePhoneGetBarringStatusPhase1, data); |
|
480 iCBList->Start(activeRetriever->Status(), condition); |
|
481 activeRetriever->Activate(); |
|
482 scheduler.StartScheduler(); |
|
483 ASSERT_EQUALS(0, CActiveRetriever::ResetRequestsNumber()); |
|
484 ASSERT_EQUALS(KErrTimedOut, activeRetriever->Status().Int()) |
|
485 AssertMockLtsyStatusL(); |
|
486 |
|
487 CleanupStack::PopAndDestroy(2); |
|
488 CActiveScheduler::Install(NULL); |
|
489 CleanupStack::PopAndDestroy(2, this); // data, this |
|
490 } |
|
491 |
|
492 |
|
493 /** |
|
494 @SYMTestCaseID BA-CTSY-CBAR-MSSP-0001 |
|
495 @SYMComponent telephony_ctsy |
|
496 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetSSPassword |
|
497 @SYMTestPriority High |
|
498 @SYMTestActions Invokes RMobilePhone::SetSSPassword |
|
499 @SYMTestExpectedResults Pass |
|
500 @SYMTestType CT |
|
501 */ |
|
502 void CCTsyCallBarringFU::TestSetSSPassword0001L() |
|
503 { |
|
504 |
|
505 OpenEtelServerL(EUseExtendedError); |
|
506 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
507 OpenPhoneL(); |
|
508 |
|
509 RBuf8 data; |
|
510 CleanupClosePushL(data); |
|
511 |
|
512 _LIT(KOldPassword, "OldPwd"); |
|
513 _LIT(KNewPassword, "NewPwd"); |
|
514 TRequestStatus reqStatus; |
|
515 RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange; |
|
516 pwdChange.iOldPassword.Copy(KOldPassword); |
|
517 pwdChange.iNewPassword.Copy(KNewPassword); |
|
518 pwdChange.iVerifiedPassword.Copy(KNewPassword); |
|
519 TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange); |
|
520 TUint16 service = 0; |
|
521 |
|
522 TMockLtsyData2<RMobilePhone::TMobilePhonePasswordChangeV2, TUint16> ssData(pwdChange, service); |
|
523 ssData.SerialiseL(data); |
|
524 //------------------------------------------------------------------------- |
|
525 // TEST A: failure to dispatch request to LTSY |
|
526 //------------------------------------------------------------------------- |
|
527 |
|
528 iMockLTSY.ExpectL(EMobilePhoneSetSSPassword, data, KErrNotSupported); |
|
529 iPhone.SetSSPassword(reqStatus, password, service); |
|
530 User::WaitForRequest(reqStatus); |
|
531 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()) |
|
532 AssertMockLtsyStatusL(); |
|
533 |
|
534 //------------------------------------------------------------------------- |
|
535 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
536 //------------------------------------------------------------------------- |
|
537 |
|
538 iMockLTSY.ExpectL(EMobilePhoneSetSSPassword, data); |
|
539 iMockLTSY.CompleteL(EMobilePhoneSetSSPassword, KErrGeneral); |
|
540 iPhone.SetSSPassword(reqStatus, password, service); |
|
541 User::WaitForRequest(reqStatus); |
|
542 ASSERT_EQUALS(KErrGeneral, reqStatus.Int()) |
|
543 AssertMockLtsyStatusL(); |
|
544 |
|
545 //------------------------------------------------------------------------- |
|
546 // TEST C: Successful completion request of |
|
547 // RMobilePhone::SetSSPassword when result is not cached. |
|
548 //------------------------------------------------------------------------- |
|
549 |
|
550 iMockLTSY.ExpectL(EMobilePhoneSetSSPassword, data); |
|
551 iMockLTSY.CompleteL(EMobilePhoneSetSSPassword, KErrNone); |
|
552 iPhone.SetSSPassword(reqStatus, password, service); |
|
553 User::WaitForRequest(reqStatus); |
|
554 ASSERT_EQUALS(KErrNone, reqStatus.Int()) |
|
555 AssertMockLtsyStatusL(); |
|
556 |
|
557 //------------------------------------------------------------------------- |
|
558 // TEST E: Unsolicited completion of RMobilePhone::SetSSPassword |
|
559 // from LTSY. |
|
560 //------------------------------------------------------------------------- |
|
561 |
|
562 TRequestStatus mockLtsyStatus; |
|
563 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
564 iMockLTSY.CompleteL(EMobilePhoneSetSSPassword, KErrNone); |
|
565 User::WaitForRequest(mockLtsyStatus); |
|
566 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()) |
|
567 |
|
568 AssertMockLtsyStatusL(); |
|
569 CleanupStack::PopAndDestroy(2, this); // data, this |
|
570 |
|
571 } |
|
572 |
|
573 |
|
574 /** |
|
575 @SYMTestCaseID BA-CTSY-CBAR-MSSP-0002 |
|
576 @SYMComponent telephony_ctsy |
|
577 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::SetSSPassword |
|
578 @SYMTestPriority High |
|
579 @SYMTestActions Invokes cancelling of RMobilePhone::SetSSPassword |
|
580 @SYMTestExpectedResults Pass |
|
581 @SYMTestType CT |
|
582 */ |
|
583 void CCTsyCallBarringFU::TestSetSSPassword0002L() |
|
584 { |
|
585 |
|
586 // This test should test cancellation of SetSSPassword |
|
587 // If this API does not have a cancel, the test step should be completely removed. |
|
588 |
|
589 OpenEtelServerL(EUseExtendedError); |
|
590 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
591 OpenPhoneL(); |
|
592 |
|
593 TRequestStatus mockLtsyStatus; |
|
594 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
595 |
|
596 RBuf8 data; |
|
597 CleanupClosePushL(data); |
|
598 |
|
599 |
|
600 _LIT(KOldPassword, "OldPwd"); |
|
601 _LIT(KNewPassword, "NewPwd"); |
|
602 TRequestStatus reqStatus; |
|
603 RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange; |
|
604 pwdChange.iOldPassword.Copy(KOldPassword); |
|
605 pwdChange.iNewPassword.Copy(KNewPassword); |
|
606 pwdChange.iVerifiedPassword.Copy(KNewPassword); |
|
607 TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange); |
|
608 TUint16 service = 0; |
|
609 |
|
610 TMockLtsyData2<RMobilePhone::TMobilePhonePasswordChangeV2, TUint16> ssData(pwdChange, service); |
|
611 ssData.SerialiseL(data); |
|
612 //------------------------------------------------------------------------- |
|
613 // Test cancelling of RMobilePhone::SetSSPassword |
|
614 //------------------------------------------------------------------------- |
|
615 |
|
616 iMockLTSY.ExpectL(EMobilePhoneSetSSPassword, data); |
|
617 iMockLTSY.CompleteL(EMobilePhoneSetSSPassword, KErrNone, 20); |
|
618 iPhone.SetSSPassword(reqStatus, password, service); |
|
619 iPhone.CancelAsyncRequest(EMobilePhoneSetSSPassword); |
|
620 |
|
621 User::WaitForRequest(mockLtsyStatus); |
|
622 User::WaitForRequest(reqStatus); |
|
623 ASSERT_EQUALS(KErrCancel, reqStatus.Int()) |
|
624 AssertMockLtsyStatusL(); |
|
625 |
|
626 CleanupStack::PopAndDestroy(2); // data, this |
|
627 |
|
628 } |
|
629 |
|
630 |
|
631 /** |
|
632 @SYMTestCaseID BA-CTSY-CBAR-MSSP-0003 |
|
633 @SYMComponent telephony_ctsy |
|
634 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetSSPassword with bad parameter data |
|
635 @SYMTestPriority High |
|
636 @SYMTestActions Invokes RMobilePhone::SetSSPassword with bad parameter data |
|
637 @SYMTestExpectedResults Pass |
|
638 @SYMTestType CT |
|
639 */ |
|
640 void CCTsyCallBarringFU::TestSetSSPassword0003L() |
|
641 { |
|
642 |
|
643 // This test should test sending bad parameter data for SetSSPassword |
|
644 // If this API does not have any parameters, then remove this test completely. |
|
645 |
|
646 OpenEtelServerL(EUseExtendedError); |
|
647 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
648 OpenPhoneL(); |
|
649 |
|
650 RBuf8 data; |
|
651 CleanupClosePushL(data); |
|
652 |
|
653 _LIT(KOldPassword, "OldPwd"); |
|
654 _LIT(KNewPassword, "NewPwd"); |
|
655 TRequestStatus reqStatus; |
|
656 RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange; |
|
657 pwdChange.iOldPassword.Copy(KOldPassword); |
|
658 pwdChange.iNewPassword.Copy(KNewPassword); |
|
659 pwdChange.iVerifiedPassword.Copy(KNewPassword); |
|
660 TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange); |
|
661 TInt service = -666; |
|
662 |
|
663 TMockLtsyData2<RMobilePhone::TMobilePhonePasswordChangeV2, TInt> ssData(pwdChange, service); |
|
664 ssData.SerialiseL(data); |
|
665 //------------------------------------------------------------------------- |
|
666 // Test C: Test passing out of bounds parameters to |
|
667 // RMobilePhone::SetSSPassword |
|
668 //------------------------------------------------------------------------- |
|
669 |
|
670 iPhone.SetSSPassword(reqStatus, password, service); |
|
671 User::WaitForRequest(reqStatus); |
|
672 ASSERT_EQUALS(KErrArgument, reqStatus.Int()) |
|
673 |
|
674 |
|
675 // Done ! |
|
676 CleanupStack::PopAndDestroy(2, this); // data, this |
|
677 } |
|
678 |
|
679 |
|
680 /** |
|
681 @SYMTestCaseID BA-CTSY-CBAR-MSSP-0004 |
|
682 @SYMComponent telephony_ctsy |
|
683 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::SetSSPassword |
|
684 @SYMTestPriority High |
|
685 @SYMTestActions Invokes multiple client requests to RMobilePhone::SetSSPassword |
|
686 @SYMTestExpectedResults Pass |
|
687 @SYMTestType CT |
|
688 */ |
|
689 void CCTsyCallBarringFU::TestSetSSPassword0004L() |
|
690 { |
|
691 |
|
692 |
|
693 OpenEtelServerL(EUseExtendedError); |
|
694 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
695 OpenPhoneL(); |
|
696 |
|
697 RBuf8 data; |
|
698 CleanupClosePushL(data); |
|
699 |
|
700 // Open second client |
|
701 RTelServer telServer2; |
|
702 TInt ret = telServer2.Connect(); |
|
703 ASSERT_EQUALS(KErrNone, ret); |
|
704 CleanupClosePushL(telServer2); |
|
705 |
|
706 RMobilePhone phone2; |
|
707 ret = phone2.Open(iTelServer,KMmTsyPhoneName); |
|
708 ASSERT_EQUALS(KErrNone, ret); |
|
709 CleanupClosePushL(phone2); |
|
710 |
|
711 _LIT(KOldPassword, "OldPwd"); |
|
712 _LIT(KNewPassword, "NewPwd"); |
|
713 TRequestStatus reqStatus; |
|
714 RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange; |
|
715 pwdChange.iOldPassword.Copy(KOldPassword); |
|
716 pwdChange.iNewPassword.Copy(KNewPassword); |
|
717 pwdChange.iVerifiedPassword.Copy(KNewPassword); |
|
718 TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange); |
|
719 TUint16 service = 0; |
|
720 |
|
721 TMockLtsyData2<RMobilePhone::TMobilePhonePasswordChangeV2, TUint16> ssData(pwdChange, service); |
|
722 ssData.SerialiseL(data); |
|
723 |
|
724 |
|
725 _LIT(KOldPassword2, "OldPwd2"); |
|
726 _LIT(KNewPassword2, "NewPwd2"); |
|
727 TRequestStatus reqStatus2; |
|
728 RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange2; |
|
729 pwdChange2.iOldPassword.Copy(KOldPassword2); |
|
730 pwdChange2.iNewPassword.Copy(KNewPassword2); |
|
731 pwdChange2.iVerifiedPassword.Copy(KNewPassword2); |
|
732 TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password2(pwdChange2); |
|
733 TUint16 service2 = 1; |
|
734 //------------------------------------------------------------------------- |
|
735 // Test A: Test multiple clients requesting RMobilePhone::SetSSPassword |
|
736 //------------------------------------------------------------------------- |
|
737 |
|
738 iMockLTSY.ExpectL(EMobilePhoneSetSSPassword, data); |
|
739 iMockLTSY.CompleteL(EMobilePhoneSetSSPassword, KErrNone); |
|
740 iPhone.SetSSPassword(reqStatus, password, service); |
|
741 phone2.SetSSPassword(reqStatus2, password2, service2); |
|
742 User::WaitForRequest(reqStatus); |
|
743 ASSERT_EQUALS(KErrNone, reqStatus.Int()) |
|
744 User::WaitForRequest(reqStatus2); |
|
745 ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int()) |
|
746 |
|
747 AssertMockLtsyStatusL(); |
|
748 // Done ! |
|
749 CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data2, data, this |
|
750 } |
|
751 |
|
752 |
|
753 /** |
|
754 @SYMTestCaseID BA-CTSY-CBAR-MSSP-0005 |
|
755 @SYMComponent telephony_ctsy |
|
756 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetSSPassword with timeout |
|
757 @SYMTestPriority High |
|
758 @SYMTestActions Invokes RMobilePhone::SetSSPassword and tests for timeout |
|
759 @SYMTestExpectedResults Pass |
|
760 @SYMTestType CT |
|
761 */ |
|
762 void CCTsyCallBarringFU::TestSetSSPassword0005L() |
|
763 { |
|
764 |
|
765 |
|
766 OpenEtelServerL(EUseExtendedError); |
|
767 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
768 OpenPhoneL(); |
|
769 |
|
770 RBuf8 data; |
|
771 CleanupClosePushL(data); |
|
772 |
|
773 _LIT(KOldPassword, "OldPwd"); |
|
774 _LIT(KNewPassword, "NewPwd"); |
|
775 TRequestStatus reqStatus; |
|
776 RMobilePhone::TMobilePhonePasswordChangeV2 pwdChange; |
|
777 pwdChange.iOldPassword.Copy(KOldPassword); |
|
778 pwdChange.iNewPassword.Copy(KNewPassword); |
|
779 pwdChange.iVerifiedPassword.Copy(KNewPassword); |
|
780 TPckg<RMobilePhone::TMobilePhonePasswordChangeV2> password(pwdChange); |
|
781 TUint16 service = 0; |
|
782 |
|
783 TMockLtsyData2<RMobilePhone::TMobilePhonePasswordChangeV2, TUint16> ssData(pwdChange, service); |
|
784 ssData.SerialiseL(data); |
|
785 //------------------------------------------------------------------------- |
|
786 // Test A: Test timeout of RMobilePhone::SetSSPassword |
|
787 //------------------------------------------------------------------------- |
|
788 iMockLTSY.ExpectL(EMobilePhoneSetSSPassword, data); |
|
789 iPhone.SetSSPassword(reqStatus, password, service); |
|
790 User::WaitForRequest(reqStatus); |
|
791 ASSERT_EQUALS(KErrTimedOut, reqStatus.Int()) |
|
792 AssertMockLtsyStatusL(); |
|
793 |
|
794 // Done ! |
|
795 CleanupStack::PopAndDestroy(2, this); // data, this |
|
796 } |
|
797 |
|
798 |
|
799 /** |
|
800 @SYMTestCaseID BA-CTSY-CBAR-MGCMN-0001 |
|
801 @SYMComponent telephony_ctsy |
|
802 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetCompMethodName |
|
803 @SYMTestPriority High |
|
804 @SYMTestActions Invokes RMobilePhone::GetCompMethodName |
|
805 @SYMTestExpectedResults Pass |
|
806 @SYMTestType CT |
|
807 */ |
|
808 void CCTsyCallBarringFU::TestGetCompMethodName0001L() |
|
809 { |
|
810 |
|
811 OpenEtelServerL(EUseExtendedError); |
|
812 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
813 OpenPhoneL(); |
|
814 |
|
815 RBuf8 data; |
|
816 CleanupClosePushL(data); |
|
817 |
|
818 |
|
819 TRequestStatus reqStatus; |
|
820 RBuf alphaTag; |
|
821 TUint8 cmi = 0; |
|
822 iPhone.GetCompMethodName(reqStatus, alphaTag, cmi); |
|
823 User::WaitForRequest(reqStatus); |
|
824 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()) |
|
825 |
|
826 AssertMockLtsyStatusL(); |
|
827 CleanupStack::PopAndDestroy(2, this); // data, this |
|
828 |
|
829 } |
|
830 |
|
831 |
|
832 /** |
|
833 @SYMTestCaseID BA-CTSY-CBAR-MSCBS-0001 |
|
834 @SYMComponent telephony_ctsy |
|
835 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetCallBarringStatus |
|
836 @SYMTestPriority High |
|
837 @SYMTestActions Invokes RMobilePhone::SetCallBarringStatus |
|
838 @SYMTestExpectedResults Pass |
|
839 @SYMTestType CT |
|
840 */ |
|
841 void CCTsyCallBarringFU::TestSetCallBarringStatus0001L() |
|
842 { |
|
843 |
|
844 OpenEtelServerL(EUseExtendedError); |
|
845 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
846 OpenPhoneL(); |
|
847 |
|
848 RBuf8 data; |
|
849 CleanupClosePushL(data); |
|
850 |
|
851 _LIT(KPwd, "pass"); |
|
852 TRequestStatus reqStatus; |
|
853 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
854 RMobilePhone::TMobilePhoneCBChangeV1 info; |
|
855 info.iAction = RMobilePhone::EServiceActionActivate; |
|
856 info.iPassword.Copy(KPwd); |
|
857 info.iServiceGroup = RMobilePhone::EPacketDataService; |
|
858 |
|
859 TMockLtsyData2<RMobilePhone::TMobilePhoneCBCondition, RMobilePhone::TMobilePhoneCBChangeV1> dataToSet(condition, info); |
|
860 dataToSet.SerialiseL(data); |
|
861 //------------------------------------------------------------------------- |
|
862 // TEST A: failure to dispatch request to LTSY |
|
863 //------------------------------------------------------------------------- |
|
864 |
|
865 iMockLTSY.ExpectL(EMobilePhoneSetCallBarringStatus, data, KErrNotSupported); |
|
866 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
867 User::WaitForRequest(reqStatus); |
|
868 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()); |
|
869 AssertMockLtsyStatusL(); |
|
870 |
|
871 //------------------------------------------------------------------------- |
|
872 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
873 //------------------------------------------------------------------------- |
|
874 |
|
875 iMockLTSY.ExpectL(EMobilePhoneSetCallBarringStatus, data); |
|
876 iMockLTSY.CompleteL(EMobilePhoneSetCallBarringStatus, KErrGeneral); |
|
877 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
878 User::WaitForRequest(reqStatus); |
|
879 ASSERT_EQUALS(KErrGeneral, reqStatus.Int()); |
|
880 AssertMockLtsyStatusL(); |
|
881 |
|
882 //------------------------------------------------------------------------- |
|
883 // TEST C: Successful completion request of |
|
884 // RMobilePhone::SetCallBarringStatus when result is not cached. |
|
885 //------------------------------------------------------------------------- |
|
886 |
|
887 iMockLTSY.ExpectL(EMobilePhoneSetCallBarringStatus, data); |
|
888 iMockLTSY.CompleteL(EMobilePhoneSetCallBarringStatus, KErrNone); |
|
889 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
890 User::WaitForRequest(reqStatus); |
|
891 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
892 AssertMockLtsyStatusL(); |
|
893 |
|
894 //------------------------------------------------------------------------- |
|
895 // TEST E: Unsolicited completion of RMobilePhone::SetCallBarringStatus |
|
896 // from LTSY. |
|
897 //------------------------------------------------------------------------- |
|
898 |
|
899 TRequestStatus mockLtsyStatus; |
|
900 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
901 iMockLTSY.CompleteL(EMobilePhoneSetCallBarringStatus, KErrNone); |
|
902 User::WaitForRequest(mockLtsyStatus); |
|
903 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
904 |
|
905 AssertMockLtsyStatusL(); |
|
906 CleanupStack::PopAndDestroy(2, this); // data, this |
|
907 |
|
908 } |
|
909 |
|
910 |
|
911 /** |
|
912 @SYMTestCaseID BA-CTSY-CBAR-MSCBS-0002 |
|
913 @SYMComponent telephony_ctsy |
|
914 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::SetCallBarringStatus |
|
915 @SYMTestPriority High |
|
916 @SYMTestActions Invokes cancelling of RMobilePhone::SetCallBarringStatus |
|
917 @SYMTestExpectedResults Pass |
|
918 @SYMTestType CT |
|
919 */ |
|
920 void CCTsyCallBarringFU::TestSetCallBarringStatus0002L() |
|
921 { |
|
922 |
|
923 // This test should test cancellation of SetCallBarringStatus |
|
924 // If this API does not have a cancel, the test step should be completely removed. |
|
925 |
|
926 OpenEtelServerL(EUseExtendedError); |
|
927 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
928 OpenPhoneL(); |
|
929 |
|
930 TRequestStatus mockLtsyStatus; |
|
931 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
932 |
|
933 RBuf8 data; |
|
934 CleanupClosePushL(data); |
|
935 |
|
936 _LIT(KPwd, "pass"); |
|
937 TRequestStatus reqStatus; |
|
938 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
939 RMobilePhone::TMobilePhoneCBChangeV1 info; |
|
940 info.iAction = RMobilePhone::EServiceActionActivate; |
|
941 info.iPassword.Copy(KPwd); |
|
942 info.iServiceGroup = RMobilePhone::EPacketDataService; |
|
943 |
|
944 TMockLtsyData2<RMobilePhone::TMobilePhoneCBCondition, RMobilePhone::TMobilePhoneCBChangeV1> dataToSet(condition, info); |
|
945 dataToSet.SerialiseL(data); |
|
946 //------------------------------------------------------------------------- |
|
947 // Test cancelling of RMobilePhone::SetCallBarringStatus |
|
948 //------------------------------------------------------------------------- |
|
949 |
|
950 iMockLTSY.ExpectL(EMobilePhoneSetCallBarringStatus, data); |
|
951 iMockLTSY.CompleteL(EMobilePhoneSetCallBarringStatus, KErrNone, 20); |
|
952 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
953 iPhone.CancelAsyncRequest(EMobilePhoneSetCallBarringStatus); |
|
954 User::WaitForRequest(mockLtsyStatus); |
|
955 User::WaitForRequest(reqStatus); |
|
956 ASSERT_EQUALS(KErrCancel, reqStatus.Int()); |
|
957 AssertMockLtsyStatusL(); |
|
958 |
|
959 CleanupStack::PopAndDestroy(2); // data, this |
|
960 } |
|
961 |
|
962 |
|
963 /** |
|
964 @SYMTestCaseID BA-CTSY-CBAR-MSCBS-0003 |
|
965 @SYMComponent telephony_ctsy |
|
966 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetCallBarringStatus with bad parameter data |
|
967 @SYMTestPriority High |
|
968 @SYMTestActions Invokes RMobilePhone::SetCallBarringStatus with bad parameter data |
|
969 @SYMTestExpectedResults Pass |
|
970 @SYMTestType CT |
|
971 */ |
|
972 void CCTsyCallBarringFU::TestSetCallBarringStatus0003L() |
|
973 { |
|
974 |
|
975 // This test should test sending bad parameter data for SetCallBarringStatus |
|
976 // If this API does not have any parameters, then remove this test completely. |
|
977 |
|
978 OpenEtelServerL(EUseExtendedError); |
|
979 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
980 OpenPhoneL(); |
|
981 |
|
982 RBuf8 data; |
|
983 CleanupClosePushL(data); |
|
984 |
|
985 _LIT(KPwd, "password"); //The length of the password doesn't equal KMmTsyMaxLengthOfSSPassword. |
|
986 TRequestStatus reqStatus; |
|
987 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
988 RMobilePhone::TMobilePhoneCBChangeV1 info; |
|
989 info.iAction = RMobilePhone::EServiceActionActivate; |
|
990 info.iPassword.Copy(KPwd); |
|
991 info.iServiceGroup = RMobilePhone::EPacketDataService; |
|
992 |
|
993 //------------------------------------------------------------------------- |
|
994 // Test B: Test passing wrong descriptor size to parameter in |
|
995 // RMobilePhone::SetCallBarringStatus |
|
996 //------------------------------------------------------------------------- |
|
997 |
|
998 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
999 User::WaitForRequest(reqStatus); |
|
1000 ASSERT_EQUALS(KErrGsmSSPasswordRegistrationFailure, reqStatus.Int()) |
|
1001 |
|
1002 //Covering conditions |
|
1003 _LIT(KPwd2,"1234"); |
|
1004 info.iAction = RMobilePhone::EServiceActionInvoke; |
|
1005 info.iPassword.Copy(KPwd2); |
|
1006 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
1007 User::WaitForRequest(reqStatus); |
|
1008 ASSERT_EQUALS(KErrArgument, reqStatus.Int()) |
|
1009 |
|
1010 info.iAction = RMobilePhone::EServiceActionActivate; |
|
1011 condition = RMobilePhone::EBarAllIncomingServices; |
|
1012 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
1013 User::WaitForRequest(reqStatus); |
|
1014 ASSERT_EQUALS(KErrArgument, reqStatus.Int()) |
|
1015 |
|
1016 CleanupStack::PopAndDestroy(2, this); // data, this |
|
1017 |
|
1018 } |
|
1019 |
|
1020 |
|
1021 /** |
|
1022 @SYMTestCaseID BA-CTSY-CBAR-MSCBS-0004 |
|
1023 @SYMComponent telephony_ctsy |
|
1024 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::SetCallBarringStatus |
|
1025 @SYMTestPriority High |
|
1026 @SYMTestActions Invokes multiple client requests to RMobilePhone::SetCallBarringStatus |
|
1027 @SYMTestExpectedResults Pass |
|
1028 @SYMTestType CT |
|
1029 */ |
|
1030 void CCTsyCallBarringFU::TestSetCallBarringStatus0004L() |
|
1031 { |
|
1032 |
|
1033 |
|
1034 OpenEtelServerL(EUseExtendedError); |
|
1035 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1036 OpenPhoneL(); |
|
1037 |
|
1038 RBuf8 data; |
|
1039 CleanupClosePushL(data); |
|
1040 |
|
1041 // Open second client |
|
1042 RTelServer telServer2; |
|
1043 TInt ret = telServer2.Connect(); |
|
1044 ASSERT_EQUALS(KErrNone, ret); |
|
1045 CleanupClosePushL(telServer2); |
|
1046 |
|
1047 RMobilePhone phone2; |
|
1048 ret = phone2.Open(iTelServer,KMmTsyPhoneName); |
|
1049 ASSERT_EQUALS(KErrNone, ret); |
|
1050 CleanupClosePushL(phone2); |
|
1051 |
|
1052 _LIT(KPwd, "pass"); |
|
1053 TRequestStatus reqStatus; |
|
1054 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
1055 RMobilePhone::TMobilePhoneCBChangeV1 info; |
|
1056 info.iAction = RMobilePhone::EServiceActionActivate; |
|
1057 info.iPassword.Copy(KPwd); |
|
1058 info.iServiceGroup = RMobilePhone::EPacketDataService; |
|
1059 |
|
1060 TMockLtsyData2<RMobilePhone::TMobilePhoneCBCondition, RMobilePhone::TMobilePhoneCBChangeV1> dataToSet(condition, info); |
|
1061 dataToSet.SerialiseL(data); |
|
1062 |
|
1063 |
|
1064 _LIT(KPwd2, "abcd"); |
|
1065 TRequestStatus reqStatus2; |
|
1066 RMobilePhone::TMobilePhoneCBCondition condition2 = RMobilePhone::EBarIncomingRoaming; |
|
1067 RMobilePhone::TMobilePhoneCBChangeV1 info2; |
|
1068 info2.iAction = RMobilePhone::EServiceActionInvoke; |
|
1069 info2.iPassword.Copy(KPwd2); |
|
1070 info2.iServiceGroup = RMobilePhone::EShortMessageService; |
|
1071 |
|
1072 //------------------------------------------------------------------------- |
|
1073 // Test A: Test multiple clients requesting RMobilePhone::SetCallBarringStatus |
|
1074 //------------------------------------------------------------------------- |
|
1075 |
|
1076 iMockLTSY.ExpectL(EMobilePhoneSetCallBarringStatus, data); |
|
1077 iMockLTSY.CompleteL(EMobilePhoneSetCallBarringStatus, KErrNone); |
|
1078 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
1079 phone2.SetCallBarringStatus(reqStatus2, condition2, info2); |
|
1080 User::WaitForRequest(reqStatus); |
|
1081 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
1082 User::WaitForRequest(reqStatus2); |
|
1083 ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int()) |
|
1084 |
|
1085 AssertMockLtsyStatusL(); |
|
1086 |
|
1087 // To write this test: |
|
1088 // If this API has parameters which have different versions, then each |
|
1089 // client in this test should use a different version of parameter. |
|
1090 // Otherwise, they should use the same version. |
|
1091 // All versions of parameters should be used. i.e. If there are three |
|
1092 // versions of a parameter, there should be three clients, one using |
|
1093 // each one. If the parameter does not have different versions, use |
|
1094 // two clients each using the same version. |
|
1095 |
|
1096 |
|
1097 // Done ! |
|
1098 CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this |
|
1099 |
|
1100 } |
|
1101 |
|
1102 |
|
1103 /** |
|
1104 @SYMTestCaseID BA-CTSY-CBAR-MSCBS-0005 |
|
1105 @SYMComponent telephony_ctsy |
|
1106 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetCallBarringStatus with timeout |
|
1107 @SYMTestPriority High |
|
1108 @SYMTestActions Invokes RMobilePhone::SetCallBarringStatus and tests for timeout |
|
1109 @SYMTestExpectedResults Pass |
|
1110 @SYMTestType CT |
|
1111 */ |
|
1112 void CCTsyCallBarringFU::TestSetCallBarringStatus0005L() |
|
1113 { |
|
1114 |
|
1115 |
|
1116 OpenEtelServerL(EUseExtendedError); |
|
1117 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1118 OpenPhoneL(); |
|
1119 |
|
1120 RBuf8 data; |
|
1121 CleanupClosePushL(data); |
|
1122 |
|
1123 _LIT(KPwd, "pass"); |
|
1124 TRequestStatus reqStatus; |
|
1125 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
1126 RMobilePhone::TMobilePhoneCBChangeV1 info; |
|
1127 info.iAction = RMobilePhone::EServiceActionActivate; |
|
1128 info.iPassword.Copy(KPwd); |
|
1129 info.iServiceGroup = RMobilePhone::EPacketDataService; |
|
1130 |
|
1131 TMockLtsyData2<RMobilePhone::TMobilePhoneCBCondition, RMobilePhone::TMobilePhoneCBChangeV1> dataToSet(condition, info); |
|
1132 dataToSet.SerialiseL(data); |
|
1133 //------------------------------------------------------------------------- |
|
1134 // Test A: Test timeout of RMobilePhone::SetCallBarringStatus |
|
1135 //------------------------------------------------------------------------- |
|
1136 |
|
1137 iMockLTSY.ExpectL(EMobilePhoneSetCallBarringStatus, data); |
|
1138 iPhone.SetCallBarringStatus(reqStatus, condition, info); |
|
1139 User::WaitForRequest(reqStatus); |
|
1140 ASSERT_EQUALS(KErrTimedOut, reqStatus.Int()) |
|
1141 AssertMockLtsyStatusL(); |
|
1142 |
|
1143 // Done ! |
|
1144 CleanupStack::PopAndDestroy(2, this); // data, this |
|
1145 |
|
1146 } |
|
1147 |
|
1148 |
|
1149 /** |
|
1150 @SYMTestCaseID BA-CTSY-CBAR-MSCBP-0001 |
|
1151 @SYMComponent telephony_ctsy |
|
1152 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetCallBarringPassword |
|
1153 @SYMTestPriority High |
|
1154 @SYMTestActions Invokes RMobilePhone::SetCallBarringPassword |
|
1155 @SYMTestExpectedResults Pass |
|
1156 @SYMTestType CT |
|
1157 */ |
|
1158 void CCTsyCallBarringFU::TestSetCallBarringPassword0001L() |
|
1159 { |
|
1160 |
|
1161 OpenEtelServerL(EUseExtendedError); |
|
1162 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1163 OpenPhoneL(); |
|
1164 |
|
1165 RBuf8 data; |
|
1166 CleanupClosePushL(data); |
|
1167 |
|
1168 _LIT(KOldPwd, "old"); |
|
1169 _LIT(KNewPwd, "new"); |
|
1170 TRequestStatus reqStatus; |
|
1171 RMobilePhone::TMobilePhonePasswordChangeV1 password; |
|
1172 password.iOldPassword.Copy(KOldPwd); |
|
1173 password.iNewPassword.Copy(KNewPwd); |
|
1174 |
|
1175 iPhone.SetCallBarringPassword(reqStatus, password); |
|
1176 User::WaitForRequest(reqStatus); |
|
1177 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()) |
|
1178 |
|
1179 // Test API is not supported |
|
1180 |
|
1181 AssertMockLtsyStatusL(); |
|
1182 CleanupStack::PopAndDestroy(2, this); // data, this |
|
1183 |
|
1184 } |
|
1185 |
|
1186 |
|
1187 /** |
|
1188 @SYMTestCaseID BA-CTSY-CBAR-MNCBSC-0001 |
|
1189 @SYMComponent telephony_ctsy |
|
1190 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyCallBarringStatusChange |
|
1191 @SYMTestPriority High |
|
1192 @SYMTestActions Invokes RMobilePhone::NotifyCallBarringStatusChange |
|
1193 @SYMTestExpectedResults Pass |
|
1194 @SYMTestType CT |
|
1195 */ |
|
1196 void CCTsyCallBarringFU::TestNotifyCallBarringStatusChange0001L() |
|
1197 { |
|
1198 |
|
1199 OpenEtelServerL(EUseExtendedError); |
|
1200 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1201 OpenPhoneL(); |
|
1202 |
|
1203 RBuf8 data; |
|
1204 CleanupClosePushL(data); |
|
1205 |
|
1206 TRequestStatus reqStatus; |
|
1207 RMobilePhone::TMobilePhoneCBCondition cond; |
|
1208 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
1209 |
|
1210 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData(condition); |
|
1211 conditionData.SerialiseL(data); |
|
1212 |
|
1213 //------------------------------------------------------------------------- |
|
1214 // TEST E: Unsolicited completion of RMobilePhone::NotifyCallBarringStatusChange |
|
1215 // from LTSY. |
|
1216 //------------------------------------------------------------------------- |
|
1217 |
|
1218 TRequestStatus mockLtsyStatus; |
|
1219 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1220 iMockLTSY.CompleteL(EMobilePhoneNotifyCallBarringStatusChange, KErrNone, data); |
|
1221 User::WaitForRequest(mockLtsyStatus); |
|
1222 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()) |
|
1223 |
|
1224 AssertMockLtsyStatusL(); |
|
1225 //------------------------------------------------------------------------- |
|
1226 // TEST C: Successful completion request of |
|
1227 // RMobilePhone::NotifyCallBarringStatusChange when result is not cached. |
|
1228 //------------------------------------------------------------------------- |
|
1229 iPhone.NotifyCallBarringStatusChange(reqStatus, cond); |
|
1230 iMockLTSY.CompleteL(EMobilePhoneNotifyCallBarringStatusChange, KErrNone, data); |
|
1231 User::WaitForRequest(reqStatus); |
|
1232 ASSERT_EQUALS(KErrNone, reqStatus.Int()) |
|
1233 ASSERT_EQUALS(condition, cond) |
|
1234 AssertMockLtsyStatusL(); |
|
1235 |
|
1236 CleanupStack::PopAndDestroy(2, this); // data, this |
|
1237 |
|
1238 } |
|
1239 |
|
1240 |
|
1241 /** |
|
1242 @SYMTestCaseID BA-CTSY-CBAR-MNCBSC-0002 |
|
1243 @SYMComponent telephony_ctsy |
|
1244 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifyCallBarringStatusChange |
|
1245 @SYMTestPriority High |
|
1246 @SYMTestActions Invokes cancelling of RMobilePhone::NotifyCallBarringStatusChange |
|
1247 @SYMTestExpectedResults Pass |
|
1248 @SYMTestType CT |
|
1249 */ |
|
1250 void CCTsyCallBarringFU::TestNotifyCallBarringStatusChange0002L() |
|
1251 { |
|
1252 |
|
1253 OpenEtelServerL(EUseExtendedError); |
|
1254 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1255 OpenPhoneL(); |
|
1256 |
|
1257 TRequestStatus mockLtsyStatus; |
|
1258 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1259 |
|
1260 RBuf8 data; |
|
1261 CleanupClosePushL(data); |
|
1262 |
|
1263 TRequestStatus reqStatus; |
|
1264 RMobilePhone::TMobilePhoneCBCondition cond; |
|
1265 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
1266 |
|
1267 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData(condition); |
|
1268 conditionData.SerialiseL(data); |
|
1269 |
|
1270 //------------------------------------------------------------------------- |
|
1271 // Test cancelling of RMobilePhone::NotifyCallBarringStatusChange |
|
1272 //------------------------------------------------------------------------- |
|
1273 |
|
1274 iPhone.NotifyCallBarringStatusChange(reqStatus, cond); |
|
1275 iPhone.CancelAsyncRequest(EMobilePhoneNotifyCallBarringStatusChange); |
|
1276 iMockLTSY.CompleteL(EMobilePhoneNotifyCallBarringStatusChange, KErrNone, data); |
|
1277 User::WaitForRequest(mockLtsyStatus); |
|
1278 User::WaitForRequest(reqStatus); |
|
1279 ASSERT_EQUALS(KErrCancel, reqStatus.Int()) |
|
1280 AssertMockLtsyStatusL(); |
|
1281 |
|
1282 CleanupStack::PopAndDestroy(2); // data, this |
|
1283 |
|
1284 } |
|
1285 |
|
1286 |
|
1287 /** |
|
1288 @SYMTestCaseID BA-CTSY-CBAR-MNCBSC-0004 |
|
1289 @SYMComponent telephony_ctsy |
|
1290 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifyCallBarringStatusChange |
|
1291 @SYMTestPriority High |
|
1292 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifyCallBarringStatusChange |
|
1293 @SYMTestExpectedResults Pass |
|
1294 @SYMTestType CT |
|
1295 */ |
|
1296 void CCTsyCallBarringFU::TestNotifyCallBarringStatusChange0004L() |
|
1297 { |
|
1298 |
|
1299 |
|
1300 OpenEtelServerL(EUseExtendedError); |
|
1301 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1302 OpenPhoneL(); |
|
1303 |
|
1304 RBuf8 data; |
|
1305 CleanupClosePushL(data); |
|
1306 |
|
1307 // Open second client |
|
1308 RTelServer telServer2; |
|
1309 TInt ret = telServer2.Connect(); |
|
1310 ASSERT_EQUALS(KErrNone, ret); |
|
1311 CleanupClosePushL(telServer2); |
|
1312 |
|
1313 RMobilePhone phone2; |
|
1314 ret = phone2.Open(iTelServer,KMmTsyPhoneName); |
|
1315 ASSERT_EQUALS(KErrNone, ret); |
|
1316 CleanupClosePushL(phone2); |
|
1317 |
|
1318 TRequestStatus reqStatus; |
|
1319 RMobilePhone::TMobilePhoneCBCondition cond; |
|
1320 RMobilePhone::TMobilePhoneCBCondition condition = RMobilePhone::EBarAllIncoming; |
|
1321 |
|
1322 TMockLtsyData1<RMobilePhone::TMobilePhoneCBCondition> conditionData(condition); |
|
1323 conditionData.SerialiseL(data); |
|
1324 |
|
1325 |
|
1326 TRequestStatus reqStatus2; |
|
1327 RMobilePhone::TMobilePhoneCBCondition cond2; |
|
1328 |
|
1329 //------------------------------------------------------------------------- |
|
1330 // Test A: Test multiple clients requesting RMobilePhone::NotifyCallBarringStatusChange |
|
1331 //------------------------------------------------------------------------- |
|
1332 |
|
1333 iPhone.NotifyCallBarringStatusChange(reqStatus, cond); |
|
1334 phone2.NotifyCallBarringStatusChange(reqStatus2, cond2); |
|
1335 iMockLTSY.CompleteL(EMobilePhoneNotifyCallBarringStatusChange, KErrNone, data); |
|
1336 User::WaitForRequest(reqStatus); |
|
1337 ASSERT_EQUALS(KErrNone, reqStatus.Int()) |
|
1338 ASSERT_EQUALS(KErrNone, reqStatus2.Int()) |
|
1339 ASSERT_EQUALS(condition, cond) |
|
1340 ASSERT_EQUALS(condition, cond2) |
|
1341 AssertMockLtsyStatusL(); |
|
1342 |
|
1343 |
|
1344 // Done ! |
|
1345 CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this |
|
1346 |
|
1347 } |
|
1348 |