24
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// implementation of test steps
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@test
|
|
21 |
*/
|
|
22 |
|
|
23 |
#include "WapIoctlSteps.h"
|
|
24 |
|
|
25 |
#include <simtsy.h>
|
|
26 |
#include <smspver.h>
|
|
27 |
#include <wap_sock.h>
|
|
28 |
|
|
29 |
#include "smsstacktestconsts.h"
|
|
30 |
#include "WapProtSuiteDefs.h"
|
|
31 |
|
|
32 |
TVerdict CIoctlStep_1::doTestStepL()
|
|
33 |
/**
|
|
34 |
* Test step one:
|
|
35 |
* Sends/receives a 7Bit business card using IOCTL
|
|
36 |
* @return - TVerdict code
|
|
37 |
*/
|
|
38 |
{
|
|
39 |
INFO_PRINTF1(_L("IOCTL Test step 1: send/receive 7-Bit business card"));
|
|
40 |
// Configure and bind to a socket
|
|
41 |
SetupWapSocketL();
|
|
42 |
|
|
43 |
// Send a business card
|
|
44 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
45 |
|
|
46 |
SendWapMessage(testData);
|
|
47 |
|
|
48 |
// Receive the business card
|
|
49 |
ReceiveWapMessage(testData);
|
|
50 |
|
|
51 |
iSocket.Close();
|
|
52 |
return TestStepResult();
|
|
53 |
}
|
|
54 |
|
|
55 |
TVerdict CIoctlStep_2::doTestStepL()
|
|
56 |
/**
|
|
57 |
* Test step two:
|
|
58 |
* Sends/receives a 7-Bit calendar entry and VCard using IOCTL(two segments each)
|
|
59 |
* @return - TVerdict code
|
|
60 |
*/
|
|
61 |
{
|
|
62 |
INFO_PRINTF1(_L("IOCTL Test step 2: send/receive a VCal and VCard"));
|
|
63 |
// Configure and bind to a socket
|
|
64 |
SetupWapSocketL();
|
|
65 |
|
|
66 |
// Issue Ioctl for getting the length of the message
|
|
67 |
TRequestStatus ioctlStatus;
|
|
68 |
TPckgBuf<TInt> length;
|
|
69 |
|
|
70 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the first message (VCal)..."));
|
|
71 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
72 |
|
|
73 |
TPtrC testData1 = GetStringFromConfigL(KTestData1);
|
|
74 |
TPtrC testData2 = GetStringFromConfigL(KTestData2);
|
|
75 |
|
|
76 |
// Send a VCal entry
|
|
77 |
SendWapMessage(testData1);
|
|
78 |
|
|
79 |
// Send a VCard entry with extended GSM alphabets
|
|
80 |
SendWapMessage(testData2);
|
|
81 |
|
|
82 |
// Get the size of the first incoming message
|
|
83 |
User::WaitForRequest(ioctlStatus);
|
|
84 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
85 |
TESTCHECK(length(), testData1.Length(), "Check if reported length is correct");
|
|
86 |
|
|
87 |
// Receive the VCal message
|
|
88 |
ReceiveWapMessageFromSocket(length(), testData1);
|
|
89 |
|
|
90 |
// Receive the VCard message
|
|
91 |
ReceiveWapMessage(testData2);
|
|
92 |
|
|
93 |
iSocket.Close();
|
|
94 |
return TestStepResult();
|
|
95 |
}
|
|
96 |
|
|
97 |
TVerdict CIoctlStep_3::doTestStepL()
|
|
98 |
/**
|
|
99 |
* Test step 3:
|
|
100 |
* send/receive one 7-Bit two segments message and one 7-Bit one segment message
|
|
101 |
* @return - TVerdict code
|
|
102 |
*/
|
|
103 |
{
|
|
104 |
INFO_PRINTF1(_L("IOCTL Test step 3: send/receive two 7-Bit messages"));
|
|
105 |
// Configure and bind to a socket
|
|
106 |
SetupWapSocketL();
|
|
107 |
|
|
108 |
// Issue Ioctl for getting the length of the message
|
|
109 |
TRequestStatus ioctlStatus;
|
|
110 |
TPckgBuf<TInt> length;
|
|
111 |
|
|
112 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the first message..."));
|
|
113 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
114 |
|
|
115 |
TPtrC testData1 = GetStringFromConfigL(KTestData1);
|
|
116 |
TPtrC testData2 = GetStringFromConfigL(KTestData2);
|
|
117 |
|
|
118 |
// Send a business card
|
|
119 |
SendWapMessage(testData2);
|
|
120 |
|
|
121 |
// Send a business card
|
|
122 |
SendWapMessage(testData1);
|
|
123 |
|
|
124 |
// Get the size of the first incoming message
|
|
125 |
User::WaitForRequest(ioctlStatus);
|
|
126 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
127 |
TESTCHECK(length(), testData2.Length(), "Check if reported length is correct");
|
|
128 |
|
|
129 |
// Receive the first message
|
|
130 |
ReceiveWapMessageFromSocket(length(), testData2);
|
|
131 |
|
|
132 |
// Receive the second message
|
|
133 |
ReceiveWapMessage(testData1);
|
|
134 |
|
|
135 |
iSocket.Close();
|
|
136 |
return TestStepResult();
|
|
137 |
}
|
|
138 |
|
|
139 |
TVerdict CIoctlStep_4::doTestStepL()
|
|
140 |
/**
|
|
141 |
* Test step 4:
|
|
142 |
* simulating client crash conditions with 7bit message
|
|
143 |
* @return - TVerdict code
|
|
144 |
*/
|
|
145 |
{
|
|
146 |
INFO_PRINTF1(_L("IOCTL Test step 4: client crash condition 7-Bit message "));
|
|
147 |
// Configure and bind to a socket
|
|
148 |
SetupWapSocketL();
|
|
149 |
|
|
150 |
// Issue Ioctl for getting the length of the message
|
|
151 |
TRequestStatus ioctlStatus;
|
|
152 |
TPckgBuf<TInt> length;
|
|
153 |
|
|
154 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the first message..."));
|
|
155 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
156 |
|
|
157 |
// Send a business card
|
|
158 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
159 |
SendWapMessage(testData);
|
|
160 |
|
|
161 |
// Get the size of the first incoming message
|
|
162 |
User::WaitForRequest(ioctlStatus);
|
|
163 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
164 |
TESTCHECK(length(), testData.Length(), "Check if reported length is correct");
|
|
165 |
|
|
166 |
// Receive a message
|
|
167 |
TRequestStatus recvStatus;
|
|
168 |
TWapAddr recvWapAddr;
|
|
169 |
HBufC8* recvBuf = HBufC8::NewLC(length());
|
|
170 |
TPtr8 recvPtr = recvBuf->Des();
|
|
171 |
|
|
172 |
iSocket.RecvFrom(recvPtr, recvWapAddr, 0, recvStatus);
|
|
173 |
User::WaitForRequest(recvStatus);
|
|
174 |
TESTCHECKL(recvStatus.Int(), KErrNone, "Receiving a message");
|
|
175 |
|
|
176 |
// Simulate a crash by closing and reopening the socket
|
|
177 |
iSocket.Close();
|
|
178 |
INFO_PRINTF1(_L("Socket was closed..."));
|
|
179 |
|
|
180 |
OpenSocketL(iSocketServer, iSocket);
|
|
181 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0));
|
|
182 |
INFO_PRINTF1(_L("Socket set option for indicating new client"));
|
|
183 |
User::LeaveIfError(iSocket.Bind(iWapAddr));
|
|
184 |
INFO_PRINTF1(_L("Socket was opened..."));
|
|
185 |
|
|
186 |
// Issue another get length of datagram as if not aware of the previous message
|
|
187 |
// and retrieve the message from the SAR store
|
|
188 |
ReceiveWapMessage(testData);
|
|
189 |
|
|
190 |
iSocket.Close();
|
|
191 |
CleanupStack::PopAndDestroy(recvBuf);
|
|
192 |
return TestStepResult();
|
|
193 |
}
|
|
194 |
|
|
195 |
TVerdict CIoctlStep_5::doTestStepL()
|
|
196 |
/**
|
|
197 |
* Test step 5:
|
|
198 |
* simulating client crash conditions with 8bit push message
|
|
199 |
* @return - TVerdict code
|
|
200 |
*/
|
|
201 |
{
|
|
202 |
INFO_PRINTF1(_L("IOCTL Test step 5: client crash condition with 8Bit push message"));
|
|
203 |
// Configure and bind to a socket
|
|
204 |
SetupWapSocketL();
|
|
205 |
|
|
206 |
// Issue Ioctl for getting the length of the message
|
|
207 |
TRequestStatus ioctlStatus;
|
|
208 |
TPckgBuf<TInt> length;
|
|
209 |
|
|
210 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the first message..."));
|
|
211 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
212 |
|
|
213 |
// Get the size of the incoming message
|
|
214 |
User::WaitForRequest(ioctlStatus);
|
|
215 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
216 |
|
|
217 |
// Receive a message
|
|
218 |
TRequestStatus recvStatus;
|
|
219 |
TWapAddr recvWapAddr;
|
|
220 |
HBufC8* recvBuf = HBufC8::NewLC(length());
|
|
221 |
TPtr8 recvPtr = recvBuf->Des();
|
|
222 |
|
|
223 |
iSocket.RecvFrom(recvPtr, recvWapAddr, 0, recvStatus);
|
|
224 |
User::WaitForRequest(recvStatus);
|
|
225 |
TESTCHECKL(recvStatus.Int(), KErrNone, "Receiving a message");
|
|
226 |
|
|
227 |
// Simulate a crash by closing and reopening the socket
|
|
228 |
iSocket.Close();
|
|
229 |
INFO_PRINTF1(_L("Socket was closed..."));
|
|
230 |
|
|
231 |
OpenSocketL(iSocketServer, iSocket);
|
|
232 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0));
|
|
233 |
INFO_PRINTF1(_L("Socket set option for indicating new client"));
|
|
234 |
User::LeaveIfError(iSocket.Bind(iWapAddr));
|
|
235 |
INFO_PRINTF1(_L("Socket was opened..."));
|
|
236 |
|
|
237 |
// Issue another get length of datagram as if not aware of the previous message
|
|
238 |
INFO_PRINTF1(_L("Issue of first IOCTL for GetLength"));
|
|
239 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
240 |
|
|
241 |
// waiting for request to be completed
|
|
242 |
User::WaitForRequest(ioctlStatus);
|
|
243 |
User::LeaveIfError(ioctlStatus.Int());
|
|
244 |
INFO_PRINTF1(_L("IOCTL completed..."));
|
|
245 |
|
|
246 |
// New message retrieved from SAR store
|
|
247 |
HBufC8* recvBuf2 = HBufC8::NewLC(length());
|
|
248 |
TPtr8 recvPtr2 = recvBuf2->Des();
|
|
249 |
|
|
250 |
iSocket.RecvFrom(recvPtr2,recvWapAddr,0,recvStatus);
|
|
251 |
User::WaitForRequest(recvStatus);
|
|
252 |
User::LeaveIfError(recvStatus.Int());
|
|
253 |
INFO_PRINTF1(_L("Received the message..."));
|
|
254 |
|
|
255 |
// Confirm the receipt of the message to the client
|
|
256 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
257 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
258 |
|
|
259 |
// Compare the received message with the previous one
|
|
260 |
// They should be identical
|
|
261 |
TEST(recvPtr2.Compare(recvPtr) == 0);
|
|
262 |
|
|
263 |
iSocket.Close();
|
|
264 |
CleanupStack::PopAndDestroy(2, recvBuf); // recvBuf, recvBuf2
|
|
265 |
return TestStepResult();
|
|
266 |
}
|
|
267 |
|
|
268 |
TVerdict CIoctlStep_6::doTestStepL()
|
|
269 |
/**
|
|
270 |
* Test step 6:
|
|
271 |
* Sends/receives a business card (Old client testing)
|
|
272 |
* @return - TVerdict code
|
|
273 |
*/
|
|
274 |
{
|
|
275 |
INFO_PRINTF1(_L("IOCTL Test step 6: send/receive a VCard (Old client testing)"));
|
|
276 |
// Configure and bind to a socket, do not set the "new style client" option
|
|
277 |
SetupWapSocketL(iSocket, iWapAddr, KWapPort, EFalse);
|
|
278 |
|
|
279 |
// Send a calendar entry
|
|
280 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
281 |
SendWapMessage(testData);
|
|
282 |
|
|
283 |
// Receiving a datagram
|
|
284 |
TRequestStatus recvStatus;
|
|
285 |
TWapAddr recvWapAddr;
|
|
286 |
TBuf8<256> recvBuf;
|
|
287 |
|
|
288 |
INFO_PRINTF1(_L("Receiving a message from the socket..."));
|
|
289 |
iSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
290 |
User::WaitForRequest(recvStatus);
|
|
291 |
TESTCHECKL(recvStatus.Int(), KErrNone, "Receiving a message");
|
|
292 |
|
|
293 |
iSocket.Close();
|
|
294 |
return TestStepResult();
|
|
295 |
}
|
|
296 |
|
|
297 |
TVerdict CIoctlStep_7::doTestStepL()
|
|
298 |
/**
|
|
299 |
* Test step 7:
|
|
300 |
* Receives a Push Message (8-Bit)
|
|
301 |
* @return - TVerdict code
|
|
302 |
*/
|
|
303 |
{
|
|
304 |
INFO_PRINTF1(_L("IOCTL Test step 7: Receive push message(8-Bit)"));
|
|
305 |
// Configure and bind to a socket
|
|
306 |
SetupWapSocketL();
|
|
307 |
|
|
308 |
//
|
|
309 |
// Issue Ioctl for getting the length of the message
|
|
310 |
TRequestStatus ioctlStatus;
|
|
311 |
TPckgBuf<TInt> length;
|
|
312 |
|
|
313 |
INFO_PRINTF1(_L("Issue of first IOCTL for GetLength"));
|
|
314 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
315 |
|
|
316 |
//
|
|
317 |
// Get the size of the incomming push message
|
|
318 |
//
|
|
319 |
User::WaitForRequest(ioctlStatus);
|
|
320 |
User::LeaveIfError(ioctlStatus.Int());
|
|
321 |
INFO_PRINTF1(_L("IOCTL completed..."));
|
|
322 |
|
|
323 |
//
|
|
324 |
// Receiving push datagram
|
|
325 |
//
|
|
326 |
TRequestStatus recvStatus;
|
|
327 |
TWapAddr recvWapAddr;
|
|
328 |
TBuf8<256> recvBuf2(length);
|
|
329 |
|
|
330 |
iSocket.RecvFrom(recvBuf2,recvWapAddr,0,recvStatus);
|
|
331 |
User::WaitForRequest(recvStatus);
|
|
332 |
User::LeaveIfError(recvStatus.Int());
|
|
333 |
INFO_PRINTF1(_L("Received the push message..."));
|
|
334 |
|
|
335 |
//
|
|
336 |
// Confirm the receipt of the message to the client
|
|
337 |
//
|
|
338 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
339 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
340 |
|
|
341 |
iSocket.Close();
|
|
342 |
return TestStepResult();
|
|
343 |
}
|
|
344 |
|
|
345 |
TVerdict CIoctlStep_8::doTestStepL()
|
|
346 |
/**
|
|
347 |
* Test step 8:
|
|
348 |
* Receives two Push Messages (8-Bit) Tests store of 8-Bit messages
|
|
349 |
* @return - TVerdict code
|
|
350 |
*/
|
|
351 |
{
|
|
352 |
INFO_PRINTF1(_L("IOCTL Test step 8: Receive two push message(8-Bit)"));
|
|
353 |
// Configure and bind to a socket
|
|
354 |
SetupWapSocketL();
|
|
355 |
|
|
356 |
//
|
|
357 |
// Issue Ioctl for getting the length of the message
|
|
358 |
//
|
|
359 |
TRequestStatus ioctlStatus;
|
|
360 |
TPckgBuf<TInt> length;
|
|
361 |
|
|
362 |
INFO_PRINTF1(_L("Issue of first IOCTL for GetLength"));
|
|
363 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
364 |
//
|
|
365 |
// Get the size of the incomming push message
|
|
366 |
//
|
|
367 |
User::WaitForRequest(ioctlStatus);
|
|
368 |
User::LeaveIfError(ioctlStatus.Int());
|
|
369 |
INFO_PRINTF1(_L("IOCTL completed..."));
|
|
370 |
|
|
371 |
//
|
|
372 |
// Receiving push datagram
|
|
373 |
//
|
|
374 |
TRequestStatus recvStatus;
|
|
375 |
TWapAddr recvWapAddr;
|
|
376 |
TBuf8<256> recvBuf1(length);
|
|
377 |
|
|
378 |
iSocket.RecvFrom(recvBuf1,recvWapAddr,0,recvStatus);
|
|
379 |
User::WaitForRequest(recvStatus);
|
|
380 |
User::LeaveIfError(recvStatus.Int());
|
|
381 |
INFO_PRINTF1(_L("Received the push message..."));
|
|
382 |
|
|
383 |
//
|
|
384 |
// Confirm the receipt of the message to the client
|
|
385 |
//
|
|
386 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
387 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
388 |
|
|
389 |
//
|
|
390 |
// Issue another Ioctl for getting the length of the message
|
|
391 |
//
|
|
392 |
INFO_PRINTF1(_L("Issue of first IOCTL for GetLength"));
|
|
393 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
394 |
//
|
|
395 |
// Get the size of the second incomming push message
|
|
396 |
//
|
|
397 |
User::WaitForRequest(ioctlStatus);
|
|
398 |
User::LeaveIfError(ioctlStatus.Int());
|
|
399 |
INFO_PRINTF1(_L("IOCTL completed..."));
|
|
400 |
//
|
|
401 |
// Allocate buffer
|
|
402 |
//
|
|
403 |
TBuf8<256> recvBuf2(length);
|
|
404 |
|
|
405 |
//
|
|
406 |
// Receiving push datagram
|
|
407 |
//
|
|
408 |
iSocket.RecvFrom(recvBuf2,recvWapAddr,0,recvStatus);
|
|
409 |
User::WaitForRequest(recvStatus);
|
|
410 |
User::LeaveIfError(recvStatus.Int());
|
|
411 |
INFO_PRINTF1(_L("Received the second push message..."));
|
|
412 |
//
|
|
413 |
// Compare the received message with the previous one
|
|
414 |
// They should be identical
|
|
415 |
//
|
|
416 |
TEST(recvBuf2.Compare(recvBuf1) == 0);
|
|
417 |
|
|
418 |
//
|
|
419 |
// Confirm the receipt of the message to the client
|
|
420 |
//
|
|
421 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
422 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
423 |
|
|
424 |
iSocket.Close();
|
|
425 |
return TestStepResult();
|
|
426 |
}
|
|
427 |
|
|
428 |
TVerdict CIoctlStep_9::doTestStepL()
|
|
429 |
/**
|
|
430 |
* Test step 9:
|
|
431 |
* Receive a 8-Bit push message (Old client testing)
|
|
432 |
* @return - TVerdict code
|
|
433 |
*/
|
|
434 |
{
|
|
435 |
INFO_PRINTF1(_L("IOCTL Test step 9: receive a push message (Testing old client)"));
|
|
436 |
// Configure and bind to a socket, do not set the "new style client" option
|
|
437 |
SetupWapSocketL(iSocket, iWapAddr, KWapPort, EFalse);
|
|
438 |
|
|
439 |
//
|
|
440 |
// Receiving a datagram
|
|
441 |
//
|
|
442 |
TRequestStatus recvStatus;
|
|
443 |
TWapAddr recvWapAddr;
|
|
444 |
TBuf8<256> recvBuf;
|
|
445 |
|
|
446 |
iSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
447 |
User::WaitForRequest(recvStatus);
|
|
448 |
User::LeaveIfError(recvStatus.Int());
|
|
449 |
INFO_PRINTF1(_L("Received the message..."));
|
|
450 |
|
|
451 |
iSocket.Close();
|
|
452 |
return TestStepResult();
|
|
453 |
}
|
|
454 |
|
|
455 |
TVerdict CIoctlStep_10::doTestStepL()
|
|
456 |
/**
|
|
457 |
* Test step Ten:
|
|
458 |
* Sends/receives a 7Bit business card using IOCTL
|
|
459 |
* @return - TVerdict code
|
|
460 |
*/
|
|
461 |
{
|
|
462 |
INFO_PRINTF1(_L("IOCTL Test step 10: send/receive 7-Bit business card using IOCTL"));
|
|
463 |
// Configure and bind to a socket
|
|
464 |
SetupWapSocketL();
|
|
465 |
|
|
466 |
// Send a calendar entry
|
|
467 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
468 |
SendWapMessage(testData);
|
|
469 |
|
|
470 |
ReceiveWapMessage(testData);
|
|
471 |
|
|
472 |
iSocket.Close();
|
|
473 |
return TestStepResult();
|
|
474 |
}
|
|
475 |
|
|
476 |
TVerdict CIoctlStep_11::doTestStepL()
|
|
477 |
/**
|
|
478 |
* Test step 11:
|
|
479 |
* Test Cancel IOCTL
|
|
480 |
* @return - TVerdict code
|
|
481 |
*/
|
|
482 |
{
|
|
483 |
INFO_PRINTF1(_L("IOCTL Test step 11: Testing CancelIOCTL"));
|
|
484 |
// Configure and bind to a socket
|
|
485 |
SetupWapSocketL();
|
|
486 |
|
|
487 |
// Issue Ioctl for getting the length of the message
|
|
488 |
TRequestStatus ioctlStatus;
|
|
489 |
TPckgBuf<TInt> length;
|
|
490 |
|
|
491 |
INFO_PRINTF1(_L("Issue of IOCTL for GetLength"));
|
|
492 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
493 |
|
|
494 |
// Issue Cancel Ioctl
|
|
495 |
INFO_PRINTF1(_L("Issue of cancel IOCTL for GetLength"));
|
|
496 |
iSocket.CancelIoctl();
|
|
497 |
TESTCHECK(ioctlStatus.Int(), KErrCancel, "Check if the outstanding IOCTL has been canceled");
|
|
498 |
|
|
499 |
iSocket.Close();
|
|
500 |
return TestStepResult();
|
|
501 |
}
|
|
502 |
|
|
503 |
TVerdict CIoctlStep_12::doTestStepL()
|
|
504 |
/**
|
|
505 |
* Test step 12:
|
|
506 |
* Test issue IOCTL without SetOption NewStyleClient
|
|
507 |
* @return - TVerdict code
|
|
508 |
*/
|
|
509 |
{
|
|
510 |
INFO_PRINTF1(_L("IOCTL Test step 12: Test issue IOCTL without SetOption NewStyleClient"));
|
|
511 |
// Configure and bind to a socket, do not set the "new style client" option
|
|
512 |
SetupWapSocketL(iSocket, iWapAddr, KWapPort, EFalse);
|
|
513 |
|
|
514 |
// Issue Ioctl for getting the length of the message (should fail)
|
|
515 |
TRequestStatus ioctlStatus;
|
|
516 |
TPckgBuf<TInt> length;
|
|
517 |
|
|
518 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
519 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
520 |
TESTCHECKCONDITION(ioctlStatus.Int()!=KErrNone, "Getting the length of the incoming message");
|
|
521 |
|
|
522 |
iSocket.Close();
|
|
523 |
return TestStepResult();
|
|
524 |
}
|
|
525 |
|
|
526 |
TVerdict CIoctlStep_13::doTestStepL()
|
|
527 |
/**
|
|
528 |
* Test step two:
|
|
529 |
* Sends/receives a 8-Bit calendar entry using IOCTL(two segments)
|
|
530 |
* @return - TVerdict code
|
|
531 |
*/
|
|
532 |
{
|
|
533 |
INFO_PRINTF1(_L("IOCTL Test step 13: send/receive a 8-Bit VCal"));
|
|
534 |
// Configure and bind to a socket
|
|
535 |
SetupWapSocketL();
|
|
536 |
|
|
537 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionNameDCS,KWapSmsOptionLevel,EWapSms8BitDCS));
|
|
538 |
|
|
539 |
// Issue Ioctl for getting the length of the message
|
|
540 |
TRequestStatus ioctlStatus;
|
|
541 |
TPckgBuf<TInt> length;
|
|
542 |
|
|
543 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
544 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
545 |
|
|
546 |
// Send a calendar entry
|
|
547 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
548 |
SendWapMessage(testData);
|
|
549 |
|
|
550 |
// Get the size of the incoming message
|
|
551 |
User::WaitForRequest(ioctlStatus);
|
|
552 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the incoming message");
|
|
553 |
TESTCHECK(length(), testData.Length(), "Check if reported length is correct");
|
|
554 |
|
|
555 |
ReceiveWapMessageFromSocket(length(), testData);
|
|
556 |
|
|
557 |
iSocket.Close();
|
|
558 |
return TestStepResult();
|
|
559 |
}
|
|
560 |
|
|
561 |
TVerdict CIoctlStep_14::doTestStepL()
|
|
562 |
/**
|
|
563 |
* Test step 14:
|
|
564 |
* simulating client crash conditions with 8bit calendar entry
|
|
565 |
* @return - TVerdict code
|
|
566 |
*/
|
|
567 |
{
|
|
568 |
INFO_PRINTF1(_L("IOCTL Test step 14: client crash condition 8-Bit calendar entry "));
|
|
569 |
// Configure and bind to a socket
|
|
570 |
SetupWapSocketL();
|
|
571 |
|
|
572 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionNameDCS,KWapSmsOptionLevel,EWapSms8BitDCS));
|
|
573 |
|
|
574 |
//
|
|
575 |
// Issue Ioctl for getting the length of the message
|
|
576 |
//
|
|
577 |
TRequestStatus ioctlStatus;
|
|
578 |
TPckgBuf<TInt> length;
|
|
579 |
|
|
580 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
581 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
582 |
|
|
583 |
// Send a Calendar entry
|
|
584 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
585 |
SendWapMessage(testData);
|
|
586 |
|
|
587 |
// Get the size of the incoming message
|
|
588 |
User::WaitForRequest(ioctlStatus);
|
|
589 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the incoming message");
|
|
590 |
TESTCHECK(length(), testData.Length(), "Check if reported length is correct");
|
|
591 |
|
|
592 |
// Receive a message
|
|
593 |
TRequestStatus recvStatus;
|
|
594 |
TWapAddr recvWapAddr;
|
|
595 |
HBufC8* recvBuf = HBufC8::NewLC(length());
|
|
596 |
TPtr8 recvPtr = recvBuf->Des();
|
|
597 |
|
|
598 |
iSocket.RecvFrom(recvPtr, recvWapAddr, 0, recvStatus);
|
|
599 |
User::WaitForRequest(recvStatus);
|
|
600 |
TESTCHECKL(recvStatus.Int(), KErrNone, "Receiving a message");
|
|
601 |
|
|
602 |
// Simulate a crash by closing and reopening the socket
|
|
603 |
iSocket.Close();
|
|
604 |
INFO_PRINTF1(_L("Socket was closed..."));
|
|
605 |
|
|
606 |
OpenSocketL(iSocketServer, iSocket);
|
|
607 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0));
|
|
608 |
INFO_PRINTF1(_L("Socket set option for indicating new client"));
|
|
609 |
User::LeaveIfError(iSocket.Bind(iWapAddr));
|
|
610 |
INFO_PRINTF1(_L("Socket was opened..."));
|
|
611 |
|
|
612 |
// Issue another get length of datagram as if not aware of the previous message
|
|
613 |
// and retrieve the message from the SAR store
|
|
614 |
ReceiveWapMessage(testData);
|
|
615 |
|
|
616 |
iSocket.Close();
|
|
617 |
CleanupStack::PopAndDestroy(recvBuf);
|
|
618 |
return TestStepResult();
|
|
619 |
}
|
|
620 |
|
|
621 |
TVerdict CIoctlStep_15::doTestStepL()
|
|
622 |
/**
|
|
623 |
* Test step fifteen:
|
|
624 |
* Receives a 7Bit v-card using IOCTL with concatenation for new style client
|
|
625 |
* @return - TVerdict code
|
|
626 |
*/
|
|
627 |
{
|
|
628 |
INFO_PRINTF1(_L("IOCTL Test step 15: send/receive 7-Bit v-card"));
|
|
629 |
// Configure and bind to a socket
|
|
630 |
SetupWapSocketL();
|
|
631 |
|
|
632 |
//
|
|
633 |
// Issue Ioctl for getting the length of the message
|
|
634 |
//
|
|
635 |
TRequestStatus ioctlStatus;
|
|
636 |
TPckgBuf<TInt> length;
|
|
637 |
|
|
638 |
INFO_PRINTF1(_L("Issue of IOCTL for GetLength"));
|
|
639 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
640 |
|
|
641 |
//
|
|
642 |
// Get the size of the first incoming message
|
|
643 |
//
|
|
644 |
User::WaitForRequest(ioctlStatus);
|
|
645 |
User::LeaveIfError(ioctlStatus.Int());
|
|
646 |
INFO_PRINTF1(_L("IOCTL completed"));
|
|
647 |
|
|
648 |
//
|
|
649 |
// Receiving a datagram that is 7bit with a concatenated length of > 160 characters
|
|
650 |
//
|
|
651 |
TRequestStatus recvStatus;
|
|
652 |
TWapAddr recvWapAddr;
|
|
653 |
TBuf8<360> recvBuf(length);
|
|
654 |
|
|
655 |
iSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
656 |
User::WaitForRequest(recvStatus);
|
|
657 |
User::LeaveIfError(recvStatus.Int());
|
|
658 |
INFO_PRINTF1(_L("Received the message..."));
|
|
659 |
|
|
660 |
//
|
|
661 |
// Confirm the receipt of the message to the client
|
|
662 |
//
|
|
663 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
664 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
665 |
|
|
666 |
iSocket.Close();
|
|
667 |
return TestStepResult();
|
|
668 |
}
|
|
669 |
|
|
670 |
TInt CBackupRestoreStep::SendWapL()
|
|
671 |
{
|
|
672 |
//modified from test 10
|
|
673 |
INFO_PRINTF1(_L("SendWapL: send 7-Bit business card using IOCTL"));
|
|
674 |
|
|
675 |
TInt ret = KErrNone;
|
|
676 |
|
|
677 |
TPtrC16 TelNumber;
|
|
678 |
TInt port=226;
|
|
679 |
|
|
680 |
if(!GetStringFromConfig(ConfigSection(),KSCNumber,TelNumber) ||
|
|
681 |
!GetIntFromConfig(ConfigSection(),KWapPort,port)
|
|
682 |
)
|
|
683 |
{
|
|
684 |
// Leave if there's any error.
|
|
685 |
User::Leave(KErrNotFound);
|
|
686 |
}
|
|
687 |
|
|
688 |
//
|
|
689 |
// Setting the port number and service center number of the wap address
|
|
690 |
// The service center number should be the same as the sim phone number used
|
|
691 |
// for test (not required for SIM tsy)
|
|
692 |
//
|
|
693 |
TWapAddr wapAddr;
|
|
694 |
wapAddr.SetWapPort(TWapPortNumber(port));
|
|
695 |
|
|
696 |
TBuf8<100> scNumber;
|
|
697 |
scNumber.Copy(TelNumber);
|
|
698 |
TPtrC8 scAddr(scNumber);
|
|
699 |
wapAddr.SetWapAddress(scAddr);
|
|
700 |
|
|
701 |
//
|
|
702 |
// Define and open the socket
|
|
703 |
//
|
|
704 |
RSocket sock;
|
|
705 |
ret = sock.Open(iSocketServer,KWAPSMSAddrFamily,KSockDatagram,KWAPSMSDatagramProtocol);
|
|
706 |
if (ret != KErrNone)
|
|
707 |
{
|
|
708 |
//
|
|
709 |
// PREQ399 changes mean that -1 is sometimes now returned from Open() when
|
|
710 |
// a Backup and Restore session is in progress (DEF114381).
|
|
711 |
//
|
|
712 |
INFO_PRINTF2(_L("Socket could not be opened (error %d)..."), ret);
|
|
713 |
|
|
714 |
return ret;
|
|
715 |
}
|
|
716 |
CleanupClosePushL(sock);
|
|
717 |
|
|
718 |
TRequestStatus status;
|
|
719 |
|
|
720 |
//
|
|
721 |
// Indicating to the protocol that it's a new client
|
|
722 |
//
|
|
723 |
INFO_PRINTF1(_L("Socket set option for indicating new client"));
|
|
724 |
User::LeaveIfError(sock.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0));
|
|
725 |
//
|
|
726 |
// Bind
|
|
727 |
//
|
|
728 |
User::LeaveIfError(sock.Bind(wapAddr));
|
|
729 |
|
|
730 |
TTimeIntervalMicroSeconds32 InitPause=9000000; //Pause to Allow SMSStack to Complete its Async Init
|
|
731 |
User::After(InitPause); //call to the TSY and finish its StartUp.
|
|
732 |
|
|
733 |
//
|
|
734 |
// Send a calendar entry
|
|
735 |
//
|
|
736 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
737 |
TBuf8<200> data;
|
|
738 |
data.Copy(testData);
|
|
739 |
sock.SendTo(data, wapAddr, 0, status);
|
|
740 |
User::WaitForRequest(status);
|
|
741 |
ret = status.Int();
|
|
742 |
|
|
743 |
if(ret == KErrNone)
|
|
744 |
{
|
|
745 |
INFO_PRINTF1(_L("Message sent..."));
|
|
746 |
}
|
|
747 |
else
|
|
748 |
{
|
|
749 |
INFO_PRINTF2(_L("Message NOT sent (error %d)..."), ret);
|
|
750 |
}
|
|
751 |
|
|
752 |
CleanupStack::PopAndDestroy(&sock);
|
|
753 |
return ret;
|
|
754 |
}
|
|
755 |
|
|
756 |
TBool CBackupRestoreStep::IsWapFileOpenL()
|
|
757 |
{
|
|
758 |
TBool ret = ETrue; //assume the file was open
|
|
759 |
RFs fsSession;
|
|
760 |
User::LeaveIfError(fsSession.Connect());
|
|
761 |
CleanupClosePushL(fsSession);
|
|
762 |
|
|
763 |
CFileMan* fileManager = CFileMan::NewL(fsSession);
|
|
764 |
CleanupStack::PushL(fileManager);
|
|
765 |
|
|
766 |
_LIT(KWapFile,"C:\\Private\\101F7989\\sms\\wapreast.dat");
|
|
767 |
_LIT(KWapFileBackup,"C:\\Private\\101f7989\\sms\\wapreast.backup");
|
|
768 |
|
|
769 |
TEntry entry;
|
|
770 |
if (fsSession.Entry(KWapFile,entry)==KErrNone) // File found
|
|
771 |
{
|
|
772 |
TInt moveStatus = fileManager->Move(KWapFile,KWapFileBackup);
|
|
773 |
TESTL(moveStatus == KErrNone || moveStatus == KErrInUse);
|
|
774 |
|
|
775 |
// If the move was successful, the file is not opened
|
|
776 |
// If the move failed with KErrInUse the file is opened
|
|
777 |
if (moveStatus == KErrNone)
|
|
778 |
{
|
|
779 |
// move it back
|
|
780 |
TEST(fileManager->Move(KWapFileBackup,KWapFile) == KErrNone);
|
|
781 |
ret = EFalse;
|
|
782 |
}
|
|
783 |
else // moveStatus == KErrInUse
|
|
784 |
{
|
|
785 |
ret = ETrue;
|
|
786 |
}
|
|
787 |
}
|
|
788 |
else
|
|
789 |
{
|
|
790 |
//file not found so it couldn't be open
|
|
791 |
ret = EFalse;
|
|
792 |
}
|
|
793 |
|
|
794 |
CleanupStack::PopAndDestroy(fileManager);
|
|
795 |
CleanupStack::PopAndDestroy(&fsSession);
|
|
796 |
|
|
797 |
if(ret)
|
|
798 |
INFO_PRINTF1(_L("Wapfile open..."));
|
|
799 |
else
|
|
800 |
INFO_PRINTF1(_L("Wapfile closed..."));
|
|
801 |
|
|
802 |
return ret;
|
|
803 |
}
|
|
804 |
|
|
805 |
TVerdict CBackupRestoreStep::doTestStepL()
|
|
806 |
/**
|
|
807 |
* Test step 16:
|
|
808 |
* simulating backup and restore
|
|
809 |
* @return - TVerdict code
|
|
810 |
*/
|
|
811 |
{
|
|
812 |
INFO_PRINTF1(_L("IOCTL Test step 16: send 7-Bit business card using IOCTL to test backup and restore"));
|
|
813 |
CSBEClient* secureBackupEngine = CSBEClient::NewL();
|
|
814 |
CleanupStack::PushL(secureBackupEngine);
|
|
815 |
secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
|
|
816 |
EBURNormal, ENoBackup);
|
|
817 |
|
|
818 |
INFO_PRINTF1(_L("Expecting SendWapL to succeed and the wap data file to be open"));
|
|
819 |
TEST(SendWapL() == KErrNone);
|
|
820 |
TEST(IsWapFileOpenL() != EFalse);
|
|
821 |
|
|
822 |
// Notify the WAPPROT server that a backup is about to take place and
|
|
823 |
// that the server should close the wapstor
|
|
824 |
INFO_PRINTF1(_L("Simulating a backup notification"));
|
|
825 |
secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
|
|
826 |
EBURBackupFull, EBackupBase);
|
|
827 |
|
|
828 |
INFO_PRINTF1(_L("Expecting SendWapL to fail and the wap data file to be closed"));
|
|
829 |
TEST(SendWapL() != KErrNone);
|
|
830 |
TEST(IsWapFileOpenL() == EFalse);
|
|
831 |
|
|
832 |
// Notify the WAPPROT server that a backup has completed
|
|
833 |
// that the server should open the wapstor
|
|
834 |
INFO_PRINTF1(_L("Simulating a backup complete notification"));
|
|
835 |
secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
|
|
836 |
EBURNormal, ENoBackup);
|
|
837 |
|
|
838 |
INFO_PRINTF1(_L("Expecting SendWapL to succeed and the wap data file to be open"));
|
|
839 |
TEST(SendWapL() == KErrNone);
|
|
840 |
TEST(IsWapFileOpenL() != EFalse);
|
|
841 |
|
|
842 |
// Notify the WAPPROT server that a restore is about to take place and
|
|
843 |
// that the server should close the wapstor
|
|
844 |
INFO_PRINTF1(_L("Simulating a restore notification"));
|
|
845 |
secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
|
|
846 |
EBURRestorePartial, EBackupIncrement);
|
|
847 |
|
|
848 |
INFO_PRINTF1(_L("Expecting SendWapL to fail and the wap data file to be closed"));
|
|
849 |
TEST(SendWapL() != KErrNone);
|
|
850 |
TEST(IsWapFileOpenL() == EFalse);
|
|
851 |
|
|
852 |
// Notify the WAPPROT server that a restore has completed
|
|
853 |
// that the server should open the wapstor
|
|
854 |
INFO_PRINTF1(_L("Simulating a restore complete notification"));
|
|
855 |
secureBackupEngine->SetBURModeL(TDriveList(_L8("C")),
|
|
856 |
EBURNormal, ENoBackup);
|
|
857 |
|
|
858 |
INFO_PRINTF1(_L("Expecting SendWapL to succeed and the wap data file to be open"));
|
|
859 |
TEST(SendWapL() == KErrNone);
|
|
860 |
TEST(IsWapFileOpenL() != EFalse);
|
|
861 |
|
|
862 |
CleanupStack::PopAndDestroy(secureBackupEngine); // testNumberProperty, secureBackupEngine
|
|
863 |
return TestStepResult();
|
|
864 |
}
|
|
865 |
|
|
866 |
TVerdict CIoctlStep_17::doTestStepL()
|
|
867 |
/**
|
|
868 |
* Test step seventeen:
|
|
869 |
* Sends a 7_Bit business card. Using IOCTL query SMS transport parameters
|
|
870 |
* @return - TVerdict code
|
|
871 |
*/
|
|
872 |
{
|
|
873 |
INFO_PRINTF1(_L("IOCTL Test step 17: send 7-Bit v-card and query SMS transport parameters"));
|
|
874 |
// Configure and bind to a socket
|
|
875 |
SetupWapSocketL();
|
|
876 |
|
|
877 |
// Send a business card
|
|
878 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
879 |
SendWapMessage(testData);
|
|
880 |
|
|
881 |
// Create a descriptor with correct size for obtaining the message parameter
|
|
882 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
883 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
884 |
|
|
885 |
// Get the message parameter value
|
|
886 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
887 |
|
|
888 |
// Internalise the message parameter and check
|
|
889 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
890 |
|
|
891 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
892 |
|
|
893 |
iSocket.Close();
|
|
894 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
895 |
return TestStepResult();
|
|
896 |
}
|
|
897 |
|
|
898 |
TVerdict CIoctlStep_18::doTestStepL()
|
|
899 |
/**
|
|
900 |
* Test step eighteen:
|
|
901 |
* Sends a 7-Bit calendar entry (two segments). Using IOCTL query SMS transport parameters.
|
|
902 |
* @return - TVerdict code
|
|
903 |
*/
|
|
904 |
{
|
|
905 |
INFO_PRINTF1(_L("IOCTL Test step 18: Sends a 7-Bit calendar entry (two segments). Using IOCTL query SMS transport parameters."));
|
|
906 |
// Configure and bind to a socket
|
|
907 |
SetupWapSocketL();
|
|
908 |
|
|
909 |
// Send a calendar entry
|
|
910 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
911 |
SendWapMessage(testData);
|
|
912 |
|
|
913 |
// Create a descriptor with correct size for obtaining the message parameter
|
|
914 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
915 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
916 |
|
|
917 |
// Get the message parameter value
|
|
918 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
919 |
|
|
920 |
// Internalise the message parameter and check
|
|
921 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
922 |
|
|
923 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
924 |
|
|
925 |
iSocket.Close();
|
|
926 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
927 |
return TestStepResult();
|
|
928 |
}
|
|
929 |
|
|
930 |
TVerdict CIoctlStep_19::doTestStepL()
|
|
931 |
/**
|
|
932 |
* Test step 19:
|
|
933 |
* send/receive one 7-Bit two segments message and one 7-Bit one segment message
|
|
934 |
* @return - TVerdict code
|
|
935 |
*/
|
|
936 |
{
|
|
937 |
INFO_PRINTF1(_L("IOCTL Test step 19: send/receive two 7-Bit messages"));
|
|
938 |
// Configure and bind to a socket
|
|
939 |
SetupWapSocketL();
|
|
940 |
|
|
941 |
//
|
|
942 |
// Issue Ioctl for getting the length of the message
|
|
943 |
//
|
|
944 |
TRequestStatus ioctlStatus;
|
|
945 |
TPckgBuf<TInt> length;
|
|
946 |
|
|
947 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the first message..."));
|
|
948 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
949 |
|
|
950 |
TPtrC testData1 = GetStringFromConfigL(KTestData1);
|
|
951 |
TPtrC testData2 = GetStringFromConfigL(KTestData2);
|
|
952 |
|
|
953 |
// Send a calendar entry
|
|
954 |
SendWapMessage(testData2);
|
|
955 |
|
|
956 |
// Send a business card
|
|
957 |
SendWapMessage(testData1);
|
|
958 |
|
|
959 |
// Get the size of the first incoming message
|
|
960 |
User::WaitForRequest(ioctlStatus);
|
|
961 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
962 |
|
|
963 |
// Get the first message parameter value
|
|
964 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
965 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
966 |
|
|
967 |
INFO_PRINTF1(_L("Getting parameter value of first message..."));
|
|
968 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
969 |
|
|
970 |
// Internalise the first message parameter and check
|
|
971 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
972 |
|
|
973 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
974 |
|
|
975 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
976 |
|
|
977 |
// Receiving a datagram
|
|
978 |
TRequestStatus recvStatus;
|
|
979 |
TWapAddr recvWapAddr;
|
|
980 |
TBuf8<256> recvBuf2(length);
|
|
981 |
|
|
982 |
iSocket.RecvFrom(recvBuf2,recvWapAddr,0,recvStatus);
|
|
983 |
User::WaitForRequest(recvStatus);
|
|
984 |
TESTL(recvStatus.Int()==KErrNone);
|
|
985 |
INFO_PRINTF1(_L("Received the first message..."));
|
|
986 |
|
|
987 |
// Confirm the receipt of the message to the client
|
|
988 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
989 |
TESTL(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0)==KErrNone);
|
|
990 |
|
|
991 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the second message..."));
|
|
992 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
993 |
|
|
994 |
// Get the size of the SECOND incoming message
|
|
995 |
User::WaitForRequest(ioctlStatus);
|
|
996 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
997 |
TESTCHECK(length(), testData1.Length(), "Check if reported length is correct");
|
|
998 |
|
|
999 |
// Create a descriptor with correct size for obtaining the second message parameter
|
|
1000 |
HBufC8* parameterStore2 = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1001 |
TPtr8 parameterStorePtr2 = parameterStore2->Des();
|
|
1002 |
|
|
1003 |
// Get the second message parameter value
|
|
1004 |
INFO_PRINTF1(_L("Getting parameter value of second message..."));
|
|
1005 |
GetMessageParameterL(iSocket, parameterStorePtr2);
|
|
1006 |
|
|
1007 |
// Internalise the second message parameter and check
|
|
1008 |
InternaliseSmsDataAndCheckL(parameterStorePtr2, scAddr);
|
|
1009 |
|
|
1010 |
CleanupStack::PopAndDestroy(parameterStore2);
|
|
1011 |
|
|
1012 |
// Receiving the second message
|
|
1013 |
ReceiveWapMessageFromSocket(length(), testData1);
|
|
1014 |
|
|
1015 |
iSocket.Close();
|
|
1016 |
return TestStepResult();
|
|
1017 |
}
|
|
1018 |
|
|
1019 |
TVerdict CIoctlStep_20::doTestStepL()
|
|
1020 |
/**
|
|
1021 |
* Test step 20:
|
|
1022 |
* simulating client crash conditions with 7bit message
|
|
1023 |
* @return - TVerdict code
|
|
1024 |
*/
|
|
1025 |
{
|
|
1026 |
INFO_PRINTF1(_L("IOCTL Test step 20: client crash condition 7-Bit message "));
|
|
1027 |
// Configure and bind to a socket
|
|
1028 |
SetupWapSocketL();
|
|
1029 |
|
|
1030 |
// Issue Ioctl for getting the length of the message
|
|
1031 |
TRequestStatus ioctlStatus;
|
|
1032 |
TPckgBuf<TInt> length;
|
|
1033 |
|
|
1034 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
1035 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1036 |
|
|
1037 |
// Send a business card
|
|
1038 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
1039 |
SendWapMessage(testData);
|
|
1040 |
|
|
1041 |
// Get the size of the incoming message
|
|
1042 |
User::WaitForRequest(ioctlStatus);
|
|
1043 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
1044 |
TESTCHECK(length(), testData.Length(), "Check if reported length is correct");
|
|
1045 |
|
|
1046 |
// Create a descriptor with correct size for obtaining the message parameter
|
|
1047 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1048 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
1049 |
|
|
1050 |
// Get the message parameter value
|
|
1051 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
1052 |
|
|
1053 |
// Internalise the message parameter and check
|
|
1054 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
1055 |
|
|
1056 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
1057 |
|
|
1058 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
1059 |
|
|
1060 |
// Receive a message
|
|
1061 |
TRequestStatus recvStatus;
|
|
1062 |
TWapAddr recvWapAddr;
|
|
1063 |
HBufC8* recvBuf = HBufC8::NewLC(length());
|
|
1064 |
TPtr8 recvPtr = recvBuf->Des();
|
|
1065 |
|
|
1066 |
iSocket.RecvFrom(recvPtr, recvWapAddr, 0, recvStatus);
|
|
1067 |
User::WaitForRequest(recvStatus);
|
|
1068 |
TESTCHECKL(recvStatus.Int(), KErrNone, "Receiving a message");
|
|
1069 |
|
|
1070 |
// Simulate a crash by closing and reopening the socket
|
|
1071 |
iSocket.Close();
|
|
1072 |
INFO_PRINTF1(_L("Socket was closed..."));
|
|
1073 |
|
|
1074 |
OpenSocketL(iSocketServer, iSocket);
|
|
1075 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0));
|
|
1076 |
INFO_PRINTF1(_L("Socket set option for indicating new client"));
|
|
1077 |
User::LeaveIfError(iSocket.Bind(iWapAddr));
|
|
1078 |
INFO_PRINTF1(_L("Socket was opened..."));
|
|
1079 |
|
|
1080 |
// Issue another get length of datagram as if not aware of the previous message
|
|
1081 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
1082 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1083 |
|
|
1084 |
// Get the size of the incoming message
|
|
1085 |
User::WaitForRequest(ioctlStatus);
|
|
1086 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
1087 |
TESTCHECK(length(), testData.Length(), "Check if reported length is correct");
|
|
1088 |
|
|
1089 |
// Recreate a descriptor with correct size for obtaining the message parameter
|
|
1090 |
HBufC8* parameterStore2 = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1091 |
TPtr8 parameterStorePtr2 = parameterStore2->Des();
|
|
1092 |
|
|
1093 |
// Get the message parameter value
|
|
1094 |
GetMessageParameterL(iSocket, parameterStorePtr2);
|
|
1095 |
|
|
1096 |
// Internalise the message parameter and check
|
|
1097 |
InternaliseSmsDataAndCheckL(parameterStorePtr2, scAddr);
|
|
1098 |
|
|
1099 |
CleanupStack::PopAndDestroy(parameterStore2);
|
|
1100 |
|
|
1101 |
// New message retrieved from SAR store
|
|
1102 |
ReceiveWapMessageFromSocket(length(), testData);
|
|
1103 |
|
|
1104 |
iSocket.Close();
|
|
1105 |
CleanupStack::PopAndDestroy(recvBuf);
|
|
1106 |
return TestStepResult();
|
|
1107 |
}
|
|
1108 |
|
|
1109 |
TVerdict CIoctlStep_21::doTestStepL()
|
|
1110 |
/**
|
|
1111 |
* Test step 21:
|
|
1112 |
* simulating client crash conditions with 8bit push message
|
|
1113 |
* @return - TVerdict code
|
|
1114 |
*/
|
|
1115 |
{
|
|
1116 |
INFO_PRINTF1(_L("IOCTL Test step 21: client crash condition with 8Bit push message"));
|
|
1117 |
// Configure and bind to a socket
|
|
1118 |
SetupWapSocketL();
|
|
1119 |
|
|
1120 |
// Issue Ioctl for getting the length of the message
|
|
1121 |
TRequestStatus ioctlStatus;
|
|
1122 |
TPckgBuf<TInt> length;
|
|
1123 |
|
|
1124 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
1125 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1126 |
|
|
1127 |
// Get the size of the incoming message
|
|
1128 |
User::WaitForRequest(ioctlStatus);
|
|
1129 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
1130 |
|
|
1131 |
// Create a descriptor with correct size for obtaining the message parameter
|
|
1132 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1133 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
1134 |
|
|
1135 |
// Get the message parameter value
|
|
1136 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
1137 |
|
|
1138 |
// Internalise the message parameter and check
|
|
1139 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
1140 |
|
|
1141 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
1142 |
|
|
1143 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
1144 |
|
|
1145 |
// Receiving a datagram
|
|
1146 |
TRequestStatus recvStatus;
|
|
1147 |
TWapAddr recvWapAddr;
|
|
1148 |
TBuf8<256> recvBuf(length);
|
|
1149 |
|
|
1150 |
iSocket.RecvFrom(recvBuf, recvWapAddr, 0, recvStatus);
|
|
1151 |
User::WaitForRequest(recvStatus);
|
|
1152 |
TESTL(recvStatus.Int()==KErrNone);
|
|
1153 |
INFO_PRINTF1(_L("Received the message..."));
|
|
1154 |
|
|
1155 |
// Simulate a crash by closing and reopening the socket
|
|
1156 |
iSocket.Close();
|
|
1157 |
INFO_PRINTF1(_L("Socket was closed..."));
|
|
1158 |
|
|
1159 |
OpenSocketL(iSocketServer, iSocket);
|
|
1160 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0));
|
|
1161 |
INFO_PRINTF1(_L("Socket set option for indicating new client"));
|
|
1162 |
User::LeaveIfError(iSocket.Bind(iWapAddr));
|
|
1163 |
INFO_PRINTF1(_L("Socket was opened..."));
|
|
1164 |
|
|
1165 |
// Issue another get length of datagram as if not aware of the previous message
|
|
1166 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
1167 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1168 |
|
|
1169 |
// Get the size of the incoming message
|
|
1170 |
User::WaitForRequest(ioctlStatus);
|
|
1171 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
1172 |
|
|
1173 |
// Recreate a descriptor with correct size for obtaining the message parameter
|
|
1174 |
HBufC8* parameterStore2 = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1175 |
TPtr8 parameterStorePtr2 = parameterStore2->Des();
|
|
1176 |
|
|
1177 |
// Get the message parameter value
|
|
1178 |
GetMessageParameterL(iSocket, parameterStorePtr2);
|
|
1179 |
|
|
1180 |
// Internalise the message parameter and check
|
|
1181 |
InternaliseSmsDataAndCheckL(parameterStorePtr2, scAddr);
|
|
1182 |
|
|
1183 |
CleanupStack::PopAndDestroy(parameterStore2);
|
|
1184 |
|
|
1185 |
// New message retrieved from SAR store
|
|
1186 |
TBuf8<256> newRecvBuf(length);
|
|
1187 |
iSocket.RecvFrom(newRecvBuf,recvWapAddr,0,recvStatus);
|
|
1188 |
User::WaitForRequest(recvStatus);
|
|
1189 |
TESTL(recvStatus.Int()==KErrNone);
|
|
1190 |
INFO_PRINTF1(_L("Received the message..."));
|
|
1191 |
|
|
1192 |
// Confirm the receipt of the message to the client
|
|
1193 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
1194 |
TESTL(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0)==KErrNone);
|
|
1195 |
|
|
1196 |
// Compare the received message with the previous one
|
|
1197 |
// They should be identical
|
|
1198 |
TESTL(newRecvBuf.Compare(recvBuf)==0);
|
|
1199 |
|
|
1200 |
iSocket.Close();
|
|
1201 |
return TestStepResult();
|
|
1202 |
}
|
|
1203 |
|
|
1204 |
TVerdict CIoctlStep_22::doTestStepL()
|
|
1205 |
/**
|
|
1206 |
* Test step 22:
|
|
1207 |
* Push Message (8-Bit). Using IOCTL query SMS transport parameters
|
|
1208 |
* @return - TVerdict code
|
|
1209 |
*/
|
|
1210 |
{
|
|
1211 |
INFO_PRINTF1(_L("IOCTL Test step 22: Push Message (8-Bit) and query SMS transport parameters"));
|
|
1212 |
// Configure and bind to a socket
|
|
1213 |
SetupWapSocketL();
|
|
1214 |
|
|
1215 |
// Create a descriptor with correct size for obtaining the message parameter
|
|
1216 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1217 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
1218 |
|
|
1219 |
// Get the message parameter value
|
|
1220 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
1221 |
|
|
1222 |
// Internalise the message parameter and check
|
|
1223 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
1224 |
|
|
1225 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
1226 |
|
|
1227 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
1228 |
|
|
1229 |
iSocket.Close();
|
|
1230 |
return TestStepResult();
|
|
1231 |
}
|
|
1232 |
|
|
1233 |
TVerdict CIoctlStep_23::doTestStepL()
|
|
1234 |
/**
|
|
1235 |
* Test step 23:
|
|
1236 |
* Two Push Messages (8-Bit). Using IOCTL query SMS transport parameters
|
|
1237 |
* @return - TVerdict code
|
|
1238 |
*/
|
|
1239 |
{
|
|
1240 |
INFO_PRINTF1(_L("IOCTL Test step 23: Push two push message(8-Bit) query transport parameters"));
|
|
1241 |
// Configure and bind to a socket
|
|
1242 |
SetupWapSocketL();
|
|
1243 |
|
|
1244 |
// Issue Ioctl for getting the length of the message
|
|
1245 |
TRequestStatus ioctlStatus;
|
|
1246 |
TPckgBuf<TInt> length;
|
|
1247 |
|
|
1248 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
1249 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1250 |
|
|
1251 |
// Get the size of the incoming message
|
|
1252 |
User::WaitForRequest(ioctlStatus);
|
|
1253 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
1254 |
|
|
1255 |
INFO_PRINTF1(_L("Getting parameter value of first message..."));
|
|
1256 |
|
|
1257 |
// Create a descriptor with correct size for obtaining the first message parameter
|
|
1258 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1259 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
1260 |
|
|
1261 |
// Get the first message parameter value
|
|
1262 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
1263 |
|
|
1264 |
// Internalise the first message parameter and check
|
|
1265 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
1266 |
|
|
1267 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
1268 |
|
|
1269 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
1270 |
|
|
1271 |
// Receiving push datagram
|
|
1272 |
TRequestStatus recvStatus;
|
|
1273 |
TWapAddr recvWapAddr;
|
|
1274 |
TBuf8<256> recvBuf1(length);
|
|
1275 |
|
|
1276 |
iSocket.RecvFrom(recvBuf1,recvWapAddr,0,recvStatus);
|
|
1277 |
User::WaitForRequest(recvStatus);
|
|
1278 |
TESTL(recvStatus.Int()==KErrNone);
|
|
1279 |
INFO_PRINTF1(_L("Received the push message..."));
|
|
1280 |
|
|
1281 |
// Confirm the receipt of the message to the client
|
|
1282 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
1283 |
TESTL(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0)==KErrNone);
|
|
1284 |
|
|
1285 |
INFO_PRINTF1(_L("Issuing IOCTL for getting the length of the message..."));
|
|
1286 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1287 |
|
|
1288 |
// Get the size of the second incoming push message
|
|
1289 |
User::WaitForRequest(ioctlStatus);
|
|
1290 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the size of the first incoming message");
|
|
1291 |
|
|
1292 |
INFO_PRINTF1(_L("Getting parameter value of second message..."));
|
|
1293 |
|
|
1294 |
// Create a descriptor with correct size for obtaining the second message parameter
|
|
1295 |
HBufC8* parameterStore2 = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1296 |
TPtr8 parameterStorePtr2 = parameterStore2->Des();
|
|
1297 |
|
|
1298 |
// Get the second message parameter value
|
|
1299 |
GetMessageParameterL(iSocket, parameterStorePtr2);
|
|
1300 |
|
|
1301 |
// Internalise the second message parameter and check
|
|
1302 |
InternaliseSmsDataAndCheckL(parameterStorePtr2, scAddr);
|
|
1303 |
|
|
1304 |
CleanupStack::PopAndDestroy(parameterStore2);
|
|
1305 |
|
|
1306 |
// Receiving push datagram
|
|
1307 |
TBuf8<256> recvBuf2(length);
|
|
1308 |
|
|
1309 |
iSocket.RecvFrom(recvBuf2,recvWapAddr,0,recvStatus);
|
|
1310 |
User::WaitForRequest(recvStatus);
|
|
1311 |
TESTL(recvStatus.Int()==KErrNone);
|
|
1312 |
INFO_PRINTF1(_L("Received the second push message..."));
|
|
1313 |
|
|
1314 |
// Compare the received message with the previous one
|
|
1315 |
// They should be identical
|
|
1316 |
TESTL(recvBuf2.Compare(recvBuf1)==0);
|
|
1317 |
|
|
1318 |
// Confirm the receipt of the message to the client
|
|
1319 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
1320 |
TESTL(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0)==KErrNone);
|
|
1321 |
|
|
1322 |
iSocket.Close();
|
|
1323 |
return TestStepResult();
|
|
1324 |
}
|
|
1325 |
|
|
1326 |
TVerdict CIoctlStep_24::doTestStepL()
|
|
1327 |
/**
|
|
1328 |
* Test step 24:
|
|
1329 |
* Test Cancel IOCTL
|
|
1330 |
* @return - TVerdict code
|
|
1331 |
*/
|
|
1332 |
{
|
|
1333 |
INFO_PRINTF1(_L("IOCTL Test step 24: Testing Cancel IOCTL"));
|
|
1334 |
// Configure and bind to a socket
|
|
1335 |
SetupWapSocketL();
|
|
1336 |
|
|
1337 |
TRequestStatus ioctlStatus;
|
|
1338 |
TBuf8<200> smsdata;
|
|
1339 |
TPckgBuf<TInt> paramLength;
|
|
1340 |
|
|
1341 |
// Issue Ioctl for getting the length of the message parameter
|
|
1342 |
INFO_PRINTF1(_L("Issue of IOCTL for KSOGetMessageParametersLength"));
|
|
1343 |
iSocket.Ioctl(KSOGetMessageParametersLength, ioctlStatus, &smsdata, KSolWapProv);
|
|
1344 |
|
|
1345 |
// Issue Cancel Ioctl
|
|
1346 |
INFO_PRINTF1(_L("Issue of cancel IOCTL for KSOGetMessageParametersLength"));
|
|
1347 |
iSocket.CancelIoctl();
|
|
1348 |
TESTCHECKL(ioctlStatus.Int(), KErrCancel, "Checking if the outstanding IOCTL has been cancelled");
|
|
1349 |
|
|
1350 |
// Issue Ioctl for getting the message parameter
|
|
1351 |
INFO_PRINTF1(_L("Issue of IOCTL for KSOGetMessageParameters"));
|
|
1352 |
iSocket.Ioctl(KSOGetMessageParameters, ioctlStatus, &smsdata, KSolWapProv);
|
|
1353 |
|
|
1354 |
// Issue Cancel Ioctl
|
|
1355 |
INFO_PRINTF1(_L("Issue of cancel IOCTL for KSOGetMessageParameters"));
|
|
1356 |
iSocket.CancelIoctl();
|
|
1357 |
TESTCHECKL(ioctlStatus.Int(), KErrCancel, "Checking if the outstanding IOCTL has been cancelled");
|
|
1358 |
|
|
1359 |
iSocket.Close();
|
|
1360 |
return TestStepResult();
|
|
1361 |
}
|
|
1362 |
|
|
1363 |
TVerdict CIoctlStep_25::doTestStepL()
|
|
1364 |
/**
|
|
1365 |
* Test step 25:
|
|
1366 |
* Test issue IOCTL without SetOption NewStyleClient
|
|
1367 |
* @return - TVerdict code
|
|
1368 |
*/
|
|
1369 |
{
|
|
1370 |
INFO_PRINTF1(_L("IOCTL Test step 25: Test issue IOCTL without SetOption NewStyleClient"));
|
|
1371 |
// Configure and bind to a socket
|
|
1372 |
SetupWapSocketL(iSocket, iWapAddr, KWapPort, EFalse);
|
|
1373 |
|
|
1374 |
// Issue Ioctl for getting the length of the message parameter (should fail)
|
|
1375 |
TRequestStatus ioctlStatus;
|
|
1376 |
TPckgBuf<TInt> paramLength;
|
|
1377 |
|
|
1378 |
INFO_PRINTF1(_L("Issue of IOCTL for KSOGetMessageParametersLength"));
|
|
1379 |
iSocket.Ioctl(KSOGetMessageParametersLength, ioctlStatus, ¶mLength, KSolWapProv);
|
|
1380 |
TESTL(ioctlStatus.Int()!=KErrNone);
|
|
1381 |
|
|
1382 |
// Issue Ioctl for getting the message parameter (should fail)
|
|
1383 |
INFO_PRINTF1(_L("Issue of IOCTL for KSOGetMessageParameters"));
|
|
1384 |
TBuf8<200> smsdata;
|
|
1385 |
|
|
1386 |
iSocket.Ioctl(KSOGetMessageParameters, ioctlStatus, &smsdata, KSolWapProv);
|
|
1387 |
User::WaitForRequest(ioctlStatus);
|
|
1388 |
TESTL(ioctlStatus.Int()!=KErrNone);
|
|
1389 |
|
|
1390 |
iSocket.Close();
|
|
1391 |
return TestStepResult();
|
|
1392 |
}
|
|
1393 |
|
|
1394 |
TVerdict CIoctlStep_26::doTestStepL()
|
|
1395 |
/**
|
|
1396 |
* Test step 26:
|
|
1397 |
* Sends a 8-Bit calendar entry using IOCTL(two segments)
|
|
1398 |
* @return - TVerdict code
|
|
1399 |
*/
|
|
1400 |
{
|
|
1401 |
INFO_PRINTF1(_L("IOCTL Test step 26: send a 8-Bit VCal (two segments)"));
|
|
1402 |
// Configure and bind to a socket
|
|
1403 |
SetupWapSocketL();
|
|
1404 |
|
|
1405 |
TESTL(iSocket.SetOpt(KWapSmsOptionNameDCS,KWapSmsOptionLevel,EWapSms8BitDCS)==KErrNone);
|
|
1406 |
|
|
1407 |
// Send a calendar entry
|
|
1408 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
1409 |
SendWapMessage(testData);
|
|
1410 |
|
|
1411 |
// Create a descriptor with correct size for obtaining the message parameter
|
|
1412 |
HBufC8* parameterStore = HBufC8::NewLC(GetMessageParameterLengthL(iSocket));
|
|
1413 |
TPtr8 parameterStorePtr = parameterStore->Des();
|
|
1414 |
|
|
1415 |
// Get the message parameter value
|
|
1416 |
GetMessageParameterL(iSocket, parameterStorePtr);
|
|
1417 |
|
|
1418 |
// Internalise the message parameter and check
|
|
1419 |
TPtrC8 scAddr = iWapAddr.WapAddress();
|
|
1420 |
|
|
1421 |
InternaliseSmsDataAndCheckL(parameterStorePtr, scAddr);
|
|
1422 |
|
|
1423 |
CleanupStack::PopAndDestroy(parameterStore);
|
|
1424 |
|
|
1425 |
iSocket.Close();
|
|
1426 |
return TestStepResult();
|
|
1427 |
}
|
|
1428 |
|
|
1429 |
struct SOneOpTestThreadInfo
|
|
1430 |
{
|
|
1431 |
CIoctlStep_27* iTest;
|
|
1432 |
TPtrC* iTestData1;
|
|
1433 |
TPtrC16* iTelNumber;
|
|
1434 |
TInt iPort;
|
|
1435 |
};
|
|
1436 |
|
|
1437 |
TInt CIoctlStep_27::DoPanicTestL(TPtrC* aTestData1, TPtrC16* aTelNumber, TInt aPort)
|
|
1438 |
{
|
|
1439 |
TInt testNumber = 1;
|
|
1440 |
TInt port = aPort;
|
|
1441 |
TPtrC TestData1 = *aTestData1;
|
|
1442 |
TPtrC16 TelNumber = *aTelNumber;
|
|
1443 |
|
|
1444 |
User::LeaveIfError(RProperty::Set(KUidSystemCategory, KUidPhonePwr.iUid, ESAPhoneOn));
|
|
1445 |
User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testNumber));
|
|
1446 |
|
|
1447 |
//
|
|
1448 |
// Setting the port number and service center number of the wap address
|
|
1449 |
// The service center number should be the same as the sim phone number used
|
|
1450 |
// for test (not required for SIM tsy)
|
|
1451 |
//
|
|
1452 |
TWapAddr wapAddr;
|
|
1453 |
TWapAddr recvWapAddr;
|
|
1454 |
wapAddr.SetWapPort(TWapPortNumber(port));
|
|
1455 |
|
|
1456 |
TBuf8<100> scNumber;
|
|
1457 |
scNumber.Copy(TelNumber);
|
|
1458 |
TPtrC8 scAddr(scNumber);
|
|
1459 |
wapAddr.SetWapAddress(scAddr);
|
|
1460 |
|
|
1461 |
//
|
|
1462 |
// Connect to socket server
|
|
1463 |
//
|
|
1464 |
RSocketServ socketServer;
|
|
1465 |
User::LeaveIfError(socketServer.Connect());
|
|
1466 |
CleanupClosePushL(socketServer);
|
|
1467 |
|
|
1468 |
//
|
|
1469 |
// Define and open the socket
|
|
1470 |
//
|
|
1471 |
RSocket sock;
|
|
1472 |
OpenSocketLC(socketServer, sock);
|
|
1473 |
//
|
|
1474 |
// Indicating to the protocol that it's a new client
|
|
1475 |
//
|
|
1476 |
INFO_PRINTF1(_L("Socket set option for indicating new client"));
|
|
1477 |
TInt ret = sock.SetOpt(KWapSmsOptionNewStyleClient,KWapSmsOptionLevel, 0);
|
|
1478 |
TESTCHECKL(ret, KErrNone, "Indicating to the protocol that it's a new client")
|
|
1479 |
|
|
1480 |
ret = sock.Bind(wapAddr);
|
|
1481 |
TESTCHECKL(ret, KErrNone, "Socket bind");
|
|
1482 |
|
|
1483 |
//
|
|
1484 |
// Send a business card
|
|
1485 |
//
|
|
1486 |
TRequestStatus status;
|
|
1487 |
|
|
1488 |
TBuf8<200> data;
|
|
1489 |
data.Copy(TestData1);
|
|
1490 |
sock.SendTo(data, wapAddr, 0, status);
|
|
1491 |
User::WaitForRequest(status);
|
|
1492 |
TESTCHECKL(status.Int(), KErrNone, "Sending a message");
|
|
1493 |
|
|
1494 |
TRequestStatus ioctlStatus;
|
|
1495 |
TRequestStatus recvStatus;
|
|
1496 |
TPckgBuf<TInt> length;
|
|
1497 |
|
|
1498 |
TRequestStatus ioctlmessageStatus;
|
|
1499 |
TBuf8<200> smsdata;
|
|
1500 |
|
|
1501 |
//
|
|
1502 |
// Issue Ioctl for getting the length of the message
|
|
1503 |
//
|
|
1504 |
sock.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1505 |
|
|
1506 |
//
|
|
1507 |
// Issue Ioctl for getting the message parameters (should panic!)
|
|
1508 |
//
|
|
1509 |
sock.Ioctl(KSOGetMessageParameters, ioctlmessageStatus, &smsdata, KSolWapProv);
|
|
1510 |
|
|
1511 |
//
|
|
1512 |
// Get the size of the first incoming message
|
|
1513 |
//
|
|
1514 |
User::WaitForRequest(ioctlStatus);
|
|
1515 |
TESTCHECKL(ioctlStatus.Int(), KErrNone, "Getting the length of the incoming message");
|
|
1516 |
|
|
1517 |
//
|
|
1518 |
// Receiving a datagram
|
|
1519 |
//
|
|
1520 |
TBuf8<256> recvBuf(length);
|
|
1521 |
sock.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
1522 |
User::WaitForRequest(recvStatus);
|
|
1523 |
TESTCHECKL(recvStatus.Int(), KErrNone, "Receiving a message");
|
|
1524 |
TESTCHECK(recvBuf.Compare(data), 0, "Checking the received message matched expected");
|
|
1525 |
|
|
1526 |
|
|
1527 |
//
|
|
1528 |
// Confirm the receipt of the message to the client
|
|
1529 |
//
|
|
1530 |
INFO_PRINTF1(_L("Setting Socket option for indicating receipt of the message..."));
|
|
1531 |
ret = iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0);
|
|
1532 |
TESTCHECKL(ret, KErrNone, "Setting Socket option for indicating receipt of the message");
|
|
1533 |
|
|
1534 |
//
|
|
1535 |
// Closing the socket
|
|
1536 |
//
|
|
1537 |
CleanupStack::PopAndDestroy(&sock);
|
|
1538 |
CleanupStack::PopAndDestroy(&socketServer);
|
|
1539 |
|
|
1540 |
return KErrNone;
|
|
1541 |
}
|
|
1542 |
|
|
1543 |
TInt testPanicsL(TAny* aPtr)
|
|
1544 |
{
|
|
1545 |
SOneOpTestThreadInfo *pI=(SOneOpTestThreadInfo *)aPtr;
|
|
1546 |
|
|
1547 |
__UHEAP_MARK;
|
|
1548 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
1549 |
TRAPD(err, pI->iTest->DoPanicTestL(pI->iTestData1, pI->iTelNumber, pI->iPort));
|
|
1550 |
|
|
1551 |
delete cleanup;
|
|
1552 |
__UHEAP_MARKEND;
|
|
1553 |
return err;
|
|
1554 |
}
|
|
1555 |
|
|
1556 |
TVerdict CIoctlStep_27::doTestStepL()
|
|
1557 |
/**
|
|
1558 |
* Test step 27:
|
|
1559 |
* Send a 7_Bit business card. Issue both a get length and get message parameters to IOCTL at sametime
|
|
1560 |
* @return - TVerdict code
|
|
1561 |
*/
|
|
1562 |
{
|
|
1563 |
const TUint KHeapMinSize=0x01000;
|
|
1564 |
const TUint KHeapMaxSize=0x10000;
|
|
1565 |
|
|
1566 |
TPtrC TestData1;
|
|
1567 |
TPtrC16 TelNumber;
|
|
1568 |
TInt port=226;
|
|
1569 |
|
|
1570 |
if(!GetStringFromConfig(ConfigSection(),KTestData1, TestData1) ||
|
|
1571 |
!GetStringFromConfig(ConfigSection(),KSCNumber,TelNumber) ||
|
|
1572 |
!GetIntFromConfig(ConfigSection(),KWapPort,port))
|
|
1573 |
{
|
|
1574 |
User::Leave(KErrNotFound);
|
|
1575 |
}
|
|
1576 |
|
|
1577 |
INFO_PRINTF1(_L("Send a 7_Bit business card. Issue both a get length and get message parameters to IOCTL"));
|
|
1578 |
|
|
1579 |
TBool jitEnabled = User::JustInTime();
|
|
1580 |
|
|
1581 |
User::SetJustInTime(EFalse);
|
|
1582 |
|
|
1583 |
SOneOpTestThreadInfo info;
|
|
1584 |
|
|
1585 |
info.iTest=this;
|
|
1586 |
info.iTestData1=&TestData1;
|
|
1587 |
info.iTelNumber=&TelNumber;
|
|
1588 |
info.iPort=226;
|
|
1589 |
|
|
1590 |
RThread thread;
|
|
1591 |
TInt rc = thread.Create(_L("PanicThread"),testPanicsL,KDefaultStackSize,KHeapMinSize,KHeapMaxSize,&info);
|
|
1592 |
|
|
1593 |
TESTCHECKL(rc, KErrNone,"Creating a thread" );
|
|
1594 |
|
|
1595 |
TRequestStatus s;
|
|
1596 |
thread.Logon(s);
|
|
1597 |
thread.Resume();
|
|
1598 |
User::WaitForRequest(s);
|
|
1599 |
TESTCHECK(thread.ExitType(), EExitPanic, "Checking the correct exit type");
|
|
1600 |
|
|
1601 |
INFO_PRINTF2(_L("Exit type is: %d"), thread.ExitType());
|
|
1602 |
|
|
1603 |
thread.Close();
|
|
1604 |
|
|
1605 |
User::SetJustInTime(jitEnabled);
|
|
1606 |
|
|
1607 |
return TestStepResult();
|
|
1608 |
}
|
|
1609 |
|
|
1610 |
TVerdict CIoctlStep_28::doTestStepPreambleL()
|
|
1611 |
{
|
|
1612 |
__UHEAP_MARK;
|
|
1613 |
|
|
1614 |
SetTestNumberFromConfigurationFileL();
|
|
1615 |
|
|
1616 |
iScheduler = new(ELeave) CActiveScheduler;
|
|
1617 |
CActiveScheduler::Install(iScheduler);
|
|
1618 |
|
|
1619 |
INFO_PRINTF1(_L("Deleting segmentation and reassembly stores..."));
|
|
1620 |
|
|
1621 |
RFs fileServer;
|
|
1622 |
User::LeaveIfError(fileServer.Connect());
|
|
1623 |
|
|
1624 |
// delete segmentation and reassembly store files before the test
|
|
1625 |
_LIT(KReassemblyStoreName,"C:\\Private\\101F7989\\sms\\smsreast.dat");
|
|
1626 |
_LIT(KSegmentationStoreName,"C:\\Private\\101F7989\\sms\\smssegst.dat");
|
|
1627 |
_LIT(KWapReassemblyStoreName,"C:\\Private\\101F7989\\sms\\wapreast.dat");
|
|
1628 |
|
|
1629 |
fileServer.Delete(KWapReassemblyStoreName);
|
|
1630 |
fileServer.Delete(KReassemblyStoreName);
|
|
1631 |
fileServer.Delete(KSegmentationStoreName);
|
|
1632 |
|
|
1633 |
fileServer.Close();
|
|
1634 |
|
|
1635 |
TInt ret = iSocketServer.Connect(KSocketMessageSlots);
|
|
1636 |
if (ret != KErrNone)
|
|
1637 |
{
|
|
1638 |
ERR_PRINTF2(_L("Connecting to socket server failed [ret=%d]"), ret);
|
|
1639 |
}
|
|
1640 |
|
|
1641 |
return TestStepResult();
|
|
1642 |
}
|
|
1643 |
|
|
1644 |
TVerdict CIoctlStep_28::doTestStepPostambleL()
|
|
1645 |
{
|
|
1646 |
iSocketServer.Close();
|
|
1647 |
|
|
1648 |
delete iScheduler;
|
|
1649 |
iScheduler = NULL;
|
|
1650 |
|
|
1651 |
__UHEAP_MARKEND;
|
|
1652 |
|
|
1653 |
return TestStepResult();
|
|
1654 |
}
|
|
1655 |
|
|
1656 |
TVerdict CIoctlStep_28::doTestStepL()
|
|
1657 |
/**
|
|
1658 |
* Test step seventeen:
|
|
1659 |
* Sends a 7_Bit business card. Issue a get message parameters to IOCTL without correct platform security
|
|
1660 |
* @return - TVerdict code
|
|
1661 |
*/
|
|
1662 |
{
|
|
1663 |
INFO_PRINTF1(_L("Sends a 7_Bit business card. Issue a get message parameters to IOCTL without correct platform security"));
|
|
1664 |
// Configure and bind to a socket
|
|
1665 |
SetupWapSocketL();
|
|
1666 |
|
|
1667 |
//
|
|
1668 |
// Send a business card
|
|
1669 |
//
|
|
1670 |
TRequestStatus status;
|
|
1671 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
1672 |
|
|
1673 |
TBuf8<200> data;
|
|
1674 |
data.Copy(testData);
|
|
1675 |
iSocket.SendTo(data, iWapAddr, 0, status);
|
|
1676 |
User::WaitForRequest(status);
|
|
1677 |
TESTL(status.Int()==KErrNone);
|
|
1678 |
INFO_PRINTF1(_L("Message sent..."));
|
|
1679 |
|
|
1680 |
//
|
|
1681 |
// Issue Ioctl for getting the message parameters
|
|
1682 |
//
|
|
1683 |
TRequestStatus testStatus;
|
|
1684 |
TBuf8<200> smsdata;
|
|
1685 |
|
|
1686 |
INFO_PRINTF1(_L("Issue of IOCTL for KSOGetMessageParameters"));
|
|
1687 |
iSocket.Ioctl(KSOGetMessageParameters, testStatus, &smsdata, KSolWapProv);
|
|
1688 |
|
|
1689 |
User::WaitForRequest(testStatus);
|
|
1690 |
TESTL(testStatus.Int()==KErrPermissionDenied);
|
|
1691 |
INFO_PRINTF2(_L("KSOGetMessageParameters on Ioctl failed to complete with: %d"), testStatus.Int());
|
|
1692 |
|
|
1693 |
iSocket.Close();
|
|
1694 |
return TestStepResult();
|
|
1695 |
}
|
|
1696 |
|
|
1697 |
CSetDiskMonitorLimits::CSetDiskMonitorLimits()
|
|
1698 |
{
|
|
1699 |
iPartOfMultiStepTestCase = ETrue;
|
|
1700 |
}
|
|
1701 |
|
|
1702 |
TVerdict CSetDiskMonitorLimits::doTestStepL()
|
|
1703 |
/**
|
|
1704 |
Creates smsu.rsc file which defines the upper and lower limits for the disk space monitor
|
|
1705 |
*/
|
|
1706 |
{
|
|
1707 |
#ifndef _DEBUG
|
|
1708 |
INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode."));
|
|
1709 |
#else
|
|
1710 |
TInt err = RProperty::Define(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey, RProperty::EInt);
|
|
1711 |
if ((err != KErrNone) && (err != KErrAlreadyExists))
|
|
1712 |
{
|
|
1713 |
ERR_PRINTF2(_L("RProperty::Define() failure [err=%d]"), err);
|
|
1714 |
User::Leave(err);
|
|
1715 |
}
|
|
1716 |
|
|
1717 |
TInt highDrop = 3;
|
|
1718 |
TInt lowDrop = 8;
|
|
1719 |
TInt freeDrop = 0;
|
|
1720 |
|
|
1721 |
GetIntFromConfig(_L("DiskMonitorLimits"), _L("highDrop"), highDrop);
|
|
1722 |
GetIntFromConfig(_L("DiskMonitorLimits"), _L("lowDrop"), lowDrop);
|
|
1723 |
|
|
1724 |
SetHighLowLimitsAndDiskSpaceLevelL(highDrop, lowDrop, freeDrop);
|
|
1725 |
#endif
|
|
1726 |
return TestStepResult();
|
|
1727 |
}
|
|
1728 |
|
|
1729 |
CSetDiskSpace::CSetDiskSpace()
|
|
1730 |
{
|
|
1731 |
iPartOfMultiStepTestCase = ETrue;
|
|
1732 |
}
|
|
1733 |
|
|
1734 |
/**
|
|
1735 |
* Set free disk space to the required limit
|
|
1736 |
*/
|
|
1737 |
TVerdict CSetDiskSpace::doTestStepL()
|
|
1738 |
{
|
|
1739 |
#ifndef _DEBUG
|
|
1740 |
INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode."));
|
|
1741 |
#else
|
|
1742 |
ReleaseDiskSpaceL();
|
|
1743 |
|
|
1744 |
TInt freeDrop = 0;
|
|
1745 |
GetIntFromConfig(ConfigSection(), _L("freeDrop"), freeDrop);
|
|
1746 |
|
|
1747 |
SetFreeDiskSpaceFromDropLevelL(freeDrop);
|
|
1748 |
#endif
|
|
1749 |
return TestStepResult();
|
|
1750 |
}
|
|
1751 |
|
|
1752 |
/**
|
|
1753 |
Free up disk space by deleting the temp files created
|
|
1754 |
*/
|
|
1755 |
TVerdict CFreeDiskSpace::doTestStepL()
|
|
1756 |
{
|
|
1757 |
#ifndef _DEBUG
|
|
1758 |
INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode."));
|
|
1759 |
#else
|
|
1760 |
ReleaseDiskSpaceL();
|
|
1761 |
|
|
1762 |
TInt err = RProperty::Delete(KUidPSSMSStackCategory, KUidPSSMSStackFreeDiskSpaceKey);
|
|
1763 |
if (err != KErrNone && err != KErrNotFound)
|
|
1764 |
{
|
|
1765 |
ERR_PRINTF2(_L("RProperty::Delete() failure [err=%d]"), err);
|
|
1766 |
}
|
|
1767 |
#endif
|
|
1768 |
return TestStepResult();
|
|
1769 |
}
|
|
1770 |
|
|
1771 |
CReceiveWapMessage::CReceiveWapMessage()
|
|
1772 |
{
|
|
1773 |
iPartOfMultiStepTestCase = ETrue;
|
|
1774 |
}
|
|
1775 |
|
|
1776 |
TVerdict CReceiveWapMessage::doTestStepL()
|
|
1777 |
{
|
|
1778 |
#ifndef _DEBUG
|
|
1779 |
INFO_PRINTF1(_L("This test can only be run when the SMS Stack is in debug mode."));
|
|
1780 |
#else
|
|
1781 |
TInt ret = iSocketServer.Connect(KSocketMessageSlots);
|
|
1782 |
if (ret != KErrNone)
|
|
1783 |
{
|
|
1784 |
ERR_PRINTF2(_L("Connecting to socket server failed [ret=%d]"), ret);
|
|
1785 |
}
|
|
1786 |
|
|
1787 |
SetupWapSocketL();
|
|
1788 |
|
|
1789 |
TRequestStatus recvStatus;
|
|
1790 |
TRequestStatus ioctlStatus;
|
|
1791 |
TPckgBuf<TInt> length;
|
|
1792 |
|
|
1793 |
//
|
|
1794 |
// Send a business card
|
|
1795 |
//
|
|
1796 |
TRequestStatus status;
|
|
1797 |
TPtrC testData;
|
|
1798 |
GetStringFromConfig(ConfigSection(),KTestData1, testData);
|
|
1799 |
TBuf8<200> data;
|
|
1800 |
data.Copy(testData);
|
|
1801 |
|
|
1802 |
iSocket.SendTo(data, iWapAddr, 0, status);
|
|
1803 |
User::WaitForRequest(status);
|
|
1804 |
TESTCHECKL(status.Int(), KErrNone, "Sending Message...");
|
|
1805 |
|
|
1806 |
TBool messageIsExpected;
|
|
1807 |
GetBoolFromConfig(ConfigSection(), _L("messageIsExpected"), messageIsExpected);
|
|
1808 |
|
|
1809 |
//Setup delay
|
|
1810 |
TRequestStatus timerStatus;
|
|
1811 |
RTimer timer;
|
|
1812 |
//Read from the INI file.
|
|
1813 |
TInt timeout = 10000000; // default 10 seconds timeout
|
|
1814 |
GetIntFromConfig(_L("ReceiveTimeout"), _L("timeout"), timeout);
|
|
1815 |
|
|
1816 |
timer.CreateLocal();
|
|
1817 |
timer.After(timerStatus, TTimeIntervalMicroSeconds32(timeout));
|
|
1818 |
|
|
1819 |
// Get the size of the first incomming message
|
|
1820 |
INFO_PRINTF1(_L("Issue of the IOCTL for GetLength"));
|
|
1821 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1822 |
|
|
1823 |
//Check if there is in fact a message
|
|
1824 |
TBool received=EFalse;
|
|
1825 |
User::WaitForRequest(timerStatus, ioctlStatus);
|
|
1826 |
|
|
1827 |
if(ioctlStatus == KRequestPending)
|
|
1828 |
{
|
|
1829 |
// if timer elapsed but ESock request is still pending
|
|
1830 |
iSocket.CancelIoctl();
|
|
1831 |
User::WaitForRequest(ioctlStatus);
|
|
1832 |
}
|
|
1833 |
else
|
|
1834 |
{
|
|
1835 |
// ESock request is done. Cancel timer
|
|
1836 |
timer.Cancel();
|
|
1837 |
User::WaitForRequest(timerStatus);
|
|
1838 |
// check ESock error status
|
|
1839 |
if(ioctlStatus.Int() == KErrNone)
|
|
1840 |
{
|
|
1841 |
INFO_PRINTF1(_L("IOCTL for GetLength completed successfully"));
|
|
1842 |
received=ETrue;
|
|
1843 |
}
|
|
1844 |
}
|
|
1845 |
timer.Close();
|
|
1846 |
|
|
1847 |
if(received && messageIsExpected)
|
|
1848 |
{
|
|
1849 |
INFO_PRINTF1(_L("Receiving push datagram..."));
|
|
1850 |
TWapAddr recvWapAddr;
|
|
1851 |
TBuf8<256> recvBuf1(length);
|
|
1852 |
iSocket.RecvFrom(recvBuf1,recvWapAddr,0,recvStatus);
|
|
1853 |
User::WaitForRequest(recvStatus);
|
|
1854 |
User::LeaveIfError(recvStatus.Int());
|
|
1855 |
TEST(recvBuf1.Compare(data) == 0);
|
|
1856 |
|
|
1857 |
//
|
|
1858 |
// Confirm the receipt of the message to the client
|
|
1859 |
//
|
|
1860 |
TInt ret = iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0);
|
|
1861 |
TESTCHECKL(ret, KErrNone, "Setting Socket option for indicating receipt of message" )
|
|
1862 |
}
|
|
1863 |
else if (received && !messageIsExpected)
|
|
1864 |
{
|
|
1865 |
ERR_PRINTF1(_L("Message is received but not expected"));
|
|
1866 |
SetTestStepResult(EFail);
|
|
1867 |
}
|
|
1868 |
else if (!received && messageIsExpected)
|
|
1869 |
{
|
|
1870 |
ERR_PRINTF1(_L("Message is expected but not received"));
|
|
1871 |
SetTestStepResult(EFail);
|
|
1872 |
}
|
|
1873 |
|
|
1874 |
iSocket.Close();
|
|
1875 |
iSocketServer.Close();
|
|
1876 |
#endif
|
|
1877 |
return TestStepResult();
|
|
1878 |
}
|
|
1879 |
|
|
1880 |
/**
|
|
1881 |
* Tests enumerating of a VCard which needs to go via the observer and not returned to the client.
|
|
1882 |
*
|
|
1883 |
* @return A TVerdict code.
|
|
1884 |
*/
|
|
1885 |
TVerdict CTestEnumeratingVCard::doTestStepL()
|
|
1886 |
{
|
|
1887 |
// Configure and bind to a socket
|
|
1888 |
SetupWapSocketL();
|
|
1889 |
|
|
1890 |
// Create a socket for the enumeration...
|
|
1891 |
RSocket enumerateSock;
|
|
1892 |
TSmsAddr smsAddr;
|
|
1893 |
|
|
1894 |
OpenSocketLC(iSocketServer, enumerateSock, KSMSAddrFamily,KSMSDatagramProtocol);
|
|
1895 |
|
|
1896 |
smsAddr.SetSmsAddrFamily(ESmsAddrLocalOperation);
|
|
1897 |
User::LeaveIfError(enumerateSock.Bind(smsAddr));
|
|
1898 |
|
|
1899 |
// Trigger the enumeration...
|
|
1900 |
TPckgBuf<TUint> messageCount(0);
|
|
1901 |
TRequestStatus enumStatus;
|
|
1902 |
|
|
1903 |
User::After(1000000); // Gives SMS Prot and WAP Prot time to initialise after loading!
|
|
1904 |
enumerateSock.Ioctl(KIoctlEnumerateSmsMessages, enumStatus, &messageCount, KSolSmsProv);
|
|
1905 |
User::WaitForRequest(enumStatus);
|
|
1906 |
TESTL(enumStatus.Int() == KErrNone);
|
|
1907 |
TEST(messageCount() == 0);
|
|
1908 |
|
|
1909 |
// Issue an Ioctl for getting the length of the enumerated datagram...
|
|
1910 |
TRequestStatus ioctlStatus;
|
|
1911 |
TPckgBuf<TInt> length;
|
|
1912 |
|
|
1913 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
1914 |
User::WaitForRequest(ioctlStatus);
|
|
1915 |
TESTL(ioctlStatus.Int() == KErrNone);
|
|
1916 |
TEST(length() == 118);
|
|
1917 |
|
|
1918 |
// Receive the VCard...
|
|
1919 |
TRequestStatus recvStatus;
|
|
1920 |
TBuf8<256> recvBuf;
|
|
1921 |
TBuf<256> vcardBuf16;
|
|
1922 |
TWapAddr recvWapAddr;
|
|
1923 |
|
|
1924 |
iSocket.RecvFrom(recvBuf, recvWapAddr, 0, recvStatus);
|
|
1925 |
User::WaitForRequest(recvStatus);
|
|
1926 |
TESTL(recvStatus.Int() == KErrNone);
|
|
1927 |
|
|
1928 |
vcardBuf16.Copy(recvBuf);
|
|
1929 |
INFO_PRINTF2(_L("Received the VCard: \"%S\""), &vcardBuf16);
|
|
1930 |
|
|
1931 |
// Confirm the receipt of the message...
|
|
1932 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
1933 |
|
|
1934 |
iSocket.Close();
|
|
1935 |
CleanupStack::PopAndDestroy(&enumerateSock);
|
|
1936 |
return TestStepResult();
|
|
1937 |
}
|
|
1938 |
|
|
1939 |
/**
|
|
1940 |
* Sends a 7-bit VCard with an email address in it, to ensure that '@'
|
|
1941 |
* characters are sent correctly.
|
|
1942 |
*
|
|
1943 |
* @return EPass or EFail.
|
|
1944 |
*/
|
|
1945 |
TVerdict CTest7BitBusinessCardWithEmail::doTestStepL()
|
|
1946 |
{
|
|
1947 |
// Configure and bind to a socket
|
|
1948 |
SetupWapSocketL();
|
|
1949 |
|
|
1950 |
// Send a business card with the email address.
|
|
1951 |
TPtrC testData = GetStringFromConfigL(KTestData1);
|
|
1952 |
SendWapMessage(testData);
|
|
1953 |
|
|
1954 |
ReceiveWapMessage(testData);
|
|
1955 |
|
|
1956 |
iSocket.Close();
|
|
1957 |
return TestStepResult();
|
|
1958 |
}
|
|
1959 |
|
|
1960 |
/**
|
|
1961 |
* Attempts to send datagrams bigger than the maximum message and bigger
|
|
1962 |
* than the maximum size of an MBuf.
|
|
1963 |
*
|
|
1964 |
* @return EPass or EFail.
|
|
1965 |
*/
|
|
1966 |
TVerdict CTestOversizedDatagram::doTestStepL()
|
|
1967 |
{
|
|
1968 |
// Configure and bind to a socket
|
|
1969 |
SetupWapSocketL();
|
|
1970 |
|
|
1971 |
// Send a datagram of the maximum datagram size (this will fail because
|
|
1972 |
// of the WAP headers)...
|
|
1973 |
TRequestStatus status;
|
|
1974 |
|
|
1975 |
HBufC8* textBuf = HBufC8::NewLC(65536+1);
|
|
1976 |
TPtr8 textPtr = textBuf->Des();
|
|
1977 |
|
|
1978 |
textPtr.Fill('A', KWAPSMSMaxDatagramSize);
|
|
1979 |
iSocket.SendTo(textPtr, iWapAddr, 0, status);
|
|
1980 |
User::WaitForRequest(status);
|
|
1981 |
TEST(status.Int() == KErrOverflow);
|
|
1982 |
|
|
1983 |
// Send a datagram bigger than the maximum datagram...
|
|
1984 |
textPtr.Fill('B', KWAPSMSMaxDatagramSize+1);
|
|
1985 |
iSocket.SendTo(textPtr, iWapAddr, 0, status);
|
|
1986 |
User::WaitForRequest(status);
|
|
1987 |
TEST(status.Int() == KErrTooBig);
|
|
1988 |
|
|
1989 |
// Send a datagram bigger than the maximum MBuf...
|
|
1990 |
textPtr.Fill('C', 65536+1);
|
|
1991 |
iSocket.SendTo(textPtr, iWapAddr, 0, status);
|
|
1992 |
User::WaitForRequest(status);
|
|
1993 |
TEST(status.Int() == KErrTooBig);
|
|
1994 |
|
|
1995 |
iSocket.Close();
|
|
1996 |
CleanupStack::PopAndDestroy(textBuf);
|
|
1997 |
return TestStepResult();
|
|
1998 |
}
|
|
1999 |
|
|
2000 |
TVerdict CTestWapDatagramSegmentContainingNoData::doTestStepL()
|
|
2001 |
/**
|
|
2002 |
* Test step: Receive 3 Wap Datagrams, each WAP message contains
|
|
2003 |
* one or more segments which comprise of a wap header but no data.
|
|
2004 |
*
|
|
2005 |
* @return - TVerdict code
|
|
2006 |
*/
|
|
2007 |
{
|
|
2008 |
INFO_PRINTF1(_L("CTestWapDatagramSegmentContainingNoData:"));
|
|
2009 |
// Configure and bind to a socket
|
|
2010 |
SetupWapSocketL();
|
|
2011 |
|
|
2012 |
TVerdict verdict = EPass;
|
|
2013 |
|
|
2014 |
// Create an empty string which will encode into a single segment wap message which contains a wap header, but no wap data.
|
|
2015 |
_LIT8(KLocalTestData1, "");
|
|
2016 |
TBuf8<300> data1(KLocalTestData1);
|
|
2017 |
// Create a VCard which will encode into 2 segment wapdatagram, the 2nd segment contains a wap header, but no wap data.
|
|
2018 |
// Use a local literal string rather than reading from a text file. This prevents extra unwanted '\' being added to the string, for example \\r\\n
|
|
2019 |
_LIT8(KLocalTestData2,"BEGIN:VCARD\r\nVERSION:2.1\r\nREV:20090403T094807Z\r\nUID:83702f931a905a6e-00e14456815a8324-33\r\nN:;3SIM;;;\r\nTEL;WORK;CELL:07878931672\r\nEND:VCARD\r");
|
|
2020 |
TBuf8<300> data2(KLocalTestData2);
|
|
2021 |
|
|
2022 |
|
|
2023 |
TRequestStatus ioctlStatus;
|
|
2024 |
TRequestStatus recvStatus;
|
|
2025 |
TPckgBuf<TInt> length;
|
|
2026 |
|
|
2027 |
//
|
|
2028 |
// Issue Ioctl for getting the length of the message
|
|
2029 |
//
|
|
2030 |
INFO_PRINTF1(_L("Issue of the IOCTL for GetLength for first VCal entry"));
|
|
2031 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
2032 |
|
|
2033 |
|
|
2034 |
TBuf8<300> data;
|
|
2035 |
|
|
2036 |
//
|
|
2037 |
// Send a SMS in order to trigger receiving the SMS messages.
|
|
2038 |
// This is to make sure the SMS messages are not received before the
|
|
2039 |
// wap address is bound to the socket.
|
|
2040 |
//
|
|
2041 |
TRequestStatus status;
|
|
2042 |
|
|
2043 |
iSocket.SendTo(data1, iWapAddr, 0, status);
|
|
2044 |
User::WaitForRequest(status);
|
|
2045 |
User::LeaveIfError(status.Int());
|
|
2046 |
INFO_PRINTF1(_L("First Message (VCal) sent..."));
|
|
2047 |
|
|
2048 |
//
|
|
2049 |
// Get the size of the first incoming message
|
|
2050 |
// The text string should be empty.
|
|
2051 |
//
|
|
2052 |
TBuf8<300> recvBuf;
|
|
2053 |
User::WaitForRequest(ioctlStatus);
|
|
2054 |
User::LeaveIfError(ioctlStatus.Int());
|
|
2055 |
INFO_PRINTF1(_L("IOCTL completed"));
|
|
2056 |
|
|
2057 |
//
|
|
2058 |
// Check if reported length is correct
|
|
2059 |
//
|
|
2060 |
if(length()!=data1.Length())
|
|
2061 |
{
|
|
2062 |
verdict = EFail;
|
|
2063 |
}
|
|
2064 |
|
|
2065 |
//
|
|
2066 |
// Receiving a datagram
|
|
2067 |
//
|
|
2068 |
TWapAddr recvWapAddr;
|
|
2069 |
|
|
2070 |
iSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
2071 |
User::WaitForRequest(recvStatus);
|
|
2072 |
User::LeaveIfError(recvStatus.Int());
|
|
2073 |
INFO_PRINTF1(_L("Received the first message (VCal)..."));
|
|
2074 |
|
|
2075 |
// The receive buffer should contain an empty string.
|
|
2076 |
// This is as a consequence of the wapprot receiving
|
|
2077 |
// a single segment wap message which contains no data.
|
|
2078 |
if(recvBuf.Compare(data1))
|
|
2079 |
{
|
|
2080 |
ERR_PRINTF1(_L("Non empty string returned"));
|
|
2081 |
verdict = EFail;
|
|
2082 |
}
|
|
2083 |
|
|
2084 |
//
|
|
2085 |
// Confirm the receipt of the message to the client
|
|
2086 |
//
|
|
2087 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of first message (VCal)"));
|
|
2088 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
2089 |
|
|
2090 |
|
|
2091 |
//Issue Ioctl for getting the length of the second message
|
|
2092 |
INFO_PRINTF1(_L("Issue of the IOCTL for GetLength for second VCard entry"));
|
|
2093 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
2094 |
|
|
2095 |
//Get the size of the second incoming message
|
|
2096 |
User::WaitForRequest(ioctlStatus);
|
|
2097 |
User::LeaveIfError(ioctlStatus.Int());
|
|
2098 |
INFO_PRINTF1(_L("IOCTL completed for second message (VCard)"));
|
|
2099 |
|
|
2100 |
//Check if reported length is correct
|
|
2101 |
if(length()!=data2.Length())
|
|
2102 |
{
|
|
2103 |
verdict = EFail;
|
|
2104 |
}
|
|
2105 |
|
|
2106 |
//Receiving a datagram (VCard)
|
|
2107 |
iSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
2108 |
User::WaitForRequest(recvStatus);
|
|
2109 |
User::LeaveIfError(recvStatus.Int());
|
|
2110 |
INFO_PRINTF1(_L("Received the second message (VCard)..."));
|
|
2111 |
|
|
2112 |
// Compare the received VCard message with the original one.
|
|
2113 |
// They should be identical. This checks that the WAPPROT
|
|
2114 |
// can receive a 2 segment wap datagram, with the 2nd segment containing no data.
|
|
2115 |
//
|
|
2116 |
if(recvBuf.Compare(data2))
|
|
2117 |
{
|
|
2118 |
ERR_PRINTF1(_L("VCard message received does not match with original message."));
|
|
2119 |
verdict = EFail;
|
|
2120 |
}
|
|
2121 |
|
|
2122 |
//Confirm the receipt of the message to the client
|
|
2123 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
2124 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
2125 |
//Issue Ioctl for getting the length of the third message
|
|
2126 |
|
|
2127 |
INFO_PRINTF1(_L("Issue of the IOCTL for GetLength for second VCard entry"));
|
|
2128 |
iSocket.Ioctl(KSOGetLength, ioctlStatus, &length, KSolWapProv);
|
|
2129 |
|
|
2130 |
//Get the size of the third incoming message
|
|
2131 |
User::WaitForRequest(ioctlStatus);
|
|
2132 |
User::LeaveIfError(ioctlStatus.Int());
|
|
2133 |
INFO_PRINTF1(_L("IOCTL completed for third message (VCard)"));
|
|
2134 |
|
|
2135 |
//Check if reported length is correct
|
|
2136 |
if(length()!=data1.Length())
|
|
2137 |
{
|
|
2138 |
verdict = EFail;
|
|
2139 |
}
|
|
2140 |
|
|
2141 |
//Receiving a datagram (VCard)
|
|
2142 |
iSocket.RecvFrom(recvBuf,recvWapAddr,0,recvStatus);
|
|
2143 |
User::WaitForRequest(recvStatus);
|
|
2144 |
User::LeaveIfError(recvStatus.Int());
|
|
2145 |
INFO_PRINTF1(_L("Received the third message (VCard)..."));
|
|
2146 |
|
|
2147 |
// The receive buffer should contain an empty string.
|
|
2148 |
// This is as a consequence of the WAPPROT containing 2 concatenated WAP Datagrams
|
|
2149 |
// each datagram segement containing no data.
|
|
2150 |
if(recvBuf.Compare(data1))
|
|
2151 |
{
|
|
2152 |
ERR_PRINTF1(_L("VCard message received does not match with original message."));
|
|
2153 |
verdict = EFail;
|
|
2154 |
}
|
|
2155 |
|
|
2156 |
//Confirm the receipt of the message to the client
|
|
2157 |
INFO_PRINTF1(_L("Socket set option for indicating receipt of message"));
|
|
2158 |
User::LeaveIfError(iSocket.SetOpt(KWapSmsOptionOKToDeleteMessage,KWapSmsOptionLevel, 0));
|
|
2159 |
|
|
2160 |
iSocket.Close();
|
|
2161 |
SetTestStepResult(verdict);
|
|
2162 |
return TestStepResult();
|
|
2163 |
}
|
|
2164 |
|