|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 /** |
|
19 @file The TEFUnit test suite for PhonebookControl in the Common TSY. |
|
20 */ |
|
21 |
|
22 #include "cctsyphonebookfu.h" |
|
23 #include <etel.h> |
|
24 #include <etelmm.h> |
|
25 #include <et_clsvr.h> |
|
26 |
|
27 #include <ctsy/mmtsy_names.h> |
|
28 #include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
29 #include <test/tmockltsydata.h> |
|
30 #include <ctsy/serviceapi/gsmerror.h> |
|
31 |
|
32 #include <ctsy/ltsy/cphonebookentry.h> |
|
33 |
|
34 #include <ctsy/ltsy/mltsydispatchsiminterface.h> |
|
35 #include <ctsy/ltsy/mltsydispatchsmsinterface.h> |
|
36 |
|
37 #include "mockltsyindicatorids.h" |
|
38 |
|
39 #include <ctsy/ltsy/cctsydispatchercallback.h> |
|
40 |
|
41 #include "listretrieverao.h" |
|
42 |
|
43 const TInt KReadBufLength = 400; |
|
44 const TInt KMaxTextLength = 50; |
|
45 const TInt KNewMaxTextLength = 55; |
|
46 const TInt KMaxNumberLength = 25; |
|
47 const TInt KNumberOfEnries = 100; |
|
48 |
|
49 CTestSuite* CCTsyPhonebookFU::CreateSuiteL(const TDesC& aName) |
|
50 { |
|
51 SUB_SUITE; |
|
52 |
|
53 //add use-case tests |
|
54 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0001L); |
|
55 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0002L); |
|
56 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0003L); |
|
57 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0004L); |
|
58 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0005L); |
|
59 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0006L); |
|
60 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0007L); |
|
61 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0008L); |
|
62 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0009L); |
|
63 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0010L); |
|
64 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0011L); |
|
65 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0012L); |
|
66 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0013L); |
|
67 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUseCase0014L); |
|
68 //add other unit tests |
|
69 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0001L); |
|
70 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0002L); |
|
71 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0003L); |
|
72 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0004L); |
|
73 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0005L); |
|
74 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0006L); |
|
75 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0007L); |
|
76 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0008L); |
|
77 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0009L); |
|
78 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0010L); |
|
79 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0011L); |
|
80 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookFU, TestUnit0012L); |
|
81 |
|
82 END_SUITE; |
|
83 } |
|
84 |
|
85 |
|
86 // |
|
87 // Use-case tests |
|
88 // |
|
89 |
|
90 /** |
|
91 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0001 |
|
92 @SYMComponent telephony_ctsy |
|
93 @SYMTestCaseDesc Test support in CTSY for Opening all supported phonebooks |
|
94 @SYMTestPriority High |
|
95 @SYMTestActions Opens caching and non caching phonebooks in different orders |
|
96 @SYMTestExpectedResults Pass |
|
97 @SYMTestType CT |
|
98 */ |
|
99 void CCTsyPhonebookFU::TestUseCase0001L() |
|
100 { |
|
101 CreateEntriesAndStoreDataL(); |
|
102 |
|
103 /*********************Open all phone books - caching PB first*****************************/ |
|
104 |
|
105 OpenEtelServerL(EUseExtendedError); |
|
106 |
|
107 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
108 OpenPhoneL(); |
|
109 |
|
110 RArray<DispatcherPhonebook::TPhonebook> names; |
|
111 CleanupClosePushL(names); |
|
112 names.AppendL(DispatcherPhonebook::EIccAdn); |
|
113 names.AppendL(DispatcherPhonebook::EIccFdn); |
|
114 names.AppendL(DispatcherPhonebook::EIccBdn); |
|
115 names.AppendL(DispatcherPhonebook::EIccSdn); |
|
116 names.AppendL(DispatcherPhonebook::EIccVmb); |
|
117 names.AppendL(DispatcherPhonebook::EIccMbdn); |
|
118 |
|
119 RMmCustomAPI customApi; |
|
120 OpenCustomApiLC(customApi); |
|
121 |
|
122 TInt nameCount = names.Count(); |
|
123 for(TInt i = 0; i < nameCount; ++i) |
|
124 { |
|
125 RMobilePhoneBookStore phonebookStore; |
|
126 CleanupClosePushL(phonebookStore); |
|
127 OpenPhoneBookL(names[i], phonebookStore, customApi); |
|
128 } |
|
129 |
|
130 CleanupStack::PopAndDestroy(nameCount); //the phonebooks |
|
131 CleanupStack::PopAndDestroy(&customApi); |
|
132 CleanupStack::PopAndDestroy(&names); |
|
133 CleanupStack::PopAndDestroy(this); |
|
134 |
|
135 /*********************Open all phone books - non caching PB first*****************************/ |
|
136 |
|
137 OpenEtelServerL(EUseExtendedError); |
|
138 |
|
139 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
140 OpenPhoneL(); |
|
141 |
|
142 |
|
143 CleanupClosePushL(names); |
|
144 names.AppendL(DispatcherPhonebook::EIccBdn); |
|
145 names.AppendL(DispatcherPhonebook::EIccFdn); |
|
146 names.AppendL(DispatcherPhonebook::EIccAdn); |
|
147 names.AppendL(DispatcherPhonebook::EIccSdn); |
|
148 names.AppendL(DispatcherPhonebook::EIccVmb); |
|
149 names.AppendL(DispatcherPhonebook::EIccMbdn); |
|
150 |
|
151 OpenCustomApiLC(customApi); |
|
152 |
|
153 nameCount = names.Count(); |
|
154 for(TInt j = 0; j < nameCount; ++j) |
|
155 { |
|
156 RMobilePhoneBookStore phonebookStore; |
|
157 CleanupClosePushL(phonebookStore); |
|
158 OpenPhoneBookL(names[j], phonebookStore, customApi); |
|
159 } |
|
160 |
|
161 CleanupStack::PopAndDestroy(nameCount); //the phonebooks |
|
162 CleanupStack::PopAndDestroy(&customApi); |
|
163 CleanupStack::PopAndDestroy(&names); |
|
164 CleanupStack::PopAndDestroy(this); |
|
165 } |
|
166 |
|
167 /** |
|
168 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0002 |
|
169 @SYMComponent telephony_ctsy |
|
170 @SYMTestCaseDesc Test support in CTSY for Opening all supported phonebooks interleaving the cache completes |
|
171 @SYMTestPriority High |
|
172 @SYMTestActions Open several phonebooks completing the cache operations between non caching phonebooks |
|
173 being opened. |
|
174 @SYMTestExpectedResults Pass |
|
175 @SYMTestType CT |
|
176 */ |
|
177 void CCTsyPhonebookFU::TestUseCase0002L() |
|
178 { |
|
179 OpenEtelServerL(EUseExtendedError); |
|
180 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
181 |
|
182 OpenPhoneL(); |
|
183 |
|
184 CreateEntriesAndStoreDataL(); |
|
185 |
|
186 RMmCustomAPI customApi; |
|
187 OpenCustomApiLC(customApi); |
|
188 |
|
189 TRequestStatus requestStatus; |
|
190 |
|
191 //repeat to test stored CTSY pointers are reset to NULL in the dispatcher |
|
192 for(TInt i = 0; i < 2; ++i) |
|
193 { |
|
194 RMobilePhoneBookStore adnPhoneBookStore; |
|
195 CleanupClosePushL(adnPhoneBookStore); |
|
196 |
|
197 RMobilePhoneBookStore fdnPhoneBookStore; |
|
198 CleanupClosePushL(fdnPhoneBookStore); |
|
199 |
|
200 RMobilePhoneBookStore bdnPhoneBookStore; |
|
201 CleanupClosePushL(bdnPhoneBookStore); |
|
202 |
|
203 RMobilePhoneBookStore sdnPhoneBookStore; |
|
204 CleanupClosePushL(sdnPhoneBookStore); |
|
205 |
|
206 RMobilePhoneBookStore vmbPhoneBookStore; |
|
207 CleanupClosePushL(vmbPhoneBookStore); |
|
208 |
|
209 OpenCachingPhoneBookL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,KErrNone); |
|
210 |
|
211 OpenNonCachingPhoneBookL(DispatcherPhonebook::EIccVmb,vmbPhoneBookStore,KErrNone); |
|
212 |
|
213 OpenCachingPhoneBookL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,KErrNone); |
|
214 |
|
215 OpenNonCachingPhoneBookL(DispatcherPhonebook::EIccBdn,bdnPhoneBookStore,KErrNone); |
|
216 |
|
217 //Custom API can only wait on one phonebook at a time. |
|
218 TName adnPhonebookName(PhonebookName(DispatcherPhonebook::EIccAdn)); |
|
219 customApi.NotifyPndCacheReady(requestStatus,adnPhonebookName); |
|
220 CompleteCacheL(DispatcherPhonebook::EIccAdn, KErrNone, EFalse); |
|
221 User::WaitForRequest(requestStatus); |
|
222 AssertMockLtsyStatusL(); |
|
223 |
|
224 OpenNonCachingPhoneBookL(DispatcherPhonebook::EIccSdn,sdnPhoneBookStore,KErrNone); |
|
225 |
|
226 TName fdnPhonebookName(PhonebookName(DispatcherPhonebook::EIccFdn)); |
|
227 customApi.NotifyPndCacheReady(requestStatus,fdnPhonebookName); |
|
228 CompleteCacheL(DispatcherPhonebook::EIccFdn, KErrNone, EFalse); |
|
229 User::WaitForRequest(requestStatus); |
|
230 AssertMockLtsyStatusL(); |
|
231 |
|
232 CleanupStack::PopAndDestroy(&vmbPhoneBookStore); |
|
233 CleanupStack::PopAndDestroy(&sdnPhoneBookStore); |
|
234 CleanupStack::PopAndDestroy(&bdnPhoneBookStore); |
|
235 CleanupStack::PopAndDestroy(&fdnPhoneBookStore); |
|
236 CleanupStack::PopAndDestroy(&adnPhoneBookStore); |
|
237 } |
|
238 |
|
239 CleanupStack::PopAndDestroy(&customApi); |
|
240 |
|
241 CleanupStack::PopAndDestroy(this); |
|
242 } |
|
243 |
|
244 /** |
|
245 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0003 |
|
246 @SYMComponent telephony_ctsy |
|
247 @SYMTestCaseDesc Test Read for all supported phonebooks |
|
248 @SYMTestPriority High |
|
249 @SYMTestActions Open the phone book and read all entries from caching and non-caching phonebooks - RMobilePhoneBookStore::Read() |
|
250 @SYMTestExpectedResults Pass |
|
251 @SYMTestType CT |
|
252 */ |
|
253 void CCTsyPhonebookFU::TestUseCase0003L() |
|
254 { |
|
255 OpenEtelServerL(EUseExtendedError); |
|
256 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
257 |
|
258 CreateEntriesAndStoreDataL(); |
|
259 |
|
260 OpenPhoneL(); |
|
261 |
|
262 ReadL(DispatcherPhonebook::EIccAdn,KErrNone); |
|
263 ReadL(DispatcherPhonebook::EIccAdn,KErrGeneral); |
|
264 |
|
265 ReadL(DispatcherPhonebook::EIccFdn,KErrNone); |
|
266 ReadL(DispatcherPhonebook::EIccFdn,KErrGeneral); |
|
267 |
|
268 ReadL(DispatcherPhonebook::EIccBdn,KErrNone); |
|
269 ReadL(DispatcherPhonebook::EIccBdn,KErrGeneral); |
|
270 |
|
271 ReadL(DispatcherPhonebook::EIccSdn,KErrNone); |
|
272 ReadL(DispatcherPhonebook::EIccSdn,KErrGeneral); |
|
273 |
|
274 ReadL(DispatcherPhonebook::EIccVmb,KErrNone); |
|
275 ReadL(DispatcherPhonebook::EIccVmb,KErrGeneral); |
|
276 |
|
277 ReadL(DispatcherPhonebook::EIccMbdn,KErrNone); |
|
278 ReadL(DispatcherPhonebook::EIccMbdn,KErrGeneral); |
|
279 |
|
280 CleanupStack::PopAndDestroy(this); // data, this |
|
281 } |
|
282 |
|
283 /** |
|
284 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0004 |
|
285 @SYMComponent telephony_ctsy |
|
286 @SYMTestCaseDesc Test Read for all supported phonebooks interleaving the non-cache reads |
|
287 @SYMTestPriority High |
|
288 @SYMTestActions Open all phonebooks and read enties interleaving the reads - RMobilePhoneBookStore::Read() |
|
289 @SYMTestExpectedResults Pass |
|
290 @SYMTestType CT |
|
291 */ |
|
292 void CCTsyPhonebookFU::TestUseCase0004L() |
|
293 { |
|
294 OpenEtelServerL(EUseExtendedError); |
|
295 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
296 |
|
297 CreateEntriesAndStoreDataL(); |
|
298 |
|
299 OpenPhoneL(); |
|
300 |
|
301 RMmCustomAPI customApi; |
|
302 OpenCustomApiLC(customApi); |
|
303 |
|
304 RMobilePhoneBookStore adnPhoneBookStore; |
|
305 CleanupClosePushL(adnPhoneBookStore); |
|
306 OpenPhoneBookL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,customApi); |
|
307 |
|
308 RMobilePhoneBookStore fdnPhoneBookStore; |
|
309 CleanupClosePushL(fdnPhoneBookStore); |
|
310 OpenPhoneBookL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,customApi); |
|
311 |
|
312 RMobilePhoneBookStore bdnPhoneBookStore; |
|
313 CleanupClosePushL(bdnPhoneBookStore); |
|
314 OpenPhoneBookL(DispatcherPhonebook::EIccBdn,bdnPhoneBookStore,customApi); |
|
315 |
|
316 RMobilePhoneBookStore sdnPhoneBookStore; |
|
317 CleanupClosePushL(sdnPhoneBookStore); |
|
318 OpenPhoneBookL(DispatcherPhonebook::EIccSdn,sdnPhoneBookStore,customApi); |
|
319 |
|
320 RMobilePhoneBookStore vmbPhoneBookStore; |
|
321 CleanupClosePushL(vmbPhoneBookStore); |
|
322 OpenPhoneBookL(DispatcherPhonebook::EIccVmb,vmbPhoneBookStore,customApi); |
|
323 |
|
324 RMobilePhoneBookStore mbdnPhoneBookStore; |
|
325 CleanupClosePushL(mbdnPhoneBookStore); |
|
326 OpenPhoneBookL(DispatcherPhonebook::EIccMbdn,mbdnPhoneBookStore,customApi); |
|
327 |
|
328 //repeat to test stored CTSY pointers are reset to NULL in the dispatcher |
|
329 for(TInt i = 0; i < 2; ++i) |
|
330 { |
|
331 TRequestStatus adnRequestStatus; |
|
332 TBuf8<KReadBufLength> adnData; |
|
333 ExpectNonCacheReadL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,1,1,adnRequestStatus,adnData); |
|
334 |
|
335 TRequestStatus fdnRequestStatus; |
|
336 TBuf8<KReadBufLength> fdnData; |
|
337 ExpectNonCacheReadL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,1,1,fdnRequestStatus,fdnData); |
|
338 |
|
339 TRequestStatus bdnRequestStatus; |
|
340 TBuf8<KReadBufLength> bdnData; |
|
341 ExpectNonCacheReadL(DispatcherPhonebook::EIccBdn,bdnPhoneBookStore,1,1,bdnRequestStatus,bdnData); |
|
342 |
|
343 TRequestStatus sdnRequestStatus; |
|
344 TBuf8<KReadBufLength> sdnData; |
|
345 ExpectNonCacheReadL(DispatcherPhonebook::EIccSdn,sdnPhoneBookStore,1,1,sdnRequestStatus,sdnData); |
|
346 |
|
347 TRequestStatus vmbRequestStatus; |
|
348 TBuf8<KReadBufLength> vmbData; |
|
349 ExpectNonCacheReadL(DispatcherPhonebook::EIccVmb,vmbPhoneBookStore,1,1,vmbRequestStatus,vmbData); |
|
350 |
|
351 TRequestStatus mbdnRequestStatus; |
|
352 TBuf8<KReadBufLength> mbdnData; |
|
353 ExpectNonCacheReadL(DispatcherPhonebook::EIccMbdn,mbdnPhoneBookStore,1,1,mbdnRequestStatus,mbdnData); |
|
354 |
|
355 //we now have size outstanding reads (thus six CTSY pointers held in the dispatcher) |
|
356 |
|
357 CompleteNonCacheReadL(DispatcherPhonebook::EIccAdn, 1, 1, adnRequestStatus, adnData, KErrNone); |
|
358 CompleteNonCacheReadL(DispatcherPhonebook::EIccFdn, 1, 1, fdnRequestStatus, fdnData, KErrNone); |
|
359 CompleteNonCacheReadL(DispatcherPhonebook::EIccBdn, 1, 1, bdnRequestStatus, bdnData, KErrNone); |
|
360 CompleteNonCacheReadL(DispatcherPhonebook::EIccSdn, 1, 1, sdnRequestStatus, sdnData, KErrNone); |
|
361 CompleteNonCacheReadL(DispatcherPhonebook::EIccVmb, 1, 1, vmbRequestStatus, vmbData, KErrNone); |
|
362 CompleteNonCacheReadL(DispatcherPhonebook::EIccMbdn, 1, 1, mbdnRequestStatus, mbdnData, KErrNone); |
|
363 } |
|
364 |
|
365 CleanupStack::PopAndDestroy(&mbdnPhoneBookStore); //phonebooks |
|
366 CleanupStack::PopAndDestroy(&vmbPhoneBookStore); //phonebooks |
|
367 CleanupStack::PopAndDestroy(&sdnPhoneBookStore); //phonebooks |
|
368 CleanupStack::PopAndDestroy(&bdnPhoneBookStore); //phonebooks |
|
369 CleanupStack::PopAndDestroy(&fdnPhoneBookStore); //phonebooks |
|
370 CleanupStack::PopAndDestroy(&adnPhoneBookStore); //phonebooks |
|
371 |
|
372 CleanupStack::PopAndDestroy(&customApi); |
|
373 |
|
374 CleanupStack::PopAndDestroy(this); // data, this |
|
375 |
|
376 } |
|
377 |
|
378 /** |
|
379 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0005 |
|
380 @SYMComponent telephony_ctsy |
|
381 @SYMTestCaseDesc Test support in CTSY for deleting entries from phonebooks |
|
382 @SYMTestPriority High |
|
383 @SYMTestActions Open all phone books (excluding SDN, can't be updated by user) and delete all entires one by one - RMobilePhoneBookStore::Delete() |
|
384 @SYMTestExpectedResults Pass |
|
385 @SYMTestType CT |
|
386 */ |
|
387 void CCTsyPhonebookFU::TestUseCase0005L() |
|
388 { |
|
389 OpenEtelServerL(EUseExtendedError); |
|
390 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
391 |
|
392 CreateEntriesAndStoreDataL(); |
|
393 |
|
394 OpenPhoneL(); |
|
395 |
|
396 TInt indexToDelete = 1; |
|
397 |
|
398 DeleteL(DispatcherPhonebook::EIccAdn, indexToDelete, KErrNone); |
|
399 DeleteL(DispatcherPhonebook::EIccAdn, indexToDelete, KErrNotFound); |
|
400 |
|
401 DeleteL(DispatcherPhonebook::EIccFdn, indexToDelete, KErrNone); |
|
402 DeleteL(DispatcherPhonebook::EIccFdn, indexToDelete, KErrNotFound); |
|
403 |
|
404 DeleteL(DispatcherPhonebook::EIccBdn, indexToDelete, KErrNone); |
|
405 DeleteL(DispatcherPhonebook::EIccBdn, indexToDelete, KErrNotFound); |
|
406 |
|
407 DeleteL(DispatcherPhonebook::EIccVmb, indexToDelete, KErrNone); |
|
408 DeleteL(DispatcherPhonebook::EIccVmb, indexToDelete, KErrNotFound); |
|
409 |
|
410 DeleteL(DispatcherPhonebook::EIccMbdn, indexToDelete, KErrNone); |
|
411 DeleteL(DispatcherPhonebook::EIccMbdn, indexToDelete, KErrNotFound); |
|
412 |
|
413 CleanupStack::PopAndDestroy(this); |
|
414 } |
|
415 |
|
416 |
|
417 /** |
|
418 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0006 |
|
419 @SYMComponent telephony_ctsy |
|
420 @SYMTestCaseDesc Test support in CTSY for deleting all entries from phonebooks |
|
421 @SYMTestPriority High |
|
422 @SYMTestActions Open all phonebooks (excluding SDN, can't be updated by user) and delete all the entries - RMobilePhoneBookStore::DeleteAll() |
|
423 @SYMTestExpectedResults Pass |
|
424 @SYMTestType CT |
|
425 */ |
|
426 void CCTsyPhonebookFU::TestUseCase0006L() |
|
427 { |
|
428 OpenEtelServerL(EUseExtendedError); |
|
429 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
430 |
|
431 CreateEntriesAndStoreDataL(); |
|
432 |
|
433 OpenPhoneL(); |
|
434 |
|
435 DeleteAllL(DispatcherPhonebook::EIccAdn, KErrNone); |
|
436 DeleteAllL(DispatcherPhonebook::EIccAdn, KErrNotFound); |
|
437 |
|
438 DeleteAllL(DispatcherPhonebook::EIccFdn, KErrNone); |
|
439 DeleteAllL(DispatcherPhonebook::EIccFdn, KErrNotFound); |
|
440 |
|
441 DeleteAllL(DispatcherPhonebook::EIccBdn, KErrNone); |
|
442 DeleteAllL(DispatcherPhonebook::EIccBdn, KErrNotFound); |
|
443 |
|
444 DeleteAllL(DispatcherPhonebook::EIccVmb, KErrNone); |
|
445 DeleteAllL(DispatcherPhonebook::EIccVmb, KErrNotFound); |
|
446 |
|
447 DeleteAllL(DispatcherPhonebook::EIccMbdn, KErrNone); |
|
448 DeleteAllL(DispatcherPhonebook::EIccMbdn, KErrNotFound); |
|
449 |
|
450 CleanupStack::PopAndDestroy(this); |
|
451 } |
|
452 |
|
453 /** |
|
454 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0007 |
|
455 @SYMComponent telephony_ctsy |
|
456 @SYMTestCaseDesc Test support in CTSY for writing entries to all phonebooks |
|
457 @SYMTestPriority High |
|
458 @SYMTestActions Open the phonebook and test successful and unsuccessful write operations - RMobilePhoneBookStore::Write() |
|
459 @SYMTestExpectedResults Pass |
|
460 @SYMTestType CT |
|
461 */ |
|
462 void CCTsyPhonebookFU::TestUseCase0007L() |
|
463 { |
|
464 OpenEtelServerL(EUseExtendedError); |
|
465 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
466 |
|
467 OpenPhoneL(); |
|
468 |
|
469 CreateEntriesAndStoreDataL(); |
|
470 |
|
471 CPhoneBookEntry* phoneBookEntry = CPhoneBookEntry::NewLC(); |
|
472 phoneBookEntry->SetIndex(5); |
|
473 phoneBookEntry->SetFirstName(_L("Symbian5")); |
|
474 phoneBookEntry->SetDiallingNumber(_L("123456789")); |
|
475 phoneBookEntry->AddEmailAddress(_L("a@a.com")); |
|
476 phoneBookEntry->AddSecondName(_L("secondname")); |
|
477 phoneBookEntry->AddAdditionalNumber(_L("3874387")); |
|
478 |
|
479 WriteL(DispatcherPhonebook::EIccAdn, *phoneBookEntry, KErrNone); |
|
480 WriteL(DispatcherPhonebook::EIccAdn, *phoneBookEntry, KErrOverflow); |
|
481 WriteL(DispatcherPhonebook::EIccAdn, *phoneBookEntry, KErrGsmSimServSneFull); |
|
482 WriteL(DispatcherPhonebook::EIccAdn, *phoneBookEntry, KErrGsmSimServAnrFull); |
|
483 WriteL(DispatcherPhonebook::EIccAdn, *phoneBookEntry, KErrGsmSimServEmailFull); |
|
484 |
|
485 WriteL(DispatcherPhonebook::EIccFdn, *phoneBookEntry, KErrNone); |
|
486 WriteL(DispatcherPhonebook::EIccFdn, *phoneBookEntry, KErrOverflow); |
|
487 WriteL(DispatcherPhonebook::EIccFdn, *phoneBookEntry, KErrGsmSimServSneFull); |
|
488 WriteL(DispatcherPhonebook::EIccFdn, *phoneBookEntry, KErrGsmSimServAnrFull); |
|
489 WriteL(DispatcherPhonebook::EIccFdn, *phoneBookEntry, KErrGsmSimServEmailFull); |
|
490 |
|
491 //text and number lengths are only set for adn, fdn, vmb, and mbdn phone books |
|
492 //thus we can't do the below tests |
|
493 // WriteL(DispatcherPhonebook::EIccBdn, *phoneBookEntry, KErrNone); |
|
494 // WriteL(DispatcherPhonebook::EIccSdn, *phoneBookEntry, KErrNone); |
|
495 |
|
496 WriteL(DispatcherPhonebook::EIccVmb, *phoneBookEntry, KErrNone); |
|
497 WriteL(DispatcherPhonebook::EIccVmb, *phoneBookEntry, KErrOverflow); |
|
498 WriteL(DispatcherPhonebook::EIccVmb, *phoneBookEntry, KErrGsmSimServSneFull); |
|
499 WriteL(DispatcherPhonebook::EIccVmb, *phoneBookEntry, KErrGsmSimServAnrFull); |
|
500 WriteL(DispatcherPhonebook::EIccVmb, *phoneBookEntry, KErrGsmSimServEmailFull); |
|
501 |
|
502 WriteL(DispatcherPhonebook::EIccMbdn, *phoneBookEntry, KErrNone); |
|
503 WriteL(DispatcherPhonebook::EIccMbdn, *phoneBookEntry, KErrOverflow); |
|
504 WriteL(DispatcherPhonebook::EIccMbdn, *phoneBookEntry, KErrGsmSimServSneFull); |
|
505 WriteL(DispatcherPhonebook::EIccMbdn, *phoneBookEntry, KErrGsmSimServAnrFull); |
|
506 WriteL(DispatcherPhonebook::EIccMbdn, *phoneBookEntry, KErrGsmSimServEmailFull); |
|
507 |
|
508 CleanupStack::PopAndDestroy(phoneBookEntry); |
|
509 CleanupStack::PopAndDestroy(this); |
|
510 } |
|
511 |
|
512 /** |
|
513 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0008 |
|
514 @SYMComponent telephony_ctsy |
|
515 @SYMTestCaseDesc Test support in CTSY for sending a Reset Cache IPC |
|
516 @SYMTestPriority High |
|
517 @SYMTestActions |
|
518 @SYMTestExpectedResults Pass |
|
519 @SYMTestType CT |
|
520 */ |
|
521 void CCTsyPhonebookFU::TestUseCase0008L() |
|
522 { |
|
523 OpenEtelServerL(EUseExtendedError); |
|
524 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
525 |
|
526 RBuf8 data; |
|
527 CleanupClosePushL(data); |
|
528 |
|
529 TRequestStatus requestStatus; |
|
530 |
|
531 CreateEntriesAndStoreDataL(); |
|
532 |
|
533 OpenPhoneL(); |
|
534 |
|
535 RMmCustomAPI customApi; |
|
536 OpenCustomApiLC(customApi); |
|
537 |
|
538 //the custom API state to RMmCustomAPI::ECacheNotReady |
|
539 |
|
540 RArray<DispatcherPhonebook::TPhonebook> cachingPhonebooks; |
|
541 CleanupClosePushL(cachingPhonebooks); |
|
542 cachingPhonebooks.AppendL(DispatcherPhonebook::EIccAdn); |
|
543 cachingPhonebooks.AppendL(DispatcherPhonebook::EIccFdn); |
|
544 |
|
545 // test all caching phonebooks |
|
546 for(TInt i = 0; i < cachingPhonebooks.Count(); ++i) |
|
547 { |
|
548 RMobilePhoneBookStore phoneBookStore; |
|
549 CleanupClosePushL(phoneBookStore); |
|
550 |
|
551 OpenPhoneBookL(cachingPhonebooks[i],phoneBookStore,customApi); |
|
552 |
|
553 TMockLtsyData1<DispatcherPhonebook::TPhonebook> resetCacheCompLtsyData(cachingPhonebooks[i]); |
|
554 resetCacheCompLtsyData.SerialiseL(data); |
|
555 iMockLTSY.CompleteL(KMockLtsyDispatchPhonebookStoreResetCacheIndId,KErrNone,data); |
|
556 data.Close(); |
|
557 |
|
558 WaitForMockLTSYTerminated(); |
|
559 AssertMockLtsyStatusL(); |
|
560 |
|
561 RMmCustomAPI::TPndCacheStatus cacheStatus; |
|
562 customApi.GetPndCacheStatus(requestStatus,cacheStatus,PhonebookName(cachingPhonebooks[i])); |
|
563 User::WaitForRequest(requestStatus); |
|
564 ASSERT_EQUALS(cacheStatus,RMmCustomAPI::ECacheNotReady); |
|
565 |
|
566 // destroying the phonebook store, while one of the caching phonebooks |
|
567 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
568 // message being generated by the ctsy |
|
569 |
|
570 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(cachingPhonebooks[i]); |
|
571 expLtsyData.SerialiseL(data); |
|
572 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
573 data.Close(); |
|
574 |
|
575 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
576 } |
|
577 |
|
578 CleanupStack::PopAndDestroy(&cachingPhonebooks); |
|
579 CleanupStack::PopAndDestroy(&customApi); |
|
580 CleanupStack::PopAndDestroy(2, this); // data, this |
|
581 } |
|
582 |
|
583 /** |
|
584 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0009 |
|
585 @SYMComponent telephony_ctsy |
|
586 @SYMTestCaseDesc Test support in CTSY for setting the FDN settings |
|
587 @SYMTestPriority High |
|
588 @SYMTestActions |
|
589 @SYMTestExpectedResults Pass |
|
590 @SYMTestType CT |
|
591 */ |
|
592 void CCTsyPhonebookFU::TestUseCase0009L() |
|
593 { |
|
594 OpenEtelServerL(EUseExtendedError); |
|
595 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
596 |
|
597 CreateEntriesAndStoreDataL(); |
|
598 |
|
599 OpenPhoneL(); |
|
600 |
|
601 RMmCustomAPI customApi; |
|
602 OpenCustomApiLC(customApi); |
|
603 |
|
604 RMobilePhoneBookStore phoneBookStore; |
|
605 CleanupClosePushL(phoneBookStore); |
|
606 |
|
607 OpenPhoneBookL(DispatcherPhonebook::EIccFdn,phoneBookStore,customApi); |
|
608 |
|
609 SetFdnInfoL(phoneBookStore,KErrNone); |
|
610 |
|
611 SetFdnInfoL(phoneBookStore,KErrGeneral); |
|
612 |
|
613 // destroying the phonebook store, while one of the caching phonebooks |
|
614 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
615 // message being generated by the ctsy |
|
616 |
|
617 RBuf8 data; |
|
618 CleanupClosePushL(data); |
|
619 |
|
620 DispatcherPhonebook::TPhonebook pB = DispatcherPhonebook::EIccFdn; |
|
621 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(pB); |
|
622 expLtsyData.SerialiseL(data); |
|
623 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
624 data.Close(); |
|
625 CleanupStack::PopAndDestroy(&data); |
|
626 |
|
627 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
628 CleanupStack::PopAndDestroy(&customApi); |
|
629 CleanupStack::PopAndDestroy(this); |
|
630 } |
|
631 |
|
632 /** |
|
633 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0010 |
|
634 @SYMComponent telephony_ctsy |
|
635 @SYMTestCaseDesc Test support in CTSY for getting phonebook store information |
|
636 @SYMTestPriority High |
|
637 @SYMTestActions Invokes RMobilePhoneBookStore::GetInfo() |
|
638 @SYMTestExpectedResults Pass |
|
639 @SYMTestType CT |
|
640 */ |
|
641 void CCTsyPhonebookFU::TestUseCase0010L() |
|
642 { |
|
643 OpenEtelServerL(EUseExtendedError); |
|
644 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
645 |
|
646 CreateEntriesAndStoreDataL(); |
|
647 |
|
648 OpenPhoneL(); |
|
649 |
|
650 GetInfoL(DispatcherPhonebook::EIccAdn,KErrNone); |
|
651 GetInfoL(DispatcherPhonebook::EIccAdn,KErrGeneral); |
|
652 |
|
653 GetInfoL(DispatcherPhonebook::EIccFdn,KErrNone); |
|
654 GetInfoL(DispatcherPhonebook::EIccFdn,KErrGeneral); |
|
655 |
|
656 GetInfoL(DispatcherPhonebook::EIccSdn,KErrNone); |
|
657 GetInfoL(DispatcherPhonebook::EIccSdn,KErrGeneral); |
|
658 |
|
659 //causes an ETel Panic - 5 (apparent known defect - Id 40502) |
|
660 //GetInfoL(DispatcherPhonebook::EIccBdn,KErrNone); |
|
661 //GetInfoL(DispatcherPhonebook::EIccBdn,KErrGeneral); |
|
662 |
|
663 GetInfoL(DispatcherPhonebook::EIccVmb,KErrNone); |
|
664 GetInfoL(DispatcherPhonebook::EIccVmb,KErrGeneral); |
|
665 |
|
666 GetInfoL(DispatcherPhonebook::EIccMbdn,KErrNone); |
|
667 GetInfoL(DispatcherPhonebook::EIccMbdn,KErrGeneral); |
|
668 |
|
669 CleanupStack::PopAndDestroy(this); |
|
670 } |
|
671 |
|
672 /** |
|
673 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0011 |
|
674 @SYMComponent telephony_ctsy |
|
675 @SYMTestCaseDesc Test support in CTSY for getting store information |
|
676 @SYMTestPriority High |
|
677 @SYMTestActions RMobilePhone::GetPhoneStoreInfo() |
|
678 @SYMTestExpectedResults Pass |
|
679 @SYMTestType CT |
|
680 */ |
|
681 void CCTsyPhonebookFU::TestUseCase0011L() |
|
682 { |
|
683 OpenEtelServerL(EUseExtendedError); |
|
684 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
685 |
|
686 RBuf8 data; |
|
687 CleanupClosePushL(data); |
|
688 |
|
689 TRequestStatus requestStatus; |
|
690 |
|
691 CreateEntriesAndStoreDataL(); |
|
692 OpenPhoneL(); |
|
693 |
|
694 TName storeName(KETelIccAdnPhoneBook); |
|
695 RMobilePhoneBookStore::TMobilePhoneStoreInfoV1 bookInfo; |
|
696 RMobilePhoneBookStore::TMobilePhoneStoreInfoV1Pckg bookInfoPckg(bookInfo); |
|
697 |
|
698 /********************Test Normal case******************************/ |
|
699 |
|
700 |
|
701 TDesC* storeNamePtr = &storeName; |
|
702 TMockLtsyData1<TDesC*> getInfoExpLtsyData(storeNamePtr); |
|
703 getInfoExpLtsyData.SerialiseL(data); |
|
704 iMockLTSY.ExpectL(MLtsyDispatchPhonebookGetPhoneStoreInfo::KLtsyDispatchPhonebookGetPhoneStoreInfoApiId,data); |
|
705 data.Close(); |
|
706 |
|
707 iPhone.GetPhoneStoreInfo(requestStatus,bookInfoPckg,storeName); |
|
708 |
|
709 RMobilePhoneBookStore::TMobilePhoneStoreInfoV1 compBookInfo; |
|
710 compBookInfo.iType = RMobilePhoneStore::EPhoneBookStore; |
|
711 compBookInfo.iTotalEntries = iPhonebookStoreData.iAdnTotalEntries; |
|
712 compBookInfo.iUsedEntries = iEntries.Count(); |
|
713 compBookInfo.iCaps = 0; |
|
714 compBookInfo.iName = KETelIccAdnPhoneBook; |
|
715 |
|
716 TMockLtsyData1<RMobilePhoneBookStore::TMobilePhoneStoreInfoV1> getInfoCompLtsyData(compBookInfo); |
|
717 getInfoCompLtsyData.SerialiseL(data); |
|
718 iMockLTSY.CompleteL(MLtsyDispatchPhonebookGetPhoneStoreInfo::KLtsyDispatchPhonebookGetPhoneStoreInfoApiId,KErrNone,data); |
|
719 data.Close(); |
|
720 |
|
721 User::WaitForRequest(requestStatus); |
|
722 ASSERT_EQUALS(requestStatus.Int(),KErrNone) |
|
723 |
|
724 |
|
725 ASSERT_EQUALS(compBookInfo.iType, bookInfo.iType); |
|
726 ASSERT_EQUALS(compBookInfo.iTotalEntries, bookInfo.iTotalEntries); |
|
727 ASSERT_EQUALS(compBookInfo.iUsedEntries, bookInfo.iUsedEntries); |
|
728 ASSERT_EQUALS(compBookInfo.iCaps, bookInfo.iCaps); |
|
729 ASSERT_EQUALS(compBookInfo.iName, bookInfo.iName); |
|
730 |
|
731 AssertMockLtsyStatusL(); |
|
732 |
|
733 /********************Test Error case******************************/ |
|
734 |
|
735 getInfoExpLtsyData.SerialiseL(data); |
|
736 iMockLTSY.ExpectL(MLtsyDispatchPhonebookGetPhoneStoreInfo::KLtsyDispatchPhonebookGetPhoneStoreInfoApiId,data); |
|
737 data.Close(); |
|
738 |
|
739 iPhone.GetPhoneStoreInfo(requestStatus,bookInfoPckg,storeName); |
|
740 |
|
741 const TInt KError = KErrGeneral; |
|
742 |
|
743 getInfoCompLtsyData.SerialiseL(data); |
|
744 iMockLTSY.CompleteL(MLtsyDispatchPhonebookGetPhoneStoreInfo::KLtsyDispatchPhonebookGetPhoneStoreInfoApiId,KError,data); |
|
745 data.Close(); |
|
746 |
|
747 User::WaitForRequest(requestStatus); |
|
748 ASSERT_EQUALS(requestStatus.Int(),KError) |
|
749 |
|
750 AssertMockLtsyStatusL(); |
|
751 |
|
752 |
|
753 CleanupStack::PopAndDestroy(&data); |
|
754 CleanupStack::PopAndDestroy(this); |
|
755 } |
|
756 |
|
757 /** |
|
758 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0012 |
|
759 @SYMComponent telephony_ctsy |
|
760 @SYMTestCaseDesc Test support in CTSY for a SIM refresh of the Cached phonebooks |
|
761 @SYMTestPriority High |
|
762 @SYMTestActions Invokes SIM refresh IPC, |
|
763 @SYMTestExpectedResults Pass |
|
764 @SYMTestType CT |
|
765 */ |
|
766 void CCTsyPhonebookFU::TestUseCase0012L() |
|
767 { |
|
768 OpenEtelServerL(EUseExtendedError); |
|
769 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
770 |
|
771 CreateEntriesAndStoreDataL(); |
|
772 OpenPhoneL(); |
|
773 |
|
774 RMmCustomAPI customApi; |
|
775 OpenCustomApiLC(customApi); |
|
776 |
|
777 |
|
778 //open the caching phonebooks |
|
779 RMobilePhoneBookStore adnPhoneBookStore; |
|
780 CleanupClosePushL(adnPhoneBookStore); |
|
781 OpenPhoneBookL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,customApi); |
|
782 |
|
783 RMobilePhoneBookStore fdnPhoneBookStore; |
|
784 CleanupClosePushL(fdnPhoneBookStore); |
|
785 OpenPhoneBookL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,customApi); |
|
786 |
|
787 |
|
788 //test the refresh |
|
789 |
|
790 //add a new entry |
|
791 CPhoneBookEntry* phoneBookEntry = CPhoneBookEntry::NewLC(); |
|
792 iEntries.AppendL(phoneBookEntry); |
|
793 CleanupStack::Pop(phoneBookEntry); //takes ownership |
|
794 phoneBookEntry->SetIndex(5); |
|
795 phoneBookEntry->SetFirstName(_L("Symbian4")); |
|
796 phoneBookEntry->SetDiallingNumber(_L("897654321")); |
|
797 phoneBookEntry->AddEmailAddress(_L("symbian1@symbian.com11")); |
|
798 phoneBookEntry->AddSecondName(_L("Phone book311")); |
|
799 phoneBookEntry->AddAdditionalNumber(_L("12311")); |
|
800 |
|
801 iPhonebookStoreData.iAdnTotalEntries = iEntries.Count(); |
|
802 iPhonebookStoreData.iFdnTotalEntries = iEntries.Count(); |
|
803 |
|
804 RefreshL(DispatcherPhonebook::EIccAdn); |
|
805 //test the refresh changed the CTSY state |
|
806 GetInfoFromCtsy(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,iEntries.Count()); |
|
807 ReadL(DispatcherPhonebook::EIccAdn,adnPhoneBookStore,KErrNone); |
|
808 |
|
809 RefreshL(DispatcherPhonebook::EIccFdn); |
|
810 //test the refresh changed the CTSY state |
|
811 GetInfoFromCtsy(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,iEntries.Count()); |
|
812 ReadL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,KErrNone); |
|
813 |
|
814 CleanupStack::PopAndDestroy(&fdnPhoneBookStore); |
|
815 CleanupStack::PopAndDestroy(&adnPhoneBookStore); |
|
816 CleanupStack::PopAndDestroy(&customApi); |
|
817 CleanupStack::PopAndDestroy(this); // data, this |
|
818 } |
|
819 |
|
820 /** |
|
821 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0013 |
|
822 @SYMComponent telephony_ctsy |
|
823 @SYMTestCaseDesc Test support in CTSY for RMobileSmsStore::Write(), RMobileSmsStore::Read(), RMobileSmsStore::GetInfo() and RMobileSmsStore::Delete() |
|
824 @SYMTestPriority High |
|
825 @SYMTestActions Invokes RMobileSmsStore::Write(), RMobileSmsStore::Read(), RMobileSmsStore::GetInfo() and RMobileSmsStore::Delete() |
|
826 @SYMTestExpectedResults Pass |
|
827 @SYMTestType CT |
|
828 */ |
|
829 void CCTsyPhonebookFU::TestUseCase0013L() |
|
830 { |
|
831 OpenEtelServerL(EUseExtendedError); |
|
832 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
833 OpenPhoneL(); |
|
834 |
|
835 TRequestStatus requestStatus; |
|
836 |
|
837 // open the message store |
|
838 RMobileSmsMessaging messaging; |
|
839 CleanupClosePushL(messaging); |
|
840 |
|
841 RMobileSmsStore smsStore; |
|
842 CleanupClosePushL(smsStore); |
|
843 |
|
844 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
845 |
|
846 RBuf8 expData; |
|
847 CleanupClosePushL(expData); |
|
848 |
|
849 RBuf8 completeData; |
|
850 CleanupClosePushL(completeData); |
|
851 |
|
852 //------------------------------------------------------------------------- |
|
853 // RMobileSmsStore::Write() |
|
854 //------------------------------------------------------------------------- |
|
855 |
|
856 TInt index = 0; |
|
857 |
|
858 RMobileSmsStore::TMobileGsmSmsEntryV1 entryV1; |
|
859 TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckgEntryV1(entryV1); |
|
860 |
|
861 entryV1.iServiceCentre.iNumberPlan = RMobilePhone::ENationalNumberPlan; |
|
862 entryV1.iServiceCentre.iTypeOfNumber = RMobilePhone::EAlphanumericNumber; |
|
863 entryV1.iServiceCentre.iTelNumber = _L("TelNumber1"); |
|
864 entryV1.iMsgData = _L8("Hello, World!"); |
|
865 entryV1.iMsgStatus = RMobileSmsStore::EStoredMessageUnread; |
|
866 entryV1.iIndex = index; |
|
867 |
|
868 TMockLtsyData1<RMobileSmsStore::TMobileGsmSmsEntryV1> |
|
869 expMockData1(entryV1); |
|
870 |
|
871 TInt location = 0; |
|
872 TBool receivedClass2ToBeResent = ETrue; |
|
873 |
|
874 TMockLtsyData2<TInt, TBool> completeMockData2(location, receivedClass2ToBeResent); |
|
875 |
|
876 expData.Close(); |
|
877 expMockData1.SerialiseL(expData); |
|
878 completeData.Close(); |
|
879 completeMockData2.SerialiseL(completeData); |
|
880 |
|
881 |
|
882 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, expData); |
|
883 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, KErrNone, completeData); |
|
884 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); |
|
885 |
|
886 smsStore.Write(requestStatus, pckgEntryV1); |
|
887 |
|
888 User::WaitForRequest(requestStatus); |
|
889 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
890 ASSERT_EQUALS(entryV1.iIndex, location); |
|
891 AssertMockLtsyStatusL(); |
|
892 |
|
893 //------------------------------------------------------------------------- |
|
894 // RMobileSmsStore::Read() |
|
895 //------------------------------------------------------------------------- |
|
896 |
|
897 |
|
898 TMockLtsyData1<TInt> mockIndex(index); |
|
899 |
|
900 DispatcherPhonebook::TSmsData smsData; |
|
901 |
|
902 smsData.iSmsMsg= _L8("Hello, World!"); |
|
903 smsData.iServiceCentre = _L("ServiceCenter1"); |
|
904 smsData.iMobileScTON = RMobilePhone::EAlphanumericNumber; |
|
905 smsData.iMobileScNPI = RMobilePhone::ENationalNumberPlan; |
|
906 smsData.iMessageStatus = RMobileSmsStore::EStoredMessageUnread; |
|
907 |
|
908 TMockLtsyData1<DispatcherPhonebook::TSmsData> mockMsg(smsData); |
|
909 |
|
910 completeData.Close(); |
|
911 mockMsg.SerialiseL(completeData); |
|
912 |
|
913 RMobileSmsStore::TMobileGsmSmsEntryV1 entryV1Read; |
|
914 entryV1Read.iIndex=index; |
|
915 TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckgEntryV1Read(entryV1Read); |
|
916 |
|
917 TMockLtsyData1<TInt> mockIndexRead(index); |
|
918 expData.Close(); |
|
919 mockIndexRead.SerialiseL(expData); |
|
920 |
|
921 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, expData); |
|
922 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, KErrNone, completeData); |
|
923 |
|
924 smsStore.Read(requestStatus, pckgEntryV1Read); |
|
925 User::WaitForRequest(requestStatus); |
|
926 AssertMockLtsyStatusL(); |
|
927 |
|
928 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
929 ASSERT_EQUALS(0, smsData.iSmsMsg.Compare(entryV1Read.iMsgData)); |
|
930 ASSERT_EQUALS(0, smsData.iServiceCentre.Compare(entryV1Read.iServiceCentre.iTelNumber)); |
|
931 ASSERT_EQUALS(smsData.iMobileScTON, entryV1Read.iServiceCentre.iTypeOfNumber); |
|
932 ASSERT_EQUALS(smsData.iMobileScNPI, entryV1Read.iServiceCentre.iNumberPlan); |
|
933 ASSERT_EQUALS(RMobileSmsStore::EStoredMessageRead, entryV1Read.iMsgStatus); |
|
934 |
|
935 //------------------------------------------------------------------------- |
|
936 // RMobileSmsStore::GetInfo() |
|
937 //------------------------------------------------------------------------- |
|
938 |
|
939 TInt totalEntries = 1; |
|
940 TInt usedEntries = 0; |
|
941 TMockLtsyData2<TInt,TInt> smsStoreGetInfoLtsyData(totalEntries, usedEntries); |
|
942 completeData.Close(); |
|
943 smsStoreGetInfoLtsyData.SerialiseL(completeData); |
|
944 |
|
945 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId); |
|
946 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrNone, completeData); |
|
947 |
|
948 RMobilePhoneBookStore::TMobilePhoneBookInfoV1 phoneBookInfoV1; |
|
949 TPckg<RMobilePhoneBookStore::TMobilePhoneBookInfoV1> pckgInfoV1(phoneBookInfoV1); |
|
950 smsStore.GetInfo(requestStatus, pckgInfoV1); |
|
951 User::WaitForRequest(requestStatus); |
|
952 AssertMockLtsyStatusL(); |
|
953 |
|
954 ASSERT_EQUALS(requestStatus.Int(),KErrNone); |
|
955 ASSERT_EQUALS(phoneBookInfoV1.iTotalEntries, totalEntries); |
|
956 ASSERT_EQUALS(phoneBookInfoV1.iUsedEntries, usedEntries); |
|
957 |
|
958 //------------------------------------------------------------------------- |
|
959 // RMobileSmsStore::Delete() |
|
960 //------------------------------------------------------------------------- |
|
961 |
|
962 TMockLtsyData1<TInt> expMockData1Delete(index); |
|
963 expMockData1Delete.SerialiseL(expData); |
|
964 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, expData); |
|
965 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, KErrNone); |
|
966 |
|
967 smsStore.Delete(requestStatus, index); |
|
968 |
|
969 User::WaitForRequest(requestStatus); |
|
970 |
|
971 AssertMockLtsyStatusL(); |
|
972 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
973 |
|
974 CleanupStack::PopAndDestroy(5, this); // expData, completeData, |
|
975 // smsStore, messaging, this |
|
976 } |
|
977 |
|
978 /** |
|
979 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UC0014 |
|
980 @SYMComponent telephony_ctsy |
|
981 @SYMTestCaseDesc Test support in CTSY for RMobileSmsStore::Write(), RMobileSmsStore::Write(), RMobileSmsStore::GetInfo(), CRetrieveMobilePhoneSmsList::Start() and RMobileSmsStore::DealeteAll() |
|
982 @SYMTestPriority High |
|
983 @SYMTestActions Invokes RMobileSmsStore::Write(), RMobileSmsStore::Write(), RMobileSmsStore::GetInfo(), CRetrieveMobilePhoneSmsList::Start() and RMobileSmsStore::DealeteAll() |
|
984 @SYMTestExpectedResults Pass |
|
985 @SYMTestType CT |
|
986 */ |
|
987 void CCTsyPhonebookFU::TestUseCase0014L() |
|
988 { |
|
989 OpenEtelServerL(EUseExtendedError); |
|
990 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
991 OpenPhoneL(); |
|
992 |
|
993 TRequestStatus requestStatus; |
|
994 |
|
995 // open the message store |
|
996 RMobileSmsMessaging messaging; |
|
997 CleanupClosePushL(messaging); |
|
998 |
|
999 RMobileSmsStore smsStore; |
|
1000 CleanupClosePushL(smsStore); |
|
1001 |
|
1002 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
1003 |
|
1004 RBuf8 expData; |
|
1005 CleanupClosePushL(expData); |
|
1006 |
|
1007 RBuf8 completeData; |
|
1008 CleanupClosePushL(completeData); |
|
1009 |
|
1010 //------------------------------------------------------------------------- |
|
1011 // RMobileSmsStore::Write() |
|
1012 //------------------------------------------------------------------------- |
|
1013 |
|
1014 TInt index1 = 0; |
|
1015 RMobileSmsStore::TMobileGsmSmsEntryV1 entry1V1; |
|
1016 TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckg1EntryV1(entry1V1); |
|
1017 |
|
1018 entry1V1.iServiceCentre.iNumberPlan = RMobilePhone::ENationalNumberPlan; |
|
1019 entry1V1.iServiceCentre.iTypeOfNumber = RMobilePhone::EAlphanumericNumber; |
|
1020 entry1V1.iServiceCentre.iTelNumber = _L("TelNumber1"); |
|
1021 entry1V1.iMsgData = _L8("Hello, World!"); |
|
1022 entry1V1.iMsgStatus = RMobileSmsStore::EStoredMessageUnread; |
|
1023 entry1V1.iIndex = index1; |
|
1024 |
|
1025 TMockLtsyData1<RMobileSmsStore::TMobileGsmSmsEntryV1> |
|
1026 expMockData1Write1(entry1V1); |
|
1027 |
|
1028 TInt location1 = 0; |
|
1029 TBool receivedClass2ToBeResent1 = EFalse; |
|
1030 |
|
1031 TMockLtsyData2<TInt, TBool> completeMockData2Write1(location1, receivedClass2ToBeResent1); |
|
1032 |
|
1033 expData.Close(); |
|
1034 expMockData1Write1.SerialiseL(expData); |
|
1035 completeData.Close(); |
|
1036 completeMockData2Write1.SerialiseL(completeData); |
|
1037 |
|
1038 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, expData); |
|
1039 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, KErrNone, completeData); |
|
1040 |
|
1041 smsStore.Write(requestStatus, pckg1EntryV1); |
|
1042 |
|
1043 User::WaitForRequest(requestStatus); |
|
1044 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
1045 ASSERT_EQUALS(entry1V1.iIndex, location1); |
|
1046 AssertMockLtsyStatusL(); |
|
1047 |
|
1048 //------------------------------------------------------------------------- |
|
1049 // RMobileSmsStore::Write() |
|
1050 //------------------------------------------------------------------------- |
|
1051 |
|
1052 TInt index2 = 1; |
|
1053 RMobileSmsStore::TMobileGsmSmsEntryV1 entry2V1; |
|
1054 TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckg2EntryV1(entry2V1); |
|
1055 |
|
1056 entry2V1.iServiceCentre.iNumberPlan = RMobilePhone::EServiceCentreSpecificPlan2; |
|
1057 entry2V1.iServiceCentre.iTypeOfNumber = RMobilePhone::ESubscriberNumber; |
|
1058 entry2V1.iServiceCentre.iTelNumber = _L("TelNumber2"); |
|
1059 entry2V1.iMsgData = _L8("Hello, World number 2!"); |
|
1060 entry2V1.iMsgStatus = RMobileSmsStore::EStoredMessageUnread; |
|
1061 entry2V1.iIndex = index2; |
|
1062 |
|
1063 TMockLtsyData1<RMobileSmsStore::TMobileGsmSmsEntryV1> |
|
1064 expMockData1Write2(entry2V1); |
|
1065 |
|
1066 TInt location2 = 1; |
|
1067 TBool receivedClass2ToBeResent2 = ETrue; |
|
1068 |
|
1069 TMockLtsyData2<TInt, TBool> completeMockData2Write2(location2, receivedClass2ToBeResent2); |
|
1070 |
|
1071 expData.Close(); |
|
1072 expMockData1Write2.SerialiseL(expData); |
|
1073 completeData.Close(); |
|
1074 completeMockData2Write2.SerialiseL(completeData); |
|
1075 |
|
1076 |
|
1077 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, expData); |
|
1078 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, KErrNone, completeData); |
|
1079 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); //because receivedClass2ToBeResent1 = ETrue; |
|
1080 |
|
1081 smsStore.Write(requestStatus, pckg2EntryV1); |
|
1082 |
|
1083 User::WaitForRequest(requestStatus); |
|
1084 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
1085 ASSERT_EQUALS(entry2V1.iIndex, location2); |
|
1086 AssertMockLtsyStatusL(); |
|
1087 |
|
1088 //------------------------------------------------------------------------- |
|
1089 // RMobileSmsStore::GetInfo() |
|
1090 //------------------------------------------------------------------------- |
|
1091 |
|
1092 TInt totalEntries = 2; |
|
1093 TInt usedEntries = 0; |
|
1094 TMockLtsyData2<TInt,TInt> smsStoreGetInfoLtsyData(totalEntries, usedEntries); |
|
1095 completeData.Close(); |
|
1096 smsStoreGetInfoLtsyData.SerialiseL(completeData); |
|
1097 |
|
1098 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId); |
|
1099 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrNone, completeData); |
|
1100 |
|
1101 RMobilePhoneBookStore::TMobilePhoneBookInfoV1 phoneBookInfoV1; |
|
1102 TPckg<RMobilePhoneBookStore::TMobilePhoneBookInfoV1> pckgInfoV1(phoneBookInfoV1); |
|
1103 smsStore.GetInfo(requestStatus, pckgInfoV1); |
|
1104 User::WaitForRequest(requestStatus); |
|
1105 |
|
1106 ASSERT_EQUALS(requestStatus.Int(),KErrNone); |
|
1107 ASSERT_EQUALS(phoneBookInfoV1.iTotalEntries, totalEntries); |
|
1108 ASSERT_EQUALS(phoneBookInfoV1.iUsedEntries, usedEntries); |
|
1109 |
|
1110 AssertMockLtsyStatusL(); |
|
1111 |
|
1112 //------------------------------------------------------------------------- |
|
1113 // CRetrieveMobilePhoneSmsList::Start |
|
1114 //------------------------------------------------------------------------- |
|
1115 |
|
1116 CGetSMSListAO* getSmsListAO = CGetSMSListAO::NewLC(smsStore); |
|
1117 |
|
1118 TBool receivedClass2ToBeResent = ETrue; |
|
1119 |
|
1120 DispatcherPhonebook::TSmsData smsData1; |
|
1121 |
|
1122 smsData1.iSmsMsg= _L8("Hello, World!"); |
|
1123 smsData1.iServiceCentre = _L("TelNumber1"); |
|
1124 smsData1.iMobileScTON = RMobilePhone::EAlphanumericNumber; |
|
1125 smsData1.iMobileScNPI = RMobilePhone::ENationalNumberPlan; |
|
1126 smsData1.iMessageStatus = RMobileSmsStore::EStoredMessageUnread; |
|
1127 |
|
1128 TBool moreToCome1 = ETrue; |
|
1129 |
|
1130 TMockLtsyData4<DispatcherPhonebook::TSmsData, TInt, TBool, TBool> completeSmsMsgLtsyData1(smsData1, index1, moreToCome1, receivedClass2ToBeResent); |
|
1131 |
|
1132 DispatcherPhonebook::TSmsData smsData2; |
|
1133 |
|
1134 smsData2.iSmsMsg= _L8("Hello, World number 2!"); |
|
1135 smsData2.iServiceCentre = _L("TelNumber2"); |
|
1136 smsData2.iMobileScTON = RMobilePhone::ESubscriberNumber; |
|
1137 smsData2.iMobileScNPI = RMobilePhone::EServiceCentreSpecificPlan2; |
|
1138 smsData2.iMessageStatus = RMobileSmsStore::EStoredMessageUnread; |
|
1139 |
|
1140 TBool moreToCome2 = EFalse; |
|
1141 |
|
1142 TMockLtsyData4<DispatcherPhonebook::TSmsData, TInt, TBool, TBool> completeSmsMsgLtsyData2(smsData2, index2, moreToCome2, receivedClass2ToBeResent); |
|
1143 |
|
1144 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone); |
|
1145 //complete with 1st sms data |
|
1146 completeData.Close(); |
|
1147 completeSmsMsgLtsyData1.SerialiseL(completeData); |
|
1148 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone, completeData); |
|
1149 //complete with 2nd sms data |
|
1150 completeData.Close(); |
|
1151 completeSmsMsgLtsyData2.SerialiseL(completeData); |
|
1152 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone, completeData); |
|
1153 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); |
|
1154 |
|
1155 getSmsListAO->TestRetrieveL(); |
|
1156 ASSERT_EQUALS(KErrNone, getSmsListAO->RetrieveLastError()); |
|
1157 //assert: |
|
1158 RMobileSmsStore::TMobileGsmSmsEntryV1 retrievedSmsMsg; |
|
1159 CMobilePhoneGsmSmsList* gsmSmsList; |
|
1160 gsmSmsList=getSmsListAO->RetrieveListL(); |
|
1161 retrievedSmsMsg=gsmSmsList->GetEntryL(0); |
|
1162 |
|
1163 ASSERT_EQUALS(0, smsData1.iSmsMsg.Compare(retrievedSmsMsg.iMsgData)); |
|
1164 ASSERT_EQUALS(0, smsData1.iServiceCentre.Compare(retrievedSmsMsg.iServiceCentre.iTelNumber)); |
|
1165 ASSERT_EQUALS(retrievedSmsMsg.iServiceCentre.iTypeOfNumber, smsData1.iMobileScTON); |
|
1166 ASSERT_EQUALS(retrievedSmsMsg.iServiceCentre.iNumberPlan, smsData1.iMobileScNPI); |
|
1167 ASSERT_EQUALS(retrievedSmsMsg.iMsgStatus, RMobileSmsStore::EStoredMessageRead); |
|
1168 ASSERT_EQUALS(retrievedSmsMsg.iIndex, index1); |
|
1169 |
|
1170 retrievedSmsMsg=gsmSmsList->GetEntryL(1); |
|
1171 |
|
1172 ASSERT_EQUALS(0, smsData2.iSmsMsg.Compare(retrievedSmsMsg.iMsgData)); |
|
1173 ASSERT_EQUALS(0, smsData2.iServiceCentre.Compare(retrievedSmsMsg.iServiceCentre.iTelNumber)); |
|
1174 ASSERT_EQUALS(retrievedSmsMsg.iServiceCentre.iTypeOfNumber, smsData2.iMobileScTON); |
|
1175 ASSERT_EQUALS(retrievedSmsMsg.iServiceCentre.iNumberPlan, smsData2.iMobileScNPI); |
|
1176 ASSERT_EQUALS(retrievedSmsMsg.iMsgStatus, RMobileSmsStore::EStoredMessageRead); |
|
1177 ASSERT_EQUALS(retrievedSmsMsg.iIndex, index2); |
|
1178 |
|
1179 AssertMockLtsyStatusL(); |
|
1180 |
|
1181 //------------------------------------------------------------------------- |
|
1182 // RMobileSmsStore::DeleteAll() |
|
1183 //------------------------------------------------------------------------- |
|
1184 |
|
1185 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId); |
|
1186 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId, KErrNone); |
|
1187 |
|
1188 smsStore.DeleteAll(requestStatus); |
|
1189 |
|
1190 User::WaitForRequest(requestStatus); |
|
1191 AssertMockLtsyStatusL(); |
|
1192 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
1193 |
|
1194 CleanupStack::PopAndDestroy(6, this); // getSmsListAO, completeData, expData, |
|
1195 // smsStore, messaging, this |
|
1196 } |
|
1197 |
|
1198 |
|
1199 // |
|
1200 // Other unit tests |
|
1201 // |
|
1202 |
|
1203 /** |
|
1204 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0001 |
|
1205 @SYMComponent telephony_ctsy |
|
1206 @SYMTestCaseDesc Test support in CTSY for a cache cancel |
|
1207 @SYMTestPriority High |
|
1208 @SYMTestActions Open the caching phonebooks and close before the cache has completed |
|
1209 @SYMTestExpectedResults Pass |
|
1210 @SYMTestType UT |
|
1211 */ |
|
1212 void CCTsyPhonebookFU::TestUnit0001L() |
|
1213 { |
|
1214 OpenEtelServerL(EUseExtendedError); |
|
1215 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1216 |
|
1217 OpenPhoneL(); |
|
1218 |
|
1219 CreateEntriesAndStoreDataL(); |
|
1220 |
|
1221 RBuf8 data; |
|
1222 CleanupClosePushL(data); |
|
1223 |
|
1224 RMmCustomAPI customApi; |
|
1225 OpenCustomApiLC(customApi); |
|
1226 |
|
1227 //repeat for all caching PBs |
|
1228 for(TInt i = 0; i < 2; ++i) |
|
1229 { |
|
1230 DispatcherPhonebook::TPhonebook phonebook |
|
1231 = ( i == 0 ? DispatcherPhonebook::EIccAdn : DispatcherPhonebook::EIccFdn); |
|
1232 |
|
1233 RMobilePhoneBookStore phoneBookStore; |
|
1234 CleanupClosePushL(phoneBookStore); |
|
1235 |
|
1236 //just the open, don't complete the cache |
|
1237 OpenCachingPhoneBookL(phonebook,phoneBookStore,KErrNone); |
|
1238 |
|
1239 // destroying the phonebook store, while one of the caching phonebooks |
|
1240 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
1241 // message being generated by the ctsy |
|
1242 |
|
1243 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(phonebook); |
|
1244 expLtsyData.SerialiseL(data); |
|
1245 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
1246 data.Close(); |
|
1247 |
|
1248 //close them without the cache yet completed |
|
1249 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
1250 |
|
1251 AssertMockLtsyStatusL(); |
|
1252 } |
|
1253 |
|
1254 CleanupStack::PopAndDestroy(&customApi); |
|
1255 CleanupStack::PopAndDestroy(&data); |
|
1256 CleanupStack::PopAndDestroy(this); |
|
1257 } |
|
1258 |
|
1259 /** |
|
1260 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0002 |
|
1261 @SYMComponent telephony_ctsy |
|
1262 @SYMTestCaseDesc Test support in CTSY for Opening a caching phonebook with initialisation failure |
|
1263 @SYMTestPriority High |
|
1264 @SYMTestActions |
|
1265 @SYMTestExpectedResults Pass |
|
1266 @SYMTestType UT |
|
1267 */ |
|
1268 void CCTsyPhonebookFU::TestUnit0002L() |
|
1269 { |
|
1270 OpenEtelServerL(EUseExtendedError); |
|
1271 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1272 |
|
1273 OpenPhoneL(); |
|
1274 |
|
1275 CreateEntriesAndStoreDataL(); |
|
1276 |
|
1277 TRequestStatus requestStatus; |
|
1278 |
|
1279 RMmCustomAPI customApi; |
|
1280 OpenCustomApiLC(customApi); |
|
1281 |
|
1282 RMobilePhoneBookStore fdnPhoneBookStore; |
|
1283 CleanupClosePushL(fdnPhoneBookStore); |
|
1284 |
|
1285 OpenCachingPhoneBookL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,KErrGeneral); |
|
1286 |
|
1287 //can't read |
|
1288 TBuf8<KReadBufLength> phonebookReadData; |
|
1289 fdnPhoneBookStore.Read(requestStatus,1,1,phonebookReadData); |
|
1290 User::WaitForRequest(requestStatus); |
|
1291 ASSERT_EQUALS(requestStatus.Int(),KErrInUse) |
|
1292 |
|
1293 //can't write |
|
1294 RBuf8 writeData; |
|
1295 CleanupClosePushL(writeData); |
|
1296 CreateTlvFromEntryL(*iEntries[1],writeData); |
|
1297 TInt index = 1; |
|
1298 fdnPhoneBookStore.Write(requestStatus,writeData,index); |
|
1299 User::WaitForRequest(requestStatus); |
|
1300 ASSERT_TRUE(requestStatus.Int() != KErrNone); |
|
1301 |
|
1302 AssertMockLtsyStatusL(); |
|
1303 CleanupStack::PopAndDestroy(&writeData); |
|
1304 CleanupStack::PopAndDestroy(&fdnPhoneBookStore); |
|
1305 CleanupStack::PopAndDestroy(&customApi); |
|
1306 CleanupStack::PopAndDestroy(this); |
|
1307 } |
|
1308 |
|
1309 /** |
|
1310 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0003 |
|
1311 @SYMComponent telephony_ctsy |
|
1312 @SYMTestCaseDesc Test support in CTSY for Opening a non caching phonebook with initialisation failure |
|
1313 @SYMTestPriority High |
|
1314 @SYMTestActions |
|
1315 @SYMTestExpectedResults Pass |
|
1316 @SYMTestType UT |
|
1317 */ |
|
1318 void CCTsyPhonebookFU::TestUnit0003L() |
|
1319 { |
|
1320 OpenEtelServerL(EUseExtendedError); |
|
1321 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1322 |
|
1323 TRequestStatus requestStatus; |
|
1324 |
|
1325 OpenPhoneL(); |
|
1326 |
|
1327 CreateEntriesAndStoreDataL(); |
|
1328 |
|
1329 RMobilePhoneBookStore vmbPhoneBookStore; |
|
1330 CleanupClosePushL(vmbPhoneBookStore); |
|
1331 |
|
1332 OpenNonCachingPhoneBookL(DispatcherPhonebook::EIccVmb,vmbPhoneBookStore,KErrGeneral); |
|
1333 |
|
1334 //cannot read, increased error checking in C-TSY result in this read being stopped. |
|
1335 RBuf8 readBuf; |
|
1336 CleanupClosePushL(readBuf); |
|
1337 readBuf.CreateL(KReadBufLength * 1); |
|
1338 |
|
1339 vmbPhoneBookStore.Read(requestStatus,1,1,readBuf); |
|
1340 ASSERT_EQUALS(requestStatus.Int(),KErrNotFound); |
|
1341 |
|
1342 //can't write |
|
1343 RBuf8 writeData; |
|
1344 CleanupClosePushL(writeData); |
|
1345 CreateTlvFromEntryL(*iEntries[1],writeData); |
|
1346 TInt index = 1; |
|
1347 vmbPhoneBookStore.Write(requestStatus,writeData,index); |
|
1348 User::WaitForRequest(requestStatus); |
|
1349 ASSERT_TRUE(requestStatus.Int() != KErrNone); |
|
1350 |
|
1351 |
|
1352 AssertMockLtsyStatusL(); |
|
1353 |
|
1354 CleanupStack::PopAndDestroy(&writeData); |
|
1355 CleanupStack::PopAndDestroy(&readBuf); |
|
1356 CleanupStack::PopAndDestroy(&vmbPhoneBookStore); |
|
1357 CleanupStack::PopAndDestroy(this); |
|
1358 } |
|
1359 |
|
1360 /** |
|
1361 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0004 |
|
1362 @SYMComponent telephony_ctsy |
|
1363 @SYMTestCaseDesc Test support in CTSY for Opening a caching phonebook with cache failure |
|
1364 @SYMTestPriority High |
|
1365 @SYMTestActions |
|
1366 @SYMTestExpectedResults Pass |
|
1367 @SYMTestType UT |
|
1368 */ |
|
1369 void CCTsyPhonebookFU::TestUnit0004L() |
|
1370 { |
|
1371 OpenEtelServerL(EUseExtendedError); |
|
1372 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1373 |
|
1374 OpenPhoneL(); |
|
1375 |
|
1376 CreateEntriesAndStoreDataL(); |
|
1377 |
|
1378 RMmCustomAPI customApi; |
|
1379 OpenCustomApiLC(customApi); |
|
1380 |
|
1381 RMobilePhoneBookStore fdnPhoneBookStore; |
|
1382 CleanupClosePushL(fdnPhoneBookStore); |
|
1383 |
|
1384 TRequestStatus requestStatus; |
|
1385 OpenCachingPhoneBookL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,KErrNone); |
|
1386 |
|
1387 //cache completed with a failure |
|
1388 CompleteCacheL(DispatcherPhonebook::EIccFdn, KErrGeneral, EFalse); |
|
1389 WaitForMockLTSYTerminated(); |
|
1390 |
|
1391 //can't read |
|
1392 TBuf8<KReadBufLength> readBuf; |
|
1393 fdnPhoneBookStore.Read(requestStatus,1,1,readBuf); |
|
1394 User::WaitForRequest(requestStatus); |
|
1395 ASSERT_EQUALS(requestStatus.Int(),KErrInUse); |
|
1396 |
|
1397 CompleteCacheL(DispatcherPhonebook::EIccFdn, KErrNone, EFalse); |
|
1398 WaitForMockLTSYTerminated(); |
|
1399 |
|
1400 //can read |
|
1401 ReadL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,KErrNone); |
|
1402 |
|
1403 // destroying the phonebook store, while one of the caching phonebooks |
|
1404 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
1405 // message being generated by the ctsy |
|
1406 |
|
1407 RBuf8 data; |
|
1408 CleanupClosePushL(data); |
|
1409 |
|
1410 DispatcherPhonebook::TPhonebook pB = DispatcherPhonebook::EIccFdn; |
|
1411 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(pB); |
|
1412 expLtsyData.SerialiseL(data); |
|
1413 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
1414 data.Close(); |
|
1415 |
|
1416 CleanupStack::PopAndDestroy(&data); |
|
1417 |
|
1418 |
|
1419 CleanupStack::PopAndDestroy(&fdnPhoneBookStore); |
|
1420 CleanupStack::PopAndDestroy(&customApi); |
|
1421 CleanupStack::PopAndDestroy(this); |
|
1422 } |
|
1423 |
|
1424 /** |
|
1425 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0005 |
|
1426 @SYMComponent telephony_ctsy |
|
1427 @SYMTestCaseDesc Gets the stores info using the Custom API |
|
1428 @SYMTestPriority High |
|
1429 @SYMTestActions Invokes RMmCustomAPI::Get3GPBInfo() |
|
1430 @SYMTestExpectedResults Pass |
|
1431 @SYMTestType UT |
|
1432 */ |
|
1433 void CCTsyPhonebookFU::TestUnit0005L() |
|
1434 { |
|
1435 OpenEtelServerL(EUseExtendedError); |
|
1436 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1437 |
|
1438 OpenPhoneL(); |
|
1439 |
|
1440 CreateEntriesAndStoreDataL(); |
|
1441 |
|
1442 TRequestStatus requestStatus; |
|
1443 |
|
1444 RMmCustomAPI customApi; |
|
1445 OpenCustomApiLC(customApi); |
|
1446 |
|
1447 RMobilePhoneBookStore fdnPhoneBookStore; |
|
1448 CleanupClosePushL(fdnPhoneBookStore); |
|
1449 |
|
1450 OpenPhoneBookL(DispatcherPhonebook::EIccFdn,fdnPhoneBookStore,customApi); |
|
1451 |
|
1452 RMmCustomAPI::T3GPBInfo info3GPB; |
|
1453 customApi.Get3GPBInfo(requestStatus,info3GPB); |
|
1454 |
|
1455 User::WaitForRequest(requestStatus); |
|
1456 |
|
1457 ASSERT_TRUE(info3GPB.iMaxLenEmail == iPhonebookStoreData.iEmailMaximumLength); |
|
1458 ASSERT_TRUE(info3GPB.iMaxLenSne == iPhonebookStoreData.iSecondNameMaximumLength); |
|
1459 ASSERT_TRUE(info3GPB.iMaxLenAnr == iPhonebookStoreData.iAdditionalNumberMaximumLength); |
|
1460 |
|
1461 ASSERT_TRUE(info3GPB.iMaxNumEmail == iPhonebookStoreData.iEmailMaximumFieldsPerEntry); |
|
1462 ASSERT_TRUE(info3GPB.iMaxNumSne == iPhonebookStoreData.iSecondNameMaximumFieldsPerEntry); |
|
1463 ASSERT_TRUE(info3GPB.iMaxNumAnr == iPhonebookStoreData.iAdditionalNumberMaximumFieldsPerEntry); |
|
1464 |
|
1465 // destroying the phonebook store, while one of the caching phonebooks |
|
1466 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
1467 // message being generated by the ctsy |
|
1468 |
|
1469 RBuf8 data; |
|
1470 CleanupClosePushL(data); |
|
1471 |
|
1472 DispatcherPhonebook::TPhonebook pB = DispatcherPhonebook::EIccFdn; |
|
1473 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(pB); |
|
1474 expLtsyData.SerialiseL(data); |
|
1475 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
1476 data.Close(); |
|
1477 |
|
1478 CleanupStack::PopAndDestroy(&data); |
|
1479 |
|
1480 CleanupStack::PopAndDestroy(&fdnPhoneBookStore); |
|
1481 CleanupStack::PopAndDestroy(&customApi); |
|
1482 CleanupStack::PopAndDestroy(this); |
|
1483 } |
|
1484 |
|
1485 /** |
|
1486 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0006 |
|
1487 @SYMComponent telephony_ctsy |
|
1488 @SYMTestCaseDesc Test correct function of dispatcher when sending a junk TLV from the LTSY on a read request |
|
1489 @SYMTestPriority High |
|
1490 @SYMTestActions Invokes RMobilePhone::Read() |
|
1491 @SYMTestExpectedResults Pass |
|
1492 @SYMTestType UT |
|
1493 */ |
|
1494 void CCTsyPhonebookFU::TestUnit0006L() |
|
1495 { |
|
1496 OpenEtelServerL(EUseExtendedError); |
|
1497 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1498 |
|
1499 RBuf8 data; |
|
1500 CleanupClosePushL(data); |
|
1501 |
|
1502 OpenPhoneL(); |
|
1503 |
|
1504 CreateEntriesAndStoreDataL(); |
|
1505 |
|
1506 RMmCustomAPI customApi; |
|
1507 OpenCustomApiLC(customApi); |
|
1508 |
|
1509 RMobilePhoneBookStore fdnPhoneBookStore; |
|
1510 CleanupClosePushL(fdnPhoneBookStore); |
|
1511 |
|
1512 DispatcherPhonebook::TPhonebook phonebook = DispatcherPhonebook::EIccFdn; |
|
1513 |
|
1514 OpenPhoneBookL(phonebook,fdnPhoneBookStore,customApi); |
|
1515 |
|
1516 TRequestStatus requestStatus; |
|
1517 TBuf8<KReadBufLength> readBuf; |
|
1518 |
|
1519 ExpectNonCacheReadL(phonebook,fdnPhoneBookStore,1,1,requestStatus,readBuf); |
|
1520 |
|
1521 TBuf8<KReadBufLength> tlvEntry = _L8("Junk Data"); |
|
1522 |
|
1523 TDesC8* tlvEntryPtr = &tlvEntry; |
|
1524 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TDesC8*> readEntryLtsyData(phonebook,tlvEntryPtr); |
|
1525 readEntryLtsyData.SerialiseL(data); |
|
1526 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreReadEntry::KLtsyDispatchPhonebookStoreReadEntryApiId,KErrNone,data); |
|
1527 data.Close(); |
|
1528 |
|
1529 User::WaitForRequest(requestStatus); |
|
1530 ASSERT_EQUALS(requestStatus.Int(),KErrArgument); //KErrArgument generated from CPhoneBookEntry::InternalizeFromTlvEntry() |
|
1531 |
|
1532 // destroying the phonebook store, while one of the caching phonebooks |
|
1533 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
1534 // message being generated by the ctsy |
|
1535 |
|
1536 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(phonebook); |
|
1537 expLtsyData.SerialiseL(data); |
|
1538 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
1539 data.Close(); |
|
1540 |
|
1541 CleanupStack::PopAndDestroy(&fdnPhoneBookStore); |
|
1542 CleanupStack::PopAndDestroy(&customApi); |
|
1543 CleanupStack::PopAndDestroy(&data); |
|
1544 CleanupStack::PopAndDestroy(this); |
|
1545 } |
|
1546 |
|
1547 /** |
|
1548 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0007 |
|
1549 @SYMComponent telephony_ctsy |
|
1550 @SYMTestCaseDesc Test support in CTSY for RMobileSmsStore::GetInfo() |
|
1551 @SYMTestPriority High |
|
1552 @SYMTestActions Invokes RMobileSmsStore::GetInfo() |
|
1553 @SYMTestExpectedResults Pass |
|
1554 @SYMTestType UT |
|
1555 */ |
|
1556 void CCTsyPhonebookFU::TestUnit0007L() |
|
1557 { |
|
1558 OpenEtelServerL(EUseExtendedError); |
|
1559 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1560 OpenPhoneL(); |
|
1561 |
|
1562 RBuf8 data; |
|
1563 CleanupClosePushL(data); |
|
1564 |
|
1565 RMobileSmsMessaging messaging; |
|
1566 CleanupClosePushL(messaging); |
|
1567 |
|
1568 RMobileSmsStore smsStore; |
|
1569 CleanupClosePushL(smsStore); |
|
1570 |
|
1571 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
1572 |
|
1573 TInt totalEntries = 100; |
|
1574 TInt usedEntries = 10; |
|
1575 TMockLtsyData2<TInt,TInt> smsStoreGetInfoLtsyData(totalEntries, usedEntries); |
|
1576 data.Close(); |
|
1577 smsStoreGetInfoLtsyData.SerialiseL(data); |
|
1578 |
|
1579 TRequestStatus getInfoStatus; |
|
1580 TRequestStatus mockLtsyStatus; |
|
1581 |
|
1582 RMobilePhoneBookStore::TMobilePhoneBookInfoV1 phoneBookInfoV1; |
|
1583 TPckg<RMobilePhoneBookStore::TMobilePhoneBookInfoV1> pckgInfoV1(phoneBookInfoV1); |
|
1584 |
|
1585 //------------------------------------------------------------------------- |
|
1586 // TEST A: failure to dispatch request to LTSY |
|
1587 //------------------------------------------------------------------------- |
|
1588 |
|
1589 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrNotSupported); |
|
1590 |
|
1591 smsStore.GetInfo(getInfoStatus, pckgInfoV1); |
|
1592 |
|
1593 User::WaitForRequest(getInfoStatus); |
|
1594 AssertMockLtsyStatusL(); |
|
1595 ASSERT_EQUALS(KErrNotSupported, getInfoStatus.Int()); |
|
1596 |
|
1597 //------------------------------------------------------------------------- |
|
1598 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
1599 //------------------------------------------------------------------------- |
|
1600 |
|
1601 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId); |
|
1602 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrGeneral, data); |
|
1603 |
|
1604 smsStore.GetInfo(getInfoStatus, pckgInfoV1); |
|
1605 |
|
1606 User::WaitForRequest(getInfoStatus); |
|
1607 AssertMockLtsyStatusL(); |
|
1608 ASSERT_EQUALS(KErrGeneral, getInfoStatus.Int()); |
|
1609 |
|
1610 //------------------------------------------------------------------------- |
|
1611 // TEST C: Successful completion request of |
|
1612 // RMobileSmsStore::GetInfo() when result is not cached. |
|
1613 //------------------------------------------------------------------------- |
|
1614 |
|
1615 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId); |
|
1616 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrNone, data); |
|
1617 |
|
1618 smsStore.GetInfo(getInfoStatus, pckgInfoV1); |
|
1619 User::WaitForRequest(getInfoStatus); |
|
1620 AssertMockLtsyStatusL(); |
|
1621 |
|
1622 ASSERT_EQUALS(getInfoStatus.Int(),KErrNone); |
|
1623 ASSERT_EQUALS(phoneBookInfoV1.iTotalEntries, totalEntries); |
|
1624 ASSERT_EQUALS(phoneBookInfoV1.iUsedEntries, usedEntries); |
|
1625 |
|
1626 |
|
1627 //------------------------------------------------------------------------- |
|
1628 // TEST D: Unsolicited completion of RMobileSmsStore::GetInfo() |
|
1629 // from LTSY. |
|
1630 //------------------------------------------------------------------------- |
|
1631 |
|
1632 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1633 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrNone, data); |
|
1634 User::WaitForRequest(mockLtsyStatus); |
|
1635 AssertMockLtsyStatusL(); |
|
1636 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1637 |
|
1638 CleanupStack::PopAndDestroy(4, this); // smsStore, messaging, data, this |
|
1639 } |
|
1640 |
|
1641 /** |
|
1642 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0008 |
|
1643 @SYMComponent telephony_ctsy |
|
1644 @SYMTestCaseDesc Test support in CTSY for RMobileSmsStore::Read() |
|
1645 @SYMTestPriority High |
|
1646 @SYMTestActions Invokes RMobileSmsStore::Read() |
|
1647 @SYMTestExpectedResults Pass |
|
1648 @SYMTestType UT |
|
1649 */ |
|
1650 void CCTsyPhonebookFU::TestUnit0008L() |
|
1651 { |
|
1652 OpenEtelServerL(EUseExtendedError); |
|
1653 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1654 OpenPhoneL(); |
|
1655 |
|
1656 RMobileSmsMessaging messaging; |
|
1657 CleanupClosePushL(messaging); |
|
1658 |
|
1659 RMobileSmsStore smsStore; |
|
1660 CleanupClosePushL(smsStore); |
|
1661 |
|
1662 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
1663 |
|
1664 RBuf8 expData; |
|
1665 CleanupClosePushL(expData); |
|
1666 |
|
1667 RBuf8 completeData; |
|
1668 CleanupClosePushL(completeData); |
|
1669 |
|
1670 //------------------------------------------------------------------------- |
|
1671 TInt index = 5; |
|
1672 |
|
1673 RMobileSmsStore::TMobileGsmSmsEntryV1 entryV1; |
|
1674 entryV1.iIndex=index; |
|
1675 TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckgEntryV1(entryV1); |
|
1676 |
|
1677 TMockLtsyData1<TInt> mockIndex(index); |
|
1678 |
|
1679 DispatcherPhonebook::TSmsData smsData; |
|
1680 |
|
1681 smsData.iSmsMsg= _L8("Hello, World!"); |
|
1682 smsData.iServiceCentre = _L("ServiceCenter1"); |
|
1683 smsData.iMobileScTON = RMobilePhone::ENetworkSpecificNumber; |
|
1684 smsData.iMobileScNPI = RMobilePhone::EServiceCentreSpecificPlan2; |
|
1685 smsData.iMessageStatus = KSimSmsMtRead; |
|
1686 |
|
1687 TMockLtsyData1<DispatcherPhonebook::TSmsData> mockMsg(smsData); |
|
1688 |
|
1689 expData.Close(); |
|
1690 mockIndex.SerialiseL(expData); |
|
1691 completeData.Close(); |
|
1692 mockMsg.SerialiseL(completeData); |
|
1693 |
|
1694 TRequestStatus requestStatus; |
|
1695 TRequestStatus mockLtsyStatus; |
|
1696 |
|
1697 //------------------------------------------------------------------------- |
|
1698 // TEST A: failure to dispatch request to LTSY |
|
1699 //------------------------------------------------------------------------- |
|
1700 |
|
1701 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, expData, KErrNotSupported); |
|
1702 |
|
1703 smsStore.Read(requestStatus, pckgEntryV1); |
|
1704 |
|
1705 User::WaitForRequest(requestStatus); |
|
1706 AssertMockLtsyStatusL(); |
|
1707 ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); |
|
1708 |
|
1709 //------------------------------------------------------------------------- |
|
1710 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
1711 //------------------------------------------------------------------------- |
|
1712 |
|
1713 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, expData); |
|
1714 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, KErrGeneral, completeData); |
|
1715 |
|
1716 smsStore.Read(requestStatus, pckgEntryV1); |
|
1717 |
|
1718 User::WaitForRequest(requestStatus); |
|
1719 AssertMockLtsyStatusL(); |
|
1720 ASSERT_EQUALS(KErrGeneral, requestStatus.Int()); |
|
1721 |
|
1722 //------------------------------------------------------------------------- |
|
1723 // TEST C: Successful completion request of |
|
1724 // RMobileSmsStore::Read() when result is not cached. |
|
1725 //------------------------------------------------------------------------- |
|
1726 |
|
1727 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, expData); |
|
1728 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, KErrNone, completeData); |
|
1729 |
|
1730 smsStore.Read(requestStatus, pckgEntryV1); |
|
1731 User::WaitForRequest(requestStatus); |
|
1732 AssertMockLtsyStatusL(); |
|
1733 |
|
1734 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
1735 ASSERT_EQUALS(0, smsData.iSmsMsg.Compare(entryV1.iMsgData)); |
|
1736 ASSERT_EQUALS(0, smsData.iServiceCentre.Compare(entryV1.iServiceCentre.iTelNumber)); |
|
1737 ASSERT_EQUALS(smsData.iMobileScTON, entryV1.iServiceCentre.iTypeOfNumber); |
|
1738 ASSERT_EQUALS(smsData.iMobileScNPI, entryV1.iServiceCentre.iNumberPlan); |
|
1739 ASSERT_EQUALS(RMobileSmsStore::EStoredMessageRead, entryV1.iMsgStatus); |
|
1740 |
|
1741 //------------------------------------------------------------------------- |
|
1742 // TEST D: Unsolicited completion of RMobileSmsStore::Read() |
|
1743 // from LTSY. |
|
1744 //------------------------------------------------------------------------- |
|
1745 |
|
1746 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1747 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadEntry::KLtsyDispatchPhonebookSmsStoreReadEntryApiId, KErrNone, completeData); |
|
1748 User::WaitForRequest(mockLtsyStatus); |
|
1749 AssertMockLtsyStatusL(); |
|
1750 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1751 |
|
1752 CleanupStack::PopAndDestroy(5, this); // completeData, expData, smsStore, messaging, this |
|
1753 } |
|
1754 |
|
1755 /** |
|
1756 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0009 |
|
1757 @SYMComponent telephony_ctsy |
|
1758 @SYMTestCaseDesc Test support in CTSY for RMobileSmsStore::Write() |
|
1759 @SYMTestPriority High |
|
1760 @SYMTestActions Invokes RMobileSmsStore::Write() |
|
1761 @SYMTestExpectedResults Pass |
|
1762 @SYMTestType UT |
|
1763 */ |
|
1764 void CCTsyPhonebookFU::TestUnit0009L() |
|
1765 { |
|
1766 OpenEtelServerL(EUseExtendedError); |
|
1767 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1768 OpenPhoneL(); |
|
1769 |
|
1770 TRequestStatus requestStatus; |
|
1771 TRequestStatus mockLtsyStatus; |
|
1772 |
|
1773 // open the message store |
|
1774 RMobileSmsMessaging messaging; |
|
1775 CleanupClosePushL(messaging); |
|
1776 |
|
1777 RMobileSmsStore smsStore; |
|
1778 CleanupClosePushL(smsStore); |
|
1779 |
|
1780 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
1781 |
|
1782 RBuf8 expData; |
|
1783 CleanupClosePushL(expData); |
|
1784 |
|
1785 RBuf8 completeData; |
|
1786 CleanupClosePushL(completeData); |
|
1787 |
|
1788 //------------------------------------------------------------------------- |
|
1789 |
|
1790 TInt index = 5; |
|
1791 |
|
1792 RMobileSmsStore::TMobileGsmSmsEntryV1 entryV1; |
|
1793 TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckgEntryV1(entryV1); |
|
1794 |
|
1795 entryV1.iServiceCentre.iNumberPlan = RMobilePhone::ENationalNumberPlan; |
|
1796 entryV1.iServiceCentre.iTypeOfNumber = RMobilePhone::EAlphanumericNumber; |
|
1797 entryV1.iServiceCentre.iTelNumber = _L("TelNumber1"); |
|
1798 entryV1.iMsgData = _L8("Hello, World!"); |
|
1799 entryV1.iMsgStatus = RMobileSmsStore::EStoredMessageUnsent; |
|
1800 entryV1.iIndex = index; |
|
1801 |
|
1802 TMockLtsyData1<RMobileSmsStore::TMobileGsmSmsEntryV1> |
|
1803 expMockData1(entryV1); |
|
1804 |
|
1805 TInt location = 100; |
|
1806 TBool receivedClass2ToBeResent = ETrue; |
|
1807 |
|
1808 TMockLtsyData2<TInt, TBool> completeMockData2(location, receivedClass2ToBeResent); |
|
1809 |
|
1810 expData.Close(); |
|
1811 expMockData1.SerialiseL(expData); |
|
1812 completeData.Close(); |
|
1813 completeMockData2.SerialiseL(completeData); |
|
1814 |
|
1815 //------------------------------------------------------------------------- |
|
1816 // TEST A: failure to dispatch request to LTSY |
|
1817 //------------------------------------------------------------------------- |
|
1818 |
|
1819 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, expData, KErrNotSupported); |
|
1820 |
|
1821 smsStore.Write(requestStatus, pckgEntryV1); |
|
1822 |
|
1823 User::WaitForRequest(requestStatus); |
|
1824 AssertMockLtsyStatusL(); |
|
1825 ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); |
|
1826 |
|
1827 //------------------------------------------------------------------------- |
|
1828 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
1829 //------------------------------------------------------------------------- |
|
1830 |
|
1831 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, expData); |
|
1832 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, KErrGeneral, completeData); |
|
1833 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); |
|
1834 |
|
1835 smsStore.Write(requestStatus, pckgEntryV1); |
|
1836 |
|
1837 User::WaitForRequest(requestStatus); |
|
1838 AssertMockLtsyStatusL(); |
|
1839 ASSERT_EQUALS(KErrGeneral, requestStatus.Int()); |
|
1840 |
|
1841 //------------------------------------------------------------------------- |
|
1842 // TEST C: Successful completion request of |
|
1843 // RMobileSmsStore::Write() when result is not cached. |
|
1844 //------------------------------------------------------------------------- |
|
1845 |
|
1846 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, expData); |
|
1847 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, KErrNone, completeData); |
|
1848 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); |
|
1849 |
|
1850 smsStore.Write(requestStatus, pckgEntryV1); |
|
1851 |
|
1852 User::WaitForRequest(requestStatus); |
|
1853 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
1854 ASSERT_EQUALS(entryV1.iIndex, location); |
|
1855 AssertMockLtsyStatusL(); |
|
1856 |
|
1857 //------------------------------------------------------------------------- |
|
1858 // TEST D: Unsolicited completion of RMobileSmsStore::Write() |
|
1859 // from LTSY. |
|
1860 //------------------------------------------------------------------------- |
|
1861 |
|
1862 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1863 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreWriteEntry::KLtsyDispatchPhonebookSmsStoreWriteEntryApiId, KErrNone, completeData); |
|
1864 User::WaitForRequest(mockLtsyStatus); |
|
1865 AssertMockLtsyStatusL(); |
|
1866 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1867 |
|
1868 CleanupStack::PopAndDestroy(5, this); // expData, completeData, this |
|
1869 // smsStore, messaging |
|
1870 } |
|
1871 |
|
1872 /** |
|
1873 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0010 |
|
1874 @SYMComponent telephony_ctsy |
|
1875 @SYMTestCaseDesc Test support in CTSY for RMobileSmsStore::Delete() |
|
1876 @SYMTestPriority High |
|
1877 @SYMTestActions Invokes RMobileSmsStore::Delete() |
|
1878 @SYMTestExpectedResults Pass |
|
1879 @SYMTestType UT |
|
1880 */ |
|
1881 void CCTsyPhonebookFU::TestUnit0010L() |
|
1882 { |
|
1883 |
|
1884 OpenEtelServerL(EUseExtendedError); |
|
1885 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1886 OpenPhoneL(); |
|
1887 |
|
1888 TRequestStatus requestStatus; |
|
1889 TRequestStatus mockLtsyStatus; |
|
1890 |
|
1891 // open the message store |
|
1892 RMobileSmsMessaging messaging; |
|
1893 CleanupClosePushL(messaging); |
|
1894 |
|
1895 RMobileSmsStore smsStore; |
|
1896 CleanupClosePushL(smsStore); |
|
1897 |
|
1898 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
1899 |
|
1900 RBuf8 expData; |
|
1901 CleanupClosePushL(expData); |
|
1902 |
|
1903 //------------------------------------------------------------------------- |
|
1904 |
|
1905 TInt index = 1; |
|
1906 |
|
1907 TMockLtsyData1<TInt> expMockData1(index); |
|
1908 expMockData1.SerialiseL(expData); |
|
1909 |
|
1910 //------------------------------------------------------------------------- |
|
1911 // TEST A: failure to dispatch request to LTSY |
|
1912 //------------------------------------------------------------------------- |
|
1913 |
|
1914 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, expData, KErrNotSupported); |
|
1915 |
|
1916 smsStore.Delete(requestStatus, index); |
|
1917 |
|
1918 User::WaitForRequest(requestStatus); |
|
1919 AssertMockLtsyStatusL(); |
|
1920 ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); |
|
1921 |
|
1922 //------------------------------------------------------------------------- |
|
1923 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
1924 //------------------------------------------------------------------------- |
|
1925 |
|
1926 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, expData); |
|
1927 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, KErrGeneral); |
|
1928 |
|
1929 smsStore.Delete(requestStatus, index); |
|
1930 |
|
1931 User::WaitForRequest(requestStatus); |
|
1932 AssertMockLtsyStatusL(); |
|
1933 ASSERT_EQUALS(KErrGeneral, requestStatus.Int()); |
|
1934 |
|
1935 //------------------------------------------------------------------------- |
|
1936 // TEST C: Successful completion request of |
|
1937 // RMobileSmsStore::Delete() when result is not cached. |
|
1938 //------------------------------------------------------------------------- |
|
1939 |
|
1940 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, expData); |
|
1941 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, KErrNone); |
|
1942 |
|
1943 smsStore.Delete(requestStatus, index); |
|
1944 |
|
1945 User::WaitForRequest(requestStatus); |
|
1946 AssertMockLtsyStatusL(); |
|
1947 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
1948 |
|
1949 //------------------------------------------------------------------------- |
|
1950 // TEST D: Unsolicited completion of RMobileSmsStore::Delete() |
|
1951 // from LTSY. |
|
1952 //------------------------------------------------------------------------- |
|
1953 |
|
1954 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
1955 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteEntry::KLtsyDispatchPhonebookSmsStoreDeleteEntryApiId, KErrNone); |
|
1956 User::WaitForRequest(mockLtsyStatus); |
|
1957 AssertMockLtsyStatusL(); |
|
1958 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
1959 |
|
1960 CleanupStack::PopAndDestroy(4, this); // expData, smsStore, messaging, this |
|
1961 } |
|
1962 |
|
1963 /** |
|
1964 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0011 |
|
1965 @SYMComponent telephony_ctsy |
|
1966 @SYMTestCaseDesc Test support in CTSY for RMobileSmsStore::DeleteAll() |
|
1967 @SYMTestPriority High |
|
1968 @SYMTestActions Invokes RMobileSmsStore::DeleteAll() |
|
1969 @SYMTestExpectedResults Pass |
|
1970 @SYMTestType UT |
|
1971 */ |
|
1972 void CCTsyPhonebookFU::TestUnit0011L() |
|
1973 { |
|
1974 |
|
1975 OpenEtelServerL(EUseExtendedError); |
|
1976 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
1977 OpenPhoneL(); |
|
1978 |
|
1979 TRequestStatus requestStatus; |
|
1980 TRequestStatus mockLtsyStatus; |
|
1981 |
|
1982 // open the message store |
|
1983 RMobileSmsMessaging messaging; |
|
1984 CleanupClosePushL(messaging); |
|
1985 |
|
1986 RMobileSmsStore smsStore; |
|
1987 CleanupClosePushL(smsStore); |
|
1988 |
|
1989 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
1990 |
|
1991 //------------------------------------------------------------------------- |
|
1992 // TEST A: failure to dispatch request to LTSY |
|
1993 //------------------------------------------------------------------------- |
|
1994 |
|
1995 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId, KErrNotSupported); |
|
1996 |
|
1997 smsStore.DeleteAll(requestStatus); |
|
1998 |
|
1999 User::WaitForRequest(requestStatus); |
|
2000 AssertMockLtsyStatusL(); |
|
2001 ASSERT_EQUALS(KErrNotSupported, requestStatus.Int()); |
|
2002 |
|
2003 //------------------------------------------------------------------------- |
|
2004 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
2005 //------------------------------------------------------------------------- |
|
2006 |
|
2007 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId); |
|
2008 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId, KErrGeneral); |
|
2009 |
|
2010 smsStore.DeleteAll(requestStatus); |
|
2011 |
|
2012 User::WaitForRequest(requestStatus); |
|
2013 AssertMockLtsyStatusL(); |
|
2014 ASSERT_EQUALS(KErrGeneral, requestStatus.Int()); |
|
2015 |
|
2016 //------------------------------------------------------------------------- |
|
2017 // TEST C: Successful completion request of |
|
2018 // RMobileSmsStore::DeleteAll() when result is not cached. |
|
2019 //------------------------------------------------------------------------- |
|
2020 |
|
2021 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId); |
|
2022 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId, KErrNone); |
|
2023 |
|
2024 smsStore.DeleteAll(requestStatus); |
|
2025 |
|
2026 User::WaitForRequest(requestStatus); |
|
2027 AssertMockLtsyStatusL(); |
|
2028 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
2029 |
|
2030 //------------------------------------------------------------------------- |
|
2031 // TEST D: Unsolicited completion of RMobileSmsStore::DeleteAll() |
|
2032 // from LTSY. |
|
2033 //------------------------------------------------------------------------- |
|
2034 |
|
2035 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
2036 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreDeleteAll::KLtsyDispatchPhonebookSmsStoreDeleteAllApiId, KErrNone); |
|
2037 User::WaitForRequest(mockLtsyStatus); |
|
2038 AssertMockLtsyStatusL(); |
|
2039 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
2040 |
|
2041 CleanupStack::PopAndDestroy(3, this); // smsStore, messaging, this |
|
2042 } |
|
2043 |
|
2044 /** |
|
2045 @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOK-UN0012 |
|
2046 @SYMComponent telephony_ctsy |
|
2047 @SYMTestCaseDesc Test support in CTSY for CRetrieveMobilePhoneSmsList::Start() |
|
2048 @SYMTestPriority High |
|
2049 @SYMTestActions Invokes CRetrieveMobilePhoneSmsList::Start() |
|
2050 @SYMTestExpectedResults Pass |
|
2051 @SYMTestType UT |
|
2052 */ |
|
2053 void CCTsyPhonebookFU::TestUnit0012L() |
|
2054 { |
|
2055 OpenEtelServerL(EUseExtendedError); |
|
2056 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
2057 OpenPhoneL(); |
|
2058 |
|
2059 TRequestStatus requestStatus; |
|
2060 TRequestStatus mockLtsyStatus; |
|
2061 |
|
2062 // open the message store |
|
2063 RMobileSmsMessaging messaging; |
|
2064 CleanupClosePushL(messaging); |
|
2065 |
|
2066 RMobileSmsStore smsStore; |
|
2067 CleanupClosePushL(smsStore); |
|
2068 |
|
2069 OpenSmsStoreL(messaging, smsStore, KETelIccSmsStore); |
|
2070 |
|
2071 RBuf8 completeData; |
|
2072 CleanupClosePushL(completeData); |
|
2073 |
|
2074 CGetSMSListAO* getSmsListAO = CGetSMSListAO::NewLC(smsStore); |
|
2075 |
|
2076 //------------------------------------------------------------------------- |
|
2077 DispatcherPhonebook::TSmsData smsData; |
|
2078 TInt index = 0; |
|
2079 |
|
2080 smsData.iSmsMsg= _L8("Hello, World!"); |
|
2081 smsData.iServiceCentre = _L("ServiceCenter"); |
|
2082 smsData.iMobileScTON = RMobilePhone::ENetworkSpecificNumber; |
|
2083 smsData.iMobileScNPI = RMobilePhone::EServiceCentreSpecificPlan2; |
|
2084 smsData.iMessageStatus = KSimSmsMtRead; |
|
2085 |
|
2086 TBool moreToCome = ETrue; |
|
2087 TBool receivedClass2ToBeResent = ETrue; |
|
2088 |
|
2089 TMockLtsyData4<DispatcherPhonebook::TSmsData, TInt, TBool, TBool> completeSmsMsgLtsyData(smsData, index, moreToCome, receivedClass2ToBeResent); |
|
2090 |
|
2091 TInt totalEntries(1); |
|
2092 TInt usedEntries(0); |
|
2093 |
|
2094 TMockLtsyData2<TInt, TInt> dataGetInfo(totalEntries, usedEntries); |
|
2095 completeData.Close(); |
|
2096 dataGetInfo.SerialiseL(completeData); |
|
2097 |
|
2098 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
2099 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrNone, completeData); |
|
2100 User::WaitForRequest(mockLtsyStatus); |
|
2101 AssertMockLtsyStatusL(); |
|
2102 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
2103 |
|
2104 //------------------------------------------------------------------------- |
|
2105 // TEST A: failure to dispatch request to LTSY |
|
2106 //------------------------------------------------------------------------- |
|
2107 |
|
2108 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNotSupported); |
|
2109 |
|
2110 getSmsListAO->TestRetrieveL(); |
|
2111 ASSERT_EQUALS(KErrNotSupported, getSmsListAO->RetrieveLastError()); |
|
2112 |
|
2113 AssertMockLtsyStatusL(); |
|
2114 |
|
2115 //------------------------------------------------------------------------- |
|
2116 // TEST B: failure on completion of pending request from LTSY->CTSY |
|
2117 //------------------------------------------------------------------------- |
|
2118 //failure when there are no more entries to be returned |
|
2119 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone); |
|
2120 completeData.Close(); |
|
2121 completeSmsMsgLtsyData.SerialiseL(completeData); |
|
2122 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrGeneral, completeData); |
|
2123 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); |
|
2124 |
|
2125 getSmsListAO->TestRetrieveL(); |
|
2126 ASSERT_EQUALS(KErrGeneral, getSmsListAO->RetrieveLastError()); |
|
2127 AssertMockLtsyStatusL(); |
|
2128 |
|
2129 //failure when there are more entries to be returned |
|
2130 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone); |
|
2131 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrGeneral, completeData); |
|
2132 moreToCome = EFalse; |
|
2133 TMockLtsyData4<DispatcherPhonebook::TSmsData, TInt, TBool, TBool> completeSmsMsgLtsyData2(smsData, index, moreToCome, receivedClass2ToBeResent); |
|
2134 completeData.Close(); |
|
2135 completeSmsMsgLtsyData2.SerialiseL(completeData); |
|
2136 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone, completeData); |
|
2137 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); |
|
2138 |
|
2139 getSmsListAO->TestRetrieveL(); |
|
2140 ASSERT_EQUALS(KErrGeneral, getSmsListAO->RetrieveLastError()); |
|
2141 AssertMockLtsyStatusL(); |
|
2142 |
|
2143 //------------------------------------------------------------------------- |
|
2144 // TEST C: Successful completion request of |
|
2145 // CRetrieveMobilePhoneSmsList::Start when result is not cached. |
|
2146 //------------------------------------------------------------------------- |
|
2147 |
|
2148 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone); |
|
2149 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone, completeData); |
|
2150 iMockLTSY.ExpectL(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId); |
|
2151 |
|
2152 getSmsListAO->TestRetrieveL(); |
|
2153 ASSERT_EQUALS(KErrNone, getSmsListAO->RetrieveLastError()); |
|
2154 |
|
2155 //assert: |
|
2156 RMobileSmsStore::TMobileGsmSmsEntryV1 retrievedSmsMsg; |
|
2157 CMobilePhoneGsmSmsList* gsmSmsList; |
|
2158 gsmSmsList=getSmsListAO->RetrieveListL(); |
|
2159 retrievedSmsMsg=gsmSmsList->GetEntryL(0); |
|
2160 |
|
2161 ASSERT_EQUALS(0, smsData.iSmsMsg.Compare(retrievedSmsMsg.iMsgData)); |
|
2162 ASSERT_EQUALS(0, smsData.iServiceCentre.Compare(retrievedSmsMsg.iServiceCentre.iTelNumber)); |
|
2163 ASSERT_EQUALS(retrievedSmsMsg.iServiceCentre.iTypeOfNumber, smsData.iMobileScTON); |
|
2164 ASSERT_EQUALS(retrievedSmsMsg.iServiceCentre.iNumberPlan, smsData.iMobileScNPI); |
|
2165 ASSERT_EQUALS(retrievedSmsMsg.iMsgStatus, RMobileSmsStore::EStoredMessageRead); |
|
2166 ASSERT_EQUALS(retrievedSmsMsg.iIndex, index); |
|
2167 |
|
2168 AssertMockLtsyStatusL(); |
|
2169 |
|
2170 |
|
2171 //------------------------------------------------------------------------- |
|
2172 // TEST D: Unsolicited completion of CRetrieveMobilePhoneSmsList::Start |
|
2173 // from LTSY. |
|
2174 //------------------------------------------------------------------------- |
|
2175 |
|
2176 iMockLTSY.NotifyTerminated(mockLtsyStatus); |
|
2177 completeSmsMsgLtsyData.SerialiseL(completeData); |
|
2178 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreReadAll::KLtsyDispatchPhonebookSmsStoreReadAllApiId, KErrNone, completeData); |
|
2179 |
|
2180 User::WaitForRequest(mockLtsyStatus); |
|
2181 ASSERT_EQUALS(KErrNone, mockLtsyStatus.Int()); |
|
2182 AssertMockLtsyStatusL(); |
|
2183 |
|
2184 CleanupStack::PopAndDestroy(5, this); // gsmSmsList, completeData, store, messaging, this |
|
2185 } |
|
2186 |
|
2187 /***********************************************Helper functions***************************************/ |
|
2188 |
|
2189 /** |
|
2190 * Helper funtion to open a phonebook |
|
2191 * |
|
2192 * @param aPhonebook The phonebook being tested |
|
2193 * @param aPhoneBookStore The opened store |
|
2194 * @param aCustomApi The open custome API |
|
2195 */ |
|
2196 void CCTsyPhonebookFU::OpenPhoneBookL( DispatcherPhonebook::TPhonebook aPhonebook, |
|
2197 RMobilePhoneBookStore& aPhoneBookStore, |
|
2198 RMmCustomAPI& aCustomApi) |
|
2199 { |
|
2200 TRequestStatus requestStatus; |
|
2201 |
|
2202 if(CachingPhonebook(aPhonebook)) |
|
2203 { |
|
2204 //so we are notified when the cache is ready |
|
2205 TName phonebookName(PhonebookName(aPhonebook)); |
|
2206 aCustomApi.NotifyPndCacheReady(requestStatus,phonebookName); |
|
2207 |
|
2208 OpenCachingPhoneBookL(aPhonebook,aPhoneBookStore,KErrNone); |
|
2209 CompleteCacheL(aPhonebook, KErrNone, EFalse); |
|
2210 |
|
2211 //wait for the cache to become ready, then the phonebook is fully open |
|
2212 User::WaitForRequest(requestStatus); |
|
2213 AssertMockLtsyStatusL(); |
|
2214 |
|
2215 RMmCustomAPI::TPndCacheStatus cacheStatus; |
|
2216 aCustomApi.GetPndCacheStatus(requestStatus,cacheStatus,PhonebookName(aPhonebook)); |
|
2217 User::WaitForRequest(requestStatus); |
|
2218 ASSERT_EQUALS(cacheStatus,RMmCustomAPI::ECacheReady); |
|
2219 |
|
2220 } |
|
2221 else |
|
2222 { |
|
2223 OpenNonCachingPhoneBookL(aPhonebook,aPhoneBookStore,KErrNone); |
|
2224 |
|
2225 RMmCustomAPI::TPndCacheStatus cacheStatus; |
|
2226 aCustomApi.GetPndCacheStatus(requestStatus,cacheStatus,PhonebookName(aPhonebook)); |
|
2227 User::WaitForRequest(requestStatus); |
|
2228 |
|
2229 if(aPhonebook != DispatcherPhonebook::EIccMbdn) |
|
2230 { |
|
2231 ASSERT_EQUALS(cacheStatus,RMmCustomAPI::ECacheNotUsed); |
|
2232 } |
|
2233 } |
|
2234 } |
|
2235 |
|
2236 /** |
|
2237 * Helper funtion to open a phonebook, this expects and completes the initialisation phase |
|
2238 * |
|
2239 * @param aPhonebook The phonebook being tested |
|
2240 * @param aPhoneBookStore The opened store |
|
2241 * @param aError the Error to return from the LTSY |
|
2242 */ |
|
2243 void CCTsyPhonebookFU::OpenPhoneBookWithInitialisationL(DispatcherPhonebook::TPhonebook aPhonebook, |
|
2244 RMobilePhoneBookStore& aPhoneBookStore, |
|
2245 TInt aError) |
|
2246 { |
|
2247 RBuf8 data; |
|
2248 CleanupClosePushL(data); |
|
2249 |
|
2250 //initialise IPC generated from phonebook store open |
|
2251 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId); |
|
2252 |
|
2253 ASSERT_EQUALS(aPhoneBookStore.Open(iPhone,PhonebookName(aPhonebook)),KErrNone); |
|
2254 |
|
2255 AssertMockLtsyStatusL(); |
|
2256 |
|
2257 //complete initialise IPC |
|
2258 TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData); |
|
2259 phonebookCompLtsyData.SerialiseL(data); |
|
2260 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,aError,data); |
|
2261 data.Close(); |
|
2262 |
|
2263 CleanupStack::PopAndDestroy(&data); |
|
2264 |
|
2265 iInititalised = ETrue; |
|
2266 } |
|
2267 |
|
2268 /** |
|
2269 * Helper funtion to open a caching phonebook (without the cache being completed) |
|
2270 * |
|
2271 * @param aPhonebook The phonebook being tested |
|
2272 * @param aPhoneBookStore The opened store |
|
2273 * @param aError the Error to return from the LTSY |
|
2274 */ |
|
2275 void CCTsyPhonebookFU::OpenCachingPhoneBookL( DispatcherPhonebook::TPhonebook aPhonebook, |
|
2276 RMobilePhoneBookStore& aPhoneBookStore, |
|
2277 TInt aError) |
|
2278 { |
|
2279 RBuf8 data; |
|
2280 CleanupClosePushL(data); |
|
2281 |
|
2282 if(!iInititalised && InitialisationRequired(aPhonebook)) |
|
2283 { |
|
2284 OpenPhoneBookWithInitialisationL(aPhonebook,aPhoneBookStore,aError); |
|
2285 |
|
2286 if(aError == KErrNone) |
|
2287 { |
|
2288 //cache IPC generated from complete initialise IPC |
|
2289 TMockLtsyData1<DispatcherPhonebook::TPhonebook> cacheExpLtsyData(aPhonebook); |
|
2290 cacheExpLtsyData.SerialiseL(data); |
|
2291 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId,data); |
|
2292 data.Close(); |
|
2293 } |
|
2294 |
|
2295 //fire up the initialise complete |
|
2296 WaitForMockLTSYTerminated(); |
|
2297 } |
|
2298 else |
|
2299 { |
|
2300 //here the expect needs to be queued before the phone book open as if initialised then the open |
|
2301 //generated the cache |
|
2302 TMockLtsyData1<DispatcherPhonebook::TPhonebook> cacheExpLtsyData(aPhonebook); |
|
2303 cacheExpLtsyData.SerialiseL(data); |
|
2304 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId,data); |
|
2305 data.Close(); |
|
2306 |
|
2307 ASSERT_EQUALS(aPhoneBookStore.Open(iPhone,PhonebookName(aPhonebook)),KErrNone); |
|
2308 } |
|
2309 |
|
2310 AssertMockLtsyStatusL(); |
|
2311 |
|
2312 CleanupStack::PopAndDestroy(&data); |
|
2313 } |
|
2314 |
|
2315 /** |
|
2316 * Helper funtion to complete the cache phase of a cache request |
|
2317 * |
|
2318 * @param aPhonebook The phonebook being tested |
|
2319 * @param aError the Error to return from the LTSY |
|
2320 * @param aIsRefresh If the cache request came from a SIM refresh request |
|
2321 */ |
|
2322 void CCTsyPhonebookFU::CompleteCacheL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError, TBool aIsRefresh) |
|
2323 { |
|
2324 //generate the TLV |
|
2325 RBuf8 tlv; |
|
2326 CleanupClosePushL(tlv); |
|
2327 |
|
2328 CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer(); |
|
2329 CleanupStack::PushL(pbBuffer); |
|
2330 |
|
2331 pbBuffer->Set(&tlv); |
|
2332 |
|
2333 TInt tlvLength = 0; |
|
2334 for(TInt i = 0; i < iEntries.Count(); ++i) |
|
2335 { |
|
2336 tlvLength += iEntries[i]->TlvLength(); |
|
2337 } |
|
2338 |
|
2339 tlv.ReAllocL(tlv.Length() + tlvLength); |
|
2340 |
|
2341 for(TInt j = 0; j < iEntries.Count(); ++j) |
|
2342 { |
|
2343 ASSERT_EQUALS(iEntries[j]->ExternalizeToTlvEntry(*pbBuffer),KErrNone); |
|
2344 } |
|
2345 |
|
2346 RBuf8 data; |
|
2347 CleanupClosePushL(data); |
|
2348 |
|
2349 TDesC8* tlvPtr = &tlv; |
|
2350 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TDesC8*> phonebookLtsyData(aPhonebook,tlvPtr); |
|
2351 phonebookLtsyData.SerialiseL(data); |
|
2352 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId,aError,data); |
|
2353 CleanupStack::PopAndDestroy(&data); |
|
2354 |
|
2355 |
|
2356 CleanupStack::PopAndDestroy(pbBuffer); |
|
2357 CleanupStack::PopAndDestroy(&tlv); |
|
2358 |
|
2359 /********************************************************************************/ |
|
2360 |
|
2361 if(aIsRefresh) |
|
2362 { |
|
2363 //the Refresh is complete |
|
2364 |
|
2365 RBuf8 data2; |
|
2366 CleanupClosePushL(data2); |
|
2367 |
|
2368 TRequestStatus reqStatusTerminated; |
|
2369 iMockLTSY.NotifyTerminated(reqStatusTerminated); |
|
2370 |
|
2371 TMockLtsyData1<TInt> simRefreshDoneExpLtsyData(aError); |
|
2372 simRefreshDoneExpLtsyData.SerialiseL(data2); |
|
2373 iMockLTSY.ExpectL(MLtsyDispatchSimSimRefreshDone::KLtsyDispatchSimSimRefreshDoneApiId,data2); |
|
2374 CleanupStack::PopAndDestroy(&data2); |
|
2375 |
|
2376 User::WaitForRequest(reqStatusTerminated); |
|
2377 ASSERT_EQUALS(KErrNone, reqStatusTerminated.Int()); |
|
2378 |
|
2379 //no notification when refresh is originated from the SIM |
|
2380 AssertMockLtsyStatusL(); |
|
2381 } |
|
2382 |
|
2383 //in the open case wait via a RMmCustomAPI::NotifyPndCacheReady() |
|
2384 |
|
2385 } |
|
2386 |
|
2387 /** |
|
2388 * Helper funtion to Open a non-caching phonebook |
|
2389 * |
|
2390 * @param aPhonebook The phonebook being tested |
|
2391 * @param aPhoneBookStore The opened store |
|
2392 * @param aError the Error to return from the LTSY |
|
2393 */ |
|
2394 void CCTsyPhonebookFU::OpenNonCachingPhoneBookL(DispatcherPhonebook::TPhonebook aPhonebook, RMobilePhoneBookStore& aPhoneBookStore, TInt aError) |
|
2395 { |
|
2396 RBuf8 data; |
|
2397 CleanupClosePushL(data); |
|
2398 |
|
2399 if(!iInititalised && InitialisationRequired(aPhonebook)) |
|
2400 { |
|
2401 OpenPhoneBookWithInitialisationL(aPhonebook,aPhoneBookStore,aError); |
|
2402 |
|
2403 //fire up the initialise complete |
|
2404 WaitForMockLTSYTerminated(); |
|
2405 } |
|
2406 else |
|
2407 { |
|
2408 ASSERT_EQUALS(aPhoneBookStore.Open(iPhone,PhonebookName(aPhonebook)),KErrNone); |
|
2409 } |
|
2410 |
|
2411 AssertMockLtsyStatusL(); |
|
2412 |
|
2413 CleanupStack::PopAndDestroy(&data); |
|
2414 } |
|
2415 |
|
2416 /** |
|
2417 * Function to create the test data, this should be called at the start of a test case |
|
2418 */ |
|
2419 void CCTsyPhonebookFU::CreateEntriesAndStoreDataL() |
|
2420 { |
|
2421 ASSERT_EQUALS(iEntries.Count(),0); |
|
2422 ASSERT_TRUE(iInititalised == EFalse); |
|
2423 |
|
2424 //for CPhoneBookEntry::NewL coverage |
|
2425 CPhoneBookEntry* phoneBookEntry = CPhoneBookEntry::NewL(); |
|
2426 delete phoneBookEntry; |
|
2427 phoneBookEntry = NULL; |
|
2428 |
|
2429 /************************Add Entry 0***********************************/ |
|
2430 phoneBookEntry = CPhoneBookEntry::NewLC(); |
|
2431 iEntries.AppendL(phoneBookEntry); |
|
2432 CleanupStack::Pop(phoneBookEntry); //takes ownership |
|
2433 phoneBookEntry->SetIndex(1); |
|
2434 phoneBookEntry->SetFirstName(_L("Symbian0")); |
|
2435 phoneBookEntry->SetDiallingNumber(_L("123456789")); |
|
2436 phoneBookEntry->AddEmailAddress(_L("symbian1@symbian.com")); |
|
2437 phoneBookEntry->AddSecondName(_L("Phone book3")); |
|
2438 phoneBookEntry->AddAdditionalNumber(_L("123")); |
|
2439 |
|
2440 /************************Add Entry 1***********************************/ |
|
2441 phoneBookEntry = CPhoneBookEntry::NewLC(); |
|
2442 iEntries.AppendL(phoneBookEntry); |
|
2443 CleanupStack::Pop(phoneBookEntry); //takes ownership |
|
2444 phoneBookEntry->SetIndex(2); |
|
2445 phoneBookEntry->SetFirstName(_L("Symbian1")); |
|
2446 phoneBookEntry->SetDiallingNumber(_L("12345678910")); |
|
2447 phoneBookEntry->AddEmailAddress(_L("symbian3@symbian.com")); |
|
2448 phoneBookEntry->AddEmailAddress(_L("symbian4@symbian.com")); |
|
2449 phoneBookEntry->AddSecondName(_L("Phone book3")); |
|
2450 phoneBookEntry->AddSecondName(_L("Phone book4")); |
|
2451 phoneBookEntry->AddAdditionalNumber(_L("789")); |
|
2452 phoneBookEntry->AddAdditionalNumber(_L("101112")); |
|
2453 |
|
2454 /************************Add Entry 2***********************************/ |
|
2455 phoneBookEntry = CPhoneBookEntry::NewLC(); |
|
2456 iEntries.AppendL(phoneBookEntry); |
|
2457 CleanupStack::Pop(phoneBookEntry); //takes ownership |
|
2458 phoneBookEntry->SetIndex(3); |
|
2459 phoneBookEntry->SetFirstName(_L("Symbian2")); |
|
2460 phoneBookEntry->SetDiallingNumber(_L("12345678910")); |
|
2461 phoneBookEntry->AddEmailAddress(_L("symbian3@symbian.com")); |
|
2462 phoneBookEntry->AddEmailAddress(_L("symbian4@symbian.com")); |
|
2463 phoneBookEntry->AddEmailAddress(_L("symbian4@symbian.com")); |
|
2464 phoneBookEntry->AddSecondName(_L("Phone book3")); |
|
2465 phoneBookEntry->AddSecondName(_L("Phone book4")); |
|
2466 phoneBookEntry->AddSecondName(_L("Phone book4")); |
|
2467 phoneBookEntry->AddAdditionalNumber(_L("789")); |
|
2468 phoneBookEntry->AddAdditionalNumber(_L("101112")); |
|
2469 phoneBookEntry->AddAdditionalNumber(_L("101112")); |
|
2470 |
|
2471 /************************Add Entry 3***********************************/ |
|
2472 phoneBookEntry = CPhoneBookEntry::NewLC(); |
|
2473 iEntries.AppendL(phoneBookEntry); |
|
2474 CleanupStack::Pop(phoneBookEntry); //takes ownership |
|
2475 phoneBookEntry->SetIndex(4); |
|
2476 phoneBookEntry->SetFirstName(_L("Symbian3")); |
|
2477 phoneBookEntry->SetDiallingNumber(_L("12345678910")); |
|
2478 |
|
2479 /************************Test TLV creation*********************************/ |
|
2480 |
|
2481 for(TInt i = 0; i < iEntries.Count(); ++i) |
|
2482 { |
|
2483 TestTlvWriteReadL(*iEntries[i]); |
|
2484 } |
|
2485 |
|
2486 /************************************************************************/ |
|
2487 |
|
2488 |
|
2489 iPhonebookStoreData.iAdnTotalEntries = iEntries.Count(); |
|
2490 iPhonebookStoreData.iAdnMaximumNumberLength = KMaxNumberLength; |
|
2491 iPhonebookStoreData.iAdnMaximumTextLength = KMaxTextLength; |
|
2492 |
|
2493 iPhonebookStoreData.iFdnTotalEntries = iEntries.Count(); |
|
2494 iPhonebookStoreData.iFdnMaximumNumberLength = KMaxNumberLength; |
|
2495 iPhonebookStoreData.iFdnMaximumTextLength = KMaxTextLength; |
|
2496 |
|
2497 iPhonebookStoreData.iSdnTotalEntries = KNumberOfEnries; |
|
2498 iPhonebookStoreData.iSdnMaximumTextLength = KMaxTextLength; |
|
2499 iPhonebookStoreData.iSdnMaximumNumberLength = KMaxNumberLength; |
|
2500 |
|
2501 iPhonebookStoreData.iVmbTotalEntries = KNumberOfEnries; |
|
2502 iPhonebookStoreData.iVmbMaximumTextLength = KMaxTextLength; |
|
2503 iPhonebookStoreData.iVmbMaximumNumberLength = KMaxNumberLength; |
|
2504 iPhonebookStoreData.iVmbCapabilities = 0; |
|
2505 |
|
2506 iPhonebookStoreData.iMbdnTotalEntries = KNumberOfEnries; |
|
2507 iPhonebookStoreData.iMbdnMaximumTextLength = KMaxTextLength; |
|
2508 iPhonebookStoreData.iMbdnMaximumNumberLength = KMaxNumberLength; |
|
2509 iPhonebookStoreData.iMbdnCapabilities = 0; |
|
2510 |
|
2511 iPhonebookStoreData.iEmailMaximumFieldsPerEntry = 101; |
|
2512 iPhonebookStoreData.iEmailMaximumLength = KMaxTextLength; |
|
2513 |
|
2514 iPhonebookStoreData.iAdditionalNumberMaximumFieldsPerEntry = 102; |
|
2515 iPhonebookStoreData.iAdditionalNumberMaximumLength = KMaxNumberLength; |
|
2516 |
|
2517 iPhonebookStoreData.iSecondNameMaximumFieldsPerEntry = 103; |
|
2518 iPhonebookStoreData.iSecondNameMaximumLength = KMaxTextLength; |
|
2519 |
|
2520 |
|
2521 iInititalised = EFalse; |
|
2522 } |
|
2523 |
|
2524 /** |
|
2525 * Helper funtion to test the Read functionality |
|
2526 * |
|
2527 * @param aPhonebook The phonebook being tested |
|
2528 * @param aPhoneBookStore The opened store |
|
2529 * @param aError the Error to return from the LTSY |
|
2530 */ |
|
2531 void CCTsyPhonebookFU::ReadL(DispatcherPhonebook::TPhonebook aPhonebook, const RMobilePhoneBookStore& aPhonebookStore, TInt aError) |
|
2532 { |
|
2533 if(CachingPhonebook(aPhonebook)) |
|
2534 { |
|
2535 //read one entry, when one entry is read this does a non-cache read |
|
2536 //thus down to the LTSY |
|
2537 for(TInt i = 1; i <= iEntries.Count(); ++i) |
|
2538 { |
|
2539 NonCacheReadL(aPhonebook,aPhonebookStore,i,1,aError); |
|
2540 } |
|
2541 |
|
2542 //read two entries, (> 1) thus a cache read |
|
2543 CacheReadL(aPhonebookStore,1,iEntries.Count()); |
|
2544 } |
|
2545 else //non caching phonebook |
|
2546 { |
|
2547 |
|
2548 //test a single entry |
|
2549 for(TInt i = 1; i <= iEntries.Count(); ++i) |
|
2550 { |
|
2551 NonCacheReadL(aPhonebook,aPhonebookStore,i,1,aError); |
|
2552 } |
|
2553 |
|
2554 //test all entries |
|
2555 NonCacheReadL(aPhonebook,aPhonebookStore,1,iEntries.Count(),aError); |
|
2556 |
|
2557 } |
|
2558 } |
|
2559 |
|
2560 /** |
|
2561 * Helper funtion to test the Read functionality |
|
2562 * |
|
2563 * @param aPhonebook The phonebook being tested |
|
2564 * @param aError the Error to return from the LTSY |
|
2565 */ |
|
2566 void CCTsyPhonebookFU::ReadL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError) |
|
2567 { |
|
2568 RMmCustomAPI customApi; |
|
2569 OpenCustomApiLC(customApi); |
|
2570 |
|
2571 RMobilePhoneBookStore phoneBookStore; |
|
2572 CleanupClosePushL(phoneBookStore); |
|
2573 OpenPhoneBookL(aPhonebook,phoneBookStore,customApi); |
|
2574 |
|
2575 ReadL(aPhonebook,phoneBookStore,aError); |
|
2576 |
|
2577 // destroying the phonebook store, while one of the caching phonebooks |
|
2578 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
2579 // message being generated by the ctsy |
|
2580 |
|
2581 if (CachingPhonebook(aPhonebook)) |
|
2582 { |
|
2583 RBuf8 data; |
|
2584 CleanupClosePushL(data); |
|
2585 |
|
2586 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(aPhonebook); |
|
2587 expLtsyData.SerialiseL(data); |
|
2588 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
2589 data.Close(); |
|
2590 |
|
2591 CleanupStack::PopAndDestroy(&data); |
|
2592 } |
|
2593 |
|
2594 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
2595 CleanupStack::PopAndDestroy(&customApi); |
|
2596 } |
|
2597 |
|
2598 /** |
|
2599 * Helper funtion to do a cache read |
|
2600 * |
|
2601 * @param aPhoneBookStore The opened store |
|
2602 * @param aIndex The index being read |
|
2603 * @param aNumberOfSlots The number of slots being read |
|
2604 */ |
|
2605 void CCTsyPhonebookFU::CacheReadL(const RMobilePhoneBookStore& aPhoneBookStore, TInt aIndex, TInt aNumberOfSlots) |
|
2606 { |
|
2607 TRequestStatus requestStatus; |
|
2608 |
|
2609 RBuf8 phonebookTlv; |
|
2610 CleanupClosePushL(phonebookTlv); |
|
2611 phonebookTlv.CreateL(KReadBufLength * aNumberOfSlots); |
|
2612 |
|
2613 //the cache read |
|
2614 aPhoneBookStore.Read(requestStatus,aIndex,aNumberOfSlots,phonebookTlv); |
|
2615 User::WaitForRequest(requestStatus); |
|
2616 ASSERT_EQUALS(requestStatus.Int(),KErrNone) |
|
2617 |
|
2618 RPointerArray<CPhoneBookEntry> phonebookArray; |
|
2619 TCleanupItem arrayCleanup( PhoneBookEntryArrayCleanup, &phonebookArray); |
|
2620 CleanupStack::PushL(arrayCleanup); |
|
2621 |
|
2622 //convert TLV -> CPhoneBookEntry(s) |
|
2623 FillPhonebookEntryArrayFromTlvL(phonebookTlv,phonebookArray); |
|
2624 |
|
2625 //check the TLV is the what we expect |
|
2626 ASSERT_EQUALS(aNumberOfSlots,phonebookArray.Count()); |
|
2627 for(TInt i = 0; i < phonebookArray.Count(); ++i) |
|
2628 { |
|
2629 ASSERT_EQUALS(*phonebookArray[i],*iEntries[aIndex + i -1]); |
|
2630 } |
|
2631 |
|
2632 AssertMockLtsyStatusL(); |
|
2633 |
|
2634 CleanupStack::PopAndDestroy(&phonebookArray); |
|
2635 CleanupStack::PopAndDestroy(&phonebookTlv); |
|
2636 } |
|
2637 |
|
2638 /** |
|
2639 * Helper funtion to do a complete non-cache read |
|
2640 * |
|
2641 * @param aPhonebook The phonebook being tested |
|
2642 * @param aPhoneBookStore The opened store |
|
2643 * @param aIndex The index being read |
|
2644 * @param aNumberOfSlots The number of slots being read |
|
2645 * @param aError The error to return from the LTSY |
|
2646 */ |
|
2647 void CCTsyPhonebookFU::NonCacheReadL( DispatcherPhonebook::TPhonebook aPhonebook, |
|
2648 const RMobilePhoneBookStore& aPhoneBookStore, |
|
2649 TInt aIndex, |
|
2650 TInt aNumberOfSlots, |
|
2651 TInt aError) |
|
2652 { |
|
2653 TRequestStatus requestStatus; |
|
2654 |
|
2655 RBuf8 readBuf; |
|
2656 CleanupClosePushL(readBuf); |
|
2657 readBuf.CreateL(KReadBufLength * aNumberOfSlots); |
|
2658 |
|
2659 ExpectNonCacheReadL(aPhonebook,aPhoneBookStore,aIndex,aNumberOfSlots,requestStatus,readBuf); |
|
2660 CompleteNonCacheReadL(aPhonebook,aIndex,aNumberOfSlots,requestStatus,readBuf,aError); |
|
2661 |
|
2662 CleanupStack::PopAndDestroy(&readBuf); |
|
2663 } |
|
2664 |
|
2665 /** |
|
2666 * Helper funtion to start the non-cache read |
|
2667 * |
|
2668 * @param aPhonebook The phonebook being tested |
|
2669 * @param aPhoneBookStore The opened store |
|
2670 * @param aIndex The index being read |
|
2671 * @param aNumberOfSlots The number of slots being read |
|
2672 * @param aRequestStatus The pending TRequestStatus to wait on |
|
2673 * @param aReadData The data read (Returned to ETel) |
|
2674 * |
|
2675 */ |
|
2676 void CCTsyPhonebookFU::ExpectNonCacheReadL( DispatcherPhonebook::TPhonebook aPhonebook, |
|
2677 const RMobilePhoneBookStore& aPhoneBookStore, |
|
2678 TInt aIndex, |
|
2679 TInt aNumberOfSlots, |
|
2680 TRequestStatus& aRequestStatus, |
|
2681 TDes8& aReadData) |
|
2682 { |
|
2683 RBuf8 data; |
|
2684 CleanupClosePushL(data); |
|
2685 |
|
2686 TMockLtsyData3<DispatcherPhonebook::TPhonebook,TInt,TInt> readEntryData(aPhonebook,aIndex,aNumberOfSlots); |
|
2687 readEntryData.SerialiseL(data); |
|
2688 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreReadEntry::KLtsyDispatchPhonebookStoreReadEntryApiId,data); |
|
2689 data.Close(); |
|
2690 |
|
2691 aPhoneBookStore.Read(aRequestStatus,aIndex,aNumberOfSlots,aReadData); |
|
2692 ASSERT_EQUALS(aRequestStatus.Int(),KRequestPending); |
|
2693 |
|
2694 CleanupStack::PopAndDestroy(&data); |
|
2695 } |
|
2696 |
|
2697 /** |
|
2698 * Helper funtion to complete the non-cache read |
|
2699 * |
|
2700 * @param aPhonebook The phonebook being tested |
|
2701 * @param aIndex The index being read |
|
2702 * @param aNumberOfSlots The number of slots being read |
|
2703 * @param aRequestStatus The pending TRequestStatus to wait on |
|
2704 * @param aReadData The data read (Returned to ETel) |
|
2705 * @param aError The error to return from the LTSY |
|
2706 */ |
|
2707 void CCTsyPhonebookFU::CompleteNonCacheReadL( DispatcherPhonebook::TPhonebook aPhonebook, |
|
2708 TInt aIndex, |
|
2709 TInt aNumberOfSlots, |
|
2710 TRequestStatus& aRequestStatus, |
|
2711 const TDesC8& aReadData, |
|
2712 TInt aError) |
|
2713 { |
|
2714 RBuf8 data; |
|
2715 CleanupClosePushL(data); |
|
2716 |
|
2717 RPointerArray<CPhoneBookEntry> phonebook; |
|
2718 CleanupClosePushL(phonebook); |
|
2719 |
|
2720 for(TInt i = 0; i < aNumberOfSlots; ++i) |
|
2721 { |
|
2722 phonebook.AppendL(iEntries[i + aIndex - 1]); //not owned |
|
2723 } |
|
2724 |
|
2725 RBuf8 tlvEntry; |
|
2726 CleanupClosePushL(tlvEntry); |
|
2727 |
|
2728 CreateTlvFromPhonebookL(phonebook,tlvEntry); |
|
2729 |
|
2730 TDesC8* tlvEntryPtr = &tlvEntry; |
|
2731 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TDesC8*> readEntryLtsyData(aPhonebook,tlvEntryPtr); |
|
2732 readEntryLtsyData.SerialiseL(data); |
|
2733 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreReadEntry::KLtsyDispatchPhonebookStoreReadEntryApiId,aError,data); |
|
2734 data.Close(); |
|
2735 |
|
2736 User::WaitForRequest(aRequestStatus); |
|
2737 |
|
2738 ASSERT_EQUALS(aRequestStatus.Int(),aError) |
|
2739 if(aError == KErrNone) |
|
2740 { |
|
2741 ASSERT_TRUE(tlvEntry == aReadData); |
|
2742 } |
|
2743 |
|
2744 AssertMockLtsyStatusL(); |
|
2745 |
|
2746 CleanupStack::PopAndDestroy(&tlvEntry); |
|
2747 CleanupStack::PopAndDestroy(&phonebook); |
|
2748 CleanupStack::PopAndDestroy(&data); |
|
2749 } |
|
2750 |
|
2751 /** |
|
2752 * Helper funtion to Test the Delete function on a phonebook |
|
2753 * |
|
2754 * @param aPhonebook The phonebook to test |
|
2755 * @param aIndexToDelete The index to remove |
|
2756 * @param aError The error to return from the LTSY |
|
2757 */ |
|
2758 void CCTsyPhonebookFU::DeleteL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aIndexToDelete, TInt aError) |
|
2759 { |
|
2760 RBuf8 data; |
|
2761 CleanupClosePushL(data); |
|
2762 |
|
2763 TRequestStatus requestStatus; |
|
2764 |
|
2765 RMmCustomAPI customApi; |
|
2766 OpenCustomApiLC(customApi); |
|
2767 |
|
2768 RMobilePhoneBookStore phoneBookStore; |
|
2769 CleanupClosePushL(phoneBookStore); |
|
2770 |
|
2771 OpenPhoneBookL(aPhonebook,phoneBookStore,customApi); |
|
2772 |
|
2773 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TInt> deleteExpLtsyData(aPhonebook,aIndexToDelete); |
|
2774 deleteExpLtsyData.SerialiseL(data); |
|
2775 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreDeleteEntry::KLtsyDispatchPhonebookStoreDeleteEntryApiId,data); |
|
2776 data.Close(); |
|
2777 |
|
2778 phoneBookStore.Delete(requestStatus,aIndexToDelete); |
|
2779 |
|
2780 TInt newMaxNumberLength = ( aPhonebook == DispatcherPhonebook::EIccFdn || |
|
2781 aPhonebook == DispatcherPhonebook::EIccAdn || |
|
2782 aPhonebook == DispatcherPhonebook::EIccVmb ) ? KNewMaxTextLength : KErrNotFound; |
|
2783 |
|
2784 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TInt> deleteCompLtsyData(aPhonebook,newMaxNumberLength); |
|
2785 deleteCompLtsyData.SerialiseL(data); |
|
2786 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreDeleteEntry::KLtsyDispatchPhonebookStoreDeleteEntryApiId, aError, data); |
|
2787 data.Close(); |
|
2788 |
|
2789 User::WaitForRequest(requestStatus); |
|
2790 ASSERT_EQUALS(aError, requestStatus.Int()); |
|
2791 |
|
2792 AssertMockLtsyStatusL(); |
|
2793 |
|
2794 //now check newMaxNumberLength is correct in the CTSY |
|
2795 |
|
2796 switch(aPhonebook) |
|
2797 { |
|
2798 case DispatcherPhonebook::EIccAdn: |
|
2799 iPhonebookStoreData.iAdnMaximumNumberLength = newMaxNumberLength; |
|
2800 break; |
|
2801 case DispatcherPhonebook::EIccFdn: |
|
2802 iPhonebookStoreData.iFdnMaximumNumberLength = newMaxNumberLength; |
|
2803 break; |
|
2804 case DispatcherPhonebook::EIccVmb: |
|
2805 iPhonebookStoreData.iVmbMaximumNumberLength = newMaxNumberLength; |
|
2806 break; |
|
2807 default: |
|
2808 break; |
|
2809 } |
|
2810 |
|
2811 CheckPhonebookDetailsL(aPhonebook,phoneBookStore,iEntries.Count() - ((aError == KErrNone) ? 1 : 0),aError); |
|
2812 |
|
2813 |
|
2814 // destroying the phonebook store, while one of the caching phonebooks |
|
2815 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
2816 // message being generated by the ctsy |
|
2817 |
|
2818 if (CachingPhonebook(aPhonebook)) |
|
2819 { |
|
2820 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(aPhonebook); |
|
2821 expLtsyData.SerialiseL(data); |
|
2822 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
2823 data.Close(); |
|
2824 } |
|
2825 |
|
2826 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
2827 CleanupStack::PopAndDestroy(&customApi); |
|
2828 CleanupStack::PopAndDestroy(&data); |
|
2829 } |
|
2830 |
|
2831 /** |
|
2832 * Helper funtion to Test DeleteAll function on a phonebook |
|
2833 * |
|
2834 * @param aPhonebook The phonebook to test |
|
2835 * @param aError The error to return from the LTSY |
|
2836 */ |
|
2837 void CCTsyPhonebookFU::DeleteAllL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError) |
|
2838 { |
|
2839 RBuf8 data; |
|
2840 CleanupClosePushL(data); |
|
2841 |
|
2842 TRequestStatus requestStatus; |
|
2843 |
|
2844 RMmCustomAPI customApi; |
|
2845 OpenCustomApiLC(customApi); |
|
2846 |
|
2847 RMobilePhoneBookStore phoneBookStore; |
|
2848 CleanupClosePushL(phoneBookStore); |
|
2849 |
|
2850 OpenPhoneBookL(aPhonebook,phoneBookStore,customApi); |
|
2851 |
|
2852 TMockLtsyData1<DispatcherPhonebook::TPhonebook> deleteAllExpLtsyData(aPhonebook); |
|
2853 deleteAllExpLtsyData.SerialiseL(data); |
|
2854 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreDeleteAll::KLtsyDispatchPhonebookStoreDeleteAllApiId,data); |
|
2855 data.Close(); |
|
2856 |
|
2857 phoneBookStore.DeleteAll(requestStatus); |
|
2858 |
|
2859 TInt newMaxNumberLength = ( aPhonebook == DispatcherPhonebook::EIccFdn || |
|
2860 aPhonebook == DispatcherPhonebook::EIccAdn || |
|
2861 aPhonebook == DispatcherPhonebook::EIccVmb ) ? KNewMaxTextLength : KErrNotFound; |
|
2862 |
|
2863 |
|
2864 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TInt> deleteAllCompLtsyData(aPhonebook,newMaxNumberLength); |
|
2865 deleteAllCompLtsyData.SerialiseL(data); |
|
2866 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreDeleteAll::KLtsyDispatchPhonebookStoreDeleteAllApiId,aError,data); |
|
2867 data.Close(); |
|
2868 |
|
2869 User::WaitForRequest(requestStatus); |
|
2870 ASSERT_EQUALS(aError, requestStatus.Int()); |
|
2871 |
|
2872 AssertMockLtsyStatusL(); |
|
2873 |
|
2874 //now check newMaxNumberLength is correct in the CTSY |
|
2875 |
|
2876 switch(aPhonebook) |
|
2877 { |
|
2878 case DispatcherPhonebook::EIccAdn: |
|
2879 iPhonebookStoreData.iAdnMaximumNumberLength = newMaxNumberLength; |
|
2880 break; |
|
2881 case DispatcherPhonebook::EIccFdn: |
|
2882 iPhonebookStoreData.iFdnMaximumNumberLength = newMaxNumberLength; |
|
2883 break; |
|
2884 case DispatcherPhonebook::EIccVmb: |
|
2885 iPhonebookStoreData.iVmbMaximumNumberLength = newMaxNumberLength; |
|
2886 break; |
|
2887 default: |
|
2888 break; |
|
2889 } |
|
2890 |
|
2891 CheckPhonebookDetailsL(aPhonebook,phoneBookStore,(aError == KErrNone) ? 0 : iEntries.Count(),aError); |
|
2892 |
|
2893 // destroying the phonebook store, while one of the caching phonebooks |
|
2894 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
2895 // message being generated by the ctsy |
|
2896 |
|
2897 if (CachingPhonebook(aPhonebook)) |
|
2898 { |
|
2899 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(aPhonebook); |
|
2900 expLtsyData.SerialiseL(data); |
|
2901 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
2902 data.Close(); |
|
2903 } |
|
2904 |
|
2905 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
2906 CleanupStack::PopAndDestroy(&customApi); |
|
2907 CleanupStack::PopAndDestroy(&data); |
|
2908 } |
|
2909 |
|
2910 /** |
|
2911 * Helper funtion to Test the writing to a phonebook |
|
2912 * |
|
2913 * @param aPhonebook The phonebook to test |
|
2914 * @param aPhoneBookEntry The entry to write |
|
2915 * @param aError The error to return from the LTSY |
|
2916 */ |
|
2917 void CCTsyPhonebookFU::WriteL(DispatcherPhonebook::TPhonebook aPhonebook, const CPhoneBookEntry& aPhoneBookEntry, TInt aError) |
|
2918 { |
|
2919 RMmCustomAPI customApi; |
|
2920 OpenCustomApiLC(customApi); |
|
2921 |
|
2922 RMobilePhoneBookStore phoneBookStore; |
|
2923 CleanupClosePushL(phoneBookStore); |
|
2924 |
|
2925 OpenPhoneBookL(aPhonebook,phoneBookStore,customApi); |
|
2926 WriteL(aPhonebook,phoneBookStore,aPhoneBookEntry,aError); |
|
2927 |
|
2928 // destroying the phonebook store, while one of the caching phonebooks |
|
2929 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
2930 // message being generated by the ctsy |
|
2931 |
|
2932 if (CachingPhonebook(aPhonebook)) |
|
2933 { |
|
2934 RBuf8 data; |
|
2935 CleanupClosePushL(data); |
|
2936 |
|
2937 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(aPhonebook); |
|
2938 expLtsyData.SerialiseL(data); |
|
2939 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
2940 data.Close(); |
|
2941 |
|
2942 CleanupStack::PopAndDestroy(&data); |
|
2943 } |
|
2944 |
|
2945 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
2946 CleanupStack::PopAndDestroy(&customApi); |
|
2947 } |
|
2948 |
|
2949 /** |
|
2950 * Helper funtion to Test the writing to a phonebook |
|
2951 * |
|
2952 * @param aPhonebook The phonebook to test |
|
2953 * @param aPhoneBookStore The opened store |
|
2954 * @param aPhoneBookEntry The entry to write |
|
2955 * @param aError The error to return from the LTSY |
|
2956 */ |
|
2957 void CCTsyPhonebookFU::WriteL( DispatcherPhonebook::TPhonebook aPhonebook, |
|
2958 const RMobilePhoneBookStore& aPhonebookStore, |
|
2959 const CPhoneBookEntry& aPhoneBookEntry, |
|
2960 TInt aError) |
|
2961 { |
|
2962 RBuf8 data; |
|
2963 CleanupClosePushL(data); |
|
2964 |
|
2965 TRequestStatus requestStatus; |
|
2966 |
|
2967 RBuf8 buf; |
|
2968 CleanupClosePushL(buf); |
|
2969 buf.CreateL(aPhoneBookEntry.TlvLength()); |
|
2970 CreateTlvFromEntryL(aPhoneBookEntry,buf); |
|
2971 |
|
2972 TDesC8* bufPtr = &buf; |
|
2973 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TDesC8*> writeEntryExpLtsyData(aPhonebook,bufPtr); |
|
2974 writeEntryExpLtsyData.SerialiseL(data); |
|
2975 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreWriteEntry::KLtsyDispatchPhonebookStoreWriteEntryApiId,data); |
|
2976 data.Close(); |
|
2977 |
|
2978 TInt index = aPhoneBookEntry.GetIndex(); |
|
2979 aPhonebookStore.Write(requestStatus,buf,index); |
|
2980 |
|
2981 TUint16 writtenIndex = aPhoneBookEntry.GetIndex(); |
|
2982 |
|
2983 TInt newMaxNumberLength = ( aPhonebook == DispatcherPhonebook::EIccFdn || |
|
2984 aPhonebook == DispatcherPhonebook::EIccAdn || |
|
2985 aPhonebook == DispatcherPhonebook::EIccVmb ) ? KNewMaxTextLength : KErrNotFound; |
|
2986 |
|
2987 TMockLtsyData3<DispatcherPhonebook::TPhonebook,TUint16,TInt> writeEntryCompLtsyData(aPhonebook,writtenIndex,newMaxNumberLength); |
|
2988 writeEntryCompLtsyData.SerialiseL(data); |
|
2989 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreWriteEntry::KLtsyDispatchPhonebookStoreWriteEntryApiId,aError,data); |
|
2990 data.Close(); |
|
2991 |
|
2992 User::WaitForRequest(requestStatus); |
|
2993 ASSERT_EQUALS(aError, requestStatus.Int()); |
|
2994 |
|
2995 //index is passed in as a reference and returned where the entry was written |
|
2996 ASSERT_TRUE(index == writtenIndex); |
|
2997 |
|
2998 AssertMockLtsyStatusL(); |
|
2999 |
|
3000 //now check newMaxNumberLength is correct in the CTSY |
|
3001 |
|
3002 switch(aPhonebook) |
|
3003 { |
|
3004 case DispatcherPhonebook::EIccAdn: |
|
3005 iPhonebookStoreData.iAdnMaximumNumberLength = newMaxNumberLength; |
|
3006 break; |
|
3007 case DispatcherPhonebook::EIccFdn: |
|
3008 iPhonebookStoreData.iFdnMaximumNumberLength = newMaxNumberLength; |
|
3009 break; |
|
3010 case DispatcherPhonebook::EIccVmb: |
|
3011 iPhonebookStoreData.iVmbMaximumNumberLength = newMaxNumberLength; |
|
3012 break; |
|
3013 default: |
|
3014 break; |
|
3015 } |
|
3016 |
|
3017 const TInt newEntryCount = (aError == KErrNone || |
|
3018 aError == KErrGsmSimServSneFull || |
|
3019 aError == KErrGsmSimServAnrFull || |
|
3020 aError == KErrGsmSimServEmailFull) ? 1 : 0; |
|
3021 CheckPhonebookDetailsL(aPhonebook,aPhonebookStore,iEntries.Count() + newEntryCount,aError); |
|
3022 |
|
3023 CleanupStack::PopAndDestroy(&buf); |
|
3024 CleanupStack::PopAndDestroy(&data); |
|
3025 } |
|
3026 |
|
3027 |
|
3028 /** |
|
3029 * Helper funtion to check the phonebook store details. |
|
3030 * |
|
3031 * @param aPhonebook The phonebook to test |
|
3032 * @param aPhonebookStore The open store |
|
3033 * @param aEntries The number of entries expected in the store |
|
3034 * @param |
|
3035 */ |
|
3036 void CCTsyPhonebookFU::CheckPhonebookDetailsL( DispatcherPhonebook::TPhonebook aPhonebook, |
|
3037 const RMobilePhoneBookStore& aPhonebookStore, |
|
3038 TInt aEntries, |
|
3039 TInt aError) |
|
3040 { |
|
3041 switch(aPhonebook) |
|
3042 { |
|
3043 case DispatcherPhonebook::EIccAdn: |
|
3044 case DispatcherPhonebook::EIccFdn: |
|
3045 case DispatcherPhonebook::EIccMbdn: |
|
3046 { |
|
3047 GetInfoFromCtsy(aPhonebook,aPhonebookStore,aEntries); |
|
3048 } |
|
3049 break; |
|
3050 case DispatcherPhonebook::EIccSdn: |
|
3051 case DispatcherPhonebook::EIccVmb: |
|
3052 { |
|
3053 GetInfoFromLtsyL(aPhonebook,aPhonebookStore,aEntries,aError); |
|
3054 } |
|
3055 default: |
|
3056 { |
|
3057 } |
|
3058 break; |
|
3059 } |
|
3060 } |
|
3061 |
|
3062 /** |
|
3063 * Helper funtion to Test getting the phonebook store info from the CTSY & LTSY |
|
3064 * |
|
3065 * @param aPhonebook The phonebook to test |
|
3066 * @param aError The error to return from the LTSY |
|
3067 */ |
|
3068 void CCTsyPhonebookFU::GetInfoL(DispatcherPhonebook::TPhonebook aPhonebook, TInt aError) |
|
3069 { |
|
3070 RMmCustomAPI customApi; |
|
3071 OpenCustomApiLC(customApi); |
|
3072 |
|
3073 RMobilePhoneBookStore phoneBookStore; |
|
3074 CleanupClosePushL(phoneBookStore); |
|
3075 |
|
3076 OpenPhoneBookL(aPhonebook,phoneBookStore,customApi); |
|
3077 |
|
3078 CheckPhonebookDetailsL(aPhonebook,phoneBookStore,iEntries.Count(),aError); |
|
3079 |
|
3080 // destroying the phonebook store, while one of the caching phonebooks |
|
3081 // ADN/FDN is in the not-ready state will result in a store cache cancel |
|
3082 // message being generated by the ctsy |
|
3083 |
|
3084 if (CachingPhonebook(aPhonebook)) |
|
3085 { |
|
3086 RBuf8 data; |
|
3087 CleanupClosePushL(data); |
|
3088 |
|
3089 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(aPhonebook); |
|
3090 expLtsyData.SerialiseL(data); |
|
3091 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
3092 data.Close(); |
|
3093 |
|
3094 CleanupStack::PopAndDestroy(&data); |
|
3095 } |
|
3096 |
|
3097 CleanupStack::PopAndDestroy(&phoneBookStore); |
|
3098 CleanupStack::PopAndDestroy(&customApi); |
|
3099 } |
|
3100 |
|
3101 |
|
3102 /** |
|
3103 * Helper funtion to Test getting the phonebook store info from the CTSY |
|
3104 * |
|
3105 * @param aPhonebook The phonebook to test |
|
3106 */ |
|
3107 void CCTsyPhonebookFU::GetInfoFromCtsy(DispatcherPhonebook::TPhonebook aPhonebook, |
|
3108 const RMobilePhoneBookStore& aPhonebookStore, |
|
3109 TInt aUsedEntries) |
|
3110 { |
|
3111 TRequestStatus requestStatus; |
|
3112 |
|
3113 RMobilePhoneBookStore::TMobilePhoneBookInfoV1 bookInfo; |
|
3114 RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg bookInfoPckg(bookInfo); |
|
3115 |
|
3116 aPhonebookStore.GetInfo(requestStatus,bookInfoPckg); |
|
3117 |
|
3118 User::WaitForRequest(requestStatus); |
|
3119 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
3120 ASSERT_EQUALS(bookInfo.iType, RMobilePhoneStore::EPhoneBookStore); |
|
3121 ASSERT_EQUALS(bookInfo.iLocation, RMobilePhoneBookStore::ELocationIccMemory); |
|
3122 |
|
3123 switch(aPhonebook) |
|
3124 { |
|
3125 case DispatcherPhonebook::EIccAdn: |
|
3126 { |
|
3127 ASSERT_EQUALS(bookInfo.iTotalEntries, iPhonebookStoreData.iAdnTotalEntries); |
|
3128 ASSERT_EQUALS(bookInfo.iUsedEntries, aUsedEntries); |
|
3129 ASSERT_EQUALS(bookInfo.iMaxNumLength, iPhonebookStoreData.iAdnMaximumNumberLength); |
|
3130 ASSERT_EQUALS(bookInfo.iMaxTextLength,iPhonebookStoreData.iAdnMaximumTextLength); |
|
3131 } |
|
3132 break; |
|
3133 |
|
3134 case DispatcherPhonebook::EIccFdn: |
|
3135 { |
|
3136 ASSERT_EQUALS(bookInfo.iTotalEntries, iPhonebookStoreData.iFdnTotalEntries); |
|
3137 ASSERT_EQUALS(bookInfo.iUsedEntries, aUsedEntries); |
|
3138 ASSERT_EQUALS(bookInfo.iMaxNumLength, iPhonebookStoreData.iFdnMaximumNumberLength); |
|
3139 ASSERT_EQUALS(bookInfo.iMaxTextLength, iPhonebookStoreData.iFdnMaximumTextLength); |
|
3140 } |
|
3141 break; |
|
3142 |
|
3143 case DispatcherPhonebook::EIccMbdn: |
|
3144 { |
|
3145 ASSERT_EQUALS(bookInfo.iTotalEntries, iPhonebookStoreData.iMbdnTotalEntries); |
|
3146 //The CTSY does not cache Mbdn entires but does not sent a request down to the LTSY |
|
3147 //like other non cached phonebooks for the used entires count, possible CTSY defect? |
|
3148 //ASSERT_EQUALS(bookInfo.iUsedEntries, aUsedEntries); |
|
3149 ASSERT_EQUALS(bookInfo.iMaxNumLength, iPhonebookStoreData.iMbdnMaximumNumberLength); |
|
3150 ASSERT_EQUALS(bookInfo.iMaxTextLength, iPhonebookStoreData.iMbdnMaximumTextLength); |
|
3151 |
|
3152 } |
|
3153 break; |
|
3154 |
|
3155 default: |
|
3156 { |
|
3157 } |
|
3158 break; |
|
3159 } |
|
3160 } |
|
3161 |
|
3162 /** |
|
3163 * Helper funtion to Test getting the phonebook store info from the LTSY |
|
3164 * |
|
3165 * @param aPhonebook The phonebook to test |
|
3166 * @param aError The error to return from the LTSY |
|
3167 */ |
|
3168 void CCTsyPhonebookFU::GetInfoFromLtsyL(DispatcherPhonebook::TPhonebook aPhonebook, |
|
3169 const RMobilePhoneBookStore& aPhonebookStore, |
|
3170 TInt aUsedEntries, |
|
3171 TInt aError) |
|
3172 { |
|
3173 RBuf8 data; |
|
3174 CleanupClosePushL(data); |
|
3175 |
|
3176 TRequestStatus requestStatus; |
|
3177 |
|
3178 TMockLtsyData1<DispatcherPhonebook::TPhonebook> getInfoExpLtsyData(aPhonebook); |
|
3179 getInfoExpLtsyData.SerialiseL(data); |
|
3180 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreGetPhonebookInfo::KLtsyDispatchPhonebookStoreGetPhonebookInfoApiId,data); |
|
3181 data.Close(); |
|
3182 |
|
3183 |
|
3184 RMobilePhoneBookStore::TMobilePhoneBookInfoV1 bookInfo; |
|
3185 RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg bookInfoPckg(bookInfo); |
|
3186 aPhonebookStore.GetInfo(requestStatus,bookInfoPckg); |
|
3187 |
|
3188 TMockLtsyData2<DispatcherPhonebook::TPhonebook,TInt> getInfoCompLtsyData(aPhonebook,aUsedEntries); |
|
3189 getInfoCompLtsyData.SerialiseL(data); |
|
3190 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreGetPhonebookInfo::KLtsyDispatchPhonebookStoreGetPhonebookInfoApiId,aError,data); |
|
3191 data.Close(); |
|
3192 |
|
3193 User::WaitForRequest(requestStatus); |
|
3194 ASSERT_EQUALS(aError,requestStatus.Int()); |
|
3195 ASSERT_EQUALS(bookInfo.iType, RMobilePhoneStore::EPhoneBookStore); |
|
3196 ASSERT_EQUALS(bookInfo.iLocation, RMobilePhoneBookStore::ELocationIccMemory); |
|
3197 |
|
3198 if(aError == KErrNone) |
|
3199 { |
|
3200 ASSERT_EQUALS(bookInfo.iUsedEntries,aUsedEntries); |
|
3201 } |
|
3202 |
|
3203 switch(aPhonebook) |
|
3204 { |
|
3205 case DispatcherPhonebook::EIccSdn: |
|
3206 { |
|
3207 ASSERT_EQUALS(bookInfo.iTotalEntries,iPhonebookStoreData.iSdnTotalEntries); |
|
3208 ASSERT_EQUALS(bookInfo.iMaxNumLength,iPhonebookStoreData.iSdnMaximumNumberLength); |
|
3209 ASSERT_EQUALS(bookInfo.iMaxTextLength,iPhonebookStoreData.iSdnMaximumTextLength); |
|
3210 } |
|
3211 break; |
|
3212 |
|
3213 case DispatcherPhonebook::EIccVmb: |
|
3214 { |
|
3215 ASSERT_EQUALS(bookInfo.iTotalEntries,iPhonebookStoreData.iVmbTotalEntries); |
|
3216 ASSERT_EQUALS(bookInfo.iMaxNumLength,iPhonebookStoreData.iVmbMaximumNumberLength); |
|
3217 ASSERT_EQUALS(bookInfo.iMaxTextLength,iPhonebookStoreData.iVmbMaximumTextLength); |
|
3218 } |
|
3219 break; |
|
3220 |
|
3221 default: |
|
3222 { |
|
3223 |
|
3224 } |
|
3225 break; |
|
3226 } |
|
3227 |
|
3228 AssertMockLtsyStatusL(); |
|
3229 |
|
3230 CleanupStack::PopAndDestroy(&data); |
|
3231 } |
|
3232 |
|
3233 /** |
|
3234 * Helper funtion to Test the Set Fdn Info IPC |
|
3235 * |
|
3236 * @param aError The error to return from the LTSY |
|
3237 */ |
|
3238 void CCTsyPhonebookFU::SetFdnInfoL(RMobilePhoneBookStore& aPhoneBookStore, TInt aError) |
|
3239 { |
|
3240 RBuf8 data; |
|
3241 CleanupClosePushL(data); |
|
3242 |
|
3243 TInt totalEntries = iEntries.Count(); |
|
3244 TInt maximumTextLength = KMaxTextLength; |
|
3245 TInt maximumNumberLength = KMaxNumberLength; |
|
3246 |
|
3247 TMockLtsyData3<TInt,TInt,TInt> phonebookDataCompLtsyData(totalEntries,maximumTextLength,maximumNumberLength); |
|
3248 phonebookDataCompLtsyData.SerialiseL(data); |
|
3249 iMockLTSY.CompleteL(KMockLtsyDispatchPhonebookStoreSetFdnPhonebookInfoIndId,aError,data); |
|
3250 data.Close(); |
|
3251 |
|
3252 WaitForMockLTSYTerminated(); |
|
3253 |
|
3254 AssertMockLtsyStatusL(); |
|
3255 |
|
3256 //now check the info |
|
3257 |
|
3258 if(aError == KErrNone) |
|
3259 { |
|
3260 iPhonebookStoreData.iFdnTotalEntries = totalEntries; |
|
3261 iPhonebookStoreData.iFdnMaximumTextLength = maximumTextLength; |
|
3262 iPhonebookStoreData.iFdnMaximumNumberLength = maximumNumberLength; |
|
3263 } |
|
3264 |
|
3265 TRequestStatus requestStatus; |
|
3266 RMobilePhoneBookStore::TMobilePhoneBookInfoV1 bookInfo; |
|
3267 RMobilePhoneBookStore::TMobilePhoneBookInfoV1Pckg bookInfoPckg(bookInfo); |
|
3268 aPhoneBookStore.GetInfo(requestStatus,bookInfoPckg); |
|
3269 User::WaitForRequest(requestStatus); |
|
3270 |
|
3271 ASSERT_EQUALS(KErrNone, requestStatus.Int()); |
|
3272 ASSERT_EQUALS(bookInfo.iType, RMobilePhoneStore::EPhoneBookStore); |
|
3273 ASSERT_EQUALS(bookInfo.iLocation, RMobilePhoneBookStore::ELocationIccMemory); |
|
3274 ASSERT_EQUALS(bookInfo.iTotalEntries, iPhonebookStoreData.iFdnTotalEntries); |
|
3275 ASSERT_EQUALS(bookInfo.iUsedEntries, iEntries.Count()); |
|
3276 ASSERT_EQUALS(bookInfo.iMaxNumLength, iPhonebookStoreData.iFdnMaximumNumberLength); |
|
3277 ASSERT_EQUALS(bookInfo.iMaxTextLength, iPhonebookStoreData.iFdnMaximumTextLength); |
|
3278 |
|
3279 CleanupStack::PopAndDestroy(&data); |
|
3280 } |
|
3281 |
|
3282 /** |
|
3283 * Helper funtion to Test the Refresh IPC |
|
3284 * |
|
3285 * @param aPhonebook The phonebook to test |
|
3286 */ |
|
3287 void CCTsyPhonebookFU::RefreshL(DispatcherPhonebook::TPhonebook aPhonebook) |
|
3288 { |
|
3289 RBuf8 data; |
|
3290 CleanupClosePushL(data); |
|
3291 |
|
3292 //KCacheAdn KCacheFdn KCacheServiceTable KCacheALSline |
|
3293 TUint16 refreshFileList = 0; |
|
3294 |
|
3295 switch(aPhonebook) |
|
3296 { |
|
3297 case DispatcherPhonebook::EIccAdn: |
|
3298 refreshFileList = KCacheAdn; |
|
3299 break; |
|
3300 case DispatcherPhonebook::EIccFdn: |
|
3301 refreshFileList = KCacheFdn; |
|
3302 break; |
|
3303 default: |
|
3304 break; |
|
3305 } |
|
3306 |
|
3307 TMockLtsyData1<TUint16> refreshFileListData(refreshFileList); |
|
3308 refreshFileListData.SerialiseL(data); |
|
3309 iMockLTSY.CompleteL(KMockLtsyDispatchSimRefreshSimFilesIndId, KErrNone, data); |
|
3310 data.Close(); |
|
3311 |
|
3312 iMockLTSY.ExpectL(MLtsyDispatchSimGetSubscriberId::KLtsyDispatchSimGetSubscriberIdApiId); |
|
3313 |
|
3314 // Prepare data for the mockLtsy's CompleteL Note the CTSY expects the data in 8-bit format. |
|
3315 _LIT8 (KIMSI8, "012012012012999"); |
|
3316 TBuf8<RMobilePhone::KIMSISize> idComp(KIMSI8); |
|
3317 TMockLtsyData1<TBuf8<RMobilePhone::KIMSISize> > idCompData(idComp); |
|
3318 idCompData.SerialiseL(data); |
|
3319 iMockLTSY.CompleteL(MLtsyDispatchSimGetSubscriberId::KLtsyDispatchSimGetSubscriberIdApiId, KErrNone, data); |
|
3320 data.Close(); |
|
3321 |
|
3322 TMockLtsyData1<DispatcherPhonebook::TPhonebook> expLtsyData(aPhonebook); |
|
3323 expLtsyData.SerialiseL(data); |
|
3324 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCacheCancel::KLtsyDispatchPhonebookStoreCacheCancelApiId,data); |
|
3325 data.Close(); |
|
3326 |
|
3327 |
|
3328 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId); |
|
3329 |
|
3330 //complete initialise IPC |
|
3331 TMockLtsyData1<DispatcherPhonebook::TPhonebookStoreInfoV1> phonebookCompLtsyData(iPhonebookStoreData); |
|
3332 phonebookCompLtsyData.SerialiseL(data); |
|
3333 iMockLTSY.CompleteL(MLtsyDispatchPhonebookStoreInitialise::KLtsyDispatchPhonebookStoreInitialiseApiId,KErrNone,data); |
|
3334 data.Close(); |
|
3335 |
|
3336 TMockLtsyData1<DispatcherPhonebook::TPhonebook> cacheExpLtsyData(aPhonebook); |
|
3337 cacheExpLtsyData.SerialiseL(data); |
|
3338 iMockLTSY.ExpectL(MLtsyDispatchPhonebookStoreCache::KLtsyDispatchPhonebookStoreCacheApiId,data); |
|
3339 data.Close(); |
|
3340 |
|
3341 CompleteCacheL(aPhonebook, KErrNone, ETrue); |
|
3342 |
|
3343 AssertMockLtsyStatusL(); |
|
3344 |
|
3345 CleanupStack::PopAndDestroy(&data); |
|
3346 } |
|
3347 |
|
3348 /** |
|
3349 * @param aPhonebook The phonebook to check |
|
3350 * @return True if the phonebook sends down the initialise IPC on the first phonebook opened |
|
3351 */ |
|
3352 TBool CCTsyPhonebookFU::InitialisationRequired(DispatcherPhonebook::TPhonebook aPhonebook) const |
|
3353 { |
|
3354 switch (aPhonebook) |
|
3355 { |
|
3356 case DispatcherPhonebook::EIccAdn: |
|
3357 case DispatcherPhonebook::EIccFdn: |
|
3358 case DispatcherPhonebook::EIccVmb: |
|
3359 case DispatcherPhonebook::EIccMbdn: |
|
3360 case DispatcherPhonebook::EIccSdn: |
|
3361 case DispatcherPhonebook::EIccBdn: |
|
3362 return ETrue; |
|
3363 |
|
3364 default: |
|
3365 return EFalse; |
|
3366 } |
|
3367 } |
|
3368 |
|
3369 /** |
|
3370 * @param aPhonebook The phonebook to check |
|
3371 * @return True if the phonebook caches the entries, false otherwise |
|
3372 */ |
|
3373 |
|
3374 TBool CCTsyPhonebookFU::CachingPhonebook(DispatcherPhonebook::TPhonebook aPhonebook) const |
|
3375 { |
|
3376 switch (aPhonebook) |
|
3377 { |
|
3378 case DispatcherPhonebook::EIccAdn: |
|
3379 case DispatcherPhonebook::EIccFdn: |
|
3380 return ETrue; |
|
3381 default: |
|
3382 return EFalse; |
|
3383 |
|
3384 } |
|
3385 } |
|
3386 |
|
3387 /** |
|
3388 * Creates a TLV phonebook entry from a CPhoneBookEntry |
|
3389 * |
|
3390 * @param aPhoneBookEntry The entry to create the TLV from |
|
3391 * @param aBuf The buffer to write the TLV to |
|
3392 */ |
|
3393 void CCTsyPhonebookFU::CreateTlvFromEntryL(const CPhoneBookEntry& aPhoneBookEntry, RBuf8& aBuf) |
|
3394 { |
|
3395 RPointerArray<CPhoneBookEntry> phonebook; |
|
3396 CleanupClosePushL(phonebook); |
|
3397 |
|
3398 phonebook.AppendL(&aPhoneBookEntry); |
|
3399 |
|
3400 CreateTlvFromPhonebookL(phonebook,aBuf); |
|
3401 |
|
3402 CleanupStack::Pop(&phonebook); |
|
3403 phonebook.Close(); |
|
3404 } |
|
3405 |
|
3406 /** |
|
3407 * Creates a TLV phonebook entry from a CPhoneBookEntry array |
|
3408 * |
|
3409 * @param aPhonebook The phonebook entries to create the TLV from |
|
3410 * @param aBuf The buffer to write the TLV to |
|
3411 */ |
|
3412 void CCTsyPhonebookFU::CreateTlvFromPhonebookL(const RPointerArray<CPhoneBookEntry>& aPhonebook, RBuf8& aBuf) |
|
3413 { |
|
3414 TInt tlvSize = 0; |
|
3415 for(TInt i = 0; i < aPhonebook.Count(); ++i) |
|
3416 { |
|
3417 tlvSize += aPhonebook[i]->TlvLength(); |
|
3418 } |
|
3419 |
|
3420 aBuf.ReAllocL(tlvSize); |
|
3421 |
|
3422 CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer(); |
|
3423 CleanupStack::PushL(pbBuffer); |
|
3424 |
|
3425 pbBuffer->Set(&aBuf); |
|
3426 |
|
3427 for(TInt j = 0; j < aPhonebook.Count(); ++j) |
|
3428 { |
|
3429 aPhonebook[j]->ExternalizeToTlvEntry(*pbBuffer); |
|
3430 } |
|
3431 |
|
3432 CleanupStack::PopAndDestroy(pbBuffer); |
|
3433 } |
|
3434 |
|
3435 /** |
|
3436 * Fills a CPhoneBookEntry array from a phonebook TLV |
|
3437 * |
|
3438 * @param aEntry The entry in TLV form |
|
3439 * @param aPhoneBook The entry array to be filled |
|
3440 */ |
|
3441 void CCTsyPhonebookFU::FillPhonebookEntryArrayFromTlvL(const TDesC8& aEntry, RPointerArray<CPhoneBookEntry>& aPhoneBook) |
|
3442 { |
|
3443 CPhoneBookBuffer* pbBuffer = new (ELeave) CPhoneBookBuffer(); |
|
3444 CleanupStack::PushL(pbBuffer); |
|
3445 |
|
3446 RBuf8 buf; |
|
3447 CleanupClosePushL(buf); |
|
3448 |
|
3449 buf.CreateL(aEntry); |
|
3450 |
|
3451 pbBuffer->Set(&buf); |
|
3452 pbBuffer->StartRead(); |
|
3453 |
|
3454 TInt entriesCount = 0; |
|
3455 while(pbBuffer->RemainingReadLength() > 0) |
|
3456 { |
|
3457 entriesCount++; |
|
3458 CPhoneBookEntry* entry = CPhoneBookEntry::NewLC(); |
|
3459 aPhoneBook.AppendL(entry); |
|
3460 CleanupStack::Pop(entry); |
|
3461 |
|
3462 ASSERT_EQUALS(entry->InternalizeFromTlvEntry(*pbBuffer,entriesCount > 1),KErrNone); |
|
3463 } |
|
3464 |
|
3465 |
|
3466 CleanupStack::PopAndDestroy(&buf); |
|
3467 CleanupStack::PopAndDestroy(pbBuffer); |
|
3468 } |
|
3469 |
|
3470 /** |
|
3471 * Test the CPhoneBookEntry ExternalizeToTlvEntry and InternalizeFromTlvEntry functions |
|
3472 * |
|
3473 * @param aPhoneBookEntry The entry to test |
|
3474 */ |
|
3475 |
|
3476 void CCTsyPhonebookFU::TestTlvWriteReadL(const CPhoneBookEntry& aPhoneBookEntry) |
|
3477 { |
|
3478 RBuf8 tlv; |
|
3479 CleanupClosePushL(tlv); |
|
3480 tlv.CreateL(aPhoneBookEntry.TlvLength()); |
|
3481 |
|
3482 CPhoneBookBuffer* phonebookBuffer = new (ELeave) CPhoneBookBuffer(); |
|
3483 CleanupStack::PushL(phonebookBuffer); |
|
3484 phonebookBuffer->Set(&tlv); |
|
3485 |
|
3486 //convert to a TLV |
|
3487 ASSERT_EQUALS(aPhoneBookEntry.ExternalizeToTlvEntry(*phonebookBuffer),KErrNone); |
|
3488 |
|
3489 //the length should equal the maxlength if CPhoneBookEntry::TlvLength() is correct |
|
3490 //(with 3 spare slots for worst case padding) |
|
3491 ASSERT_EQUALS(tlv.Length() + 3,tlv.MaxLength()); |
|
3492 |
|
3493 CPhoneBookEntry* phonebookEntry = CPhoneBookEntry::NewLC(); |
|
3494 |
|
3495 phonebookBuffer->StartRead(); |
|
3496 |
|
3497 //convert the TLV back to a phone book entry |
|
3498 ASSERT_EQUALS(phonebookEntry->InternalizeFromTlvEntry(*phonebookBuffer),KErrNone); |
|
3499 |
|
3500 ASSERT_EQUALS(aPhoneBookEntry,*phonebookEntry); |
|
3501 |
|
3502 CleanupStack::PopAndDestroy(phonebookEntry); |
|
3503 CleanupStack::PopAndDestroy(phonebookBuffer); |
|
3504 CleanupStack::PopAndDestroy(&tlv); |
|
3505 } |
|
3506 |
|
3507 /** |
|
3508 * Converts a Phone enum type to the ETel name |
|
3509 * |
|
3510 * @param aPhonebook The phonebook type |
|
3511 * @return The ETel store name |
|
3512 */ |
|
3513 TName CCTsyPhonebookFU::PhonebookName(DispatcherPhonebook::TPhonebook aPhonebook) const |
|
3514 { |
|
3515 |
|
3516 TName phonebookName; |
|
3517 |
|
3518 switch(aPhonebook) |
|
3519 { |
|
3520 case DispatcherPhonebook::EIccAdn: |
|
3521 { |
|
3522 phonebookName = KETelIccAdnPhoneBook; |
|
3523 } |
|
3524 break; |
|
3525 |
|
3526 case DispatcherPhonebook::EIccBdn: |
|
3527 { |
|
3528 phonebookName = KETelIccBdnPhoneBook; |
|
3529 } |
|
3530 break; |
|
3531 |
|
3532 case DispatcherPhonebook::EIccSdn: |
|
3533 { |
|
3534 phonebookName = KETelIccSdnPhoneBook; |
|
3535 } |
|
3536 break; |
|
3537 |
|
3538 case DispatcherPhonebook::EIccFdn: |
|
3539 { |
|
3540 phonebookName = KETelIccFdnPhoneBook; |
|
3541 } |
|
3542 break; |
|
3543 |
|
3544 case DispatcherPhonebook::EIccVmb: |
|
3545 { |
|
3546 phonebookName = KETelIccVoiceMailBox; |
|
3547 } |
|
3548 break; |
|
3549 |
|
3550 case DispatcherPhonebook::EIccMbdn: |
|
3551 { |
|
3552 phonebookName = KETelIccMbdnPhoneBook; |
|
3553 } |
|
3554 break; |
|
3555 |
|
3556 case DispatcherPhonebook::EUnknown: |
|
3557 default: |
|
3558 { |
|
3559 //do nothing; |
|
3560 } |
|
3561 } |
|
3562 |
|
3563 return phonebookName; |
|
3564 } |
|
3565 |
|
3566 void CCTsyPhonebookFU::PhoneBookEntryArrayCleanup(TAny* aArray) |
|
3567 { |
|
3568 static_cast<RPointerArray<CPhoneBookEntry>*>(aArray)->ResetAndDestroy(); |
|
3569 } |
|
3570 |
|
3571 void CCTsyPhonebookFU::OpenSmsStoreL(RMobileSmsMessaging& aSmsMessaging, RMobileSmsStore& aSmsStore, const TDesC& aSmsStoreName) |
|
3572 { |
|
3573 iMockLTSY.ExpectL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId); |
|
3574 |
|
3575 User::LeaveIfError(aSmsMessaging.Open(iPhone)); |
|
3576 User::LeaveIfError(aSmsStore.Open(aSmsMessaging, aSmsStoreName)); |
|
3577 |
|
3578 RBuf8 data; |
|
3579 CleanupClosePushL(data); |
|
3580 |
|
3581 TInt totalEntries = 0; |
|
3582 TInt usedEntries = 0; |
|
3583 TMockLtsyData2<TInt,TInt> smsStoreGetInfoLtsyData(totalEntries, usedEntries); |
|
3584 data.Close(); |
|
3585 smsStoreGetInfoLtsyData.SerialiseL(data); |
|
3586 iMockLTSY.CompleteL(MLtsyDispatchPhonebookSmsStoreGetInfo::KLtsyDispatchPhonebookSmsStoreGetInfoApiId, KErrGeneral, data); |
|
3587 |
|
3588 WaitForMockLTSYTerminated(); |
|
3589 AssertMockLtsyStatusL(); |
|
3590 |
|
3591 CleanupStack::PopAndDestroy(&data); |
|
3592 } |
|
3593 |
|
3594 void CCTsyPhonebookFU::DoCleanup() |
|
3595 { |
|
3596 iInititalised = EFalse; |
|
3597 iEntries.ResetAndDestroy(); |
|
3598 CCtsyComponentTestBase::DoCleanup(); |
|
3599 } |
|
3600 |
|
3601 |