|
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 AlternateLineService in the Common TSY. |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 */ |
|
21 |
|
22 #include "cctsyalternatelineservicefu.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 #include <centralrepository.h> |
|
31 |
|
32 const TUid KCRUidCtsyMEAlsLine = { 0x102029A2 }; |
|
33 const TUint KCtsyMEAlsSupported = { 0x00000002 }; |
|
34 |
|
35 CTestSuite* CCTsyAlternateLineServiceFU::CreateSuiteL(const TDesC& aName) |
|
36 { |
|
37 SUB_SUITE; |
|
38 |
|
39 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestGetALSLine0001L); |
|
40 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestGetALSLine0005L); |
|
41 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestSetALSLine0001L); |
|
42 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestSetALSLine0004L); |
|
43 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestSetALSLine0005L); |
|
44 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestNotifyALSLineChange0001L); |
|
45 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestNotifyALSLineChange0002L); |
|
46 ADD_TEST_STEP_ISO_CPP(CCTsyAlternateLineServiceFU, TestNotifyALSLineChange0004L); |
|
47 |
|
48 END_SUITE; |
|
49 } |
|
50 |
|
51 |
|
52 // |
|
53 // Actual test cases |
|
54 // |
|
55 |
|
56 |
|
57 /** |
|
58 @SYMTestCaseID BA-CTSY-ALLS-MGAL-0001 |
|
59 @SYMComponent telephony_ctsy |
|
60 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetALSLine |
|
61 @SYMTestPriority High |
|
62 @SYMTestActions Invokes RMobilePhone::GetALSLine |
|
63 @SYMTestExpectedResults Pass |
|
64 @SYMTestType CT |
|
65 */ |
|
66 void CCTsyAlternateLineServiceFU::TestGetALSLine0001L() |
|
67 { |
|
68 |
|
69 OpenEtelServerL(EUseExtendedError); |
|
70 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
71 OpenPhoneL(); |
|
72 |
|
73 RBuf8 data; |
|
74 CleanupClosePushL(data); |
|
75 |
|
76 TInt ret(KErrGeneral); |
|
77 |
|
78 TRequestStatus requestStatus; |
|
79 |
|
80 // dont change the tests order in order to preserve the environment state |
|
81 // at the beginig of every test |
|
82 //------------------------------------------------------------------------- |
|
83 // TEST E: Unsolicited completion of RMobilePhone::GetALSLine |
|
84 // from LTSY. |
|
85 //------------------------------------------------------------------------- |
|
86 |
|
87 // create centRep to change repository |
|
88 CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); |
|
89 CleanupStack::PushL(centRep); |
|
90 |
|
91 // setting environment (set KCtsyMEAlsSupported in repository to EFalse) |
|
92 ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); |
|
93 ASSERT_EQUALS(KErrNone, ret); |
|
94 |
|
95 // Unsolicited completion with new value EAlternateLineAuxiliary that is not yet cached in CTSY |
|
96 iMockLTSY.NotifyTerminated(requestStatus); |
|
97 RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLineAuxiliary); |
|
98 TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine); |
|
99 alsLineData.SerialiseL(data); |
|
100 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); |
|
101 User::WaitForRequest(requestStatus); |
|
102 AssertMockLtsyStatusL(); |
|
103 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
104 |
|
105 // Unsolicited completion with the same value EAlternateLineAuxiliary that is cached in CTSY |
|
106 iMockLTSY.NotifyTerminated(requestStatus); |
|
107 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); |
|
108 User::WaitForRequest(requestStatus); |
|
109 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
110 AssertMockLtsyStatusL(); |
|
111 |
|
112 //------------------------------------------------------------------------- |
|
113 // TEST C: Successful completion request of |
|
114 // RMobilePhone::GetALSLine when result is not cached. |
|
115 //------------------------------------------------------------------------- |
|
116 |
|
117 // test setting and execute |
|
118 ret = iPhone.GetALSLine(alsLine); |
|
119 ASSERT_EQUALS(KErrNone, ret); |
|
120 AssertMockLtsyStatusL(); |
|
121 |
|
122 //------------------------------------------------------------------------- |
|
123 // TESTs for coverage increasing with different values of alsLine and |
|
124 // of KCtsyMEAlsSupported from repository |
|
125 //------------------------------------------------------------------------- |
|
126 // setting environment (set alsLine to EAlternateLineUnknown) |
|
127 iMockLTSY.NotifyTerminated(requestStatus); |
|
128 alsLine = RMobilePhone::EAlternateLineUnknown; |
|
129 data.Close(); |
|
130 alsLineData.SerialiseL(data); |
|
131 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); |
|
132 User::WaitForRequest(requestStatus); |
|
133 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
134 AssertMockLtsyStatusL(); |
|
135 |
|
136 // test setting and execute |
|
137 ret = iPhone.GetALSLine(alsLine); |
|
138 ASSERT_EQUALS(KErrNone, ret); |
|
139 AssertMockLtsyStatusL(); |
|
140 |
|
141 // setting environment (set KCtsyMEAlsSupported in repository to ETrue) |
|
142 ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); |
|
143 ASSERT_EQUALS(KErrNone, ret); |
|
144 |
|
145 // test setting and execute |
|
146 alsLine = RMobilePhone::EAlternateLinePrimary; |
|
147 data.Close(); |
|
148 alsLineData.SerialiseL(data); |
|
149 iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone); |
|
150 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); |
|
151 |
|
152 ret = iPhone.GetALSLine(alsLine); |
|
153 ASSERT_EQUALS(KErrNone, ret); |
|
154 ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary); |
|
155 AssertMockLtsyStatusL(); |
|
156 |
|
157 //------------------------------------------------------------------------- |
|
158 // TEST D: RMobilePhone::GetALSLine again, this time CTSY |
|
159 // will get result from the cache. |
|
160 //------------------------------------------------------------------------- |
|
161 |
|
162 ret = iPhone.GetALSLine(alsLine); |
|
163 ASSERT_EQUALS(KErrNone, ret); |
|
164 ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary); |
|
165 AssertMockLtsyStatusL(); |
|
166 |
|
167 //------------------------------------------------------------------------- |
|
168 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
169 //------------------------------------------------------------------------- |
|
170 |
|
171 // change alsLine to EAlternateLineUnknown again |
|
172 iMockLTSY.NotifyTerminated(requestStatus); |
|
173 alsLine = RMobilePhone::EAlternateLineUnknown; |
|
174 data.Close(); |
|
175 alsLineData.SerialiseL(data); |
|
176 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); |
|
177 User::WaitForRequest(requestStatus); |
|
178 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
179 AssertMockLtsyStatusL(); |
|
180 |
|
181 // test setting and execute |
|
182 iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone); |
|
183 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrGeneral, data); |
|
184 |
|
185 ret = iPhone.GetALSLine(alsLine); |
|
186 ASSERT_EQUALS(KErrGeneral, ret); |
|
187 AssertMockLtsyStatusL(); |
|
188 |
|
189 //------------------------------------------------------------------------- |
|
190 // TEST A: failure to dispatch request to LTSY |
|
191 //------------------------------------------------------------------------- |
|
192 |
|
193 //change alsLine to EAlternateLineUnknown again |
|
194 iMockLTSY.NotifyTerminated(requestStatus); |
|
195 alsLine = RMobilePhone::EAlternateLineUnknown; |
|
196 data.Close(); |
|
197 alsLineData.SerialiseL(data); |
|
198 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); |
|
199 User::WaitForRequest(requestStatus); |
|
200 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
201 AssertMockLtsyStatusL(); |
|
202 |
|
203 // test setting and execute |
|
204 iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNotSupported); |
|
205 ret = iPhone.GetALSLine(alsLine); |
|
206 ASSERT_EQUALS(KErrNotSupported, ret); |
|
207 AssertMockLtsyStatusL(); |
|
208 |
|
209 //Done! |
|
210 // return repository KCtsyMEAlsSupported to EFalse (initial state) |
|
211 ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); |
|
212 ASSERT_EQUALS(KErrNone, ret); |
|
213 |
|
214 AssertMockLtsyStatusL(); |
|
215 CleanupStack::PopAndDestroy(1); // iCentRep |
|
216 CleanupStack::PopAndDestroy(2, this); // data, this |
|
217 |
|
218 } |
|
219 |
|
220 |
|
221 /** |
|
222 @SYMTestCaseID BA-CTSY-ALLS-MGAL-0005 |
|
223 @SYMComponent telephony_ctsy |
|
224 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::GetALSLine with timeout |
|
225 @SYMTestPriority High |
|
226 @SYMTestActions Invokes RMobilePhone::GetALSLine and tests for timeout |
|
227 @SYMTestExpectedResults Pass |
|
228 @SYMTestType CT |
|
229 */ |
|
230 void CCTsyAlternateLineServiceFU::TestGetALSLine0005L() |
|
231 { |
|
232 |
|
233 OpenEtelServerL(EUseExtendedError); |
|
234 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
235 OpenPhoneL(); |
|
236 |
|
237 RBuf8 data; |
|
238 CleanupClosePushL(data); |
|
239 |
|
240 TRequestStatus requestStatus; |
|
241 TInt ret(-1); |
|
242 |
|
243 //------------------------------------------------------------------------- |
|
244 // Test A: Test timeout of RMobilePhone::GetALSLine |
|
245 //------------------------------------------------------------------------- |
|
246 |
|
247 // create centRep to change repository |
|
248 CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); |
|
249 CleanupStack::PushL(centRep); |
|
250 |
|
251 // setting environment (set KCtsyMEAlsSupported in repository to ETrue) |
|
252 ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); |
|
253 ASSERT_EQUALS(KErrNone, ret); |
|
254 |
|
255 // setting environment (set alsLine to EAlternateLinePrimary) |
|
256 iMockLTSY.NotifyTerminated(requestStatus); |
|
257 RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLineUnknown); |
|
258 TMockLtsyData1<RMobilePhone::TMobilePhoneALSLine> alsLineData(alsLine); |
|
259 alsLineData.SerialiseL(data); |
|
260 iMockLTSY.CompleteL(EMobilePhoneGetALSLine, KErrNone, data); |
|
261 User::WaitForRequest(requestStatus); |
|
262 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
263 AssertMockLtsyStatusL(); |
|
264 |
|
265 // test setting and execute |
|
266 iMockLTSY.ExpectL(EMobilePhoneGetALSLine, KErrNone); |
|
267 ret = iPhone.GetALSLine(alsLine); |
|
268 ASSERT_EQUALS(KErrTimedOut, ret); |
|
269 ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineNotAvailable); |
|
270 AssertMockLtsyStatusL(); |
|
271 |
|
272 // Done ! |
|
273 // return repository KCtsyMEAlsSupported to EFalse (initial state) |
|
274 ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); |
|
275 ASSERT_EQUALS(KErrNone, ret); |
|
276 |
|
277 AssertMockLtsyStatusL(); |
|
278 CleanupStack::PopAndDestroy(1); // iCentRep |
|
279 CleanupStack::PopAndDestroy(2, this); // data, this |
|
280 |
|
281 } |
|
282 |
|
283 |
|
284 /** |
|
285 @SYMTestCaseID BA-CTSY-ALLS-MSL-0001 |
|
286 @SYMComponent telephony_ctsy |
|
287 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetALSLine |
|
288 @SYMTestPriority High |
|
289 @SYMTestActions Invokes RMobilePhone::SetALSLine |
|
290 @SYMTestExpectedResults Pass |
|
291 @SYMTestType CT |
|
292 */ |
|
293 void CCTsyAlternateLineServiceFU::TestSetALSLine0001L() |
|
294 { |
|
295 |
|
296 OpenEtelServerL(EUseExtendedError); |
|
297 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
298 OpenPhoneL(); |
|
299 |
|
300 RBuf8 data; |
|
301 CleanupClosePushL(data); |
|
302 |
|
303 TInt ret(-1); |
|
304 TRequestStatus requestStatus; |
|
305 |
|
306 //------------------------------------------------------------------------- |
|
307 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
308 //------------------------------------------------------------------------- |
|
309 |
|
310 // create centRep to change repository |
|
311 CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); |
|
312 CleanupStack::PushL(centRep); |
|
313 |
|
314 // setting environment (set KCtsyMEAlsSupported in repository to ETrue) |
|
315 ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); |
|
316 ASSERT_EQUALS(KErrNone, ret); |
|
317 |
|
318 // test setting and execute |
|
319 RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLinePrimary); |
|
320 TMockLtsyData1< RMobilePhone::TMobilePhoneALSLine > |
|
321 alsLineData( alsLine ); |
|
322 alsLineData.SerialiseL(data); |
|
323 iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data); |
|
324 iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrGeneral); |
|
325 |
|
326 iPhone.SetALSLine(requestStatus, alsLine); |
|
327 User::WaitForRequest(requestStatus); |
|
328 ASSERT_EQUALS(KErrGeneral, requestStatus.Int()); |
|
329 AssertMockLtsyStatusL(); |
|
330 |
|
331 //------------------------------------------------------------------------- |
|
332 // TEST C: Successful completion request of |
|
333 // RMobilePhone::SetALSLine when result is not cached. |
|
334 // Case CtsyMEAlsSupported ETrue |
|
335 //------------------------------------------------------------------------- |
|
336 |
|
337 iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data); |
|
338 iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone); |
|
339 iPhone.SetALSLine(requestStatus, alsLine); |
|
340 User::WaitForRequest(requestStatus); |
|
341 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
342 AssertMockLtsyStatusL(); |
|
343 |
|
344 //------------------------------------------------------------------------- |
|
345 // TEST C: Successful completion request of |
|
346 // RMobilePhone::SetALSLine when result is not cached. |
|
347 // Case ÑtsyMEAlsSupported EFalse |
|
348 //------------------------------------------------------------------------- |
|
349 |
|
350 // setting environment (set KCtsyMEAlsSupported in repository to EFalse) |
|
351 ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); |
|
352 ASSERT_EQUALS(KErrNone, ret); |
|
353 |
|
354 // test setting and execute |
|
355 alsLine = RMobilePhone::EAlternateLinePrimary; |
|
356 iPhone.SetALSLine(requestStatus, alsLine); |
|
357 User::WaitForRequest(requestStatus); |
|
358 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
359 AssertMockLtsyStatusL(); |
|
360 |
|
361 // check test results |
|
362 ret = iPhone.GetALSLine(alsLine); |
|
363 ASSERT_EQUALS(KErrNone, ret); |
|
364 ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLinePrimary); //check |
|
365 AssertMockLtsyStatusL(); |
|
366 |
|
367 //------------------------------------------------------------------------- |
|
368 // TESTs for coverage increasing with different values of alsLine |
|
369 //------------------------------------------------------------------------- |
|
370 |
|
371 // test execute |
|
372 alsLine = RMobilePhone::EAlternateLineAuxiliary; |
|
373 iPhone.SetALSLine(requestStatus, alsLine); |
|
374 User::WaitForRequest(requestStatus); |
|
375 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
376 AssertMockLtsyStatusL(); |
|
377 |
|
378 // check test results |
|
379 ret = iPhone.GetALSLine(alsLine); |
|
380 ASSERT_EQUALS(KErrNone, ret); |
|
381 ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineAuxiliary); //check |
|
382 AssertMockLtsyStatusL(); |
|
383 |
|
384 // test execute |
|
385 alsLine = RMobilePhone::EAlternateLineUnknown; |
|
386 iPhone.SetALSLine(requestStatus, alsLine); |
|
387 User::WaitForRequest(requestStatus); |
|
388 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
389 AssertMockLtsyStatusL(); |
|
390 |
|
391 // check test results |
|
392 ret = iPhone.GetALSLine(alsLine); |
|
393 ASSERT_EQUALS(KErrNone, ret); |
|
394 ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineUnknown); //check |
|
395 AssertMockLtsyStatusL(); |
|
396 |
|
397 // test execute |
|
398 alsLine = RMobilePhone::EAlternateLineNotAvailable; |
|
399 iPhone.SetALSLine(requestStatus, alsLine); |
|
400 User::WaitForRequest(requestStatus); |
|
401 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
402 AssertMockLtsyStatusL(); |
|
403 |
|
404 // check test results |
|
405 ret = iPhone.GetALSLine(alsLine); |
|
406 ASSERT_EQUALS(KErrNone, ret); |
|
407 ASSERT_EQUALS(alsLine, RMobilePhone::EAlternateLineNotAvailable); //check |
|
408 AssertMockLtsyStatusL(); |
|
409 |
|
410 //------------------------------------------------------------------------- |
|
411 // TEST E: Unsolicited completion of RMobilePhone::SetALSLine |
|
412 // from LTSY. |
|
413 //------------------------------------------------------------------------- |
|
414 |
|
415 iMockLTSY.NotifyTerminated(requestStatus); |
|
416 iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone); |
|
417 User::WaitForRequest(requestStatus); |
|
418 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
419 AssertMockLtsyStatusL(); |
|
420 |
|
421 //------------------------------------------------------------------------- |
|
422 // TEST A: failure to dispatch request to LTSY |
|
423 //------------------------------------------------------------------------- |
|
424 |
|
425 // setting environment (set KCtsyMEAlsSupported in repository to ETrue) |
|
426 ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); |
|
427 ASSERT_EQUALS(KErrNone, ret); |
|
428 |
|
429 // test setting and execute |
|
430 data.Close(); |
|
431 alsLineData.SerialiseL(data); // serialise data here because alsLine variable is changed |
|
432 iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data, KErrNotSupported); |
|
433 iPhone.SetALSLine(requestStatus, alsLine); |
|
434 |
|
435 User::WaitForRequest(requestStatus); |
|
436 ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); |
|
437 AssertMockLtsyStatusL(); |
|
438 |
|
439 // Done ! |
|
440 // return repository KCtsyMEAlsSupported to EFalse (initial state) |
|
441 ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); |
|
442 ASSERT_EQUALS(KErrNone, ret); |
|
443 |
|
444 AssertMockLtsyStatusL(); |
|
445 CleanupStack::PopAndDestroy(1); // iCentRep |
|
446 CleanupStack::PopAndDestroy(2, this); // data, this |
|
447 |
|
448 } |
|
449 |
|
450 |
|
451 /** |
|
452 @SYMTestCaseID BA-CTSY-ALLS-MSL-0004 |
|
453 @SYMComponent telephony_ctsy |
|
454 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::SetALSLine |
|
455 @SYMTestPriority High |
|
456 @SYMTestActions Invokes multiple client requests to RMobilePhone::SetALSLine |
|
457 @SYMTestExpectedResults Pass |
|
458 @SYMTestType CT |
|
459 */ |
|
460 void CCTsyAlternateLineServiceFU::TestSetALSLine0004L() |
|
461 { |
|
462 |
|
463 OpenEtelServerL(EUseExtendedError); |
|
464 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
465 OpenPhoneL(); |
|
466 |
|
467 RBuf8 data; |
|
468 CleanupClosePushL(data); |
|
469 |
|
470 // Open second client |
|
471 RTelServer telServer2; |
|
472 TInt ret = telServer2.Connect(); |
|
473 ASSERT_EQUALS(KErrNone, ret); |
|
474 CleanupClosePushL(telServer2); |
|
475 |
|
476 RMobilePhone phone2; |
|
477 ret = phone2.Open(telServer2,KMmTsyPhoneName); |
|
478 ASSERT_EQUALS(KErrNone, ret); |
|
479 CleanupClosePushL(phone2); |
|
480 |
|
481 // create centRep to change repository |
|
482 CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); |
|
483 CleanupStack::PushL(centRep); |
|
484 |
|
485 // setting environment (set KCtsyMEAlsSupported in repository to ETrue) |
|
486 ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); |
|
487 ASSERT_EQUALS(KErrNone, ret); |
|
488 |
|
489 TRequestStatus requestStatus; |
|
490 TRequestStatus requestStatus2; |
|
491 |
|
492 //------------------------------------------------------------------------- |
|
493 // Test A: Test multiple clients requesting RMobilePhone::SetALSLine |
|
494 //------------------------------------------------------------------------- |
|
495 |
|
496 // setting and execute 1st request |
|
497 RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLinePrimary); |
|
498 TMockLtsyData1< RMobilePhone::TMobilePhoneALSLine > |
|
499 alsLineData( alsLine ); |
|
500 alsLineData.SerialiseL(data); |
|
501 iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data); |
|
502 iMockLTSY.CompleteL(EMobilePhoneSetALSLine, KErrNone); |
|
503 iPhone.SetALSLine(requestStatus, alsLine); |
|
504 |
|
505 // setting and execute 2nd request |
|
506 RMobilePhone::TMobilePhoneALSLine alsLine2(RMobilePhone::EAlternateLineAuxiliary); |
|
507 phone2.SetALSLine(requestStatus2, alsLine2); |
|
508 |
|
509 // wait for completion and check results |
|
510 User::WaitForRequest(requestStatus2); |
|
511 ASSERT_EQUALS(KErrServerBusy, requestStatus2.Int()); |
|
512 User::WaitForRequest(requestStatus); |
|
513 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
514 |
|
515 AssertMockLtsyStatusL(); |
|
516 |
|
517 // setting environment (set KCtsyMEAlsSupported in repository to ETrue) |
|
518 ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); |
|
519 ASSERT_EQUALS(KErrNone, ret); |
|
520 |
|
521 // setting and execute the test for the case when |
|
522 // KCtsyMEAlsSupported in repository is set to ETrue |
|
523 alsLine = RMobilePhone::EAlternateLinePrimary; |
|
524 iPhone.SetALSLine(requestStatus, alsLine); |
|
525 |
|
526 alsLine2 = RMobilePhone::EAlternateLineAuxiliary; |
|
527 phone2.SetALSLine(requestStatus2, alsLine2); |
|
528 |
|
529 User::WaitForRequest(requestStatus); |
|
530 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
531 User::WaitForRequest(requestStatus2); |
|
532 ASSERT_EQUALS(KErrNone, requestStatus2.Int()); |
|
533 |
|
534 AssertMockLtsyStatusL(); |
|
535 |
|
536 //Done! |
|
537 CleanupStack::PopAndDestroy(1); // iCentRep |
|
538 CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this |
|
539 |
|
540 } |
|
541 |
|
542 |
|
543 /** |
|
544 @SYMTestCaseID BA-CTSY-ALLS-MSL-0005 |
|
545 @SYMComponent telephony_ctsy |
|
546 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::SetALSLine with timeout |
|
547 @SYMTestPriority High |
|
548 @SYMTestActions Invokes RMobilePhone::SetALSLine and tests for timeout |
|
549 @SYMTestExpectedResults Pass |
|
550 @SYMTestType CT |
|
551 */ |
|
552 void CCTsyAlternateLineServiceFU::TestSetALSLine0005L() |
|
553 { |
|
554 |
|
555 OpenEtelServerL(EUseExtendedError); |
|
556 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
557 OpenPhoneL(); |
|
558 |
|
559 RBuf8 data; |
|
560 CleanupClosePushL(data); |
|
561 |
|
562 // create centRep to change repository |
|
563 CRepository* centRep = CRepository::NewL( KCRUidCtsyMEAlsLine ); |
|
564 CleanupStack::PushL(centRep); |
|
565 |
|
566 TInt ret(-1); |
|
567 // setting environment (set KCtsyMEAlsSupported in repository to ETrue) |
|
568 ret = centRep->Set( KCtsyMEAlsSupported, ETrue ); |
|
569 ASSERT_EQUALS(KErrNone, ret); |
|
570 |
|
571 TRequestStatus requestStatus; |
|
572 |
|
573 //------------------------------------------------------------------------- |
|
574 // Test A: Test timeout of RMobilePhone::SetALSLine |
|
575 //------------------------------------------------------------------------- |
|
576 |
|
577 RMobilePhone::TMobilePhoneALSLine alsLine(RMobilePhone::EAlternateLinePrimary); |
|
578 TMockLtsyData1< RMobilePhone::TMobilePhoneALSLine > |
|
579 alsLineData( alsLine ); |
|
580 alsLineData.SerialiseL(data); |
|
581 iMockLTSY.ExpectL(EMobilePhoneSetALSLine, data); |
|
582 |
|
583 iPhone.SetALSLine(requestStatus, alsLine); |
|
584 |
|
585 User::WaitForRequest(requestStatus); |
|
586 ASSERT_EQUALS(KErrTimedOut, requestStatus.Int()); |
|
587 AssertMockLtsyStatusL(); |
|
588 |
|
589 // Done ! |
|
590 // return repository KCtsyMEAlsSupported to EFalse (initial state) |
|
591 ret = centRep->Set( KCtsyMEAlsSupported, EFalse ); |
|
592 ASSERT_EQUALS(KErrNone, ret); |
|
593 |
|
594 AssertMockLtsyStatusL(); |
|
595 CleanupStack::PopAndDestroy(1); // iCentRep |
|
596 CleanupStack::PopAndDestroy(2, this); // data, this |
|
597 |
|
598 } |
|
599 |
|
600 |
|
601 /** |
|
602 @SYMTestCaseID BA-CTSY-ALLS-MNALC-0001 |
|
603 @SYMComponent telephony_ctsy |
|
604 @SYMTestCaseDesc Test support in CTSY for RMobilePhone::NotifyALSLineChange |
|
605 @SYMTestPriority High |
|
606 @SYMTestActions Invokes RMobilePhone::NotifyALSLineChange |
|
607 @SYMTestExpectedResults Pass |
|
608 @SYMTestType CT |
|
609 */ |
|
610 void CCTsyAlternateLineServiceFU::TestNotifyALSLineChange0001L() |
|
611 { |
|
612 |
|
613 OpenEtelServerL(EUseExtendedError); |
|
614 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
615 OpenPhoneL(); |
|
616 |
|
617 RBuf8 data; |
|
618 CleanupClosePushL(data); |
|
619 |
|
620 TRequestStatus requestStatus; |
|
621 |
|
622 //------------------------------------------------------------------------- |
|
623 // TEST C: Successful completion request of |
|
624 // RMobilePhone::NotifyALSLineChange when result is not cached. |
|
625 //------------------------------------------------------------------------- |
|
626 |
|
627 // call notify ALSLine change |
|
628 RMobilePhone::TMobilePhoneALSLine alsLine; |
|
629 iPhone.NotifyALSLineChange(requestStatus, alsLine); |
|
630 |
|
631 // change ALSLine |
|
632 TRequestStatus mockLtsyStatus; |
|
633 RMobilePhone::TMobilePhoneALSLine newAlsLine(RMobilePhone::EAlternateLinePrimary); |
|
634 iPhone.SetALSLine( mockLtsyStatus, newAlsLine ); |
|
635 User::WaitForRequest( mockLtsyStatus ); |
|
636 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
637 |
|
638 // wait for completion notify request and check results |
|
639 User::WaitForRequest( requestStatus ); |
|
640 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
641 ASSERT_EQUALS(RMobilePhone::EAlternateLinePrimary, alsLine); |
|
642 AssertMockLtsyStatusL(); |
|
643 |
|
644 CleanupStack::PopAndDestroy(2, this); // data, this |
|
645 |
|
646 } |
|
647 |
|
648 |
|
649 /** |
|
650 @SYMTestCaseID BA-CTSY-ALLS-MNALC-0002 |
|
651 @SYMComponent telephony_ctsy |
|
652 @SYMTestCaseDesc Test support in CTSY for cancelling of RMobilePhone::NotifyALSLineChange |
|
653 @SYMTestPriority High |
|
654 @SYMTestActions Invokes cancelling of RMobilePhone::NotifyALSLineChange |
|
655 @SYMTestExpectedResults Pass |
|
656 @SYMTestType CT |
|
657 */ |
|
658 void CCTsyAlternateLineServiceFU::TestNotifyALSLineChange0002L() |
|
659 { |
|
660 |
|
661 // This test should test cancellation of NotifyALSLineChange |
|
662 // If this API does not have a cancel, the test step should be completely removed. |
|
663 |
|
664 OpenEtelServerL(EUseExtendedError); |
|
665 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
666 OpenPhoneL(); |
|
667 |
|
668 //------------------------------------------------------------------------- |
|
669 // Test cancelling of RMobilePhone::NotifyALSLineChange |
|
670 //------------------------------------------------------------------------- |
|
671 |
|
672 RMobilePhone::TMobilePhoneALSLine alsLine; |
|
673 TRequestStatus requestStatus; |
|
674 iPhone.NotifyALSLineChange(requestStatus, alsLine); |
|
675 |
|
676 iPhone.CancelAsyncRequest(EMobilePhoneNotifyALSLineChange); |
|
677 |
|
678 User::WaitForRequest(requestStatus); |
|
679 ASSERT_EQUALS(KErrCancel, requestStatus.Int()); |
|
680 |
|
681 AssertMockLtsyStatusL(); |
|
682 |
|
683 CleanupStack::PopAndDestroy(1); // data, this |
|
684 |
|
685 } |
|
686 |
|
687 |
|
688 /** |
|
689 @SYMTestCaseID BA-CTSY-ALLS-MNALC-0004 |
|
690 @SYMComponent telephony_ctsy |
|
691 @SYMTestCaseDesc Test support in CTSY for multiple client requests to RMobilePhone::NotifyALSLineChange |
|
692 @SYMTestPriority High |
|
693 @SYMTestActions Invokes multiple client requests to RMobilePhone::NotifyALSLineChange |
|
694 @SYMTestExpectedResults Pass |
|
695 @SYMTestType CT |
|
696 */ |
|
697 void CCTsyAlternateLineServiceFU::TestNotifyALSLineChange0004L() |
|
698 { |
|
699 |
|
700 OpenEtelServerL(EUseExtendedError); |
|
701 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
702 OpenPhoneL(); |
|
703 |
|
704 RBuf8 data; |
|
705 CleanupClosePushL(data); |
|
706 |
|
707 // Open second client |
|
708 RTelServer telServer2; |
|
709 TInt ret = telServer2.Connect(); |
|
710 ASSERT_EQUALS(KErrNone, ret); |
|
711 CleanupClosePushL(telServer2); |
|
712 |
|
713 RMobilePhone phone2; |
|
714 ret = phone2.Open(telServer2,KMmTsyPhoneName); |
|
715 ASSERT_EQUALS(KErrNone, ret); |
|
716 CleanupClosePushL(phone2); |
|
717 |
|
718 //------------------------------------------------------------------------- |
|
719 // Test A: Test multiple clients requesting RMobilePhone::NotifyALSLineChange |
|
720 //------------------------------------------------------------------------- |
|
721 |
|
722 // execute 1st request |
|
723 RMobilePhone::TMobilePhoneALSLine alsLine; |
|
724 TRequestStatus requestStatus; |
|
725 iPhone.NotifyALSLineChange(requestStatus, alsLine); |
|
726 |
|
727 // execute 2nd request |
|
728 RMobilePhone::TMobilePhoneALSLine alsLine2; |
|
729 TRequestStatus requestStatus2; |
|
730 phone2.NotifyALSLineChange(requestStatus2, alsLine2); |
|
731 |
|
732 // change alsLine |
|
733 TRequestStatus mockLtsyStatus; |
|
734 RMobilePhone::TMobilePhoneALSLine newAlsLine(RMobilePhone::EAlternateLinePrimary); |
|
735 iPhone.SetALSLine( mockLtsyStatus, newAlsLine ); |
|
736 User::WaitForRequest( mockLtsyStatus ); |
|
737 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
738 |
|
739 // wait for completion notify requests and check results |
|
740 User::WaitForRequest( requestStatus ); |
|
741 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
742 ASSERT_EQUALS(RMobilePhone::EAlternateLinePrimary, alsLine); |
|
743 |
|
744 User::WaitForRequest( requestStatus2 ); |
|
745 ASSERT_EQUALS(KErrNone, requestStatus2.Int()); |
|
746 ASSERT_EQUALS(RMobilePhone::EAlternateLinePrimary, alsLine2); |
|
747 |
|
748 AssertMockLtsyStatusL(); |
|
749 // Done ! |
|
750 CleanupStack::PopAndDestroy(4, this); // phone2, telServer2, data, this |
|
751 |
|
752 } |
|
753 |
|
754 |
|
755 |
|
756 |