|
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 MailboxNumbers in the Common TSY. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "cctsymailboxnumbersfu.h" |
|
23 #include <etel.h> |
|
24 #include <etelmm.h> |
|
25 #include <et_clsvr.h> |
|
26 #include <ctsy/mmtsy_names.h> |
|
27 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
28 #include "tmockltsydata.h" |
|
29 #include <ctsy/serviceapi/gsmerror.h> |
|
30 |
|
31 CTestSuite* CCTsyMailboxNumbersFU::CreateSuiteL(const TDesC& aName) |
|
32 { |
|
33 SUB_SUITE; |
|
34 |
|
35 ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0001L); |
|
36 ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0002L); |
|
37 ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0003L); |
|
38 ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0004L); |
|
39 ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestGetMailboxNumbers0005L); |
|
40 ADD_TEST_STEP_ISO_CPP(CCTsyMailboxNumbersFU, TestNotifyMailboxNumbersChange0001L); |
|
41 |
|
42 END_SUITE; |
|
43 } |
|
44 |
|
45 |
|
46 // |
|
47 // Actual test cases |
|
48 // |
|
49 |
|
50 |
|
51 /** |
|
52 @SYMTestCaseID BA-CTSY-MBXN-MGMN-0001 |
|
53 @SYMComponent telephony_ctsy |
|
54 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetMailboxNumbers |
|
55 @SYMTestPriority High |
|
56 @SYMTestActions Invokes RMobilePhone::GetMailboxNumbers |
|
57 @SYMTestExpectedResults Pass |
|
58 @SYMTestType CT |
|
59 */ |
|
60 void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0001L() |
|
61 { |
|
62 |
|
63 OpenEtelServerL(EUseExtendedError); |
|
64 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
65 OpenPhoneL(); |
|
66 |
|
67 RBuf8 data; |
|
68 CleanupClosePushL(data); |
|
69 |
|
70 TRequestStatus reqStatus; |
|
71 |
|
72 //------------------------------------------------------------------------- |
|
73 // TEST A: failure to dispatch request to LTSY |
|
74 //------------------------------------------------------------------------- |
|
75 RMobilePhone::TMobilePhoneVoicemailIdsV3 expVoicemailIds; |
|
76 expVoicemailIds.iVoice = 1; |
|
77 expVoicemailIds.iData = 2; |
|
78 expVoicemailIds.iFax = 3; |
|
79 expVoicemailIds.iOther = 4; |
|
80 TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3> |
|
81 voicemailIdsData( expVoicemailIds ); |
|
82 voicemailIdsData.SerialiseL(data); |
|
83 iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data, KErrNotSupported); |
|
84 |
|
85 RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds; |
|
86 voicemailIds.iVoice = 1; |
|
87 voicemailIds.iData = 2; |
|
88 voicemailIds.iFax = 3; |
|
89 voicemailIds.iOther = 4; |
|
90 RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds); |
|
91 iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg); |
|
92 User::WaitForRequest(reqStatus); |
|
93 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()); |
|
94 AssertMockLtsyStatusL(); |
|
95 |
|
96 //------------------------------------------------------------------------- |
|
97 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
98 //------------------------------------------------------------------------- |
|
99 iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data); |
|
100 |
|
101 RMobilePhone::TMobilePhoneVoicemailIdsV3 completeVoicemailIds; |
|
102 TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3> |
|
103 completeVoicemailIdsData( completeVoicemailIds ); |
|
104 data.Close(); |
|
105 completeVoicemailIdsData.SerialiseL(data); |
|
106 iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrGeneral, data); |
|
107 |
|
108 iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg); |
|
109 User::WaitForRequest(reqStatus); |
|
110 ASSERT_EQUALS(KErrGeneral, reqStatus.Int()); |
|
111 AssertMockLtsyStatusL(); |
|
112 |
|
113 //------------------------------------------------------------------------- |
|
114 // TEST C: Successful completion request of |
|
115 // RMobilePhone::GetMailboxNumbers when result is not cached. |
|
116 //------------------------------------------------------------------------- |
|
117 data.Close(); |
|
118 voicemailIdsData.SerialiseL(data); |
|
119 iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data); |
|
120 |
|
121 completeVoicemailIds.iVoice = 5; |
|
122 completeVoicemailIds.iData = 6; |
|
123 completeVoicemailIds.iFax = 7; |
|
124 completeVoicemailIds.iOther = 8; |
|
125 data.Close(); |
|
126 completeVoicemailIdsData.SerialiseL(data); |
|
127 iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrNone, data); |
|
128 |
|
129 iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg); |
|
130 User::WaitForRequest(reqStatus); |
|
131 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
132 AssertMockLtsyStatusL(); |
|
133 ASSERT_EQUALS(completeVoicemailIds.iVoice, voicemailIds.iVoice); |
|
134 ASSERT_EQUALS(completeVoicemailIds.iData, voicemailIds.iData); |
|
135 ASSERT_EQUALS(completeVoicemailIds.iFax, voicemailIds.iFax); |
|
136 ASSERT_EQUALS(completeVoicemailIds.iOther, voicemailIds.iOther); |
|
137 |
|
138 //------------------------------------------------------------------------- |
|
139 // TEST E: Unsolicited completion of RMobilePhone::GetMailboxNumbers |
|
140 // from LTSY. |
|
141 //------------------------------------------------------------------------- |
|
142 iMockLTSY.NotifyTerminated(reqStatus); |
|
143 //send completion |
|
144 iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrNone, data); |
|
145 // wait for completion |
|
146 User::WaitForRequest(reqStatus); |
|
147 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
148 AssertMockLtsyStatusL(); |
|
149 |
|
150 CleanupStack::PopAndDestroy(2, this); // data, this |
|
151 |
|
152 } |
|
153 |
|
154 |
|
155 /** |
|
156 @SYMTestCaseID BA-CTSY-MBXN-MGMN-0002 |
|
157 @SYMComponent telephony_ctsy |
|
158 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::GetMailboxNumbers |
|
159 @SYMTestPriority High |
|
160 @SYMTestActions Invokes cancelling of RMobilePhone::GetMailboxNumbers |
|
161 @SYMTestExpectedResults Pass |
|
162 @SYMTestType CT |
|
163 */ |
|
164 void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0002L() |
|
165 { |
|
166 |
|
167 // This test should test cancellation of GetMailboxNumbers |
|
168 // If this API does not have a cancel, the test step should be completely removed. |
|
169 |
|
170 OpenEtelServerL(EUseExtendedError); |
|
171 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
172 OpenPhoneL(); |
|
173 |
|
174 TRequestStatus mockLtsyStatus; |
|
175 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
176 |
|
177 RBuf8 data; |
|
178 CleanupClosePushL(data); |
|
179 |
|
180 TRequestStatus reqStatus; |
|
181 |
|
182 //------------------------------------------------------------------------- |
|
183 // Test cancelling of RMobilePhone::GetMailboxNumbers |
|
184 //------------------------------------------------------------------------- |
|
185 RMobilePhone::TMobilePhoneVoicemailIdsV3 expVoicemailIds; |
|
186 TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3> expVoicemailIdsData( expVoicemailIds ); |
|
187 expVoicemailIdsData.SerialiseL(data); |
|
188 iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data); |
|
189 |
|
190 RMobilePhone::TMobilePhoneVoicemailIdsV3 completeVoicemailIds; |
|
191 TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3> |
|
192 completeVoicemailIdsData( completeVoicemailIds ); |
|
193 data.Close(); |
|
194 completeVoicemailIdsData.SerialiseL(data); |
|
195 iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrNone, data, 10); |
|
196 |
|
197 RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds; |
|
198 RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds); |
|
199 iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg); |
|
200 |
|
201 iPhone.CancelAsyncRequest(EMobilePhoneGetMailboxNumbers); |
|
202 |
|
203 User::WaitForRequest(reqStatus); |
|
204 ASSERT_EQUALS(KErrCancel, reqStatus.Int()); |
|
205 |
|
206 // Wait for completion of iMockLTSY.NotifyTerminated |
|
207 User::WaitForRequest(mockLtsyStatus); |
|
208 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
209 AssertMockLtsyStatusL(); |
|
210 |
|
211 CleanupStack::PopAndDestroy(2); // data, this |
|
212 |
|
213 } |
|
214 |
|
215 /** |
|
216 @SYMTestCaseID BA-CTSY-MBXN-MGMN-0003 |
|
217 @SYMComponent telephony_ctsy |
|
218 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetMailboxNumbers with bad parameter data |
|
219 @SYMTestPriority High |
|
220 @SYMTestActions Invokes RMobilePhone::GetMailboxNumbers with bad parameter data |
|
221 @SYMTestExpectedResults Pass |
|
222 @SYMTestType CT |
|
223 */ |
|
224 void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0003L() |
|
225 { |
|
226 |
|
227 OpenEtelServerL(EUseExtendedError); |
|
228 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
229 OpenPhoneL(); |
|
230 |
|
231 TRequestStatus reqStatus; |
|
232 |
|
233 //------------------------------------------------------------------------- |
|
234 // Test B: Test passing wrong descriptor size to parameter in |
|
235 // RMobilePhone::GetMailboxNumbers |
|
236 //------------------------------------------------------------------------- |
|
237 TInt wrongVoicemailIds; |
|
238 TPckg<TInt> wrongVoicemailIdsPckg(wrongVoicemailIds); |
|
239 iPhone.GetMailboxNumbers(reqStatus, wrongVoicemailIdsPckg); |
|
240 User::WaitForRequest(reqStatus); |
|
241 ASSERT_EQUALS(KErrArgument, reqStatus.Int()); |
|
242 AssertMockLtsyStatusL(); |
|
243 |
|
244 // Done ! |
|
245 CleanupStack::PopAndDestroy(this); |
|
246 |
|
247 } |
|
248 |
|
249 |
|
250 /** |
|
251 @SYMTestCaseID BA-CTSY-MBXN-MGMN-0004 |
|
252 @SYMComponent telephony_ctsy |
|
253 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::GetMailboxNumbers |
|
254 @SYMTestPriority High |
|
255 @SYMTestActions Invokes multiple client requests to RMobilePhone::GetMailboxNumbers |
|
256 @SYMTestExpectedResults Pass |
|
257 @SYMTestType CT |
|
258 */ |
|
259 void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0004L() |
|
260 { |
|
261 |
|
262 |
|
263 OpenEtelServerL(EUseExtendedError); |
|
264 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
265 OpenPhoneL(); |
|
266 |
|
267 RBuf8 data; |
|
268 CleanupClosePushL(data); |
|
269 |
|
270 // Open second client |
|
271 RTelServer telServer2; |
|
272 TInt ret = telServer2.Connect(); |
|
273 ASSERT_EQUALS(KErrNone, ret); |
|
274 CleanupClosePushL(telServer2); |
|
275 |
|
276 RMobilePhone phone2; |
|
277 ret = phone2.Open(telServer2, KMmTsyPhoneName); |
|
278 ASSERT_EQUALS(KErrNone, ret); |
|
279 CleanupClosePushL(phone2); |
|
280 |
|
281 //------------------------------------------------------------------------- |
|
282 // Test A: Test multiple clients requesting RMobilePhone::GetMailboxNumbers |
|
283 //------------------------------------------------------------------------- |
|
284 // setting and execute 1st request |
|
285 RMobilePhone::TMobilePhoneVoicemailIdsV3 expVoicemailIds; |
|
286 TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3> |
|
287 expVoicemailIdsData( expVoicemailIds ); |
|
288 expVoicemailIdsData.SerialiseL(data); |
|
289 iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data); |
|
290 |
|
291 RMobilePhone::TMobilePhoneVoicemailIdsV3 completeVoicemailIds; |
|
292 TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3> |
|
293 completeVoicemailIdsData( completeVoicemailIds ); |
|
294 completeVoicemailIds.iVoice = 1; |
|
295 completeVoicemailIds.iData = 2; |
|
296 completeVoicemailIds.iFax = 3; |
|
297 completeVoicemailIds.iOther = 4; |
|
298 data.Close(); |
|
299 completeVoicemailIdsData.SerialiseL(data); |
|
300 iMockLTSY.CompleteL(EMobilePhoneGetMailboxNumbers, KErrNone, data); |
|
301 |
|
302 TRequestStatus reqStatus; |
|
303 RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds; |
|
304 RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds); |
|
305 iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg); |
|
306 |
|
307 // setting and execute 2nd request |
|
308 RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds2; |
|
309 TRequestStatus reqStatus2; |
|
310 RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg2(voicemailIds2); |
|
311 phone2.GetMailboxNumbers(reqStatus2, voicemailIdsPckg2); |
|
312 |
|
313 // test completion |
|
314 User::WaitForRequest(reqStatus); |
|
315 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
316 ASSERT_EQUALS(completeVoicemailIds.iVoice, voicemailIds.iVoice); |
|
317 ASSERT_EQUALS(completeVoicemailIds.iData, voicemailIds.iData); |
|
318 ASSERT_EQUALS(completeVoicemailIds.iFax, voicemailIds.iFax); |
|
319 ASSERT_EQUALS(completeVoicemailIds.iOther, voicemailIds.iOther); |
|
320 |
|
321 User::WaitForRequest(reqStatus2); |
|
322 ASSERT_EQUALS(KErrServerBusy, reqStatus2.Int()); |
|
323 |
|
324 AssertMockLtsyStatusL(); |
|
325 // Done ! |
|
326 CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this |
|
327 |
|
328 } |
|
329 |
|
330 |
|
331 /** |
|
332 @SYMTestCaseID BA-CTSY-MBXN-MGMN-0005 |
|
333 @SYMComponent telephony_ctsy |
|
334 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetMailboxNumbers with timeout |
|
335 @SYMTestPriority High |
|
336 @SYMTestActions Invokes RMobilePhone::GetMailboxNumbers and tests for timeout |
|
337 @SYMTestExpectedResults Pass |
|
338 @SYMTestType CT |
|
339 */ |
|
340 void CCTsyMailboxNumbersFU::TestGetMailboxNumbers0005L() |
|
341 { |
|
342 |
|
343 |
|
344 OpenEtelServerL(EUseExtendedError); |
|
345 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
346 OpenPhoneL(); |
|
347 |
|
348 RBuf8 data; |
|
349 CleanupClosePushL(data); |
|
350 |
|
351 //------------------------------------------------------------------------- |
|
352 // Test A: Test timeout of RMobilePhone::GetMailboxNumbers |
|
353 //------------------------------------------------------------------------- |
|
354 RMobilePhone::TMobilePhoneVoicemailIdsV3 expVoicemailIds; |
|
355 TMockLtsyData1<RMobilePhone::TMobilePhoneVoicemailIdsV3> |
|
356 expVoicemailIdsData( expVoicemailIds ); |
|
357 expVoicemailIdsData.SerialiseL(data); |
|
358 iMockLTSY.ExpectL(EMobilePhoneGetMailboxNumbers, data); |
|
359 |
|
360 TRequestStatus reqStatus; |
|
361 RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds; |
|
362 RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds); |
|
363 iPhone.GetMailboxNumbers(reqStatus, voicemailIdsPckg); |
|
364 |
|
365 ERR_PRINTF2(_L("<font color=Orange>$CTSYKnownFailure: defect id = %d</font>"), 140102); |
|
366 User::WaitForRequest(reqStatus); |
|
367 ASSERT_EQUALS(KErrTimedOut, reqStatus.Int()); |
|
368 AssertMockLtsyStatusL(); |
|
369 |
|
370 // Done ! |
|
371 CleanupStack::PopAndDestroy(2, this); // data, this |
|
372 |
|
373 } |
|
374 |
|
375 |
|
376 /** |
|
377 @SYMTestCaseID BA-CTSY-MBXN-MNMNC-0001 |
|
378 @SYMComponent telephony_ctsy |
|
379 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyMailboxNumbersChange |
|
380 @SYMTestPriority High |
|
381 @SYMTestActions Invokes RMobilePhone::NotifyMailboxNumbersChange |
|
382 @SYMTestExpectedResults Pass |
|
383 @SYMTestType CT |
|
384 */ |
|
385 void CCTsyMailboxNumbersFU::TestNotifyMailboxNumbersChange0001L() |
|
386 { |
|
387 |
|
388 OpenEtelServerL(EUseExtendedError); |
|
389 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
390 OpenPhoneL(); |
|
391 |
|
392 TRequestStatus reqStatus; |
|
393 RMobilePhone::TMobilePhoneVoicemailIdsV3 voicemailIds; |
|
394 RMobilePhone::TMobilePhoneVoicemailIdsV3Pckg voicemailIdsPckg(voicemailIds); |
|
395 iPhone.NotifyMailboxNumbersChange(reqStatus, voicemailIdsPckg); |
|
396 User::WaitForRequest(reqStatus); |
|
397 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()); |
|
398 |
|
399 AssertMockLtsyStatusL(); |
|
400 CleanupStack::PopAndDestroy(this); |
|
401 |
|
402 } |
|
403 |
|
404 |
|
405 |