|
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 // ctsyphonebookonfunegative.cpp |
|
15 // |
|
16 |
|
17 #include "cctsyphonebookonfunegative.h" |
|
18 |
|
19 #include <etelmm.h> |
|
20 #include <mmlist.h> |
|
21 #include <mmretrieve.h> |
|
22 #include "config.h" |
|
23 #include <ctsy/ltsy/mltsydispatchphonebookoninterface.h> |
|
24 #include <test/tmockltsydata.h> |
|
25 #include "cctsyphonebookonfu.h" |
|
26 #include "listretrieverao.h" |
|
27 |
|
28 /* static */ |
|
29 CTestSuite* CCTsyPhonebookOnFUNegative::CreateSuiteL(const TDesC& aName) |
|
30 { |
|
31 SUB_SUITE; |
|
32 |
|
33 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestGetInfoIpcL); |
|
34 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestWriteIpcL); |
|
35 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestReadIpcL); |
|
36 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestDeleteEntryIpcL); |
|
37 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestWriteEntryIpcL); |
|
38 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestDeleteAllIpcL); |
|
39 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestReadEntryIpcL); |
|
40 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestReadSizeIpcL); |
|
41 ADD_TEST_STEP_ISO_CPP(CCTsyPhonebookOnFUNegative, TestWriteSizeIpcL); |
|
42 |
|
43 END_SUITE; |
|
44 } |
|
45 |
|
46 /** |
|
47 * Wraps up boilerplate code for starting tests with a clean RPhone session and RMobileONStore |
|
48 * initialised. On return this and aONStore have been pushed to the CleanupStack |
|
49 */ |
|
50 void CCTsyPhonebookOnFUNegative::OpenAndPushEtelAndPhoneONStoreL(RMobileONStore& aONStore) |
|
51 { |
|
52 OpenEtelServerL(EUseExtendedError); |
|
53 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
54 OpenPhoneL(); |
|
55 |
|
56 TInt ret = aONStore.Open(iPhone); |
|
57 ASSERT_EQUALS(ret, KErrNone); |
|
58 CleanupClosePushL(aONStore); |
|
59 } |
|
60 |
|
61 |
|
62 /** |
|
63 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0001 |
|
64 * @SYMComponent telephony_ctsy |
|
65 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::GetInfo() when associated PhonebookOn FU isn't supported |
|
66 * @SYMTestPriority High |
|
67 * @SYMTestActions Disables associated PhonebookOn Api, invokes RMobileONStore::GetInfo() |
|
68 * @SYMTestExpectedResults Pass |
|
69 * @SYMTestType UT |
|
70 */ |
|
71 void CCTsyPhonebookOnFUNegative::TestGetInfoIpcL() |
|
72 { |
|
73 TConfig config; |
|
74 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreGetInfo::KLtsyDispatchPhonebookOnStoreGetInfoApiId, EFalse); |
|
75 |
|
76 RMobileONStore onStore; |
|
77 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
78 |
|
79 TRequestStatus status; |
|
80 |
|
81 RMobileONStore::TMobileONStoreInfoV1 onStoreInfoV1; |
|
82 TPckg<RMobileONStore::TMobileONStoreInfoV1> pckgInfoV1(onStoreInfoV1); |
|
83 |
|
84 onStore.GetInfo(status, pckgInfoV1); |
|
85 User::WaitForRequest(status); |
|
86 |
|
87 ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
88 |
|
89 AssertMockLtsyStatusL(); |
|
90 config.Reset(); |
|
91 |
|
92 CleanupStack::PopAndDestroy(2, this); // onStore, this |
|
93 } |
|
94 |
|
95 /** |
|
96 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0002 |
|
97 * @SYMComponent telephony_ctsy |
|
98 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::Read() when associated PhonebookOn FU isn't supported |
|
99 * @SYMTestPriority High |
|
100 * @SYMTestActions Disables associated PhonebookOn Api, invokes RMobileONStore::Write() |
|
101 * @SYMTestExpectedResults Pass |
|
102 * @SYMTestType UT |
|
103 */ |
|
104 void CCTsyPhonebookOnFUNegative::TestWriteIpcL() |
|
105 { |
|
106 TConfig config; |
|
107 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreWrite::KLtsyDispatchPhonebookOnStoreWriteApiId, EFalse); |
|
108 |
|
109 RMobileONStore onStore; |
|
110 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
111 |
|
112 _LIT(KText1, "Number1"); |
|
113 _LIT(KNumber1, "11111111"); |
|
114 RMobileONStore::TMobileONEntryV1 writeEntry1; |
|
115 writeEntry1.iMode = RMobilePhone::ENetworkModeGsm; |
|
116 writeEntry1.iService = RMobilePhone::ETelephony; |
|
117 writeEntry1.iNumber.iTypeOfNumber = RMobilePhone::EAlphanumericNumber; |
|
118 writeEntry1.iNumber.iNumberPlan = RMobilePhone::EDataNumberPlan; |
|
119 writeEntry1.iNumber.iTelNumber.Copy(KNumber1); |
|
120 writeEntry1.iText.Copy(KText1); |
|
121 writeEntry1.iIndex = 1; |
|
122 |
|
123 TPckg<RMobileONStore::TMobileONEntryV1> pckgWriteEntry1(writeEntry1); |
|
124 |
|
125 TRequestStatus status; |
|
126 onStore.Write(status, pckgWriteEntry1); |
|
127 User::WaitForRequest(status); |
|
128 |
|
129 ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
130 |
|
131 AssertMockLtsyStatusL(); |
|
132 config.Reset(); |
|
133 |
|
134 CleanupStack::PopAndDestroy(2, this); // onStore, this |
|
135 } |
|
136 |
|
137 |
|
138 /** |
|
139 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0003 |
|
140 * @SYMComponent telephony_ctsy |
|
141 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::Read() when associated PhonebookOn FU isn't supported |
|
142 * @SYMTestPriority High |
|
143 * @SYMTestActions Disables associated PhonebookOn Api, invokes RMobileONStore::Read() |
|
144 * @SYMTestExpectedResults Pass |
|
145 * @SYMTestType UT |
|
146 */ |
|
147 void CCTsyPhonebookOnFUNegative::TestReadIpcL() |
|
148 { |
|
149 TConfig config; |
|
150 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreRead::KLtsyDispatchPhonebookOnStoreReadApiId, EFalse); |
|
151 |
|
152 RMobileONStore onStore; |
|
153 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
154 |
|
155 TInt location = 1; |
|
156 RMobileONStore::TMobileONEntryV1 readEntry; |
|
157 readEntry.iIndex = location; |
|
158 TPckg<RMobileONStore::TMobileONEntryV1> pckgReadEntry(readEntry); |
|
159 |
|
160 TRequestStatus status; |
|
161 onStore.Read(status, pckgReadEntry); |
|
162 User::WaitForRequest(status); |
|
163 |
|
164 ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
165 |
|
166 AssertMockLtsyStatusL(); |
|
167 config.Reset(); |
|
168 |
|
169 CleanupStack::PopAndDestroy(2, this); // onStore, this |
|
170 } |
|
171 |
|
172 |
|
173 /** |
|
174 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0004 |
|
175 * @SYMComponent telephony_ctsy |
|
176 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::Read() when associated PhonebookOn FU isn't supported |
|
177 * @SYMTestPriority High |
|
178 * @SYMTestActions Disables associated PhonebookOn Api, invokes RMobileONStore::Read() |
|
179 * @SYMTestExpectedResults Pass |
|
180 * @SYMTestType UT |
|
181 */ |
|
182 void CCTsyPhonebookOnFUNegative::TestDeleteEntryIpcL() |
|
183 { |
|
184 TConfig config; |
|
185 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreDeleteEntry::KLtsyDispatchPhonebookOnStoreDeleteEntryApiId, EFalse); |
|
186 |
|
187 RMobileONStore onStore; |
|
188 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
189 |
|
190 TRequestStatus status; |
|
191 onStore.Delete(status, 1); |
|
192 User::WaitForRequest(status); |
|
193 |
|
194 ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
195 |
|
196 AssertMockLtsyStatusL(); |
|
197 config.Reset(); |
|
198 |
|
199 CleanupStack::PopAndDestroy(2, this); // onStore, this |
|
200 } |
|
201 |
|
202 |
|
203 /** |
|
204 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0005 |
|
205 * @SYMComponent telephony_ctsy |
|
206 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::StoreAll() when associated PhonebookOn FU isn't supported |
|
207 * @SYMTestPriority High |
|
208 * @SYMTestActions Disables associated PhonebookOn Api, invokes RMobileONStore::StoreAllL() |
|
209 * @SYMTestExpectedResults Pass |
|
210 * @SYMTestType UT |
|
211 */ |
|
212 void CCTsyPhonebookOnFUNegative::TestWriteEntryIpcL() |
|
213 { |
|
214 TConfig config; |
|
215 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreWriteEntry::KLtsyDispatchPhonebookOnStoreWriteEntryApiId, EFalse); |
|
216 |
|
217 RMobileONStore onStore; |
|
218 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
219 |
|
220 CMobilePhoneONList* onList = CMobilePhoneONList::NewL(); |
|
221 CleanupStack::PushL(onList); |
|
222 |
|
223 RMobileONStore::TMobileONEntryV1 writeEntry; |
|
224 onList->AddEntryL(writeEntry); // writeEntry not initialised, not checked |
|
225 |
|
226 TInt size = onList->Enumerate(); |
|
227 |
|
228 RBuf8 completeData; |
|
229 CleanupClosePushL(completeData); |
|
230 TMockLtsyData1<TInt> sizeLTsyData(size); |
|
231 completeData.Close(); |
|
232 sizeLTsyData.SerialiseL(completeData); |
|
233 |
|
234 iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId); |
|
235 iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone); |
|
236 |
|
237 iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId); |
|
238 iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, KErrNone, completeData); |
|
239 |
|
240 TRequestStatus status; |
|
241 onStore.StoreAllL(status, onList); |
|
242 User::WaitForRequest(status); |
|
243 |
|
244 ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
245 |
|
246 AssertMockLtsyStatusL(); |
|
247 config.Reset(); |
|
248 |
|
249 CleanupStack::PopAndDestroy(4, this); // completeData, onList, onStore, this |
|
250 } |
|
251 |
|
252 |
|
253 /** |
|
254 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0006 |
|
255 * @SYMComponent telephony_ctsy |
|
256 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::DeleteAll() when associated PhonebookOn FU isn't supported |
|
257 * @SYMTestPriority High |
|
258 * @SYMTestActions Disables associated PhonebookOn Api, invokes RMobileONStore::DeleteAllL() |
|
259 * @SYMTestExpectedResults Pass |
|
260 * @SYMTestType UT |
|
261 */ |
|
262 void CCTsyPhonebookOnFUNegative::TestDeleteAllIpcL() |
|
263 { |
|
264 TConfig config; |
|
265 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, EFalse); |
|
266 |
|
267 RMobileONStore onStore; |
|
268 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
269 |
|
270 TRequestStatus status; |
|
271 onStore.DeleteAll(status); |
|
272 User::WaitForRequest(status); |
|
273 |
|
274 ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
275 |
|
276 AssertMockLtsyStatusL(); |
|
277 config.Reset(); |
|
278 |
|
279 CleanupStack::PopAndDestroy(2, this); // onStore, this |
|
280 } |
|
281 |
|
282 |
|
283 /** |
|
284 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0007 |
|
285 * @SYMComponent telephony_ctsy |
|
286 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::ReadAll() when associated PhonebookOn FU isn't supported |
|
287 * @SYMTestPriority High |
|
288 * @SYMTestActions Disables associated PhonebookOn Api, invokes CRetrieveMobilePhoneONList |
|
289 * @SYMTestExpectedResults Pass |
|
290 * @SYMTestType UT |
|
291 */ |
|
292 void CCTsyPhonebookOnFUNegative::TestReadEntryIpcL() |
|
293 { |
|
294 TConfig config; |
|
295 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, EFalse); |
|
296 |
|
297 RMobileONStore onStore; |
|
298 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
299 |
|
300 //CActiveScheduler* activeScheduler = new (ELeave) CActiveScheduler(); |
|
301 //CleanupStack::PushL(activeScheduler); |
|
302 //CActiveScheduler::Install(activeScheduler); |
|
303 |
|
304 RBuf8 completeData; |
|
305 CleanupClosePushL(completeData); |
|
306 TInt size = 1; |
|
307 TMockLtsyData1<TInt> sizeLTsyData(size); |
|
308 completeData.Close(); |
|
309 sizeLTsyData.SerialiseL(completeData); |
|
310 |
|
311 iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId); |
|
312 iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId, KErrNone, completeData); |
|
313 // |
|
314 // _LIT(KText, "Number%d"); |
|
315 // _LIT(KNumber, "0000000%d"); |
|
316 // TInt location[1]; |
|
317 // TBuf<RMobileONStore::KOwnNumberTextSize> name[1]; |
|
318 // TBuf<KPBStoreNumSize> telNumber[1]; |
|
319 // TInt index = 1; |
|
320 // location[0] = index; |
|
321 // name[0].Format(KText,index); |
|
322 // telNumber[0].Format(KNumber,index); |
|
323 // |
|
324 // RBuf8 expectReadData; |
|
325 // CleanupClosePushL(expectReadData); |
|
326 // TMockLtsyData1<TInt> locationLTsyData(location[0]); |
|
327 // expectReadData.Close(); |
|
328 // locationLTsyData.SerialiseL(expectReadData); |
|
329 // |
|
330 // TMockLtsyData3< TInt, TBuf<RMobileONStore::KOwnNumberTextSize>, TBuf<KPBStoreNumSize> > readLTsyDataComplete(location[0], name[0], telNumber[0]); |
|
331 // completeData.Close(); |
|
332 // readLTsyDataComplete.SerialiseL(completeData); |
|
333 // iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, expectReadData); |
|
334 // iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreReadEntry::KLtsyDispatchPhonebookOnStoreReadEntryApiId, KErrNone, completeData); |
|
335 |
|
336 // CRetrieveMobilePhoneONList* onListRetriever = CRetrieveMobilePhoneONList::NewL(onStore); |
|
337 // CleanupStack::PushL(onListRetriever); |
|
338 TRequestStatus status; |
|
339 //onListRetriever->Start(status); |
|
340 //TBool test = onListRetriever->IsActive(); |
|
341 //onListRetriever->RetrieveListL(); |
|
342 //CActiveScheduler::Start(); |
|
343 |
|
344 CGetONListAO* getOnListAO = CGetONListAO::NewLC(onStore); |
|
345 getOnListAO->TestRetrieveL(); |
|
346 ASSERT_EQUALS(KErrNotSupported, getOnListAO->RetrieveLastError()); |
|
347 |
|
348 //User::WaitForRequest(status); |
|
349 |
|
350 //ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
351 |
|
352 AssertMockLtsyStatusL(); |
|
353 |
|
354 config.Reset(); |
|
355 |
|
356 //CActiveScheduler::Stop(); |
|
357 CleanupStack::PopAndDestroy(4, this); // getOnListAO, completeData, onStore, this |
|
358 } |
|
359 |
|
360 |
|
361 /** |
|
362 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0008 |
|
363 * @SYMComponent telephony_ctsy |
|
364 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::ReadAll() when associated PhonebookOn FU isn't supported |
|
365 * @SYMTestPriority High |
|
366 * @SYMTestActions Disables associated PhonebookOn Api, invokes CRetrieveMobilePhoneONList |
|
367 * @SYMTestExpectedResults Pass |
|
368 * @SYMTestType UT |
|
369 */ |
|
370 void CCTsyPhonebookOnFUNegative::TestReadSizeIpcL() |
|
371 { |
|
372 TConfig config; |
|
373 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreGetReadStoreSize::KLtsyDispatchPhonebookOnStoreGetReadStoreSizeApiId, EFalse); |
|
374 |
|
375 RMobileONStore onStore; |
|
376 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
377 |
|
378 TRequestStatus status; |
|
379 CGetONListAO* getOnListAO = CGetONListAO::NewLC(onStore); |
|
380 getOnListAO->TestRetrieveL(); |
|
381 ASSERT_EQUALS(KErrNotSupported, getOnListAO->RetrieveLastError()); |
|
382 |
|
383 AssertMockLtsyStatusL(); |
|
384 |
|
385 config.Reset(); |
|
386 |
|
387 CleanupStack::PopAndDestroy(3, this); // getOnListAO, onStore, this |
|
388 } |
|
389 |
|
390 |
|
391 /** |
|
392 * @SYMTestCaseID BA-CTSYD-DIS-PHONEBOOKON-NEGATIVE-UN0009 |
|
393 * @SYMComponent telephony_ctsy |
|
394 * @SYMTestCaseDesc Test support in CTSY for RMobileONStore::StoreAll() when associated PhonebookOn FU isn't supported |
|
395 * @SYMTestPriority High |
|
396 * @SYMTestActions Disables associated PhonebookOn Api, invokes RMobileONStore::StoreAllL() |
|
397 * @SYMTestExpectedResults Pass |
|
398 * @SYMTestType UT |
|
399 */ |
|
400 void CCTsyPhonebookOnFUNegative::TestWriteSizeIpcL() |
|
401 { |
|
402 TConfig config; |
|
403 config.SetSupportedValue(MLtsyDispatchPhonebookOnStoreGetStoreSize::KLtsyDispatchPhonebookOnStoreGetStoreSizeApiId, EFalse); |
|
404 |
|
405 RMobileONStore onStore; |
|
406 OpenAndPushEtelAndPhoneONStoreL(onStore); |
|
407 |
|
408 CMobilePhoneONList* onList = CMobilePhoneONList::NewL(); |
|
409 CleanupStack::PushL(onList); |
|
410 |
|
411 iMockLTSY.ExpectL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId); |
|
412 iMockLTSY.CompleteL(MLtsyDispatchPhonebookOnStoreDeleteAll::KLtsyDispatchPhonebookOnStoreDeleteAllApiId, KErrNone); |
|
413 |
|
414 TRequestStatus status; |
|
415 onStore.StoreAllL(status, onList); |
|
416 User::WaitForRequest(status); |
|
417 |
|
418 ASSERT_EQUALS(KErrNotSupported, status.Int()); |
|
419 |
|
420 AssertMockLtsyStatusL(); |
|
421 config.Reset(); |
|
422 |
|
423 CleanupStack::PopAndDestroy(3, this); // onList, onStore, this |
|
424 } |