changeset 20 | 244d7c5f118e |
parent 0 | 3553901f7fa8 |
child 24 | 6638e7f4bd8f |
19:1f776524b15c | 20:244d7c5f118e |
---|---|
14 // |
14 // |
15 |
15 |
16 /** |
16 /** |
17 @file |
17 @file |
18 */ |
18 */ |
19 #include <commsdattypesv1_1.h> |
|
20 |
|
21 #include "TE_smsprtbase.h" |
|
22 #include "smsulog.h" |
|
23 #include "logcheck.h" |
|
24 #include "TE_smsprt.h" |
19 #include "TE_smsprt.h" |
20 |
|
25 #include <sacls.h> |
21 #include <sacls.h> |
26 #include <exterror.h> |
22 #include <exterror.h> |
27 |
|
28 #include <emsformatie.h> |
23 #include <emsformatie.h> |
29 #include <logwraplimits.h> |
24 #include <logwraplimits.h> |
30 #include <smspver.h> |
25 #include <smspver.h> |
31 |
26 |
27 #include "smsulog.h" |
|
28 |
|
32 using namespace CommsDat; |
29 using namespace CommsDat; |
33 |
30 |
34 #if defined (__WINS__) |
|
35 #define PDD_NAME _L("ECDRV") |
|
36 #define LDD_NAME _L("ECOMM") |
|
37 #else |
|
38 #define PDD_NAME _L("EUART1") |
|
39 #define LDD_NAME _L("ECOMM") |
|
40 #endif |
|
41 |
|
42 |
|
43 TVerdict CTestSimpleTxAndRx::doTestStepL() |
31 TVerdict CTestSimpleTxAndRx::doTestStepL() |
44 /** |
32 /** |
45 * Test a simple Transmit and Receive of a TPDU |
33 * Test a simple Transmit and Receive of a TPDU |
46 */ |
34 */ |
47 { |
35 { |
48 INFO_PRINTF1(_L("Test Simple Tx and Rx SMS")); |
36 INFO_PRINTF1(_L("Test Simple Tx and Rx SMS")); |
49 |
|
50 RSocketServ socketServer; |
|
51 PrepareRegTestLC(socketServer, 0); |
|
52 |
|
53 RSocket socket; |
37 RSocket socket; |
54 iSmsStackTestUtils->OpenSmsSocketL(socketServer,socket,ESmsAddrRecvAny); |
38 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
55 CleanupClosePushL(socket); |
39 |
56 |
40 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
57 // Create comms database object |
41 |
58 |
42 _LIT(KTestMsg,"test message, 8bits, length 30"); |
59 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
60 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
61 #else |
|
62 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
63 #endif |
|
64 CleanupStack::PushL(db); |
|
65 |
|
66 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
67 |
|
68 // EReceiveUnstoredClientAck |
|
69 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
70 CleanupStack::PushL(smsReceiveModeField); |
|
71 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
72 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
73 smsReceiveModeField->ModifyL(*db); |
|
74 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
75 CleanupStack::PopAndDestroy(db); |
|
76 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
|
77 |
43 |
78 //Set destination and SC numbers |
44 //Set destination and SC numbers |
79 iTelephoneNumber=KPekka; |
45 iTelephoneNumber=KPekka; |
80 iServiceCenterNumber=KRadiolinjaSC; |
46 iServiceCenterNumber=KRadiolinjaSC; |
81 |
47 |
82 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
48 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
83 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
49 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg, alphabet); |
84 CleanupStack::PushL(smsMessage); |
|
85 |
50 |
86 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
51 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
87 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
52 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
88 |
53 |
89 //Send SMS |
54 //Send SMS |
90 SendSmsL(smsMessage,socket); |
55 SendSmsL(smsMessage,socket); |
91 |
|
92 CleanupStack::PopAndDestroy(smsMessage); |
56 CleanupStack::PopAndDestroy(smsMessage); |
93 |
57 |
94 //Receive SMS |
58 //Receive SMS |
95 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
96 WaitForRecvL(socket); |
59 WaitForRecvL(socket); |
97 smsMessage = RecvSmsL(socket); |
60 smsMessage = RecvSmsL(socket); |
98 |
61 CleanupStack::PushL(smsMessage); |
99 INFO_PRINTF1(_L("incoming SMS") ); |
62 |
100 |
63 TestSmsContentsL(smsMessage, KTestMsg); |
101 CleanupStack::PushL(smsMessage); |
|
102 TestSmsContentsL(smsMessage,KTestMsg1); |
|
103 |
64 |
104 //Save the received message to the SMS storage |
65 //Save the received message to the SMS storage |
105 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
66 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
106 WriteSmsToSimL(*smsMessage, socket); |
67 WriteSmsToSimL(*smsMessage, socket); |
107 |
|
108 CleanupStack::PopAndDestroy(smsMessage); |
68 CleanupStack::PopAndDestroy(smsMessage); |
109 |
69 |
110 // Enumerate messages from Store |
70 // Enumerate messages from Store |
111 RPointerArray<CSmsMessage> messages; |
71 RPointerArray<CSmsMessage> messages; |
112 ReadSmsStoreL(socket, messages); |
72 ReadSmsStoreL(socket, messages); |
113 messages.ResetAndDestroy(); |
73 messages.ResetAndDestroy(); |
114 |
74 |
115 CleanupStack::PopAndDestroy(&socket); |
75 CleanupStack::PopAndDestroy(&socket); |
116 |
|
117 CleanupStack::PopAndDestroy(&socketServer); |
|
118 |
|
119 return TestStepResult() ; |
76 return TestStepResult() ; |
120 } |
77 } |
121 |
78 |
122 |
|
123 TVerdict CTestBinaryTxAndRx::doTestStepL() |
79 TVerdict CTestBinaryTxAndRx::doTestStepL() |
124 /** |
80 /** |
125 * Test a binary Transmit and Receive of a TPDU |
81 * Test a binary Transmit and Receive of a TPDU |
126 */ |
82 */ |
127 { |
83 { |
128 INFO_PRINTF1(_L("Test Binary Tx and Rx SMS")); |
84 INFO_PRINTF1(_L("Test Binary Tx and Rx SMS")); |
129 |
|
130 RSocketServ socketServer; |
|
131 PrepareRegTestLC(socketServer, 142); |
|
132 |
|
133 RSocket socket; |
85 RSocket socket; |
134 iSmsStackTestUtils->OpenSmsSocketL(socketServer,socket,ESmsAddrRecvAny); |
86 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer,socket,ESmsAddrRecvAny); |
135 CleanupClosePushL(socket); |
87 CleanupClosePushL(socket); |
136 |
88 |
137 // Create comms database object |
89 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
138 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
139 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
140 #else |
|
141 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
142 #endif |
|
143 CleanupStack::PushL(db); |
|
144 |
|
145 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
146 |
|
147 // EReceiveUnstoredClientAck |
|
148 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
149 CleanupStack::PushL(smsReceiveModeField); |
|
150 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
151 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
152 smsReceiveModeField->ModifyL(*db); |
|
153 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
154 CleanupStack::PopAndDestroy(db); |
|
155 |
|
156 |
90 |
157 //Set destination and SC numbers |
91 //Set destination and SC numbers |
158 iTelephoneNumber=KPekka; |
92 iTelephoneNumber=KPekka; |
159 iServiceCenterNumber=KRadiolinjaSC; |
93 iServiceCenterNumber=KRadiolinjaSC; |
160 |
94 |
165 { |
99 { |
166 arrBuf[i] = i; |
100 arrBuf[i] = i; |
167 } |
101 } |
168 |
102 |
169 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
103 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
170 CSmsMessage* smsMessage=CreateSmsMessageL(arrBuf, alphabet); |
104 CSmsMessage* smsMessage=CreateSmsMessageLC(arrBuf, alphabet); |
171 CleanupStack::PushL(smsMessage); |
|
172 |
105 |
173 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
106 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
174 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
107 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
175 |
108 |
176 //Send first SMS |
109 //Send first SMS |
182 for(TInt i = 0; i < KTestPDUSize; ++i) |
115 for(TInt i = 0; i < KTestPDUSize; ++i) |
183 { |
116 { |
184 arrBuf2[i] = 128 + i; |
117 arrBuf2[i] = 128 + i; |
185 } |
118 } |
186 |
119 |
187 smsMessage=CreateSmsMessageL(arrBuf2, alphabet); |
|
188 CleanupStack::PushL(smsMessage); |
|
189 |
|
190 //Send second SMS |
120 //Send second SMS |
191 SendSmsL(smsMessage,socket); |
121 smsMessage=CreateSmsMessageLC(arrBuf2, alphabet); |
122 SendSmsL(smsMessage,socket); |
|
192 CleanupStack::PopAndDestroy(smsMessage); |
123 CleanupStack::PopAndDestroy(smsMessage); |
193 |
124 |
194 //Receive first SMS |
125 //Receive first SMS |
195 INFO_PRINTF1(_L("waiting for incoming first SMS...") ); |
|
196 WaitForRecvL(socket); |
126 WaitForRecvL(socket); |
197 smsMessage = RecvSmsL(socket); |
127 smsMessage = RecvSmsL(socket); |
198 |
|
199 INFO_PRINTF1(_L("incoming first SMS") ); |
|
200 |
|
201 CleanupStack::PushL(smsMessage); |
128 CleanupStack::PushL(smsMessage); |
202 TestSmsContentsL(smsMessage, arrBuf, ETrue); |
129 |
130 TestSmsContentsL(smsMessage, arrBuf, ETrue); |
|
203 |
131 |
204 //Save the received message to the SMS storage |
132 //Save the received message to the SMS storage |
205 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
133 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
206 WriteSmsToSimL(*smsMessage, socket); |
134 WriteSmsToSimL(*smsMessage, socket); |
207 |
|
208 CleanupStack::PopAndDestroy(smsMessage); |
135 CleanupStack::PopAndDestroy(smsMessage); |
209 |
136 |
210 //Receive second SMS |
137 //Receive second SMS |
211 INFO_PRINTF1(_L("waiting for incoming second SMS...") ); |
|
212 WaitForRecvL(socket); |
138 WaitForRecvL(socket); |
213 smsMessage = RecvSmsL(socket); |
139 smsMessage = RecvSmsL(socket); |
214 |
|
215 INFO_PRINTF1(_L("incoming second SMS") ); |
|
216 |
|
217 CleanupStack::PushL(smsMessage); |
140 CleanupStack::PushL(smsMessage); |
218 TestSmsContentsL(smsMessage, arrBuf2, ETrue); |
141 |
142 TestSmsContentsL(smsMessage, arrBuf2, ETrue); |
|
219 |
143 |
220 //Save the received message to the SMS storage |
144 //Save the received message to the SMS storage |
221 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
145 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
222 WriteSmsToSimL(*smsMessage, socket); |
146 WriteSmsToSimL(*smsMessage, socket); |
223 |
|
224 CleanupStack::PopAndDestroy(smsMessage); |
147 CleanupStack::PopAndDestroy(smsMessage); |
225 |
148 |
226 // Enumerate messages from Store |
149 // Enumerate messages from Store |
227 RPointerArray<CSmsMessage> messages; |
150 RPointerArray<CSmsMessage> messages; |
228 ReadSmsStoreL(socket, messages); |
151 ReadSmsStoreL(socket, messages); |
229 messages.ResetAndDestroy(); |
152 messages.ResetAndDestroy(); |
230 |
153 |
231 CleanupStack::PopAndDestroy(&socket); |
154 CleanupStack::PopAndDestroy(&socket); |
232 |
|
233 CleanupStack::PopAndDestroy(&socketServer); |
|
234 |
|
235 return TestStepResult() ; |
155 return TestStepResult() ; |
236 } |
156 } |
237 |
157 |
238 |
|
239 TVerdict CTestStatusReport::doTestStepL() |
158 TVerdict CTestStatusReport::doTestStepL() |
240 /** |
159 /** |
241 * Test a simple Transmit and Receive with status reporting |
160 * Test a simple Transmit and Receive with status reporting |
242 */ |
161 */ |
243 { |
162 { |
244 INFO_PRINTF1(_L("Test Tx an SMS and then receive a status report")); |
163 INFO_PRINTF1(_L("Test Tx an SMS and then receive a status report")); |
245 |
|
246 RSocketServ socketServer; |
|
247 PrepareRegTestLC(socketServer, 1); |
|
248 |
|
249 RSocket socket; |
164 RSocket socket; |
250 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
165 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
251 |
166 |
252 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
167 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
253 |
168 |
254 //Set destination and SC numbers |
169 //Set destination and SC numbers |
255 iTelephoneNumber=KPekka; |
170 iTelephoneNumber=KPekka; |
262 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
177 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
263 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
178 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
264 |
179 |
265 //Send SMS |
180 //Send SMS |
266 SendSmsL(smsMessage,socket); |
181 SendSmsL(smsMessage,socket); |
267 |
|
268 CleanupStack::PopAndDestroy(smsMessage); |
182 CleanupStack::PopAndDestroy(smsMessage); |
269 |
183 |
270 //Create and send the second SMS |
184 //Create and send the second SMS |
271 |
|
272 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
185 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
273 |
186 |
274 //Set destination number |
187 //Set destination number |
275 iTelephoneNumber=KOther; |
188 iTelephoneNumber=KOther; |
276 |
189 |
281 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
194 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
282 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
195 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
283 |
196 |
284 //Send SMS |
197 //Send SMS |
285 SendSmsL(smsMessage,socket); |
198 SendSmsL(smsMessage,socket); |
286 |
|
287 CleanupStack::PopAndDestroy(smsMessage); |
199 CleanupStack::PopAndDestroy(smsMessage); |
288 |
200 |
289 //Create and send the third SMS |
201 //Create and send the third SMS |
290 |
202 |
291 //Set destination number |
203 //Set destination number |
298 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
210 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
299 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
211 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
300 |
212 |
301 //Send SMS |
213 //Send SMS |
302 SendSmsL(smsMessage,socket); |
214 SendSmsL(smsMessage,socket); |
303 |
|
304 CleanupStack::PopAndDestroy(smsMessage); |
215 CleanupStack::PopAndDestroy(smsMessage); |
305 |
216 |
306 //Create and send the fourth SMS |
217 //Create and send the fourth SMS |
307 |
218 |
308 //Set destination and SC numbers |
219 //Set destination and SC numbers |
316 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
227 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
317 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
228 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
318 |
229 |
319 //Send SMS |
230 //Send SMS |
320 SendSmsL(smsMessage,socket); |
231 SendSmsL(smsMessage,socket); |
321 |
|
322 CleanupStack::PopAndDestroy(smsMessage); |
232 CleanupStack::PopAndDestroy(smsMessage); |
323 |
233 |
324 // Create and send the 5th SMS. Here the submit PDU contains an international number |
234 // Create and send the 5th SMS. Here the submit PDU contains an international number |
325 // and the Status Report that will be received contains the local version of that number |
235 // and the Status Report that will be received contains the local version of that number |
326 |
236 |
336 INFO_PRINTF2(_L("Destination number:..... %S"), &iTelephoneNumber); |
246 INFO_PRINTF2(_L("Destination number:..... %S"), &iTelephoneNumber); |
337 INFO_PRINTF2(_L("ServiceCenter number:... %S"), &iServiceCenterNumber); |
247 INFO_PRINTF2(_L("ServiceCenter number:... %S"), &iServiceCenterNumber); |
338 |
248 |
339 //Send SMS |
249 //Send SMS |
340 SendSmsL(smsMessage, socket); |
250 SendSmsL(smsMessage, socket); |
341 |
251 CleanupStack::PopAndDestroy(smsMessage); |
342 CleanupStack::PopAndDestroy(smsMessage); |
252 |
343 |
253 //////////// |
344 // |
|
345 // PDEF137451 |
254 // PDEF137451 |
346 //Create and send the sixth SMS |
255 //Create and send the sixth SMS |
347 // |
256 // |
348 |
257 |
349 //Set destination and SC numbers |
258 //Set destination and SC numbers |
357 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
266 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
358 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
267 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
359 |
268 |
360 //Send SMS |
269 //Send SMS |
361 SendSmsL(smsMessage,socket); |
270 SendSmsL(smsMessage,socket); |
362 |
|
363 CleanupStack::PopAndDestroy(smsMessage); |
271 CleanupStack::PopAndDestroy(smsMessage); |
364 |
272 |
365 // |
273 // |
366 //Create and send the seventh SMS (7-bit) |
274 //Create and send the seventh SMS (7-bit) |
367 // |
275 // |
376 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
284 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
377 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
285 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
378 |
286 |
379 //Send SMS |
287 //Send SMS |
380 SendSmsL(smsMessage,socket); |
288 SendSmsL(smsMessage,socket); |
381 |
289 CleanupStack::PopAndDestroy(smsMessage); |
382 CleanupStack::PopAndDestroy(smsMessage); |
290 |
383 |
291 /////////////// |
384 // |
292 |
385 |
|
386 |
|
387 //Receive status report |
293 //Receive status report |
388 TSmsServiceCenterAddress telephoneNumber; |
294 TSmsServiceCenterAddress telephoneNumber; |
389 telephoneNumber.Copy( KOther ); |
295 telephoneNumber.Copy( KOther ); |
390 RecvStatusReportL(telephoneNumber, socket); |
296 RecvStatusReportL(telephoneNumber, socket); |
297 |
|
391 telephoneNumber = KLocalNumber; |
298 telephoneNumber = KLocalNumber; |
392 RecvStatusReportL(telephoneNumber, socket); |
299 RecvStatusReportL(telephoneNumber, socket); |
300 |
|
393 telephoneNumber = KOther; |
301 telephoneNumber = KOther; |
394 RecvStatusReportL(telephoneNumber, socket); |
302 RecvStatusReportL(telephoneNumber, socket); |
303 |
|
395 telephoneNumber.Copy( KPekka ); |
304 telephoneNumber.Copy( KPekka ); |
396 RecvStatusReportL(telephoneNumber, socket); |
305 RecvStatusReportL(telephoneNumber, socket); |
306 |
|
397 // CSmsPDUProcessor::DecodeAndProcessPDUL sets the address of the SR |
307 // CSmsPDUProcessor::DecodeAndProcessPDUL sets the address of the SR |
398 // to the same as that of the original submit. So we expect the |
308 // to the same as that of the original submit. So we expect the |
399 // received SR to have an international number, despite the SR PDU |
309 // received SR to have an international number, despite the SR PDU |
400 // having a local number. |
310 // having a local number. |
401 telephoneNumber.Copy(KInternationalTestNumber); |
311 telephoneNumber.Copy(KInternationalTestNumber); |
402 RecvStatusReportL(telephoneNumber, socket); |
312 RecvStatusReportL(telephoneNumber, socket); |
403 |
313 |
404 // truncated user data, 8-bit: |
314 // truncated user data, 8-bit: |
405 telephoneNumber.Copy( KPekka ); |
315 telephoneNumber.Copy( KPekka ); |
406 RecvStatusReportL(telephoneNumber, socket); |
316 RecvStatusReportL(telephoneNumber, socket); |
317 |
|
407 // truncated user data, 7-bit: |
318 // truncated user data, 7-bit: |
408 telephoneNumber.Copy( KOther ); |
319 telephoneNumber.Copy( KOther ); |
409 RecvStatusReportL(telephoneNumber, socket); |
320 RecvStatusReportL(telephoneNumber, socket); |
410 |
321 |
411 CleanupStack::PopAndDestroy(&socket); |
322 CleanupStack::PopAndDestroy(&socket); |
412 CleanupStack::PopAndDestroy(&socketServer); |
|
413 |
|
414 |
|
415 return TestStepResult() ; |
323 return TestStepResult() ; |
416 } |
324 } |
417 |
325 |
418 |
|
419 TVerdict CTestTxWithError::doTestStepL() |
326 TVerdict CTestTxWithError::doTestStepL() |
420 /** |
327 /** |
421 * Test a simple Transmit and Receive. This test case tests different errors from TSY. |
328 * Test a simple Transmit and Receive. This test case tests different errors from TSY. |
422 */ |
329 */ |
423 { |
330 { |
424 INFO_PRINTF1(_L("Test Tx an SMS, completed with error")); |
331 INFO_PRINTF1(_L("Test Tx an SMS, completed with error")); |
425 |
|
426 RSocketServ socketServer; |
|
427 PrepareRegTestLC(socketServer, 2); |
|
428 |
|
429 RSocket socket; |
332 RSocket socket; |
430 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
333 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
431 |
334 |
432 RSocket socket2; |
335 RSocket socket2; |
433 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket2,ESmsAddrSendOnly); |
336 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket2,ESmsAddrSendOnly); |
434 |
337 |
435 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
338 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
436 |
339 |
437 //Set destination and SC numbers |
340 //Set destination and SC numbers |
438 iTelephoneNumber=KPekka; |
341 iTelephoneNumber=KPekka; |
439 iServiceCenterNumber=KSoneraSC; |
342 iServiceCenterNumber=KSoneraSC; |
440 |
343 |
441 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
344 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
442 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
345 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
443 CleanupStack::PushL(smsMessage); |
|
444 |
346 |
445 //Set Status report request |
347 //Set Status report request |
446 CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU(); |
348 CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU(); |
447 submitPdu.SetStatusReportRequest(ETrue); |
349 submitPdu.SetStatusReportRequest(ETrue); |
448 |
350 |
452 INFO_PRINTF1(_L("waiting 2 secs for smsprot to load")); |
354 INFO_PRINTF1(_L("waiting 2 secs for smsprot to load")); |
453 User::After(2000000); |
355 User::After(2000000); |
454 |
356 |
455 //Try sending, Tsy returns error |
357 //Try sending, Tsy returns error |
456 SendSmsCancelL(smsMessage,socket, socket2); |
358 SendSmsCancelL(smsMessage,socket, socket2); |
457 |
|
458 // SendSmsErrorL(smsMessage,socket); |
|
459 |
359 |
460 INFO_PRINTF1(_L("Try again sending the SMS")); |
360 INFO_PRINTF1(_L("Try again sending the SMS")); |
461 //Now sending succeeds KErrNone |
361 //Now sending succeeds KErrNone |
462 SendSmsL(smsMessage,socket); |
362 SendSmsL(smsMessage,socket); |
463 |
363 |
488 TEST(ETrue); |
388 TEST(ETrue); |
489 |
389 |
490 CleanupStack::PopAndDestroy(smsMessage); |
390 CleanupStack::PopAndDestroy(smsMessage); |
491 |
391 |
492 //Receive SMS |
392 //Receive SMS |
493 INFO_PRINTF1(_L("waiting for incoming SMS...")); |
|
494 WaitForRecvL(socket); |
393 WaitForRecvL(socket); |
495 smsMessage = RecvSmsL(socket); |
394 smsMessage = RecvSmsL(socket); |
496 |
|
497 INFO_PRINTF1(_L("incoming SMS") ); |
|
498 |
|
499 CleanupStack::PushL(smsMessage); |
395 CleanupStack::PushL(smsMessage); |
500 |
396 |
501 TestSmsContentsL(smsMessage,KTestMsg1); |
397 TestSmsContentsL(smsMessage,KTestMsg1); |
502 |
398 |
503 CleanupStack::PopAndDestroy(3); // socket, socket2, smsMessage |
399 CleanupStack::PopAndDestroy(3, &socket); // socket, socket2, smsMessage |
504 CleanupStack::PopAndDestroy(&socketServer); |
|
505 |
|
506 return TestStepResult() ; |
400 return TestStepResult() ; |
507 } |
401 } |
508 |
402 |
509 |
|
510 TVerdict CTestTxFailed::doTestStepL() |
403 TVerdict CTestTxFailed::doTestStepL() |
511 /** |
404 /** |
512 * Test sending an SMS, transmit will be failed with different error codes |
405 * Test sending an SMS, transmit will be failed with different error codes |
513 */ |
406 */ |
514 { |
407 { |
515 INFO_PRINTF1(_L("Test Tx an SMS, failed with different error codes")); |
408 INFO_PRINTF1(_L("Test Tx an SMS, failed with different error codes")); |
516 |
|
517 RSocketServ socketServer; |
|
518 PrepareRegTestLC(socketServer, 3); |
|
519 |
|
520 RSocket socket; |
409 RSocket socket; |
521 TInt ret; |
410 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
522 |
|
523 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
|
524 |
411 |
525 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
412 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
526 |
413 |
527 //Set destination and SC numbers |
414 //Set destination and SC numbers |
528 iTelephoneNumber=KPekka; |
415 iTelephoneNumber=KPekka; |
529 iServiceCenterNumber=KSoneraSC; |
416 iServiceCenterNumber=KSoneraSC; |
530 |
417 |
531 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
418 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
532 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
419 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
533 CleanupStack::PushL(smsMessage); |
|
534 |
420 |
535 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
421 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
536 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
422 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
537 |
423 |
538 //Try sending, Dummy Tsy returns RP-error |
424 //Try sending, Dummy Tsy returns RP-error |
539 TInt i; |
425 TInt i; |
540 for (i=0; i <25; i++) |
426 TInt ret; |
427 |
|
428 for (i=0; i < 25; ++i) |
|
541 { |
429 { |
542 ret = SendSmsErrorL(smsMessage,socket); |
430 ret = SendSmsErrorL(smsMessage,socket); |
543 } |
431 } |
544 |
432 |
545 //Try sending, Dummy Tsy returns RP-error with corrupted or wrong submit report PDU |
433 //Try sending, Dummy Tsy returns RP-error with corrupted or wrong submit report PDU |
546 for (i=0; i <2; i++) |
434 for (i=0; i < 2; ++i) |
547 { |
435 { |
548 ret = SendSmsErrorL(smsMessage,socket); |
436 ret = SendSmsErrorL(smsMessage,socket); |
549 } |
437 } |
550 |
438 |
551 //Try sending, Dummy Tsy returns general error |
439 //Try sending, Dummy Tsy returns general error |
552 for (i=0; i <3; i++) |
440 for (i=0; i < 3; ++i) |
553 { |
441 { |
554 ret = SendSmsErrorL(smsMessage,socket); |
442 ret = SendSmsErrorL(smsMessage,socket); |
555 } |
443 } |
556 |
444 |
557 //Try sending, check expected error code |
445 //Try sending, check expected error code |
558 ret = SendSmsErrorL(smsMessage,socket); |
446 ret = SendSmsErrorL(smsMessage,socket); |
559 TEST(ret== KErrGsmSMSMemCapacityExceeded); |
447 TEST(ret== KErrGsmSMSMemCapacityExceeded); |
560 |
448 |
561 |
449 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
562 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
|
563 CleanupStack::PopAndDestroy(&socketServer); |
|
564 |
|
565 return TestStepResult() ; |
450 return TestStepResult() ; |
566 } |
451 } |
567 |
452 |
568 |
453 // TODO: test does not seem to be used in any scripts that are run as part of tests |
454 // only present in TE_smsprtRegressionClass0StoreEnabled.script, check if OK to remove |
|
569 TVerdict CTestMatchingToObserver::doTestStepL() |
455 TVerdict CTestMatchingToObserver::doTestStepL() |
570 /** |
456 /** |
571 * Test a simple Receive of a single TPDU containing a simple text |
457 * Test a simple Receive of a single TPDU containing a simple text |
572 */ |
458 */ |
573 { |
459 { |
574 INFO_PRINTF1(_L("Test Messages matching to correct observer")); |
460 INFO_PRINTF1(_L("Test Messages matching to correct observer")); |
575 |
|
576 RSocketServ socketServer; |
|
577 PrepareRegTestLC(socketServer, 4); |
|
578 |
|
579 RSocket socket1; |
461 RSocket socket1; |
580 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket1,ESmsAddrRecvAny); |
462 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket1,ESmsAddrRecvAny); |
581 |
463 |
582 RSocket socket2; |
464 RSocket socket2; |
583 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket2,ESmsAddrSendOnly); |
465 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket2,ESmsAddrSendOnly); |
584 |
466 |
585 _LIT(KTestMsg1,"test message, 8bits, length 30"); //8 bits test message, length 30 chars |
467 _LIT(KTestMsg1,"test message, 8bits, length 30"); //8 bits test message, length 30 chars |
586 _LIT(KTestMsg2,"test message, length 23"); //7 bits test message, length 23 characters |
468 _LIT(KTestMsg2,"test message, length 23"); //7 bits test message, length 23 characters |
587 |
469 |
588 TBuf8<128> match; |
470 TBuf8<128> match; |
589 match.Copy(KTestMsg2); |
471 match.Copy(KTestMsg2); |
590 |
472 |
591 RSocket socket3; |
473 RSocket socket3; |
592 TInt ret=socket3.Open(socketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol); |
474 TInt ret=socket3.Open(iSocketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol); |
593 TEST(ret == KErrNone); |
475 TEST(ret == KErrNone); |
594 CleanupClosePushL(socket3); |
476 CleanupClosePushL(socket3); |
595 |
477 |
596 TSmsAddr smsaddr; |
478 TSmsAddr smsaddr; |
597 smsaddr.SetSmsAddrFamily(ESmsAddrMatchText); |
479 smsaddr.SetSmsAddrFamily(ESmsAddrMatchText); |
601 |
483 |
602 smsaddr.SetTextMatch(_L8("test message, 8bi")); |
484 smsaddr.SetTextMatch(_L8("test message, 8bi")); |
603 ret=socket1.Bind(smsaddr); |
485 ret=socket1.Bind(smsaddr); |
604 TEST(ret == KErrNone); |
486 TEST(ret == KErrNone); |
605 |
487 |
606 // |
|
607 //Set destination and SC numbers |
488 //Set destination and SC numbers |
608 iTelephoneNumber=KPekka; |
489 iTelephoneNumber=KPekka; |
609 iServiceCenterNumber=KRadiolinjaSC; |
490 iServiceCenterNumber=KRadiolinjaSC; |
610 |
491 |
611 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
492 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
615 INFO_PRINTF2(_L("Destination number:..... %S"), &iTelephoneNumber); |
496 INFO_PRINTF2(_L("Destination number:..... %S"), &iTelephoneNumber); |
616 INFO_PRINTF2(_L("ServiceCenter number:... %S"), &iServiceCenterNumber); |
497 INFO_PRINTF2(_L("ServiceCenter number:... %S"), &iServiceCenterNumber); |
617 |
498 |
618 //Send SMS |
499 //Send SMS |
619 SendSmsL(smsMessage,socket2); |
500 SendSmsL(smsMessage,socket2); |
620 |
|
621 CleanupStack::PopAndDestroy(smsMessage); |
501 CleanupStack::PopAndDestroy(smsMessage); |
622 |
502 |
623 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
503 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
624 |
504 |
625 //Set receiving status report to socket2 |
505 //Set receiving status report to socket2 |
629 smsaddr2.SetSmsAddrFamily(ESmsAddrStatusReport); |
509 smsaddr2.SetSmsAddrFamily(ESmsAddrStatusReport); |
630 ret=socket2.Bind(smsaddr2); |
510 ret=socket2.Bind(smsaddr2); |
631 TEST(ret == KErrNone); |
511 TEST(ret == KErrNone); |
632 |
512 |
633 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
513 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
634 |
|
635 smsMessage = RecvSmsL(socket3); |
514 smsMessage = RecvSmsL(socket3); |
636 INFO_PRINTF1(_L("incoming SMS") ); |
|
637 |
|
638 CleanupStack::PushL(smsMessage); |
515 CleanupStack::PushL(smsMessage); |
639 |
516 |
640 TestSmsContentsL(smsMessage,KTestMsg2); |
517 TestSmsContentsL(smsMessage,KTestMsg2); |
641 |
518 |
642 CleanupStack::PopAndDestroy(smsMessage); |
519 CleanupStack::PopAndDestroy(smsMessage); |
643 |
520 |
644 //Receive a message to socket1 |
521 //Receive a message to socket1 |
645 smsMessage = RecvSmsL(socket1); |
522 smsMessage = RecvSmsL(socket1); |
646 |
|
647 INFO_PRINTF1(_L("incoming SMS") ); |
|
648 |
|
649 CleanupStack::PushL(smsMessage); |
523 CleanupStack::PushL(smsMessage); |
650 |
524 |
651 TestSmsContentsL(smsMessage,KTestMsg1); |
525 TestSmsContentsL(smsMessage,KTestMsg1); |
652 |
526 CleanupStack::PopAndDestroy(smsMessage); |
653 CleanupStack::PopAndDestroy(smsMessage); |
527 |
654 |
528 //Receive a status report message to socket2 |
655 //Receive a status report message to socket2 |
|
656 |
|
657 smsMessage = RecvSmsL(socket2); |
529 smsMessage = RecvSmsL(socket2); |
658 |
530 CleanupStack::PushL(smsMessage); |
659 INFO_PRINTF1(_L("incoming SMS") ); |
531 |
660 |
|
661 //Check the status report |
532 //Check the status report |
662 |
|
663 CleanupStack::PushL(smsMessage); |
|
664 if (smsMessage->Type()==CSmsPDU::ESmsStatusReport) |
533 if (smsMessage->Type()==CSmsPDU::ESmsStatusReport) |
665 { |
534 { |
666 INFO_PRINTF1(_L("Received status report")); |
535 INFO_PRINTF1(_L("Received status report")); |
667 TSmsServiceCenterAddress telephoneNumber=smsMessage->ToFromAddress(); |
536 TSmsServiceCenterAddress telephoneNumber=smsMessage->ToFromAddress(); |
668 TEST(telephoneNumber==KPekka); |
537 TEST(telephoneNumber==KPekka); |
669 INFO_PRINTF2(_L("Message delivered to %S"),&telephoneNumber); |
538 INFO_PRINTF2(_L("Message delivered to %S"),&telephoneNumber); |
670 } |
539 } |
671 |
540 |
672 CleanupStack::PopAndDestroy(4); // socket1, socket2, socket3, smsMessage |
541 CleanupStack::PopAndDestroy(4, &socket1); // socket1, socket2, socket3, smsMessage |
673 CleanupStack::PopAndDestroy(&socketServer); |
|
674 |
|
675 return TestStepResult() ; |
542 return TestStepResult() ; |
676 } |
543 } |
677 |
|
678 |
544 |
679 TVerdict CTestCommandMessages::doTestStepL() |
545 TVerdict CTestCommandMessages::doTestStepL() |
680 /** |
546 /** |
681 * Test first transmit of a message, then send Command message to enable status reporting to previously sent |
547 * Test first transmit of a message, then send Command message to enable status reporting to previously sent |
682 * message and then receive a status report when previously sent message is delivered to recipient. |
548 * message and then receive a status report when previously sent message is delivered to recipient. |
683 */ |
549 */ |
684 { |
550 { |
685 INFO_PRINTF1(_L("Test Command messages")); |
551 INFO_PRINTF1(_L("Test Command messages")); |
686 |
|
687 RSocketServ socketServer; |
|
688 PrepareRegTestLC(socketServer, 5); |
|
689 |
|
690 RSocket socket; |
552 RSocket socket; |
691 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
553 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
692 |
554 |
693 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
555 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
694 |
556 |
695 //Set destination and SC numbers |
557 //Set destination and SC numbers |
696 iTelephoneNumber=KPekka; |
558 iTelephoneNumber=KPekka; |
697 iServiceCenterNumber=KSoneraSC; |
559 iServiceCenterNumber=KSoneraSC; |
698 |
560 |
699 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
561 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
700 CSmsMessage* smsMessage=CreateSmsMessageL(KTest7bitMsg,alphabet); |
562 CSmsMessage* smsMessage=CreateSmsMessageLC(KTest7bitMsg,alphabet); |
701 CleanupStack::PushL(smsMessage); |
|
702 |
563 |
703 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
564 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
704 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
565 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
705 |
566 |
706 //Send the message |
567 //Send the message |
729 //Receive status report |
590 //Receive status report |
730 TSmsServiceCenterAddress telephoneNumber; |
591 TSmsServiceCenterAddress telephoneNumber; |
731 telephoneNumber.Copy( KPekka ); |
592 telephoneNumber.Copy( KPekka ); |
732 RecvStatusReportL(telephoneNumber, socket); |
593 RecvStatusReportL(telephoneNumber, socket); |
733 |
594 |
734 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
595 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
735 CleanupStack::PopAndDestroy(&socketServer); |
|
736 |
|
737 return TestStepResult() ; |
596 return TestStepResult() ; |
738 } |
597 } |
739 |
598 |
740 |
|
741 TVerdict CTestSimpleRx::doTestStepL() |
599 TVerdict CTestSimpleRx::doTestStepL() |
742 /** |
600 /** |
743 * Test a simple Receive of a single TPDU containing a simple text |
601 * Test a simple Receive of a single TPDU containing a simple text |
744 */ |
602 */ |
745 { |
603 { |
746 INFO_PRINTF1(_L("Test Simple Rx SMS with Client ACK")); |
604 INFO_PRINTF1(_L("Test Simple Rx SMS with Client ACK")); |
747 |
|
748 RSocketServ socketServer; |
|
749 PrepareRegTestLC(socketServer, 6); |
|
750 |
|
751 RSocket socket; |
605 RSocket socket; |
752 TSmsAddr smsaddr; |
606 TSmsAddr smsaddr; |
753 smsaddr.SetSmsAddrFamily(ESmsAddrMatchText); |
607 smsaddr.SetSmsAddrFamily(ESmsAddrMatchText); |
754 smsaddr.SetTextMatch(_L8("test message, 8b")); |
608 smsaddr.SetTextMatch(_L8("test message, 8b")); |
755 iSmsStackTestUtils->OpenSmsSocketLC(socketServer, socket, smsaddr); |
609 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, smsaddr); |
756 |
610 |
757 RSocket socketRecvAny; |
611 RSocket socketRecvAny; |
758 iSmsStackTestUtils->OpenSmsSocketLC(socketServer, socketRecvAny, ESmsAddrRecvAny); |
612 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socketRecvAny, ESmsAddrRecvAny); |
759 |
613 |
760 INFO_PRINTF1(_L("waiting for incoming SMS No. 1...") ); |
614 INFO_PRINTF1(_L("waiting for incoming SMS No. 1...") ); |
761 WaitForRecvL(socket); |
615 WaitForRecvL(socket); |
762 CSmsMessage* smsMessage = RecvSmsFailedL(socket); |
616 CSmsMessage* smsMessage = RecvSmsFailedL(socket); |
763 |
|
764 INFO_PRINTF1(_L("incoming SMS") ); |
|
765 |
|
766 CleanupStack::PushL(smsMessage); |
617 CleanupStack::PushL(smsMessage); |
767 |
618 |
768 _LIT(KTestMsg1,"Test message, 8bits, length 30"); |
619 _LIT(KTestMsg1,"Test message, 8bits, length 30"); |
769 TestSmsContentsL(smsMessage,KTestMsg1); |
620 TestSmsContentsL(smsMessage,KTestMsg1); |
770 |
|
771 CleanupStack::PopAndDestroy(smsMessage); |
621 CleanupStack::PopAndDestroy(smsMessage); |
772 |
622 |
773 INFO_PRINTF1(_L("waiting for incoming SMS No. 2...") ); |
623 INFO_PRINTF1(_L("waiting for incoming SMS No. 2...") ); |
774 WaitForRecvL(socketRecvAny); |
624 WaitForRecvL(socketRecvAny); |
775 smsMessage = RecvSmsFailedL(socketRecvAny); |
625 smsMessage = RecvSmsFailedL(socketRecvAny); |
776 |
|
777 INFO_PRINTF1(_L("incoming SMS") ); |
|
778 |
|
779 CleanupStack::PushL(smsMessage); |
626 CleanupStack::PushL(smsMessage); |
780 |
627 |
781 _LIT(KTestMsg2,"Sest message, 8bits, length 30"); |
628 _LIT(KTestMsg2,"Sest message, 8bits, length 30"); |
782 TestSmsContentsL(smsMessage,KTestMsg2); |
629 TestSmsContentsL(smsMessage,KTestMsg2); |
783 |
630 |
784 CleanupStack::PopAndDestroy(3); // socket, socketRecvAny, smsMessage |
631 CleanupStack::PopAndDestroy(3, &socket); // socket, socketRecvAny, smsMessage |
785 CleanupStack::PopAndDestroy(&socketServer); |
|
786 |
|
787 return TestStepResult() ; |
632 return TestStepResult() ; |
788 } |
633 } |
789 |
634 |
790 |
|
791 TVerdict CTest7bitMessTest::doTestStepL() |
635 TVerdict CTest7bitMessTest::doTestStepL() |
792 /** |
636 /** |
793 * Test a simple Transmit and Receive of a single TPDU containing a single character |
637 * Test a simple Transmit and Receive of a single TPDU containing a single character |
794 */ |
638 */ |
795 { |
639 { |
796 INFO_PRINTF1(_L("Test Tx and Rx 7 bit SMS with Client ACK")); |
640 INFO_PRINTF1(_L("Test Tx and Rx 7 bit SMS with Client ACK")); |
797 |
|
798 RSocketServ socketServer; |
|
799 PrepareRegTestLC(socketServer, 7); |
|
800 |
|
801 RSocket socket; |
641 RSocket socket; |
802 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
642 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
803 |
643 |
804 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
644 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
805 //Set destination and SC numbers |
645 //Set destination and SC numbers |
806 iTelephoneNumber=KPekka; |
646 iTelephoneNumber=KPekka; |
807 iServiceCenterNumber=KSoneraSC; |
647 iServiceCenterNumber=KSoneraSC; |
808 |
648 |
809 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
649 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
810 CSmsMessage* smsMessage=CreateSmsMessageL(KTest7bitMsg,alphabet); |
650 CSmsMessage* smsMessage=CreateSmsMessageLC(KTest7bitMsg,alphabet); |
811 CleanupStack::PushL(smsMessage); |
|
812 |
651 |
813 //Set status report request |
652 //Set status report request |
814 CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU(); |
653 CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU(); |
815 submitPdu.SetStatusReportRequest(ETrue); |
654 submitPdu.SetStatusReportRequest(ETrue); |
816 |
655 |
819 |
658 |
820 //Send the message |
659 //Send the message |
821 SendSmsL(smsMessage,socket); |
660 SendSmsL(smsMessage,socket); |
822 CleanupStack::PopAndDestroy(smsMessage); |
661 CleanupStack::PopAndDestroy(smsMessage); |
823 |
662 |
824 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
825 WaitForRecvL(socket); |
663 WaitForRecvL(socket); |
826 smsMessage = RecvSmsL(socket); |
664 smsMessage = RecvSmsL(socket); |
827 |
|
828 INFO_PRINTF1(_L("incoming SMS") ); |
|
829 |
|
830 CleanupStack::PushL(smsMessage); |
665 CleanupStack::PushL(smsMessage); |
666 |
|
831 TestSmsContentsL(smsMessage,KTest7bitMsg); |
667 TestSmsContentsL(smsMessage,KTest7bitMsg); |
832 |
668 |
833 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
669 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
834 CleanupStack::PopAndDestroy(&socketServer); |
670 return TestStepResult() ; |
835 |
671 } |
836 return TestStepResult() ; |
|
837 } |
|
838 |
|
839 |
672 |
840 TVerdict CTestClassMessages::doTestStepL() |
673 TVerdict CTestClassMessages::doTestStepL() |
841 /** |
674 /** |
842 * Test Send and receive messages of different classes |
675 * Test Send and receive messages of different classes |
843 * TODO - why do I have to send a class 2 sms before the class 1 and 3 sms |
676 * TODO - why do I have to send a class 2 sms before the class 1 and 3 sms |
844 */ |
677 */ |
845 { |
678 { |
846 |
|
847 INFO_PRINTF1(_L("Send and receive messages with different classes")); |
679 INFO_PRINTF1(_L("Send and receive messages with different classes")); |
848 |
|
849 RSocketServ socketServer; |
|
850 PrepareRegTestLC(socketServer, 8); |
|
851 |
|
852 RSocket socket; |
680 RSocket socket; |
853 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
681 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
854 |
682 |
855 iTelephoneNumber=KPekka; |
683 iTelephoneNumber=KPekka; |
856 iServiceCenterNumber=KSoneraSC; |
684 iServiceCenterNumber=KSoneraSC; |
857 |
685 |
858 INFO_PRINTF1(_L("Sending message...")); |
686 INFO_PRINTF1(_L("Sending message...")); |
873 TTestCase Class3msg(_L("Class 3 message")); |
701 TTestCase Class3msg(_L("Class 3 message")); |
874 Class3msg.SetSmsClass(TSmsDataCodingScheme::ESmsClass3); |
702 Class3msg.SetSmsClass(TSmsDataCodingScheme::ESmsClass3); |
875 SendAndRecvTestMessageL(Class3msg,socket); |
703 SendAndRecvTestMessageL(Class3msg,socket); |
876 |
704 |
877 CleanupStack::PopAndDestroy(&socket); |
705 CleanupStack::PopAndDestroy(&socket); |
878 CleanupStack::PopAndDestroy(&socketServer); |
|
879 |
|
880 return TestStepResult() ; |
706 return TestStepResult() ; |
881 } |
707 } |
882 |
|
883 |
708 |
884 TVerdict CTestRxConcatenated::doTestStepL() |
709 TVerdict CTestRxConcatenated::doTestStepL() |
885 /** |
710 /** |
886 * Test reception of a concatenated SMS message spanning 3 TPDUs |
711 * Test reception of a concatenated SMS message spanning 3 TPDUs |
887 * with the TSY requiring the SMS Stack to ACK each TPDU |
712 * with the TSY requiring the SMS Stack to ACK each TPDU |
888 */ |
713 */ |
889 { |
714 { |
890 INFO_PRINTF1(_L("Test Rx Three Part Concatenated Message")); |
715 INFO_PRINTF1(_L("Test Rx Three Part Concatenated Message")); |
891 |
|
892 RSocketServ socketServer; |
|
893 PrepareRegTestLC(socketServer, 9); |
|
894 |
|
895 RSocket socket; |
716 RSocket socket; |
896 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
717 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
897 |
718 |
898 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
899 WaitForRecvL(socket); |
719 WaitForRecvL(socket); |
900 CSmsMessage* smsMessage = RecvSmsL(socket); |
720 CSmsMessage* smsMessage = RecvSmsL(socket); |
901 CleanupStack::PushL(smsMessage); |
721 CleanupStack::PushL(smsMessage); |
902 INFO_PRINTF1(_L("incoming SMS") ); |
|
903 |
722 |
904 _LIT(KLongText,"3 PDU test SMS message. " |
723 _LIT(KLongText,"3 PDU test SMS message. " |
905 L"3 PDU test SMS message. " |
724 L"3 PDU test SMS message. " |
906 L"3 PDU test SMS message. " |
725 L"3 PDU test SMS message. " |
907 L"3 PDU test SMS message. " |
726 L"3 PDU test SMS message. " |
908 L"3 PDU test SMS message. " |
727 L"3 PDU test SMS message. " |
909 L"3 PDU test SMS message. " |
728 L"3 PDU test SMS message. " |
910 L"3 PDU test SMS message. " |
729 L"3 PDU test SMS message. " |
911 L"3 PDU test SMS message. " |
730 L"3 PDU test SMS message. " |
912 L"3 PDU test SMS message. " |
731 L"3 PDU test SMS message. " |
913 L"3 PDU test SMS message. " |
732 L"3 PDU test SMS message. " |
914 L"3 PDU test SMS message. " |
733 L"3 PDU test SMS message. " |
915 L"3 PDU test SMS message. " |
734 L"3 PDU test SMS message. " |
916 L"3 PDU test SMS message. " |
735 L"3 PDU test SMS message. " |
917 L"3 PDU test SMS message. " |
736 L"3 PDU test SMS message. " |
918 L"3 PDU test SMS message. " |
737 L"3 PDU test SMS message. " |
919 L"3 PDU test SMS message. " |
738 L"3 PDU test SMS message. " |
920 L"3 PDU test SMS message. " |
739 L"3 PDU test SMS message. " |
921 L"The End."); |
740 L"The End."); |
741 |
|
922 TestSmsContentsL(smsMessage,KLongText); |
742 TestSmsContentsL(smsMessage,KLongText); |
923 |
743 |
924 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
744 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
925 CleanupStack::PopAndDestroy(&socketServer); |
|
926 |
|
927 return TestStepResult() ; |
745 return TestStepResult() ; |
928 } |
746 } |
929 |
|
930 |
747 |
931 TVerdict CTestRxDuplicate::doTestStepL() |
748 TVerdict CTestRxDuplicate::doTestStepL() |
932 /** |
749 /** |
933 * Test reception of a concatenated SMS message spanning 3 TPDUs |
750 * Test reception of a concatenated SMS message spanning 3 TPDUs |
934 * with the TSY requiring the SMS Stack to ACK each TPDU, where the second |
751 * with the TSY requiring the SMS Stack to ACK each TPDU, where the second |
935 * PDU is repeated even though correctly ACKed by the SMS Stack. |
752 * PDU is repeated even though correctly ACKed by the SMS Stack. |
936 */ |
753 */ |
937 { |
754 { |
938 INFO_PRINTF1(_L("Test Rx Three Part Concatenated Message with 2nd TPDU Duplicated")); |
755 INFO_PRINTF1(_L("Test Rx Three Part Concatenated Message with 2nd TPDU Duplicated")); |
939 |
|
940 RSocketServ socketServer; |
|
941 PrepareRegTestLC(socketServer, 10); |
|
942 |
|
943 RSocket socket; |
756 RSocket socket; |
944 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
757 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
945 |
758 |
946 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
947 WaitForRecvL(socket); |
759 WaitForRecvL(socket); |
948 CSmsMessage* smsMessage = RecvSmsL(socket); |
760 CSmsMessage* smsMessage = RecvSmsL(socket); |
949 CleanupStack::PushL(smsMessage); |
761 CleanupStack::PushL(smsMessage); |
950 INFO_PRINTF1(_L("incoming SMS") ); |
|
951 |
762 |
952 _LIT(KLongText,"3 PDU test SMS message. " |
763 _LIT(KLongText,"3 PDU test SMS message. " |
953 L"3 PDU test SMS message. " |
764 L"3 PDU test SMS message. " |
954 L"3 PDU test SMS message. " |
765 L"3 PDU test SMS message. " |
955 L"3 PDU test SMS message. " |
766 L"3 PDU test SMS message. " |
956 L"3 PDU test SMS message. " |
767 L"3 PDU test SMS message. " |
957 L"3 PDU test SMS message. " |
768 L"3 PDU test SMS message. " |
958 L"3 PDU test SMS message. " |
769 L"3 PDU test SMS message. " |
959 L"3 PDU test SMS message. " |
770 L"3 PDU test SMS message. " |
960 L"3 PDU test SMS message. " |
771 L"3 PDU test SMS message. " |
961 L"3 PDU test SMS message. " |
772 L"3 PDU test SMS message. " |
962 L"3 PDU test SMS message. " |
773 L"3 PDU test SMS message. " |
963 L"3 PDU test SMS message. " |
774 L"3 PDU test SMS message. " |
964 L"3 PDU test SMS message. " |
775 L"3 PDU test SMS message. " |
965 L"3 PDU test SMS message. " |
776 L"3 PDU test SMS message. " |
966 L"3 PDU test SMS message. " |
777 L"3 PDU test SMS message. " |
967 L"3 PDU test SMS message. " |
778 L"3 PDU test SMS message. " |
968 L"3 PDU test SMS message. " |
779 L"3 PDU test SMS message. " |
969 L"The End."); |
780 L"The End."); |
781 |
|
970 TestSmsContentsL(smsMessage,KLongText); |
782 TestSmsContentsL(smsMessage,KLongText); |
971 |
783 |
972 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
784 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
973 CleanupStack::PopAndDestroy(&socketServer); |
|
974 |
|
975 return TestStepResult() ; |
785 return TestStepResult() ; |
976 } |
786 } |
977 |
|
978 |
787 |
979 TVerdict CTestRxRingToneA::doTestStepL() |
788 TVerdict CTestRxRingToneA::doTestStepL() |
980 /** |
789 /** |
981 * Test reception of a concatenated SMS Ringing Tone message spanning 3 TPDUs |
790 * Test reception of a concatenated SMS Ringing Tone message spanning 3 TPDUs |
982 * with the TSY requiring the SMS Stack to ACK each TPDU. |
791 * with the TSY requiring the SMS Stack to ACK each TPDU. |
983 */ |
792 */ |
984 { |
793 { |
985 INFO_PRINTF1(_L("Test Rx Three Part Concatenated SMS Ringing Tone Message")); |
794 INFO_PRINTF1(_L("Test Rx Three Part Concatenated SMS Ringing Tone Message")); |
986 |
|
987 RSocketServ socketServer; |
|
988 PrepareRegTestLC(socketServer, 11); |
|
989 |
|
990 RSocket socket; |
795 RSocket socket; |
991 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
796 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
992 |
797 |
993 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
994 WaitForRecvL(socket); |
798 WaitForRecvL(socket); |
995 CSmsMessage* smsMessage = RecvSmsL(socket); |
799 CSmsMessage* smsMessage = RecvSmsL(socket); |
996 CleanupStack::PushL(smsMessage); |
800 CleanupStack::PushL(smsMessage); |
997 INFO_PRINTF1(_L("incoming SMS") ); |
|
998 |
801 |
999 const TUint16 KRingingTonePDUA[]= { |
802 const TUint16 KRingingTonePDUA[]= { |
1000 0x02, 0x4A, 0x3A, 0x75, 0x09, 0x85, 0x91, 0xA5, 0xB9, 0x95, |
803 0x02, 0x4A, 0x3A, 0x75, 0x09, 0x85, 0x91, 0xA5, 0xB9, 0x95, |
1001 0xC9, 0xA5, 0x95, 0x0D, 0xBD, 0xC1, 0xE4, 0x04, 0x01, 0xD5, |
804 0xC9, 0xA5, 0x95, 0x0D, 0xBD, 0xC1, 0xE4, 0x04, 0x01, 0xD5, |
1002 0x28, 0x61, 0x0A, 0x32, 0xC2, 0xCC, 0x22, 0x82, 0xCC, 0x22, |
805 0x28, 0x61, 0x0A, 0x32, 0xC2, 0xCC, 0x22, 0x82, 0xCC, 0x22, |
1031 0x18, 0xA2, 0x2D, 0x49, 0xB8, 0x1B, 0x61, 0x96, 0x19, 0x28 }; |
834 0x18, 0xA2, 0x2D, 0x49, 0xB8, 0x1B, 0x61, 0x96, 0x19, 0x28 }; |
1032 |
835 |
1033 TPtrC ringingTonePDUA(KRingingTonePDUA,sizeof(KRingingTonePDUA)/sizeof(TUint16)); |
836 TPtrC ringingTonePDUA(KRingingTonePDUA,sizeof(KRingingTonePDUA)/sizeof(TUint16)); |
1034 TestSmsContentsL(smsMessage,ringingTonePDUA); |
837 TestSmsContentsL(smsMessage,ringingTonePDUA); |
1035 |
838 |
1036 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
839 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
1037 CleanupStack::PopAndDestroy(&socketServer); |
840 return TestStepResult() ; |
1038 |
841 } |
1039 return TestStepResult() ; |
|
1040 } |
|
1041 |
|
1042 |
842 |
1043 TVerdict CTestTxRxConcatenated::doTestStepL() |
843 TVerdict CTestTxRxConcatenated::doTestStepL() |
1044 /** |
844 /** |
1045 * Test transmition and reception of a concatenated SMS message spanning 3 TPDUs |
845 * Test transmition and reception of a concatenated SMS message spanning 3 TPDUs |
1046 */ |
846 */ |
1047 |
|
1048 { |
847 { |
1049 INFO_PRINTF1(_L("Test Tx and Rx SMS with 3 PDU message")); |
848 INFO_PRINTF1(_L("Test Tx and Rx SMS with 3 PDU message")); |
1050 |
|
1051 RSocketServ socketServer; |
|
1052 PrepareRegTestLC(socketServer, 12); |
|
1053 |
|
1054 RSocket socket; |
849 RSocket socket; |
1055 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
850 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
1056 |
851 |
1057 _LIT(KLongText,"3 PDU test SMS message. " |
852 _LIT(KLongText,"3 PDU test SMS message. " |
1058 L"3 PDU test SMS message. " |
853 L"3 PDU test SMS message. " |
1059 L"3 PDU test SMS message. " |
854 L"3 PDU test SMS message. " |
1060 L"3 PDU test SMS message. " |
855 L"3 PDU test SMS message. " |
1061 L"3 PDU test SMS message. " |
856 L"3 PDU test SMS message. " |
1062 L"3 PDU test SMS message. " |
857 L"3 PDU test SMS message. " |
1063 L"3 PDU test SMS message. " |
858 L"3 PDU test SMS message. " |
1064 L"3 PDU test SMS message. " |
859 L"3 PDU test SMS message. " |
1065 L"3 PDU test SMS message. " |
860 L"3 PDU test SMS message. " |
1066 L"3 PDU test SMS message. " |
861 L"3 PDU test SMS message. " |
1067 L"3 PDU test SMS message. " |
862 L"3 PDU test SMS message. " |
1068 L"3 PDU test SMS message. " |
863 L"3 PDU test SMS message. " |
1069 L"3 PDU test SMS message. " |
864 L"3 PDU test SMS message. " |
1070 L"3 PDU test SMS message. " |
865 L"3 PDU test SMS message. " |
1071 L"3 PDU test SMS message. " |
866 L"3 PDU test SMS message. " |
1072 L"3 PDU test SMS message. " |
867 L"3 PDU test SMS message. " |
1073 L"3 PDU test SMS message. " |
868 L"3 PDU test SMS message. " |
1074 L"The End."); |
869 L"The End."); |
1075 |
870 |
1076 //Set destination and SC numbers |
871 //Set destination and SC numbers |
1077 iTelephoneNumber=KRegTestNumber; |
872 iTelephoneNumber=KRegTestNumber; |
1078 iServiceCenterNumber=KVodafoneSC; |
873 iServiceCenterNumber=KVodafoneSC; |
1079 |
874 |
1080 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit;//changed to 7 bits |
875 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1081 // CSmsMessage* smsMessage=CreateSmsMessageL(KLongText,alphabet); |
|
1082 CSmsMessage* smsMessage=CreateSmsWithStatusReportReqL(KLongText,alphabet); |
876 CSmsMessage* smsMessage=CreateSmsWithStatusReportReqL(KLongText,alphabet); |
1083 |
877 |
1084 CleanupStack::PushL(smsMessage); |
878 CleanupStack::PushL(smsMessage); |
1085 SendSmsL(smsMessage,socket); |
879 SendSmsL(smsMessage,socket); |
1086 CleanupStack::PopAndDestroy(smsMessage); |
880 CleanupStack::PopAndDestroy(smsMessage); |
1087 |
881 |
1088 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
1089 WaitForRecvL(socket); |
882 WaitForRecvL(socket); |
1090 smsMessage = RecvSmsL(socket); |
883 smsMessage = RecvSmsL(socket); |
1091 |
|
1092 INFO_PRINTF1(_L("incoming SMS")); |
|
1093 |
|
1094 CleanupStack::PushL(smsMessage); |
884 CleanupStack::PushL(smsMessage); |
885 |
|
1095 TestSmsContentsL(smsMessage,KLongText); |
886 TestSmsContentsL(smsMessage,KLongText); |
1096 CleanupStack::PopAndDestroy(smsMessage); |
887 CleanupStack::PopAndDestroy(smsMessage); |
1097 |
888 |
1098 TSmsServiceCenterAddress telephoneNumber; |
889 TSmsServiceCenterAddress telephoneNumber; |
1099 telephoneNumber.Copy( KRegTestNumber ); |
890 telephoneNumber.Copy( KRegTestNumber ); |
1100 RecvStatusReportL(telephoneNumber, socket); |
891 RecvStatusReportL(telephoneNumber, socket); |
1101 |
892 |
1102 // TX & RX 8 bit conc msg |
893 // TX & RX 8 bit conc msg |
1103 alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
894 alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
1104 smsMessage=CreateSmsMessageL(KLongText,alphabet); |
895 smsMessage=CreateSmsMessageLC(KLongText,alphabet); |
1105 |
896 |
1106 CleanupStack::PushL(smsMessage); |
|
1107 SendSmsL(smsMessage,socket); |
897 SendSmsL(smsMessage,socket); |
1108 CleanupStack::PopAndDestroy(smsMessage); |
898 CleanupStack::PopAndDestroy(smsMessage); |
1109 |
899 |
1110 INFO_PRINTF1(_L("waiting for incoming SMS...")); |
|
1111 WaitForRecvL(socket); |
900 WaitForRecvL(socket); |
1112 smsMessage = RecvSmsL(socket); |
901 smsMessage = RecvSmsL(socket); |
1113 |
|
1114 INFO_PRINTF1(_L("incoming SMS") ); |
|
1115 |
|
1116 CleanupStack::PushL(smsMessage); |
902 CleanupStack::PushL(smsMessage); |
903 |
|
1117 TestSmsContentsL(smsMessage,KLongText); |
904 TestSmsContentsL(smsMessage,KLongText); |
1118 CleanupStack::PopAndDestroy(smsMessage); |
905 CleanupStack::PopAndDestroy(smsMessage); |
1119 |
906 |
1120 // TX & RX 16 bit conc msg |
907 // TX & RX 16 bit conc msg |
1121 _LIT(KLongText2,"3 PDU test SMS message. " |
908 _LIT(KLongText2,"3 PDU test SMS message. " |
1122 L"3 PDU test SMS message. " |
909 L"3 PDU test SMS message. " |
1123 L"3 PDU test SMS message. " |
910 L"3 PDU test SMS message. " |
1124 L"3 PDU test SMS message. " |
911 L"3 PDU test SMS message. " |
1125 L"3 PDU test SMS message. " |
912 L"3 PDU test SMS message. " |
1126 L"The End."); |
913 L"The End."); |
1127 |
914 |
1128 alphabet=TSmsDataCodingScheme::ESmsAlphabetUCS2; |
915 alphabet=TSmsDataCodingScheme::ESmsAlphabetUCS2; |
1129 smsMessage=CreateSmsMessageL(KLongText2,alphabet); |
916 smsMessage=CreateSmsMessageLC(KLongText2,alphabet); |
1130 |
917 |
1131 CleanupStack::PushL(smsMessage); |
|
1132 SendSmsL(smsMessage,socket); |
918 SendSmsL(smsMessage,socket); |
1133 CleanupStack::PopAndDestroy(smsMessage); |
919 CleanupStack::PopAndDestroy(smsMessage); |
1134 |
920 |
1135 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
1136 WaitForRecvL(socket); |
921 WaitForRecvL(socket); |
1137 smsMessage = RecvSmsL(socket); |
922 smsMessage = RecvSmsL(socket); |
1138 |
|
1139 INFO_PRINTF1(_L("incoming SMS")); |
|
1140 |
|
1141 CleanupStack::PushL(smsMessage); |
923 CleanupStack::PushL(smsMessage); |
924 |
|
1142 TestSmsContentsL(smsMessage,KLongText2); |
925 TestSmsContentsL(smsMessage,KLongText2); |
1143 |
926 |
1144 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
927 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
1145 CleanupStack::PopAndDestroy(&socketServer); |
928 return TestStepResult(); |
1146 |
929 } |
1147 return TestStepResult(); |
|
1148 } |
|
1149 |
|
1150 |
930 |
1151 TVerdict CTestParamStorage::doTestStepL() |
931 TVerdict CTestParamStorage::doTestStepL() |
1152 /** |
932 /** |
1153 * Test retrieving and storing the sms parameters |
933 * Test retrieving and storing the sms parameters |
1154 */ |
934 */ |
1155 { |
935 { |
1156 INFO_PRINTF1(_L("Test the parameter storage")); |
936 INFO_PRINTF1(_L("Test the parameter storage")); |
1157 |
937 // Open the socket for SIM operations |
1158 RSocketServ socketServer; |
938 RSocket socket; |
1159 PrepareRegTestLC(socketServer, 13); |
939 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrLocalOperation); |
1160 |
940 |
1161 TInt ret(KErrNone); |
941 // |
1162 TRequestStatus status; |
942 // Retrieve SMS parameters |
1163 |
943 // |
1164 // |
|
1165 // Retrieve SMS parameters |
|
1166 // |
|
1167 // Open the socket for SIM operations |
|
1168 RSocket socket; |
|
1169 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation); |
|
1170 |
|
1171 RSmsSocketReadStream readstream(socket); |
|
1172 |
944 |
1173 //Create the smspList |
945 //Create the smspList |
1174 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
946 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
1175 CleanupStack::PushL(smspList); |
947 CleanupStack::PushL(smspList); |
1176 |
948 |
1177 INFO_PRINTF1(_L("waiting 2 secs for smsprot to load")); |
949 INFO_PRINTF1(_L("waiting 2 secs for smsprot to load")); |
1178 User::After(2000000); |
950 User::After(2000000); |
1179 |
951 |
1180 // Make read SMS params request to the SMS Stack. |
952 // Make read SMS params request to the SMS Stack. |
953 TRequestStatus status; |
|
954 |
|
1181 socket.Ioctl(KIoctlReadSmsParams,status,NULL, KSolSmsProv); |
955 socket.Ioctl(KIoctlReadSmsParams,status,NULL, KSolSmsProv); |
1182 INFO_PRINTF1(_L("waiting for SMS parameters...")); |
956 INFO_PRINTF1(_L("waiting for SMS parameters...")); |
1183 User::WaitForRequest(status); |
957 User::WaitForRequest(status); |
1184 TEST(status.Int() == KErrNone); |
958 TEST(status.Int() == KErrNone); |
1185 |
959 |
1186 // Read list from stream and make acknowledgement to the SMS Stack |
960 // Read list from stream and make acknowledgement to the SMS Stack |
961 RSmsSocketReadStream readstream(socket); |
|
962 |
|
1187 readstream >> *smspList; |
963 readstream >> *smspList; |
1188 socket.Ioctl(KIoctlCompleteReadSmsParams, status, NULL,KSolSmsProv); |
964 socket.Ioctl(KIoctlCompleteReadSmsParams, status, NULL,KSolSmsProv); |
1189 User::WaitForRequest(status); |
965 User::WaitForRequest(status); |
1190 TEST(status.Int() == KErrNone); |
966 TEST(status.Int() == KErrNone); |
1191 |
967 |
1192 CleanupStack::PopAndDestroy(smspList); |
968 CleanupStack::PopAndDestroy(smspList); |
1193 |
969 |
1194 // |
970 // |
1195 // Store SMS parameters |
971 // Store SMS parameters |
1196 // |
972 // |
1197 smspList=CMobilePhoneSmspList::NewL(); |
973 smspList=CMobilePhoneSmspList::NewL(); |
1198 CleanupStack::PushL(smspList); |
974 CleanupStack::PushL(smspList); |
1199 |
975 |
1200 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
976 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
1201 |
977 |
1212 entryToTsy.iDcs = DMMTSY_SMSP_STORE_DCS1; |
988 entryToTsy.iDcs = DMMTSY_SMSP_STORE_DCS1; |
1213 |
989 |
1214 // Add 6 entries to the list |
990 // Add 6 entries to the list |
1215 TInt i = 0; |
991 TInt i = 0; |
1216 |
992 |
1217 for(i=0; i<6; i++) |
993 for(i=0; i<6; ++i) |
1218 { |
994 { |
1219 entryToTsy.iIndex = i; |
995 entryToTsy.iIndex = i; |
1220 smspList->AddEntryL(entryToTsy); |
996 smspList->AddEntryL(entryToTsy); |
1221 } |
997 } |
1222 |
998 |
1223 INFO_PRINTF1(_L("storing the SMS parameters...")); |
999 INFO_PRINTF1(_L("storing the SMS parameters...")); |
1224 |
1000 |
1225 // Write parameter list to the stream and make write SMS parameters request to the SMS Stack. |
1001 // Write parameter list to the stream and make write SMS parameters request to the SMS Stack. |
1226 ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
1002 TInt ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
1227 TEST_CHECKL(ret,KErrArgument,_L("Status values doesn't match")); |
1003 TEST_CHECKL(ret,KErrArgument,_L("Status values doesn't match")); |
1228 |
1004 |
1229 // Writing failed because SIM tsy's SMS parameter store can contain only 5 SMSP sets. |
1005 // Writing failed because SIM tsy's SMS parameter store can contain only 5 SMSP sets. |
1230 |
1006 |
1231 // Delete one entry from SMSP list and try to write the list again. |
1007 // Delete one entry from SMSP list and try to write the list again. |
1232 smspList->DeleteEntryL(5); |
1008 smspList->DeleteEntryL(5); |
1233 |
1009 |
1234 ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
1010 ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
1235 TEST(ret == KErrNone); |
1011 TEST(ret == KErrNone); |
1236 |
1012 |
1237 // |
1013 // |
1238 // Retrieve SMS parameters again |
1014 // Retrieve SMS parameters again |
1239 // |
1015 // |
1240 CMobilePhoneSmspList* smspList2=CMobilePhoneSmspList::NewL(); |
1016 CMobilePhoneSmspList* smspList2=CMobilePhoneSmspList::NewL(); |
1241 CleanupStack::PushL(smspList2); |
1017 CleanupStack::PushL(smspList2); |
1242 |
1018 |
1243 // Test first canceling of Read SMS Parameters request |
1019 // Test first canceling of Read SMS Parameters request |
1244 socket.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
1020 socket.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
1245 socket.CancelIoctl(); |
1021 socket.CancelIoctl(); |
1246 User::WaitForRequest(status); |
1022 User::WaitForRequest(status); |
1247 |
1023 |
1248 // originl code was |
1024 // originl code was |
1249 // GLOBAL_CHECKPOINT_CODE(status.Int()); |
1025 // GLOBAL_CHECKPOINT_CODE(status.Int()); |
1250 // thus always assumes that the cancelling will be missed, |
1026 // thus always assumes that the cancelling will be missed, |
1251 // but with the change due defect (DEF40029) to smsppara.cpp, |
1027 // but with the change due defect (DEF40029) to smsppara.cpp, |
1252 // see CSmsReadParams::Start this however is not true. |
1028 // see CSmsReadParams::Start this however is not true. |
1253 TEST_CHECKL(status.Int(),KErrCancel,_L("Status values doesn't match")); |
1029 TEST_CHECKL(status.Int(),KErrCancel,_L("Status values doesn't match")); |
1268 ret = iSmsStackTestUtils->TestParameters(*smspList,*smspList2); |
1044 ret = iSmsStackTestUtils->TestParameters(*smspList,*smspList2); |
1269 TEST(ret == KErrNone); |
1045 TEST(ret == KErrNone); |
1270 |
1046 |
1271 CleanupStack::PopAndDestroy(2); //smspList,smspList2 |
1047 CleanupStack::PopAndDestroy(2); //smspList,smspList2 |
1272 |
1048 |
1273 // |
1049 // |
1274 // Store SMS parameters again |
1050 // Store SMS parameters again |
1275 // |
1051 // |
1276 smspList=CMobilePhoneSmspList::NewL(); |
1052 smspList=CMobilePhoneSmspList::NewL(); |
1277 CleanupStack::PushL(smspList); |
1053 CleanupStack::PushL(smspList); |
1278 |
1054 |
1279 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy2; |
1055 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy2; |
1280 |
1056 |
1305 |
1081 |
1306 // Make Write SMS Parameters request |
1082 // Make Write SMS Parameters request |
1307 ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
1083 ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
1308 TEST(ret == KErrNone); |
1084 TEST(ret == KErrNone); |
1309 |
1085 |
1310 CleanupStack::PopAndDestroy(2); // socket,smspList |
1086 CleanupStack::PopAndDestroy(2, &socket); // socket,smspList |
1311 CleanupStack::PopAndDestroy(&socketServer); |
1087 return TestStepResult(); |
1312 |
1088 } |
1313 return TestStepResult(); |
|
1314 } |
|
1315 |
|
1316 |
1089 |
1317 TVerdict CTestSmsStore::doTestStepL() |
1090 TVerdict CTestSmsStore::doTestStepL() |
1318 /** |
1091 /** |
1319 * Test Sms message storage |
1092 * Test Sms message storage |
1320 */ |
1093 */ |
1321 { |
1094 { |
1322 INFO_PRINTF1(_L("Test the SMS storage")); |
1095 INFO_PRINTF1(_L("Test the SMS storage")); |
1323 |
|
1324 RSocketServ socketServer; |
|
1325 PrepareRegTestLC(socketServer, 14); |
|
1326 |
|
1327 // Open the socket |
|
1328 RSocket socket; |
1096 RSocket socket; |
1329 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
1097 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
1330 |
1098 |
1331 // Enumerate messages |
1099 // Enumerate messages |
1332 RPointerArray<CSmsMessage> messages; |
1100 RPointerArray<CSmsMessage> messages; |
1333 CleanupResetAndDestroyPushL(messages); |
1101 CleanupResetAndDestroyPushL(messages); |
1334 ReadSmsStoreL(socket, messages); |
1102 ReadSmsStoreL(socket, messages); |
1335 // const TInt beforeCount = messages.Count(); |
|
1336 |
1103 |
1337 const CSmsMessage* message = messages[0]; |
1104 const CSmsMessage* message = messages[0]; |
1338 |
1105 |
1339 TInt ret = DeleteSmsL(*message, socket); |
1106 TInt ret = DeleteSmsL(*message, socket); |
1340 TEST(ret == KErrNone); |
1107 TEST(ret == KErrNone); |
1351 messages.ResetAndDestroy(); |
1118 messages.ResetAndDestroy(); |
1352 |
1119 |
1353 // Create and store the message |
1120 // Create and store the message |
1354 _LIT(KStoreMsg1,"SIM TEST MESSAGE 1"); |
1121 _LIT(KStoreMsg1,"SIM TEST MESSAGE 1"); |
1355 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1122 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1356 CSmsMessage* smsmessage=CreateSmsMessageL(KStoreMsg1,alphabet); |
1123 CSmsMessage* smsmessage=CreateSmsMessageLC(KStoreMsg1,alphabet); |
1357 CleanupStack::PushL(smsmessage); |
|
1358 |
1124 |
1359 smsmessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
1125 smsmessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
1360 WriteSmsToSimL(*smsmessage, socket); |
1126 WriteSmsToSimL(*smsmessage, socket); |
1361 CleanupStack::PopAndDestroy(smsmessage); |
1127 CleanupStack::PopAndDestroy(smsmessage); |
1362 |
1128 |
1363 // Create and store another message |
1129 // Create and store another message |
1364 _LIT(KStoreMsg2,"ME TEST MESSAGE 2"); |
1130 _LIT(KStoreMsg2,"ME TEST MESSAGE 2"); |
1365 alphabet=TSmsDataCodingScheme::ESmsAlphabetUCS2; |
1131 alphabet=TSmsDataCodingScheme::ESmsAlphabetUCS2; |
1366 smsmessage=CreateSmsMessageL(KStoreMsg2,alphabet); |
1132 smsmessage=CreateSmsMessageLC(KStoreMsg2,alphabet); |
1367 CleanupStack::PushL(smsmessage); |
|
1368 |
1133 |
1369 smsmessage->SetStorage(CSmsMessage::ESmsPhoneStorage); |
1134 smsmessage->SetStorage(CSmsMessage::ESmsPhoneStorage); |
1370 WriteSmsToSimL(*smsmessage, socket); |
1135 WriteSmsToSimL(*smsmessage, socket); |
1371 |
|
1372 CleanupStack::PopAndDestroy(smsmessage); |
1136 CleanupStack::PopAndDestroy(smsmessage); |
1373 |
1137 |
1374 // Enumerate messages |
1138 // Enumerate messages |
1375 ReadSmsStoreL(socket, messages); |
1139 ReadSmsStoreL(socket, messages); |
1376 |
1140 |
1377 //Check that count of messages matches to supposed count |
1141 //Check that count of messages matches to supposed count |
1378 TEST(messages.Count()==4); |
1142 TEST(messages.Count()==4); |
1379 |
1143 |
1380 CleanupStack::PopAndDestroy(&messages); |
1144 CleanupStack::PopAndDestroy(&messages); |
1381 CleanupStack::PopAndDestroy(&socket); |
1145 CleanupStack::PopAndDestroy(&socket); |
1382 CleanupStack::PopAndDestroy(&socketServer); |
1146 return TestStepResult() ; |
1383 |
1147 } |
1384 return TestStepResult() ; |
|
1385 } |
|
1386 |
|
1387 |
1148 |
1388 TVerdict CTestSmsStoreList::doTestStepL() |
1149 TVerdict CTestSmsStoreList::doTestStepL() |
1389 /** |
1150 /** |
1390 * Test Sms message storage |
1151 * Test Sms message storage |
1391 */ |
1152 */ |
1392 { |
1153 { |
1393 INFO_PRINTF1(_L("Test the SMS storage - read SmsList")); |
1154 INFO_PRINTF1(_L("Test the SMS storage - read SmsList")); |
1394 |
|
1395 RSocketServ socketServer; |
|
1396 PrepareRegTestLC(socketServer, 15); |
|
1397 |
|
1398 // Open the socket for SIM operations |
|
1399 RSocket socket; |
1155 RSocket socket; |
1400 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
1156 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
1401 |
1157 |
1402 // Enumerate messages |
1158 // Enumerate messages |
1403 RPointerArray<CSmsMessage> messages; |
1159 RPointerArray<CSmsMessage> messages; |
1404 CleanupResetAndDestroyPushL(messages); |
1160 CleanupResetAndDestroyPushL(messages); |
1405 ReadSmsStoreL(socket, messages); |
1161 ReadSmsStoreL(socket, messages); |
1406 // const TInt beforeCount = messages.Count(); |
|
1407 |
1162 |
1408 const CSmsMessage* message = messages[1]; |
1163 const CSmsMessage* message = messages[1]; |
1409 |
1164 |
1410 TInt ret = DeleteSmsL(*message, socket); |
1165 TInt ret = DeleteSmsL(*message, socket); |
1411 TEST(ret == KErrNone); |
1166 TEST(ret == KErrNone); |
1423 |
1178 |
1424 // Create and store the message |
1179 // Create and store the message |
1425 _LIT(KStoreMsg1,"SIM TEST MESSAGE 1"); |
1180 _LIT(KStoreMsg1,"SIM TEST MESSAGE 1"); |
1426 iTelephoneNumber=KOther; |
1181 iTelephoneNumber=KOther; |
1427 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1182 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1428 CSmsMessage* smsmessage=CreateSmsMessageL(KStoreMsg1,alphabet); |
1183 CSmsMessage* smsmessage=CreateSmsMessageLC(KStoreMsg1,alphabet); |
1429 smsmessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
1184 smsmessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
1430 smsmessage->SetStatus(NMobileSmsStore::EStoredMessageUnsent); |
1185 smsmessage->SetStatus(NMobileSmsStore::EStoredMessageUnsent); |
1431 |
|
1432 CleanupStack::PushL(smsmessage); |
|
1433 |
1186 |
1434 WriteSmsToSimL(*smsmessage, socket); |
1187 WriteSmsToSimL(*smsmessage, socket); |
1435 CleanupStack::PopAndDestroy(smsmessage); |
1188 CleanupStack::PopAndDestroy(smsmessage); |
1436 |
1189 |
1437 // Create and store another message |
1190 // Create and store another message |
1438 _LIT(KStoreMsg2,"COMB TEST MESSAGE 2"); |
1191 _LIT(KStoreMsg2,"COMB TEST MESSAGE 2"); |
1439 alphabet=TSmsDataCodingScheme::ESmsAlphabetUCS2; |
1192 alphabet=TSmsDataCodingScheme::ESmsAlphabetUCS2; |
1440 smsmessage=CreateSmsMessageL(KStoreMsg2,alphabet); |
1193 smsmessage=CreateSmsMessageLC(KStoreMsg2,alphabet); |
1441 smsmessage->SetStorage(CSmsMessage::ESmsCombinedStorage); |
1194 smsmessage->SetStorage(CSmsMessage::ESmsCombinedStorage); |
1442 smsmessage->SetStatus(NMobileSmsStore::EStoredMessageUnsent); |
1195 smsmessage->SetStatus(NMobileSmsStore::EStoredMessageUnsent); |
1443 |
|
1444 CleanupStack::PushL(smsmessage); |
|
1445 |
1196 |
1446 WriteSmsToSimL(*smsmessage, socket); |
1197 WriteSmsToSimL(*smsmessage, socket); |
1447 CleanupStack::PopAndDestroy(smsmessage); |
1198 CleanupStack::PopAndDestroy(smsmessage); |
1448 |
1199 |
1449 // Create and store third message |
1200 // Create and store third message |
1450 _LIT(KStoreMsg3,"ME TEST MESSAGE 3"); |
1201 _LIT(KStoreMsg3,"ME TEST MESSAGE 3"); |
1451 alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
1202 alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
1452 smsmessage=CreateSmsMessageL(KStoreMsg3,alphabet); |
1203 smsmessage=CreateSmsMessageLC(KStoreMsg3,alphabet); |
1453 smsmessage->SetStorage(CSmsMessage::ESmsPhoneStorage); |
1204 smsmessage->SetStorage(CSmsMessage::ESmsPhoneStorage); |
1454 smsmessage->SetStatus(NMobileSmsStore::EStoredMessageUnsent); |
1205 smsmessage->SetStatus(NMobileSmsStore::EStoredMessageUnsent); |
1455 |
1206 |
1456 CleanupStack::PushL(smsmessage); |
|
1457 |
|
1458 WriteSmsToSimL(*smsmessage, socket); |
1207 WriteSmsToSimL(*smsmessage, socket); |
1459 |
|
1460 |
|
1461 CleanupStack::PopAndDestroy(smsmessage); |
1208 CleanupStack::PopAndDestroy(smsmessage); |
1462 |
1209 |
1463 // Enumerate messages |
1210 // Enumerate messages |
1464 TEST(messages.Count() == 0); |
1211 TEST(messages.Count() == 0); |
1465 ReadSmsStoreL(socket, messages); |
1212 ReadSmsStoreL(socket, messages); |
1467 //Check that count of messages matches to supposed count |
1214 //Check that count of messages matches to supposed count |
1468 TEST(messages.Count()==6); |
1215 TEST(messages.Count()==6); |
1469 |
1216 |
1470 CleanupStack::PopAndDestroy(&messages); |
1217 CleanupStack::PopAndDestroy(&messages); |
1471 CleanupStack::PopAndDestroy(&socket); |
1218 CleanupStack::PopAndDestroy(&socket); |
1472 CleanupStack::PopAndDestroy(&socketServer); |
|
1473 |
|
1474 return TestStepResult() ; |
1219 return TestStepResult() ; |
1475 } |
1220 } |
1476 |
1221 |
1477 |
|
1478 TVerdict CTestDeleteSms::doTestStepL() |
1222 TVerdict CTestDeleteSms::doTestStepL() |
1479 /** |
1223 /** |
1480 * Try to delete message without enumerating the store before it. |
1224 * Try to delete message without enumerating the store before it. |
1481 */ |
1225 */ |
1482 { |
1226 { |
1483 INFO_PRINTF1(_L("Test deleting message from SMS storage")); |
1227 INFO_PRINTF1(_L("Test deleting message from SMS storage")); |
1484 |
|
1485 RSocketServ socketServer; |
|
1486 PrepareRegTestLC(socketServer, 15); //script number can be this! |
|
1487 |
|
1488 // Open the socket |
|
1489 RSocket socket; |
1228 RSocket socket; |
1490 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
1229 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
1491 |
1230 |
1492 _LIT(KStoreMsg1,"HELLO CHRIS"); |
1231 _LIT(KStoreMsg1,"HELLO CHRIS"); |
1493 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1232 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1494 CSmsMessage* smsmessage=CreateSmsMessageL(KStoreMsg1,alphabet); |
1233 CSmsMessage* smsmessage=CreateSmsMessageLC(KStoreMsg1,alphabet); |
1495 CleanupStack::PushL(smsmessage); |
|
1496 |
1234 |
1497 //Try to delete the message without enumerating first! |
1235 //Try to delete the message without enumerating first! |
1498 TRequestStatus status; |
1236 TRequestStatus status; |
1499 |
1237 |
1500 RSmsSocketWriteStream writestream(socket); |
1238 RSmsSocketWriteStream writestream(socket); |
1501 writestream << *smsmessage; |
1239 writestream << *smsmessage; |
1502 writestream.CommitL(); |
1240 writestream.CommitL(); |
1503 |
1241 |
1504 socket.Ioctl(KIoctlDeleteSmsMessage, status, NULL, KSolSmsProv); |
1242 TBool tryAgain = ETrue; |
1505 User::WaitForRequest(status); |
1243 TInt attempts (0); |
1506 |
1244 TInt maxRetries = 3; |
1507 INFO_PRINTF2(_L("Delete Sms - returned %d"), status.Int()); |
1245 |
1246 // Delete messages from store. If it fails with KErrNotReady wait for 3 seconds to |
|
1247 // allow sms protocol to fully load and repeat |
|
1248 while( tryAgain && attempts++ < maxRetries ) |
|
1249 { |
|
1250 socket.Ioctl(KIoctlDeleteSmsMessage, status, NULL, KSolSmsProv); |
|
1251 User::WaitForRequest(status); |
|
1252 INFO_PRINTF2(_L("Delete messages from store returned [status=%d]"), status.Int()); |
|
1253 |
|
1254 if ( status.Int() == KErrNotReady ) |
|
1255 { |
|
1256 INFO_PRINTF1(_L("Trying to delete again... ")); |
|
1257 User::After(3000000); |
|
1258 } |
|
1259 else |
|
1260 { |
|
1261 tryAgain = EFalse; |
|
1262 } |
|
1263 } |
|
1508 |
1264 |
1509 TEST(status.Int() == KErrArgument); |
1265 TEST(status.Int() == KErrArgument); |
1510 |
1266 |
1511 CleanupStack::PopAndDestroy(2); //socket, smsmessage |
1267 CleanupStack::PopAndDestroy(2, &socket); //socket, smsmessage |
1512 CleanupStack::PopAndDestroy(&socketServer); |
1268 return TestStepResult() ; |
1513 |
1269 } |
1514 return TestStepResult() ; |
1270 |
1515 } |
1271 /** |
1516 |
1272 * Tests the TSmsAddr class |
1273 * |
|
1274 * @return A TVerdict test result. |
|
1275 */ |
|
1276 TVerdict CTestSmsAddr::doTestStepL() |
|
1277 { |
|
1278 TSmsAddr addr1; |
|
1279 |
|
1280 INFO_PRINTF1(_L("Test default values ...")); |
|
1281 |
|
1282 TEST(addr1.SmsAddrFamily() == ESmsAddrUnbound); |
|
1283 |
|
1284 INFO_PRINTF1(_L("Test address family set/get and dual-SIM aware flag ...")); |
|
1285 |
|
1286 addr1.SetSmsAddrFamily(ESmsAddrLocalOperation); |
|
1287 TEST(addr1.SmsAddrFamily() == ESmsAddrLocalOperation); |
|
1288 |
|
1289 |
|
1290 addr1.SetSmsAddrFamily(ESmsAddrEmail); |
|
1291 TEST(addr1.SmsAddrFamily() == ESmsAddrEmail); |
|
1292 |
|
1293 INFO_PRINTF1(_L("Test identifier match set/get ...")); |
|
1294 |
|
1295 addr1.SetSmsAddrFamily(ESmsAddrMatchIEI); |
|
1296 addr1.SetIdentifierMatch(CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit); |
|
1297 TEST(addr1.IdentifierMatch() == CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit); |
|
1298 |
|
1299 INFO_PRINTF1(_L("Test text match set/get ...")); |
|
1300 |
|
1301 addr1.SetSmsAddrFamily(ESmsAddrMatchText); |
|
1302 addr1.SetTextMatch(_L8("test message, len")); |
|
1303 TEST(addr1.TextMatch().CompareF(_L8("test message, len")) == 0); |
|
1304 |
|
1305 addr1.SetTextMatch(_L8("test message this is max:extra")); |
|
1306 TEST(addr1.TextMatch().CompareF(_L8("test message this is max")) == 0); |
|
1307 |
|
1308 INFO_PRINTF1(_L("Test compare ...")); |
|
1309 |
|
1310 TSmsAddr addr2; |
|
1311 addr2.SetSmsAddrFamily(ESmsAddrMatchText); |
|
1312 addr2.SetTextMatch(_L8("test message, len")); |
|
1313 |
|
1314 TSmsAddr addr3; |
|
1315 addr3.SetSmsAddrFamily(ESmsAddrMatchText); |
|
1316 addr3.SetTextMatch(_L8("test message, len")); |
|
1317 |
|
1318 TEST((addr2 == addr3)); |
|
1319 |
|
1320 addr3.SetTextMatch(_L8("diff test message")); |
|
1321 TEST(!(addr2 == addr3)); |
|
1322 |
|
1323 addr2.SetSmsAddrFamily(ESmsAddrMatchIEI); |
|
1324 addr2.SetIdentifierMatch(CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit); |
|
1325 |
|
1326 TEST(!(addr2 == addr3)); |
|
1327 |
|
1328 addr3.SetSmsAddrFamily(ESmsAddrMatchIEI); |
|
1329 addr3.SetIdentifierMatch(CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit); |
|
1330 |
|
1331 TEST((addr2 == addr3)); |
|
1332 |
|
1333 addr2.SetIdentifierMatch(CSmsInformationElement::ESmsIEIApplicationPortAddressing16Bit); |
|
1334 TEST(!(addr2 == addr3)); |
|
1335 |
|
1336 return TestStepResult(); |
|
1337 } |
|
1517 |
1338 |
1518 TVerdict CTestSocketBinding::doTestStepL() |
1339 TVerdict CTestSocketBinding::doTestStepL() |
1519 /** |
1340 /** |
1520 * Test opening and binding the socket to different SMS Address types |
1341 * Test opening and binding the socket to different SMS Address types |
1521 */ |
1342 */ |
1522 { |
1343 { |
1523 INFO_PRINTF1(_L("Test Open & Bind the Socket")); |
1344 INFO_PRINTF1(_L("Test Open & Bind the Socket")); |
1524 |
|
1525 RSocketServ socketServer; |
|
1526 PrepareRegTestLC(socketServer, 16); |
|
1527 |
|
1528 RSocket socket1; |
1345 RSocket socket1; |
1529 RSocket socket2; |
1346 RSocket socket2; |
1530 |
1347 |
1531 TInt ret1=socket1.Open(socketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol); |
1348 TInt ret1=socket1.Open(iSocketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol); |
1532 TEST(ret1 == KErrNone); |
1349 TEST(ret1 == KErrNone); |
1533 CleanupClosePushL(socket1); |
1350 CleanupClosePushL(socket1); |
1534 TSmsAddr smsaddr1; |
1351 TSmsAddr smsaddr1; |
1535 |
1352 |
1536 TInt ret2=socket2.Open(socketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol); |
1353 TInt ret2=socket2.Open(iSocketServer,KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol); |
1537 TEST(ret2 == KErrNone); |
1354 TEST(ret2 == KErrNone); |
1538 CleanupClosePushL(socket2); |
1355 CleanupClosePushL(socket2); |
1539 TSmsAddr smsaddr2; |
1356 TSmsAddr smsaddr2; |
1540 |
1357 |
1541 //ESmsAddrUnbound |
1358 //ESmsAddrUnbound |
1619 ret2=socket2.Bind(smsaddr2); |
1436 ret2=socket2.Bind(smsaddr2); |
1620 TEST(ret2 == KErrNone); |
1437 TEST(ret2 == KErrNone); |
1621 |
1438 |
1622 CleanupStack::Pop(&socket2); |
1439 CleanupStack::Pop(&socket2); |
1623 CleanupStack::Pop(&socket1); |
1440 CleanupStack::Pop(&socket1); |
1624 CleanupStack::PopAndDestroy(&socketServer); |
1441 INFO_PRINTF1(_L("All bindings ok!")); |
1625 |
|
1626 INFO_PRINTF1(_L("All bindings ok!")); |
|
1627 return TestStepResult() ; |
1442 return TestStepResult() ; |
1628 } |
1443 } |
1629 |
1444 |
1630 |
|
1631 TVerdict CTestSmsEventLogger::doTestStepL() |
1445 TVerdict CTestSmsEventLogger::doTestStepL() |
1632 /** |
1446 /** |
1633 * Test SMS event logger |
1447 * Test SMS event logger |
1634 */ |
1448 */ |
1635 { |
1449 { |
1636 INFO_PRINTF1(_L("Test SMS event logger")); |
1450 INFO_PRINTF1(_L("Test SMS event logger")); |
1637 |
|
1638 RSocketServ socketServer; |
|
1639 PrepareRegTestLC(socketServer, 17); |
|
1640 |
|
1641 RSocket socket; |
1451 RSocket socket; |
1642 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
1452 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
1643 |
1453 |
1644 CLogEvent* logEvent=CLogEvent::NewL(); |
1454 CLogEvent* logEvent=CLogEvent::NewL(); |
1645 CleanupStack::PushL(logEvent); |
1455 CleanupStack::PushL(logEvent); |
1646 |
1456 |
1647 // |
1457 // |
1648 // Test logging of sending and receiving events |
1458 // Test logging of sending and receiving events |
1649 // |
1459 // |
1460 |
|
1650 //Set destination and SC numbers |
1461 //Set destination and SC numbers |
1651 iTelephoneNumber=KPekka; |
1462 iTelephoneNumber=KPekka; |
1652 iServiceCenterNumber=KRadiolinjaSC; |
1463 iServiceCenterNumber=KRadiolinjaSC; |
1653 |
1464 |
1654 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
1465 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
1655 |
1466 |
1656 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1467 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
1657 CSmsMessage* sendSmsMessage=CreateSmsMessageL(KTest7bitMsg,alphabet); |
1468 CSmsMessage* sendSmsMessage=CreateSmsMessageLC(KTest7bitMsg,alphabet); |
1658 CleanupStack::PushL(sendSmsMessage); |
|
1659 |
1469 |
1660 //Send SMS-SUBMIT |
1470 //Send SMS-SUBMIT |
1661 SendSmsL(sendSmsMessage,socket); |
1471 SendSmsL(sendSmsMessage,socket); |
1662 |
1472 |
1663 //Receive SMS-DELIVER |
1473 //Receive SMS-DELIVER |
1767 (dateTime.Hour() != 13) || |
1577 (dateTime.Hour() != 13) || |
1768 (dateTime.Minute() != 38) || |
1578 (dateTime.Minute() != 38) || |
1769 (dateTime.Second() != 18) ) |
1579 (dateTime.Second() != 18) ) |
1770 TEST(KErrArgument); |
1580 TEST(KErrArgument); |
1771 |
1581 |
1772 // |
1582 // |
1773 // Test logging when senging fails. |
1583 // Test logging when senging fails. |
1774 // |
1584 // |
1775 |
1585 |
1776 //Send SMS-SUBMIT |
1586 //Send SMS-SUBMIT |
1777 SendSmsErrorL(sendSmsMessage,socket); |
1587 SendSmsErrorL(sendSmsMessage,socket); |
1778 |
1588 |
1779 //TSY returned KErrGsmSMSNetworkFailure error to the send request. |
1589 //TSY returned KErrGsmSMSNetworkFailure error to the send request. |
1789 (logEvent->Number() != sendSmsMessage->ToFromAddress())) |
1599 (logEvent->Number() != sendSmsMessage->ToFromAddress())) |
1790 TEST(KErrArgument); |
1600 TEST(KErrArgument); |
1791 |
1601 |
1792 CleanupStack::PopAndDestroy(2); //sendSmsMessage, receiveSmsMessage |
1602 CleanupStack::PopAndDestroy(2); //sendSmsMessage, receiveSmsMessage |
1793 |
1603 |
1794 // |
1604 // |
1795 // Test event logging when an intermittent concatenated message status report received. |
1605 // Test event logging when an intermittent concatenated message status report received. |
1796 // |
1606 // |
1797 _LIT(KLongText,"3 PDU test SMS message. " |
1607 _LIT(KLongText,"3 PDU test SMS message. " |
1798 L"3 PDU test SMS message. " |
1608 L"3 PDU test SMS message. " |
1799 L"3 PDU test SMS message. " |
1609 L"3 PDU test SMS message. " |
1800 L"3 PDU test SMS message. " |
1610 L"3 PDU test SMS message. " |
1801 L"3 PDU test SMS message. " |
1611 L"3 PDU test SMS message. " |
1802 L"3 PDU test SMS message. " |
1612 L"3 PDU test SMS message. " |
1803 L"3 PDU test SMS message. " |
1613 L"3 PDU test SMS message. " |
1804 L"3 PDU test SMS message. " |
1614 L"3 PDU test SMS message. " |
1805 L"3 PDU test SMS message. " |
1615 L"3 PDU test SMS message. " |
1806 L"3 PDU test SMS message. " |
1616 L"3 PDU test SMS message. " |
1807 L"3 PDU test SMS message. " |
1617 L"3 PDU test SMS message. " |
1808 L"3 PDU test SMS message. " |
1618 L"3 PDU test SMS message. " |
1809 L"3 PDU test SMS message. " |
1619 L"3 PDU test SMS message. " |
1810 L"3 PDU test SMS message. " |
1620 L"3 PDU test SMS message. " |
1811 L"3 PDU test SMS message. " |
1621 L"3 PDU test SMS message. " |
1812 L"3 PDU test SMS message. " |
1622 L"3 PDU test SMS message. " |
1813 L"3 PDU test SMS message. " |
1623 L"3 PDU test SMS message. " |
1814 L"The End."); |
1624 L"The End."); |
1815 |
1625 |
1816 //Set destination and SC numbers |
1626 //Set destination and SC numbers |
1817 iTelephoneNumber=KRegTestNumber; |
1627 iTelephoneNumber=KRegTestNumber; |
1818 iServiceCenterNumber=KVodafoneSC; |
1628 iServiceCenterNumber=KVodafoneSC; |
1819 |
1629 |
1863 (dateTime.Hour() != 13) || |
1673 (dateTime.Hour() != 13) || |
1864 (dateTime.Minute() != 38) || |
1674 (dateTime.Minute() != 38) || |
1865 (dateTime.Second() != 18) ) |
1675 (dateTime.Second() != 18) ) |
1866 TEST(KErrArgument); |
1676 TEST(KErrArgument); |
1867 |
1677 |
1868 CleanupStack::PopAndDestroy(4); // sendSmsMessage, receiveSmsMessage, logEvent, socket |
1678 CleanupStack::PopAndDestroy(4, &socket); // sendSmsMessage, receiveSmsMessage, logEvent, socket |
1869 CleanupStack::PopAndDestroy(&socketServer); |
1679 return TestStepResult() ; |
1870 |
|
1871 return TestStepResult() ; |
|
1872 } |
1680 } |
1873 |
1681 |
1874 |
1682 |
1875 TVerdict CTestBearerChange::doTestStepL() |
1683 TVerdict CTestBearerChange::doTestStepL() |
1876 /** |
1684 /** |
1877 * @test Test changing the GPRS bearer while sending and receiving concatenated messages |
1685 * @test Test changing the GPRS bearer while sending and receiving concatenated messages |
1878 * The idea is to change bearer midway through sending the PDUs making up the complete |
1686 * The idea is to change bearer midway through sending the PDUs making up the complete |
1879 * message. Buffer size of 500 => 4 PDU message |
1687 * message. Buffer size of 500 => 4 PDU message |
1880 */ |
1688 */ |
1881 { |
1689 { |
1690 RSocket socket; |
|
1691 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
|
1692 |
|
1882 INFO_PRINTF1(_L("Testing tx & rx while changing the SMS Bearer")); |
1693 INFO_PRINTF1(_L("Testing tx & rx while changing the SMS Bearer")); |
1883 |
|
1884 RSocketServ socketServer; |
|
1885 PrepareRegTestLC(socketServer, 18); |
|
1886 |
|
1887 |
|
1888 iTelephoneNumber=KPekka; |
1694 iTelephoneNumber=KPekka; |
1889 iServiceCenterNumber=KRadiolinjaSC; //maybe not needed... |
1695 iServiceCenterNumber=KRadiolinjaSC; //maybe not needed... |
1890 |
1696 |
1891 // Create message |
1697 // Create message |
1892 const TInt KTestMessageBufferSize=500; |
1698 const TInt KTestMessageBufferSize=500; |
1893 HBufC* messageBuffer=HBufC::New(KTestMessageBufferSize); |
1699 HBufC* messageBuffer=HBufC::New(KTestMessageBufferSize); |
1894 CleanupStack::PushL(messageBuffer); |
1700 CleanupStack::PushL(messageBuffer); |
1895 TPtr bufferPtr=messageBuffer->Des(); |
1701 TPtr bufferPtr=messageBuffer->Des(); |
1896 FillDes(bufferPtr,KTestMessageBufferSize); |
1702 FillDes(bufferPtr,KTestMessageBufferSize); |
1897 CSmsMessage* smsMessage=CreateSmsMessageL(bufferPtr, |
1703 CSmsMessage* smsMessage=CreateSmsMessageLC(bufferPtr, TSmsDataCodingScheme::ESmsAlphabet7Bit); |
1898 TSmsDataCodingScheme::ESmsAlphabet7Bit); |
|
1899 CleanupStack::PushL(smsMessage); |
|
1900 CSmsMessage* rxSmsMessage=NULL; |
|
1901 |
|
1902 // Open socket |
|
1903 RSocket socket; |
|
1904 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
|
1905 |
|
1906 RMobileSmsMessaging::TMobileSmsBearer smsBearer; |
|
1907 |
1704 |
1908 INFO_PRINTF1(_L("Testing bearer change to GPRS only setting")); |
1705 INFO_PRINTF1(_L("Testing bearer change to GPRS only setting")); |
1909 |
1706 |
1910 // Send message & change bearer |
1707 // Send message & change bearer |
1911 smsBearer=RMobileSmsMessaging::ESmsBearerPacketOnly; |
1708 RMobileSmsMessaging::TMobileSmsBearer smsBearer = RMobileSmsMessaging::ESmsBearerPacketOnly; |
1912 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage,socket, smsBearer); |
1709 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage, socket, smsBearer); |
1710 |
|
1711 // Receive message |
|
1712 CSmsMessage* rxSmsMessage = RecvSmsL(socket); |
|
1713 CleanupStack::PushL(rxSmsMessage); |
|
1714 TestSmsContentsL(rxSmsMessage,bufferPtr); |
|
1715 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
|
1716 |
|
1717 INFO_PRINTF1(_L("Testing bearer change to CSD only setting")); |
|
1718 |
|
1719 // Send message & change bearer |
|
1720 smsBearer = RMobileSmsMessaging::ESmsBearerCircuitOnly; |
|
1721 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage, socket, smsBearer); |
|
1913 |
1722 |
1914 // Receive message |
1723 // Receive message |
1915 rxSmsMessage=RecvSmsL(socket); |
1724 rxSmsMessage=RecvSmsL(socket); |
1916 CleanupStack::PushL(rxSmsMessage); |
1725 CleanupStack::PushL(rxSmsMessage); |
1917 TestSmsContentsL(rxSmsMessage,bufferPtr); |
1726 TestSmsContentsL(rxSmsMessage,bufferPtr); |
1918 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
1727 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
1919 |
1728 |
1920 INFO_PRINTF1(_L("Testing bearer change to CSD only setting")); |
1729 INFO_PRINTF1(_L("Testing bearer change to GPRS preferred setting")); |
1921 |
1730 |
1922 // Send message & change bearer |
1731 // Send message & change bearer |
1923 smsBearer=RMobileSmsMessaging::ESmsBearerCircuitOnly; |
1732 smsBearer=RMobileSmsMessaging::ESmsBearerPacketPreferred; |
1924 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage,socket, smsBearer); |
1733 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage, socket, smsBearer); |
1925 |
1734 |
1926 // Receive message |
1735 // Receive message |
1927 rxSmsMessage=RecvSmsL(socket); |
1736 rxSmsMessage=RecvSmsL(socket); |
1928 CleanupStack::PushL(rxSmsMessage); |
1737 CleanupStack::PushL(rxSmsMessage); |
1929 TestSmsContentsL(rxSmsMessage,bufferPtr); |
1738 TestSmsContentsL(rxSmsMessage,bufferPtr); |
1930 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
1739 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
1931 |
1740 |
1932 INFO_PRINTF1(_L("Testing bearer change to GPRS preferred setting")); |
1741 INFO_PRINTF1(_L("Testing bearer change to CSD preferred setting")); |
1933 |
1742 |
1934 // Send message & change bearer |
1743 // Send message & change bearer |
1935 smsBearer=RMobileSmsMessaging::ESmsBearerPacketPreferred; |
1744 smsBearer=RMobileSmsMessaging::ESmsBearerCircuitPreferred; |
1936 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage,socket, smsBearer); |
1745 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage,socket, smsBearer); |
1937 |
1746 |
1938 // Receive message |
1747 // Receive message |
1939 rxSmsMessage=RecvSmsL(socket); |
1748 rxSmsMessage=RecvSmsL(socket); |
1940 CleanupStack::PushL(rxSmsMessage); |
1749 CleanupStack::PushL(rxSmsMessage); |
1941 TestSmsContentsL(rxSmsMessage,bufferPtr); |
1750 TestSmsContentsL(rxSmsMessage,bufferPtr); |
1942 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
1751 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
1943 |
1752 |
1944 INFO_PRINTF1(_L("Testing bearer change to CSD preferred setting")); |
1753 CleanupStack::PopAndDestroy(3, &socket); // messageBuffer, smsMessage, CleanupCloseItem |
1945 |
1754 return TestStepResult() ; |
1946 // Send message & change bearer |
|
1947 smsBearer=RMobileSmsMessaging::ESmsBearerCircuitPreferred; |
|
1948 iSmsStackTestUtils->SendSmsAndChangeBearerL(smsMessage,socket, smsBearer); |
|
1949 |
|
1950 // Receive message |
|
1951 rxSmsMessage=RecvSmsL(socket); |
|
1952 CleanupStack::PushL(rxSmsMessage); |
|
1953 TestSmsContentsL(rxSmsMessage,bufferPtr); |
|
1954 CleanupStack::PopAndDestroy(rxSmsMessage); // rxSmsMessage |
|
1955 |
|
1956 CleanupStack::PopAndDestroy(3); // messageBuffer, smsMessage, CleanupCloseItem |
|
1957 CleanupStack::PopAndDestroy(&socketServer); |
|
1958 |
|
1959 return TestStepResult() ; |
|
1960 } |
1755 } |
1961 |
1756 |
1962 |
1757 |
1963 TVerdict CTestRestoreBearer::doTestStepL() |
1758 TVerdict CTestRestoreBearer::doTestStepL() |
1964 /** |
1759 /** |
1965 @test Test attempt to set the bearer which returns an error reverts |
1760 @test Test attempt to set the bearer which returns an error reverts |
1966 the bearer back to the previous setting. |
1761 the bearer back to the previous setting. |
1967 */ |
1762 */ |
1968 { |
1763 { |
1969 // Set the initial bearer value in CommDB |
1764 // Get the initial bearer value from CommDB |
1970 RMobileSmsMessaging::TMobileSmsBearer newBearer; |
1765 RMobileSmsMessaging::TMobileSmsBearer retrievedBearer; |
1971 newBearer = RMobileSmsMessaging::ESmsBearerCircuitPreferred; |
1766 RMobileSmsMessaging::TMobileSmsBearer bearer; |
1972 iSmsStackTestUtils->ChangeBearerL(newBearer); |
1767 iSmsStackTestUtils->GetBearerL(retrievedBearer); |
1973 |
1768 |
1974 // Starts the smsstack |
|
1975 RSocketServ socketServer; |
|
1976 INFO_PRINTF1(_L("Connecting to SocketServer ...")); |
|
1977 TInt ret = socketServer.Connect(KSocketMessageSlots); |
|
1978 CleanupClosePushL(socketServer); |
|
1979 |
|
1980 // Open socket |
|
1981 RSocket socket; |
1769 RSocket socket; |
1982 iSmsStackTestUtils->OpenSmsSocketL(socketServer,socket,ESmsAddrRecvAny); |
1770 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
1983 |
1771 |
1984 // Attempt to change the bearer |
1772 // Attempt to change the bearer |
1985 newBearer = RMobileSmsMessaging::ESmsBearerPacketPreferred; |
1773 if (retrievedBearer == RMobileSmsMessaging::ESmsBearerPacketPreferred ) |
1986 iSmsStackTestUtils->ChangeBearerL(newBearer); |
1774 { |
1987 INFO_PRINTF2(_L("Changing bearer in CommDB global settings to %d"), newBearer); |
1775 bearer = RMobileSmsMessaging::ESmsBearerCircuitPreferred; |
1776 } |
|
1777 else |
|
1778 { |
|
1779 bearer = RMobileSmsMessaging::ESmsBearerPacketPreferred; |
|
1780 } |
|
1781 INFO_PRINTF2(_L("Changing bearer in CommDB global settings to %d"), bearer); |
|
1782 iSmsStackTestUtils->ChangeBearerL(bearer); |
|
1988 |
1783 |
1989 // Wait 2 seconds for CSmspSetBearer to complete and revert the bearer |
1784 // Wait 5 seconds for CSmspSetBearer to complete and revert the bearer |
1990 User::After(2000000); |
1785 const TInt delay = 5; |
1786 User::After(delay*1000000); |
|
1991 |
1787 |
1992 // With simtsy, setting the bearer to any value is not |
1788 // With simtsy, setting the bearer to any value is not |
1993 // supported, therefore the smsstack should revert |
1789 // supported, therefore the smsstack should revert |
1994 // back to the previous bearer setting. |
1790 // back to the previous bearer setting. |
1995 INFO_PRINTF1(_L("Bearer should be reverted back to previous supported setting.")); |
1791 INFO_PRINTF2(_L("Bearer should be reverted back to previous supported setting after wait for %d seconds"), delay); |
1996 INFO_PRINTF1(_L("The initial supported setting is obtained from CommDB.")); |
1792 INFO_PRINTF1(_L("The initial supported setting is obtained from CommDB.")); |
1997 RMobileSmsMessaging::TMobileSmsBearer retrievedBearer; |
1793 iSmsStackTestUtils->GetBearerL(bearer); |
1998 iSmsStackTestUtils->GetBearerL(retrievedBearer); |
|
1999 |
1794 |
2000 TEST(retrievedBearer == RMobileSmsMessaging::ESmsBearerCircuitPreferred); |
1795 TESTCHECK(retrievedBearer, bearer, "Checking if the Bearer was reverted back to previous supported setting"); |
2001 |
1796 |
2002 CleanupStack::PopAndDestroy(); //socketServer |
1797 CleanupStack::PopAndDestroy(&socket); |
2003 return TestStepResult(); |
1798 return TestStepResult(); |
2004 } |
1799 } |
2005 |
|
2006 |
1800 |
2007 TVerdict CTestRecvModeChange::doTestStepL() |
1801 TVerdict CTestRecvModeChange::doTestStepL() |
2008 /** |
1802 /** |
2009 * @test Test changing the recv mode while sending and receiving concatenated messages |
1803 * @test Test changing the recv mode while sending and receiving concatenated messages |
2010 * |
1804 * |
2011 */ |
1805 */ |
2012 { |
1806 { |
2013 INFO_PRINTF1(_L("Testing tx & rx while changing the SMS Receive mode")); |
1807 INFO_PRINTF1(_L("Testing tx & rx while changing the SMS Receive mode")); |
2014 |
1808 RSocket socket; |
2015 RSocketServ socketServer; |
1809 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2016 PrepareRegTestLC(socketServer, 19); |
1810 |
2017 |
|
2018 |
|
2019 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
1811 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2020 |
1812 |
2021 //Set destination and SC numbers |
1813 //Set destination and SC numbers |
2022 iTelephoneNumber=KPekka; |
1814 iTelephoneNumber=KPekka; |
2023 iServiceCenterNumber=KRadiolinjaSC; //maybe not needed... |
1815 iServiceCenterNumber=KRadiolinjaSC; //maybe not needed... |
2026 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
1818 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
2027 |
1819 |
2028 CleanupStack::PushL(smsMessage); |
1820 CleanupStack::PushL(smsMessage); |
2029 CSmsMessage* rxSmsMessage=NULL; |
1821 CSmsMessage* rxSmsMessage=NULL; |
2030 |
1822 |
2031 // Open socket |
|
2032 RSocket socket; |
|
2033 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
|
2034 |
|
2035 // Create comms database object |
1823 // Create comms database object |
2036 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
1824 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
2037 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
1825 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
2038 #else |
1826 #else |
2039 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
1827 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
2040 #endif |
1828 #endif |
2041 CleanupStack::PushL(db); |
1829 CleanupStack::PushL(db); |
2042 INFO_PRINTF1(_L("Testing recvMode change to EReceiveModeUnspecified")); |
1830 INFO_PRINTF1(_L("Testing recvMode change to EReceiveModeUnspecified")); |
2043 |
1831 |
2044 // Send message & wait a sec(!) |
1832 // Send message & wait a sec(!) |
2045 SendSmsL(smsMessage,socket); |
1833 SendSmsL(smsMessage,socket); |
2046 |
1834 |
2047 // EReceiveModeUnspecified |
1835 // EReceiveModeUnspecified |
2048 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
1836 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
2049 CleanupStack::PushL(smsReceiveModeField); |
1837 CleanupStack::PushL(smsReceiveModeField); |
2050 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
1838 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
2051 *smsReceiveModeField = RMobileSmsMessaging::EReceiveModeUnspecified; |
1839 *smsReceiveModeField = RMobileSmsMessaging::EReceiveModeUnspecified; |
2052 smsReceiveModeField->ModifyL(*db); |
1840 smsReceiveModeField->ModifyL(*db); |
2053 |
1841 |
2054 // Receive message |
1842 // Receive message |
2055 rxSmsMessage=RecvSmsL(socket); |
1843 rxSmsMessage=RecvSmsL(socket); |
2056 CleanupStack::PushL(rxSmsMessage); |
1844 CleanupStack::PushL(rxSmsMessage); |
2057 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
1845 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
2061 |
1849 |
2062 // Send message & wait a sec(!) |
1850 // Send message & wait a sec(!) |
2063 SendSmsL(smsMessage,socket); |
1851 SendSmsL(smsMessage,socket); |
2064 |
1852 |
2065 // UnstoredPhoneAck |
1853 // UnstoredPhoneAck |
2066 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredPhoneAck; |
1854 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredPhoneAck; |
2067 smsReceiveModeField->ModifyL(*db); |
1855 smsReceiveModeField->ModifyL(*db); |
2068 |
1856 |
2069 // Receive message |
1857 // Receive message |
2070 rxSmsMessage=RecvSmsL(socket); |
1858 rxSmsMessage=RecvSmsL(socket); |
2071 CleanupStack::PushL(rxSmsMessage); |
1859 CleanupStack::PushL(rxSmsMessage); |
2072 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
1860 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
2076 |
1864 |
2077 // Send message & wait a sec(!) |
1865 // Send message & wait a sec(!) |
2078 SendSmsL(smsMessage,socket); |
1866 SendSmsL(smsMessage,socket); |
2079 |
1867 |
2080 // UnstoredClientAck |
1868 // UnstoredClientAck |
2081 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
1869 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
2082 smsReceiveModeField->ModifyL(*db); |
1870 smsReceiveModeField->ModifyL(*db); |
2083 |
1871 |
2084 // Receive message |
1872 // Receive message |
2085 rxSmsMessage=RecvSmsL(socket); |
1873 rxSmsMessage=RecvSmsL(socket); |
2086 CleanupStack::PushL(rxSmsMessage); |
1874 CleanupStack::PushL(rxSmsMessage); |
2087 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
1875 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
2091 |
1879 |
2092 // Send message & wait a sec(!) |
1880 // Send message & wait a sec(!) |
2093 SendSmsL(smsMessage,socket); |
1881 SendSmsL(smsMessage,socket); |
2094 |
1882 |
2095 // Stored |
1883 // Stored |
2096 *smsReceiveModeField = RMobileSmsMessaging::EReceiveStored; |
1884 *smsReceiveModeField = RMobileSmsMessaging::EReceiveStored; |
2097 smsReceiveModeField->ModifyL(*db); |
1885 smsReceiveModeField->ModifyL(*db); |
2098 |
1886 |
2099 // Receive message |
1887 // Receive message |
2100 rxSmsMessage=RecvSmsL(socket); |
1888 rxSmsMessage=RecvSmsL(socket); |
2101 CleanupStack::PushL(rxSmsMessage); |
1889 CleanupStack::PushL(rxSmsMessage); |
2102 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
1890 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
2106 |
1894 |
2107 // Send message & wait a sec(!) |
1895 // Send message & wait a sec(!) |
2108 SendSmsL(smsMessage,socket); |
1896 SendSmsL(smsMessage,socket); |
2109 |
1897 |
2110 // Either |
1898 // Either |
2111 *smsReceiveModeField = RMobileSmsMessaging::EReceiveEither; |
1899 *smsReceiveModeField = RMobileSmsMessaging::EReceiveEither; |
2112 smsReceiveModeField->ModifyL(*db); |
1900 smsReceiveModeField->ModifyL(*db); |
2113 CleanupStack::PopAndDestroy(smsReceiveModeField); |
1901 CleanupStack::PopAndDestroy(smsReceiveModeField); |
2114 |
1902 |
2115 // Receive message |
1903 // Receive message |
2116 rxSmsMessage=RecvSmsL(socket); |
1904 rxSmsMessage=RecvSmsL(socket); |
2117 CleanupStack::PushL(rxSmsMessage); |
1905 CleanupStack::PushL(rxSmsMessage); |
2118 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
1906 TestSmsContentsL(rxSmsMessage,KTestMsg1); |
2119 CleanupStack::PopAndDestroy(); // rxSmsMessage |
1907 CleanupStack::PopAndDestroy(); // rxSmsMessage |
2120 |
1908 |
2121 // Cleanup |
1909 // Cleanup |
2122 CleanupStack::PopAndDestroy(3); // smsMessage, socket, db |
1910 CleanupStack::PopAndDestroy(3); // smsMessage, socket, db |
2123 CleanupStack::PopAndDestroy(&socketServer); |
1911 |
2124 |
1912 return TestStepResult() ; |
2125 return TestStepResult() ; |
|
2126 } |
1913 } |
2127 |
1914 |
2128 |
|
2129 TVerdict CTestTsyCaps::doTestStepL() |
1915 TVerdict CTestTsyCaps::doTestStepL() |
2130 /** |
1916 /** |
2131 * Test sms stack when tsy doesn't support anything |
1917 * Test sms stack when tsy doesn't support anything |
2132 */ |
1918 */ |
2133 { |
1919 { |
2134 INFO_PRINTF1(_L("Test Sms stack when Tsy supports nothing")); |
1920 INFO_PRINTF1(_L("Test Sms stack when Tsy supports nothing")); |
2135 |
|
2136 RSocketServ socketServer; |
|
2137 PrepareRegTestLC(socketServer, 20); |
|
2138 |
|
2139 |
|
2140 RSocket socket; |
1921 RSocket socket; |
2141 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
1922 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2142 |
1923 |
2143 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
1924 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2144 |
1925 |
2145 //Set destination and SC numbers |
1926 //Set destination and SC numbers |
2146 iTelephoneNumber=KPekka; |
1927 iTelephoneNumber=KPekka; |
2147 iServiceCenterNumber=KRadiolinjaSC; |
1928 iServiceCenterNumber=KRadiolinjaSC; |
2148 |
1929 |
2149 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
1930 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
2150 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
1931 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
2151 CleanupStack::PushL(smsMessage); |
|
2152 |
1932 |
2153 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
1933 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
2154 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
1934 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
2155 |
1935 |
2156 //Send SMS |
1936 //Send SMS |
2198 INFO_PRINTF1(_L("waiting for SMS parameters...") ); |
1978 INFO_PRINTF1(_L("waiting for SMS parameters...") ); |
2199 User::WaitForRequest(status); |
1979 User::WaitForRequest(status); |
2200 INFO_PRINTF2(_L("Read Sms parameters - returned %d"), status.Int()); |
1980 INFO_PRINTF2(_L("Read Sms parameters - returned %d"), status.Int()); |
2201 TEST(status.Int() == KErrNotSupported); |
1981 TEST(status.Int() == KErrNotSupported); |
2202 |
1982 |
2203 |
1983 // Try to store SMS parameters, tsy doesn't support this |
2204 // |
|
2205 // Try to store SMS parameters, tsy doesn't support this |
|
2206 // |
|
2207 CMobilePhoneSmspList* smspList=CMobilePhoneSmspList::NewL(); |
1984 CMobilePhoneSmspList* smspList=CMobilePhoneSmspList::NewL(); |
2208 CleanupStack::PushL(smspList); |
1985 CleanupStack::PushL(smspList); |
2209 |
1986 |
2210 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
1987 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
2211 |
1988 |
2234 socket.Ioctl(KIoctlWriteSmsParams,status,NULL, KSolSmsProv); |
2011 socket.Ioctl(KIoctlWriteSmsParams,status,NULL, KSolSmsProv); |
2235 User::WaitForRequest(status); |
2012 User::WaitForRequest(status); |
2236 INFO_PRINTF2(_L("Write Sms parameters - returned %d"), status.Int()); |
2013 INFO_PRINTF2(_L("Write Sms parameters - returned %d"), status.Int()); |
2237 TEST(status.Int() == KErrNotSupported); |
2014 TEST(status.Int() == KErrNotSupported); |
2238 |
2015 |
2239 CleanupStack::PopAndDestroy(2); //socket, smspList |
2016 CleanupStack::PopAndDestroy(2, &socket); //socket, smspList |
2240 CleanupStack::PopAndDestroy(&socketServer); |
2017 return TestStepResult() ; |
2241 |
|
2242 return TestStepResult() ; |
|
2243 } |
2018 } |
2244 |
2019 |
2245 TVerdict CTestOOMSendSms::doTestStepL() |
2020 TVerdict CTestOOMSendSms::doTestStepL() |
2246 /** |
2021 /** |
2247 * Test out of memory handling, Send Sms |
2022 * Test out of memory handling, Send Sms |
2249 { |
2024 { |
2250 INFO_PRINTF1(_L("Test out of memory handling")); |
2025 INFO_PRINTF1(_L("Test out of memory handling")); |
2251 #ifdef _DEBUG |
2026 #ifdef _DEBUG |
2252 |
2027 |
2253 INFO_PRINTF1(_L("OOM test: Send Sms")); |
2028 INFO_PRINTF1(_L("OOM test: Send Sms")); |
2254 RSocketServ socketServer; |
|
2255 PrepareRegTestLC(socketServer, 21); |
|
2256 |
|
2257 |
|
2258 RSocket socket; |
2029 RSocket socket; |
2259 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2030 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2260 |
2031 |
2261 //Set destination and SC numbers |
2032 //Set destination and SC numbers |
2262 iTelephoneNumber=KPekka; |
2033 iTelephoneNumber=KPekka; |
2263 iServiceCenterNumber=KRadiolinjaSC; |
2034 iServiceCenterNumber=KRadiolinjaSC; |
2264 |
2035 |
2265 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2036 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2266 |
2037 |
2267 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
2038 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
2268 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
2039 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
2269 CleanupStack::PushL(smsMessage); |
|
2270 |
2040 |
2271 TInt count=0; |
2041 TInt count=0; |
2272 TInt ret=KErrNoMemory; |
2042 TInt ret=KErrNoMemory; |
2273 TInt successfullSends=0; //maximum expected number of succeeded sends is 2 in TSY config file |
2043 TInt successfullSends=0; //maximum expected number of succeeded sends is 2 in TSY config file |
2274 while ((ret==KErrNoMemory || ret==KErrEof || count < 18) && (successfullSends<2)) |
2044 while ((ret==KErrNoMemory || ret==KErrEof || count < 18) && (successfullSends<2)) |
2275 { |
2045 { |
2276 socketServer.__DbgFailNext(count); |
2046 iSocketServer.__DbgFailNext(count); |
2277 socketServer.__DbgMarkHeap(); |
2047 iSocketServer.__DbgMarkHeap(); |
2278 TRAP(ret,SendSmsDontCheckReturnValueL(smsMessage,socket)); |
2048 TRAP(ret,SendSmsDontCheckReturnValueL(smsMessage,socket)); |
2279 socketServer.__DbgMarkEnd(0); |
2049 iSocketServer.__DbgMarkEnd(0); |
2280 if(ret==KErrNone) |
2050 if(ret==KErrNone) |
2281 successfullSends++; |
2051 successfullSends++; |
2282 count++; |
2052 count++; |
2283 } |
2053 } |
2284 |
2054 |
2285 TEST(ret == KErrNone); |
2055 TEST(ret == KErrNone); |
2286 |
2056 |
2287 socketServer.__DbgFailNext(-1); // Reset heap |
2057 iSocketServer.__DbgFailNext(-1); // Reset heap |
2288 |
2058 |
2289 CleanupStack::PopAndDestroy(2); //smsMessage, socket |
2059 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
2290 |
|
2291 CleanupStack::PopAndDestroy(&socketServer); |
|
2292 |
2060 |
2293 #endif |
2061 #endif |
2294 return TestStepResult() ; |
2062 return TestStepResult() ; |
2295 } |
2063 } |
2296 |
2064 |
2299 * Test out of memory handling, Write Sms to store |
2067 * Test out of memory handling, Write Sms to store |
2300 */ |
2068 */ |
2301 { |
2069 { |
2302 INFO_PRINTF1(_L("OOM test: Write Sms to Store")); |
2070 INFO_PRINTF1(_L("OOM test: Write Sms to Store")); |
2303 #ifdef _DEBUG |
2071 #ifdef _DEBUG |
2304 |
|
2305 RSocketServ socketServer; |
|
2306 PrepareRegTestLC(socketServer, 22); |
|
2307 |
|
2308 |
|
2309 RSocket socket; |
2072 RSocket socket; |
2310 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2073 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2311 |
2074 |
2312 // Create and store the message |
2075 // Create and store the message |
2313 _LIT(KStoreMsg1,"HELLO CHRIS"); |
2076 _LIT(KStoreMsg1,"HELLO CHRIS"); |
2314 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
2077 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
2315 CSmsMessage* smsMessage=CreateSmsMessageL(KStoreMsg1,alphabet); |
2078 CSmsMessage* smsMessage=CreateSmsMessageLC(KStoreMsg1,alphabet); |
2316 CleanupStack::PushL(smsMessage); |
|
2317 |
2079 |
2318 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
2080 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
2319 |
2081 |
2320 TInt count=0; |
2082 TInt count=0; |
2321 TInt ret=KErrNoMemory; |
2083 TInt ret=KErrNoMemory; |
2322 while (ret==KErrNoMemory || ret==KErrEof || count < 8) |
2084 while (ret==KErrNoMemory || ret==KErrEof || count < 8) |
2323 { |
2085 { |
2324 socketServer.__DbgFailNext(count); |
2086 iSocketServer.__DbgFailNext(count); |
2325 socketServer.__DbgMarkHeap(); |
2087 iSocketServer.__DbgMarkHeap(); |
2326 TRAP(ret,WriteSmsLeaveIfErrorL(*smsMessage,socket);); |
2088 TRAP(ret,WriteSmsLeaveIfErrorL(*smsMessage,socket);); |
2327 socketServer.__DbgMarkEnd(0); |
2089 iSocketServer.__DbgMarkEnd(0); |
2328 count++; |
2090 count++; |
2329 } |
2091 } |
2330 |
2092 |
2331 socketServer.__DbgFailNext(-1); // Reset heap |
2093 iSocketServer.__DbgFailNext(-1); // Reset heap |
2332 TEST(ret == KErrNone); |
2094 TEST(ret == KErrNone); |
2333 CleanupStack::PopAndDestroy(2); //smsMessage, socket |
2095 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
2334 |
|
2335 //Ensure socket server session is closed to remove cache |
|
2336 CleanupStack::PopAndDestroy(&socketServer); |
|
2337 |
|
2338 #endif |
2096 #endif |
2339 return TestStepResult() ; |
2097 return TestStepResult() ; |
2340 } |
2098 } |
2341 |
2099 |
2342 |
|
2343 TVerdict CTestOOMReadSms::doTestStepL() |
2100 TVerdict CTestOOMReadSms::doTestStepL() |
2344 /** |
2101 /** |
2345 * Test out of memory handling, Read SMS messages |
2102 * Test out of memory handling, Read SMS messages |
2346 */ |
2103 */ |
2347 { |
2104 { |
2348 INFO_PRINTF1(_L("OOM test: Read, SMS store ReadAll not supported.")); |
2105 INFO_PRINTF1(_L("OOM test: Read, SMS store ReadAll not supported.")); |
2349 #ifdef _DEBUG |
2106 #ifdef _DEBUG |
2350 |
|
2351 RSocketServ socketServer; |
|
2352 PrepareRegTestLC(socketServer, 23); |
|
2353 |
|
2354 |
|
2355 RSocket socket; |
2107 RSocket socket; |
2356 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2108 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2357 |
|
2358 TInt count, i(0); |
|
2359 |
2109 |
2360 RSmsSocketReadStream readstream(socket); |
2110 RSmsSocketReadStream readstream(socket); |
2361 TRequestStatus status; |
2111 TRequestStatus status; |
2362 |
2112 |
2363 CSmsMessage* smsMessage = NULL; |
2113 CSmsMessage* smsMessage = NULL; |
2364 |
2114 |
2365 TInt numberOfMessages(0); |
2115 TInt numberOfMessages(0); |
2366 smsMessage = CreateSmsMessageL(_L(""),TSmsDataCodingScheme::ESmsAlphabet7Bit); |
2116 smsMessage = CreateSmsMessageLC(_L(""),TSmsDataCodingScheme::ESmsAlphabet7Bit); |
2367 CleanupStack::PushL(smsMessage); |
2117 |
2368 |
2118 TInt count=0; |
2369 count=0; |
|
2370 TInt ret=KErrNoMemory; |
2119 TInt ret=KErrNoMemory; |
2371 while (ret==KErrNoMemory || ret==KErrEof || count < 10) |
2120 while (ret==KErrNoMemory || ret==KErrEof || count < 10) |
2372 { |
2121 { |
2373 socketServer.__DbgFailNext(count); |
2122 iSocketServer.__DbgFailNext(count); |
2374 socketServer.__DbgMarkHeap(); |
2123 iSocketServer.__DbgMarkHeap(); |
2375 TRAP(ret,numberOfMessages=MakeReadSmsStoreRequestL(socket);); |
2124 TRAP(ret,numberOfMessages=MakeReadSmsStoreRequestL(socket);); |
2376 socketServer.__DbgMarkEnd(0); |
2125 iSocketServer.__DbgMarkEnd(0); |
2377 |
2126 |
2378 if (ret==KErrNone) |
2127 if (ret==KErrNone) |
2379 { |
2128 { |
2380 for (i=0; i<numberOfMessages; i++) |
2129 for (TInt i=0; i<numberOfMessages; ++i) |
2381 { |
2130 { |
2382 TRAPD(ret,readstream >> *smsMessage); |
2131 TRAPD(ret,readstream >> *smsMessage); |
2383 TEST(ret == KErrNone); |
2132 TEST(ret == KErrNone); |
2384 socket.Ioctl(KIoctlReadMessageSucceeded,status,NULL, KSolSmsProv); |
2133 socket.Ioctl(KIoctlReadMessageSucceeded,status,NULL, KSolSmsProv); |
2385 User::WaitForRequest(status); |
2134 User::WaitForRequest(status); |
2386 } |
2135 } |
2387 } |
2136 } |
2388 count++; |
2137 ++count; |
2389 } |
2138 } |
2390 |
2139 |
2391 CleanupStack::PopAndDestroy(smsMessage); |
2140 CleanupStack::PopAndDestroy(smsMessage); |
2392 TEST(ret == KErrNone); |
2141 TEST(ret == KErrNone); |
2393 socketServer.__DbgFailNext(-1); // Reset heap |
2142 iSocketServer.__DbgFailNext(-1); // Reset heap |
2394 |
2143 |
2395 INFO_PRINTF2(_L("%d enumerated messages"), numberOfMessages); |
2144 INFO_PRINTF2(_L("%d enumerated messages"), numberOfMessages); |
2396 |
2145 |
2397 //Check that test client can read all messages from the stream |
2146 //Check that test client can read all messages from the stream |
2398 for(i=0; i< numberOfMessages; i++) |
2147 for(TInt i=0; i< numberOfMessages; ++i) |
2399 { |
2148 { |
2400 CSmsBuffer* buffer=CSmsBuffer::NewL(); |
2149 CSmsBuffer* buffer=CSmsBuffer::NewL(); |
2401 smsMessage=CSmsMessage::NewL(iFs, CSmsPDU::ESmsDeliver,buffer); |
2150 smsMessage=CSmsMessage::NewL(iFs, CSmsPDU::ESmsDeliver,buffer); |
2402 CleanupStack::PushL(smsMessage); |
2151 CleanupStack::PushL(smsMessage); |
2403 |
2152 |
2407 TEST(status.Int() == KErrNone); |
2156 TEST(status.Int() == KErrNone); |
2408 |
2157 |
2409 CleanupStack::PopAndDestroy(smsMessage); |
2158 CleanupStack::PopAndDestroy(smsMessage); |
2410 } |
2159 } |
2411 |
2160 |
2412 CleanupStack::PopAndDestroy(&socket); //socket |
2161 CleanupStack::PopAndDestroy(&socket); |
2413 |
|
2414 //Ensure socket server session is closed to remove cache |
|
2415 CleanupStack::PopAndDestroy(&socketServer); |
|
2416 |
|
2417 #endif |
2162 #endif |
2418 return TestStepResult() ; |
2163 return TestStepResult() ; |
2419 } |
2164 } |
2420 |
2165 |
2421 |
|
2422 TVerdict CTestOOMReadSmsList::doTestStepL() |
2166 TVerdict CTestOOMReadSmsList::doTestStepL() |
2423 /** |
2167 /** |
2424 * Test out of memory handling, Read SMS messages from store |
2168 * Test out of memory handling, Read SMS messages from store |
2425 */ |
2169 */ |
2426 { |
2170 { |
2427 INFO_PRINTF1(_L("OOM test: Read, SMS store ReadAll not supported.")); |
2171 INFO_PRINTF1(_L("OOM test: Read, SMS store ReadAll not supported.")); |
2428 #ifdef _DEBUG |
2172 #ifdef _DEBUG |
2429 |
|
2430 RSocketServ socketServer; |
|
2431 PrepareRegTestLC(socketServer, 24); |
|
2432 |
|
2433 |
|
2434 RSocket socket; |
2173 RSocket socket; |
2435 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2174 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2436 |
|
2437 TInt count, i(0); |
|
2438 |
2175 |
2439 RSmsSocketReadStream readstream(socket); |
2176 RSmsSocketReadStream readstream(socket); |
2440 TRequestStatus status; |
2177 TRequestStatus status; |
2441 |
2178 |
2442 CSmsMessage* smsMessage = NULL; |
2179 CSmsMessage* smsMessage = NULL; |
2443 |
2180 |
2444 TInt numberOfMessages(0); |
2181 TInt numberOfMessages(0); |
2445 smsMessage = CreateSmsMessageL(_L(""),TSmsDataCodingScheme::ESmsAlphabet7Bit); |
2182 smsMessage = CreateSmsMessageLC(_L(""),TSmsDataCodingScheme::ESmsAlphabet7Bit); |
2446 CleanupStack::PushL(smsMessage); |
2183 |
2447 |
2184 TInt count=0; |
2448 count=0; |
|
2449 TInt ret=KErrNoMemory; |
2185 TInt ret=KErrNoMemory; |
2450 while (ret==KErrNoMemory || ret==KErrEof || count < 10) |
2186 while (ret==KErrNoMemory || ret==KErrEof || count < 10) |
2451 { |
2187 { |
2452 |
2188 iSocketServer.__DbgFailNext(count); |
2453 socketServer.__DbgFailNext(count); |
2189 iSocketServer.__DbgMarkHeap(); |
2454 socketServer.__DbgMarkHeap(); |
|
2455 TRAP(ret,numberOfMessages=MakeReadSmsStoreRequestL(socket);); |
2190 TRAP(ret,numberOfMessages=MakeReadSmsStoreRequestL(socket);); |
2456 socketServer.__DbgMarkEnd(0); |
2191 iSocketServer.__DbgMarkEnd(0); |
2457 |
2192 |
2458 if (ret==KErrNone) |
2193 if (ret==KErrNone) |
2459 { |
2194 { |
2460 //Check that test client can read all messages from the stream |
2195 //Check that test client can read all messages from the stream |
2461 for (i=0; i<numberOfMessages; i++) |
2196 for (TInt i=0; i<numberOfMessages; ++i) |
2462 { |
2197 { |
2463 TRAPD(ret,readstream >> *smsMessage); |
2198 TRAPD(ret,readstream >> *smsMessage); |
2464 TEST(ret == KErrNone); |
2199 TEST(ret == KErrNone); |
2465 socket.Ioctl(KIoctlReadMessageSucceeded,status,NULL, KSolSmsProv); |
2200 socket.Ioctl(KIoctlReadMessageSucceeded,status,NULL, KSolSmsProv); |
2466 User::WaitForRequest(status); |
2201 User::WaitForRequest(status); |
2467 TEST(status.Int() == KErrNone); |
2202 TEST(status.Int() == KErrNone); |
2468 } |
2203 } |
2469 } |
2204 } |
2470 count++; |
2205 ++count; |
2471 } |
2206 } |
2472 |
2207 |
2473 CleanupStack::PopAndDestroy(smsMessage); |
2208 CleanupStack::PopAndDestroy(smsMessage); |
2474 |
2209 |
2475 TEST(ret == KErrNone); |
2210 TEST(ret == KErrNone); |
2476 |
2211 |
2477 socketServer.__DbgFailNext(-1); // Reset heap |
2212 iSocketServer.__DbgFailNext(-1); // Reset heap |
2478 |
2213 |
2479 INFO_PRINTF2(_L("%d enumerated messages"), numberOfMessages); |
2214 INFO_PRINTF2(_L("%d enumerated messages"), numberOfMessages); |
2480 |
2215 |
2481 CleanupStack::PopAndDestroy(&socket); //socket |
2216 CleanupStack::PopAndDestroy(&socket); |
2482 |
|
2483 //Ensure socket server session is closed to remove cache |
|
2484 CleanupStack::PopAndDestroy(&socketServer); |
|
2485 |
|
2486 #endif |
2217 #endif |
2487 return TestStepResult() ; |
2218 return TestStepResult() ; |
2488 } |
2219 } |
2489 |
2220 |
2490 |
|
2491 TVerdict CTestOOMDeleteSms::doTestStepL() |
2221 TVerdict CTestOOMDeleteSms::doTestStepL() |
2492 /** |
2222 /** |
2493 * Test out of memory handling, Delete SMS message |
2223 * Test out of memory handling, Delete SMS message |
2494 */ |
2224 */ |
2495 { |
2225 { |
2496 INFO_PRINTF1(_L("OOM test: Delete SMS message.")); |
2226 INFO_PRINTF1(_L("OOM test: Delete SMS message.")); |
2497 #ifdef _DEBUG |
2227 #ifdef _DEBUG |
2498 |
|
2499 RSocketServ socketServer; |
|
2500 PrepareRegTestLC(socketServer, 25); |
|
2501 |
|
2502 |
|
2503 RSocket socket; |
2228 RSocket socket; |
2504 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation); |
2229 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrLocalOperation); |
2505 |
2230 |
2506 // First get one message from store. |
2231 // First get one message from store. |
2507 RPointerArray<CSmsMessage> messages; |
2232 RPointerArray<CSmsMessage> messages; |
2508 CleanupResetAndDestroyPushL(messages); |
2233 CleanupResetAndDestroyPushL(messages); |
2509 ReadSmsStoreL(socket, messages); |
2234 ReadSmsStoreL(socket, messages); |
2511 TInt count=0; |
2236 TInt count=0; |
2512 TInt i (0); |
2237 TInt i (0); |
2513 TInt ret=0; |
2238 TInt ret=0; |
2514 while (ret==KErrNoMemory || ret==KErrEof || i<messages.Count()) |
2239 while (ret==KErrNoMemory || ret==KErrEof || i<messages.Count()) |
2515 { |
2240 { |
2516 socketServer.__DbgFailNext(count); |
2241 iSocketServer.__DbgFailNext(count); |
2517 socketServer.__DbgMarkHeap(); |
2242 iSocketServer.__DbgMarkHeap(); |
2518 TRAP(ret,DeleteSmsLeaveIfErrorL(*messages[i],socket)); |
2243 TRAP(ret,DeleteSmsLeaveIfErrorL(*messages[i],socket)); |
2519 socketServer.__DbgMarkEnd(0); |
2244 iSocketServer.__DbgMarkEnd(0); |
2520 |
2245 |
2521 if(ret == KErrNone) |
2246 if(ret == KErrNone) |
2247 { |
|
2522 //Deleting was successfull. Delete next message. |
2248 //Deleting was successfull. Delete next message. |
2523 |
2249 ++i; |
2524 i++; |
2250 } |
2525 else if(ret == KErrNotFound) |
2251 else if(ret == KErrNotFound) |
2252 { |
|
2526 //SMS Prot has deleted message, but returned KErrNoMemory. |
2253 //SMS Prot has deleted message, but returned KErrNoMemory. |
2527 //When test harness tried to delete same message again, SMS stack |
2254 //When test harness tried to delete same message again, SMS stack |
2528 //returned KErrNotFound. |
2255 //returned KErrNotFound. |
2529 TEST(ret == KErrNone); |
2256 TEST(ret == KErrNone); |
2530 count++; |
2257 } |
2258 ++count; |
|
2531 } |
2259 } |
2532 |
2260 |
2533 socketServer.__DbgFailNext(-1); // Reset heap |
2261 iSocketServer.__DbgFailNext(-1); // Reset heap |
2534 messages.ResetAndDestroy(); |
2262 messages.ResetAndDestroy(); |
2535 ReadSmsStoreL(socket, messages); |
2263 ReadSmsStoreL(socket, messages); |
2536 |
2264 |
2537 TEST(messages.Count()== 0); |
2265 TEST(messages.Count()== 0); |
2538 CleanupStack::PopAndDestroy(2); //messages,socket |
2266 CleanupStack::PopAndDestroy(2, &socket); // socket, messages |
2539 |
|
2540 //Ensure socket server session is closed to remove cache |
|
2541 CleanupStack::PopAndDestroy(&socketServer); |
|
2542 |
|
2543 #endif |
2267 #endif |
2544 return TestStepResult() ; |
2268 return TestStepResult() ; |
2545 } |
2269 } |
2546 |
2270 |
2547 |
|
2548 TVerdict CTestOOMSmsParams::doTestStepL() |
2271 TVerdict CTestOOMSmsParams::doTestStepL() |
2549 /** |
2272 /** |
2550 * Test out of memory handling, Retrieve and store SMS parameters |
2273 * Test out of memory handling, Retrieve and store SMS parameters |
2551 */ |
2274 */ |
2552 { |
2275 { |
2553 INFO_PRINTF1(_L("OOM test: Read and Store Sms params.")); |
|
2554 #ifdef _DEBUG |
2276 #ifdef _DEBUG |
2555 |
2277 INFO_PRINTF1(_L("OOM test: Read and Store Sms params.")); |
2556 RSocketServ socketServer; |
2278 RSocket socket; |
2557 PrepareRegTestLC(socketServer, 26); |
2279 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrLocalOperation); |
2558 |
|
2559 |
|
2560 RSocket socket; |
|
2561 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation); |
|
2562 |
|
2563 TInt count; |
|
2564 |
2280 |
2565 RSmsSocketReadStream readstream(socket); |
2281 RSmsSocketReadStream readstream(socket); |
2566 TRequestStatus status; |
2282 TRequestStatus status; |
2567 |
2283 |
2568 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
2284 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
2569 CleanupStack::PushL(smspList); |
2285 CleanupStack::PushL(smspList); |
2570 |
2286 |
2571 INFO_PRINTF1(_L("Retrieve SMS parameters.")); |
2287 INFO_PRINTF1(_L("Retrieve SMS parameters.")); |
2572 |
2288 |
2573 count=0; |
2289 TInt count = 0; |
2574 TInt ret=KErrNoMemory; |
2290 TInt ret=KErrNoMemory; |
2575 while (ret==KErrNoMemory || ret==KErrEof || count < 8) |
2291 while (ret==KErrNoMemory || ret==KErrEof || count < 8) |
2576 { |
2292 { |
2577 socketServer.__DbgFailNext(count); |
2293 iSocketServer.__DbgFailNext(count); |
2578 socketServer.__DbgMarkHeap(); |
2294 iSocketServer.__DbgMarkHeap(); |
2579 TRAP(ret,iSmsStackTestUtils->MakeParametersReadRequestL(socket);); |
2295 TRAP(ret,iSmsStackTestUtils->MakeParametersReadRequestL(socket);); |
2580 socketServer.__DbgMarkEnd(0); |
2296 iSocketServer.__DbgMarkEnd(0); |
2581 count++; |
2297 count++; |
2582 } |
2298 } |
2583 socketServer.__DbgFailNext(-1); // suppress any lurking heap failure |
2299 iSocketServer.__DbgFailNext(-1); // suppress any lurking heap failure |
2584 |
2300 |
2585 TEST(ret == KErrNone); |
2301 TEST(ret == KErrNone); |
2586 |
2302 |
2587 // Read list from stream and make acknowledgement to the SMS Stack |
2303 // Read list from stream and make acknowledgement to the SMS Stack |
2588 readstream >> *smspList; |
2304 readstream >> *smspList; |
2590 User::WaitForRequest(status); |
2306 User::WaitForRequest(status); |
2591 TEST(status.Int() == KErrNone); |
2307 TEST(status.Int() == KErrNone); |
2592 |
2308 |
2593 CleanupStack::PopAndDestroy(smspList); |
2309 CleanupStack::PopAndDestroy(smspList); |
2594 |
2310 |
2595 // |
2311 // |
2596 //Store parameters |
2312 //Store parameters |
2597 // |
2313 // |
2598 smspList=CMobilePhoneSmspList::NewL(); |
2314 smspList=CMobilePhoneSmspList::NewL(); |
2599 CleanupStack::PushL(smspList); |
2315 CleanupStack::PushL(smspList); |
2600 |
2316 |
2601 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
2317 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
2602 entryToTsy.iText = DMMTSY_SMSP_STORE_TEXT1; |
2318 entryToTsy.iText = DMMTSY_SMSP_STORE_TEXT1; |
2619 |
2335 |
2620 count=0; |
2336 count=0; |
2621 ret=KErrNoMemory; |
2337 ret=KErrNoMemory; |
2622 while (ret==KErrNoMemory || count < 10) |
2338 while (ret==KErrNoMemory || count < 10) |
2623 { |
2339 { |
2624 socketServer.__DbgFailNext(count); |
2340 iSocketServer.__DbgFailNext(count); |
2625 socketServer.__DbgMarkHeap(); |
2341 iSocketServer.__DbgMarkHeap(); |
2626 TRAP(ret,iSmsStackTestUtils->StoreParamsLeaveIfErrorL(*smspList,socket);); |
2342 TRAP(ret,iSmsStackTestUtils->StoreParamsLeaveIfErrorL(*smspList,socket);); |
2627 socketServer.__DbgMarkEnd(0); |
2343 iSocketServer.__DbgMarkEnd(0); |
2628 count++; |
2344 count++; |
2629 } |
2345 } |
2630 |
2346 |
2631 TEST(ret == KErrNone); |
2347 TEST(ret == KErrNone); |
2632 |
2348 |
2633 socketServer.__DbgFailNext(-1); // Reset heap |
2349 iSocketServer.__DbgFailNext(-1); // Reset heap |
2634 // |
2350 // |
2635 // Retrieve SMS parameters again and test the content of params |
2351 // Retrieve SMS parameters again and test the content of params |
2636 // |
2352 // |
2637 //Wait a second, OOM macro is still closing!! |
2353 //Wait a second, OOM macro is still closing!! |
2638 INFO_PRINTF1(_L("Retrieve parameters again...")); |
2354 INFO_PRINTF1(_L("Retrieve parameters again...")); |
2639 |
2355 |
2640 //Create the smspList |
2356 //Create the smspList |
2641 CMobilePhoneSmspList* smspList2 = CMobilePhoneSmspList::NewL(); |
2357 CMobilePhoneSmspList* smspList2 = CMobilePhoneSmspList::NewL(); |
2654 TEST(status.Int() == KErrNone); |
2370 TEST(status.Int() == KErrNone); |
2655 |
2371 |
2656 ret = iSmsStackTestUtils->TestParameters(*smspList,*smspList2); |
2372 ret = iSmsStackTestUtils->TestParameters(*smspList,*smspList2); |
2657 TEST(ret == KErrNone); |
2373 TEST(ret == KErrNone); |
2658 |
2374 |
2659 CleanupStack::PopAndDestroy(3); //smspList2, smspList, socket |
2375 CleanupStack::PopAndDestroy(3, &socket); //smspList2, smspList, socket |
2660 |
|
2661 //Ensure socket server session is closed to remove cache |
|
2662 CleanupStack::PopAndDestroy(&socketServer); |
|
2663 |
|
2664 #endif |
2376 #endif |
2665 return TestStepResult(); |
2377 return TestStepResult(); |
2666 } |
2378 } |
2667 |
|
2668 |
2379 |
2669 // |
2380 // |
2670 // Integration test harnesses against SIM tsy |
2381 // Integration test harnesses against SIM tsy |
2671 // |
2382 // |
2672 TVerdict CTestMeStoreDupAndMiss::doTestStepL() |
2383 TVerdict CTestMeStoreDupAndMiss::doTestStepL() |
2674 * Test SIM store containing concatenated messages when |
2385 * Test SIM store containing concatenated messages when |
2675 * some pdu is missing and some pdu is duplicated. |
2386 * some pdu is missing and some pdu is duplicated. |
2676 */ |
2387 */ |
2677 { |
2388 { |
2678 INFO_PRINTF1(_L("Test the ME store containing duplicated and missing pdus")); |
2389 INFO_PRINTF1(_L("Test the ME store containing duplicated and missing pdus")); |
2679 |
|
2680 RSocketServ socketServer; |
|
2681 PrepareRegTestLC(socketServer, 27); |
|
2682 |
|
2683 |
|
2684 // Open the socket for SIM operations |
2390 // Open the socket for SIM operations |
2685 RSocket enumSocket; |
2391 RSocket enumSocket; |
2686 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,enumSocket,ESmsAddrRecvAny); |
2392 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, enumSocket, ESmsAddrLocalOperation); |
2687 |
2393 |
2688 // Enumerate messages |
2394 // Enumerate messages |
2689 RPointerArray<CSmsMessage> messages; |
2395 RPointerArray<CSmsMessage> messages; |
2690 CleanupResetAndDestroyPushL(messages); |
2396 CleanupResetAndDestroyPushL(messages); |
2691 ReadSmsStoreL(enumSocket, messages); |
2397 ReadSmsStoreL(enumSocket, messages); |
2693 TEST(messages.Count() == 0); |
2399 TEST(messages.Count() == 0); |
2694 CleanupStack::PopAndDestroy(&messages); |
2400 CleanupStack::PopAndDestroy(&messages); |
2695 CleanupStack::PopAndDestroy(&enumSocket); |
2401 CleanupStack::PopAndDestroy(&enumSocket); |
2696 |
2402 |
2697 RSocket socket; |
2403 RSocket socket; |
2698 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2404 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2699 |
2405 |
2700 INFO_PRINTF1(_L("waiting for 1st incoming SMS...") ); |
2406 INFO_PRINTF1(_L("waiting for 1st incoming SMS...") ); |
2701 WaitForRecvL(socket); |
2407 WaitForRecvL(socket); |
2702 CSmsMessage* smsMessage = RecvSmsL(socket); |
2408 CSmsMessage* smsMessage = RecvSmsL(socket); |
2703 delete smsMessage; |
2409 delete smsMessage; |
2716 WaitForRecvL(socket); |
2422 WaitForRecvL(socket); |
2717 smsMessage = RecvSmsL(socket); |
2423 smsMessage = RecvSmsL(socket); |
2718 delete smsMessage; |
2424 delete smsMessage; |
2719 |
2425 |
2720 CleanupStack::PopAndDestroy(&socket); |
2426 CleanupStack::PopAndDestroy(&socket); |
2721 CleanupStack::PopAndDestroy(&socketServer); |
2427 INFO_PRINTF1(_L("Additional waiting SMS protocol to get unloaded")); |
2722 |
2428 User::After(20000000); // TODO: reviewers - is this needed here? |
2723 INFO_PRINTF1(_L("Additional waiting SMS protocol to get unloaded")); |
|
2724 User::After(20000000); |
|
2725 return TestStepResult() ; |
2429 return TestStepResult() ; |
2726 } |
2430 } |
2727 |
|
2728 |
2431 |
2729 TVerdict CTestSimStoreDupAndMiss::doTestStepL() |
2432 TVerdict CTestSimStoreDupAndMiss::doTestStepL() |
2730 /** |
2433 /** |
2731 * Test ME store containing concatenated messages when |
2434 * Test ME store containing concatenated messages when |
2732 * some pdu is missing and some pdu is duplicated. |
2435 * some pdu is missing and some pdu is duplicated. |
2733 */ |
2436 */ |
2734 { |
2437 { |
2735 INFO_PRINTF1(_L("Test the ME store containing duplicated and missing pdus")); |
2438 INFO_PRINTF1(_L("Test the ME store containing duplicated and missing pdus")); |
2736 |
|
2737 RSocketServ socketServer; |
|
2738 PrepareRegTestLC(socketServer, 28); |
|
2739 |
|
2740 |
|
2741 // Open the socket for SIM operations |
2439 // Open the socket for SIM operations |
2742 RSocket socket; |
2440 RSocket socket; |
2743 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2441 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrLocalOperation); |
2744 |
2442 |
2745 // Enumerate messages |
2443 // Enumerate messages |
2746 RPointerArray<CSmsMessage> messages; |
2444 RPointerArray<CSmsMessage> messages; |
2747 CleanupResetAndDestroyPushL(messages); |
2445 CleanupResetAndDestroyPushL(messages); |
2748 ReadSmsStoreL(socket, messages); |
2446 ReadSmsStoreL(socket, messages); |
2768 |
2466 |
2769 //Delete concatenated msg that has one pdu missing and pdus are in different order |
2467 //Delete concatenated msg that has one pdu missing and pdus are in different order |
2770 message = messages[0]; |
2468 message = messages[0]; |
2771 ret = DeleteSmsL(*message, socket); |
2469 ret = DeleteSmsL(*message, socket); |
2772 TEST(ret == KErrNone); |
2470 TEST(ret == KErrNone); |
2773 |
|
2774 messages.ResetAndDestroy(); |
2471 messages.ResetAndDestroy(); |
2775 |
2472 |
2776 ReadSmsStoreL(socket, messages); |
2473 ReadSmsStoreL(socket, messages); |
2777 |
|
2778 TEST(messages.Count() == 4); |
2474 TEST(messages.Count() == 4); |
2779 |
2475 |
2780 CleanupStack::PopAndDestroy(&messages); |
2476 CleanupStack::PopAndDestroy(&messages); |
2781 CleanupStack::PopAndDestroy(&socket); |
2477 CleanupStack::PopAndDestroy(&socket); |
2782 CleanupStack::PopAndDestroy(&socketServer); |
2478 return TestStepResult() ; |
2783 |
2479 } |
2784 return TestStepResult() ; |
|
2785 } |
|
2786 |
|
2787 |
2480 |
2788 TVerdict CTestRxCphs::doTestStepL() |
2481 TVerdict CTestRxCphs::doTestStepL() |
2789 /** |
2482 /** |
2790 * Test the reception of a CPHS Message Waiting Indication |
2483 * Test the reception of a CPHS Message Waiting Indication |
2791 */ |
2484 */ |
2792 { |
2485 { |
2793 INFO_PRINTF1(_L("Test Rx Message Waiting Cphs")); |
2486 INFO_PRINTF1(_L("Test Rx Message Waiting Cphs")); |
2794 |
2487 // Open the socket for Address Message Indications |
2795 RSocketServ socketServer; |
|
2796 PrepareRegTestLC(socketServer, 30); |
|
2797 |
|
2798 |
|
2799 // Open the socket for SIM operations |
|
2800 RSocket socket; |
2488 RSocket socket; |
2801 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrMessageIndication); |
2489 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrMessageIndication); |
2802 |
2490 |
2803 INFO_PRINTF1(_L("...waiting for incoming Message Waiting Indicator Cphs...") ); |
2491 INFO_PRINTF1(_L("...waiting for incoming Message Waiting Indicator Cphs...") ); |
2804 WaitForRecvL(socket); |
2492 WaitForRecvL(socket); |
2805 CSmsMessage* smsMessage = RecvSmsL(socket); |
2493 CSmsMessage* smsMessage = RecvSmsL(socket); |
2806 CleanupStack::PushL(smsMessage); |
2494 CleanupStack::PushL(smsMessage); |
2815 TEST(( address.iTypeOfAddress.TON() == EGsmSmsTONAlphaNumeric)); |
2503 TEST(( address.iTypeOfAddress.TON() == EGsmSmsTONAlphaNumeric)); |
2816 TEST(( address.iTelNumber.Length()==4)); |
2504 TEST(( address.iTelNumber.Length()==4)); |
2817 TEST(((address.iTelNumber[2] & 0x7E) == 0x10)); |
2505 TEST(((address.iTelNumber[2] & 0x7E) == 0x10)); |
2818 TEST(((address.iTelNumber[3] & 0x7E) == 0x00)); |
2506 TEST(((address.iTelNumber[3] & 0x7E) == 0x00)); |
2819 |
2507 |
2820 |
|
2821 //test for the user data: space and then free-format text |
2508 //test for the user data: space and then free-format text |
2822 _LIT(KTestSingleSpace," "); |
2509 _LIT(KTestSingleSpace," "); |
2823 TestSmsContentsL(smsMessage,KTestSingleSpace); |
2510 TestSmsContentsL(smsMessage,KTestSingleSpace); |
2824 INFO_PRINTF1(_L("Successful Match of Message Waiting Indicator Cphs") ); |
2511 INFO_PRINTF1(_L("Successful Match of Message Waiting Indicator Cphs") ); |
2825 |
2512 |
2826 CleanupStack::PopAndDestroy(2); // socket, smsMessage |
2513 CleanupStack::PopAndDestroy(2, &socket); // socket, smsMessage |
2827 CleanupStack::PopAndDestroy(&socketServer); |
2514 return TestStepResult() ; |
2828 |
2515 } |
2829 return TestStepResult() ; |
|
2830 } |
|
2831 |
|
2832 |
2516 |
2833 TVerdict CTestInvalidPDUs::doTestStepL() |
2517 TVerdict CTestInvalidPDUs::doTestStepL() |
2834 /** |
2518 /** |
2835 * Test receiving invalid pdus. |
2519 * Test receiving invalid pdus. |
2836 * See tsmsprt_config.txt for definition of pdus. |
2520 * See tsmsprt_config.txt for definition of pdus. |
2837 */ |
2521 */ |
2838 { |
2522 { |
2839 INFO_PRINTF1(_L("Test receiving invalid pdus")); |
2523 INFO_PRINTF1(_L("Test receiving invalid pdus")); |
2840 |
|
2841 RSocketServ socketServer; |
|
2842 PrepareRegTestLC(socketServer, 31); |
|
2843 |
|
2844 |
|
2845 RSocket socket; |
2524 RSocket socket; |
2846 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2525 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2847 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2526 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2848 _LIT(KTestMsg2,"Voicemail waiting"); |
2527 _LIT(KTestMsg2,"Voicemail waiting"); |
2849 |
2528 |
2850 CSmsMessage* smsMessage = NULL; |
2529 CSmsMessage* smsMessage = NULL; |
2851 TInt i(1); |
2530 TInt i(1); |
2853 while (i<17)//16 of the PDUs in tsmsprt_config.txt test31 |
2532 while (i<17)//16 of the PDUs in tsmsprt_config.txt test31 |
2854 { //should be decoded successfully into CSmsMessages |
2533 { //should be decoded successfully into CSmsMessages |
2855 INFO_PRINTF2(_L("waiting for incoming SMS No. %d..."), i); |
2534 INFO_PRINTF2(_L("waiting for incoming SMS No. %d..."), i); |
2856 WaitForRecvL(socket); |
2535 WaitForRecvL(socket); |
2857 smsMessage = RecvSmsL(socket); |
2536 smsMessage = RecvSmsL(socket); |
2858 |
|
2859 INFO_PRINTF1(_L("incoming SMS") ); |
|
2860 CleanupStack::PushL(smsMessage); |
2537 CleanupStack::PushL(smsMessage); |
2861 |
2538 |
2862 if (i!=10 && i!= 16) |
2539 if (i!=10 && i!= 16) |
2863 PrintMessageL(smsMessage); |
2540 PrintMessageL(smsMessage); |
2864 |
2541 |
2865 if (i!=4 && i!= 10 && i!=12 && i<14) |
2542 if (i!=4 && i!= 10 && i!=12 && i<14) |
2866 TestSmsContentsL(smsMessage,KTestMsg1); |
2543 TestSmsContentsL(smsMessage,KTestMsg1); |
2867 if (i==12) |
2544 if (i==12) |
2868 TestSmsContentsL(smsMessage, KTestMsg2); |
2545 TestSmsContentsL(smsMessage, KTestMsg2); |
2869 CleanupStack::PopAndDestroy(smsMessage); |
2546 CleanupStack::PopAndDestroy(smsMessage); |
2870 i++; |
2547 ++i; |
2871 } |
2548 } |
2872 |
2549 |
2873 CleanupStack::PopAndDestroy(&socket); |
2550 CleanupStack::PopAndDestroy(&socket); |
2874 CleanupStack::PopAndDestroy(&socketServer); |
2551 return TestStepResult() ; |
2875 |
2552 } |
2876 return TestStepResult() ; |
|
2877 } |
|
2878 |
|
2879 |
2553 |
2880 TVerdict CTestStress::doTestStepL() |
2554 TVerdict CTestStress::doTestStepL() |
2881 /** |
2555 /** |
2882 * Test Transmit and Receive large number of different messages |
2556 * Test Transmit and Receive large number of different messages |
2883 */ |
2557 */ |
2884 { |
2558 { |
2885 INFO_PRINTF1(_L("Test Tx and Rx large number of messages")); |
2559 INFO_PRINTF1(_L("Test Tx and Rx large number of messages")); |
2886 |
|
2887 RSocketServ socketServer; |
|
2888 PrepareRegTestLC(socketServer, 32); |
|
2889 |
|
2890 |
|
2891 RSocket socket; |
2560 RSocket socket; |
2892 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2561 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
2893 |
2562 |
2894 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2563 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
2895 |
2564 |
2896 //Set destination and SC numbers |
2565 //Set destination and SC numbers |
2897 iTelephoneNumber=KPekka; |
2566 iTelephoneNumber=KPekka; |
2898 iServiceCenterNumber=KRadiolinjaSC; |
2567 iServiceCenterNumber=KRadiolinjaSC; |
2899 |
2568 |
2900 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
2569 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
2901 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
2570 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
2902 CleanupStack::PushL(smsMessage); |
|
2903 |
2571 |
2904 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
2572 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
2905 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
2573 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
2906 |
2574 |
2907 INFO_PRINTF1(_L("Send large number of messages")); |
2575 INFO_PRINTF1(_L("Send large number (20) of messages")); |
2908 |
2576 |
2909 TInt i(0); |
2577 TInt i(0); |
2910 //Send SMSes |
|
2911 while (i<20) |
2578 while (i<20) |
2912 { |
2579 { |
2913 SendSmsL(smsMessage,socket); |
2580 SendSmsL(smsMessage,socket); |
2914 i++; |
2581 ++i; |
2915 } |
2582 } |
2916 |
2583 |
2917 CleanupStack::PopAndDestroy(smsMessage); |
2584 CleanupStack::PopAndDestroy(smsMessage); |
2918 |
2585 |
2919 INFO_PRINTF1(_L("Receive large number of messages")); |
2586 INFO_PRINTF1(_L("Receive large number (20) of messages")); |
2920 //Receive SMSes |
|
2921 while (i!=0) |
2587 while (i!=0) |
2922 { |
2588 { |
2923 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
2924 WaitForRecvL(socket); |
2589 WaitForRecvL(socket); |
2925 smsMessage = RecvSmsL(socket); |
2590 smsMessage = RecvSmsL(socket); |
2926 |
|
2927 INFO_PRINTF1(_L("incoming SMS") ); |
|
2928 |
|
2929 CleanupStack::PushL(smsMessage); |
2591 CleanupStack::PushL(smsMessage); |
2592 |
|
2930 TestSmsContentsL(smsMessage,KTestMsg1); |
2593 TestSmsContentsL(smsMessage,KTestMsg1); |
2931 CleanupStack::PopAndDestroy(smsMessage); |
2594 CleanupStack::PopAndDestroy(smsMessage); |
2932 i--; |
2595 --i; |
2933 } |
2596 } |
2934 |
2597 |
2935 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
2598 _LIT(KTest7bitMsg,"test message, length 23"); //7 bits test message, length 23 characters |
2936 |
2599 |
2937 //Set destination and SC numbers |
2600 //Set destination and SC numbers |
2938 iTelephoneNumber=KPekka; |
2601 iTelephoneNumber=KPekka; |
2939 iServiceCenterNumber=KSoneraSC; |
2602 iServiceCenterNumber=KSoneraSC; |
2940 |
2603 |
2941 alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
2604 alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
2942 smsMessage=CreateSmsMessageL(KTest7bitMsg,alphabet); |
2605 smsMessage=CreateSmsMessageLC(KTest7bitMsg,alphabet); |
2943 CleanupStack::PushL(smsMessage); |
|
2944 |
2606 |
2945 //Set status report request |
2607 //Set status report request |
2946 CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU(); |
2608 CSmsSubmit& submitPdu=(CSmsSubmit&)smsMessage->SmsPDU(); |
2947 submitPdu.SetStatusReportRequest(ETrue); |
2609 submitPdu.SetStatusReportRequest(ETrue); |
2948 |
2610 |
2949 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
2611 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
2950 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
2612 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
2951 |
2613 |
2952 INFO_PRINTF1(_L("Send large number of messages")); |
2614 INFO_PRINTF1(_L("Send large number (40) of messages")); |
2953 //Send SMSes |
|
2954 while (i<40) |
2615 while (i<40) |
2955 { |
2616 { |
2956 SendSmsL(smsMessage,socket); |
2617 SendSmsL(smsMessage,socket); |
2957 i++; |
2618 ++i; |
2958 } |
2619 } |
2959 CleanupStack::PopAndDestroy(smsMessage); |
2620 CleanupStack::PopAndDestroy(smsMessage); |
2960 |
2621 |
2961 //Receive status report |
2622 //Receive status report |
2962 TSmsServiceCenterAddress telephoneNumber(KPekka); |
2623 TSmsServiceCenterAddress telephoneNumber(KPekka); |
2963 |
2624 |
2964 INFO_PRINTF1(_L("Receive large number of messages")); |
2625 INFO_PRINTF1(_L("Receive large number (40) of messages")); |
2965 //Receive SMSes |
|
2966 while (i!=0) |
2626 while (i!=0) |
2967 { |
2627 { |
2968 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
2969 WaitForRecvL(socket); |
2628 WaitForRecvL(socket); |
2970 smsMessage = RecvSmsL(socket); |
2629 smsMessage = RecvSmsL(socket); |
2971 |
|
2972 INFO_PRINTF1(_L("incoming SMS") ); |
|
2973 |
|
2974 CleanupStack::PushL(smsMessage); |
2630 CleanupStack::PushL(smsMessage); |
2631 |
|
2975 TestSmsContentsL(smsMessage,KTest7bitMsg); |
2632 TestSmsContentsL(smsMessage,KTest7bitMsg); |
2976 CleanupStack::PopAndDestroy(smsMessage); |
2633 CleanupStack::PopAndDestroy(smsMessage); |
2977 i--; |
2634 --i; |
2978 //Receive status report |
2635 //Receive status report |
2979 RecvStatusReportL(telephoneNumber, socket); |
2636 RecvStatusReportL(telephoneNumber, socket); |
2980 } |
2637 } |
2981 |
2638 |
2982 //Tx and rx concatenated message & status report |
2639 //Tx and rx concatenated message & status report |
2983 _LIT(KLongText,"3 PDU test SMS message. " |
2640 _LIT(KLongText,"3 PDU test SMS message. " |
2984 L"3 PDU test SMS message. " |
2641 L"3 PDU test SMS message. " |
2985 L"3 PDU test SMS message. " |
2642 L"3 PDU test SMS message. " |
2986 L"3 PDU test SMS message. " |
2643 L"3 PDU test SMS message. " |
2987 L"3 PDU test SMS message. " |
2644 L"3 PDU test SMS message. " |
2988 L"3 PDU test SMS message. " |
2645 L"3 PDU test SMS message. " |
2989 L"3 PDU test SMS message. " |
2646 L"3 PDU test SMS message. " |
2990 L"3 PDU test SMS message. " |
2647 L"3 PDU test SMS message. " |
2991 L"3 PDU test SMS message. " |
2648 L"3 PDU test SMS message. " |
2992 L"3 PDU test SMS message. " |
2649 L"3 PDU test SMS message. " |
2993 L"3 PDU test SMS message. " |
2650 L"3 PDU test SMS message. " |
2994 L"3 PDU test SMS message. " |
2651 L"3 PDU test SMS message. " |
2995 L"3 PDU test SMS message. " |
2652 L"3 PDU test SMS message. " |
2996 L"3 PDU test SMS message. " |
2653 L"3 PDU test SMS message. " |
2997 L"3 PDU test SMS message. " |
2654 L"3 PDU test SMS message. " |
2998 L"3 PDU test SMS message. " |
2655 L"3 PDU test SMS message. " |
2999 L"3 PDU test SMS message. " |
2656 L"3 PDU test SMS message. " |
3000 L"The End."); |
2657 L"The End."); |
3001 |
2658 |
3002 //Set destination and SC numbers |
2659 //Set destination and SC numbers |
3003 iTelephoneNumber=KRegTestNumber; |
2660 iTelephoneNumber=KRegTestNumber; |
3004 iServiceCenterNumber=KVodafoneSC; |
2661 iServiceCenterNumber=KVodafoneSC; |
3005 |
2662 |
3010 INFO_PRINTF1(_L("Send concatenated message")); |
2667 INFO_PRINTF1(_L("Send concatenated message")); |
3011 SendSmsL(smsMessage,socket); |
2668 SendSmsL(smsMessage,socket); |
3012 CleanupStack::PopAndDestroy(smsMessage); |
2669 CleanupStack::PopAndDestroy(smsMessage); |
3013 |
2670 |
3014 INFO_PRINTF1(_L("Recv concatenated message and status report")); |
2671 INFO_PRINTF1(_L("Recv concatenated message and status report")); |
3015 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
3016 WaitForRecvL(socket); |
2672 WaitForRecvL(socket); |
3017 smsMessage = RecvSmsL(socket); |
2673 smsMessage = RecvSmsL(socket); |
3018 |
|
3019 INFO_PRINTF1(_L("incoming SMS") ); |
|
3020 |
|
3021 CleanupStack::PushL(smsMessage); |
2674 CleanupStack::PushL(smsMessage); |
2675 |
|
3022 TestSmsContentsL(smsMessage,KLongText); |
2676 TestSmsContentsL(smsMessage,KLongText); |
3023 CleanupStack::PopAndDestroy(smsMessage); |
2677 CleanupStack::PopAndDestroy(smsMessage); |
3024 |
2678 |
3025 telephoneNumber.Copy( KRegTestNumber ); |
2679 telephoneNumber.Copy( KRegTestNumber ); |
3026 RecvStatusReportL(telephoneNumber, socket); |
2680 RecvStatusReportL(telephoneNumber, socket); |
3027 |
2681 |
3028 //Tx and rx longer concatenated message & status report |
2682 //Tx and rx longer concatenated message & status report |
3029 _LIT(KLongText2,"7 PDU test SMS message. " |
2683 _LIT(KLongText2,"7 PDU test SMS message. " |
3030 L"7 PDU test SMS message. " |
2684 L"7 PDU test SMS message. " |
3031 L"7 PDU test SMS message. " |
2685 L"7 PDU test SMS message. " |
3032 L"7 PDU test SMS message. " |
2686 L"7 PDU test SMS message. " |
3033 L"7 PDU test SMS message. " |
2687 L"7 PDU test SMS message. " |
3034 L"7 PDU test SMS message. " |
2688 L"7 PDU test SMS message. " |
3035 L"7 PDU test SMS message. " |
2689 L"7 PDU test SMS message. " |
3036 L"7 PDU test SMS message. " |
2690 L"7 PDU test SMS message. " |
3037 L"7 PDU test SMS message. " |
2691 L"7 PDU test SMS message. " |
3038 L"7 PDU test SMS message. " |
2692 L"7 PDU test SMS message. " |
3039 L"7 PDU test SMS message. " |
2693 L"7 PDU test SMS message. " |
3040 L"7 PDU test SMS message. " |
2694 L"7 PDU test SMS message. " |
3041 L"7 PDU test SMS message. " |
2695 L"7 PDU test SMS message. " |
3042 L"7 PDU test SMS message. " |
2696 L"7 PDU test SMS message. " |
3043 L"7 PDU test SMS message. " |
2697 L"7 PDU test SMS message. " |
3044 L"7 PDU test SMS message. " |
2698 L"7 PDU test SMS message. " |
3045 L"7 PDU test SMS message. " |
2699 L"7 PDU test SMS message. " |
3046 L"7 PDU test SMS message. " |
2700 L"7 PDU test SMS message. " |
3047 L"7 PDU test SMS message. " |
2701 L"7 PDU test SMS message. " |
3048 L"7 PDU test SMS message. " |
2702 L"7 PDU test SMS message. " |
3049 L"7 PDU test SMS message. " |
2703 L"7 PDU test SMS message. " |
3050 L"7 PDU test SMS message. " |
2704 L"7 PDU test SMS message. " |
3051 L"7 PDU test SMS message. " |
2705 L"7 PDU test SMS message. " |
3052 L"7 PDU test SMS message. " |
2706 L"7 PDU test SMS message. " |
3053 L"7 PDU test SMS message. " |
2707 L"7 PDU test SMS message. " |
3054 L"7 PDU test SMS message. " |
2708 L"7 PDU test SMS message. " |
3055 L"7 PDU test SMS message. " |
2709 L"7 PDU test SMS message. " |
3056 L"7 PDU test SMS message. " |
2710 L"7 PDU test SMS message. " |
3057 L"7 PDU test SMS message. " |
2711 L"7 PDU test SMS message. " |
3058 L"7 PDU test SMS message. " |
2712 L"7 PDU test SMS message. " |
3059 L"7 PDU test SMS message. " |
2713 L"7 PDU test SMS message. " |
3060 L"7 PDU test SMS message. " |
2714 L"7 PDU test SMS message. " |
3061 L"7 PDU test SMS message. " |
2715 L"7 PDU test SMS message. " |
3062 L"7 PDU test SMS message. " |
2716 L"7 PDU test SMS message. " |
3063 L"The End."); |
2717 L"The End."); |
3064 |
2718 |
3065 //Set destination and SC numbers |
2719 //Set destination and SC numbers |
3066 iTelephoneNumber=KPekka; |
2720 iTelephoneNumber=KPekka; |
3067 iServiceCenterNumber=KVodafoneSC; |
2721 iServiceCenterNumber=KVodafoneSC; |
3068 |
2722 |
3069 alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
2723 alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
3070 smsMessage=CreateSmsWithStatusReportReqL(KLongText2,alphabet); |
2724 smsMessage=CreateSmsWithStatusReportReqL(KLongText2,alphabet); |
3071 |
|
3072 CleanupStack::PushL(smsMessage); |
2725 CleanupStack::PushL(smsMessage); |
2726 |
|
3073 INFO_PRINTF1(_L("Send concatenated message")); |
2727 INFO_PRINTF1(_L("Send concatenated message")); |
3074 SendSmsL(smsMessage,socket); |
2728 SendSmsL(smsMessage,socket); |
3075 CleanupStack::PopAndDestroy(smsMessage); |
2729 CleanupStack::PopAndDestroy(smsMessage); |
3076 |
2730 |
3077 INFO_PRINTF1(_L("Recv concatenated message and status report")); |
2731 INFO_PRINTF1(_L("Recv concatenated message and status report")); |
3078 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
3079 WaitForRecvL(socket); |
2732 WaitForRecvL(socket); |
3080 smsMessage = RecvSmsL(socket); |
2733 smsMessage = RecvSmsL(socket); |
3081 |
|
3082 INFO_PRINTF1(_L("incoming SMS") ); |
|
3083 |
|
3084 CleanupStack::PushL(smsMessage); |
2734 CleanupStack::PushL(smsMessage); |
2735 |
|
3085 TestSmsContentsL(smsMessage,KLongText2); |
2736 TestSmsContentsL(smsMessage,KLongText2); |
3086 |
2737 |
3087 telephoneNumber.Copy( KPekka ); |
2738 telephoneNumber.Copy( KPekka ); |
3088 RecvStatusReportL(telephoneNumber, socket); |
2739 RecvStatusReportL(telephoneNumber, socket); |
3089 |
2740 |
3123 (dateTime.Second() != 18))) |
2774 (dateTime.Second() != 18))) |
3124 TEST(KErrArgument); |
2775 TEST(KErrArgument); |
3125 |
2776 |
3126 CleanupStack::PopAndDestroy(logEvent); |
2777 CleanupStack::PopAndDestroy(logEvent); |
3127 CleanupStack::PopAndDestroy(smsMessage); |
2778 CleanupStack::PopAndDestroy(smsMessage); |
3128 |
|
3129 CleanupStack::PopAndDestroy(&socket); |
2779 CleanupStack::PopAndDestroy(&socket); |
3130 CleanupStack::PopAndDestroy(&socketServer); |
|
3131 |
|
3132 return TestStepResult() ; |
2780 return TestStepResult() ; |
3133 } |
2781 } |
3134 |
2782 |
3135 |
|
3136 TVerdict CTestCombinedStore::doTestStepL() |
2783 TVerdict CTestCombinedStore::doTestStepL() |
3137 /** |
2784 /** |
3138 * Test combined store. |
2785 * Test combined store. |
3139 */ |
2786 */ |
3140 { |
2787 { |
3141 INFO_PRINTF1(_L("Test Combined SMS Store")); |
2788 INFO_PRINTF1(_L("Test Combined SMS Store")); |
3142 |
|
3143 RSocketServ socketServer; |
|
3144 PrepareRegTestLC(socketServer, 33); |
|
3145 |
|
3146 |
|
3147 // Open the socket for SIM operations |
2789 // Open the socket for SIM operations |
3148 RSocket socket; |
2790 RSocket socket; |
3149 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
2791 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrLocalOperation); |
3150 |
2792 |
3151 // Enumerate messages. Concatenated message with constituent PDUs is stored to the SIM, Phone store and |
2793 // Enumerate messages. Concatenated message with constituent PDUs is stored to the SIM, Phone store and |
3152 // Combined store. Also one normal single part message is stored to Combined store. |
2794 // Combined store. Also one normal single part message is stored to Combined store. |
3153 RPointerArray<CSmsMessage> messages; |
2795 RPointerArray<CSmsMessage> messages; |
3154 CleanupResetAndDestroyPushL(messages); |
2796 CleanupResetAndDestroyPushL(messages); |
3176 messages.ResetAndDestroy(); |
2818 messages.ResetAndDestroy(); |
3177 |
2819 |
3178 // Create and write message to the Combined store |
2820 // Create and write message to the Combined store |
3179 _LIT(KStoreMsg1,"Store MSG to combined store"); |
2821 _LIT(KStoreMsg1,"Store MSG to combined store"); |
3180 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
2822 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
3181 CSmsMessage* smsmessage1=CreateSmsMessageL(KStoreMsg1,alphabet); |
2823 CSmsMessage* smsmessage1=CreateSmsMessageLC(KStoreMsg1,alphabet); |
3182 CleanupStack::PushL(smsmessage1); |
|
3183 smsmessage1->SetStorage(CSmsMessage::ESmsCombinedStorage); |
2824 smsmessage1->SetStorage(CSmsMessage::ESmsCombinedStorage); |
3184 WriteSmsToSimL(*smsmessage1, socket); |
2825 WriteSmsToSimL(*smsmessage1, socket); |
3185 |
2826 |
3186 // Create and write concatenated message to the Combined store |
2827 // Create and write concatenated message to the Combined store |
3187 _LIT(KStoreMsg2,"3 PDU test SMS message. " |
2828 _LIT(KStoreMsg2,"3 PDU test SMS message. " |
3188 L"3 PDU test SMS message. " |
2829 L"3 PDU test SMS message. " |
3189 L"3 PDU test SMS message. " |
2830 L"3 PDU test SMS message. " |
3190 L"3 PDU test SMS message. " |
2831 L"3 PDU test SMS message. " |
3191 L"3 PDU test SMS message. " |
2832 L"3 PDU test SMS message. " |
3192 L"3 PDU test SMS message. " |
2833 L"3 PDU test SMS message. " |
3193 L"3 PDU test SMS message. " |
2834 L"3 PDU test SMS message. " |
3194 L"3 PDU test SMS message. " |
2835 L"3 PDU test SMS message. " |
3195 L"3 PDU test SMS message. " |
2836 L"3 PDU test SMS message. " |
3196 L"3 PDU test SMS message. " |
2837 L"3 PDU test SMS message. " |
3197 L"3 PDU test SMS message. " |
2838 L"3 PDU test SMS message. " |
3198 L"3 PDU test SMS message. " |
2839 L"3 PDU test SMS message. " |
3199 L"3 PDU test SMS message. " |
2840 L"3 PDU test SMS message. " |
3200 L"3 PDU test SMS message. " |
2841 L"3 PDU test SMS message. " |
3201 L"3 PDU test SMS message. " |
2842 L"3 PDU test SMS message. " |
3202 L"3 PDU test SMS message. " |
2843 L"3 PDU test SMS message. " |
3203 L"3 PDU test SMS message. " |
2844 L"3 PDU test SMS message. " |
3204 L"The End."); |
2845 L"The End."); |
3205 CSmsMessage* smsmessage2=CreateSmsMessageL(KStoreMsg2,alphabet); |
2846 CSmsMessage* smsmessage2=CreateSmsMessageLC(KStoreMsg2,alphabet); |
3206 CleanupStack::PushL(smsmessage2); |
|
3207 smsmessage2->SetStorage(CSmsMessage::ESmsCombinedStorage); |
2847 smsmessage2->SetStorage(CSmsMessage::ESmsCombinedStorage); |
3208 WriteSmsToSimL(*smsmessage2, socket); |
2848 WriteSmsToSimL(*smsmessage2, socket); |
3209 |
2849 |
3210 // Read all message and check store info |
2850 // Read all message and check store info |
3211 ReadSmsStoreL(socket, messages); |
2851 ReadSmsStoreL(socket, messages); |
3225 |
2865 |
3226 // Read messages and check that message store is empty |
2866 // Read messages and check that message store is empty |
3227 ReadSmsStoreL(socket, messages); |
2867 ReadSmsStoreL(socket, messages); |
3228 TEST(messages.Count()==0); |
2868 TEST(messages.Count()==0); |
3229 |
2869 |
3230 CleanupStack::PopAndDestroy(4); //socket, messages, smsmessage1, smsmessage2 |
2870 CleanupStack::PopAndDestroy(4, &socket); //socket, messages, smsmessage1, smsmessage2 |
3231 CleanupStack::PopAndDestroy(&socketServer); |
2871 return TestStepResult() ; |
3232 |
2872 } |
3233 return TestStepResult() ; |
|
3234 } |
|
3235 |
|
3236 |
2873 |
3237 TVerdict CTestParamsInter::doTestStepL() |
2874 TVerdict CTestParamsInter::doTestStepL() |
3238 /** |
2875 /** |
3239 * Test retrieving and storing the sms parameters. |
2876 * Test retrieving and storing the sms parameters. |
3240 * Data tests: GT83-T_SmsInter-015 ... GT83-T_SmsInter-022 |
2877 * Data tests: GT83-T_SmsInter-015 ... GT83-T_SmsInter-022 |
3241 */ |
2878 */ |
3242 { |
2879 { |
3243 INFO_PRINTF1(_L("Parameter storage data testing")); |
2880 INFO_PRINTF1(_L("Parameter storage data testing")); |
3244 |
|
3245 RSocketServ socketServer; |
|
3246 PrepareRegTestLC(socketServer, 34); |
|
3247 |
|
3248 |
|
3249 TInt ret(KErrNone); |
2881 TInt ret(KErrNone); |
3250 TRequestStatus status; |
2882 TRequestStatus status; |
3251 |
2883 |
3252 // |
2884 // |
3253 // Retrieve SMS parameters |
2885 // Retrieve SMS parameters |
3254 // |
2886 // |
3255 // Open the socket for SIM operations |
2887 // Open the socket for SIM operations |
3256 RSocket socket; |
2888 RSocket socket; |
3257 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation); |
2889 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrLocalOperation); |
3258 |
2890 |
3259 RSmsSocketReadStream readstream(socket); |
2891 RSmsSocketReadStream readstream(socket); |
3260 |
2892 |
3261 //Create the smspList |
2893 //Create the smspList |
3262 CMobilePhoneSmspList* smspListOriginal = CMobilePhoneSmspList::NewL(); |
2894 CMobilePhoneSmspList* smspListOriginal = CMobilePhoneSmspList::NewL(); |
3276 readstream >> *smspListOriginal; |
2908 readstream >> *smspListOriginal; |
3277 socket.Ioctl(KIoctlCompleteReadSmsParams, status, NULL,KSolSmsProv); |
2909 socket.Ioctl(KIoctlCompleteReadSmsParams, status, NULL,KSolSmsProv); |
3278 User::WaitForRequest(status); |
2910 User::WaitForRequest(status); |
3279 TEST(status.Int() == KErrNone); |
2911 TEST(status.Int() == KErrNone); |
3280 |
2912 |
3281 // |
2913 // |
3282 // Store SMS parameters |
2914 // Store SMS parameters |
3283 // |
2915 // |
3284 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
2916 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
3285 CleanupStack::PushL(smspList); |
2917 CleanupStack::PushL(smspList); |
3286 |
2918 |
3287 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
2919 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy; |
3288 |
2920 |
3351 |
2983 |
3352 // Write parameter list to the stream and make write SMS parameters request to the SMS Stack. |
2984 // Write parameter list to the stream and make write SMS parameters request to the SMS Stack. |
3353 ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
2985 ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
3354 TEST(ret == KErrNone); |
2986 TEST(ret == KErrNone); |
3355 |
2987 |
3356 // |
2988 // |
3357 // Retrieve SMS parameters again |
2989 // Retrieve SMS parameters again |
3358 // |
2990 // |
3359 CMobilePhoneSmspList* smspList2=CMobilePhoneSmspList::NewL(); |
2991 CMobilePhoneSmspList* smspList2=CMobilePhoneSmspList::NewL(); |
3360 CleanupStack::PushL(smspList2); |
2992 CleanupStack::PushL(smspList2); |
3361 |
2993 |
3362 // Now read SMS parameters |
2994 // Now read SMS parameters |
3363 socket.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
2995 socket.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
3374 ret = iSmsStackTestUtils->TestParameters(*smspList,*smspList2); |
3006 ret = iSmsStackTestUtils->TestParameters(*smspList,*smspList2); |
3375 TEST(ret == KErrNone); |
3007 TEST(ret == KErrNone); |
3376 |
3008 |
3377 CleanupStack::PopAndDestroy(2); //smspList,smspList2 |
3009 CleanupStack::PopAndDestroy(2); //smspList,smspList2 |
3378 |
3010 |
3379 // |
3011 // |
3380 // Store original SMS parameters to the SIM |
3012 // Store original SMS parameters to the SIM |
3381 // |
3013 // |
3382 |
3014 |
3383 INFO_PRINTF1(_L("storing the original SMS parameters...") ); |
3015 INFO_PRINTF1(_L("storing the original SMS parameters...") ); |
3384 |
3016 |
3385 // Make Write SMS Parameters request |
3017 // Make Write SMS Parameters request |
3386 ret = iSmsStackTestUtils->StoreParamsL(*smspListOriginal,socket,EFalse); |
3018 ret = iSmsStackTestUtils->StoreParamsL(*smspListOriginal,socket,EFalse); |
3387 TEST(ret == KErrNone); |
3019 TEST(ret == KErrNone); |
3388 |
3020 |
3389 CleanupStack::PopAndDestroy(2); // socket,smspListOriginal |
3021 CleanupStack::PopAndDestroy(2, &socket); // socket,smspListOriginal |
3390 CleanupStack::PopAndDestroy(&socketServer); |
3022 return TestStepResult() ; |
3391 |
3023 } |
3392 return TestStepResult() ; |
|
3393 } |
|
3394 |
|
3395 |
3024 |
3396 TVerdict CTestTxRxAlphanumeric::doTestStepL() |
3025 TVerdict CTestTxRxAlphanumeric::doTestStepL() |
3397 /** |
3026 /** |
3398 * Test a Tx And Rx of messages with alphanumeric dest/orig addresses |
3027 * Test a Tx And Rx of messages with alphanumeric dest/orig addresses |
3399 */ |
3028 */ |
3400 { |
3029 { |
3401 INFO_PRINTF1(_L("Test Tx And Rx SMSes with Alphanumeric originator address")); |
3030 INFO_PRINTF1(_L("Test Tx And Rx SMSes with Alphanumeric originator address")); |
3402 |
|
3403 RSocketServ socketServer; |
|
3404 PrepareRegTestLC(socketServer, 35); |
|
3405 |
|
3406 |
|
3407 RSocket socket; |
3031 RSocket socket; |
3408 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3032 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
3409 |
3033 |
3410 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
3034 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
3411 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
3035 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
3412 CSmsMessage* txSms=NULL; |
3036 CSmsMessage* txSms=NULL; |
3413 CSmsMessage* rxSms=NULL; |
3037 CSmsMessage* rxSms=NULL; |
3429 |
3053 |
3430 while (i<destinationNumbers.Count()) |
3054 while (i<destinationNumbers.Count()) |
3431 { |
3055 { |
3432 iTelephoneNumber=destinationNumbers[i]; |
3056 iTelephoneNumber=destinationNumbers[i]; |
3433 |
3057 |
3434 txSms=CreateSmsMessageL(KTestMsg1,alphabet); |
3058 txSms=CreateSmsMessageLC(KTestMsg1,alphabet); |
3435 CleanupStack::PushL(txSms); |
|
3436 |
3059 |
3437 gsmSmsTelNumber.iTelNumber.Copy(iTelephoneNumber); |
3060 gsmSmsTelNumber.iTelNumber.Copy(iTelephoneNumber); |
3438 |
3061 |
3439 // Type of number is EGsmSmsTONAlphaNumeric |
3062 // Type of number is EGsmSmsTONAlphaNumeric |
3440 gsmSmsTelNumber.iTypeOfAddress.SetTON(EGsmSmsTONAlphaNumeric); |
3063 gsmSmsTelNumber.iTypeOfAddress.SetTON(EGsmSmsTONAlphaNumeric); |
3442 INFO_PRINTF1(_L("Send SMS message. Type of number is EGsmSmsTONAlphaNumeric") ); |
3065 INFO_PRINTF1(_L("Send SMS message. Type of number is EGsmSmsTONAlphaNumeric") ); |
3443 INFO_PRINTF2(_L("Destination number:...[%S]"),&iTelephoneNumber); |
3066 INFO_PRINTF2(_L("Destination number:...[%S]"),&iTelephoneNumber); |
3444 |
3067 |
3445 //Send SMS |
3068 //Send SMS |
3446 if(i!=0) |
3069 if(i!=0) |
3447 SendSmsL(txSms,socket); |
3070 { |
3071 SendSmsL(txSms,socket); |
|
3072 } |
|
3448 else |
3073 else |
3074 { |
|
3449 SendSmsErrorL(txSms,socket); |
3075 SendSmsErrorL(txSms,socket); |
3450 |
3076 } |
3077 |
|
3451 if(i!=0) |
3078 if(i!=0) |
3452 { |
3079 { |
3453 INFO_PRINTF2(_L("waiting for incoming SMS No. %d..."), i); |
3080 INFO_PRINTF2(_L("waiting for incoming SMS No. %d..."), i); |
3454 WaitForRecvL(socket); |
3081 WaitForRecvL(socket); |
3455 rxSms = RecvSmsL(socket); |
3082 rxSms = RecvSmsL(socket); |
3456 |
|
3457 INFO_PRINTF1(_L("incoming SMS") ); |
|
3458 CleanupStack::PushL(rxSms); |
3083 CleanupStack::PushL(rxSms); |
3459 |
3084 |
3460 TestSmsContentsL(rxSms,KTestMsg1); |
3085 TestSmsContentsL(rxSms,KTestMsg1); |
3461 |
3086 |
3462 INFO_PRINTF1(_L("Originator address:...[")); |
3087 INFO_PRINTF1(_L("Originator address:...[")); |
3470 INFO_PRINTF1(_L("]")); |
3095 INFO_PRINTF1(_L("]")); |
3471 |
3096 |
3472 CleanupStack::PopAndDestroy(rxSms); |
3097 CleanupStack::PopAndDestroy(rxSms); |
3473 } |
3098 } |
3474 CleanupStack::PopAndDestroy(txSms); |
3099 CleanupStack::PopAndDestroy(txSms); |
3475 i++; |
3100 ++i; |
3476 } |
3101 } |
3477 |
3102 |
3478 CleanupStack::PopAndDestroy(2); //socket, destinationNumbers |
3103 CleanupStack::PopAndDestroy(2, &socket); //socket, destinationNumbers |
3479 CleanupStack::PopAndDestroy(&socketServer); |
3104 return TestStepResult() ; |
3480 |
3105 } |
3481 return TestStepResult() ; |
|
3482 } |
|
3483 |
|
3484 |
3106 |
3485 TVerdict CTestRxSuspend::doTestStepL() |
3107 TVerdict CTestRxSuspend::doTestStepL() |
3486 /** |
3108 /** |
3487 * Test suspend receiving messages |
3109 * Test suspend receiving messages |
3488 */ |
3110 */ |
3489 { |
3111 { |
3490 const TInt testNumber = 36; |
3112 const TInt testNumber = 36; |
3491 const TInt smsRxCount = KDefaultMaxmumNumberOfCompleteMessagesInReassemblyStore + 1; //< Number of messages that will cause a suspend |
3113 const TInt smsRxCount = KDefaultMaxmumNumberOfCompleteMessagesInReassemblyStore + 1; // Number of messages that will cause a suspend |
3492 |
3114 |
3493 //Add smsRxCount SmsRx tags to c:\config.txt, taking KTSmsPrtConfigFileName as input |
3115 //Add smsRxCount SmsRx tags to c:\config.txt, taking KTSmsPrtConfigFileName as input |
3494 CTestConfig* configFile = CTestConfig::NewLC(iFs, KGmsSmsConfigFileDir, KTSmsPrtConfigFileName); |
3116 CTestConfig* configFile = CTestConfig::NewLC(iFs, KGmsSmsConfigFileDir, KTSmsPrtConfigFileName); |
3495 |
3117 |
3496 TInt i(0); |
3118 TInt i(0); |
3497 for (i = 0; i < smsRxCount; i++) |
3119 for (i = 0; i < smsRxCount; ++i) |
3498 { |
3120 { |
3499 _LIT(KTestRxSuspendMessage, "TestRxSuspendMessage %d"); |
3121 _LIT(KTestRxSuspendMessage, "TestRxSuspendMessage %d"); |
3500 TBuf<32> buf; |
3122 TBuf<32> buf; |
3501 buf.AppendFormat(KTestRxSuspendMessage, i); |
3123 buf.AppendFormat(KTestRxSuspendMessage, i); |
3502 CSmsMessage* message = iSmsStackTestUtils->CreateSmsMessageLC(CSmsPDU::ESmsDeliver, iTelephoneNumber, buf); |
3124 CSmsMessage* message = iSmsStackTestUtils->CreateSmsMessageLC(CSmsPDU::ESmsDeliver, iTelephoneNumber, buf); |
3513 _LIT8(KTestRxSuspendSmsRxPeriod, "SmsRxPeriod"); |
3135 _LIT8(KTestRxSuspendSmsRxPeriod, "SmsRxPeriod"); |
3514 const TInt rxPeriod = section.ItemValue(KTestRxSuspendSmsRxPeriod, 5) + 1; |
3136 const TInt rxPeriod = section.ItemValue(KTestRxSuspendSmsRxPeriod, 5) + 1; |
3515 |
3137 |
3516 CleanupStack::PopAndDestroy(configFile); |
3138 CleanupStack::PopAndDestroy(configFile); |
3517 |
3139 |
3518 RSocketServ socketServer; |
3140 // Set the test number. SIMTSY will re-configure itself |
3519 PrepareRegTestLC(socketServer, testNumber); |
3141 SetSimTSYTestNumberL(testNumber); |
3520 |
3142 |
3521 |
|
3522 RSocket socket; |
3143 RSocket socket; |
3523 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3144 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
3524 |
3145 |
3525 INFO_PRINTF1(_L("Test suspend receiving messages")); |
3146 INFO_PRINTF1(_L("Test suspend receiving messages")); |
3526 |
3147 |
3527 CSmsMessage* smsMessage; |
3148 CSmsMessage* smsMessage; |
3528 for (i = 0; i < smsRxCount; i++) |
3149 for (i = 0; i < smsRxCount; ++i) |
3529 { |
3150 { |
3530 INFO_PRINTF2(_L("%d Waiting for incoming SMS..."), i); |
3151 INFO_PRINTF2(_L("%d Waiting for incoming SMS..."), i); |
3531 WaitForRecvL(socket); |
3152 WaitForRecvL(socket); |
3532 smsMessage = RecvSmsL(socket, KIoctlReadMessageFailed); |
3153 smsMessage = RecvSmsL(socket, KIoctlReadMessageFailed); |
3533 |
3154 CleanupStack::PushL(smsMessage); |
3534 PrintSmsMessage(*smsMessage); |
3155 |
3535 delete smsMessage; |
3156 PrintMessageL(smsMessage); |
3157 CleanupStack::PopAndDestroy(smsMessage); |
|
3536 |
3158 |
3537 INFO_PRINTF3(_L("%d Waiting %d secs for next message"), i, rxPeriod); |
3159 INFO_PRINTF3(_L("%d Waiting %d secs for next message"), i, rxPeriod); |
3538 User::After(rxPeriod * 1000000); |
3160 User::After(rxPeriod * 1000000); |
3539 } |
3161 } |
3540 |
3162 |
3541 for (i = 0; i < smsRxCount; i++) |
3163 for (i = 0; i < smsRxCount; ++i) |
3542 { |
3164 { |
3543 INFO_PRINTF2(_L("%d Waiting for incoming SMS..."), i); |
3165 INFO_PRINTF2(_L("%d Waiting for incoming SMS..."), i); |
3544 WaitForRecvL(socket); |
3166 WaitForRecvL(socket); |
3545 smsMessage = RecvSmsL(socket, KIoctlReadMessageSucceeded); |
3167 smsMessage = RecvSmsL(socket, KIoctlReadMessageSucceeded); |
3546 |
3168 CleanupStack::PushL(smsMessage); |
3547 PrintSmsMessage(*smsMessage); |
3169 |
3548 delete smsMessage; |
3170 PrintMessageL(smsMessage); |
3171 CleanupStack::PopAndDestroy(smsMessage); |
|
3549 } |
3172 } |
3550 |
3173 |
3551 INFO_PRINTF2(_L("Waiting %d secs to see if other (unexpected) message received"), rxPeriod * 3); |
3174 INFO_PRINTF2(_L("Waiting %d secs to see if other (unexpected) message received"), rxPeriod * 3); |
3552 const TBool otherReceived = TimedWaitForRecvL(socket, rxPeriod * 3 * 1000000); |
3175 const TBool otherReceived = TimedWaitForRecvL(socket, rxPeriod * 3 * 1000000); |
3553 |
3176 |
3554 if (otherReceived) |
3177 if (otherReceived) |
3555 { |
3178 { |
3556 INFO_PRINTF1(_L("Unexpected message received:")); |
3179 INFO_PRINTF1(_L("Unexpected message received:")); |
3557 smsMessage = RecvSmsL(socket, KIoctlReadMessageSucceeded); |
3180 smsMessage = RecvSmsL(socket, KIoctlReadMessageSucceeded); |
3558 PrintSmsMessage(*smsMessage); |
3181 CleanupStack::PushL(smsMessage); |
3559 delete smsMessage; |
3182 PrintMessageL(smsMessage); |
3183 CleanupStack::PopAndDestroy(smsMessage); |
|
3560 } |
3184 } |
3561 |
3185 |
3562 TEST(!otherReceived); |
3186 TEST(!otherReceived); |
3563 |
3187 |
3564 CleanupStack::PopAndDestroy(&socket); |
3188 CleanupStack::PopAndDestroy(&socket); |
3565 CleanupStack::PopAndDestroy(&socketServer); |
|
3566 |
|
3567 |
|
3568 return TestStepResult() ; |
3189 return TestStepResult() ; |
3569 } |
3190 } |
3570 |
3191 |
3571 |
|
3572 TVerdict CTestEnumerateCorrupted::doTestStepL() |
3192 TVerdict CTestEnumerateCorrupted::doTestStepL() |
3573 { |
3193 { |
3574 RSocketServ socketServer; |
|
3575 PrepareRegTestLC(socketServer, 37); |
|
3576 |
|
3577 |
|
3578 RSocket socket; |
3194 RSocket socket; |
3579 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3195 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
3580 |
3196 |
3581 // Enumerate messages |
3197 // Enumerate messages |
3582 RPointerArray<CSmsMessage> messages; |
3198 RPointerArray<CSmsMessage> messages; |
3583 CleanupResetAndDestroyPushL(messages); |
3199 CleanupResetAndDestroyPushL(messages); |
3584 ReadSmsStoreL(socket, messages); |
3200 ReadSmsStoreL(socket, messages); |
3587 TEST(numberOfMess==2);//the 3rd message is corrupted and therefore ignored |
3203 TEST(numberOfMess==2);//the 3rd message is corrupted and therefore ignored |
3588 |
3204 |
3589 messages.ResetAndDestroy(); |
3205 messages.ResetAndDestroy(); |
3590 CleanupStack::PopAndDestroy(&messages); |
3206 CleanupStack::PopAndDestroy(&messages); |
3591 CleanupStack::PopAndDestroy(&socket); |
3207 CleanupStack::PopAndDestroy(&socket); |
3592 CleanupStack::PopAndDestroy(&socketServer); |
3208 return TestStepResult() ; |
3593 |
3209 } |
3594 return TestStepResult() ; |
|
3595 } |
|
3596 |
|
3597 |
3210 |
3598 TVerdict CTestCancelling::doTestStepL() |
3211 TVerdict CTestCancelling::doTestStepL() |
3599 { |
3212 { |
3600 /*This test harness has been created to reproduce HOE-573FF6 that has been closed |
3213 /*This test harness has been created to reproduce HOE-573FF6 that has been closed |
3601 This test shows that even if the cancelling operation return KErrCancel, the request is |
3214 This test shows that even if the cancelling operation return KErrCancel, the request is |
3602 still processed |
3215 still processed |
3603 note: the message count will keep increasing as the socket is not emptied |
3216 note: the message count will keep increasing as the socket is not emptied |
3604 */ |
3217 */ |
3605 INFO_PRINTF1(_L("Test Cancelling requests")); |
3218 INFO_PRINTF1(_L("Test Cancelling requests")); |
3606 RSocketServ socketServer; |
|
3607 PrepareRegTestLC(socketServer, 38); |
|
3608 |
|
3609 |
|
3610 RSocket socket; |
3219 RSocket socket; |
3611 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3220 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
3612 |
3221 |
3613 RSocket socket2; |
3222 RSocket socket2; |
3614 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket2,ESmsAddrLocalOperation); |
3223 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket2,ESmsAddrLocalOperation); |
3615 RSmsSocketWriteStream writestream(socket); |
3224 RSmsSocketWriteStream writestream(socket); |
3616 |
3225 |
3617 RPointerArray<CSmsMessage> messages; |
3226 RPointerArray<CSmsMessage> messages; |
3618 CleanupResetAndDestroyPushL(messages); |
3227 CleanupResetAndDestroyPushL(messages); |
3619 |
3228 |
3620 _LIT(KStoreMsg1,"SIM TEST MESSAGE 1"); |
3229 _LIT(KStoreMsg1,"SIM TEST MESSAGE 1"); |
3621 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
3230 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
3622 CSmsMessage* smsmessage=CreateSmsMessageL(KStoreMsg1,alphabet); |
3231 CSmsMessage* smsmessage=CreateSmsMessageLC(KStoreMsg1,alphabet); |
3623 CleanupStack::PushL(smsmessage); |
|
3624 smsmessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
3232 smsmessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
3625 |
3233 |
3626 TPckgBuf<TUint> sbuf; |
3234 TPckgBuf<TUint> sbuf; |
3627 TRequestStatus status; |
3235 TRequestStatus status; |
3628 //*********************************************************** |
3236 |
3629 INFO_PRINTF1(_L("testing cancel send message")); |
3237 INFO_PRINTF1(_L("testing cancel send message")); |
3630 |
3238 |
3631 writestream << *smsmessage; |
3239 writestream << *smsmessage; |
3632 writestream.CommitL(); |
3240 writestream.CommitL(); |
3633 |
3241 |
3634 socket.Ioctl(KIoctlSendSmsMessage,status,&sbuf, KSolSmsProv); |
3242 socket.Ioctl(KIoctlSendSmsMessage,status,&sbuf, KSolSmsProv); |
3635 INFO_PRINTF1(_L("Cancel")); |
3243 INFO_PRINTF1(_L("Cancel send request")); |
3636 socket.CancelIoctl(); |
3244 socket.CancelIoctl(); |
3637 User::WaitForRequest(status); |
3245 User::WaitForRequest(status); |
3638 TEST(status.Int()==KErrCancel); |
3246 TESTCHECK(status.Int(), KErrCancel, "Cancel send request"); |
3639 //need to check here if the message has actually been sent |
3247 //need to check here if the message has actually been sent |
3640 |
3248 |
3641 |
|
3642 //************************************************************ |
|
3643 INFO_PRINTF1(_L("testing cancel Delete message")); |
3249 INFO_PRINTF1(_L("testing cancel Delete message")); |
3644 |
3250 |
3645 ReadSmsStoreL(socket, messages); |
3251 ReadSmsStoreL(socket, messages); |
3646 const CSmsMessage* message = messages[0]; |
3252 const CSmsMessage* message = messages[0]; |
3647 INFO_PRINTF1(_L("Delete message")); |
3253 INFO_PRINTF1(_L("Delete message")); |
3651 |
3257 |
3652 socket.Ioctl(KIoctlDeleteSmsMessage,status,NULL,KSolSmsProv); |
3258 socket.Ioctl(KIoctlDeleteSmsMessage,status,NULL,KSolSmsProv); |
3653 INFO_PRINTF1(_L("Cancel")); |
3259 INFO_PRINTF1(_L("Cancel")); |
3654 User::After(300000); |
3260 User::After(300000); |
3655 socket.CancelIoctl(); |
3261 socket.CancelIoctl(); |
3656 |
|
3657 User::WaitForRequest(status); |
3262 User::WaitForRequest(status); |
3658 TEST(status.Int()==KErrCancel); |
3263 TESTCHECK(status.Int(), KErrCancel, "Cancel delete request"); |
3659 INFO_PRINTF1(_L("Cancel successfully")); |
3264 |
3660 |
|
3661 |
|
3662 //**************************************************** |
|
3663 INFO_PRINTF1(_L("testing cancel write message")); |
3265 INFO_PRINTF1(_L("testing cancel write message")); |
3664 |
3266 |
3665 writestream << *smsmessage; |
3267 writestream << *smsmessage; |
3666 writestream.CommitL(); |
3268 writestream.CommitL(); |
3667 TInt ret; |
3269 TInt ret; |
3671 CleanupStack::PopAndDestroy(smsmessage); |
3273 CleanupStack::PopAndDestroy(smsmessage); |
3672 messages.ResetAndDestroy(); |
3274 messages.ResetAndDestroy(); |
3673 CleanupStack::PopAndDestroy(&messages); |
3275 CleanupStack::PopAndDestroy(&messages); |
3674 CleanupStack::PopAndDestroy(&socket2); |
3276 CleanupStack::PopAndDestroy(&socket2); |
3675 CleanupStack::PopAndDestroy(&socket); |
3277 CleanupStack::PopAndDestroy(&socket); |
3676 CleanupStack::PopAndDestroy(&socketServer); |
|
3677 |
|
3678 return TestStepResult() ; |
3278 return TestStepResult() ; |
3679 } |
3279 } |
3680 |
3280 |
3681 |
|
3682 TVerdict CTestSendAndRecvMsgsWithDifferentTON::doTestStepL() |
3281 TVerdict CTestSendAndRecvMsgsWithDifferentTON::doTestStepL() |
3683 /** |
3282 /** |
3684 * @test Send and receive messages with different type of number |
3283 * @test Send and receive messages with different type of number |
3685 */ |
3284 */ |
3686 { |
3285 { |
3286 // TODO: replace the following two lines with |
|
3287 // in-script commands(copy file, ParseSettingsFromFileL is called from preample) |
|
3687 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3288 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3688 ParseSettingsFromFileL(); |
3289 ParseSettingsFromFileL(); |
3290 |
|
3689 TBool found( ETrue ); |
3291 TBool found( ETrue ); |
3690 TInt count( 0 ); |
3292 TInt count( 0 ); |
3293 |
|
3691 while( found ) |
3294 while( found ) |
3692 { |
3295 { |
3693 //run the test |
3296 //run the test |
3694 found = DoSingleTestCaseL( KTestSendAndRecvMsgsWithDifferentTON, count++ ); |
3297 found = DoSingleTestCaseL( KTestSendAndRecvMsgsWithDifferentTON, count++ ); |
3695 } |
3298 } |
3696 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3299 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3697 return TestStepResult() ; |
3300 return TestStepResult() ; |
3698 } |
3301 } |
3699 |
|
3700 |
3302 |
3701 TVerdict CTestSendAndReceiveIndicatorMsgs::doTestStepL() |
3303 TVerdict CTestSendAndReceiveIndicatorMsgs::doTestStepL() |
3702 { |
3304 { |
3703 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3305 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3704 ParseSettingsFromFileL(); |
3306 ParseSettingsFromFileL(); |
3711 } |
3313 } |
3712 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3314 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3713 return TestStepResult() ; |
3315 return TestStepResult() ; |
3714 } |
3316 } |
3715 |
3317 |
3716 |
|
3717 TVerdict CTestSendRecvMaxLengthMsg::doTestStepL() |
3318 TVerdict CTestSendRecvMaxLengthMsg::doTestStepL() |
3718 { |
3319 { |
3719 INFO_PRINTF1(_L("Sending max length SMS can take a while ... get a cup of coffee or two :-)")); |
3320 INFO_PRINTF1(_L("Sending max length SMS can take a while ... get a cup of coffee or two :-)")); |
3720 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigTxRxMaxMsgFileName); |
3321 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigTxRxMaxMsgFileName); |
3721 |
|
3722 ParseSettingsFromFileL(); |
3322 ParseSettingsFromFileL(); |
3723 |
3323 |
3724 RSocketServ socketServer; |
3324 const TInt testNumber = 42; |
3725 |
3325 SetSimTSYTestNumberL(testNumber); |
3726 PrepareRegTestLC(socketServer, 42); |
|
3727 |
|
3728 |
3326 |
3729 RSocket socket; |
3327 RSocket socket; |
3730 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3328 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
3731 |
3329 |
3732 HBufC* textBuf=HBufC::NewL(39015); |
3330 HBufC* textBuf=HBufC::NewL(39015); |
3733 CleanupStack::PushL(textBuf); |
3331 CleanupStack::PushL(textBuf); |
3734 TPtr textPtr=textBuf->Des(); |
3332 TPtr textPtr=textBuf->Des(); |
3735 TInt i; |
3333 TInt i; |
3736 for(i=0;i<255;i++) |
3334 for(i=0; i<255; ++i) |
3737 { |
3335 { |
3738 textPtr.Append(KText); |
3336 textPtr.Append(KText); |
3739 } |
3337 } |
3740 |
3338 |
3741 SendAndRecvSms7BitL(textPtr,socket); |
3339 SendAndRecvSms7BitL(textPtr,socket); |
3742 |
3340 CleanupStack::PopAndDestroy(2, &socket); // socket, textBuf |
3743 CleanupStack::PopAndDestroy(2); |
|
3744 CleanupStack::PopAndDestroy(&socketServer); |
|
3745 |
3341 |
3746 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3342 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3747 |
|
3748 return TestStepResult() ; |
3343 return TestStepResult() ; |
3749 } |
3344 } |
3750 |
|
3751 |
3345 |
3752 TVerdict CTestSendAndRecvMsgsWithDifferentPID::doTestStepL() |
3346 TVerdict CTestSendAndRecvMsgsWithDifferentPID::doTestStepL() |
3753 /** |
3347 /** |
3754 * @test Send and receive messages with different type of protocol identifier |
3348 * @test Send and receive messages with different type of protocol identifier |
3755 */ |
3349 */ |
3756 { |
3350 { |
3757 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3351 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3758 ParseSettingsFromFileL(); |
3352 ParseSettingsFromFileL(); |
3759 |
3353 |
3760 INFO_PRINTF1(_L("Send and receive messages with different type of TP-PID")); |
3354 INFO_PRINTF1(_L("Send and receive messages with different type of TP-PID")); |
3761 |
3355 |
3762 RSocketServ socketServer; |
3356 const TInt testNumber = 41; |
3763 |
3357 SetSimTSYTestNumberL(testNumber); |
3764 PrepareRegTestLC(socketServer, 41); |
|
3765 |
|
3766 |
3358 |
3767 RSocket sendSocket; |
3359 RSocket sendSocket; |
3768 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,sendSocket,ESmsAddrSendOnly); |
3360 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,sendSocket,ESmsAddrSendOnly); |
3769 |
3361 |
3770 _LIT(KTestMsg,"Test message."); |
3362 _LIT(KTestMsg,"Test message."); |
3771 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
3363 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
3772 CSmsMessage* sendMessage=CreateSmsMessageL(KTestMsg,alphabet); |
3364 CSmsMessage* sendMessage=CreateSmsMessageLC(KTestMsg,alphabet); |
3773 CleanupStack::PushL(sendMessage); |
|
3774 CSmsSubmit& submitPdu=(CSmsSubmit&)sendMessage->SmsPDU(); |
3365 CSmsSubmit& submitPdu=(CSmsSubmit&)sendMessage->SmsPDU(); |
3775 |
3366 |
3776 // TP-PID is telex (or teletex reduced to telex format) |
3367 // TP-PID is telex (or teletex reduced to telex format) |
3777 submitPdu.SetPIDType(TSmsProtocolIdentifier::ESmsPIDTelematicInterworking); |
3368 submitPdu.SetPIDType(TSmsProtocolIdentifier::ESmsPIDTelematicInterworking); |
3778 submitPdu.SetTelematicDeviceIndicator(TSmsProtocolIdentifier::ESmsTelematicDevice); |
3369 submitPdu.SetTelematicDeviceIndicator(TSmsProtocolIdentifier::ESmsTelematicDevice); |
3779 submitPdu.SetTelematicDeviceType(TSmsProtocolIdentifier::ESmsTelex); |
3370 submitPdu.SetTelematicDeviceType(TSmsProtocolIdentifier::ESmsTelex); |
3780 INFO_PRINTF1(_L("Send SMS message. TP-PID is telex (or teletex reduced to telex format)") ); |
3371 INFO_PRINTF1(_L("Send SMS message. TP-PID is telex (or teletex reduced to telex format)") ); |
3781 SendSmsL(sendMessage,sendSocket); |
3372 SendSmsL(sendMessage,sendSocket); |
3782 |
3373 |
3783 RSocket recvSocket; |
3374 RSocket recvSocket; |
3784 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,recvSocket,ESmsAddrRecvAny); |
3375 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,recvSocket,ESmsAddrRecvAny); |
3785 |
3376 |
3786 INFO_PRINTF1(_L("Waiting for incoming SMS...") ); |
|
3787 WaitForRecvL(recvSocket); |
3377 WaitForRecvL(recvSocket); |
3788 CSmsMessage* recvMessage = RecvSmsL(recvSocket); |
3378 CSmsMessage* recvMessage = RecvSmsL(recvSocket); |
3789 CleanupStack::PushL(recvMessage); |
3379 CleanupStack::PushL(recvMessage); |
3790 CSmsDeliver& deliverPdu1=(CSmsDeliver&)recvMessage->SmsPDU(); |
3380 CSmsDeliver& deliverPdu1=(CSmsDeliver&)recvMessage->SmsPDU(); |
3791 |
3381 |
3792 TestSmsContentsL(recvMessage,KTestMsg); |
3382 TestSmsContentsL(recvMessage,KTestMsg); |
3793 TEST(deliverPdu1.PIDType() == submitPdu.PIDType()); |
3383 TEST(deliverPdu1.PIDType() == submitPdu.PIDType()); |
3794 TEST(deliverPdu1.TelematicDeviceIndicator() == submitPdu.TelematicDeviceIndicator()); |
3384 TEST(deliverPdu1.TelematicDeviceIndicator() == submitPdu.TelematicDeviceIndicator()); |
3795 TEST(deliverPdu1.TelematicDeviceType() == submitPdu.TelematicDeviceType()); |
3385 TEST(deliverPdu1.TelematicDeviceType() == submitPdu.TelematicDeviceType()); |
3796 |
3386 |
3797 CleanupStack::PopAndDestroy(2); //recvSocket,recvMessage |
3387 CleanupStack::PopAndDestroy(2, &recvSocket); //recvSocket, recvMessage |
3798 |
3388 |
3799 // TP-PID is Replace Short Message Type 1 |
3389 // TP-PID is Replace Short Message Type 1 |
3800 submitPdu.SetPIDType(TSmsProtocolIdentifier::ESmsPIDShortMessageType); |
3390 submitPdu.SetPIDType(TSmsProtocolIdentifier::ESmsPIDShortMessageType); |
3801 submitPdu.SetShortMessageType(TSmsProtocolIdentifier::ESmsReplaceShortMessageType1); |
3391 submitPdu.SetShortMessageType(TSmsProtocolIdentifier::ESmsReplaceShortMessageType1); |
3802 INFO_PRINTF1(_L("Send SMS message. TP-PID is Replace Short Message Type 1") ); |
3392 INFO_PRINTF1(_L("Send SMS message. TP-PID is Replace Short Message Type 1") ); |
3803 SendSmsL(sendMessage,sendSocket); |
3393 SendSmsL(sendMessage,sendSocket); |
3804 |
3394 |
3805 INFO_PRINTF1(_L("Send another SMS message. TP-PID is Replace Short Message Type 1") ); |
3395 INFO_PRINTF1(_L("Send another SMS message. TP-PID is Replace Short Message Type 1") ); |
3806 SendSmsL(sendMessage,sendSocket); |
3396 SendSmsL(sendMessage,sendSocket); |
3807 |
3397 |
3808 INFO_PRINTF1(_L("Open ESmsAddrRecvAny socket and receive messages") ); |
3398 INFO_PRINTF1(_L("Open ESmsAddrRecvAny socket and receive messages") ); |
3809 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,recvSocket,ESmsAddrRecvAny); |
3399 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,recvSocket,ESmsAddrRecvAny); |
3810 |
3400 |
3811 INFO_PRINTF1(_L("Waiting for incoming SMS...") ); |
3401 INFO_PRINTF1(_L("Waiting for incoming SMS...") ); |
3812 WaitForRecvL(recvSocket); |
3402 WaitForRecvL(recvSocket); |
3813 recvMessage = RecvSmsL(recvSocket); |
3403 recvMessage = RecvSmsL(recvSocket); |
3814 CleanupStack::PushL(recvMessage); |
3404 CleanupStack::PushL(recvMessage); |
3829 INFO_PRINTF1(_L("Waiting for incoming SMS...") );*/ |
3419 INFO_PRINTF1(_L("Waiting for incoming SMS...") );*/ |
3830 |
3420 |
3831 /*I beleive the above is wrong, the sms stack does not care about the PID and just passes the message |
3421 /*I beleive the above is wrong, the sms stack does not care about the PID and just passes the message |
3832 it is up to the applicatio to do that check; therefore the 2 replace messages are received -Pierre*/ |
3422 it is up to the applicatio to do that check; therefore the 2 replace messages are received -Pierre*/ |
3833 |
3423 |
3834 |
|
3835 WaitForRecvL(recvSocket); |
3424 WaitForRecvL(recvSocket); |
3836 recvMessage = RecvSmsL(recvSocket); |
3425 recvMessage = RecvSmsL(recvSocket); |
3837 CleanupStack::PushL(recvMessage); |
3426 CleanupStack::PushL(recvMessage); |
3838 CSmsDeliver& deliverPdu3=(CSmsDeliver&)recvMessage->SmsPDU(); |
3427 CSmsDeliver& deliverPdu3=(CSmsDeliver&)recvMessage->SmsPDU(); |
3839 |
3428 |
3840 TestSmsContentsL(recvMessage,KTestMsg); |
3429 TestSmsContentsL(recvMessage,KTestMsg); |
3841 TEST(deliverPdu3.PIDType() == submitPdu.PIDType()); |
3430 TEST(deliverPdu3.PIDType() == submitPdu.PIDType()); |
3842 TEST(deliverPdu3.ShortMessageType() == submitPdu.ShortMessageType()); |
3431 TEST(deliverPdu3.ShortMessageType() == submitPdu.ShortMessageType()); |
3843 CleanupStack::PopAndDestroy(recvMessage); |
3432 CleanupStack::PopAndDestroy(recvMessage); |
3844 |
3433 |
3845 CleanupStack::PopAndDestroy(3); //socketServer,sendSocket,sendMessage,recvSocket |
3434 CleanupStack::PopAndDestroy(3, &sendSocket); // sendSocket,sendMessage,recvSocket |
3846 CleanupStack::PopAndDestroy(&socketServer); |
3435 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3847 |
|
3848 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
|
3849 return TestStepResult() ; |
3436 return TestStepResult() ; |
3850 } |
3437 } |
3851 |
3438 |
3852 |
3439 TVerdict CTestSmsParamsErrorCases::doTestStepL() |
3853 TVerdict CSmsParamsErrorCases::doTestStepL() |
|
3854 /** |
3440 /** |
3855 * Test SMS parameters while error returned from TSY. |
3441 * Test SMS parameters while error returned from TSY. |
3856 * Manual function moved from t_sms_inter_auto test suite. |
3442 * Manual function moved from t_sms_inter_auto test suite. |
3857 */ |
3443 */ |
3858 { |
3444 { |
3859 INFO_PRINTF1(_L("Test SMS prameters while eror returned from TSY")); |
3445 INFO_PRINTF1(_L("Test SMS prameters while error returned from TSY")); |
3860 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3446 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigExtraFileName); |
3447 |
|
3861 const TInt testNumber = 43; // or any number it reaches |
3448 const TInt testNumber = 43; // or any number it reaches |
3862 CTestConfig* configFile = CTestConfig::NewLC(iFs, KGmsSmsConfigFileDir, KTSmsPrtConfigExtraFileName); |
3449 CTestConfig* configFile = CTestConfig::NewLC(iFs, KGmsSmsConfigFileDir, KTSmsPrtConfigExtraFileName); |
3450 |
|
3863 CTestConfigSection& section = iSmsStackTestUtils->GetSectionL(*configFile, testNumber); |
3451 CTestConfigSection& section = iSmsStackTestUtils->GetSectionL(*configFile, testNumber); |
3864 TInt param = section.ItemValue(KSmspEntryValidParams, 2); |
3452 TInt param = section.ItemValue(KSmspEntryValidParams, 2); |
3453 |
|
3865 RMobileSmsMessaging::TMobileSmspStoreValidParams smspEntryValidParams = ( RMobileSmsMessaging::TMobileSmspStoreValidParams )param; |
3454 RMobileSmsMessaging::TMobileSmspStoreValidParams smspEntryValidParams = ( RMobileSmsMessaging::TMobileSmspStoreValidParams )param; |
3866 param = section.ItemValue(KSmspEntryScTypeOfNumber, 1); |
3455 param = section.ItemValue(KSmspEntryScTypeOfNumber, 1); |
3456 |
|
3867 RMobilePhone::TMobileTON smspEntryScTypeOfNumber = ( RMobilePhone::TMobileTON )param; |
3457 RMobilePhone::TMobileTON smspEntryScTypeOfNumber = ( RMobilePhone::TMobileTON )param; |
3868 param = section.ItemValue(KSmspEntryScNumberPlan, 1); |
3458 param = section.ItemValue(KSmspEntryScNumberPlan, 1); |
3459 |
|
3869 RMobilePhone::TMobileNPI smspEntryScNumberPlan = ( RMobilePhone::TMobileNPI )param; |
3460 RMobilePhone::TMobileNPI smspEntryScNumberPlan = ( RMobilePhone::TMobileNPI )param; |
3870 const TDesC8& smspEntryScTelNumber = section.ItemValue(KServiceCentreAddress, (_L8("+358508771010"))); |
3461 const TDesC8& smspEntryScTelNumber = section.ItemValue(KServiceCentreAddress, (_L8("+358508771010"))); |
3871 |
3462 |
3872 TestSmsParamsErrorCasesL(smspEntryValidParams, smspEntryScTypeOfNumber, smspEntryScNumberPlan, smspEntryScTelNumber); |
3463 TestSmsParamsErrorCasesL(smspEntryValidParams, smspEntryScTypeOfNumber, smspEntryScNumberPlan, smspEntryScTelNumber); |
3464 |
|
3873 CleanupStack::PopAndDestroy(configFile); |
3465 CleanupStack::PopAndDestroy(configFile); |
3874 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3466 iSmsStackTestUtils->CopyConfigFileL(KTSmsPrtConfigFileName); |
3875 return TestStepResult() ; |
3467 return TestStepResult() ; |
3876 } |
3468 } |
3877 |
3469 |
3878 void CSmsParamsErrorCases::TestSmsParamsErrorCasesL( |
3470 void CTestSmsParamsErrorCases::TestSmsParamsErrorCasesL( |
3879 RMobileSmsMessaging::TMobileSmspStoreValidParams aSmspEntryValidParams, |
3471 RMobileSmsMessaging::TMobileSmspStoreValidParams aSmspEntryValidParams, |
3880 RMobilePhone::TMobileTON aSmspEntryScTypeOfNumber, |
3472 RMobilePhone::TMobileTON aSmspEntryScTypeOfNumber, |
3881 RMobilePhone::TMobileNPI aSmspEntryScNumberPlan, |
3473 RMobilePhone::TMobileNPI aSmspEntryScNumberPlan, |
3882 const TDesC8& aSmspEntryScTelNumber) |
3474 const TDesC8& aSmspEntryScTelNumber) |
3883 /** |
3475 /** |
3884 * TSY returns error to retrieve and store requests |
3476 * TSY returns error to retrieve and store requests |
3885 */ |
3477 */ |
3886 { |
3478 { |
3887 INFO_PRINTF1(_L("TSY returns error to retrieve and store SMSP list requests")); |
3479 INFO_PRINTF1(_L("TSY returns error to retrieve and store SMSP list requests")); |
3888 |
3480 |
3889 RSocketServ socketServer; |
3481 const TInt testNumber = 43; |
3890 PrepareRegTestLC(socketServer,43); |
3482 SetSimTSYTestNumberL(testNumber); |
3891 |
3483 |
3892 |
|
3893 RSocket socket; |
3484 RSocket socket; |
3894 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation); |
3485 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrLocalOperation); |
3895 |
3486 |
3896 RSmsSocketReadStream readstream(socket); |
3487 RSmsSocketReadStream readstream(socket); |
3897 TRequestStatus status; |
3488 TRequestStatus status; |
3898 |
3489 |
3899 // |
3490 TBool tryAgain = ETrue; |
3900 //Retrieve SMSP list |
3491 TInt attempts (0); |
3901 // |
3492 TInt maxRetries = 3; |
3902 // Make read SMS params request to the SMS Stack. |
3493 |
3903 socket.Ioctl(KIoctlReadSmsParams,status,NULL, KSolSmsProv); |
3494 // |
3495 //Retrieve SMSP list |
|
3496 // |
|
3497 |
|
3498 // Make read SMS params request to the SMS Stack. If it fails with KErrNotReady wait for 3 seconds to |
|
3499 // allow sms protocol to fully load and repeat |
|
3904 INFO_PRINTF1(_L("Waiting for SMS parameters...") ); |
3500 INFO_PRINTF1(_L("Waiting for SMS parameters...") ); |
3905 User::WaitForRequest(status); |
3501 while( tryAgain && attempts++ < maxRetries ) |
3906 INFO_PRINTF2(_L("Read parameters returned %d"), status.Int()); |
3502 { |
3503 socket.Ioctl(KIoctlReadSmsParams,status,NULL, KSolSmsProv); |
|
3504 User::WaitForRequest(status); |
|
3505 INFO_PRINTF2(_L("Read parameters returned %d"), status.Int()); |
|
3506 |
|
3507 if ( status.Int() == KErrNotReady ) |
|
3508 { |
|
3509 INFO_PRINTF1(_L("Trying again... ")); |
|
3510 User::After(3000000); |
|
3511 } |
|
3512 else |
|
3513 { |
|
3514 tryAgain = EFalse; |
|
3515 } |
|
3516 } |
|
3517 |
|
3907 if(status.Int() == KErrNone) |
3518 if(status.Int() == KErrNone) |
3908 { |
3519 { |
3909 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
3520 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
3910 CleanupStack::PushL(smspList); |
3521 CleanupStack::PushL(smspList); |
3911 // Read list from stream and make acknowledgement to the SMS Stack |
3522 // Read list from stream and make acknowledgement to the SMS Stack |
3912 readstream >> *smspList; |
3523 readstream >> *smspList; |
3913 socket.Ioctl(KIoctlCompleteReadSmsParams, status, NULL,KSolSmsProv); |
3524 socket.Ioctl(KIoctlCompleteReadSmsParams, status, NULL,KSolSmsProv); |
3914 User::WaitForRequest(status); |
3525 User::WaitForRequest(status); |
3915 CleanupStack::PopAndDestroy(smspList); |
3526 CleanupStack::PopAndDestroy(smspList); |
3916 } |
3527 } |
3917 TEST(status.Int() == KErrNone); |
3528 TEST(status.Int() == KErrNone); |
3918 |
3529 |
3919 // |
3530 // |
3920 //Store SMSP list |
3531 //Store SMSP list |
3921 // |
3532 // |
3922 // Create the smspList |
3533 // Create the smspList |
3923 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
3534 CMobilePhoneSmspList* smspList = CMobilePhoneSmspList::NewL(); |
3924 CleanupStack::PushL(smspList); |
3535 CleanupStack::PushL(smspList); |
3925 |
3536 |
3926 // Because of AT-command limitations we can store only SC address to the phone. |
3537 // Because of AT-command limitations we can store only SC address to the phone. |
3936 TInt ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
3547 TInt ret = iSmsStackTestUtils->StoreParamsL(*smspList,socket,EFalse); |
3937 TEST(ret == KErrNone); |
3548 TEST(ret == KErrNone); |
3938 |
3549 |
3939 CleanupStack::PopAndDestroy(smspList); |
3550 CleanupStack::PopAndDestroy(smspList); |
3940 CleanupStack::PopAndDestroy(&socket); |
3551 CleanupStack::PopAndDestroy(&socket); |
3941 CleanupStack::PopAndDestroy(&socketServer); |
3552 } |
3942 |
|
3943 } |
|
3944 |
|
3945 |
3553 |
3946 TVerdict CTestResendFailedConcatinatedMessage::doTestStepL() |
3554 TVerdict CTestResendFailedConcatinatedMessage::doTestStepL() |
3947 /** |
3555 /** |
3948 * Test that sent PDUs in failed concatenated message are not re-sent" |
3556 * Test that sent PDUs in failed concatenated message are not re-sent" |
3949 */ |
3557 */ |
3950 { |
3558 { |
3951 INFO_PRINTF1(_L(" Test that sent PDUs in failed concatenated message are not re-sent")); |
3559 INFO_PRINTF1(_L(" Test that sent PDUs in failed concatenated message are not re-sent")); |
3952 TLogId logid; |
3560 TLogId logid; |
3953 TLogSmsPduData pduData; |
3561 TLogSmsPduData pduData; |
3954 |
|
3955 RSocketServ socketServer; |
|
3956 PrepareRegTestLC(socketServer, 44); |
|
3957 |
|
3958 |
|
3959 RSocket socket; |
3562 RSocket socket; |
3960 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3563 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
3961 |
3564 |
3962 // Create comms database object |
3565 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
3963 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
3964 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
3965 #else |
|
3966 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
3967 #endif |
|
3968 CleanupStack::PushL(db); |
|
3969 |
|
3970 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
3971 |
|
3972 // EReceiveUnstoredClientAck |
|
3973 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
3974 CleanupStack::PushL(smsReceiveModeField); |
|
3975 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
3976 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
3977 smsReceiveModeField->ModifyL(*db); |
|
3978 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
3979 CleanupStack::PopAndDestroy(db); |
|
3980 |
3566 |
3981 _LIT(KTestMsg1,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCC"); |
3567 _LIT(KTestMsg1,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCC"); |
3982 |
3568 |
3983 //Set destination and SC numbers |
3569 //Set destination and SC numbers |
3984 iTelephoneNumber=KPekka; |
3570 iTelephoneNumber=KPekka; |
3985 iServiceCenterNumber=KRadiolinjaSC; |
3571 iServiceCenterNumber=KRadiolinjaSC; |
3986 |
3572 |
3987 |
|
3988 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
3573 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
3989 |
3574 |
3990 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
3575 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
3991 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
3576 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
3992 |
3577 |
3993 //Send SMS - first pdu fails |
3578 //Send SMS - first pdu fails |
3994 |
3579 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
3995 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
3996 CleanupStack::PushL(smsMessage); |
|
3997 pduData.iType=smsMessage->Type(); |
3580 pduData.iType=smsMessage->Type(); |
3998 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
3581 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
3999 smsMessage->SetLogServerId(logid); |
3582 smsMessage->SetLogServerId(logid); |
3583 |
|
4000 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
3584 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
4001 SendSmsErrorL(smsMessage,socket); |
3585 SendSmsErrorL(smsMessage,socket); |
4002 SendSmsL(smsMessage,socket); |
3586 SendSmsL(smsMessage,socket); |
4003 CleanupStack::PopAndDestroy(smsMessage); |
3587 CleanupStack::PopAndDestroy(smsMessage); |
3588 |
|
4004 //Receive SMS |
3589 //Receive SMS |
4005 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4006 WaitForRecvL(socket); |
3590 WaitForRecvL(socket); |
4007 smsMessage = RecvSmsL(socket); |
3591 smsMessage = RecvSmsL(socket); |
4008 |
3592 |
4009 INFO_PRINTF1(_L("incoming SMS") ); |
|
4010 |
|
4011 CleanupStack::PushL(smsMessage); |
3593 CleanupStack::PushL(smsMessage); |
4012 TestSmsContentsL(smsMessage,KTestMsg1); |
3594 TestSmsContentsL(smsMessage,KTestMsg1); |
4013 CleanupStack::PopAndDestroy(smsMessage); |
3595 CleanupStack::PopAndDestroy(smsMessage); |
4014 |
3596 |
4015 //Send SMS - second pdu fails |
3597 //Send SMS - second pdu fails |
4016 |
3598 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4017 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4018 CleanupStack::PushL(smsMessage); |
|
4019 pduData.iType=smsMessage->Type(); |
3599 pduData.iType=smsMessage->Type(); |
4020 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
3600 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
4021 smsMessage->SetLogServerId(logid); |
3601 smsMessage->SetLogServerId(logid); |
3602 |
|
4022 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
3603 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
4023 SendSmsErrorL(smsMessage,socket); |
3604 SendSmsErrorL(smsMessage,socket); |
4024 SendSmsL(smsMessage,socket); |
3605 SendSmsL(smsMessage,socket); |
4025 CleanupStack::PopAndDestroy(smsMessage); |
3606 CleanupStack::PopAndDestroy(smsMessage); |
4026 |
3607 |
4027 //Receive SMS |
3608 //Receive SMS |
4028 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4029 WaitForRecvL(socket); |
3609 WaitForRecvL(socket); |
4030 smsMessage = RecvSmsL(socket); |
3610 smsMessage = RecvSmsL(socket); |
4031 |
|
4032 INFO_PRINTF1(_L("incoming SMS") ); |
|
4033 |
|
4034 CleanupStack::PushL(smsMessage); |
3611 CleanupStack::PushL(smsMessage); |
3612 |
|
4035 TestSmsContentsL(smsMessage,KTestMsg1); |
3613 TestSmsContentsL(smsMessage,KTestMsg1); |
4036 CleanupStack::PopAndDestroy(smsMessage); |
3614 CleanupStack::PopAndDestroy(smsMessage); |
4037 |
3615 |
4038 |
|
4039 //Send SMS - third pdu fails |
3616 //Send SMS - third pdu fails |
4040 |
3617 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4041 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4042 CleanupStack::PushL(smsMessage); |
|
4043 pduData.iType=smsMessage->Type(); |
3618 pduData.iType=smsMessage->Type(); |
4044 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
3619 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
4045 smsMessage->SetLogServerId(logid); |
3620 smsMessage->SetLogServerId(logid); |
3621 |
|
4046 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
3622 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
4047 SendSmsErrorL(smsMessage,socket); |
3623 SendSmsErrorL(smsMessage,socket); |
4048 SendSmsL(smsMessage,socket); |
3624 SendSmsL(smsMessage,socket); |
4049 CleanupStack::PopAndDestroy(smsMessage); |
3625 CleanupStack::PopAndDestroy(smsMessage); |
4050 |
3626 |
4051 //Receive SMS |
3627 //Receive SMS |
4052 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4053 WaitForRecvL(socket); |
3628 WaitForRecvL(socket); |
4054 smsMessage = RecvSmsL(socket); |
3629 smsMessage = RecvSmsL(socket); |
4055 |
|
4056 INFO_PRINTF1(_L("incoming SMS") ); |
|
4057 |
|
4058 CleanupStack::PushL(smsMessage); |
3630 CleanupStack::PushL(smsMessage); |
3631 |
|
4059 TestSmsContentsL(smsMessage,KTestMsg1); |
3632 TestSmsContentsL(smsMessage,KTestMsg1); |
4060 CleanupStack::PopAndDestroy(smsMessage); |
3633 CleanupStack::PopAndDestroy(smsMessage); |
4061 |
3634 |
4062 //Send SMS - fourth pdu fails |
3635 //Send SMS - fourth pdu fails |
4063 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
3636 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4064 CleanupStack::PushL(smsMessage); |
|
4065 pduData.iType=smsMessage->Type(); |
3637 pduData.iType=smsMessage->Type(); |
4066 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
3638 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
4067 smsMessage->SetLogServerId(logid); |
3639 smsMessage->SetLogServerId(logid); |
3640 |
|
4068 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
3641 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
4069 SendSmsErrorL(smsMessage,socket); |
3642 SendSmsErrorL(smsMessage,socket); |
4070 smsMessage->SetLogServerId(KLogNullId); |
3643 smsMessage->SetLogServerId(KLogNullId); |
3644 |
|
4071 SendSmsL(smsMessage,socket); |
3645 SendSmsL(smsMessage,socket); |
4072 CleanupStack::PopAndDestroy(smsMessage); |
3646 CleanupStack::PopAndDestroy(smsMessage); |
4073 |
3647 |
4074 //Receive SMS |
3648 //Receive SMS |
4075 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4076 WaitForRecvL(socket); |
3649 WaitForRecvL(socket); |
4077 smsMessage = RecvSmsL(socket); |
3650 smsMessage = RecvSmsL(socket); |
4078 |
|
4079 INFO_PRINTF1(_L("incoming SMS") ); |
|
4080 |
|
4081 CleanupStack::PushL(smsMessage); |
3651 CleanupStack::PushL(smsMessage); |
3652 |
|
4082 TestSmsContentsL(smsMessage,KTestMsg1); |
3653 TestSmsContentsL(smsMessage,KTestMsg1); |
4083 CleanupStack::PopAndDestroy(smsMessage); |
3654 CleanupStack::PopAndDestroy(smsMessage); |
3655 |
|
4084 CleanupStack::PopAndDestroy(&socket); |
3656 CleanupStack::PopAndDestroy(&socket); |
4085 CleanupStack::PopAndDestroy(&socketServer); |
3657 return TestStepResult() ; |
4086 |
3658 } |
4087 return TestStepResult() ; |
3659 |
4088 } |
3660 // TODO: move to WAP STACK test suite |
4089 |
|
4090 |
|
4091 TVerdict CTestMultipartWapMessage::doTestStepL() |
3661 TVerdict CTestMultipartWapMessage::doTestStepL() |
4092 /** |
3662 /** |
4093 * test multi-part WAP message |
3663 * test multi-part WAP message |
4094 */ |
3664 */ |
4095 { |
3665 { |
4096 |
|
4097 INFO_PRINTF1(_L("Test receive multi-part WAP message")); |
3666 INFO_PRINTF1(_L("Test receive multi-part WAP message")); |
4098 |
|
4099 RSocketServ socketServer; |
|
4100 PrepareRegTestLC(socketServer, 45); |
|
4101 |
|
4102 RSocket socket; |
3667 RSocket socket; |
4103 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3668 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
4104 |
3669 |
4105 RSocket wapsock; |
3670 RSocket wapsock; |
4106 TInt ret=wapsock.Open(socketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol); |
3671 TInt ret=wapsock.Open(iSocketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol); |
4107 TEST(ret == KErrNone); |
3672 TEST(ret == KErrNone); |
4108 |
3673 |
4109 TWapAddr recvWapAddr; |
3674 TWapAddr recvWapAddr; |
4110 TBuf8<2048> recvBuf; |
3675 TBuf8<2048> recvBuf; |
4111 TRequestStatus recvStatus; |
3676 TRequestStatus recvStatus; |
4132 { |
3697 { |
4133 TBuf<KMaxPrintLen> buf; |
3698 TBuf<KMaxPrintLen> buf; |
4134 buf.Zero(); |
3699 buf.Zero(); |
4135 const TInt midLen = Min(KMaxPrintLen, len - pos); |
3700 const TInt midLen = Min(KMaxPrintLen, len - pos); |
4136 buf.SetLength(midLen); |
3701 buf.SetLength(midLen); |
4137 for (TInt i=0; i<midLen; i++) |
3702 for (TInt i=0; i<midLen; ++i) |
3703 { |
|
4138 buf[i]=recvBuf[pos+i]; |
3704 buf[i]=recvBuf[pos+i]; |
3705 } |
|
4139 INFO_PRINTF2(_L("%S"), &buf); |
3706 INFO_PRINTF2(_L("%S"), &buf); |
4140 } |
3707 } |
4141 |
3708 |
4142 wapsock.Close(); |
3709 wapsock.Close(); |
4143 |
|
4144 CleanupStack::PopAndDestroy(&socket); |
3710 CleanupStack::PopAndDestroy(&socket); |
4145 CleanupStack::PopAndDestroy(&socketServer); |
|
4146 |
|
4147 return TestStepResult() ; |
3711 return TestStepResult() ; |
4148 } |
3712 } |
4149 |
3713 |
4150 |
|
4151 TVerdict CTestMOSESMessage::doTestStepL() |
3714 TVerdict CTestMOSESMessage::doTestStepL() |
4152 /** |
3715 /** |
4153 * Test a simple Receive of a single TPDU containing a simple text |
3716 * Test a simple Receive of a single TPDU containing a simple text |
4154 */ |
3717 */ |
4155 { |
3718 { |
4156 INFO_PRINTF1(_L("Test receive MOSES message")); |
3719 INFO_PRINTF1(_L("Test receive MOSES message")); |
4157 |
|
4158 RSocketServ socketServer; |
|
4159 PrepareRegTestLC(socketServer, 46); |
|
4160 |
|
4161 |
|
4162 RSocket socketRecvAny; |
3720 RSocket socketRecvAny; |
4163 iSmsStackTestUtils->OpenSmsSocketLC(socketServer, socketRecvAny, ESmsAddrRecvAny); |
3721 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socketRecvAny, ESmsAddrRecvAny); |
4164 |
|
4165 INFO_PRINTF1(_L("waiting for incoming SMS ...") ); |
|
4166 |
3722 |
4167 WaitForRecvL(socketRecvAny); |
3723 WaitForRecvL(socketRecvAny); |
4168 CSmsMessage* smsMessage = RecvSmsL(socketRecvAny); |
3724 CSmsMessage* smsMessage = RecvSmsL(socketRecvAny); |
4169 |
3725 |
4170 INFO_PRINTF1(_L("incoming SMS received from: ") ); |
3726 INFO_PRINTF1(_L("incoming SMS received from: ") ); |
4171 Logger().Write(smsMessage->ToFromAddress()); |
3727 Logger().Write(smsMessage->ToFromAddress()); |
4172 INFO_PRINTF1(_L("")); |
3728 INFO_PRINTF1(_L("")); |
4173 |
3729 |
4174 CleanupStack::PushL(smsMessage); |
3730 CleanupStack::PushL(smsMessage); |
4175 |
3731 CleanupStack::PopAndDestroy(2, &socketRecvAny); // socketRecvAny, smsMessage |
4176 CleanupStack::PopAndDestroy(2); // socketRecvAny, smsMessage |
3732 return TestStepResult() ; |
4177 CleanupStack::PopAndDestroy(&socketServer); |
3733 } |
4178 |
|
4179 return TestStepResult() ; |
|
4180 } |
|
4181 |
|
4182 |
3734 |
4183 TVerdict CTestClockBack::doTestStepL() |
3735 TVerdict CTestClockBack::doTestStepL() |
4184 /** |
3736 /** |
4185 * Test clock back |
3737 * Test clock back |
4186 */ |
3738 */ |
4187 { |
3739 { |
4188 INFO_PRINTF1(_L(" Test that turning back time does not result in 2 receipts of same messages")); |
3740 INFO_PRINTF1(_L(" Test that turning back time does not result in 2 receipts of same messages")); |
4189 |
|
4190 RSocketServ socketServer; |
|
4191 PrepareRegTestLC(socketServer, 47); |
|
4192 |
|
4193 |
|
4194 RSocket socket; |
3741 RSocket socket; |
4195 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3742 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
4196 |
3743 |
4197 // Create comms database object |
3744 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
4198 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
4199 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
4200 #else |
|
4201 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
4202 #endif |
|
4203 CleanupStack::PushL(db); |
|
4204 |
|
4205 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
4206 |
|
4207 // EReceiveUnstoredClientAck |
|
4208 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
4209 CleanupStack::PushL(smsReceiveModeField); |
|
4210 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
4211 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
4212 smsReceiveModeField->ModifyL(*db); |
|
4213 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
4214 CleanupStack::PopAndDestroy(db); |
|
4215 |
3745 |
4216 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
3746 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
4217 |
3747 |
4218 //Set destination and SC numbers |
3748 //Set destination and SC numbers |
4219 iTelephoneNumber=KPekka; |
3749 iTelephoneNumber=KPekka; |
4220 iServiceCenterNumber=KRadiolinjaSC; |
3750 iServiceCenterNumber=KRadiolinjaSC; |
4221 |
3751 |
4222 |
|
4223 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
3752 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
4224 |
3753 |
4225 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
3754 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
4226 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
3755 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
4227 |
3756 |
4228 // turn clock back for two hours (given in seconds) |
3757 // turn clock back for two hours (given in seconds) |
4229 User::SetUTCOffset(-2*60*60); |
3758 User::SetUTCOffset(-2*60*60); |
4230 |
3759 |
4231 //Send SMS |
3760 //Send SMS |
4232 |
3761 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4233 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4234 CleanupStack::PushL(smsMessage); |
|
4235 SendSmsL(smsMessage,socket); |
3762 SendSmsL(smsMessage,socket); |
4236 CleanupStack::PopAndDestroy(smsMessage); |
3763 CleanupStack::PopAndDestroy(smsMessage); |
3764 |
|
4237 //Receive SMS |
3765 //Receive SMS |
4238 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4239 WaitForRecvL(socket); |
3766 WaitForRecvL(socket); |
4240 smsMessage = RecvSmsL(socket); |
3767 smsMessage = RecvSmsL(socket); |
4241 |
|
4242 INFO_PRINTF1(_L("incoming SMS") ); |
|
4243 |
|
4244 CleanupStack::PushL(smsMessage); |
3768 CleanupStack::PushL(smsMessage); |
3769 |
|
4245 TestSmsContentsL(smsMessage,KTestMsg1); |
3770 TestSmsContentsL(smsMessage,KTestMsg1); |
4246 CleanupStack::PopAndDestroy(smsMessage); |
3771 CleanupStack::PopAndDestroy(smsMessage); |
4247 |
3772 |
4248 INFO_PRINTF2(_L("Waiting %d secs to see if another copy of message received"), 5); |
3773 INFO_PRINTF2(_L("Waiting %d secs to see if another copy of message received"), 5); |
4249 const TBool otherReceived = TimedWaitForRecvL(socket, 5 * 1000000); |
3774 const TBool otherReceived = TimedWaitForRecvL(socket, 5 * 1000000); |
4250 |
3775 |
4251 TEST(otherReceived ==EFalse); |
3776 TEST(otherReceived ==EFalse); |
4252 |
3777 |
4253 CleanupStack::PopAndDestroy(&socket); |
3778 CleanupStack::PopAndDestroy(&socket); |
4254 CleanupStack::PopAndDestroy(&socketServer); |
3779 return TestStepResult() ; |
4255 |
3780 } |
4256 return TestStepResult() ; |
|
4257 } |
|
4258 |
|
4259 |
3781 |
4260 TVerdict CTestEnumerateNoMessages::doTestStepL() |
3782 TVerdict CTestEnumerateNoMessages::doTestStepL() |
4261 /** |
3783 /** |
4262 * Test enumerating a message store which has no messages in it. |
3784 * Test enumerating a message store which has no messages in it. |
4263 * There are 3 message stores s13 has 0 messages, S14 has 1 message and S15 has 2 messages |
3785 * There are 3 message stores s13 has 0 messages, S14 has 1 message and S15 has 2 messages |
4264 */ |
3786 */ |
4265 { |
3787 { |
4266 INFO_PRINTF1(_L("Test enumerating a message store which has no messages")); |
3788 INFO_PRINTF1(_L("Test enumerating a message store which has no messages")); |
4267 |
|
4268 RSocketServ socketServer; |
|
4269 PrepareRegTestLC(socketServer, 48); |
|
4270 |
|
4271 |
|
4272 RSocket socket; |
3789 RSocket socket; |
4273 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3790 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
4274 |
3791 |
4275 // Enumerate messages from Store |
|
4276 TRequestStatus status; |
3792 TRequestStatus status; |
4277 TPckgBuf<TUint> sbuf; |
3793 TPckgBuf<TUint> sbuf; |
4278 sbuf()=0; |
3794 sbuf()=0; |
4279 |
3795 |
4280 //Now enumerate messages from store |
3796 TBool tryAgain = ETrue; |
4281 socket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv); |
3797 TInt attempts (0); |
4282 User::WaitForRequest(status); |
3798 TInt maxRetries = 3; |
4283 TEST(status.Int()==KErrNone); |
3799 |
4284 |
3800 // Enumerate messages from store. If it fails with KErrNotReady wait for 3 seconds to |
3801 // allow sms protocol to fully load and repeat |
|
3802 while( tryAgain && attempts++ < maxRetries ) |
|
3803 { |
|
3804 socket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv); |
|
3805 User::WaitForRequest(status); |
|
3806 INFO_PRINTF2(_L("Enumerate messages from store returned [status=%d]"), status.Int()); |
|
3807 |
|
3808 if ( status.Int() == KErrNotReady ) |
|
3809 { |
|
3810 INFO_PRINTF1(_L("Trying to enumerate again... ")); |
|
3811 User::After(3000000); |
|
3812 } |
|
3813 else |
|
3814 { |
|
3815 tryAgain = EFalse; |
|
3816 } |
|
3817 } |
|
3818 |
|
3819 TESTCHECK(status.Int(), KErrNone, "Enumerate messages from store"); |
|
3820 |
|
4285 //sbuf() includes the count of messages on Store |
3821 //sbuf() includes the count of messages on Store |
4286 TInt count = sbuf(); |
3822 TInt count = sbuf(); |
4287 INFO_PRINTF2(_L("%d enumerated messages"), count); |
3823 INFO_PRINTF2(_L("%d enumerated messages"), count); |
4288 TEST(count==3); |
3824 TEST(count==3); |
4289 |
3825 |
4290 CleanupStack::PopAndDestroy(&socket); |
3826 CleanupStack::PopAndDestroy(&socket); |
4291 CleanupStack::PopAndDestroy(&socketServer); |
3827 return TestStepResult() ; |
4292 |
3828 } |
4293 return TestStepResult() ; |
|
4294 } |
|
4295 |
|
4296 |
3829 |
4297 TVerdict CTestIE::doTestStepL() |
3830 TVerdict CTestIE::doTestStepL() |
4298 /** |
3831 /** |
4299 * Test the reception of a CPHS Message Waiting Indication |
3832 * Test the reception of a CPHS Message Waiting Indication |
4300 */ |
3833 */ |
4301 { |
3834 { |
4302 INFO_PRINTF1(_L("Test IE")); |
3835 INFO_PRINTF1(_L("Test IE")); |
4303 |
|
4304 RSocketServ socketServer; |
|
4305 PrepareRegTestLC(socketServer, 52); |
|
4306 |
|
4307 |
|
4308 RSocket socket; |
3836 RSocket socket; |
4309 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
3837 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
4310 |
|
4311 |
3838 |
4312 //Set destination and SC numbers |
3839 //Set destination and SC numbers |
4313 iTelephoneNumber=KPekka; |
3840 iTelephoneNumber=KPekka; |
4314 iServiceCenterNumber=KRadiolinjaSC; |
3841 iServiceCenterNumber=KRadiolinjaSC; |
4315 CSmsMessage* smsMessage=NULL; |
3842 CSmsMessage* smsMessage=NULL; |
4316 |
3843 |
3844 WaitForRecvL(socket); |
|
3845 smsMessage = RecvSmsL(socket); |
|
3846 |
|
3847 CleanupStack::PushL(smsMessage); |
|
3848 CSmsUserData& recvUserData = smsMessage->SmsPDU().UserData(); |
|
3849 TInt numIE=recvUserData.NumInformationElements(); |
|
3850 |
|
3851 for(TInt i=0; i<numIE; ++i) |
|
3852 { |
|
3853 CSmsInformationElement& ie=recvUserData.InformationElement(i); |
|
3854 TPtr8 ptr(ie.Data()); |
|
3855 INFO_PRINTF4(_L(" %d. ie is %d %S"),i ,ie.Identifier(), &ptr); |
|
3856 } |
|
3857 |
|
3858 CleanupStack::PopAndDestroy(smsMessage); |
|
3859 CleanupStack::PopAndDestroy(&socket); |
|
3860 return TestStepResult() ; |
|
3861 } |
|
3862 |
|
3863 TVerdict CTestEmailIE::doTestStepL() |
|
3864 /** |
|
3865 * Test the reception of a CPHS Message Waiting Indication |
|
3866 */ |
|
3867 { |
|
3868 INFO_PRINTF1(_L("Test EmailIE")); |
|
3869 _LIT(KTestMsg1,"MMMMMMMMMM"); |
|
3870 _LIT16(KSmsEmailHeaderShort,"HHHHHH"); |
|
3871 _LIT16(KSmsEmailBodyShort,"BBBBBB"); |
|
3872 |
|
3873 _LIT16(KSmsEmailHeaderLong,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); |
|
3874 _LIT16(KSmsEmailBodyLong,"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"); |
|
3875 |
|
3876 RSocket socket; |
|
3877 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrEmail); |
|
3878 |
|
3879 //Set destination and SC numbers |
|
3880 iTelephoneNumber=KPekka; |
|
3881 iServiceCenterNumber=KRadiolinjaSC; |
|
3882 CSmsMessage* smsMessage=NULL; |
|
3883 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
|
3884 |
|
3885 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
|
3886 |
|
3887 // case 1 short - one pdu |
|
3888 smsMessage->AddEmailHeaderL(KSmsEmailHeaderShort,KSmsEmailBodyShort); |
|
3889 |
|
3890 SendSmsL(smsMessage,socket); |
|
3891 CleanupStack::PopAndDestroy(smsMessage); |
|
3892 |
|
3893 WaitForRecvL(socket); |
|
3894 smsMessage = RecvSmsL(socket); |
|
3895 CleanupStack::PushL(smsMessage); |
|
3896 |
|
3897 CSmsUserData& recvUserData = smsMessage->SmsPDU().UserData(); |
|
3898 TInt numIE=recvUserData.NumInformationElements(); |
|
3899 |
|
3900 for(TInt i=0; i<numIE; ++i) |
|
3901 { |
|
3902 CSmsInformationElement& ie=recvUserData.InformationElement(i); |
|
3903 TPtr8 ptr(ie.Data()); |
|
3904 INFO_PRINTF4(_L(" %d. ie is %d %S"), i, ie.Identifier(), &ptr); |
|
3905 } |
|
3906 |
|
3907 TLogId logId(KLogNullId); |
|
3908 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Checking if message contains E-Mail header")); |
|
3909 HBufC* bd; |
|
3910 HBufC* hd; |
|
3911 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
|
3912 { |
|
3913 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
|
3914 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
|
3915 TEST(*hd==KSmsEmailHeaderShort()); |
|
3916 TEST(*bd==KSmsEmailBodyShort()); |
|
3917 logId=smsMessage->LogServerId(); |
|
3918 |
|
3919 if(logId!=KLogNullId) |
|
3920 { |
|
3921 TLogSmsPduData pduData; |
|
3922 CLogEvent* logEvent=CLogEvent::NewL(); |
|
3923 CleanupStack::PushL(logEvent); |
|
3924 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
|
3925 TPckg<TLogSmsPduData> packeddata(pduData); |
|
3926 packeddata.Copy(logEvent->Data()); |
|
3927 TEST(packeddata().iTotal==1); |
|
3928 TEST(packeddata().iReceived==1); |
|
3929 CleanupStack::PopAndDestroy(logEvent); |
|
3930 } |
|
3931 delete hd; |
|
3932 delete bd; |
|
3933 } |
|
3934 CleanupStack::PopAndDestroy(smsMessage); |
|
3935 |
|
3936 // case 2 - long header |
|
3937 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
|
3938 |
|
3939 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyShort); |
|
3940 |
|
3941 SendSmsL(smsMessage,socket); |
|
3942 CleanupStack::PopAndDestroy(smsMessage); |
|
3943 |
|
3944 WaitForRecvL(socket); |
|
3945 smsMessage = RecvSmsL(socket); |
|
3946 CleanupStack::PushL(smsMessage); |
|
3947 |
|
3948 CSmsUserData& recvUserData2 = smsMessage->SmsPDU().UserData(); |
|
3949 numIE=recvUserData2.NumInformationElements(); |
|
3950 |
|
3951 for(TInt i=0; i<numIE; ++i) |
|
3952 { |
|
3953 CSmsInformationElement& ie=recvUserData2.InformationElement(i); |
|
3954 TPtr8 ptr(ie.Data()); |
|
3955 INFO_PRINTF4(_L(" %d. ie is %d %S"), i, ie.Identifier(), &ptr); |
|
3956 } |
|
3957 |
|
3958 logId=KLogNullId; |
|
3959 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
|
3960 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
|
3961 { |
|
3962 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
|
3963 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
|
3964 TEST(*hd==KSmsEmailHeaderLong()); |
|
3965 TEST(*bd==KSmsEmailBodyShort()); |
|
3966 logId=smsMessage->LogServerId(); |
|
3967 if(logId!=KLogNullId) |
|
3968 { |
|
3969 TLogSmsPduData pduData; |
|
3970 CLogEvent* logEvent=CLogEvent::NewL(); |
|
3971 CleanupStack::PushL(logEvent); |
|
3972 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
|
3973 TPckg<TLogSmsPduData> packeddata(pduData); |
|
3974 packeddata.Copy(logEvent->Data()); |
|
3975 TEST(packeddata().iTotal==2); |
|
3976 TEST(packeddata().iReceived==2); |
|
3977 CleanupStack::PopAndDestroy(logEvent); |
|
3978 } |
|
3979 delete hd; |
|
3980 delete bd; |
|
3981 } |
|
3982 CleanupStack::PopAndDestroy(smsMessage); |
|
3983 |
|
3984 |
|
3985 // case 3 - short header long body |
|
3986 |
|
3987 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
|
3988 |
|
3989 smsMessage->AddEmailHeaderL(KSmsEmailHeaderShort,KSmsEmailBodyLong); |
|
3990 |
|
3991 //Send SMS |
|
3992 SendSmsL(smsMessage,socket); |
|
3993 CleanupStack::PopAndDestroy(smsMessage); |
|
3994 |
|
4317 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
3995 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
4318 WaitForRecvL(socket); |
3996 WaitForRecvL(socket); |
4319 smsMessage = RecvSmsL(socket); |
3997 smsMessage = RecvSmsL(socket); |
4320 CleanupStack::PushL(smsMessage); |
3998 CleanupStack::PushL(smsMessage); |
4321 CSmsUserData& recvUserData = smsMessage->SmsPDU().UserData(); |
3999 |
4322 TInt numIE=recvUserData.NumInformationElements(); |
4000 CSmsUserData& recvUserData3 = smsMessage->SmsPDU().UserData(); |
4323 for(TInt k=0;k<numIE;k++) |
4001 numIE = recvUserData3.NumInformationElements(); |
4002 for(TInt i=0; i<numIE; ++i) |
|
4324 { |
4003 { |
4325 CSmsInformationElement& ie=recvUserData.InformationElement(k); |
4004 CSmsInformationElement& ie=recvUserData3.InformationElement(i); |
4326 TPtr8 ptr(ie.Data()); |
4005 TPtr8 ptr(ie.Data()); |
4327 INFO_PRINTF4(_L(" %d. ie is %d %S"),k,ie.Identifier(),&ptr); |
4006 INFO_PRINTF4(_L(" %d. ie is %d %S"), i, ie.Identifier(), &ptr); |
4328 } |
4007 } |
4329 |
4008 |
4330 CleanupStack::PopAndDestroy(smsMessage); |
4009 logId=KLogNullId; |
4331 CleanupStack::PopAndDestroy(&socket); |
4010 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
4332 CleanupStack::PopAndDestroy(&socketServer); |
4011 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
4333 |
4012 { |
4334 return TestStepResult() ; |
4013 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
4335 } |
4014 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
4336 |
4015 TEST(*hd==KSmsEmailHeaderShort()); |
4337 |
4016 TEST(*bd==KSmsEmailBodyLong()); |
4338 TVerdict CTestEmailIE::doTestStepL() |
4017 logId=smsMessage->LogServerId(); |
4339 /** |
4018 if(logId!=KLogNullId) |
4340 * Test the reception of a CPHS Message Waiting Indication |
4019 { |
4341 */ |
4020 TLogSmsPduData pduData; |
4342 |
4021 CLogEvent* logEvent=CLogEvent::NewL(); |
4343 { |
4022 CleanupStack::PushL(logEvent); |
4344 INFO_PRINTF1(_L("Test EmailIE")); |
4023 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
4345 _LIT(KTestMsg1,"MMMMMMMMMM"); |
4024 TPckg<TLogSmsPduData> packeddata(pduData); |
4346 _LIT16(KSmsEmailHeaderShort,"HHHHHH"); |
4025 packeddata.Copy(logEvent->Data()); |
4347 _LIT16(KSmsEmailBodyShort,"BBBBBB"); |
4026 TEST(packeddata().iTotal==2); |
4348 |
4027 TEST(packeddata().iReceived==2); |
4349 _LIT16(KSmsEmailHeaderLong,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); |
4028 CleanupStack::PopAndDestroy(logEvent); |
4350 _LIT16(KSmsEmailBodyLong,"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"); |
4029 } |
4351 |
4030 delete hd; |
4352 RSocketServ socketServer; |
4031 delete bd; |
4353 PrepareRegTestLC(socketServer, 53); |
4032 } |
4354 |
4033 CleanupStack::PopAndDestroy(smsMessage); |
4355 |
4034 |
4356 RSocket socket; |
4035 // case 4 - long header long body |
4357 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrEmail); |
4036 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4358 |
4037 |
4359 |
4038 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyLong); |
4360 //Set destination and SC numbers |
4039 |
4361 iTelephoneNumber=KPekka; |
|
4362 iServiceCenterNumber=KRadiolinjaSC; |
|
4363 CSmsMessage* smsMessage=NULL; |
|
4364 |
|
4365 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
|
4366 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4367 CleanupStack::PushL(smsMessage); |
|
4368 // case 1 short - one pdu |
|
4369 smsMessage->AddEmailHeaderL(KSmsEmailHeaderShort,KSmsEmailBodyShort); |
|
4370 //Send SMS |
|
4371 SendSmsL(smsMessage,socket); |
4040 SendSmsL(smsMessage,socket); |
4372 CleanupStack::PopAndDestroy(smsMessage); |
4041 CleanupStack::PopAndDestroy(smsMessage); |
4373 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
4042 |
4374 WaitForRecvL(socket); |
4043 WaitForRecvL(socket); |
4375 smsMessage = RecvSmsL(socket); |
4044 smsMessage = RecvSmsL(socket); |
4376 CleanupStack::PushL(smsMessage); |
4045 CleanupStack::PushL(smsMessage); |
4377 CSmsUserData& recvUserData = smsMessage->SmsPDU().UserData(); |
4046 |
4378 TInt numIE=recvUserData.NumInformationElements(); |
4047 CSmsUserData& recvUserData4 = smsMessage->SmsPDU().UserData(); |
4379 TInt k=0; |
4048 numIE=recvUserData4.NumInformationElements(); |
4380 for(k=0;k<numIE;k++) |
4049 |
4050 for(TInt i=0; i<numIE; ++i) |
|
4381 { |
4051 { |
4382 CSmsInformationElement& ie=recvUserData.InformationElement(k); |
4052 CSmsInformationElement& ie=recvUserData4.InformationElement(i); |
4383 TPtr8 ptr(ie.Data()); |
4053 TPtr8 ptr(ie.Data()); |
4384 INFO_PRINTF4(_L(" %d. ie is %d %S"),k,ie.Identifier(),&ptr); |
4054 INFO_PRINTF4(_L(" %d. ie is %d %S"), i, ie.Identifier(), &ptr); |
4385 } |
4055 } |
4386 |
4056 |
4387 TLogId logId(KLogNullId); |
4057 logId=KLogNullId; |
4388 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
4058 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
4389 HBufC* bd; |
|
4390 HBufC* hd; |
|
4391 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
4059 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
4392 { |
4060 { |
4393 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
4061 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
4394 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
4062 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
4395 TEST(*hd==KSmsEmailHeaderShort()); |
4063 TEST(*hd==KSmsEmailHeaderLong()); |
4396 TEST(*bd==KSmsEmailBodyShort()); |
4064 TEST(*bd==KSmsEmailBodyLong()); |
4397 logId=smsMessage->LogServerId(); |
4065 logId=smsMessage->LogServerId(); |
4398 if(logId!=KLogNullId) |
4066 if(logId!=KLogNullId) |
4399 { |
4067 { |
4400 TLogSmsPduData pduData; |
4068 TLogSmsPduData pduData; |
4401 CLogEvent* logEvent=CLogEvent::NewL(); |
4069 CLogEvent* logEvent=CLogEvent::NewL(); |
4402 CleanupStack::PushL(logEvent); |
4070 CleanupStack::PushL(logEvent); |
4403 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
4071 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
4404 TPckg<TLogSmsPduData> packeddata(pduData); |
4072 TPckg<TLogSmsPduData> packeddata(pduData); |
4405 packeddata.Copy(logEvent->Data()); |
4073 packeddata.Copy(logEvent->Data()); |
4406 TEST(packeddata().iTotal==1); |
4074 TEST(packeddata().iTotal==3); |
4407 TEST(packeddata().iReceived==1); |
4075 TEST(packeddata().iReceived==3); |
4408 CleanupStack::PopAndDestroy(logEvent); |
4076 CleanupStack::PopAndDestroy(logEvent); |
4409 } |
4077 } |
4410 delete hd; |
4078 delete hd; |
4411 delete bd; |
4079 delete bd; |
4412 } |
4080 } |
4413 // |
4081 |
4414 CleanupStack::PopAndDestroy(smsMessage); |
4082 CleanupStack::PopAndDestroy(smsMessage); |
4415 |
4083 |
4416 // case 2 - long header |
4084 // case 5 - long header, long body, unicode |
4417 |
4085 smsMessage=CreateSmsMessageLC(KTestMsg1,TSmsDataCodingScheme::ESmsAlphabetUCS2); |
4418 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
4086 |
4419 CleanupStack::PushL(smsMessage); |
4087 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyLong); |
4420 |
4088 |
4421 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyShort); |
|
4422 |
|
4423 //Send SMS |
|
4424 SendSmsL(smsMessage,socket); |
4089 SendSmsL(smsMessage,socket); |
4425 CleanupStack::PopAndDestroy(smsMessage); |
4090 CleanupStack::PopAndDestroy(smsMessage); |
4426 |
4091 |
4427 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4428 WaitForRecvL(socket); |
4092 WaitForRecvL(socket); |
4429 smsMessage = RecvSmsL(socket); |
4093 smsMessage = RecvSmsL(socket); |
4430 CleanupStack::PushL(smsMessage); |
4094 CleanupStack::PushL(smsMessage); |
4095 |
|
4096 CSmsUserData& recvUserData5 = smsMessage->SmsPDU().UserData(); |
|
4097 numIE=recvUserData5.NumInformationElements(); |
|
4098 for(TInt i=0; i<numIE; ++i) |
|
4431 { |
4099 { |
4432 CSmsUserData& recvUserData2 = smsMessage->SmsPDU().UserData(); |
4100 CSmsInformationElement& ie=recvUserData5.InformationElement(i); |
4433 TInt numIE=recvUserData2.NumInformationElements(); |
4101 TPtr8 ptr(ie.Data()); |
4434 for(TInt k=0;k<numIE;k++) |
4102 INFO_PRINTF4(_L(" %d. ie is %d %S"), i, ie.Identifier(), &ptr); |
4435 { |
|
4436 CSmsInformationElement& ie=recvUserData2.InformationElement(k); |
|
4437 TPtr8 ptr(ie.Data()); |
|
4438 INFO_PRINTF4(_L(" %d. ie is %d %S"),k,ie.Identifier(),&ptr); |
|
4439 } |
|
4440 } |
4103 } |
4441 |
4104 |
4442 logId=KLogNullId; |
4105 logId=KLogNullId; |
4443 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
4106 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
4444 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
4107 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
4108 { |
|
4109 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
|
4110 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
|
4111 TEST(*hd==KSmsEmailHeaderLong()); |
|
4112 TEST(*bd==KSmsEmailBodyLong()); |
|
4113 logId=smsMessage->LogServerId(); |
|
4114 if(logId!=KLogNullId) |
|
4445 { |
4115 { |
4446 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
4116 TLogSmsPduData pduData; |
4447 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
4117 CLogEvent* logEvent=CLogEvent::NewL(); |
4448 TEST(*hd==KSmsEmailHeaderLong()); |
4118 CleanupStack::PushL(logEvent); |
4449 TEST(*bd==KSmsEmailBodyShort()); |
4119 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
4450 logId=smsMessage->LogServerId(); |
4120 TPckg<TLogSmsPduData> packeddata(pduData); |
4451 if(logId!=KLogNullId) |
4121 packeddata.Copy(logEvent->Data()); |
4452 { |
4122 TEST(packeddata().iTotal==6); |
4453 TLogSmsPduData pduData; |
4123 TEST(packeddata().iReceived==6); |
4454 CLogEvent* logEvent=CLogEvent::NewL(); |
4124 CleanupStack::PopAndDestroy(logEvent); |
4455 CleanupStack::PushL(logEvent); |
|
4456 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
|
4457 TPckg<TLogSmsPduData> packeddata(pduData); |
|
4458 packeddata.Copy(logEvent->Data()); |
|
4459 TEST(packeddata().iTotal==2); |
|
4460 TEST(packeddata().iReceived==2); |
|
4461 CleanupStack::PopAndDestroy(logEvent); |
|
4462 } |
|
4463 delete hd; |
|
4464 delete bd; |
|
4465 } |
4125 } |
4466 // |
4126 delete hd; |
4467 CleanupStack::PopAndDestroy(smsMessage); |
4127 delete bd; |
4468 |
4128 } |
4469 |
4129 CleanupStack::PopAndDestroy(smsMessage); |
4470 // case 3 - short header long body |
4130 |
4471 |
4131 |
4472 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
4132 // case 6 - long header long body, 7bit |
4473 CleanupStack::PushL(smsMessage); |
4133 smsMessage=CreateSmsMessageLC(KTestMsg1,TSmsDataCodingScheme::ESmsAlphabet7Bit); |
4474 |
4134 |
4475 smsMessage->AddEmailHeaderL(KSmsEmailHeaderShort,KSmsEmailBodyLong); |
4135 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyLong); |
4476 |
4136 |
4477 //Send SMS |
|
4478 SendSmsL(smsMessage,socket); |
4137 SendSmsL(smsMessage,socket); |
4479 CleanupStack::PopAndDestroy(smsMessage); |
4138 CleanupStack::PopAndDestroy(smsMessage); |
4480 |
4139 |
4481 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4482 WaitForRecvL(socket); |
4140 WaitForRecvL(socket); |
4483 smsMessage = RecvSmsL(socket); |
4141 smsMessage = RecvSmsL(socket); |
4484 CleanupStack::PushL(smsMessage); |
4142 CleanupStack::PushL(smsMessage); |
4143 |
|
4144 CSmsUserData& recvUserData6 = smsMessage->SmsPDU().UserData(); |
|
4145 numIE=recvUserData6.NumInformationElements(); |
|
4146 |
|
4147 for(TInt i=0; i<numIE; ++i) |
|
4485 { |
4148 { |
4486 CSmsUserData& recvUserData3 = smsMessage->SmsPDU().UserData(); |
4149 CSmsInformationElement& ie=recvUserData6.InformationElement(i); |
4487 TInt numIE=recvUserData3.NumInformationElements(); |
4150 TPtr8 ptr(ie.Data()); |
4488 for(TInt k=0;k<numIE;k++) |
4151 INFO_PRINTF4(_L(" %d. ie is %d %S"),i, ie.Identifier(), &ptr); |
4489 { |
|
4490 CSmsInformationElement& ie=recvUserData3.InformationElement(k); |
|
4491 TPtr8 ptr(ie.Data()); |
|
4492 INFO_PRINTF4(_L(" %d. ie is %d %S"),k,ie.Identifier(),&ptr); |
|
4493 } |
|
4494 } |
4152 } |
4495 |
4153 |
4496 logId=KLogNullId; |
4154 logId=KLogNullId; |
4497 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
4155 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
4498 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
4156 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
4157 { |
|
4158 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
|
4159 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
|
4160 TEST(*hd==KSmsEmailHeaderLong()); |
|
4161 TEST(*bd==KSmsEmailBodyLong()); |
|
4162 logId=smsMessage->LogServerId(); |
|
4163 if(logId!=KLogNullId) |
|
4499 { |
4164 { |
4500 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
4165 TLogSmsPduData pduData; |
4501 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
4166 CLogEvent* logEvent=CLogEvent::NewL(); |
4502 TEST(*hd==KSmsEmailHeaderShort()); |
4167 CleanupStack::PushL(logEvent); |
4503 TEST(*bd==KSmsEmailBodyLong()); |
4168 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
4504 logId=smsMessage->LogServerId(); |
4169 TPckg<TLogSmsPduData> packeddata(pduData); |
4505 if(logId!=KLogNullId) |
4170 packeddata.Copy(logEvent->Data()); |
4506 { |
4171 TEST(packeddata().iTotal==3); |
4507 TLogSmsPduData pduData; |
4172 TEST(packeddata().iReceived==3); |
4508 CLogEvent* logEvent=CLogEvent::NewL(); |
4173 CleanupStack::PopAndDestroy(logEvent); |
4509 CleanupStack::PushL(logEvent); |
|
4510 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
|
4511 TPckg<TLogSmsPduData> packeddata(pduData); |
|
4512 packeddata.Copy(logEvent->Data()); |
|
4513 TEST(packeddata().iTotal==2); |
|
4514 TEST(packeddata().iReceived==2); |
|
4515 CleanupStack::PopAndDestroy(logEvent); |
|
4516 } |
|
4517 delete hd; |
|
4518 delete bd; |
|
4519 } |
4174 } |
4520 // |
4175 delete hd; |
4521 CleanupStack::PopAndDestroy(smsMessage); |
4176 delete bd; |
4522 |
|
4523 |
|
4524 // case 4 - long header long body |
|
4525 |
|
4526 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4527 CleanupStack::PushL(smsMessage); |
|
4528 |
|
4529 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyLong); |
|
4530 |
|
4531 //Send SMS |
|
4532 SendSmsL(smsMessage,socket); |
|
4533 CleanupStack::PopAndDestroy(smsMessage); |
|
4534 |
|
4535 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4536 WaitForRecvL(socket); |
|
4537 smsMessage = RecvSmsL(socket); |
|
4538 CleanupStack::PushL(smsMessage); |
|
4539 { |
|
4540 CSmsUserData& recvUserData4 = smsMessage->SmsPDU().UserData(); |
|
4541 TInt numIE=recvUserData4.NumInformationElements(); |
|
4542 for(TInt k=0;k<numIE;k++) |
|
4543 { |
|
4544 CSmsInformationElement& ie=recvUserData4.InformationElement(k); |
|
4545 TPtr8 ptr(ie.Data()); |
|
4546 INFO_PRINTF4(_L(" %d. ie is %d %S"),k,ie.Identifier(),&ptr); |
|
4547 } |
|
4548 } |
4177 } |
4549 |
4178 |
4550 logId=KLogNullId; |
|
4551 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
|
4552 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
|
4553 { |
|
4554 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
|
4555 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
|
4556 TEST(*hd==KSmsEmailHeaderLong()); |
|
4557 TEST(*bd==KSmsEmailBodyLong()); |
|
4558 logId=smsMessage->LogServerId(); |
|
4559 if(logId!=KLogNullId) |
|
4560 { |
|
4561 TLogSmsPduData pduData; |
|
4562 CLogEvent* logEvent=CLogEvent::NewL(); |
|
4563 CleanupStack::PushL(logEvent); |
|
4564 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
|
4565 TPckg<TLogSmsPduData> packeddata(pduData); |
|
4566 packeddata.Copy(logEvent->Data()); |
|
4567 TEST(packeddata().iTotal==3); |
|
4568 TEST(packeddata().iReceived==3); |
|
4569 CleanupStack::PopAndDestroy(logEvent); |
|
4570 } |
|
4571 delete hd; |
|
4572 delete bd; |
|
4573 } |
|
4574 // |
|
4575 CleanupStack::PopAndDestroy(smsMessage); |
|
4576 |
|
4577 |
|
4578 // case 5 - long header long body, unicode |
|
4579 |
|
4580 smsMessage=CreateSmsMessageL(KTestMsg1,TSmsDataCodingScheme::ESmsAlphabetUCS2); |
|
4581 CleanupStack::PushL(smsMessage); |
|
4582 |
|
4583 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyLong); |
|
4584 |
|
4585 //Send SMS |
|
4586 SendSmsL(smsMessage,socket); |
|
4587 CleanupStack::PopAndDestroy(smsMessage); |
|
4588 |
|
4589 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4590 WaitForRecvL(socket); |
|
4591 smsMessage = RecvSmsL(socket); |
|
4592 CleanupStack::PushL(smsMessage); |
|
4593 { |
|
4594 CSmsUserData& recvUserData4 = smsMessage->SmsPDU().UserData(); |
|
4595 TInt numIE=recvUserData4.NumInformationElements(); |
|
4596 for(TInt k=0;k<numIE;k++) |
|
4597 { |
|
4598 CSmsInformationElement& ie=recvUserData4.InformationElement(k); |
|
4599 TPtr8 ptr(ie.Data()); |
|
4600 INFO_PRINTF4(_L(" %d. ie is %d %S"),k,ie.Identifier(),&ptr); |
|
4601 } |
|
4602 } |
|
4603 |
|
4604 logId=KLogNullId; |
|
4605 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
|
4606 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
|
4607 { |
|
4608 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
|
4609 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
|
4610 TEST(*hd==KSmsEmailHeaderLong()); |
|
4611 TEST(*bd==KSmsEmailBodyLong()); |
|
4612 logId=smsMessage->LogServerId(); |
|
4613 if(logId!=KLogNullId) |
|
4614 { |
|
4615 TLogSmsPduData pduData; |
|
4616 CLogEvent* logEvent=CLogEvent::NewL(); |
|
4617 CleanupStack::PushL(logEvent); |
|
4618 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
|
4619 TPckg<TLogSmsPduData> packeddata(pduData); |
|
4620 packeddata.Copy(logEvent->Data()); |
|
4621 TEST(packeddata().iTotal==6); |
|
4622 TEST(packeddata().iReceived==6); |
|
4623 CleanupStack::PopAndDestroy(logEvent); |
|
4624 } |
|
4625 delete hd; |
|
4626 delete bd; |
|
4627 } |
|
4628 // |
|
4629 CleanupStack::PopAndDestroy(smsMessage); |
|
4630 |
|
4631 |
|
4632 |
|
4633 // case 6 - long header long body, 7bit |
|
4634 |
|
4635 smsMessage=CreateSmsMessageL(KTestMsg1,TSmsDataCodingScheme::ESmsAlphabet7Bit); |
|
4636 CleanupStack::PushL(smsMessage); |
|
4637 |
|
4638 smsMessage->AddEmailHeaderL(KSmsEmailHeaderLong,KSmsEmailBodyLong); |
|
4639 |
|
4640 //Send SMS |
|
4641 SendSmsL(smsMessage,socket); |
|
4642 CleanupStack::PopAndDestroy(smsMessage); |
|
4643 |
|
4644 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4645 WaitForRecvL(socket); |
|
4646 smsMessage = RecvSmsL(socket); |
|
4647 CleanupStack::PushL(smsMessage); |
|
4648 { |
|
4649 CSmsUserData& recvUserData4 = smsMessage->SmsPDU().UserData(); |
|
4650 TInt numIE=recvUserData4.NumInformationElements(); |
|
4651 for(TInt k=0;k<numIE;k++) |
|
4652 { |
|
4653 CSmsInformationElement& ie=recvUserData4.InformationElement(k); |
|
4654 TPtr8 ptr(ie.Data()); |
|
4655 INFO_PRINTF4(_L(" %d. ie is %d %S"),k,ie.Identifier(),&ptr); |
|
4656 } |
|
4657 } |
|
4658 |
|
4659 logId=KLogNullId; |
|
4660 TEST_CHECKL(smsMessage->IsEmailHeader(),ETrue,_L("Message does noty contain E-Mail header")); |
|
4661 if(smsMessage->GetEmailHeaderL(&hd,&bd)) |
|
4662 { |
|
4663 INFO_PRINTF3(_L(" This is e-mail header:len %d %S"),hd->Length(),hd); |
|
4664 INFO_PRINTF3(_L(" This is e-mail body: %d %S"),bd->Length(),bd); |
|
4665 TEST(*hd==KSmsEmailHeaderLong()); |
|
4666 TEST(*bd==KSmsEmailBodyLong()); |
|
4667 logId=smsMessage->LogServerId(); |
|
4668 if(logId!=KLogNullId) |
|
4669 { |
|
4670 TLogSmsPduData pduData; |
|
4671 CLogEvent* logEvent=CLogEvent::NewL(); |
|
4672 CleanupStack::PushL(logEvent); |
|
4673 iSmsStackTestUtils->GetLogEventL(*logEvent,logId); |
|
4674 TPckg<TLogSmsPduData> packeddata(pduData); |
|
4675 packeddata.Copy(logEvent->Data()); |
|
4676 TEST(packeddata().iTotal==3); |
|
4677 TEST(packeddata().iReceived==3); |
|
4678 CleanupStack::PopAndDestroy(logEvent); |
|
4679 } |
|
4680 delete hd; |
|
4681 delete bd; |
|
4682 } |
|
4683 // |
|
4684 CleanupStack::PopAndDestroy(smsMessage); |
4179 CleanupStack::PopAndDestroy(smsMessage); |
4685 CleanupStack::PopAndDestroy(&socket); |
4180 CleanupStack::PopAndDestroy(&socket); |
4686 CleanupStack::PopAndDestroy(&socketServer); |
|
4687 |
|
4688 return TestStepResult() ; |
4181 return TestStepResult() ; |
4689 } |
4182 } |
4690 |
|
4691 |
|
4692 |
4183 |
4693 TVerdict CTestMaxReadTimeForSmsStoreList::doTestStepL() |
4184 TVerdict CTestMaxReadTimeForSmsStoreList::doTestStepL() |
4694 /** |
4185 /** |
4695 * Test Sms message storage |
4186 * Test Sms message storage |
4696 */ |
4187 */ |
4697 { |
4188 { |
4698 INFO_PRINTF1(_L("Enumerating a phone store list that takes 254 seconds")); |
4189 INFO_PRINTF1(_L("Enumerating a phone store list that takes 254 seconds")); |
4699 |
|
4700 RSocketServ socketServer; |
|
4701 PrepareRegTestLC(socketServer, 54); |
|
4702 |
|
4703 |
|
4704 // Open the socket for SIM operations |
4190 // Open the socket for SIM operations |
4705 RSocket socket; |
4191 RSocket socket; |
4706 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
4192 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrLocalOperation); |
4707 |
4193 |
4708 // Enumerate messages |
4194 // Enumerate messages |
4709 |
|
4710 RPointerArray<CSmsMessage> messages; |
4195 RPointerArray<CSmsMessage> messages; |
4711 CleanupResetAndDestroyPushL(messages); |
4196 CleanupResetAndDestroyPushL(messages); |
4712 ReadSmsStoreL(socket, messages); |
4197 ReadSmsStoreL(socket, messages); |
4198 |
|
4713 const TInt count = messages.Count(); |
4199 const TInt count = messages.Count(); |
4714 |
4200 TESTCHECK(count, 2, "Request retrieved 2 messages after 254 seconds"); |
4715 // Check that request successfully retrieved 2 messages |
|
4716 // after 254 seconds. |
|
4717 |
|
4718 TEST(count == 2); |
|
4719 |
4201 |
4720 CleanupStack::PopAndDestroy(&messages); |
4202 CleanupStack::PopAndDestroy(&messages); |
4721 CleanupStack::PopAndDestroy(&socket); |
4203 CleanupStack::PopAndDestroy(&socket); |
4722 CleanupStack::PopAndDestroy(&socketServer); |
|
4723 |
|
4724 return TestStepResult(); |
4204 return TestStepResult(); |
4725 } |
4205 } |
4726 |
|
4727 |
4206 |
4728 TVerdict CTestSameLogIdMultiplePDU::doTestStepL() |
4207 TVerdict CTestSameLogIdMultiplePDU::doTestStepL() |
4729 /** |
4208 /** |
4730 * Resend Multi PDU SMS message with same log id" |
4209 * Resend Multi PDU SMS message with same log id" |
4731 */ |
4210 */ |
4750 // which provides the encoded versions of the PDUs, the SIMTSY has to receive and send. |
4229 // which provides the encoded versions of the PDUs, the SIMTSY has to receive and send. |
4751 |
4230 |
4752 INFO_PRINTF1(_L(" Test that sent SMS consisting of Multiple PDUs with the same logId")); |
4231 INFO_PRINTF1(_L(" Test that sent SMS consisting of Multiple PDUs with the same logId")); |
4753 TLogId logid; |
4232 TLogId logid; |
4754 TLogSmsPduData pduData; |
4233 TLogSmsPduData pduData; |
4755 |
|
4756 RSocketServ socketServer; |
|
4757 PrepareRegTestLC(socketServer, 57); |
|
4758 |
|
4759 |
|
4760 RSocket socket; |
4234 RSocket socket; |
4761 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
4235 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
4762 |
4236 |
4763 // Create comms database object |
4237 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
4764 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
4765 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
4766 #else |
|
4767 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
4768 #endif |
|
4769 CleanupStack::PushL(db); |
|
4770 |
|
4771 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
4772 |
|
4773 // EReceiveUnstoredClientAck |
|
4774 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
4775 CleanupStack::PushL(smsReceiveModeField); |
|
4776 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
4777 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
4778 smsReceiveModeField->ModifyL(*db); |
|
4779 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
4780 CleanupStack::PopAndDestroy(db); |
|
4781 |
4238 |
4782 // Initialization |
4239 // Initialization |
4783 // Message String |
4240 // Message String |
4784 _LIT(KTestMsg1,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCC"); |
4241 _LIT(KTestMsg1,"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCC"); |
4785 |
4242 |
4792 |
4249 |
4793 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
4250 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
4794 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
4251 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
4795 |
4252 |
4796 // Twice send an Sms with the same logid - step 1 |
4253 // Twice send an Sms with the same logid - step 1 |
4797 // Create a Message |
4254 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4798 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4799 CleanupStack::PushL(smsMessage); |
|
4800 pduData.iType=smsMessage->Type(); |
4255 pduData.iType=smsMessage->Type(); |
4801 |
4256 |
4802 // Get a log Id |
4257 // Get a log Id |
4803 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
4258 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
4804 smsMessage->SetLogServerId(logid); |
4259 smsMessage->SetLogServerId(logid); |
4805 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
4260 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
4806 |
4261 |
4262 SendSmsL(smsMessage,socket); |
|
4263 // Send SMS again |
|
4264 SendSmsL(smsMessage,socket); |
|
4265 |
|
4266 CleanupStack::PopAndDestroy(smsMessage); |
|
4267 |
|
4268 WaitForRecvL(socket); |
|
4269 smsMessage = RecvSmsL(socket); |
|
4270 |
|
4271 CleanupStack::PushL(smsMessage); |
|
4272 TestSmsContentsL(smsMessage,KTestMsg1); |
|
4273 CleanupStack::PopAndDestroy(smsMessage); |
|
4274 |
|
4275 // Twice send an Sms with the same logid - step 2 |
|
4276 // Create a Message |
|
4277 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
|
4278 pduData.iType=smsMessage->Type(); |
|
4279 |
|
4280 // Get a log Id |
|
4281 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
|
4282 smsMessage->SetLogServerId(logid); |
|
4283 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
|
4284 |
|
4807 // Send SMS |
4285 // Send SMS |
4808 SendSmsL(smsMessage,socket); |
4286 SendSmsL(smsMessage,socket); |
4809 // Send SMS again |
4287 // Send SMS again |
4810 SendSmsL(smsMessage,socket); |
4288 SendSmsL(smsMessage,socket); |
4811 |
4289 |
4812 CleanupStack::PopAndDestroy(smsMessage); |
4290 CleanupStack::PopAndDestroy(smsMessage); |
4813 |
4291 |
4814 //Receive SMS |
4292 //Receive SMS |
4815 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4816 WaitForRecvL(socket); |
4293 WaitForRecvL(socket); |
4817 smsMessage = RecvSmsL(socket); |
4294 smsMessage = RecvSmsL(socket); |
4818 INFO_PRINTF1(_L("incoming SMS arrived") ); |
|
4819 |
4295 |
4820 CleanupStack::PushL(smsMessage); |
4296 CleanupStack::PushL(smsMessage); |
4821 TestSmsContentsL(smsMessage,KTestMsg1); |
4297 TestSmsContentsL(smsMessage,KTestMsg1); |
4822 CleanupStack::PopAndDestroy(smsMessage); |
4298 |
4823 |
|
4824 // Twice send an Sms with the same logid - step 2 |
|
4825 // Create a Message |
|
4826 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4827 CleanupStack::PushL(smsMessage); |
|
4828 pduData.iType=smsMessage->Type(); |
|
4829 |
|
4830 // Get a log Id |
|
4831 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
|
4832 smsMessage->SetLogServerId(logid); |
|
4833 INFO_PRINTF2(_L("Sends message with log id %d"),logid); |
|
4834 |
|
4835 // Send SMS |
|
4836 SendSmsL(smsMessage,socket); |
|
4837 // Send SMS again |
|
4838 SendSmsL(smsMessage,socket); |
|
4839 |
|
4840 CleanupStack::PopAndDestroy(smsMessage); |
|
4841 |
|
4842 //Receive SMS |
|
4843 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4844 WaitForRecvL(socket); |
|
4845 smsMessage = RecvSmsL(socket); |
|
4846 INFO_PRINTF1(_L("incoming SMS arrived") ); |
|
4847 |
|
4848 CleanupStack::PushL(smsMessage); |
|
4849 TestSmsContentsL(smsMessage,KTestMsg1); |
|
4850 CleanupStack::PopAndDestroy(smsMessage); |
4299 CleanupStack::PopAndDestroy(smsMessage); |
4851 CleanupStack::PopAndDestroy(&socket); |
4300 CleanupStack::PopAndDestroy(&socket); |
4852 CleanupStack::PopAndDestroy(&socketServer); |
|
4853 |
|
4854 return TestStepResult(); |
4301 return TestStepResult(); |
4855 } |
4302 } |
4856 |
|
4857 |
4303 |
4858 TVerdict CTestSameLogIdSinglePDU::doTestStepL() |
4304 TVerdict CTestSameLogIdSinglePDU::doTestStepL() |
4859 /** |
4305 /** |
4860 * Resend Single PDU SMS message with same log id" |
4306 * Resend Single PDU SMS message with same log id" |
4861 */ |
4307 */ |
4880 // which provides the encoded versions of the PDUs, the SIMTSY has to receive and send. |
4326 // which provides the encoded versions of the PDUs, the SIMTSY has to receive and send. |
4881 // |
4327 // |
4882 INFO_PRINTF1(_L(" Test that sent SMS consisting of single PDUs with the same logId")); |
4328 INFO_PRINTF1(_L(" Test that sent SMS consisting of single PDUs with the same logId")); |
4883 TLogId logid; |
4329 TLogId logid; |
4884 TLogSmsPduData pduData; |
4330 TLogSmsPduData pduData; |
4885 |
|
4886 RSocketServ socketServer; |
|
4887 PrepareRegTestLC(socketServer, 58); |
|
4888 |
|
4889 |
|
4890 RSocket socket; |
4331 RSocket socket; |
4891 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
4332 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
4892 |
4333 |
4893 // Create comms database object |
4334 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
4894 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
4335 |
4895 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
4896 #else |
|
4897 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
4898 #endif |
|
4899 CleanupStack::PushL(db); |
|
4900 |
|
4901 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
4902 |
|
4903 // EReceiveUnstoredClientAck |
|
4904 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
4905 CleanupStack::PushL(smsReceiveModeField); |
|
4906 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
4907 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
4908 smsReceiveModeField->ModifyL(*db); |
|
4909 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
4910 CleanupStack::PopAndDestroy(db); |
|
4911 // Initialization |
|
4912 // Message String |
|
4913 _LIT(KTestMsg1,"CCCCCCC"); |
4336 _LIT(KTestMsg1,"CCCCCCC"); |
4914 |
4337 |
4915 //Set destination and SC numbers |
4338 //Set destination and SC numbers |
4916 iTelephoneNumber=KPekka; |
4339 iTelephoneNumber=KPekka; |
4917 iServiceCenterNumber=KRadiolinjaSC; |
4340 iServiceCenterNumber=KRadiolinjaSC; |
4932 alphabet = (TSmsDataCodingScheme::TSmsAlphabet) nStep; |
4355 alphabet = (TSmsDataCodingScheme::TSmsAlphabet) nStep; |
4933 INFO_PRINTF2(_L("Alphabet:..... %d"),alphabet); |
4356 INFO_PRINTF2(_L("Alphabet:..... %d"),alphabet); |
4934 |
4357 |
4935 // Twice send an Sms with the same logid - step 1 |
4358 // Twice send an Sms with the same logid - step 1 |
4936 // Create a Message |
4359 // Create a Message |
4937 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
4360 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4938 CleanupStack::PushL(smsMessage); |
|
4939 pduData.iType=smsMessage->Type(); |
4361 pduData.iType=smsMessage->Type(); |
4940 |
4362 |
4941 // Get a log Id |
4363 // Get a log Id |
4942 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage, pduData); |
4364 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage, pduData); |
4943 smsMessage->SetLogServerId(logid); |
4365 smsMessage->SetLogServerId(logid); |
4949 SendSmsL(smsMessage,socket); |
4371 SendSmsL(smsMessage,socket); |
4950 |
4372 |
4951 CleanupStack::PopAndDestroy(smsMessage); |
4373 CleanupStack::PopAndDestroy(smsMessage); |
4952 |
4374 |
4953 // Receive SMS |
4375 // Receive SMS |
4954 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4955 WaitForRecvL(socket); |
4376 WaitForRecvL(socket); |
4956 smsMessage = RecvSmsL(socket); |
4377 smsMessage = RecvSmsL(socket); |
4957 INFO_PRINTF1(_L("incoming SMS arrived") ); |
|
4958 |
4378 |
4959 CleanupStack::PushL(smsMessage); |
4379 CleanupStack::PushL(smsMessage); |
4960 TestSmsContentsL(smsMessage,KTestMsg1); |
4380 TestSmsContentsL(smsMessage,KTestMsg1); |
4961 CleanupStack::PopAndDestroy(smsMessage); |
4381 CleanupStack::PopAndDestroy(smsMessage); |
4962 |
4382 |
4963 // Twice send an Sms with the same logid - step 2 |
4383 // Twice send an Sms with the same logid - step 2 |
4964 // Create a Message |
4384 smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
4965 smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
|
4966 CleanupStack::PushL(smsMessage); |
|
4967 pduData.iType=smsMessage->Type(); |
4385 pduData.iType=smsMessage->Type(); |
4968 |
4386 |
4969 // Get a log Id |
4387 // Get a log Id |
4970 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
4388 logid=iSmsStackTestUtils->AddLogEventL(*smsMessage,pduData); |
4971 smsMessage->SetLogServerId(logid); |
4389 smsMessage->SetLogServerId(logid); |
4977 SendSmsL(smsMessage,socket); |
4395 SendSmsL(smsMessage,socket); |
4978 |
4396 |
4979 CleanupStack::PopAndDestroy(smsMessage); |
4397 CleanupStack::PopAndDestroy(smsMessage); |
4980 |
4398 |
4981 //Receive SMS |
4399 //Receive SMS |
4982 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
4983 WaitForRecvL(socket); |
4400 WaitForRecvL(socket); |
4984 smsMessage = RecvSmsL(socket); |
4401 smsMessage = RecvSmsL(socket); |
4985 INFO_PRINTF1(_L("incoming SMS arrived") ); |
|
4986 |
4402 |
4987 CleanupStack::PushL(smsMessage); |
4403 CleanupStack::PushL(smsMessage); |
4988 TestSmsContentsL(smsMessage,KTestMsg1); |
4404 TestSmsContentsL(smsMessage,KTestMsg1); |
4989 CleanupStack::PopAndDestroy(smsMessage); |
4405 CleanupStack::PopAndDestroy(smsMessage); |
4990 } |
4406 } |
4991 |
4407 |
4992 CleanupStack::PopAndDestroy(&socket); |
4408 CleanupStack::PopAndDestroy(&socket); |
4993 CleanupStack::PopAndDestroy(&socketServer); |
|
4994 |
|
4995 |
|
4996 return TestStepResult(); |
4409 return TestStepResult(); |
4997 } |
4410 } |
4998 |
4411 |
4999 |
4412 CTestLog* CTestLog::NewLC(CSmsStackTestUtils& aUtils, RFs& aFs, CSmsBaseTestStep* aTest, TInt aPriority) |
5000 CTestLog* CTestLog::NewLC(CSmsStackTestUtils& aUtils, RFs& aFs, CSmsPrtTestStep* aTest, TInt aPriority) |
|
5001 { |
4413 { |
5002 CTestLog* self = new (ELeave) CTestLog(aUtils, aTest, aPriority); |
4414 CTestLog* self = new (ELeave) CTestLog(aUtils, aTest, aPriority); |
5003 CleanupStack::PushL(self); |
4415 CleanupStack::PushL(self); |
5004 self->ConstructL(aFs); |
4416 self->ConstructL(aFs); |
5005 return self; |
4417 return self; |
5006 } |
4418 } |
5007 |
4419 |
5008 CTestLog::CTestLog(CSmsStackTestUtils& aUtils, CSmsPrtTestStep* aTest, TInt aPriority) |
4420 CTestLog::CTestLog(CSmsStackTestUtils& aUtils, CSmsBaseTestStep* aTest, TInt aPriority) |
5009 : CActive(aPriority), iUtils(aUtils), iTest(aTest) |
4421 : CActive(aPriority), iUtils(aUtils), iTest(aTest) |
5010 { |
4422 { |
5011 CActiveScheduler::Add(this); |
4423 CActiveScheduler::Add(this); |
5012 } |
4424 } |
5013 |
4425 |
5014 CTestLog::~CTestLog() |
4426 CTestLog::~CTestLog() |
5015 { |
4427 { |
5016 Cancel(); |
4428 Cancel(); |
5017 delete iMessage; |
4429 iSocket.Close(); |
5018 delete iLogChecker; |
4430 delete iLogChecker; |
5019 delete iEventLogger; |
4431 delete iEventLogger; |
4432 delete iMessage; |
|
5020 iAddedIds.Close(); |
4433 iAddedIds.Close(); |
5021 } |
4434 } |
5022 |
4435 |
5023 void CTestLog::StartOriginalL() |
4436 void CTestLog::StartOriginalL() |
5024 { |
4437 { |
5025 |
|
5026 iAddedIds.Reset(); |
4438 iAddedIds.Reset(); |
5027 |
4439 |
5028 iLogChecker->CountOriginalIdsL(iStatus); |
4440 iLogChecker->CountOriginalIdsL(iStatus); |
5029 iState = EOriginal; |
4441 iState = EOriginal; |
5030 SetActive(); |
4442 SetActive(); |
5031 CActiveScheduler::Start(); |
4443 CActiveScheduler::Start(); |
5032 |
4444 |
5033 //TEST(KErrNone == iStatus.Int()); |
4445 //TEST(KErrNone == iStatus.Int()); |
5034 iTest->testBooleanTrue(KErrNone == iStatus.Int(),(TText8*)__FILE__, __LINE__); |
4446 iTest->testBooleanTrue(KErrNone == iStatus.Int(),(TText8*)__FILE__, __LINE__); |
5035 |
|
5036 |
|
5037 } |
4447 } |
5038 |
4448 |
5039 void CTestLog::StartCompareL(TInt aExpectError) |
4449 void CTestLog::StartCompareL(TInt aExpectError) |
5040 { |
4450 { |
5041 iLogChecker->CompareNewIdsL(iAddedIds, iStatus); |
4451 iLogChecker->CompareNewIdsL(iAddedIds, iStatus); |
5045 //TEST(aExpectError == iStatus.Int()); |
4455 //TEST(aExpectError == iStatus.Int()); |
5046 iTest->testBooleanTrue(aExpectError == iStatus.Int(),(TText8*)__FILE__, __LINE__); |
4456 iTest->testBooleanTrue(aExpectError == iStatus.Int(),(TText8*)__FILE__, __LINE__); |
5047 } |
4457 } |
5048 |
4458 |
5049 _LIT(KLongText,"3 PDU test SMS message. " |
4459 _LIT(KLongText,"3 PDU test SMS message. " |
5050 L"3 PDU test SMS message. " |
4460 L"3 PDU test SMS message. " |
5051 L"3 PDU test SMS message. " |
4461 L"3 PDU test SMS message. " |
5052 L"3 PDU test SMS message. " |
4462 L"3 PDU test SMS message. " |
5053 L"3 PDU test SMS message. " |
4463 L"3 PDU test SMS message. " |
5054 L"3 PDU test SMS message. " |
4464 L"3 PDU test SMS message. " |
5055 L"3 PDU test SMS message. " |
4465 L"3 PDU test SMS message. " |
5056 L"3 PDU test SMS message. " |
4466 L"3 PDU test SMS message. " |
5057 L"3 PDU test SMS message. " |
4467 L"3 PDU test SMS message. " |
5058 L"3 PDU test SMS message. " |
4468 L"3 PDU test SMS message. " |
5059 L"3 PDU test SMS message. " |
4469 L"3 PDU test SMS message. " |
5060 L"3 PDU test SMS message. " |
4470 L"3 PDU test SMS message. " |
5061 L"3 PDU test SMS message. " |
4471 L"3 PDU test SMS message. " |
5062 L"3 PDU test SMS message. " |
4472 L"3 PDU test SMS message. " |
5063 L"3 PDU test SMS message. " |
4473 L"3 PDU test SMS message. " |
5064 L"3 PDU test SMS message. " |
4474 L"3 PDU test SMS message. " |
5065 L"3 PDU test SMS message. " |
4475 L"3 PDU test SMS message. " |
5066 L"The End."); |
4476 L"The End."); |
5067 |
4477 |
5068 void CTestLog::StartL() |
4478 void CTestLog::StartL() |
5069 { |
4479 { |
5070 |
4480 |
5071 StartOriginalL(); |
4481 StartOriginalL(); |
5072 |
4482 |
5073 iTest->SendSmsL(iMessage,iSocket); |
4483 iTest->SendSmsL(iMessage,iSocket); |
5074 |
|
5075 //INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
5076 iTest->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (_L("waiting for incoming SMS...\n"))); |
|
5077 |
4484 |
5078 delete iMessage; |
4485 delete iMessage; |
5079 iMessage = NULL; |
4486 iMessage = NULL; |
5080 |
4487 |
5081 iTest->WaitForRecvL(iSocket); |
4488 iTest->WaitForRecvL(iSocket); |
5082 iMessage = iTest->RecvSmsL(iSocket); |
4489 iMessage = iTest->RecvSmsL(iSocket); |
5083 |
4490 |
5084 //INFO_PRINTF1(_L("incoming SMS") ); |
4491 iTest->TestSmsContentsL(iMessage, KLongText); |
5085 iTest->Logger().LogExtra(((TText8*)__FILE__), __LINE__, ESevrInfo, (_L("incoming SMS\n"))); |
|
5086 iTest->TestSmsContentsL(iMessage,KLongText); |
|
5087 |
4492 |
5088 User::LeaveIfError(iAddedIds.Append(iMessage->LogServerId())); |
4493 User::LeaveIfError(iAddedIds.Append(iMessage->LogServerId())); |
5089 |
4494 |
5090 StartCompareL(KErrNone); |
4495 StartCompareL(KErrNone); |
5091 |
|
5092 delete iMessage; |
4496 delete iMessage; |
5093 iMessage = NULL; |
4497 iMessage = NULL; |
5094 |
|
5095 CleanupStack::PopAndDestroy(&iSocket); |
|
5096 CleanupStack::PopAndDestroy(&iSocketServer); |
|
5097 } |
4498 } |
5098 |
4499 |
5099 void CTestLog::ConstructL(RFs& aFs) |
4500 void CTestLog::ConstructL(RFs& aFs) |
5100 { |
4501 { |
5101 iLogChecker = CSmsLogChecker::NewL(aFs, iTest, Priority()); |
4502 iLogChecker = CSmsLogChecker::NewL(aFs, iTest, Priority()); |
5102 iEventLogger = CSmsEventLogger::NewL(aFs, Priority()); |
4503 iEventLogger = CSmsEventLogger::NewL(aFs, Priority()); |
5103 |
4504 |
5104 iTest->PrepareRegTestLC(iSocketServer, 50); |
4505 // iTest->ConnectSocketServerL(iSocketServer); |
5105 |
4506 iTest->iSmsStackTestUtils->OpenSmsSocketL(iTest->iSocketServer,iSocket,ESmsAddrRecvAny); |
5106 iTest->iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,iSocket,ESmsAddrRecvAny); |
|
5107 |
4507 |
5108 //Set destination and SC numbers |
4508 //Set destination and SC numbers |
5109 iTest->iTelephoneNumber=KRegTestNumber; |
4509 iTest->iTelephoneNumber=KRegTestNumber; |
5110 iTest->iServiceCenterNumber=KVodafoneSC; |
4510 iTest->iServiceCenterNumber=KVodafoneSC; |
5111 |
4511 |
5132 |
4532 |
5133 TVerdict CTestConcatenatedMessageLogging::doTestStepL() |
4533 TVerdict CTestConcatenatedMessageLogging::doTestStepL() |
5134 { |
4534 { |
5135 INFO_PRINTF1(_L("Test Tx and Rx SMS with 3 PDU message")); |
4535 INFO_PRINTF1(_L("Test Tx and Rx SMS with 3 PDU message")); |
5136 |
4536 |
5137 |
|
5138 CTestLog* testLog = CTestLog::NewLC(*iSmsStackTestUtils, iFs,this, CActive::EPriorityStandard); |
4537 CTestLog* testLog = CTestLog::NewLC(*iSmsStackTestUtils, iFs,this, CActive::EPriorityStandard); |
5139 testLog->StartL(); |
4538 testLog->StartL(); |
5140 |
4539 |
5141 CleanupStack::PopAndDestroy(testLog); |
4540 CleanupStack::PopAndDestroy(testLog); |
5142 |
|
5143 return TestStepResult(); |
4541 return TestStepResult(); |
5144 } |
4542 } |
5145 |
4543 |
5146 |
4544 |
5147 TVerdict CTestEnumerationOfStatusReport::doTestStepL() |
4545 TVerdict CTestEnumerationOfStatusReport::doTestStepL() |
5148 { |
4546 { |
5149 INFO_PRINTF1(_L("Test enumeration of status report")); |
4547 INFO_PRINTF1(_L("Test enumeration of status report")); |
5150 |
|
5151 RSocketServ socketServer; |
|
5152 PrepareRegTestLC(socketServer, 51); |
|
5153 |
|
5154 |
|
5155 RSocket socket; |
4548 RSocket socket; |
5156 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation); |
4549 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrLocalOperation); |
5157 |
4550 |
5158 CSmsMessage* smsMessage = CreateSmsMessageLC(CSmsPDU::ESmsStatusReport, CSmsBuffer::NewL(), iTelephoneNumber); |
4551 CSmsMessage* smsMessage = CreateSmsMessageLC(CSmsPDU::ESmsStatusReport, CSmsBuffer::NewL(), iTelephoneNumber); |
5159 |
4552 |
5160 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
4553 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
5161 |
4554 |
5162 WriteToSIML(socket, *smsMessage); |
4555 WriteSmsToSimL(*smsMessage, socket); |
5163 |
4556 |
5164 // Enumerate messages from Store |
4557 // Enumerate messages from Store |
5165 TRequestStatus status; |
4558 TRequestStatus status; |
5166 TPckgBuf<TUint> sbuf; |
4559 TPckgBuf<TUint> sbuf; |
5167 sbuf()=0; |
4560 sbuf()=0; |
5168 |
4561 |
5169 //Now enumerate messages from store |
4562 //Now enumerate messages from store |
5170 socket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv); |
4563 socket.Ioctl(KIoctlEnumerateSmsMessages,status,&sbuf, KSolSmsProv); |
5171 User::WaitForRequest(status); |
4564 User::WaitForRequest(status); |
5172 TEST(status.Int() == KErrNone); |
4565 TESTCHECK(status.Int(), KErrNone, "Enumerate messages from store"); |
5173 |
4566 |
5174 //sbuf() includes the count of messages on Store |
4567 //sbuf() includes the count of messages on Store |
5175 TInt count = sbuf(); |
4568 TInt count = sbuf(); |
5176 INFO_PRINTF2(_L("%d enumerated messages"), count); |
4569 INFO_PRINTF2(_L("%d enumerated messages"), count); |
5177 TEST(count==1); |
4570 TEST(count==1); |
5178 |
4571 |
5179 CleanupStack::PopAndDestroy(smsMessage); |
4572 CleanupStack::PopAndDestroy(smsMessage); |
5180 CleanupStack::PopAndDestroy(&socket); |
4573 CleanupStack::PopAndDestroy(&socket); |
5181 CleanupStack::PopAndDestroy(&socketServer); |
4574 return TestStepResult(); |
5182 |
4575 } |
4576 |
|
4577 TVerdict CTestWriteStatusReportToSIM::doTestStepL() |
|
4578 { |
|
4579 INFO_PRINTF1(_L("Test write of status report to SIM")); |
|
4580 RSocket socket; |
|
4581 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrLocalOperation); |
|
4582 |
|
4583 CSmsMessage* smsMessage = CreateSmsMessageLC(CSmsPDU::ESmsStatusReport, CSmsBuffer::NewL(), iTelephoneNumber); |
|
4584 |
|
4585 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
|
4586 |
|
4587 WriteSmsToSimL(*smsMessage, socket); |
|
4588 |
|
4589 CleanupStack::PopAndDestroy(smsMessage); |
|
4590 CleanupStack::PopAndDestroy(&socket); |
|
5183 return TestStepResult(); |
4591 return TestStepResult(); |
5184 } |
4592 } |
5185 |
|
5186 |
|
5187 TVerdict CTestWriteStatusReportToSIM::doTestStepL() |
|
5188 { |
|
5189 INFO_PRINTF1(_L("Test write of status report to SIM")); |
|
5190 |
|
5191 RSocketServ socketServer; |
|
5192 PrepareRegTestLC(socketServer, 49); |
|
5193 |
|
5194 |
|
5195 RSocket socket; |
|
5196 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrLocalOperation); |
|
5197 |
|
5198 CSmsMessage* smsMessage = CreateSmsMessageLC(CSmsPDU::ESmsStatusReport, CSmsBuffer::NewL(), iTelephoneNumber); |
|
5199 |
|
5200 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
|
5201 |
|
5202 WriteToSIML(socket, *smsMessage); |
|
5203 |
|
5204 CleanupStack::PopAndDestroy(smsMessage); |
|
5205 CleanupStack::PopAndDestroy(&socket); |
|
5206 CleanupStack::PopAndDestroy(&socketServer); |
|
5207 |
|
5208 return TestStepResult(); |
|
5209 } |
|
5210 |
|
5211 |
4593 |
5212 TVerdict CTestTxSmsWithDelayedCompletion::doTestStepL() |
4594 TVerdict CTestTxSmsWithDelayedCompletion::doTestStepL() |
5213 { |
4595 { |
5214 /** |
4596 /** |
5215 * INC045765/DEF46216 - Test that sms stack does not time out if the TSY takes 1 minute |
4597 * INC045765/DEF46216 - Test that sms stack does not time out if the TSY takes 1 minute |
5216 * 59 seconds to complete sending. This test case is cloned from |
4598 * 59 seconds to complete sending. This test case is cloned from |
5217 * TestSimpleTxAndRxL(), simply removing the message receiption portion |
4599 * TestSimpleTxAndRxL(), simply removing the message receiption portion |
5218 * and adding a delay to the SIM TSY's completion time in tsms_config.txt. |
4600 * and adding a delay to the SIM TSY's completion time in tsms_config.txt. |
5219 * DEF047240 - read sendTryTimeout from ESK file |
4601 * DEF047240 - read sendTryTimeout from ESK file |
5220 */ |
4602 */ |
5221 |
|
5222 INFO_PRINTF1(_L("Test Simple Tx SMS")); |
4603 INFO_PRINTF1(_L("Test Simple Tx SMS")); |
5223 |
|
5224 RSocketServ socketServer; |
|
5225 PrepareRegTestLC(socketServer, 60); |
|
5226 |
|
5227 |
|
5228 RSocket socket; |
4604 RSocket socket; |
5229 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
4605 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
5230 |
4606 |
5231 // Create comms database object |
4607 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
5232 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
5233 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
5234 #else |
|
5235 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
5236 #endif |
|
5237 CleanupStack::PushL(db); |
|
5238 |
|
5239 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
5240 |
|
5241 // EReceiveUnstoredClientAck |
|
5242 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
5243 CleanupStack::PushL(smsReceiveModeField); |
|
5244 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
5245 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
5246 smsReceiveModeField->ModifyL(*db); |
|
5247 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
5248 CleanupStack::PopAndDestroy(db); |
|
5249 |
4608 |
5250 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
4609 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
5251 |
4610 |
5252 //Set destination and SC numbers |
4611 //Set destination and SC numbers |
5253 iTelephoneNumber=KPekka; |
4612 iTelephoneNumber=KPekka; |
5254 iServiceCenterNumber=KRadiolinjaSC; |
4613 iServiceCenterNumber=KRadiolinjaSC; |
5255 |
4614 |
5256 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
4615 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5257 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
4616 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
5258 CleanupStack::PushL(smsMessage); |
|
5259 |
4617 |
5260 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
4618 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
5261 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
4619 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
5262 |
4620 |
5263 //Send SMS |
4621 //Send SMS |
5264 SendSmsL(smsMessage,socket); |
4622 SendSmsL(smsMessage,socket); |
5265 |
|
5266 CleanupStack::PopAndDestroy(smsMessage); |
4623 CleanupStack::PopAndDestroy(smsMessage); |
5267 |
4624 |
5268 INFO_PRINTF1(_L("SMS message sent successfully") ); |
4625 INFO_PRINTF1(_L("SMS message sent successfully") ); |
5269 |
4626 |
5270 CleanupStack::PopAndDestroy(&socket); |
4627 CleanupStack::PopAndDestroy(&socket); |
5271 CleanupStack::PopAndDestroy(&socketServer); |
|
5272 |
|
5273 return TestStepResult(); |
4628 return TestStepResult(); |
5274 }; |
4629 }; |
5275 |
4630 |
5276 |
|
5277 TVerdict CTestSmsStoreReadCancel::doTestStepL() |
4631 TVerdict CTestSmsStoreReadCancel::doTestStepL() |
5278 /** |
4632 /** |
5279 * Test Sms message storage - cancel during read |
4633 * Test Sms message storage - cancel during read |
5280 */ |
4634 */ |
5281 { |
4635 { |
5282 return TestStepResult() ; |
4636 return TestStepResult() ; |
5283 } |
4637 } |
5284 |
|
5285 |
4638 |
5286 TVerdict CTestBindWhenPoweredDownWithPublishSubscribe::doTestStepL() |
4639 TVerdict CTestBindWhenPoweredDownWithPublishSubscribe::doTestStepL() |
5287 /** |
4640 /** |
5288 * Test bind()ing when powered-down, and subsequent dequeueing of messages upon power-up |
4641 * Test bind()ing when powered-down, and subsequent dequeueing of messages upon power-up |
5289 * using Publish and Subscribe |
4642 * using Publish and Subscribe |
5290 */ |
4643 */ |
5291 { |
4644 { |
5292 INFO_PRINTF1(_L("Test bind() when powered-down with Publish and Subscribe")); |
4645 INFO_PRINTF1(_L("Test bind() when powered-down with Publish and Subscribe")); |
5293 |
4646 |
5294 RSocketServ socketServer; |
|
5295 TInt ret = socketServer.Connect(KSocketMessageSlots); |
|
5296 TESTL(ret == KErrNone); |
|
5297 CleanupClosePushL(socketServer); |
|
5298 |
|
5299 // Now switch phone off |
|
5300 INFO_PRINTF1(_L("switching phone off") ); |
4647 INFO_PRINTF1(_L("switching phone off") ); |
5301 |
|
5302 RProperty phonePowerProperty; |
4648 RProperty phonePowerProperty; |
5303 User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid)); |
4649 User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid)); |
5304 CleanupClosePushL(phonePowerProperty); |
4650 CleanupClosePushL(phonePowerProperty); |
5305 |
4651 |
5306 // Create the socket and open for SIM operations |
4652 // Create the socket and open for SIM operations |
5307 RSocket socket; |
4653 RSocket socket; |
5308 INFO_PRINTF1(_L("binding socket") ); |
4654 INFO_PRINTF1(_L("binding socket") ); |
5309 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
4655 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
5310 |
4656 |
5311 // knock power off because opening of socket brought it up |
4657 // knock power off because opening of socket brought it up |
5312 TRequestStatus status; |
4658 UpdatePhonePowerStatusL(phonePowerProperty, ESAPhoneOff); |
5313 TInt phonePowerCheck; |
|
5314 do |
|
5315 { |
|
5316 phonePowerProperty.Subscribe(status); |
|
5317 User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff)); |
|
5318 User::After(5 * 1000000); // sleep 5 secs; |
|
5319 User::WaitForRequest(status); |
|
5320 TEST(status.Int() == KErrNone); |
|
5321 User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck)); |
|
5322 } |
|
5323 while (phonePowerCheck==ESAPhoneOn); |
|
5324 |
4659 |
5325 // Set the SimTSY config. |
4660 // Set the SimTSY config. |
5326 SetSimTSYTestNumberL(29); |
4661 SetSimTSYTestNumberL(29); |
5327 |
4662 |
5328 // Briefly wait for receipt on it - this shouldn't happen when powered off |
4663 // Briefly wait for receipt on it - this shouldn't happen when powered off |
5329 TBool bRcv = TimedWaitForRecvL(socket, 5* 1000000); |
4664 TBool bRcv = TimedWaitForRecvL(socket, 5* 1000000); |
5330 TEST_CHECKL(bRcv, EFalse, _L("Receive should fail with phone off")); |
4665 TEST_CHECKL(bRcv, EFalse, _L("Receive should fail with phone off")); |
5331 |
4666 |
5332 // Power on & wait for rx again |
4667 // Power on & wait for rx again |
5333 do |
4668 UpdatePhonePowerStatusL(phonePowerProperty, ESAPhoneOn); |
5334 { |
4669 |
5335 phonePowerProperty.Subscribe(status); |
|
5336 User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn)); |
|
5337 User::After(5 * 1000000); // sleep 5 secs; |
|
5338 User::WaitForRequest(status); |
|
5339 TEST(status.Int() == KErrNone); |
|
5340 User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck)); |
|
5341 } |
|
5342 while (phonePowerCheck==ESAPhoneOff); |
|
5343 |
|
5344 // Briefly wait for receipt on it - this should now happen |
4670 // Briefly wait for receipt on it - this should now happen |
5345 bRcv = TimedWaitForRecvL(socket, 5 * 1000000); |
4671 bRcv = TimedWaitForRecvL(socket, 5 * 1000000); |
5346 TEST_CHECKL(bRcv, ETrue, _L("Receive should now succeed with phone on again")); |
4672 TEST_CHECKL(bRcv, ETrue, _L("Receive should now succeed with phone on again")); |
5347 CSmsMessage* smsMessage = RecvSmsL(socket); |
4673 CSmsMessage* smsMessage = RecvSmsL(socket); |
5348 |
4674 |
5349 CleanupStack::PushL(smsMessage); |
4675 CleanupStack::PushL(smsMessage); |
5350 |
4676 |
5351 TPtrC fromAddr = smsMessage->ToFromAddress(); |
4677 TPtrC fromAddr = smsMessage->ToFromAddress(); |
5352 INFO_PRINTF2(_L("Received SMS from: %S"), &fromAddr); |
4678 INFO_PRINTF2(_L("Received SMS from: %S"), &fromAddr); |
5353 CleanupStack::PopAndDestroy(smsMessage); |
4679 |
5354 |
4680 CleanupStack::PopAndDestroy(smsMessage); |
5355 CleanupStack::PopAndDestroy(&socket); |
4681 CleanupStack::PopAndDestroy(&socket); |
5356 CleanupStack::PopAndDestroy(&phonePowerProperty); |
4682 CleanupStack::PopAndDestroy(&phonePowerProperty); |
5357 CleanupStack::PopAndDestroy(&socketServer); |
4683 return TestStepResult() ; |
5358 |
4684 } |
5359 return TestStepResult() ; |
|
5360 } |
|
5361 |
|
5362 |
4685 |
5363 TVerdict CTestObserverNotifiedWhenPoweredDownWithPublishSubscribe::doTestStepL() |
4686 TVerdict CTestObserverNotifiedWhenPoweredDownWithPublishSubscribe::doTestStepL() |
5364 /** |
4687 /** |
5365 * Fix Defect 42937 |
4688 * Fix Defect 42937 |
5366 * |
4689 * |
5379 * |
4702 * |
5380 * Identical operation of test now using publish and subscribe |
4703 * Identical operation of test now using publish and subscribe |
5381 */ |
4704 */ |
5382 { |
4705 { |
5383 INFO_PRINTF1(_L("Test observer when powered-down")); |
4706 INFO_PRINTF1(_L("Test observer when powered-down")); |
5384 |
|
5385 RSocketServ socketServer; |
|
5386 PrepareRegTestLC(socketServer, 59); |
|
5387 |
|
5388 |
|
5389 // Open the socket and bind it to ESmsAddrApplication16BitPort 245 |
4707 // Open the socket and bind it to ESmsAddrApplication16BitPort 245 |
5390 RSocket socket; |
4708 RSocket socket; |
5391 TSmsAddr addr16; |
4709 TSmsAddr addr16; |
5392 addr16.SetSmsAddrFamily(ESmsAddrApplication16BitPort); |
4710 addr16.SetSmsAddrFamily(ESmsAddrApplication16BitPort); |
5393 TInt port(245); |
4711 TInt port(245); |
5394 addr16.SetPort(port); |
4712 addr16.SetPort(port); |
5395 |
4713 |
5396 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,addr16); |
4714 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,addr16); |
5397 |
4715 |
5398 // Switch phone off, causing the stack to notify the observer |
4716 // Switch phone off, causing the stack to notify the observer |
5399 // corresponding to ESmsAddrApplication16BitPort 245 |
4717 // corresponding to ESmsAddrApplication16BitPort 245 |
5400 INFO_PRINTF1(_L("switching phone off") ); |
4718 INFO_PRINTF1(_L("switching phone off") ); |
5401 |
4719 |
5402 RProperty phonePowerProperty; |
4720 RProperty phonePowerProperty; |
5403 User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid)); |
4721 User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid)); |
5404 CleanupClosePushL(phonePowerProperty); |
4722 CleanupClosePushL(phonePowerProperty); |
5405 |
4723 |
5406 // knock power off because opening of socket brought it up |
4724 // knock power off because opening of socket brought it up |
5407 TInt phonePowerCheck; |
4725 UpdatePhonePowerStatusL(phonePowerProperty, ESAPhoneOff); |
5408 TRequestStatus status; |
|
5409 do |
|
5410 { |
|
5411 phonePowerProperty.Subscribe(status); |
|
5412 User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff)); |
|
5413 User::After(5 * 1000000); // sleep 5 secs; |
|
5414 User::WaitForRequest(status); |
|
5415 TEST(status.Int() == KErrNone); |
|
5416 User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck)); |
|
5417 } |
|
5418 while (phonePowerCheck==ESAPhoneOn); |
|
5419 |
4726 |
5420 // bring power back up |
4727 // bring power back up |
5421 do |
4728 UpdatePhonePowerStatusL(phonePowerProperty, ESAPhoneOn); |
5422 { |
|
5423 phonePowerProperty.Subscribe(status); |
|
5424 User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn)); |
|
5425 User::After(5 * 1000000); // sleep 5 secs; |
|
5426 User::WaitForRequest(status); |
|
5427 TEST(status.Int() == KErrNone); |
|
5428 User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck)); |
|
5429 } |
|
5430 while (phonePowerCheck==ESAPhoneOff); |
|
5431 |
4729 |
5432 CleanupStack::PopAndDestroy(&phonePowerProperty); |
4730 CleanupStack::PopAndDestroy(&phonePowerProperty); |
5433 CleanupStack::PopAndDestroy(&socket); |
4731 CleanupStack::PopAndDestroy(&socket); |
5434 CleanupStack::PopAndDestroy(&socketServer); |
4732 return TestStepResult(); |
5435 |
4733 } |
5436 return TestStepResult(); |
|
5437 } |
|
5438 |
|
5439 |
4734 |
5440 TVerdict CTestSmsCNumberChangeWithPublishSubscribe::doTestStepL() |
4735 TVerdict CTestSmsCNumberChangeWithPublishSubscribe::doTestStepL() |
5441 /** |
4736 /** |
5442 * Test SMSC number change |
4737 * Test SMSC number change |
5443 * Added to verify fix for defect # INC040029. |
4738 * Added to verify fix for defect # INC040029. |
5457 * Updated to use publish and subscribe |
4752 * Updated to use publish and subscribe |
5458 * |
4753 * |
5459 */ |
4754 */ |
5460 { |
4755 { |
5461 INFO_PRINTF1(_L("Test SMSC Number Change with Publish and Subscribe")); |
4756 INFO_PRINTF1(_L("Test SMSC Number Change with Publish and Subscribe")); |
5462 |
|
5463 RSocketServ socketServer; |
|
5464 TRequestStatus status; |
|
5465 PrepareRegTestLC(socketServer, 55); |
|
5466 |
|
5467 |
|
5468 // Open the socket for SIM operations |
4757 // Open the socket for SIM operations |
5469 RSocket socket1; |
4758 RSocket socket1; |
5470 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket1,ESmsAddrLocalOperation); |
4759 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket1, ESmsAddrLocalOperation); |
5471 RSmsSocketReadStream readstream1(socket1); |
4760 RSmsSocketReadStream readstream1(socket1); |
5472 |
4761 |
5473 // Create the smspList |
4762 // Create the smspList |
5474 CMobilePhoneSmspList* smspList1 = CMobilePhoneSmspList::NewL(); |
4763 CMobilePhoneSmspList* smspList1 = CMobilePhoneSmspList::NewL(); |
5475 CleanupStack::PushL(smspList1); |
4764 CleanupStack::PushL(smspList1); |
5476 |
4765 |
5477 // Make read SMS params request to the SMS Stack |
4766 // Make read SMS params request to the SMS Stack |
5478 socket1.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
4767 TRequestStatus status; |
5479 INFO_PRINTF1(_L("waiting for SMS parameters...") ); |
4768 TBool tryAgain = ETrue; |
5480 User::WaitForRequest(status); |
4769 TInt attempts (0); |
5481 TEST(status.Int() == KErrNone); |
4770 TInt maxRetries = 3; |
5482 INFO_PRINTF1(_L("Received SMS parameters...")); |
4771 |
4772 // Enumerate messages from store. If it fails with KErrNotReady wait for 3 seconds to |
|
4773 // allow sms protocol to fully load and repeat |
|
4774 while( tryAgain && attempts++ < maxRetries ) |
|
4775 { |
|
4776 socket1.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
|
4777 User::WaitForRequest(status); |
|
4778 INFO_PRINTF2(_L("Reading SMS parameters returned [status=%d]"), status.Int()); |
|
4779 if ( status.Int() == KErrNotReady ) |
|
4780 { |
|
4781 INFO_PRINTF1(_L("Trying to enumerate again... ")); |
|
4782 User::After(3000000); |
|
4783 } |
|
4784 else |
|
4785 { |
|
4786 tryAgain = EFalse; |
|
4787 } |
|
4788 } |
|
4789 |
|
4790 TESTCHECK(status.Int(), KErrNone, "Reading SMS parameters"); |
|
5483 |
4791 |
5484 // Read list from stream and make acknowledgement to the SMS Stack |
4792 // Read list from stream and make acknowledgement to the SMS Stack |
5485 |
|
5486 INFO_PRINTF1(_L("About to write to smspList1...")); |
4793 INFO_PRINTF1(_L("About to write to smspList1...")); |
5487 readstream1 >> *smspList1; |
4794 readstream1 >> *smspList1; |
5488 INFO_PRINTF1(_L("written to smspList1...")); |
4795 INFO_PRINTF1(_L("written to smspList1...")); |
5489 socket1.Ioctl(KIoctlCompleteReadSmsParams,status,NULL,KSolSmsProv); |
4796 socket1.Ioctl(KIoctlCompleteReadSmsParams,status,NULL,KSolSmsProv); |
5490 User::WaitForRequest(status); |
4797 User::WaitForRequest(status); |
5491 TEST(status.Int() == KErrNone); |
4798 TESTCHECK(status.Int(), KErrNone, "Completing Read SMS parameters..."); |
5492 |
4799 |
5493 iSmsStackTestUtils->PrintSmspList(*smspList1); |
4800 iSmsStackTestUtils->PrintSmspList(*smspList1); |
5494 |
4801 |
5495 // Switch phone off/on area |
4802 // Switch phone off/on area |
5496 // Init required members |
4803 // Init required members |
5497 RProperty phonePowerProperty; |
4804 RProperty phonePowerProperty; |
5498 User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid)); |
4805 User::LeaveIfError(phonePowerProperty.Attach(KUidSystemCategory, KUidPhonePwr.iUid)); |
5499 CleanupClosePushL(phonePowerProperty); |
4806 CleanupClosePushL(phonePowerProperty); |
5500 |
4807 |
5501 // knock power off |
4808 // knock power off |
5502 INFO_PRINTF1(_L("switching phone off")); |
4809 UpdatePhonePowerStatusL(phonePowerProperty, ESAPhoneOff); |
5503 TInt phonePowerCheck; |
|
5504 do |
|
5505 { |
|
5506 phonePowerProperty.Subscribe(status); |
|
5507 User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOff)); |
|
5508 User::After(5 * 1000000); // sleep 5 secs; |
|
5509 User::WaitForRequest(status); |
|
5510 TEST(status.Int() == KErrNone); |
|
5511 User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck)); |
|
5512 } |
|
5513 while (phonePowerCheck==ESAPhoneOn); |
|
5514 |
4810 |
5515 // Move to new test |
4811 // Move to new test |
5516 RProperty testNumberProperty; |
4812 RProperty testNumberProperty; |
5517 User::LeaveIfError(testNumberProperty.Attach(KUidPSSimTsyCategory, KPSSimTsyTestNumber)); |
4813 User::LeaveIfError(testNumberProperty.Attach(KUidPSSimTsyCategory, KPSSimTsyTestNumber)); |
5518 CleanupClosePushL(testNumberProperty); |
4814 CleanupClosePushL(testNumberProperty); |
5527 User::LeaveIfError(testNumberProperty.Get(testNumberCheck)); |
4823 User::LeaveIfError(testNumberProperty.Get(testNumberCheck)); |
5528 if (TestNumber != testNumberCheck) |
4824 if (TestNumber != testNumberCheck) |
5529 User::Leave(KErrNotFound); |
4825 User::Leave(KErrNotFound); |
5530 |
4826 |
5531 // Power back on |
4827 // Power back on |
5532 INFO_PRINTF1(_L("switching phone on") ); |
4828 UpdatePhonePowerStatusL(phonePowerProperty, ESAPhoneOn); |
5533 do |
|
5534 { |
|
5535 phonePowerProperty.Subscribe(status); |
|
5536 User::LeaveIfError(phonePowerProperty.Set(KUidSystemCategory,KUidPhonePwr.iUid,ESAPhoneOn)); |
|
5537 User::After(5 * 1000000); // sleep 5 secs; |
|
5538 User::WaitForRequest(status); |
|
5539 TEST(status.Int() == KErrNone); |
|
5540 User::LeaveIfError(phonePowerProperty.Get(phonePowerCheck)); |
|
5541 } |
|
5542 while (phonePowerCheck==ESAPhoneOff); |
|
5543 |
4829 |
5544 CleanupStack::PopAndDestroy(&testNumberProperty); |
4830 CleanupStack::PopAndDestroy(&testNumberProperty); |
5545 CleanupStack::PopAndDestroy(&phonePowerProperty); |
4831 CleanupStack::PopAndDestroy(&phonePowerProperty); |
5546 |
4832 |
5547 // Open the second socket for SIM operations |
4833 // Open the second socket for SIM operations |
5548 RSocket socket2; |
4834 RSocket socket2; |
5549 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket2,ESmsAddrLocalOperation); |
4835 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket2,ESmsAddrLocalOperation); |
5550 |
4836 |
5551 RSmsSocketReadStream readstream2(socket2); |
4837 RSmsSocketReadStream readstream2(socket2); |
5552 |
4838 |
5553 // Create the smspList |
4839 // Create the smspList |
5554 CMobilePhoneSmspList* smspList2 = CMobilePhoneSmspList::NewL(); |
4840 CMobilePhoneSmspList* smspList2 = CMobilePhoneSmspList::NewL(); |
5556 |
4842 |
5557 // Make read SMS params request to the SMS Stack |
4843 // Make read SMS params request to the SMS Stack |
5558 socket2.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
4844 socket2.Ioctl(KIoctlReadSmsParams,status,NULL,KSolSmsProv); |
5559 INFO_PRINTF1(_L("waiting for SMS parameters...") ); |
4845 INFO_PRINTF1(_L("waiting for SMS parameters...") ); |
5560 User::WaitForRequest(status); |
4846 User::WaitForRequest(status); |
5561 TEST(status.Int() == KErrNone); |
4847 TESTCHECK(status.Int(), KErrNone, "Receiving SMS parameters..."); |
5562 |
4848 |
5563 // Read list from stream and make acknowledgement to the SMS Stack |
4849 // Read list from stream and make acknowledgement to the SMS Stack |
5564 readstream2 >> *smspList2; |
4850 readstream2 >> *smspList2; |
5565 socket2.Ioctl(KIoctlCompleteReadSmsParams,status,NULL,KSolSmsProv); |
4851 socket2.Ioctl(KIoctlCompleteReadSmsParams,status,NULL,KSolSmsProv); |
5566 User::WaitForRequest(status); |
4852 User::WaitForRequest(status); |
5567 TEST(status.Int() == KErrNone); |
4853 TESTCHECK(status.Int(), KErrNone, "Completing Read SMS parameters..."); |
5568 |
4854 |
5569 iSmsStackTestUtils->PrintSmspList(*smspList2); |
4855 iSmsStackTestUtils->PrintSmspList(*smspList2); |
5570 |
4856 |
5571 // Test that the two numbers are different |
4857 // Test that the two numbers are different |
5572 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy1; |
4858 RMobileSmsMessaging::TMobileSmspEntryV1 entryToTsy1; |
5577 INFO_PRINTF3(_L("Call center Numbers: CS1 <%S> CS2 <%S>"), |
4863 INFO_PRINTF3(_L("Call center Numbers: CS1 <%S> CS2 <%S>"), |
5578 &entryToTsy1.iServiceCentre.iTelNumber, |
4864 &entryToTsy1.iServiceCentre.iTelNumber, |
5579 &entryToTsy2.iServiceCentre.iTelNumber); |
4865 &entryToTsy2.iServiceCentre.iTelNumber); |
5580 |
4866 |
5581 // Real test - both parameters have a vaild SC number and they are different - it leaves if error |
4867 // Real test - both parameters have a vaild SC number and they are different - it leaves if error |
5582 TEST( |
4868 TEST((entryToTsy1.iValidParams & RMobileSmsMessaging::KSCAIncluded) && |
5583 (entryToTsy1.iValidParams & RMobileSmsMessaging::KSCAIncluded) && |
4869 (entryToTsy2.iValidParams & RMobileSmsMessaging::KSCAIncluded) && |
5584 (entryToTsy2.iValidParams & RMobileSmsMessaging::KSCAIncluded) && |
4870 (entryToTsy1.iServiceCentre.iTelNumber != entryToTsy2.iServiceCentre.iTelNumber)); |
5585 (entryToTsy1.iServiceCentre.iTelNumber != entryToTsy2.iServiceCentre.iTelNumber) |
4871 |
5586 ); |
|
5587 |
|
5588 // Give memory back |
|
5589 CleanupStack::PopAndDestroy(smspList2); |
4872 CleanupStack::PopAndDestroy(smspList2); |
5590 CleanupStack::PopAndDestroy(&socket2); |
4873 CleanupStack::PopAndDestroy(&socket2); |
5591 CleanupStack::PopAndDestroy(smspList1); |
4874 CleanupStack::PopAndDestroy(smspList1); |
5592 CleanupStack::PopAndDestroy(&socket1); |
4875 CleanupStack::PopAndDestroy(&socket1); |
5593 CleanupStack::PopAndDestroy(&socketServer); |
4876 return TestStepResult(); |
5594 |
|
5595 return TestStepResult(); |
|
5596 } |
4877 } |
5597 |
4878 |
5598 |
|
5599 TVerdict CTestStatusReportTime::doTestStepL() |
4879 TVerdict CTestStatusReportTime::doTestStepL() |
5600 /** |
4880 /** |
5601 * Test a simple Transmit and Receive with status reporting, check time stamp |
4881 * Test a simple Transmit and Receive with status reporting, check time stamp |
5602 */ |
4882 */ |
5603 { |
4883 { |
5604 INFO_PRINTF1(_L("Test Tx an SMS and then receive a status report")); |
4884 INFO_PRINTF1(_L("Test Tx an SMS and then receive a status report")); |
5605 |
|
5606 RSocketServ socketServer; |
|
5607 PrepareRegTestLC(socketServer, 62); |
|
5608 |
|
5609 |
|
5610 RSocket socket; |
4885 RSocket socket; |
5611 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
4886 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
5612 |
4887 |
5613 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
4888 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
5614 |
4889 |
5615 //Set destination and SC numbers |
4890 //Set destination and SC numbers |
5616 iTelephoneNumber=KPekka; |
4891 iTelephoneNumber=KPekka; |
5627 TTime timeSend; |
4902 TTime timeSend; |
5628 timeSend = smsMessageSend->Time(); |
4903 timeSend = smsMessageSend->Time(); |
5629 |
4904 |
5630 //Send SMS |
4905 //Send SMS |
5631 SendSmsL(smsMessageSend,socket); |
4906 SendSmsL(smsMessageSend,socket); |
5632 |
|
5633 CleanupStack::PopAndDestroy(smsMessageSend); |
4907 CleanupStack::PopAndDestroy(smsMessageSend); |
5634 |
4908 |
5635 //Receive status report |
4909 //Receive status report |
5636 TSmsServiceCenterAddress telephoneNumberSC; |
4910 TSmsServiceCenterAddress telephoneNumberSC; |
5637 telephoneNumberSC.Copy( KPekka ); |
4911 telephoneNumberSC.Copy( KPekka ); |
5638 |
4912 |
5639 //Receive SMS |
4913 //Receive SMS |
5640 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
5641 WaitForRecvL(socket); |
4914 WaitForRecvL(socket); |
5642 CSmsMessage* smsMessageRecv = RecvSmsL(socket); |
4915 CSmsMessage* smsMessageRecv = RecvSmsL(socket); |
5643 |
|
5644 INFO_PRINTF1(_L("incoming SMS") ); |
|
5645 |
4916 |
5646 //Check the status report (timestamp should be 10 seconds later) |
4917 //Check the status report (timestamp should be 10 seconds later) |
5647 CleanupStack::PushL(smsMessageRecv); |
4918 CleanupStack::PushL(smsMessageRecv); |
5648 TBool isSR = (smsMessageRecv->Type()==CSmsPDU::ESmsStatusReport); |
4919 TBool isSR = (smsMessageRecv->Type()==CSmsPDU::ESmsStatusReport); |
5649 |
4920 |
5659 timeRecv = smsMessageRecv->Time(); |
4930 timeRecv = smsMessageRecv->Time(); |
5660 |
4931 |
5661 if (timeRecv < timeSend) |
4932 if (timeRecv < timeSend) |
5662 { |
4933 { |
5663 // fail condition |
4934 // fail condition |
5664 INFO_PRINTF1(_L("Timestamp of received status report earlier than sent SMS!")); |
4935 ERR_PRINTF1(_L("Timestamp of received status report earlier than sent SMS!")); |
4936 SetTestStepResult(EFail); |
|
5665 } |
4937 } |
5666 else if (timeRecv == timeSend) |
4938 else if (timeRecv == timeSend) |
5667 { |
4939 { |
5668 // fail condition |
4940 // fail condition |
5669 INFO_PRINTF1(_L("Timestamp of received status report same as sent SMS!")); |
4941 ERR_PRINTF1(_L("Timestamp of received status report same as sent SMS!")); |
4942 SetTestStepResult(EFail); |
|
5670 } |
4943 } |
5671 else |
4944 else |
5672 { |
4945 { |
5673 // pass condition |
4946 // pass condition |
5674 INFO_PRINTF1(_L("Timestamp of received status report later than sent SMS!")); |
4947 INFO_PRINTF1(_L("Timestamp of received status report later than sent SMS!")); |
5675 } |
4948 } |
5676 |
|
5677 TEST(timeRecv > timeSend); |
|
5678 } |
4949 } |
5679 else |
4950 else |
5680 INFO_PRINTF1(_L("Received SMS is NOT a Status report!")); |
4951 { |
5681 |
4952 ERR_PRINTF1(_L("Received SMS is NOT a Status report!")); |
5682 TEST(isSR==1); |
4953 SetTestStepResult(EFail); |
5683 |
4954 } |
5684 CleanupStack::PopAndDestroy(smsMessageRecv); |
4955 |
5685 CleanupStack::PopAndDestroy(); // socket |
4956 CleanupStack::PopAndDestroy(2, &socket); // smsMessageRecv, socket |
5686 CleanupStack::PopAndDestroy(&socketServer); |
|
5687 |
|
5688 return TestStepResult() ; |
4957 return TestStepResult() ; |
5689 } |
4958 } |
5690 |
4959 |
5691 |
4960 //TODO: move to WAPPROT test suite |
5692 TVerdict CTestTx8BitWapWithStatus::doTestStepL() |
4961 TVerdict CTestTx8BitWapWithStatus::doTestStepL() |
5693 // Fix Defect 42714 |
4962 // Fix Defect 42714 |
5694 // This test case verifies that 8 Bit Wap messages can |
4963 // This test case verifies that 8 Bit Wap messages can |
5695 // sent with their Status Report Bit set. Hither to this |
4964 // sent with their Status Report Bit set. Hither to this |
5696 // functionality was only provided for 7 Bit Wap Messages. |
4965 // functionality was only provided for 7 Bit Wap Messages. |
5707 // Note: It is not possible to correlate the outgoing Wap Message to |
4976 // Note: It is not possible to correlate the outgoing Wap Message to |
5708 // the inbound status message as the interface does not provide |
4977 // the inbound status message as the interface does not provide |
5709 // access to the log id. This will be fixed in defect 42716. |
4978 // access to the log id. This will be fixed in defect 42716. |
5710 // |
4979 // |
5711 { |
4980 { |
5712 INFO_PRINTF1(_L("Test sending a 8 Bit Wap Message")); |
4981 INFO_PRINTF1(_L("Test sending a 8 Bit Wap Message and receiving a status message")); |
5713 INFO_PRINTF1(_L("and receiving a status message")); |
4982 |
5714 |
4983 // (1) Create a Socket for sending wap messages |
5715 RSocketServ socketServer; |
|
5716 RSocket socket; |
4984 RSocket socket; |
5717 TRequestStatus status; |
4985 TInt ret=socket.Open(iSocketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol); |
5718 |
|
5719 PrepareRegTestLC(socketServer, 63); |
|
5720 |
|
5721 |
|
5722 socketServer.StartProtocol(KSMSAddrFamily,KSockDatagram,KSMSDatagramProtocol, |
|
5723 status); |
|
5724 |
|
5725 // (1) Create a Socket for sending wap messages |
|
5726 TInt ret=socket.Open(socketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol); |
|
5727 INFO_PRINTF2(_L("Socket return code is %d"),ret); |
4986 INFO_PRINTF2(_L("Socket return code is %d"),ret); |
5728 TESTL(ret == KErrNone); |
4987 TESTL(ret == KErrNone); |
5729 CleanupClosePushL(socket); |
4988 CleanupClosePushL(socket); |
5730 |
4989 |
5731 TWapSmsDataCodingScheme codingScheme = EWapSms8BitDCS; |
4990 TWapSmsDataCodingScheme codingScheme = EWapSms8BitDCS; |
5732 ret = socket.SetOpt(KWapSmsOptionNameDCS,KWapSmsOptionLevel,codingScheme); |
4991 ret = socket.SetOpt(KWapSmsOptionNameDCS,KWapSmsOptionLevel,codingScheme); |
5733 TESTL(ret==KErrNone); |
4992 TESTL(ret==KErrNone); |
5734 |
4993 |
5735 // (2) Create a socket for receiving status reports |
4994 // (2) Create a socket for receiving status reports |
5736 RSocket statusSocket; |
4995 RSocket statusSocket; |
5737 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,statusSocket,ESmsAddrStatusReport); |
4996 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,statusSocket,ESmsAddrStatusReport); |
5738 // socket pushed onto stack inside method call. |
4997 // socket pushed onto stack inside method call. |
5739 |
4998 |
5740 // (3) Create a Wap address and bind it to the socket |
4999 // (3) Create a Wap address and bind it to the socket |
5741 TWapAddr wapAddr; |
5000 TWapAddr wapAddr; |
5742 wapAddr.SetWapPort(TWapPortNumber(226)); |
5001 wapAddr.SetWapPort(TWapPortNumber(226)); |
5748 ret = socket.Bind(wapAddr); |
5007 ret = socket.Bind(wapAddr); |
5749 TESTL(ret==KErrNone); |
5008 TESTL(ret==KErrNone); |
5750 |
5009 |
5751 // (4) Send a test message to address specified in setupgsmsms.txt |
5010 // (4) Send a test message to address specified in setupgsmsms.txt |
5752 // and the port specified above |
5011 // and the port specified above |
5753 _LIT8(KWapTestMsg,"BEGIN:VCARD\r\nVERSION:2.1\r\nFN:Jal\r\nN:Jal\r\nORG:PanSoftware\r\nTITLE:Director\r\nLABEL:Islington\r\nEND:VCARD\r\n"); |
5012 TRequestStatus status; |
5013 _LIT8(KWapTestMsg,"BEGIN:VCARD\r\nVERSION:2.1\r\nFN:Jal\r\nN:Jal\r\nORG:PanSoftware\r\nTITLE:Director\r\nLABEL:Islington\r\nEND:VCARD\r\n"); |
|
5014 |
|
5754 socket.SendTo(KWapTestMsg,wapAddr,0,status); |
5015 socket.SendTo(KWapTestMsg,wapAddr,0,status); |
5755 User::WaitForRequest(status); |
5016 User::WaitForRequest(status); |
5756 TESTL(status.Int()==KErrNone); |
5017 TESTL(status.Int()==KErrNone); |
5757 INFO_PRINTF2(_L("Sent datagram length: %d on socket OK"),KWapTestMsg().Length()); |
5018 INFO_PRINTF2(_L("Sent datagram length: %d on socket OK"),KWapTestMsg().Length()); |
5758 |
5019 |
5759 // (5) Message has been sent successfully, now check that |
5020 // (5) Message has been sent successfully, now check that |
5760 // status report is received for that address. |
5021 // status report is received for that address. |
5761 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
5762 WaitForRecvL(statusSocket); |
5022 WaitForRecvL(statusSocket); |
5763 INFO_PRINTF1(_L("received status report...") ); |
5023 INFO_PRINTF1(_L("received status report...") ); |
5764 |
5024 |
5765 User::After(200000); |
5025 User::After(200000); |
5766 |
|
5767 CleanupStack::PopAndDestroy(&statusSocket); |
5026 CleanupStack::PopAndDestroy(&statusSocket); |
5768 CleanupStack::PopAndDestroy(&socket); |
5027 CleanupStack::PopAndDestroy(&socket); |
5769 CleanupStack::PopAndDestroy(&socketServer); |
|
5770 |
|
5771 return TestStepResult(); |
5028 return TestStepResult(); |
5772 } |
5029 } |
5773 |
|
5774 |
5030 |
5775 TVerdict CTestSimStoreCorruptMessage::doTestStepL() |
5031 TVerdict CTestSimStoreCorruptMessage::doTestStepL() |
5776 /** |
5032 /** |
5777 * Added to verify fix for DEF039913 |
5033 * Added to verify fix for DEF039913 |
5778 * This test case is testing how the stack processes PDUs that the TSY declares corrupt |
5034 * This test case is testing how the stack processes PDUs that the TSY declares corrupt |
5782 * and then one final valid PDU. The test checks that both, and only, the 2 valid PDUs |
5038 * and then one final valid PDU. The test checks that both, and only, the 2 valid PDUs |
5783 * are decoded and forwarded to the client. |
5039 * are decoded and forwarded to the client. |
5784 */ |
5040 */ |
5785 { |
5041 { |
5786 INFO_PRINTF1(_L("Test to see whether RMobileSimStore ignores corrupted SMSs")); |
5042 INFO_PRINTF1(_L("Test to see whether RMobileSimStore ignores corrupted SMSs")); |
5787 |
|
5788 RSocketServ socketServer; |
|
5789 PrepareRegTestLC(socketServer, 64); |
|
5790 |
|
5791 |
|
5792 // Open the socket |
|
5793 RSocket socket; |
5043 RSocket socket; |
5794 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
5044 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
5795 |
5045 |
5046 // Enumerate messages |
|
5796 TRequestStatus status; |
5047 TRequestStatus status; |
5797 |
|
5798 // Enumerate messages |
|
5799 RPointerArray<CSmsMessage> messages; |
5048 RPointerArray<CSmsMessage> messages; |
5800 CleanupResetAndDestroyPushL(messages); |
5049 CleanupResetAndDestroyPushL(messages); |
5050 |
|
5801 ReadSmsStoreL(socket, messages, status); |
5051 ReadSmsStoreL(socket, messages, status); |
5802 |
5052 TESTCHECK(status.Int(), KErrNone, "Enumerate messages"); |
5803 TEST(status.Int() == KErrNone); |
5053 TESTCHECK(messages.Count(), 2, "CHecking message count equals to 2"); |
5804 |
|
5805 TEST(messages.Count()==2); |
|
5806 |
5054 |
5807 CleanupStack::PopAndDestroy(&messages); |
5055 CleanupStack::PopAndDestroy(&messages); |
5808 CleanupStack::PopAndDestroy(&socket); |
5056 CleanupStack::PopAndDestroy(&socket); |
5809 CleanupStack::PopAndDestroy(&socketServer); |
5057 return TestStepResult() ; |
5810 |
5058 } |
5811 return TestStepResult() ; |
|
5812 } |
|
5813 |
|
5814 |
5059 |
5815 TVerdict CTestCorruptPduWithNegativeResponse::doTestStepL() |
5060 TVerdict CTestCorruptPduWithNegativeResponse::doTestStepL() |
5816 /** |
5061 /** |
5817 * Test for DEF47323 |
5062 * Test for DEF47323 |
5818 * (1) Configure the sms.esk file so that a corrupt pdu will be negatively acknowledged. |
5063 * (1) Configure the sms.esk file so that a corrupt pdu will be negatively acknowledged. |
5820 * (3) Receive a second valid PDU, positively acknowledge it and forward it to the client. |
5065 * (3) Receive a second valid PDU, positively acknowledge it and forward it to the client. |
5821 * |
5066 * |
5822 */ |
5067 */ |
5823 { |
5068 { |
5824 INFO_PRINTF1(_L("TestCorruptPduWithNegativeResponse")); |
5069 INFO_PRINTF1(_L("TestCorruptPduWithNegativeResponse")); |
5825 |
|
5826 RSocketServ socketServer; |
|
5827 PrepareRegTestLC(socketServer, 65); |
|
5828 |
|
5829 |
|
5830 RSocket socket; |
5070 RSocket socket; |
5831 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
5071 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
5832 |
5072 |
5833 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
5073 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
5834 |
5074 |
5835 //Set destination and SC numbers |
5075 //Set destination and SC numbers |
5836 iTelephoneNumber=KPekka; |
5076 iTelephoneNumber=KPekka; |
5837 iServiceCenterNumber=KRadiolinjaSC; |
5077 iServiceCenterNumber=KRadiolinjaSC; |
5838 |
|
5839 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5078 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5840 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
5079 |
5841 CleanupStack::PushL(smsMessage); |
5080 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
5842 |
5081 |
5843 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
5082 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
5844 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
5083 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
5845 |
5084 |
5846 //Send SMS |
5085 //Send SMS |
5847 SendSmsL(smsMessage,socket); |
5086 SendSmsL(smsMessage,socket); |
5848 |
|
5849 CleanupStack::PopAndDestroy(smsMessage); |
5087 CleanupStack::PopAndDestroy(smsMessage); |
5850 |
5088 |
5851 //Receive SMS |
5089 //Receive SMS |
5852 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
5853 WaitForRecvL(socket); |
5090 WaitForRecvL(socket); |
5854 smsMessage = RecvSmsL(socket); |
5091 smsMessage = RecvSmsL(socket); |
5855 |
|
5856 INFO_PRINTF1(_L("incoming SMS") ); |
|
5857 |
|
5858 CleanupStack::PushL(smsMessage); |
5092 CleanupStack::PushL(smsMessage); |
5093 |
|
5859 TestSmsContentsL(smsMessage,KTestMsg1); |
5094 TestSmsContentsL(smsMessage,KTestMsg1); |
5860 |
5095 |
5861 CleanupStack::PopAndDestroy(smsMessage); |
5096 CleanupStack::PopAndDestroy(smsMessage); |
5862 CleanupStack::PopAndDestroy(&socket); |
5097 CleanupStack::PopAndDestroy(&socket); |
5863 CleanupStack::PopAndDestroy(&socketServer); |
5098 return TestStepResult(); |
5864 |
|
5865 return TestStepResult(); |
|
5866 } |
5099 } |
5867 |
|
5868 |
5100 |
5869 TVerdict CTestBootTimer::doTestStepL() |
5101 TVerdict CTestBootTimer::doTestStepL() |
5870 /** |
5102 /** |
5871 * Test for DEF054033: |
5103 * Test for DEF054033: |
5872 * Check that the sms stack boot timer value can be configured from the |
5104 * Check that the sms stack boot timer value can be configured from the |
5886 * so when the sms stack's boot timer expires after the configured time, |
5118 * so when the sms stack's boot timer expires after the configured time, |
5887 * the messages are delivered to the default socket. |
5119 * the messages are delivered to the default socket. |
5888 */ |
5120 */ |
5889 { |
5121 { |
5890 INFO_PRINTF1(_L("Test receive multi-part WAP message")); |
5122 INFO_PRINTF1(_L("Test receive multi-part WAP message")); |
5891 |
|
5892 RSocketServ socketServer; |
|
5893 PrepareRegTestLC(socketServer, 45); |
|
5894 |
|
5895 |
|
5896 RSocket socket; |
5123 RSocket socket; |
5897 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
5124 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
5898 |
5125 |
5899 TBool msgRcvd = TimedWaitForRecvL(socket, 40000000); |
5126 TBool msgRcvd = TimedWaitForRecvL(socket, 40000000); |
5900 |
5127 |
5901 if (msgRcvd) |
5128 if (msgRcvd) |
5902 { |
5129 { |
5903 INFO_PRINTF1(_L("WAP message delivered to messaging application")); |
5130 INFO_PRINTF1(_L("WAP message delivered to messaging application")); |
5904 INFO_PRINTF1(_L("on default watcher")); |
5131 INFO_PRINTF1(_L("on default watcher")); |
5905 } |
5132 } |
5906 else |
5133 else |
5907 { |
5134 { |
5908 INFO_PRINTF1(_L("Boot Time did not timeout - Test Failed")); |
5135 INFO_PRINTF1(_L("Boot Time did not timeout - Test Failed")); |
5909 User::Leave(KErrGeneral); |
5136 User::Leave(KErrGeneral); |
5910 } |
5137 } |
5911 |
5138 |
5912 CleanupStack::PopAndDestroy(&socket); |
5139 CleanupStack::PopAndDestroy(&socket); |
5913 CleanupStack::PopAndDestroy(&socketServer); |
|
5914 |
|
5915 return TestStepResult() ; |
5140 return TestStepResult() ; |
5916 } |
5141 } |
5917 |
5142 |
5918 |
|
5919 TVerdict CTestCSmsMessageTimeStamp::doTestStepL() |
5143 TVerdict CTestCSmsMessageTimeStamp::doTestStepL() |
5920 /** |
5144 /** |
5921 * Creating a CSmsMessage object, checking it's timestamp is set to UTC time |
5145 * Creating a CSmsMessage object, checking it's timestamp is set to UTC time |
5922 */ |
5146 */ |
5923 |
|
5924 { |
5147 { |
5925 //Get the current UTC offset |
5148 //Get the current UTC offset |
5926 TTime currUTCTime; |
5149 TTime currUTCTime; |
5927 currUTCTime.UniversalTime(); |
5150 currUTCTime.UniversalTime(); |
5928 TTimeIntervalSeconds currUTCOffset=User::UTCOffset(); |
5151 TTimeIntervalSeconds currUTCOffset=User::UTCOffset(); |
5948 //Set UTC and offset |
5171 //Set UTC and offset |
5949 User::SetUTCTimeAndOffset(utcTime,offset); |
5172 User::SetUTCTimeAndOffset(utcTime,offset); |
5950 |
5173 |
5951 //Create a message |
5174 //Create a message |
5952 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5175 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5953 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg,alphabet); |
5176 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg,alphabet); |
5954 CleanupStack::PushL(smsMessage); |
|
5955 |
5177 |
5956 // Test time stamp, Time() |
5178 // Test time stamp, Time() |
5957 // Time must be = UTC, we allow 1 second for Message to be created. |
5179 // Time must be = UTC, we allow 1 second for Message to be created. |
5958 TTime smsTimeStamp=smsMessage->Time(); |
5180 TTime smsTimeStamp=smsMessage->Time(); |
5959 TInt allowableVariance=1; |
5181 TInt allowableVariance=1; |
6060 messageOffset=smsMessage->UTCOffset(); |
5282 messageOffset=smsMessage->UTCOffset(); |
6061 TEST(offset==messageOffset); |
5283 TEST(offset==messageOffset); |
6062 |
5284 |
6063 CleanupStack::PopAndDestroy(smsMessage); |
5285 CleanupStack::PopAndDestroy(smsMessage); |
6064 User::SetUTCTimeAndOffset(currUTCTime,currUTCOffset); |
5286 User::SetUTCTimeAndOffset(currUTCTime,currUTCOffset); |
6065 |
|
6066 return TestStepResult(); |
5287 return TestStepResult(); |
6067 } |
5288 } |
6068 |
|
6069 |
5289 |
6070 TVerdict CTestCSmsMessageWithDeliverPDU::doTestStepL() |
5290 TVerdict CTestCSmsMessageWithDeliverPDU::doTestStepL() |
6071 { |
5291 { |
6072 /** |
5292 /** |
6073 * Creating a CSmsMessage object when receiving a message with a deliver PDU |
5293 * Creating a CSmsMessage object when receiving a message with a deliver PDU |
6075 const TInt KMaxAllowanceSeconds=4; |
5295 const TInt KMaxAllowanceSeconds=4; |
6076 const TInt KMaxRxPeriod=60; |
5296 const TInt KMaxRxPeriod=60; |
6077 TTimeIntervalSeconds allowableDelay(KMaxAllowanceSeconds); |
5297 TTimeIntervalSeconds allowableDelay(KMaxAllowanceSeconds); |
6078 TTimeIntervalSeconds rxPeriod(KMaxRxPeriod); |
5298 TTimeIntervalSeconds rxPeriod(KMaxRxPeriod); |
6079 |
5299 |
6080 |
|
6081 INFO_PRINTF1(_L("Test Simple Tx and Rx SMS")); |
5300 INFO_PRINTF1(_L("Test Simple Tx and Rx SMS")); |
6082 |
|
6083 RSocketServ socketServer; |
|
6084 PrepareRegTestLC(socketServer, 66); |
|
6085 |
|
6086 |
|
6087 RSocket socket; |
5301 RSocket socket; |
6088 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
5302 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
6089 |
5303 |
6090 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
5304 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
6091 |
5305 |
6092 //Set destination and SC numbers |
5306 //Set destination and SC numbers |
6093 iTelephoneNumber=KPekka; |
5307 iTelephoneNumber=KPekka; |
6094 iServiceCenterNumber=KRadiolinjaSC; |
5308 iServiceCenterNumber=KRadiolinjaSC; |
6095 |
5309 |
6096 //Create the message |
5310 //Create the message |
6097 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5311 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
6098 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
5312 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
6099 CleanupStack::PushL(smsMessage); |
|
6100 |
5313 |
6101 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
5314 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
6102 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
5315 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
6103 |
5316 |
6104 //Send SMS |
|
6105 SendSmsL(smsMessage,socket); |
5317 SendSmsL(smsMessage,socket); |
6106 |
5318 CleanupStack::PopAndDestroy(smsMessage); |
6107 CleanupStack::PopAndDestroy(smsMessage); |
|
6108 |
|
6109 //Receive SMS |
|
6110 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
6111 |
5319 |
6112 //Wait for first SMS |
5320 //Wait for first SMS |
6113 WaitForRecvL(socket); |
5321 WaitForRecvL(socket); |
6114 |
5322 |
6115 //Before we create the message received, we get the UTC time and the offset. |
5323 //Before we create the message received, we get the UTC time and the offset. |
6146 TTimeIntervalSeconds specificOffset(specificOffsetValue); |
5354 TTimeIntervalSeconds specificOffset(specificOffsetValue); |
6147 User::SetUTCTimeAndOffset(specificUTCTime,specificOffset); |
5355 User::SetUTCTimeAndOffset(specificUTCTime,specificOffset); |
6148 |
5356 |
6149 CleanupStack::PopAndDestroy(smsMessage); |
5357 CleanupStack::PopAndDestroy(smsMessage); |
6150 |
5358 |
6151 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
6152 |
|
6153 // Wait for second message to arrive. Must be round 60 seconds |
5359 // Wait for second message to arrive. Must be round 60 seconds |
6154 WaitForRecvL(socket); |
5360 WaitForRecvL(socket); |
6155 |
5361 |
6156 //Receive second message |
5362 //Receive second message |
6157 smsMessage = RecvSmsL(socket); |
5363 smsMessage = RecvSmsL(socket); |
6158 CleanupStack::PushL(smsMessage); |
5364 CleanupStack::PushL(smsMessage); |
6159 |
|
6160 INFO_PRINTF1(_L("incoming second SMS") ); |
5365 INFO_PRINTF1(_L("incoming second SMS") ); |
6161 |
5366 |
6162 //Checks make on message |
5367 //Checks make on message |
6163 messageTime=smsMessage->Time(); |
5368 messageTime=smsMessage->Time(); |
6164 TEST(messageTime>=specificUTCTime+rxPeriod-allowableDelay&&messageTime<=specificUTCTime+rxPeriod+allowableDelay); |
5369 TEST(messageTime>=specificUTCTime+rxPeriod-allowableDelay&&messageTime<=specificUTCTime+rxPeriod+allowableDelay); |
6197 TEST(timeStampOffset==0); |
5402 TEST(timeStampOffset==0); |
6198 TEST(expectedTime==timeStamp); |
5403 TEST(expectedTime==timeStamp); |
6199 |
5404 |
6200 CleanupStack::PopAndDestroy(smsMessage); |
5405 CleanupStack::PopAndDestroy(smsMessage); |
6201 CleanupStack::PopAndDestroy(&socket); |
5406 CleanupStack::PopAndDestroy(&socket); |
6202 CleanupStack::PopAndDestroy(&socketServer); |
5407 return TestStepResult(); |
6203 |
|
6204 return TestStepResult(); |
|
6205 } |
5408 } |
6206 |
5409 |
6207 |
5410 |
6208 TVerdict CTestCSmsMessageWithStatusReportPDU::doTestStepL() |
5411 TVerdict CTestCSmsMessageWithStatusReportPDU::doTestStepL() |
6209 /** |
5412 /** |
6210 * Test the timestamp in a statusReport PDU |
5413 * Test the timestamp in a statusReport PDU |
6211 */ |
5414 */ |
6212 { |
5415 { |
6213 INFO_PRINTF1(_L("Test Tx an SMS and then receive a status report")); |
5416 INFO_PRINTF1(_L("Test Tx an SMS and then receive a status report")); |
6214 |
|
6215 RSocketServ socketServer; |
|
6216 PrepareRegTestLC(socketServer, 67); |
|
6217 |
|
6218 |
|
6219 RSocket socket; |
5417 RSocket socket; |
6220 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
5418 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
6221 |
5419 |
6222 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
5420 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
6223 |
5421 |
6224 //Set destination and SC numbers |
5422 //Set destination and SC numbers |
6225 iTelephoneNumber=KPekka; |
5423 iTelephoneNumber=KPekka; |
6230 CleanupStack::PushL(smsMessage); |
5428 CleanupStack::PushL(smsMessage); |
6231 |
5429 |
6232 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
5430 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
6233 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
5431 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
6234 |
5432 |
6235 //Send SMS |
|
6236 SendSmsL(smsMessage,socket); |
5433 SendSmsL(smsMessage,socket); |
6237 CleanupStack::PopAndDestroy(smsMessage); |
5434 CleanupStack::PopAndDestroy(smsMessage); |
6238 |
5435 |
6239 //Receive status report |
|
6240 TSmsServiceCenterAddress telephoneNumber; |
5436 TSmsServiceCenterAddress telephoneNumber; |
6241 telephoneNumber.Copy( KPekka ); |
5437 telephoneNumber.Copy( KPekka ); |
6242 |
5438 |
6243 //Wait for status report |
5439 // Receive status report |
6244 WaitForRecvL(socket); |
5440 WaitForRecvL(socket); |
6245 |
|
6246 //Get message from socket |
|
6247 smsMessage = RecvSmsL(socket); |
5441 smsMessage = RecvSmsL(socket); |
6248 |
5442 |
6249 //Get the status report |
5443 //Get the status report |
6250 CleanupStack::PushL(smsMessage); |
5444 CleanupStack::PushL(smsMessage); |
6251 TEST(smsMessage->Type()==CSmsPDU::ESmsStatusReport); |
5445 TEST(smsMessage->Type()==CSmsPDU::ESmsStatusReport); |
6290 TEST(expectedTime==timeStamp); |
5484 TEST(expectedTime==timeStamp); |
6291 //actualDateTime=timeStamp.DateTime(); |
5485 //actualDateTime=timeStamp.DateTime(); |
6292 |
5486 |
6293 CleanupStack::PopAndDestroy(smsMessage); |
5487 CleanupStack::PopAndDestroy(smsMessage); |
6294 CleanupStack::PopAndDestroy(&socket); |
5488 CleanupStack::PopAndDestroy(&socket); |
6295 CleanupStack::PopAndDestroy(&socketServer); |
5489 return TestStepResult() ; |
6296 |
|
6297 return TestStepResult() ; |
|
6298 } |
5490 } |
6299 |
5491 |
6300 TVerdict CTestCSmsMessageWithSubmitPDU::doTestStepL() |
5492 TVerdict CTestCSmsMessageWithSubmitPDU::doTestStepL() |
6301 /** |
5493 /** |
6302 * Test creating a sms message with a submit pdu. PDU timestamp should reflect |
5494 * Test creating a sms message with a submit pdu. PDU timestamp should reflect |
6303 * UTC value, offset and validity period. |
5495 * UTC value, offset and validity period. |
6304 */ |
5496 */ |
6305 { |
5497 { |
6306 _LIT(KTestMsg,"test message, 8bits, length 30"); |
|
6307 INFO_PRINTF1(_L("Test Tx an SMS and let SIMTSY validate the validityPeriod in the submit pdu")); |
5498 INFO_PRINTF1(_L("Test Tx an SMS and let SIMTSY validate the validityPeriod in the submit pdu")); |
6308 |
|
6309 RSocketServ socketServer; |
|
6310 PrepareRegTestLC(socketServer, 68); |
|
6311 |
|
6312 RSocket socket; |
5499 RSocket socket; |
6313 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
5500 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
6314 |
5501 |
6315 //-------------------------------------------------------- |
5502 //-------------------------------------------------------- |
6316 // Set the universal time |
5503 // Set the universal time |
6317 //Setup a date time |
5504 //Setup a date time |
6318 TInt year=2009; |
5505 TInt year=2009; |
6331 //Set UTC and offset |
5518 //Set UTC and offset |
6332 User::SetUTCTimeAndOffset(utcTime,offset); |
5519 User::SetUTCTimeAndOffset(utcTime,offset); |
6333 //-------------------------------------------------------- |
5520 //-------------------------------------------------------- |
6334 |
5521 |
6335 //Create a message |
5522 //Create a message |
5523 _LIT(KTestMsg,"test message, 8bits, length 30"); |
|
6336 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5524 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
6337 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg,alphabet); |
5525 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg,alphabet); |
6338 CleanupStack::PushL(smsMessage); |
|
6339 |
5526 |
6340 // Test validity period of submit pdu |
5527 // Test validity period of submit pdu |
6341 TEST(smsMessage->Type()==CSmsPDU::ESmsSubmit); |
5528 TEST(smsMessage->Type()==CSmsPDU::ESmsSubmit); |
6342 |
5529 |
6343 //Get submit pdu |
5530 //Get submit pdu |
6351 |
5538 |
6352 pdu.SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFSemiOctet); |
5539 pdu.SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFSemiOctet); |
6353 |
5540 |
6354 //Send the message |
5541 //Send the message |
6355 SendSmsL(smsMessage,socket); |
5542 SendSmsL(smsMessage,socket); |
6356 TEST(ETrue); |
5543 |
6357 |
5544 CleanupStack::PopAndDestroy(smsMessage); |
6358 CleanupStack::PopAndDestroy(smsMessage); |
|
6359 //-------------------------------------------------------- |
|
6360 CleanupStack::PopAndDestroy(&socket); |
5545 CleanupStack::PopAndDestroy(&socket); |
6361 CleanupStack::PopAndDestroy(&socketServer); |
|
6362 |
|
6363 return TestStepResult() ; |
5546 return TestStepResult() ; |
6364 } |
5547 } |
6365 |
|
6366 |
5548 |
6367 TVerdict CTestHandlePID40h::doTestStepL() |
5549 TVerdict CTestHandlePID40h::doTestStepL() |
6368 /** |
5550 /** |
6369 * Test for DEF055800 |
5551 * Test for DEF055800 |
6370 * Check that PDUs with PID = 0x40 are acknowledged but not forwarded to |
5552 * Check that PDUs with PID = 0x40 are acknowledged but not forwarded to |
6371 * the inbox. |
5553 * the inbox. |
6372 */ |
5554 */ |
6373 { |
5555 { |
6374 INFO_PRINTF1(_L("Check that PDUs with PID = 0x40 are acknowledged but not forwarded to the inbox.")); |
5556 INFO_PRINTF1(_L("Check that PDUs with PID = 0x40 are acknowledged but not forwarded to the inbox.")); |
6375 |
|
6376 RSocketServ socketServer; |
|
6377 PrepareRegTestLC(socketServer, 69); |
|
6378 |
|
6379 RSocket socket; |
5557 RSocket socket; |
6380 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
5558 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
6381 |
5559 |
6382 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
5560 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
6383 |
5561 |
6384 //Set destination and SC numbers |
5562 //Set destination and SC numbers |
6385 iTelephoneNumber=KPekka; |
5563 iTelephoneNumber=KPekka; |
6386 iServiceCenterNumber=KRadiolinjaSC; |
5564 iServiceCenterNumber=KRadiolinjaSC; |
6387 |
5565 |
6388 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
5566 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
6389 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
5567 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
6390 CleanupStack::PushL(smsMessage); |
|
6391 |
5568 |
6392 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
5569 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
6393 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
5570 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
6394 |
5571 |
6395 //Send SMS |
5572 //Send SMS |
6396 SendSmsL(smsMessage,socket); |
5573 SendSmsL(smsMessage,socket); |
6397 |
5574 |
6398 CleanupStack::PopAndDestroy(smsMessage); |
5575 CleanupStack::PopAndDestroy(smsMessage); |
6399 |
5576 |
6400 //Receive 2 PDUs |
5577 //Receive 2 PDUs |
6401 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
6402 WaitForRecvL(socket); |
5578 WaitForRecvL(socket); |
6403 smsMessage = RecvSmsL(socket); |
5579 smsMessage = RecvSmsL(socket); |
6404 |
|
6405 INFO_PRINTF1(_L("incoming SMS") ); |
|
6406 |
|
6407 CleanupStack::PushL(smsMessage); |
5580 CleanupStack::PushL(smsMessage); |
5581 |
|
6408 TestSmsContentsL(smsMessage,KTestMsg1); |
5582 TestSmsContentsL(smsMessage,KTestMsg1); |
6409 |
5583 |
6410 //Save the received message to the SMS storage |
5584 //Save the received message to the SMS storage |
6411 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
5585 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
6412 WriteSmsToSimL(*smsMessage, socket); |
5586 WriteSmsToSimL(*smsMessage, socket); |
6415 // Enumerate messages from Store |
5589 // Enumerate messages from Store |
6416 RPointerArray<CSmsMessage> messages; |
5590 RPointerArray<CSmsMessage> messages; |
6417 ReadSmsStoreL(socket, messages); |
5591 ReadSmsStoreL(socket, messages); |
6418 // The standard PDU should be in the SIM store, along with two other messages |
5592 // The standard PDU should be in the SIM store, along with two other messages |
6419 // The PDU with PID 0x40 should be NOT be present |
5593 // The PDU with PID 0x40 should be NOT be present |
6420 TInt count = messages.Count(); |
5594 TESTCHECK(messages.Count(), 3, "Expecting 3 messages in SIM Store" ); |
6421 TEST(count==3); |
|
6422 INFO_PRINTF2(_L("Expecting 3 messages in SIM Store, found %d."),count); |
|
6423 messages.ResetAndDestroy(); |
5595 messages.ResetAndDestroy(); |
6424 |
5596 |
6425 CleanupStack::PopAndDestroy(&socket); |
5597 CleanupStack::PopAndDestroy(&socket); |
6426 CleanupStack::PopAndDestroy(&socketServer); |
|
6427 |
|
6428 return TestStepResult() ; |
5598 return TestStepResult() ; |
6429 } |
5599 } |
6430 |
5600 |
6431 TVerdict CTestDiskSpaceMidRangeClass0Class2::doTestStepPreambleL() |
5601 TVerdict CTestDiskSpaceMidRangeClass0Class2::doTestStepPreambleL() |
6432 { |
5602 { |
6433 CSmsPrtTestStep::doTestStepPreambleL(); |
5603 CSmsBaseTestStep::doTestStepPreambleL(); |
6434 |
5604 |
6435 #ifdef _DEBUG |
5605 #ifdef _DEBUG |
6436 TInt err = RProperty::Define(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey, RProperty::EInt); |
5606 TInt err = RProperty::Define(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey, RProperty::EInt); |
6437 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
5607 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
6438 { |
5608 { |
6455 TVerdict CTestDiskSpaceMidRangeClass0Class2::doTestStepL() |
5625 TVerdict CTestDiskSpaceMidRangeClass0Class2::doTestStepL() |
6456 { |
5626 { |
6457 #ifndef _DEBUG |
5627 #ifndef _DEBUG |
6458 INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode.")); |
5628 INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode.")); |
6459 #else |
5629 #else |
6460 |
|
6461 // |
5630 // |
6462 // Disk space should be available at the start... |
5631 // Disk space should be available at the start... |
6463 // |
5632 // |
6464 TInt diskSpaceStatus(ESmsDiskSpaceUnknown); |
5633 TInt diskSpaceStatus(ESmsDiskSpaceUnknown); |
6465 TInt ret(KErrUnknown); |
5634 TInt ret(KErrUnknown); |
6479 SetHighLowLimitsAndDiskSpaceLevelL(highDrop, lowDrop, freeDrop); |
5648 SetHighLowLimitsAndDiskSpaceLevelL(highDrop, lowDrop, freeDrop); |
6480 |
5649 |
6481 // |
5650 // |
6482 // Load the SMS Stack... |
5651 // Load the SMS Stack... |
6483 // |
5652 // |
6484 RSocketServ socketServer; |
|
6485 PrepareRegTestLC(socketServer, 131); |
|
6486 |
|
6487 RSocket socket; |
5653 RSocket socket; |
6488 iSmsStackTestUtils->OpenSmsSocketLC(socketServer, socket, ESmsAddrRecvAny); |
5654 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrRecvAny); |
6489 |
5655 |
6490 // |
5656 // |
6491 // Attempt to receive an SMS - Class 0 message should arrive... |
5657 // Attempt to receive an SMS - Class 0 message should arrive... |
6492 // |
5658 // |
6493 INFO_PRINTF1(_L("Receiving SMS message - Class 0 message should arrive...")); |
5659 INFO_PRINTF1(_L("Receiving SMS message - Class 0 message should arrive...")); |
5660 |
|
5661 CSmsMessage* message1 = CreateSMSL(); |
|
5662 CleanupStack::PushL(message1); |
|
5663 SendSmsL(message1, socket); |
|
5664 CleanupStack::PopAndDestroy(message1); |
|
6494 |
5665 |
6495 TBool messageReceived; |
5666 TBool messageReceived; |
6496 |
|
6497 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
5667 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
6498 if (messageReceived) |
5668 if( messageReceived ) |
6499 { |
5669 { |
6500 CSmsMessage* sms = RecvSmsL(socket); |
5670 CSmsMessage* sms = RecvSmsL(socket); |
6501 |
5671 |
6502 INFO_PRINTF1(_L("Message received!")); |
5672 INFO_PRINTF1(_L("Message received!")); |
6503 |
5673 |
6505 |
5675 |
6506 if (!sms->SmsPDU().DataCodingSchemePresent() || |
5676 if (!sms->SmsPDU().DataCodingSchemePresent() || |
6507 !sms->SmsPDU().Class(msgClass) || |
5677 !sms->SmsPDU().Class(msgClass) || |
6508 msgClass != TSmsDataCodingScheme::ESmsClass0) |
5678 msgClass != TSmsDataCodingScheme::ESmsClass0) |
6509 { |
5679 { |
6510 INFO_PRINTF1(_L("Message was not Class 0!")); |
5680 ERR_PRINTF1(_L("Message was not Class 0!")); |
6511 TEST(EFalse); |
5681 SetTestStepResult(EFail); |
6512 } |
5682 } |
6513 |
5683 |
6514 delete sms; |
5684 delete sms; |
6515 } |
5685 } |
6516 else |
5686 else |
6517 { |
5687 { |
6518 INFO_PRINTF1(_L("Message not received!")); |
5688 ERR_PRINTF1(_L("Message not received!")); |
6519 TEST(EFalse); |
5689 SetTestStepResult(EFail); |
6520 } |
5690 } |
6521 |
5691 |
6522 // |
5692 // 1 - rx now triggered from tx; more deterministic |
5693 // 2 - if class 0 received, disk space available. |
|
5694 // |
|
5695 // But I agree with comment below - this seems like a defect in disk monitor |
|
5696 // as it depends on order of received messages and not actuall OOD situation! |
|
5697 // Disk monitor needs to be updated to give diskfull status when below high |
|
5698 // but above low. |
|
5699 // |
|
5700 // Old comment below; |
|
6523 // Disk space should not be available, even though the Class 0 came through okay. |
5701 // Disk space should not be available, even though the Class 0 came through okay. |
6524 // Potentially I think this maybe a defect in the Disk Space Monitor class. |
5702 // Potentially I think this maybe a defect in the Disk Space Monitor class. |
6525 // |
5703 // |
6526 ret = RProperty::Get(KUidPSSMSStackCategory, KUidPSSMSStackDiskSpaceMonitorKey, |
5704 ret = RProperty::Get(KUidPSSMSStackCategory, KUidPSSMSStackDiskSpaceMonitorKey, |
6527 diskSpaceStatus); |
5705 diskSpaceStatus); |
6528 TEST(ret == KErrNone); |
5706 TEST(ret == KErrNone); |
6529 TEST(diskSpaceStatus == ESmsDiskSpaceFull); |
5707 TEST(diskSpaceStatus == ESmsDiskSpaceAvailable); |
6530 |
5708 |
6531 // |
5709 // |
6532 // Attempt to receive an SMS - Class 2 message should not arrive... |
5710 // Attempt to receive an SMS - Class 2 message should not arrive... |
6533 // |
5711 // |
6534 INFO_PRINTF1(_L("Receiving SMS message - Class 2 message should not arrive...")); |
5712 INFO_PRINTF1(_L("Receiving SMS message - Class 2 message should not arrive...")); |
6535 |
5713 |
6536 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
5714 CSmsMessage* message2 = CreateSMSL(); |
5715 CleanupStack::PushL(message2); |
|
5716 SendSmsL(message2, socket); |
|
5717 CleanupStack::PopAndDestroy(message2); |
|
5718 |
|
5719 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
|
6537 if (messageReceived) |
5720 if (messageReceived) |
6538 { |
5721 { |
6539 CSmsMessage* sms = RecvSmsL(socket); |
5722 CSmsMessage* sms = RecvSmsL(socket); |
6540 |
5723 |
6541 INFO_PRINTF1(_L("Message received!")); |
5724 ERR_PRINTF1(_L("Message received!")); |
6542 TEST(EFalse); |
5725 SetTestStepResult(EFail); |
6543 |
5726 |
6544 delete sms; |
5727 delete sms; |
6545 } |
5728 } |
6546 else |
5729 else |
6547 { |
5730 { |
6557 TEST(diskSpaceStatus == ESmsDiskSpaceFull); |
5740 TEST(diskSpaceStatus == ESmsDiskSpaceFull); |
6558 |
5741 |
6559 // |
5742 // |
6560 // Raise the disk space to above the high limit... |
5743 // Raise the disk space to above the high limit... |
6561 // |
5744 // |
5745 INFO_PRINTF1(_L("Raise the disk space to above the high limit")); |
|
5746 |
|
6562 freeDrop = 2; |
5747 freeDrop = 2; |
6563 ReleaseDiskSpaceL(); |
5748 ReleaseDiskSpaceL(); |
6564 SetFreeDiskSpaceFromDropLevelL(freeDrop); |
5749 SetFreeDiskSpaceFromDropLevelL(freeDrop); |
6565 |
5750 |
6566 // |
5751 // |
6567 // Attempt to receive an SMS - Class 2 message should arrive... |
5752 // Attempt to receive an SMS - Class 2 message should arrive... |
6568 // |
5753 // |
6569 INFO_PRINTF1(_L("Receiving SMS message - Class 2 message should arrive...")); |
5754 INFO_PRINTF1(_L("Receiving SMS message - Class 2 message should arrive...")); |
6570 |
5755 |
6571 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
5756 CSmsMessage* message3 = CreateSMSL(); |
5757 CleanupStack::PushL(message3); |
|
5758 SendSmsL(message3, socket); |
|
5759 CleanupStack::PopAndDestroy(message3); |
|
5760 |
|
5761 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
|
6572 if (messageReceived) |
5762 if (messageReceived) |
6573 { |
5763 { |
6574 CSmsMessage* sms = RecvSmsL(socket); |
5764 CSmsMessage* sms = RecvSmsL(socket); |
6575 |
5765 |
6576 INFO_PRINTF1(_L("Message received!")); |
5766 INFO_PRINTF1(_L("Message received!")); |
6579 |
5769 |
6580 if (!sms->SmsPDU().DataCodingSchemePresent() || |
5770 if (!sms->SmsPDU().DataCodingSchemePresent() || |
6581 !sms->SmsPDU().Class(msgClass) || |
5771 !sms->SmsPDU().Class(msgClass) || |
6582 msgClass != TSmsDataCodingScheme::ESmsClass2) |
5772 msgClass != TSmsDataCodingScheme::ESmsClass2) |
6583 { |
5773 { |
6584 INFO_PRINTF1(_L("Message was not Class 2!")); |
5774 ERR_PRINTF1(_L("Message was not Class 2!")); |
6585 TEST(EFalse); |
5775 SetTestStepResult(EFail); |
6586 } |
5776 } |
6587 |
5777 |
6588 delete sms; |
5778 delete sms; |
6589 } |
5779 } |
6590 else |
5780 else |
6591 { |
5781 { |
6592 INFO_PRINTF1(_L("Message not received!")); |
5782 ERR_PRINTF1(_L("Message not received!")); |
6593 TEST(EFalse); |
5783 SetTestStepResult(EFail); |
6594 } |
5784 } |
6595 |
5785 |
6596 // |
5786 // |
6597 // Disk space should be available now... |
5787 // Disk space should be available now... |
6598 // |
5788 // |
6603 |
5793 |
6604 // |
5794 // |
6605 // Close the SMS Stack... |
5795 // Close the SMS Stack... |
6606 // |
5796 // |
6607 ReleaseDiskSpaceL(); |
5797 ReleaseDiskSpaceL(); |
6608 |
|
6609 CleanupStack::PopAndDestroy(&socket); |
5798 CleanupStack::PopAndDestroy(&socket); |
6610 CleanupStack::PopAndDestroy(&socketServer); |
|
6611 #endif |
5799 #endif |
6612 |
5800 |
6613 return TestStepResult() ; |
5801 return TestStepResult() ; |
6614 } // CTestDiskSpaceMidRangeClass0Class2::doTestStepL |
5802 } |
6615 |
5803 |
6616 |
5804 |
6617 /** |
5805 /** |
6618 * Post-amble funtion to ensure the environment is reverted to normal. |
5806 * Post-amble funtion to ensure the environment is reverted to normal. |
6619 */ |
5807 */ |
6620 TVerdict CTestDiskSpaceMidRangeClass0Class2::doTestStepPostambleL() |
5808 TVerdict CTestDiskSpaceMidRangeClass0Class2::doTestStepPostambleL() |
6621 { |
5809 { |
6622 #ifdef _DEBUG |
5810 #ifdef _DEBUG |
6623 TInt err = RProperty::Delete(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey); |
5811 TInt err = RProperty::Delete(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey); |
6624 if (err != KErrNone && err != KErrNotFound) |
5812 if (err != KErrNone && err != KErrNotFound) |
6625 { |
5813 { |
6626 ERR_PRINTF2(_L("RProperty::Delete() failure [err=%d]"), err); |
5814 ERR_PRINTF2(_L("RProperty::Delete() failure [err=%d]"), err); |
6627 } |
5815 } |
6628 #endif |
5816 #endif |
6629 |
5817 |
6630 // |
5818 // |
6631 // Restore the environment to normal and then call the previous post-amble |
5819 // Restore the environment to normal and then call the previous post-amble |
6632 // function. |
5820 // function. |
6633 // |
5821 // |
6634 RemoveLowHighLimitsFromSmsuRscL(); |
5822 RemoveLowHighLimitsFromSmsuRscL(); |
6635 |
5823 |
6636 CSmsPrtTestStep::doTestStepPostambleL(); |
5824 CSmsBaseTestStep::doTestStepPostambleL(); |
6637 |
5825 |
6638 return TestStepResult() ; |
5826 return TestStepResult() ; |
6639 } // CTestDiskSpaceMidRangeClass0Class2::doTestStepPostambleL |
5827 } |
6640 |
5828 |
6641 TVerdict CTestDiskSpaceLowRangeClass0Class2::doTestStepPreambleL() |
5829 TVerdict CTestDiskSpaceLowRangeClass0Class2::doTestStepPreambleL() |
6642 { |
5830 { |
6643 CSmsPrtTestStep::doTestStepPreambleL(); |
5831 CSmsBaseTestStep::doTestStepPreambleL(); |
6644 |
5832 |
6645 #ifdef _DEBUG |
5833 #ifdef _DEBUG |
6646 TInt err = RProperty::Define(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey, RProperty::EInt); |
5834 TInt err = RProperty::Define(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey, RProperty::EInt); |
6647 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
5835 if ((err != KErrNone) && (err != KErrAlreadyExists)) |
6648 { |
5836 { |
6666 TVerdict CTestDiskSpaceLowRangeClass0Class2::doTestStepL() |
5854 TVerdict CTestDiskSpaceLowRangeClass0Class2::doTestStepL() |
6667 { |
5855 { |
6668 #ifndef _DEBUG |
5856 #ifndef _DEBUG |
6669 INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode.")); |
5857 INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode.")); |
6670 #else |
5858 #else |
6671 |
|
6672 // |
5859 // |
6673 // Disk space should be available at the start... |
5860 // Disk space should be available at the start... |
6674 // |
5861 // |
6675 TInt diskSpaceStatus(ESmsDiskSpaceUnknown); |
5862 TInt diskSpaceStatus(ESmsDiskSpaceUnknown); |
6676 TInt ret(KErrUnknown); |
5863 TInt ret(KErrUnknown); |
6687 TUint lowDrop = 10; |
5874 TUint lowDrop = 10; |
6688 TUint freeDrop = 11; |
5875 TUint freeDrop = 11; |
6689 |
5876 |
6690 SetHighLowLimitsAndDiskSpaceLevelL(highDrop, lowDrop, freeDrop); |
5877 SetHighLowLimitsAndDiskSpaceLevelL(highDrop, lowDrop, freeDrop); |
6691 |
5878 |
6692 // |
|
6693 // Load the SMS Stack... |
|
6694 // |
|
6695 RSocketServ socketServer; |
|
6696 PrepareRegTestLC(socketServer, 132); |
|
6697 |
|
6698 RSocket socket; |
5879 RSocket socket; |
6699 iSmsStackTestUtils->OpenSmsSocketLC(socketServer, socket, ESmsAddrRecvAny); |
5880 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrRecvAny); |
6700 |
5881 |
6701 // |
5882 // |
6702 // Attempt to receive an SMS - Class 0 message should not arrive... |
5883 // Attempt to receive an SMS - Class 0 message should not arrive... |
6703 // |
5884 // |
6704 INFO_PRINTF1(_L("Receiving SMS message - Class 0 message should not arrive...")); |
5885 INFO_PRINTF1(_L("Receiving SMS message - Class 0 message should not arrive...")); |
6707 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
5888 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
6708 if (messageReceived) |
5889 if (messageReceived) |
6709 { |
5890 { |
6710 CSmsMessage* sms = RecvSmsL(socket); |
5891 CSmsMessage* sms = RecvSmsL(socket); |
6711 |
5892 |
6712 INFO_PRINTF1(_L("Message received!")); |
5893 ERR_PRINTF1(_L("Message received!")); |
6713 TEST(EFalse); |
5894 SetTestStepResult(EFail); |
6714 |
|
6715 delete sms; |
5895 delete sms; |
6716 } |
5896 } |
6717 else |
5897 else |
6718 { |
5898 { |
6719 INFO_PRINTF1(_L("Message not received!")); |
5899 INFO_PRINTF1(_L("Message not received!")); |
6735 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
5915 messageReceived = TimedWaitForRecvL(socket, 10*1000000); |
6736 if (messageReceived) |
5916 if (messageReceived) |
6737 { |
5917 { |
6738 CSmsMessage* sms = RecvSmsL(socket); |
5918 CSmsMessage* sms = RecvSmsL(socket); |
6739 |
5919 |
6740 INFO_PRINTF1(_L("Message received!")); |
5920 ERR_PRINTF1(_L("Message received!")); |
6741 TEST(EFalse); |
5921 SetTestStepResult(EFail); |
6742 |
|
6743 delete sms; |
5922 delete sms; |
6744 } |
5923 } |
6745 else |
5924 else |
6746 { |
5925 { |
6747 INFO_PRINTF1(_L("Message not received!")); |
5926 INFO_PRINTF1(_L("Message not received!")); |
6778 |
5957 |
6779 if (!sms->SmsPDU().DataCodingSchemePresent() || |
5958 if (!sms->SmsPDU().DataCodingSchemePresent() || |
6780 !sms->SmsPDU().Class(msgClass) || |
5959 !sms->SmsPDU().Class(msgClass) || |
6781 msgClass != TSmsDataCodingScheme::ESmsClass0) |
5960 msgClass != TSmsDataCodingScheme::ESmsClass0) |
6782 { |
5961 { |
6783 INFO_PRINTF1(_L("Message was not Class 0!")); |
5962 ERR_PRINTF1(_L("Message was not Class 0!")); |
6784 TEST(EFalse); |
5963 SetTestStepResult(EFail); |
6785 } |
5964 } |
6786 |
5965 |
6787 delete sms; |
5966 delete sms; |
6788 } |
5967 } |
6789 else |
5968 else |
6790 { |
5969 { |
6791 INFO_PRINTF1(_L("Message not received!")); |
5970 ERR_PRINTF1(_L("Message not received!")); |
6792 TEST(EFalse); |
5971 SetTestStepResult(EFail); |
6793 } |
5972 } |
6794 |
5973 |
6795 // |
5974 // |
6796 // Disk space should be available now... |
5975 // Disk space should be available now... |
6797 // |
5976 // |
6816 |
5995 |
6817 if (!sms->SmsPDU().DataCodingSchemePresent() || |
5996 if (!sms->SmsPDU().DataCodingSchemePresent() || |
6818 !sms->SmsPDU().Class(msgClass) || |
5997 !sms->SmsPDU().Class(msgClass) || |
6819 msgClass != TSmsDataCodingScheme::ESmsClass2) |
5998 msgClass != TSmsDataCodingScheme::ESmsClass2) |
6820 { |
5999 { |
6821 INFO_PRINTF1(_L("Message was not Class 2!")); |
6000 ERR_PRINTF1(_L("Message was not Class 2!")); |
6822 TEST(EFalse); |
6001 SetTestStepResult(EFail); |
6823 } |
6002 } |
6824 |
6003 |
6825 delete sms; |
6004 delete sms; |
6826 } |
6005 } |
6827 else |
6006 else |
6828 { |
6007 { |
6829 INFO_PRINTF1(_L("Message not received!")); |
6008 ERR_PRINTF1(_L("Message not received!")); |
6830 TEST(EFalse); |
6009 SetTestStepResult(EFail); |
6831 } |
6010 } |
6832 |
6011 |
6833 // |
6012 // |
6834 // Disk space should still be available now... |
6013 // Disk space should still be available now... |
6835 // |
6014 // |
6840 |
6019 |
6841 // |
6020 // |
6842 // Close the SMS Stack... |
6021 // Close the SMS Stack... |
6843 // |
6022 // |
6844 ReleaseDiskSpaceL(); |
6023 ReleaseDiskSpaceL(); |
6845 |
|
6846 CleanupStack::PopAndDestroy(&socket); |
6024 CleanupStack::PopAndDestroy(&socket); |
6847 CleanupStack::PopAndDestroy(&socketServer); |
6025 |
6848 #endif |
6026 #endif |
6849 |
6027 |
6850 return TestStepResult() ; |
6028 return TestStepResult() ; |
6851 } // CTestDiskSpaceLowRangeClass0Class2::doTestStepL |
6029 } // CTestDiskSpaceLowRangeClass0Class2::doTestStepL |
6852 |
6030 |
6853 |
|
6854 /** |
6031 /** |
6855 * Post-amble funtion to ensure the environment is reverted to normal. |
6032 * Post-amble funtion to ensure the environment is reverted to normal. |
6856 */ |
6033 */ |
6857 TVerdict CTestDiskSpaceLowRangeClass0Class2::doTestStepPostambleL() |
6034 TVerdict CTestDiskSpaceLowRangeClass0Class2::doTestStepPostambleL() |
6858 { |
6035 { |
6859 #ifdef _DEBUG |
6036 #ifdef _DEBUG |
6860 TInt err = RProperty::Delete(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey); |
6037 TInt err = RProperty::Delete(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey); |
6861 if (err != KErrNone && err != KErrNotFound) |
6038 if (err != KErrNone && err != KErrNotFound) |
6862 { |
6039 { |
6863 ERR_PRINTF2(_L("RProperty::Delete() failure [err=%d]"), err); |
6040 ERR_PRINTF2(_L("RProperty::Delete() failure [err=%d]"), err); |
6864 } |
6041 } |
6865 #endif |
6042 #endif |
6866 |
|
6867 // |
6043 // |
6868 // Restore the environment to normal and then call the previous post-amble |
6044 // Restore the environment to normal and then call the previous post-amble |
6869 // function. |
6045 // function. |
6870 // |
6046 // |
6871 RemoveLowHighLimitsFromSmsuRscL(); |
6047 RemoveLowHighLimitsFromSmsuRscL(); |
6872 |
6048 |
6873 CSmsPrtTestStep::doTestStepPostambleL(); |
6049 CSmsBaseTestStep::doTestStepPostambleL(); |
6874 |
6050 |
6875 return TestStepResult() ; |
6051 return TestStepResult() ; |
6876 } // CTestDiskSpaceLowRangeClass0Class2::doTestStepPostambleL |
6052 } // CTestDiskSpaceLowRangeClass0Class2::doTestStepPostambleL |
6877 |
6053 |
6878 |
|
6879 /** |
6054 /** |
6880 * Simple test of receiving a few corrupt PDUs and then one good one. |
6055 * Simple test of receiving a few corrupt PDUs and then one good one. |
6881 */ |
6056 */ |
6882 TVerdict CTestCorruptPDUs::doTestStepL() |
6057 TVerdict CTestCorruptPDUs::doTestStepL() |
6883 { |
6058 { |
6884 // |
|
6885 // Load the SMS Stack... |
|
6886 // |
|
6887 RSocketServ socketServer; |
|
6888 PrepareRegTestLC(socketServer, 133); |
|
6889 |
|
6890 RSocket socket; |
6059 RSocket socket; |
6891 iSmsStackTestUtils->OpenSmsSocketLC(socketServer, socket, ESmsAddrRecvAny); |
6060 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, ESmsAddrRecvAny); |
6892 |
6061 |
6893 // |
|
6894 // Attempt to receive the valid SMS... |
6062 // Attempt to receive the valid SMS... |
6895 // |
|
6896 WaitForRecvL(socket); |
6063 WaitForRecvL(socket); |
6897 |
|
6898 CSmsMessage* sms = RecvSmsL(socket); |
6064 CSmsMessage* sms = RecvSmsL(socket); |
6899 |
|
6900 INFO_PRINTF1(_L("Message received!")); |
|
6901 |
|
6902 delete sms; |
6065 delete sms; |
6903 |
6066 |
6904 // |
|
6905 // Close the SMS Stack... |
|
6906 // |
|
6907 CleanupStack::PopAndDestroy(&socket); |
6067 CleanupStack::PopAndDestroy(&socket); |
6908 CleanupStack::PopAndDestroy(&socketServer); |
|
6909 |
|
6910 return TestStepResult() ; |
6068 return TestStepResult() ; |
6911 } // CTestCorruptPDUs::doTestStepL() |
6069 } |
6912 |
|
6913 |
6070 |
6914 /** |
6071 /** |
6915 * Tests the reception of a series of messages which cause the assembly to become full, |
6072 * Tests the reception of a series of messages which cause the assembly to become full, |
6916 * SMS reception to be suspended and then resumed. |
6073 * SMS reception to be suspended and then resumed. |
6917 */ |
6074 */ |
6918 TVerdict CTestCongestedReceive::doTestStepL() |
6075 TVerdict CTestCongestedReceive::doTestStepL() |
6919 { |
6076 { |
6920 RSocketServ socketServer; |
|
6921 PrepareRegTestLC(socketServer, 141); |
|
6922 |
|
6923 RSocket socket; |
6077 RSocket socket; |
6924 TSmsAddr smsaddr; |
6078 TSmsAddr smsaddr; |
6925 smsaddr.SetSmsAddrFamily(ESmsAddrRecvAny); |
6079 smsaddr.SetSmsAddrFamily(ESmsAddrRecvAny); |
6926 iSmsStackTestUtils->OpenSmsSocketLC(socketServer, socket, smsaddr); |
6080 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer, socket, smsaddr); |
6927 |
6081 |
6928 for (TInt count = 1; count <= 30; count++) |
6082 for (TInt count = 1; count <= 30; ++count) |
6929 { |
6083 { |
6930 INFO_PRINTF2(_L("Waiting for incoming SMS %d..."), count); |
6084 INFO_PRINTF2(_L("Waiting for incoming SMS %d..."), count); |
6931 |
6085 |
6932 WaitForRecvL(socket); |
6086 WaitForRecvL(socket); |
6933 User::After(3*1000000); |
6087 User::After(3*1000000); |
6935 CSmsMessage* smsMessage = RecvSmsL(socket); |
6089 CSmsMessage* smsMessage = RecvSmsL(socket); |
6936 delete smsMessage; |
6090 delete smsMessage; |
6937 } |
6091 } |
6938 |
6092 |
6939 CleanupStack::PopAndDestroy(&socket); |
6093 CleanupStack::PopAndDestroy(&socket); |
6940 CleanupStack::PopAndDestroy(&socketServer); |
6094 return TestStepResult(); |
6941 |
6095 } |
6942 return TestStepResult(); |
|
6943 } // CTestCongestedReceive::doTestStepL() |
|
6944 |
|
6945 |
6096 |
6946 enum TVerdict CTestEncodingPDUonBoundary::doTestStepL() |
6097 enum TVerdict CTestEncodingPDUonBoundary::doTestStepL() |
6947 /** |
6098 /** |
6948 * INC119830 |
6099 * INC119830 |
6949 * * |
6100 * * |
6951 * into a full PDU. This should result in the format IE being |
6102 * into a full PDU. This should result in the format IE being |
6952 * encoded into the 2nd PDU. |
6103 * encoded into the 2nd PDU. |
6953 */ |
6104 */ |
6954 { |
6105 { |
6955 INFO_PRINTF1(_L("Test Encoding PDU on Boundary")); |
6106 INFO_PRINTF1(_L("Test Encoding PDU on Boundary")); |
6956 |
|
6957 RSocketServ socketServer; |
|
6958 PrepareRegTestLC(socketServer, 143); |
|
6959 RSocket socket; |
6107 RSocket socket; |
6960 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
6108 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
6961 |
6109 |
6962 // Create comms database object |
6110 ChangeReceiveModeL(RMobileSmsMessaging::EReceiveUnstoredClientAck); |
6963 #ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY |
|
6964 CMDBSession* db = CMDBSession::NewL(KCDVersion1_2); |
|
6965 #else |
|
6966 CMDBSession* db = CMDBSession::NewL(KCDVersion1_1); |
|
6967 #endif |
|
6968 CleanupStack::PushL(db); |
|
6969 |
|
6970 INFO_PRINTF1(_L("Testing recvMode change to EReceiveUnstoredClientAck")); |
|
6971 |
|
6972 // EReceiveUnstoredClientAck |
|
6973 CMDBField<TUint32>* smsReceiveModeField = new(ELeave) CMDBField<TUint32>(KCDTIdSMSReceiveMode); |
|
6974 CleanupStack::PushL(smsReceiveModeField); |
|
6975 smsReceiveModeField->SetRecordId(1); //it's GlobalSettingsRecord |
|
6976 *smsReceiveModeField = RMobileSmsMessaging::EReceiveUnstoredClientAck; |
|
6977 smsReceiveModeField->ModifyL(*db); |
|
6978 CleanupStack::PopAndDestroy(smsReceiveModeField); |
|
6979 CleanupStack::PopAndDestroy(db); |
|
6980 |
6111 |
6981 // Create a 149 character message (from 4 30 character messages + 1 29 character message). |
6112 // Create a 149 character message (from 4 30 character messages + 1 29 character message). |
6982 // Set the encoding to 7 bit encoding. There should be sufficient space in the PDU to |
6113 // Set the encoding to 7 bit encoding. There should be sufficient space in the PDU to |
6983 // encode the 1st format IE, but this will leave the PDU full. The 2nd format IE |
6114 // encode the 1st format IE, but this will leave the PDU full. The 2nd format IE |
6984 // then needs to be added to the next PDU. |
6115 // then needs to be added to the next PDU. |
6988 iTelephoneNumber=KPekka; |
6119 iTelephoneNumber=KPekka; |
6989 iServiceCenterNumber=KRadiolinjaSC; |
6120 iServiceCenterNumber=KRadiolinjaSC; |
6990 |
6121 |
6991 TSmsDataCodingScheme::TSmsAlphabet alphabet7Bit=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
6122 TSmsDataCodingScheme::TSmsAlphabet alphabet7Bit=TSmsDataCodingScheme::ESmsAlphabet7Bit; |
6992 |
6123 |
6993 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet7Bit); |
6124 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet7Bit); |
6994 CleanupStack::PushL(smsMessage); |
6125 |
6995 |
|
6996 |
|
6997 // Create the format object |
6126 // Create the format object |
6998 CEmsFormatIE* format = CEmsFormatIE::NewL(); |
6127 CEmsFormatIE* format = CEmsFormatIE::NewL(); |
6999 format->SetStartPosition(147); |
6128 format->SetStartPosition(147); |
7000 format->SetFormatLength(1); |
6129 format->SetFormatLength(1); |
7001 format->SetAlignment(CEmsFormatIE::ERight); |
6130 format->SetAlignment(CEmsFormatIE::ERight); |
7018 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
6147 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
7019 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
6148 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
7020 |
6149 |
7021 //Send SMS |
6150 //Send SMS |
7022 SendSmsL(smsMessage,socket); |
6151 SendSmsL(smsMessage,socket); |
7023 |
|
7024 CleanupStack::PopAndDestroy(smsMessage); |
6152 CleanupStack::PopAndDestroy(smsMessage); |
7025 |
6153 |
7026 //Receive SMS |
6154 //Receive SMS |
7027 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
7028 WaitForRecvL(socket); |
6155 WaitForRecvL(socket); |
7029 smsMessage = RecvSmsL(socket); |
6156 smsMessage = RecvSmsL(socket); |
7030 |
|
7031 INFO_PRINTF1(_L("incoming SMS") ); |
|
7032 |
|
7033 CleanupStack::PushL(smsMessage); |
6157 CleanupStack::PushL(smsMessage); |
6158 |
|
7034 TestSmsContentsL(smsMessage,KTestMsg1); |
6159 TestSmsContentsL(smsMessage,KTestMsg1); |
7035 |
6160 |
7036 num = smsMessage->NumMessagePDUsL(); |
6161 num = smsMessage->NumMessagePDUsL(); |
7037 TEST(num == 2); |
6162 TEST(num == 2); |
7038 |
6163 |
7039 //Save the received message to the SMS storage |
6164 //Save the received message to the SMS storage |
7040 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
6165 smsMessage->SetStorage(CSmsMessage::ESmsSIMStorage); |
7041 WriteSmsToSimL(*smsMessage, socket); |
6166 WriteSmsToSimL(*smsMessage, socket); |
7042 |
|
7043 CleanupStack::PopAndDestroy(smsMessage); |
6167 CleanupStack::PopAndDestroy(smsMessage); |
7044 |
6168 |
7045 // Enumerate messages from Store |
6169 // Enumerate messages from Store |
7046 RPointerArray<CSmsMessage> messages; |
6170 RPointerArray<CSmsMessage> messages; |
7047 ReadSmsStoreL(socket, messages); |
6171 ReadSmsStoreL(socket, messages); |
7048 messages.ResetAndDestroy(); |
6172 messages.ResetAndDestroy(); |
7049 |
6173 |
7050 CleanupStack::PopAndDestroy(&socket); |
6174 CleanupStack::PopAndDestroy(&socket); |
7051 CleanupStack::PopAndDestroy(&socketServer); |
|
7052 |
|
7053 return TestStepResult() ; |
6175 return TestStepResult() ; |
7054 } |
6176 } |
7055 |
6177 |
7056 |
|
7057 /** |
6178 /** |
7058 * Tests that a PDU can be received if it has an invalid or reserved IE number. |
6179 * Tests that a PDU can be received if it has an invalid or reserved IE number. |
7059 */ |
6180 */ |
7060 TVerdict CTestReceiveInvalidOrReservedIE::doTestStepL() |
6181 TVerdict CTestReceiveInvalidOrReservedIE::doTestStepL() |
7061 { |
6182 { |
7062 // |
|
7063 // Open a socket to receive an SMS with SIMTSY... |
|
7064 // |
|
7065 RSocketServ socketServer; |
|
7066 PrepareRegTestLC(socketServer, 144); |
|
7067 |
|
7068 RSocket socket; |
6183 RSocket socket; |
7069 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6184 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7070 CleanupClosePushL(socket); |
6185 CleanupClosePushL(socket); |
7071 |
6186 |
7072 // |
|
7073 // Receive the SMS with the reserved IE value. |
6187 // Receive the SMS with the reserved IE value. |
7074 // |
|
7075 WaitForRecvL(socket); |
6188 WaitForRecvL(socket); |
7076 CSmsMessage* smsMessage = RecvSmsL(socket); |
6189 CSmsMessage* smsMessage = RecvSmsL(socket); |
7077 CleanupStack::PushL(smsMessage); |
6190 CleanupStack::PushL(smsMessage); |
7078 |
6191 |
7079 _LIT(KTestMsg, "I am in an emergency. Please help me."); |
6192 _LIT(KTestMsg, "I am in an emergency. Please help me."); |
7080 TestSmsContentsL(smsMessage, KTestMsg); |
6193 TestSmsContentsL(smsMessage, KTestMsg); |
7081 |
6194 |
7082 CleanupStack::PopAndDestroy(smsMessage); |
6195 CleanupStack::PopAndDestroy(smsMessage); |
7083 |
|
7084 // |
|
7085 // Close the socket. |
|
7086 // |
|
7087 CleanupStack::PopAndDestroy(&socket); |
6196 CleanupStack::PopAndDestroy(&socket); |
7088 CleanupStack::PopAndDestroy(&socketServer); |
|
7089 |
|
7090 return TestStepResult() ; |
6197 return TestStepResult() ; |
7091 } // CTestReceiveInvalidOrReservedIE::doTestStepL |
6198 } |
7092 |
|
7093 |
6199 |
7094 /** |
6200 /** |
7095 * Tests that standard GSM characters can be sent and received using 7bit |
6201 * Tests that standard GSM characters can be sent and received using 7bit |
7096 * without loss of characters. |
6202 * without loss of characters. |
7097 */ |
6203 */ |
7098 TVerdict CTestEncoding7bitStandardGSM::doTestStepL() |
6204 TVerdict CTestEncoding7bitStandardGSM::doTestStepL() |
7099 { |
6205 { |
7100 RSocketServ socketServer; |
|
7101 PrepareRegTestLC(socketServer, 150); |
|
7102 |
|
7103 RSocket socket; |
6206 RSocket socket; |
7104 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6207 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7105 CleanupClosePushL(socket); |
6208 CleanupClosePushL(socket); |
7106 |
6209 |
7107 // |
6210 // |
7108 // Test standard GSM text (default table with no shift characters)... |
6211 // Test standard GSM text (default table with no shift characters)... |
7109 // |
6212 // |
7130 /* Char sets */ iCharSets, |
6233 /* Char sets */ iCharSets, |
7131 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6234 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7132 /* Encoding to use */ ESmsEncodingNone, |
6235 /* Encoding to use */ ESmsEncodingNone, |
7133 /* Encoding expected */ ESmsEncodingNone); |
6236 /* Encoding expected */ ESmsEncodingNone); |
7134 iCharSets.Reset(); |
6237 iCharSets.Reset(); |
7135 |
6238 |
7136 // |
|
7137 // Clean up and finish... |
|
7138 // |
|
7139 CleanupStack::PopAndDestroy(&socket); |
6239 CleanupStack::PopAndDestroy(&socket); |
7140 CleanupStack::PopAndDestroy(&socketServer); |
|
7141 |
|
7142 return TestStepResult(); |
6240 return TestStepResult(); |
7143 } // CTestEncoding7bitStandardGSM::doTestStepL |
6241 } |
7144 |
|
7145 |
6242 |
7146 /** |
6243 /** |
7147 * Tests that standard 8bit characters can be sent and received without |
6244 * Tests that standard 8bit characters can be sent and received without |
7148 * loss of characters. |
6245 * loss of characters. |
7149 */ |
6246 */ |
7150 TVerdict CTestEncoding8bitCodePage1252::doTestStepL() |
6247 TVerdict CTestEncoding8bitCodePage1252::doTestStepL() |
7151 { |
6248 { |
7152 RSocketServ socketServer; |
|
7153 PrepareRegTestLC(socketServer, 151); |
|
7154 |
|
7155 RSocket socket; |
6249 RSocket socket; |
7156 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6250 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7157 CleanupClosePushL(socket); |
6251 CleanupClosePushL(socket); |
7158 |
6252 |
7159 // |
6253 // |
7160 // Test standard 8bit text (really 8bit data)... |
6254 // Test standard 8bit text (really 8bit data)... |
7161 // |
6255 // |
7168 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet8Bit, |
6262 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet8Bit, |
7169 /* Encoding to use */ ESmsEncodingNone, |
6263 /* Encoding to use */ ESmsEncodingNone, |
7170 /* Encoding expected */ ESmsEncodingNone); |
6264 /* Encoding expected */ ESmsEncodingNone); |
7171 iCharSets.Reset(); |
6265 iCharSets.Reset(); |
7172 |
6266 |
7173 // |
|
7174 // Clean up and finish... |
|
7175 // |
|
7176 CleanupStack::PopAndDestroy(&socket); |
6267 CleanupStack::PopAndDestroy(&socket); |
7177 CleanupStack::PopAndDestroy(&socketServer); |
|
7178 |
|
7179 return TestStepResult(); |
6268 return TestStepResult(); |
7180 } // CTestEncoding8bitCodePage1252::doTestStepL |
6269 } |
7181 |
|
7182 |
6270 |
7183 /** |
6271 /** |
7184 * Tests that standard unicode characters can be sent and received without |
6272 * Tests that standard unicode characters can be sent and received without |
7185 * loss of characters. |
6273 * loss of characters. |
7186 */ |
6274 */ |
7187 TVerdict CTestEncodingUnicode::doTestStepL() |
6275 TVerdict CTestEncodingUnicode::doTestStepL() |
7188 { |
6276 { |
7189 RSocketServ socketServer; |
|
7190 PrepareRegTestLC(socketServer, 152); |
|
7191 |
|
7192 RSocket socket; |
6277 RSocket socket; |
7193 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6278 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7194 CleanupClosePushL(socket); |
6279 CleanupClosePushL(socket); |
7195 |
6280 |
7196 // |
6281 // |
7197 // Test unicode text (not really GSM specific)... |
6282 // Test unicode text (not really GSM specific)... |
7198 // |
6283 // |
7205 /* DCS */ TSmsDataCodingScheme::ESmsAlphabetUCS2, |
6290 /* DCS */ TSmsDataCodingScheme::ESmsAlphabetUCS2, |
7206 /* Encoding to use */ ESmsEncodingNone, |
6291 /* Encoding to use */ ESmsEncodingNone, |
7207 /* Encoding expected */ ESmsEncodingNone); |
6292 /* Encoding expected */ ESmsEncodingNone); |
7208 iCharSets.Reset(); |
6293 iCharSets.Reset(); |
7209 |
6294 |
7210 // |
|
7211 // Clean up and finish... |
|
7212 // |
|
7213 CleanupStack::PopAndDestroy(&socket); |
6295 CleanupStack::PopAndDestroy(&socket); |
7214 CleanupStack::PopAndDestroy(&socketServer); |
|
7215 |
|
7216 return TestStepResult(); |
6296 return TestStepResult(); |
7217 } // CTestEncodingUnicode::doTestStepL |
6297 } |
7218 |
|
7219 |
6298 |
7220 /** |
6299 /** |
7221 * Tests that unconvertible GSM characters can be sent using 7bit by being |
6300 * Tests that unconvertible GSM characters can be sent using 7bit by being |
7222 * set to the replacement character. |
6301 * set to the replacement character. |
7223 */ |
6302 */ |
7224 TVerdict CTestEncoding7bitUnconvertibleGSM::doTestStepL() |
6303 TVerdict CTestEncoding7bitUnconvertibleGSM::doTestStepL() |
7225 { |
6304 { |
7226 RSocketServ socketServer; |
|
7227 PrepareRegTestLC(socketServer, 153); |
|
7228 |
|
7229 RSocket socket; |
6305 RSocket socket; |
7230 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6306 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7231 CleanupClosePushL(socket); |
6307 CleanupClosePushL(socket); |
7232 |
6308 |
7233 // |
6309 // |
7234 // Test various characters not supported in the 7bit ASCII text (either |
6310 // Test various characters not supported in the 7bit ASCII text (either |
7235 // default GSM, shifted GSM, downgraded by the internal converter or |
6311 // default GSM, shifted GSM, downgraded by the internal converter or |
7244 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6320 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7245 /* Encoding to use */ ESmsEncodingNone, |
6321 /* Encoding to use */ ESmsEncodingNone, |
7246 /* Encoding expected */ ESmsEncodingNone); |
6322 /* Encoding expected */ ESmsEncodingNone); |
7247 iCharSets.Reset(); |
6323 iCharSets.Reset(); |
7248 |
6324 |
7249 // |
|
7250 // Clean up and finish... |
|
7251 // |
|
7252 CleanupStack::PopAndDestroy(&socket); |
6325 CleanupStack::PopAndDestroy(&socket); |
7253 CleanupStack::PopAndDestroy(&socketServer); |
|
7254 |
|
7255 return TestStepResult(); |
6326 return TestStepResult(); |
7256 } // CTestEncoding7bitUnconvertibleGSM::doTestStepL |
6327 } |
7257 |
|
7258 |
6328 |
7259 /** |
6329 /** |
7260 * Tests that non-standard GSM characters can be sent and received using 7bit |
6330 * Tests that non-standard GSM characters can be sent and received using 7bit |
7261 * with downgraded conversions. |
6331 * with downgraded conversions. |
7262 */ |
6332 */ |
7263 TVerdict CTestEncoding7bitNonStandardGSM::doTestStepL() |
6333 TVerdict CTestEncoding7bitNonStandardGSM::doTestStepL() |
7264 { |
6334 { |
7265 RSocketServ socketServer; |
|
7266 PrepareRegTestLC(socketServer, 154); |
|
7267 |
|
7268 RSocket socket; |
6335 RSocket socket; |
7269 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6336 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7270 CleanupClosePushL(socket); |
6337 CleanupClosePushL(socket); |
7271 |
6338 |
7272 // |
6339 // |
7273 // Test downgrades that were part of the internal converter |
6340 // Test downgrades that were part of the internal converter |
7274 // (e.g. pre-PREQ2090)... |
6341 // (e.g. pre-PREQ2090)... |
7296 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6363 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7297 /* Encoding to use */ ESmsEncodingNone, |
6364 /* Encoding to use */ ESmsEncodingNone, |
7298 /* Encoding expected */ ESmsEncodingNone); |
6365 /* Encoding expected */ ESmsEncodingNone); |
7299 iCharSets.Reset(); |
6366 iCharSets.Reset(); |
7300 |
6367 |
7301 // |
|
7302 // Clean up and finish... |
|
7303 // |
|
7304 CleanupStack::PopAndDestroy(&socket); |
6368 CleanupStack::PopAndDestroy(&socket); |
7305 CleanupStack::PopAndDestroy(&socketServer); |
|
7306 |
|
7307 return TestStepResult(); |
6369 return TestStepResult(); |
7308 } // CTestEncoding7bitNonStandardGSM::doTestStepL |
6370 } |
7309 |
|
7310 |
6371 |
7311 /** |
6372 /** |
7312 * Tests that Turkish characters can be sent and received using 7bit without |
6373 * Tests that Turkish characters can be sent and received using 7bit without |
7313 * loss of characters. |
6374 * loss of characters. |
7314 */ |
6375 */ |
7315 TVerdict CTestEncoding7bitTurkishNationalLanguage::doTestStepL() |
6376 TVerdict CTestEncoding7bitTurkishNationalLanguage::doTestStepL() |
7316 { |
6377 { |
7317 RSocketServ socketServer; |
|
7318 PrepareRegTestLC(socketServer, 155); |
|
7319 |
|
7320 RSocket socket; |
6378 RSocket socket; |
7321 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6379 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7322 CleanupClosePushL(socket); |
6380 CleanupClosePushL(socket); |
7323 |
6381 |
7324 // |
6382 // |
7325 // Test Turkish GSM text (no alternative encoding)... |
6383 // Test Turkish GSM text (no alternative encoding)... |
7326 // |
6384 // |
7408 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6466 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7409 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
6467 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
7410 /* Encoding expected */ ESmsEncodingTurkishSingleShift); |
6468 /* Encoding expected */ ESmsEncodingTurkishSingleShift); |
7411 iCharSets.Reset(); |
6469 iCharSets.Reset(); |
7412 |
6470 |
7413 // |
|
7414 // Clean up and finish... |
|
7415 // |
|
7416 CleanupStack::PopAndDestroy(&socket); |
6471 CleanupStack::PopAndDestroy(&socket); |
7417 CleanupStack::PopAndDestroy(&socketServer); |
|
7418 |
|
7419 return TestStepResult(); |
6472 return TestStepResult(); |
7420 } // CTestEncoding7bitTurkishNationalLanguage::doTestStepL |
6473 } |
7421 |
|
7422 |
6474 |
7423 /** |
6475 /** |
7424 * Generates various messages with some Turkish and unconvertible characters, |
6476 * Generates various messages with some Turkish and unconvertible characters, |
7425 * sends/receives them and compares the contents. |
6477 * sends/receives them and compares the contents. |
7426 */ |
6478 */ |
7427 TVerdict CTestEncoding7bitTurkishAndUnconvertible::doTestStepL() |
6479 TVerdict CTestEncoding7bitTurkishAndUnconvertible::doTestStepL() |
7428 { |
6480 { |
7429 RSocketServ socketServer; |
|
7430 PrepareRegTestLC(socketServer, 156); |
|
7431 |
|
7432 RSocket socket; |
6481 RSocket socket; |
7433 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6482 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7434 CleanupClosePushL(socket); |
6483 CleanupClosePushL(socket); |
7435 |
6484 |
7436 // |
6485 // |
7437 // Test mix of Turkish and unconvertible characters... |
6486 // Test mix of Turkish and unconvertible characters... |
7438 // |
6487 // |
7447 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6496 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7448 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
6497 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
7449 /* Encoding expected */ ESmsEncodingTurkishSingleShift); |
6498 /* Encoding expected */ ESmsEncodingTurkishSingleShift); |
7450 iCharSets.Reset(); |
6499 iCharSets.Reset(); |
7451 |
6500 |
7452 // |
|
7453 // Clean up and finish... |
|
7454 // |
|
7455 CleanupStack::PopAndDestroy(&socket); |
6501 CleanupStack::PopAndDestroy(&socket); |
7456 CleanupStack::PopAndDestroy(&socketServer); |
|
7457 |
|
7458 return TestStepResult(); |
6502 return TestStepResult(); |
7459 } // CTestEncoding7bitTurkishAndUnconvertible::doTestStepL |
6503 } // CTestEncoding7bitTurkishAndUnconvertible::doTestStepL |
7460 |
6504 |
7461 |
6505 |
7462 /** |
6506 /** |
7465 * SIMTSY will return 3 mixed PDUs (each one starting with a different DCS). |
6509 * SIMTSY will return 3 mixed PDUs (each one starting with a different DCS). |
7466 * The test ensures they are received correctly. |
6510 * The test ensures they are received correctly. |
7467 */ |
6511 */ |
7468 TVerdict CTestReceivingMessageWithDifferentEncodings::doTestStepL() |
6512 TVerdict CTestReceivingMessageWithDifferentEncodings::doTestStepL() |
7469 { |
6513 { |
7470 RSocketServ socketServer; |
|
7471 PrepareRegTestLC(socketServer, 157); |
|
7472 |
|
7473 RSocket socket; |
6514 RSocket socket; |
7474 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6515 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7475 CleanupClosePushL(socket); |
6516 CleanupClosePushL(socket); |
7476 |
6517 |
7477 // |
6518 // |
7478 // Generate 3 messages for each encoding type that will require 3 PDUs... |
6519 // Generate 3 messages for each encoding type that will require 3 PDUs... |
7479 // |
6520 // |
7513 // Send all three messages and receive them to ensure they are valid... |
6554 // Send all three messages and receive them to ensure they are valid... |
7514 // |
6555 // |
7515 CSmsMessage* smsMessage; |
6556 CSmsMessage* smsMessage; |
7516 TInt pdus; |
6557 TInt pdus; |
7517 |
6558 |
7518 smsMessage = CreateSmsMessageL(msg7BitPtr, TSmsDataCodingScheme::ESmsAlphabet7Bit); |
6559 smsMessage = CreateSmsMessageLC(msg7BitPtr, TSmsDataCodingScheme::ESmsAlphabet7Bit); |
7519 CleanupStack::PushL(smsMessage); |
|
7520 pdus = smsMessage->NumMessagePDUsL(); |
6560 pdus = smsMessage->NumMessagePDUsL(); |
7521 TESTCHECK(pdus, 3); |
6561 TESTCHECK(pdus, 3, "Expected 3 PDUs"); |
7522 TRAPD(sendErr, SendSmsL(smsMessage, socket)); |
6562 TRAPD(sendErr, SendSmsL(smsMessage, socket)); |
7523 TESTCHECK(sendErr, KErrNone); |
6563 TESTCHECK(sendErr, KErrNone, "Sending SMS"); |
7524 CleanupStack::PopAndDestroy(smsMessage); |
6564 CleanupStack::PopAndDestroy(smsMessage); |
7525 |
6565 |
7526 smsMessage = RecvSmsL(socket); |
6566 smsMessage = RecvSmsL(socket); |
7527 CleanupStack::PushL(smsMessage); |
6567 CleanupStack::PushL(smsMessage); |
7528 TestSmsContentsL(smsMessage, msg7BitPtr); |
6568 TestSmsContentsL(smsMessage, msg7BitPtr); |
7529 CleanupStack::PopAndDestroy(smsMessage); |
6569 CleanupStack::PopAndDestroy(smsMessage); |
7530 |
6570 |
7531 smsMessage = CreateSmsMessageL(msg8BitPtr, TSmsDataCodingScheme::ESmsAlphabet8Bit); |
6571 smsMessage = CreateSmsMessageLC(msg8BitPtr, TSmsDataCodingScheme::ESmsAlphabet8Bit); |
7532 CleanupStack::PushL(smsMessage); |
|
7533 pdus = smsMessage->NumMessagePDUsL(); |
6572 pdus = smsMessage->NumMessagePDUsL(); |
7534 TESTCHECK(pdus, 3); |
6573 TESTCHECK(pdus, 3, "Expected 3 PDUs"); |
6574 |
|
7535 TRAP(sendErr, SendSmsL(smsMessage, socket)); |
6575 TRAP(sendErr, SendSmsL(smsMessage, socket)); |
7536 TESTCHECK(sendErr, KErrNone); |
6576 TESTCHECK(sendErr, KErrNone, "Sending SMS"); |
7537 CleanupStack::PopAndDestroy(smsMessage); |
6577 CleanupStack::PopAndDestroy(smsMessage); |
7538 |
6578 |
7539 smsMessage = RecvSmsL(socket); |
6579 smsMessage = RecvSmsL(socket); |
7540 CleanupStack::PushL(smsMessage); |
6580 CleanupStack::PushL(smsMessage); |
7541 TestSmsContentsL(smsMessage, msg8BitPtr); |
6581 TestSmsContentsL(smsMessage, msg8BitPtr); |
7542 CleanupStack::PopAndDestroy(smsMessage); |
6582 CleanupStack::PopAndDestroy(smsMessage); |
7543 |
6583 |
7544 smsMessage = CreateSmsMessageL(msg16BitPtr, TSmsDataCodingScheme::ESmsAlphabetUCS2); |
6584 smsMessage = CreateSmsMessageLC(msg16BitPtr, TSmsDataCodingScheme::ESmsAlphabetUCS2); |
7545 CleanupStack::PushL(smsMessage); |
|
7546 pdus = smsMessage->NumMessagePDUsL(); |
6585 pdus = smsMessage->NumMessagePDUsL(); |
7547 TESTCHECK(pdus, 3); |
6586 TESTCHECK(pdus, 3, "Expected 3 PDUs"); |
6587 |
|
7548 TRAP(sendErr, SendSmsL(smsMessage, socket)); |
6588 TRAP(sendErr, SendSmsL(smsMessage, socket)); |
7549 TESTCHECK(sendErr, KErrNone); |
6589 TESTCHECK(sendErr, KErrNone, "Sending SMS"); |
6590 |
|
7550 CleanupStack::PopAndDestroy(smsMessage); |
6591 CleanupStack::PopAndDestroy(smsMessage); |
7551 |
6592 |
7552 smsMessage = RecvSmsL(socket); |
6593 smsMessage = RecvSmsL(socket); |
7553 CleanupStack::PushL(smsMessage); |
6594 CleanupStack::PushL(smsMessage); |
7554 TestSmsContentsL(smsMessage, msg16BitPtr); |
6595 TestSmsContentsL(smsMessage, msg16BitPtr); |
7594 smsMessage = RecvSmsL(socket); |
6635 smsMessage = RecvSmsL(socket); |
7595 CleanupStack::PushL(smsMessage); |
6636 CleanupStack::PushL(smsMessage); |
7596 TestSmsContentsL(smsMessage, incomingPtr); |
6637 TestSmsContentsL(smsMessage, incomingPtr); |
7597 CleanupStack::PopAndDestroy(smsMessage); |
6638 CleanupStack::PopAndDestroy(smsMessage); |
7598 |
6639 |
7599 // |
|
7600 // Clean up and finish... |
|
7601 // |
|
7602 CleanupStack::PopAndDestroy(incomingBuf); |
6640 CleanupStack::PopAndDestroy(incomingBuf); |
7603 CleanupStack::PopAndDestroy(msg16BitBuf); |
6641 CleanupStack::PopAndDestroy(msg16BitBuf); |
7604 CleanupStack::PopAndDestroy(msg8BitBuf); |
6642 CleanupStack::PopAndDestroy(msg8BitBuf); |
7605 CleanupStack::PopAndDestroy(msg7BitBuf); |
6643 CleanupStack::PopAndDestroy(msg7BitBuf); |
7606 CleanupStack::PopAndDestroy(&socket); |
6644 CleanupStack::PopAndDestroy(&socket); |
7607 CleanupStack::PopAndDestroy(&socketServer); |
|
7608 |
|
7609 return TestStepResult(); |
6645 return TestStepResult(); |
7610 } // CTestReceivingMessageWithDifferentEncodings::doTestStepL |
6646 } // CTestReceivingMessageWithDifferentEncodings::doTestStepL |
7611 |
6647 |
7612 |
6648 |
7613 /** |
6649 /** |
7615 * On re-request the message should still be available to the client to be read. |
6651 * On re-request the message should still be available to the client to be read. |
7616 */ |
6652 */ |
7617 TVerdict CTestReceivingMessageAfterSocketClosure::doTestStepL() |
6653 TVerdict CTestReceivingMessageAfterSocketClosure::doTestStepL() |
7618 { |
6654 { |
7619 INFO_PRINTF1(_L("Test re-requesting to receive a message after socket closure.")); |
6655 INFO_PRINTF1(_L("Test re-requesting to receive a message after socket closure.")); |
7620 |
|
7621 RSocketServ socketServer; |
|
7622 PrepareRegTestLC(socketServer, 159); |
|
7623 |
|
7624 // Open the socket for SIM operations. |
|
7625 RSocket socket; |
6656 RSocket socket; |
7626 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
6657 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
7627 |
6658 |
7628 // Wait for SMS message receipt. |
6659 // Wait for SMS message receipt. |
7629 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
7630 WaitForRecvL(socket); |
6660 WaitForRecvL(socket); |
7631 |
6661 |
7632 // Close socket before reading the message. |
6662 // Close socket before reading the message. |
7633 CleanupStack::PopAndDestroy(&socket); |
6663 CleanupStack::PopAndDestroy(&socket); |
7634 |
6664 |
7635 // Bind the socket again |
6665 // Bind the socket again |
7636 INFO_PRINTF1(_L("binding socket again; checking for receipt") ); |
6666 INFO_PRINTF1(_L("binding socket again; checking for receipt") ); |
7637 iSmsStackTestUtils->OpenSmsSocketLC(socketServer,socket,ESmsAddrRecvAny); |
6667 iSmsStackTestUtils->OpenSmsSocketLC(iSocketServer,socket,ESmsAddrRecvAny); |
7638 |
6668 |
7639 // Briefly wait for receipt on it - this should now happen again. |
6669 // Briefly wait for receipt on it - this should now happen again. |
7640 TBool bRcv = TimedWaitForRecvL(socket, 5 * 1000000); |
6670 TBool bRcv = TimedWaitForRecvL(socket, 5 * 1000000); |
7641 TEST_CHECKL(bRcv, ETrue, _L("Receive after re-bind should succeed.")); |
6671 TEST_CHECKL(bRcv, ETrue, _L("Receive after re-bind should succeed.")); |
7642 |
6672 |
7643 // Read the 1st SMS. |
6673 // Read the 1st SMS. |
7644 CSmsMessage* smsMessage1 = RecvSmsL(socket); |
6674 CSmsMessage* smsMessage1 = RecvSmsL(socket); |
7645 |
|
7646 CleanupStack::PushL(smsMessage1); |
6675 CleanupStack::PushL(smsMessage1); |
7647 |
6676 |
7648 TPtrC fromAddr1 = smsMessage1->ToFromAddress(); |
6677 TPtrC fromAddr1 = smsMessage1->ToFromAddress(); |
7649 INFO_PRINTF2(_L("1st received SMS from: %S"), &fromAddr1); |
6678 INFO_PRINTF2(_L("1st received SMS from: %S"), &fromAddr1); |
7650 |
6679 |
7651 // Now read the second SMS to make sure it is still available |
6680 // Now read the second SMS to make sure it is still available |
7652 bRcv = TimedWaitForRecvL(socket, 5 * 1000000); |
6681 bRcv = TimedWaitForRecvL(socket, 5 * 1000000); |
7653 TEST_CHECKL(bRcv, ETrue, _L("Receive after reading 1st message should also succeed.")); |
6682 TEST_CHECKL(bRcv, ETrue, _L("Receive after reading 1st message should also succeed.")); |
7654 |
6683 |
7655 CSmsMessage* smsMessage2 = RecvSmsL(socket); |
6684 CSmsMessage* smsMessage2 = RecvSmsL(socket); |
7656 |
|
7657 CleanupStack::PushL(smsMessage2); |
6685 CleanupStack::PushL(smsMessage2); |
7658 |
6686 |
7659 TPtrC fromAddr2 = smsMessage2->ToFromAddress(); |
6687 TPtrC fromAddr2 = smsMessage2->ToFromAddress(); |
7660 INFO_PRINTF2(_L("2st received SMS from: %S"), &fromAddr2); |
6688 INFO_PRINTF2(_L("2st received SMS from: %S"), &fromAddr2); |
7661 |
6689 |
7662 CleanupStack::PopAndDestroy(smsMessage2); |
6690 CleanupStack::PopAndDestroy(smsMessage2); |
7663 CleanupStack::PopAndDestroy(smsMessage1); |
6691 CleanupStack::PopAndDestroy(smsMessage1); |
7664 CleanupStack::PopAndDestroy(&socket); |
6692 CleanupStack::PopAndDestroy(&socket); |
7665 CleanupStack::PopAndDestroy(&socketServer); |
|
7666 |
|
7667 return TestStepResult() ; |
6693 return TestStepResult() ; |
7668 } // CTestReceivingMessageAfterSocketClosure::doTestStepL |
6694 } |
7669 |
6695 |
7670 TVerdict CTestSimpleTxAndRxWithLoggingDisabled::doTestStepL() |
6696 TVerdict CTestSimpleTxAndRxWithLoggingDisabled::doTestStepL() |
7671 /** |
6697 /** |
7672 * Test that a simple SMS can be transmitted and received |
6698 * Test that a simple SMS can be transmitted and received |
7673 * when the logging subsystem is disabled. |
6699 * when the logging subsystem is disabled. |
7674 */ |
6700 */ |
7675 { |
6701 { |
7676 INFO_PRINTF1(_L("Test Simple Tx and Rx SMS")); |
6702 INFO_PRINTF1(_L("Test Simple Tx and Rx SMS")); |
7677 |
6703 RSocket socket; |
7678 RSocketServ socketServer; |
6704 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer,socket,ESmsAddrRecvAny); |
7679 PrepareRegTestLC(socketServer, 158); |
|
7680 |
|
7681 RSocket socket; |
|
7682 iSmsStackTestUtils->OpenSmsSocketL(socketServer,socket,ESmsAddrRecvAny); |
|
7683 CleanupClosePushL(socket); |
6705 CleanupClosePushL(socket); |
7684 |
6706 |
7685 iSmsStackTestUtils->DisableLogging(); |
6707 iSmsStackTestUtils->DisableLogging(); |
7686 |
6708 |
7687 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
6709 _LIT(KTestMsg1,"test message, 8bits, length 30"); |
7689 //Set destination and SC numbers |
6711 //Set destination and SC numbers |
7690 iTelephoneNumber=KPekka; |
6712 iTelephoneNumber=KPekka; |
7691 iServiceCenterNumber=KRadiolinjaSC; |
6713 iServiceCenterNumber=KRadiolinjaSC; |
7692 |
6714 |
7693 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
6715 TSmsDataCodingScheme::TSmsAlphabet alphabet=TSmsDataCodingScheme::ESmsAlphabet8Bit; |
7694 CSmsMessage* smsMessage=CreateSmsMessageL(KTestMsg1,alphabet); |
6716 CSmsMessage* smsMessage=CreateSmsMessageLC(KTestMsg1,alphabet); |
7695 CleanupStack::PushL(smsMessage); |
|
7696 |
6717 |
7697 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
6718 INFO_PRINTF2(_L("Destination number:..... %S"),&iTelephoneNumber); |
7698 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
6719 INFO_PRINTF2(_L("ServiceCenter number:... %S"),&iServiceCenterNumber); |
7699 |
6720 |
7700 //Send SMS |
6721 //Send SMS |
7701 SendSmsL(smsMessage,socket); |
6722 SendSmsL(smsMessage,socket); |
7702 |
|
7703 CleanupStack::PopAndDestroy(smsMessage); |
6723 CleanupStack::PopAndDestroy(smsMessage); |
7704 |
6724 |
7705 //Receive SMS |
6725 //Receive SMS |
7706 INFO_PRINTF1(_L("waiting for incoming SMS...") ); |
|
7707 WaitForRecvL(socket); |
6726 WaitForRecvL(socket); |
7708 smsMessage = RecvSmsL(socket); |
6727 smsMessage = RecvSmsL(socket); |
7709 |
|
7710 INFO_PRINTF1(_L("incoming SMS") ); |
|
7711 |
|
7712 CleanupStack::PushL(smsMessage); |
6728 CleanupStack::PushL(smsMessage); |
6729 |
|
7713 TestSmsContentsL(smsMessage,KTestMsg1); |
6730 TestSmsContentsL(smsMessage,KTestMsg1); |
7714 CleanupStack::PopAndDestroy(smsMessage); |
6731 CleanupStack::PopAndDestroy(smsMessage); |
7715 |
6732 |
7716 iSmsStackTestUtils->EnableLogging(); |
6733 iSmsStackTestUtils->EnableLogging(); |
7717 |
|
7718 CleanupStack::PopAndDestroy(&socket); |
6734 CleanupStack::PopAndDestroy(&socket); |
7719 |
|
7720 CleanupStack::PopAndDestroy(&socketServer); |
|
7721 |
|
7722 return TestStepResult() ; |
6735 return TestStepResult() ; |
7723 } |
6736 } |
7724 |
6737 |
7725 /** |
6738 /** |
7726 * Tests that Spanish, Portuguese and Turkish character converters are being used. |
6739 * Tests that Spanish, Portuguese and Turkish character converters are being used. |
7727 */ |
6740 */ |
7728 TVerdict CTestEncoding7bitNationalLanguages::doTestStepL() |
6741 TVerdict CTestEncoding7bitNationalLanguages::doTestStepL() |
7729 { |
6742 { |
7730 RSocketServ socketServer; |
|
7731 PrepareRegTestLC(socketServer, 160); |
|
7732 |
|
7733 RSocket socket; |
6743 RSocket socket; |
7734 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6744 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7735 CleanupClosePushL(socket); |
6745 CleanupClosePushL(socket); |
7736 |
6746 |
7737 // |
6747 // |
7738 // Test use of Spanish GSM text using shift table... |
6748 // Test use of Spanish GSM text using shift table... |
7739 // Some of the characters chosen dont appear in Portuguese or Turkish table |
6749 // Some of the characters chosen dont appear in Portuguese or Turkish table |
7806 /* Char sets */ iCharSets, |
6816 /* Char sets */ iCharSets, |
7807 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6817 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7808 /* Encoding to use */ ESmsEncodingTurkishLockingShift, |
6818 /* Encoding to use */ ESmsEncodingTurkishLockingShift, |
7809 /* Encoding expected */ ESmsEncodingTurkishLockingShift); |
6819 /* Encoding expected */ ESmsEncodingTurkishLockingShift); |
7810 iCharSets.Reset(); |
6820 iCharSets.Reset(); |
7811 |
6821 |
7812 // |
|
7813 // Clean up and finish... |
|
7814 // |
|
7815 CleanupStack::PopAndDestroy(&socket); |
6822 CleanupStack::PopAndDestroy(&socket); |
7816 CleanupStack::PopAndDestroy(&socketServer); |
|
7817 |
|
7818 return TestStepResult(); |
6823 return TestStepResult(); |
7819 } // CTestEncoding7bitNationalLanguages::doTestStepL |
6824 } |
7820 |
6825 |
7821 /** |
6826 /** |
7822 * Tests that Portuguese character converters creates a multi PDU SMS message correctly. |
6827 * Tests that Portuguese character converters creates a multi PDU SMS message correctly. |
7823 */ |
6828 */ |
7824 TVerdict CTestEncodingMultiPDUwith7bitNationalLanguages::doTestStepL() |
6829 TVerdict CTestEncodingMultiPDUwith7bitNationalLanguages::doTestStepL() |
7825 { |
6830 { |
7826 RSocketServ socketServer; |
|
7827 PrepareRegTestLC(socketServer, 161); |
|
7828 |
|
7829 RSocket socket; |
6831 RSocket socket; |
7830 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6832 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7831 CleanupClosePushL(socket); |
6833 CleanupClosePushL(socket); |
7832 |
6834 |
7833 // |
6835 // |
7834 // Test use of Portuguese GSM text using locking shift table... |
6836 // Test use of Portuguese GSM text using locking shift table... |
7835 // Check that when one byte remains in the last PDU that adding a 2 byte character |
6837 // Check that when one byte remains in the last PDU that adding a 2 byte character |
7853 /* Encoding to use */ ESmsEncodingPortugueseLockingAndSingleShift, |
6855 /* Encoding to use */ ESmsEncodingPortugueseLockingAndSingleShift, |
7854 /* Encoding expected */ ESmsEncodingPortugueseLockingShift); |
6856 /* Encoding expected */ ESmsEncodingPortugueseLockingShift); |
7855 iCharSets.Reset(); |
6857 iCharSets.Reset(); |
7856 iAdditionalCharSets.Reset(); |
6858 iAdditionalCharSets.Reset(); |
7857 |
6859 |
7858 // |
|
7859 // Clean up and finish... |
|
7860 // |
|
7861 CleanupStack::PopAndDestroy(&socket); |
6860 CleanupStack::PopAndDestroy(&socket); |
7862 CleanupStack::PopAndDestroy(&socketServer); |
|
7863 |
|
7864 return TestStepResult(); |
6861 return TestStepResult(); |
7865 } // CTestEncodingMultiPDUwith7bitNationalLanguages::doTestStepL |
6862 } |
7866 |
6863 |
7867 /** |
6864 /** |
7868 * Test Turkish, Portuguese and Spanish Character Downgrading |
6865 * Test Turkish, Portuguese and Spanish Character Downgrading |
7869 */ |
6866 */ |
7870 TVerdict CTestEncodingDowngradedWith7bitNationalLanguages::doTestStepL() |
6867 TVerdict CTestEncodingDowngradedWith7bitNationalLanguages::doTestStepL() |
7871 { |
6868 { |
7872 |
|
7873 RSocketServ socketServer; |
|
7874 PrepareRegTestLC(socketServer, 162); |
|
7875 |
|
7876 RSocket socket; |
6869 RSocket socket; |
7877 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6870 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7878 CleanupClosePushL(socket); |
6871 CleanupClosePushL(socket); |
7879 |
6872 |
7880 // |
6873 // |
7881 // Test Turkish GSM text (no alternative encoding)... |
6874 // Test Turkish GSM text (no alternative encoding)... |
7882 // |
6875 // |
7917 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6910 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7918 /* Encoding to use */ ESmsEncodingNone, |
6911 /* Encoding to use */ ESmsEncodingNone, |
7919 /* Encoding expected */ ESmsEncodingNone); |
6912 /* Encoding expected */ ESmsEncodingNone); |
7920 iCharSets.Reset(); |
6913 iCharSets.Reset(); |
7921 |
6914 |
7922 // |
|
7923 // Clean up and finish... |
|
7924 // |
|
7925 CleanupStack::PopAndDestroy(&socket); |
6915 CleanupStack::PopAndDestroy(&socket); |
7926 CleanupStack::PopAndDestroy(&socketServer); |
|
7927 |
|
7928 return TestStepResult(); |
6916 return TestStepResult(); |
7929 } // CTestEncodingDowngradedWith7bitNationalLanguages::doTestStepL() |
6917 } |
7930 |
6918 |
7931 /** |
6919 /** |
7932 * Test Portuguese GSM text (Portuguese locking and shift table)... |
6920 * Test Portuguese GSM text (Portuguese locking and shift table)... |
7933 */ |
6921 */ |
7934 TVerdict CTestOptimumEncodingWithLockingAndShift7bitNationalLanguages::doTestStepL() |
6922 TVerdict CTestOptimumEncodingWithLockingAndShift7bitNationalLanguages::doTestStepL() |
7935 { |
6923 { |
7936 |
|
7937 RSocketServ socketServer; |
|
7938 PrepareRegTestLC(socketServer, 163); |
|
7939 |
|
7940 RSocket socket; |
6924 RSocket socket; |
7941 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6925 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7942 CleanupClosePushL(socket); |
6926 CleanupClosePushL(socket); |
7943 |
6927 |
7944 // Test to ensure ESmsEncodingPortugueseSingleShift is selected |
6928 // Test to ensure ESmsEncodingPortugueseSingleShift is selected |
7945 // two Portuguese shift (& standard) characters are added for every locking (& shift) |
6929 // two Portuguese shift (& standard) characters are added for every locking (& shift) |
7946 // character - the result is Portuguese Single Shift |
6930 // character - the result is Portuguese Single Shift |
7957 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6941 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7958 /* Encoding to use */ ESmsEncodingPortugueseLockingAndSingleShift, |
6942 /* Encoding to use */ ESmsEncodingPortugueseLockingAndSingleShift, |
7959 /* Encoding expected */ ESmsEncodingPortugueseSingleShift); |
6943 /* Encoding expected */ ESmsEncodingPortugueseSingleShift); |
7960 iCharSets.Reset(); |
6944 iCharSets.Reset(); |
7961 |
6945 |
7962 // |
|
7963 // Clean up and finish... |
|
7964 // |
|
7965 CleanupStack::PopAndDestroy(&socket); |
6946 CleanupStack::PopAndDestroy(&socket); |
7966 CleanupStack::PopAndDestroy(&socketServer); |
|
7967 |
|
7968 return TestStepResult(); |
6947 return TestStepResult(); |
7969 } // CTestOptimumEncodingWithLockingAndShift7bitNationalLanguages::doTestStepL() |
6948 } |
7970 |
6949 |
7971 /** |
6950 /** |
7972 * Test normal GSM text but with Turkish locking and shift table... |
6951 * Test normal GSM text but with Turkish locking and shift table... |
7973 */ |
6952 */ |
7974 TVerdict CTestOptimumEncodingWithLockingAndDowngrade7bitNationalLanguages::doTestStepL() |
6953 TVerdict CTestOptimumEncodingWithLockingAndDowngrade7bitNationalLanguages::doTestStepL() |
7975 { |
6954 { |
7976 |
|
7977 RSocketServ socketServer; |
|
7978 PrepareRegTestLC(socketServer, 164); |
|
7979 |
|
7980 RSocket socket; |
6955 RSocket socket; |
7981 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6956 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
7982 CleanupClosePushL(socket); |
6957 CleanupClosePushL(socket); |
7983 |
6958 |
7984 // Add characters in the standard table, but request ESmsEncodingTurkishLockingAndSingleShift |
6959 // Add characters in the standard table, but request ESmsEncodingTurkishLockingAndSingleShift |
7985 iCharSets.Append(KCharacterSetStandard7bitGSM()); |
6960 iCharSets.Append(KCharacterSetStandard7bitGSM()); |
7986 iCharSets.Append(KCharacterSetStandard7bitGSMShift()); |
6961 iCharSets.Append(KCharacterSetStandard7bitGSMShift()); |
7992 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6967 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
7993 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
6968 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
7994 /* Encoding expected */ ESmsEncodingNone); |
6969 /* Encoding expected */ ESmsEncodingNone); |
7995 iCharSets.Reset(); |
6970 iCharSets.Reset(); |
7996 |
6971 |
7997 // |
|
7998 // Clean up and finish... |
|
7999 // |
|
8000 CleanupStack::PopAndDestroy(&socket); |
6972 CleanupStack::PopAndDestroy(&socket); |
8001 CleanupStack::PopAndDestroy(&socketServer); |
|
8002 |
|
8003 return TestStepResult(); |
6973 return TestStepResult(); |
8004 } // CTestOptimumEncodingWithLockingAndDowngrade7bitNationalLanguages::doTestStepL() |
6974 } |
8005 |
6975 |
8006 /** |
6976 /** |
8007 * Test Turkish GSM text with other downgrades (Turkish locking and shift table)... |
6977 * Test Turkish GSM text with other downgrades (Turkish locking and shift table)... |
8008 */ |
6978 */ |
8009 TVerdict CTestOptimumEncodingWithLockingAndUnconvertible7bitNationalLanguages::doTestStepL() |
6979 TVerdict CTestOptimumEncodingWithLockingAndUnconvertible7bitNationalLanguages::doTestStepL() |
8010 { |
6980 { |
8011 |
|
8012 RSocketServ socketServer; |
|
8013 PrepareRegTestLC(socketServer, 165); |
|
8014 |
|
8015 RSocket socket; |
6981 RSocket socket; |
8016 iSmsStackTestUtils->OpenSmsSocketL(socketServer, socket, ESmsAddrRecvAny); |
6982 iSmsStackTestUtils->OpenSmsSocketL(iSocketServer, socket, ESmsAddrRecvAny); |
8017 CleanupClosePushL(socket); |
6983 CleanupClosePushL(socket); |
8018 |
6984 |
8019 // Add Turkish shift characters |
6985 // Add Turkish shift characters |
8020 iCharSets.Append(KCharacterSetTurkish7bitGSMShift()); |
6986 iCharSets.Append(KCharacterSetTurkish7bitGSMShift()); |
8021 // Add Non- Turkish characters that will be downgraded |
6987 // Add Non- Turkish characters that will be downgraded |
8028 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
6994 /* DCS */ TSmsDataCodingScheme::ESmsAlphabet7Bit, |
8029 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
6995 /* Encoding to use */ ESmsEncodingTurkishLockingAndSingleShift, |
8030 /* Encoding expected */ ESmsEncodingTurkishSingleShift); |
6996 /* Encoding expected */ ESmsEncodingTurkishSingleShift); |
8031 iCharSets.Reset(); |
6997 iCharSets.Reset(); |
8032 |
6998 |
8033 // |
|
8034 // Clean up and finish... |
|
8035 // |
|
8036 CleanupStack::PopAndDestroy(&socket); |
6999 CleanupStack::PopAndDestroy(&socket); |
8037 CleanupStack::PopAndDestroy(&socketServer); |
|
8038 |
|
8039 return TestStepResult(); |
7000 return TestStepResult(); |
8040 } // CTestOptimumEncodingWithLockingAndUnconvertible7bitNationalLanguages::doTestStepL |
7001 } |
8041 |