|
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 // cctsysmsfu.cpp |
|
15 // when support for the various APIs are disabled in the dispatch layer. |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file The TEFUnit test suite for SmsControl in the Common TSY |
|
22 */ |
|
23 |
|
24 #include "cctsysmsfunegative.h" |
|
25 |
|
26 #include <etelmm.h> |
|
27 #include <ctsy/ltsy/mltsydispatchsmsinterface.h> |
|
28 #include <mmretrieve.h> |
|
29 #include "mockltsyindicatorids.h" |
|
30 |
|
31 #include "config.h" |
|
32 |
|
33 #include "cctsyactiveretriever.h" |
|
34 #include <test/tmockltsydata.h> |
|
35 |
|
36 CTestSuite* CCTsySmsFUNegative::CreateSuiteL(const TDesC& aName) |
|
37 { |
|
38 SUB_SUITE; |
|
39 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestNackSmsStoredL); |
|
40 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestAckSmsStoredL); |
|
41 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestSendMessageL); |
|
42 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestGetSmsStoreInfoL); |
|
43 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestGetSmspListL); |
|
44 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestSendMessageNoFdnCheckL); |
|
45 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestResumeSmsReceptionL); |
|
46 |
|
47 ADD_TEST_STEP_ISO_CPP(CCTsySmsFUNegative, TestStoreSmspListEntryL); |
|
48 END_SUITE; |
|
49 } |
|
50 |
|
51 /** |
|
52 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0001 |
|
53 * @SYMComponent telephony_ctsy |
|
54 * @SYMTestCaseDesc Test handing in CTSY dispatch when the NackSmsStored API is disabled |
|
55 * @SYMTestPriority High |
|
56 * @SYMTestActions Disable API, call API, check correct error returned |
|
57 * @SYMTestExpectedResults Pass |
|
58 * @SYMTestType CT |
|
59 */ |
|
60 void CCTsySmsFUNegative::TestNackSmsStoredL() |
|
61 { |
|
62 TConfig config; |
|
63 config.SetSupportedValue(MLtsyDispatchSmsNackSmsStored::KLtsyDispatchSmsNackSmsStoredApiId, EFalse); |
|
64 config.PushL(); |
|
65 |
|
66 OpenEtelServerL(EUseExtendedError); |
|
67 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
68 OpenPhoneL(); |
|
69 |
|
70 RMobileSmsMessaging messaging; |
|
71 TInt err = messaging.Open(iPhone); |
|
72 ASSERT_EQUALS(KErrNone, err); |
|
73 CleanupClosePushL(messaging); |
|
74 |
|
75 RBuf8 data; |
|
76 CleanupClosePushL(data); |
|
77 |
|
78 TRequestStatus reqStatus; |
|
79 TRequestStatus mockLtsyStatus; |
|
80 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr; |
|
81 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr); |
|
82 |
|
83 _LIT8(KMessage, "Happy New Year"); |
|
84 TBuf8<100> forMsg; |
|
85 |
|
86 // receiving message: |
|
87 messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg); |
|
88 |
|
89 TSmsMsg smsMsg; |
|
90 TSmsMsg* smsMsgPtr(&smsMsg); |
|
91 TBool ind(EFalse); |
|
92 |
|
93 smsMsg.iSmsClass2 = ETrue; |
|
94 smsMsg.iDeleteAfterClientAck = ETrue; |
|
95 smsMsg.iSmsMsg.Copy(KMessage); |
|
96 |
|
97 TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr); |
|
98 compTsyData.SerialiseL(data); |
|
99 |
|
100 iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data); |
|
101 |
|
102 User::WaitForRequest(reqStatus); |
|
103 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
104 AssertMockLtsyStatusL(); |
|
105 |
|
106 TDesC8* msgPtr = const_cast<TDesC8*>(&KMessage); |
|
107 TInt rpCause(0); |
|
108 TMockLtsyData2<TDesC8*, TInt> expTsyData(msgPtr, rpCause); |
|
109 data.Close(); |
|
110 expTsyData.SerialiseL(data); |
|
111 |
|
112 messaging.NackSmsStored(reqStatus, KMessage, rpCause); |
|
113 |
|
114 User::WaitForRequest(reqStatus); |
|
115 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()); |
|
116 AssertMockLtsyStatusL(); |
|
117 |
|
118 CleanupStack::PopAndDestroy(4, &config); // messaging, this, data, config |
|
119 } |
|
120 |
|
121 |
|
122 /** |
|
123 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0002 |
|
124 * @SYMComponent telephony_ctsy |
|
125 * @SYMTestCaseDesc Test handing in CTSY dispatch when the AckSmsStored API is disabled |
|
126 * @SYMTestPriority High |
|
127 * @SYMTestActions Disable API, call API, check correct error returned |
|
128 * @SYMTestExpectedResults Pass |
|
129 * @SYMTestType CT |
|
130 */ |
|
131 void CCTsySmsFUNegative::TestAckSmsStoredL() |
|
132 { |
|
133 TConfig config; |
|
134 config.SetSupportedValue(MLtsyDispatchSmsAckSmsStored::KLtsyDispatchSmsAckSmsStoredApiId, EFalse); |
|
135 config.PushL(); |
|
136 |
|
137 OpenEtelServerL(EUseExtendedError); |
|
138 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
139 OpenPhoneL(); |
|
140 |
|
141 RMobileSmsMessaging messaging; |
|
142 TInt err = messaging.Open(iPhone); |
|
143 ASSERT_EQUALS(KErrNone, err); |
|
144 CleanupClosePushL(messaging); |
|
145 |
|
146 RBuf8 data; |
|
147 CleanupClosePushL(data); |
|
148 |
|
149 TRequestStatus reqStatus; |
|
150 TRequestStatus mockLtsyStatus; |
|
151 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1 receiveAttr; |
|
152 RMobileSmsMessaging::TMobileSmsReceiveAttributesV1Pckg receiveAttrPckg(receiveAttr); |
|
153 |
|
154 _LIT8(KMessage, "Happy New Year"); |
|
155 TBuf8<100> forMsg; |
|
156 |
|
157 // receiving message: |
|
158 messaging.ReceiveMessage(reqStatus, forMsg, receiveAttrPckg); |
|
159 |
|
160 TSmsMsg smsMsg; |
|
161 TSmsMsg* smsMsgPtr(&smsMsg); |
|
162 TBool ind(EFalse); |
|
163 |
|
164 smsMsg.iSmsClass2 = ETrue; |
|
165 smsMsg.iDeleteAfterClientAck = ETrue; |
|
166 smsMsg.iSmsMsg.Copy(KMessage); |
|
167 |
|
168 TMockLtsyData2<TBool, TSmsMsg*> compTsyData(ind, smsMsgPtr); |
|
169 compTsyData.SerialiseL(data); |
|
170 |
|
171 iMockLTSY.CompleteL(KMockLtsyDispatchSmsNotifyReceiveSmsMessageIndId, KErrNone, data); |
|
172 |
|
173 User::WaitForRequest(reqStatus); |
|
174 ASSERT_EQUALS(KErrNone, reqStatus.Int()); |
|
175 AssertMockLtsyStatusL(); |
|
176 |
|
177 messaging.AckSmsStored(reqStatus, KMessage, ETrue); |
|
178 |
|
179 User::WaitForRequest(reqStatus); |
|
180 ASSERT_EQUALS(KErrNotSupported, reqStatus.Int()); |
|
181 AssertMockLtsyStatusL(); |
|
182 |
|
183 CleanupStack::PopAndDestroy(4, &config); // messaging, this, data, config |
|
184 } |
|
185 |
|
186 |
|
187 /** |
|
188 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0003 |
|
189 * @SYMComponent telephony_ctsy |
|
190 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SendMessage API is disabled |
|
191 * @SYMTestPriority High |
|
192 * @SYMTestActions Disable API, call API, check correct error returned |
|
193 * @SYMTestExpectedResults Pass |
|
194 * @SYMTestType CT |
|
195 */ |
|
196 void CCTsySmsFUNegative::TestSendMessageL() |
|
197 { |
|
198 TConfig config; |
|
199 config.SetSupportedValue(MLtsyDispatchSmsSendSmsMessage::KLtsyDispatchSmsSendSmsMessageApiId, EFalse); |
|
200 config.PushL(); |
|
201 |
|
202 OpenEtelServerL(EUseExtendedError); |
|
203 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
204 OpenPhoneL(); |
|
205 |
|
206 RMobileSmsMessaging messaging; |
|
207 TInt err = messaging.Open(iPhone); |
|
208 CleanupClosePushL(messaging); |
|
209 |
|
210 _LIT8(KMessage, "Hello"); |
|
211 |
|
212 RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsAttr; |
|
213 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsAttrPckg(smsAttr); |
|
214 |
|
215 TRequestStatus status; |
|
216 messaging.SendMessage(status, KMessage, smsAttrPckg); |
|
217 User::WaitForRequest(status); |
|
218 ASSERT_EQUALS(status.Int(), KErrNotSupported); |
|
219 |
|
220 AssertMockLtsyStatusL(); |
|
221 |
|
222 CleanupStack::PopAndDestroy(3, &config); // messaging, this, config |
|
223 } |
|
224 |
|
225 |
|
226 /** |
|
227 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0004 |
|
228 * @SYMComponent telephony_ctsy |
|
229 * @SYMTestCaseDesc Test handing in CTSY dispatch when the GetMessageStoreInfo (a.k.a GetSmsStoreInfo) API is disabled |
|
230 * @SYMTestPriority High |
|
231 * @SYMTestActions Disable API, call API, check correct error returned |
|
232 * @SYMTestExpectedResults Pass |
|
233 * @SYMTestType CT |
|
234 */ |
|
235 void CCTsySmsFUNegative::TestGetSmsStoreInfoL() |
|
236 { |
|
237 TConfig config; |
|
238 config.SetSupportedValue(MLtsyDispatchSmsGetSmsStoreInfo::KLtsyDispatchSmsGetSmsStoreInfoApiId, EFalse); |
|
239 config.PushL(); |
|
240 |
|
241 OpenEtelServerL(EUseExtendedError); |
|
242 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
243 OpenPhoneL(); |
|
244 |
|
245 RMobileSmsMessaging messaging; |
|
246 TInt err = messaging.Open(iPhone); |
|
247 CleanupClosePushL(messaging); |
|
248 |
|
249 RMobilePhoneStore::TMobilePhoneStoreInfoV1 info; |
|
250 RMobilePhoneStore::TMobilePhoneStoreInfoV1Pckg pckgInfo(info); |
|
251 TInt index(0); |
|
252 |
|
253 TRequestStatus status; |
|
254 messaging.GetMessageStoreInfo(status, index, pckgInfo); |
|
255 User::WaitForRequest(status); |
|
256 ASSERT_EQUALS(status.Int(), KErrNotSupported); |
|
257 |
|
258 AssertMockLtsyStatusL(); |
|
259 |
|
260 CleanupStack::PopAndDestroy(3, &config); // messaging, this, config |
|
261 } |
|
262 |
|
263 |
|
264 /** |
|
265 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0005 |
|
266 * @SYMComponent telephony_ctsy |
|
267 * @SYMTestCaseDesc Test handing in CTSY dispatch when the ReadSmspListPhase1L API is disabled |
|
268 * @SYMTestPriority High |
|
269 * @SYMTestActions Disable API, call API via the CRetrieveMobilePhoneSmspList AO, check correct error returned |
|
270 * @SYMTestExpectedResults Pass |
|
271 * @SYMTestType CT |
|
272 */ |
|
273 void CCTsySmsFUNegative::TestGetSmspListL() |
|
274 { |
|
275 TConfig config; |
|
276 config.SetSupportedValue(MLtsyDispatchSmsGetSmspList::KLtsyDispatchSmsGetSmspListApiId, EFalse); |
|
277 config.PushL(); |
|
278 |
|
279 OpenEtelServerL(EUseExtendedError); |
|
280 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
281 OpenPhoneL(); |
|
282 |
|
283 RMobileSmsMessaging messaging; |
|
284 TInt err = messaging.Open(iPhone); |
|
285 CleanupClosePushL(messaging); |
|
286 |
|
287 //CFilteringActiveScheduler does not need to be used, this should be changed |
|
288 //to a listretrieverao type class (see "listretrieverao.h") |
|
289 CFilteringActiveScheduler* scheduler = new (ELeave) CFilteringActiveScheduler(); |
|
290 CleanupStack::PushL(scheduler); |
|
291 CActiveScheduler::Install(scheduler); |
|
292 CRetrieveMobilePhoneSmspList* asyncRetrieveList |
|
293 = CRetrieveMobilePhoneSmspList::NewL(messaging); |
|
294 CleanupStack::PushL(asyncRetrieveList); |
|
295 |
|
296 CActiveRetriever::ResetRequestsNumber(); |
|
297 CActiveRetriever* activeRetriever = |
|
298 CActiveRetriever::NewL(*asyncRetrieveList); |
|
299 CleanupStack::PushL(activeRetriever); |
|
300 scheduler->AddRetrieverL(*activeRetriever); |
|
301 |
|
302 asyncRetrieveList->Start(activeRetriever->iStatus); |
|
303 activeRetriever->Activate(); |
|
304 scheduler->StartScheduler(); |
|
305 |
|
306 ASSERT_EQUALS(CActiveRetriever::ResetRequestsNumber(), 0); |
|
307 ASSERT_EQUALS(activeRetriever->iStatus.Int(), KErrNotSupported); |
|
308 |
|
309 AssertMockLtsyStatusL(); |
|
310 |
|
311 CleanupStack::PopAndDestroy(6, &config); // activeRetriever, asyncRetrieveList, scheduler, , messaging, this, config |
|
312 } |
|
313 |
|
314 |
|
315 /** |
|
316 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0006 |
|
317 * @SYMComponent telephony_ctsy |
|
318 * @SYMTestCaseDesc Test handing in CTSY dispatch when the SendMessageNoFdnCheck API is disabled |
|
319 * @SYMTestPriority High |
|
320 * @SYMTestActions Disable API, call API, check correct error returned |
|
321 * @SYMTestExpectedResults Pass |
|
322 * @SYMTestType CT |
|
323 */ |
|
324 void CCTsySmsFUNegative::TestSendMessageNoFdnCheckL() |
|
325 { |
|
326 TConfig config; |
|
327 config.SetSupportedValue(MLtsyDispatchSmsSendSmsMessageNoFdnCheck::KLtsyDispatchSmsSendSmsMessageNoFdnCheckApiId, EFalse); |
|
328 config.PushL(); |
|
329 |
|
330 OpenEtelServerL(EUseExtendedError); |
|
331 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
332 OpenPhoneL(); |
|
333 |
|
334 RMobileSmsMessaging messaging; |
|
335 TInt err = messaging.Open(iPhone); |
|
336 CleanupClosePushL(messaging); |
|
337 |
|
338 _LIT8(KMessage, "Hello"); |
|
339 |
|
340 RMobileSmsMessaging::TMobileSmsSendAttributesV1 smsAttr; |
|
341 RMobileSmsMessaging::TMobileSmsSendAttributesV1Pckg smsAttrPckg(smsAttr); |
|
342 |
|
343 TRequestStatus status; |
|
344 messaging.SendMessageNoFdnCheck(status, KMessage, smsAttrPckg); |
|
345 User::WaitForRequest(status); |
|
346 ASSERT_EQUALS(status.Int(), KErrNotSupported); |
|
347 |
|
348 AssertMockLtsyStatusL(); |
|
349 |
|
350 CleanupStack::PopAndDestroy(3, &config); // messaging, this, config |
|
351 } |
|
352 |
|
353 /** |
|
354 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0007 |
|
355 * @SYMComponent telephony_ctsy |
|
356 * @SYMTestCaseDesc Test handing in CTSY dispatch when the ResumeSmsReception API is disabled |
|
357 * @SYMTestPriority High |
|
358 * @SYMTestActions Disable API, call API, check correct error returned |
|
359 * @SYMTestExpectedResults Pass |
|
360 * @SYMTestType CT |
|
361 */ |
|
362 void CCTsySmsFUNegative::TestResumeSmsReceptionL() |
|
363 { |
|
364 TConfig config; |
|
365 config.SetSupportedValue(MLtsyDispatchSmsResumeSmsReception::KLtsyDispatchSmsResumeSmsReceptionApiId, EFalse); |
|
366 config.PushL(); |
|
367 |
|
368 OpenEtelServerL(EUseExtendedError); |
|
369 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
370 OpenPhoneL(); |
|
371 |
|
372 RMobileSmsMessaging messaging; |
|
373 TInt err = messaging.Open(iPhone); |
|
374 CleanupClosePushL(messaging); |
|
375 |
|
376 TRequestStatus status; |
|
377 messaging.ResumeSmsReception(status); |
|
378 User::WaitForRequest(status); |
|
379 ASSERT_EQUALS(status.Int(), KErrNotSupported); |
|
380 |
|
381 AssertMockLtsyStatusL(); |
|
382 |
|
383 CleanupStack::PopAndDestroy(3, &config); // messaging, this, config |
|
384 } |
|
385 |
|
386 |
|
387 /** |
|
388 * @SYMTestCaseID BA-CTSYD-DIS-SMS-NEGATIVE-UN0009 |
|
389 * @SYMComponent telephony_ctsy |
|
390 * @SYMTestCaseDesc Test handing in CTSY dispatch when the StoreSmspListEntry API is disabled |
|
391 * @SYMTestPriority High |
|
392 * @SYMTestActions Disable API, call API, check correct error returned |
|
393 * @SYMTestExpectedResults Pass |
|
394 * @SYMTestType CT |
|
395 */ |
|
396 void CCTsySmsFUNegative::TestStoreSmspListEntryL() |
|
397 { |
|
398 TConfig config; |
|
399 config.SetSupportedValue(MLtsyDispatchSmsStoreSmspListEntry::KLtsyDispatchSmsStoreSmspListEntryApiId, EFalse); |
|
400 config.PushL(); |
|
401 |
|
402 OpenEtelServerL(EUseExtendedError); |
|
403 CleanupStack::PushL(TCleanupItem(Cleanup,this)); |
|
404 OpenPhoneL(); |
|
405 |
|
406 RMobileSmsMessaging messaging; |
|
407 TInt err = messaging.Open(iPhone); |
|
408 CleanupClosePushL(messaging); |
|
409 |
|
410 RMobileSmsMessaging::TMobileSmspEntryV1 smspEntry; |
|
411 CMobilePhoneSmspList* smspListPtr = CMobilePhoneSmspList::NewL(); |
|
412 CleanupStack::PushL(smspListPtr); |
|
413 |
|
414 smspListPtr->AddEntryL(smspEntry); |
|
415 |
|
416 TRequestStatus status; |
|
417 messaging.StoreSmspListL(status, smspListPtr); |
|
418 User::WaitForRequest(status); |
|
419 ASSERT_EQUALS(status.Int(), KErrNotSupported); |
|
420 |
|
421 AssertMockLtsyStatusL(); |
|
422 |
|
423 CleanupStack::PopAndDestroy(4, &config); // smspListPtr, messaging, this, config |
|
424 } |
|
425 |