|
1 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <msvids.h> |
|
17 #include "pushtests.h" |
|
18 #include "dummywapstack.h" |
|
19 #include "wappushmsggen.h" |
|
20 #include <push/cwappushmsgutils.h> |
|
21 |
|
22 #ifdef __MESSAGING_API_V2__ |
|
23 #include <cmsvattachment.h> |
|
24 #include <mmsvattachmentmanager.h> |
|
25 #endif // __MESSAGING_API_V2__ |
|
26 |
|
27 _LIT8(KBIOLine1, "begin:vcard\r\n"); |
|
28 _LIT8(KBIOLine2, "n:Blumin;J\r\n"); |
|
29 _LIT8(KBIOLine3, "tel;cell:+44 774 706 5443\r\n"); |
|
30 _LIT8(KBIOLine4, "x-mozilla-html:TRUE\r\n"); |
|
31 _LIT8(KBIOLine5, "org:Pure Matrix;Engineering\r\n"); |
|
32 _LIT8(KBIOLine6, "adr:;;;;;;\r\n"); |
|
33 _LIT8(KBIOLine7, "version:2.1\r\n"); |
|
34 _LIT8(KBIOLine8, "email;internet:julia.blumin@symbian.com\r\n"); |
|
35 _LIT8(KBIOLine9, "title:engneer\r\n"); |
|
36 _LIT8(KBIOLine10, "end:vcard\r\n"); |
|
37 |
|
38 _LIT8(KUnkLine1, "just some random text for the unknown message\r\n"); |
|
39 _LIT8(KUnkLine2, "body though text will may no influence on how stored.\r\n"); |
|
40 _LIT8(KUnkLine3, "Test wap push plugin leaving from HandleMessageL\r\n"); |
|
41 //_LIT8(KCrLf, "\r\n"); |
|
42 |
|
43 _LIT8(KWMLTextLine1, "<?xml version=\"1.0\" ?>\r\n"); |
|
44 _LIT8(KWMLTextLine2, "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\"\r\n"); |
|
45 _LIT8(KWMLTextLine3, "\"http://www.wapforum.org/DTD/wml12.dtd\">\r\n"); |
|
46 _LIT8(KWMLTextLine4, "<wml>\r\n"); |
|
47 _LIT8(KWMLTextLine5, "<template>\r\n"); |
|
48 _LIT8(KWMLTextLine6, "<do label=\"TOP\" type=\"accept\" name=\"soft1\">\r\n"); |
|
49 _LIT8(KWMLTextLine7, "<go href=\"../index.wml#menu\"/>\r\n"); |
|
50 _LIT8(KWMLTextLine8, "</do>\r\n"); |
|
51 _LIT8(KWMLTextLine9, "<do label=\"Back\" type=\"prev\" name=\"soft2\">\r\n"); |
|
52 _LIT8(KWMLTextLine10, "<prev/>\r\n"); |
|
53 _LIT8(KWMLTextLine11, "</do>\r\n"); |
|
54 _LIT8(KWMLTextLine12, "</template>\r\n"); |
|
55 _LIT8(KWMLTextLine13, "<card id=\"index\">\r\n"); |
|
56 _LIT8(KWMLTextLine14, "<p>\r\n"); |
|
57 _LIT8(KWMLTextLine15, "<big><b>WML Sample</b></big>\r\n"); |
|
58 _LIT8(KWMLTextLine16, "</p>\r\n"); |
|
59 _LIT8(KWMLTextLine17, "<p>\r\n"); |
|
60 _LIT8(KWMLTextLine18, "<select multiple=\"true\" value=\"\">\r\n"); |
|
61 _LIT8(KWMLTextLine19, "<option onpick=\"text.wml\">Text Formats</option>\r\n"); |
|
62 _LIT8(KWMLTextLine20, "<option onpick=\"control.wml\">Controls</option>\r\n"); |
|
63 _LIT8(KWMLTextLine21, "<option onpick=\"script.wml\">WMLScript</option>\r\n"); |
|
64 _LIT8(KWMLTextLine22, "</select>\r\n"); |
|
65 _LIT8(KWMLTextLine23, "</p>\r\n"); |
|
66 _LIT8(KWMLTextLine24, "</card>\r\n"); |
|
67 _LIT8(KWMLTextLine25, "</wml>\r\n"); |
|
68 |
|
69 _LIT(KUnkTestStart, " ******** Wap Push Unknown Message Test - START ******** "); |
|
70 _LIT(KUnkTestFinish, " ******** Wap Push Unknown Message Test - FINISH ******** "); |
|
71 _LIT(KSpace, " "); |
|
72 _LIT(KDefaultFilename, "content.dat"); |
|
73 _LIT(KContentWml, "content.wml"); |
|
74 _LIT(KCase5, "case5.txt"); |
|
75 _LIT(KCase6, "case6.txt"); |
|
76 _LIT(KCase7, "case7.txt"); |
|
77 _LIT(KCase8, "case8.txt"); |
|
78 _LIT(KCase9, "case9.txt"); |
|
79 _LIT(KTest1, "Test Case 1"); |
|
80 _LIT(KTest2, "Test Case 2"); |
|
81 _LIT(KTest3, "Test Case 3"); |
|
82 _LIT(KTest4, "Test Case 4"); |
|
83 _LIT(KTest5, "Test Case 5"); |
|
84 _LIT(KTest6, "Test Case 6"); |
|
85 _LIT(KTest7, "Test Case 7"); |
|
86 _LIT(KTest8, "Test Case 8"); |
|
87 _LIT(KTest9, "Test Case 9"); |
|
88 _LIT(KLogSucceeded, "OK"); |
|
89 _LIT(KLogFailed, "FAILED"); |
|
90 _LIT(KLogOutput,"WapPushUnknownMessageTest: %S - %S"); |
|
91 |
|
92 |
|
93 /** set test name to 'Unknown Handler Test' |
|
94 @param void |
|
95 @return string |
|
96 string represents test name |
|
97 */ |
|
98 const TDesC& CWapPushUnkMessageTest::TestName() |
|
99 { |
|
100 _LIT(KTextUnkMessageTest, "Unknown Handler Test"); |
|
101 return KTextUnkMessageTest; |
|
102 } |
|
103 |
|
104 /** set the number of test messages to use */ |
|
105 void CWapPushUnkMessageTest::NumberTestCasesToRun() |
|
106 { |
|
107 iNumberOfTestCases = 11; |
|
108 } |
|
109 |
|
110 /** build different test messages to test handler |
|
111 @param TInt |
|
112 the number of test messages to create and use |
|
113 @return void |
|
114 */ |
|
115 void CWapPushUnkMessageTest::PrepareTestMessageL(TInt aTestCase) |
|
116 { |
|
117 // this set of test messages adds a test message |
|
118 // to the store for the match cases, |
|
119 // replaces the stored message and ends with no stored si message |
|
120 |
|
121 iBodyBuf.Delete(0,KBufferSize); |
|
122 //iBodyBuf.Zero(); |
|
123 iHeadersBuf.Delete(0, KBufferSize); |
|
124 |
|
125 |
|
126 switch (aTestCase) |
|
127 { |
|
128 case 0 : |
|
129 { |
|
130 // create vcard header |
|
131 const TUint8 kHdr[]= |
|
132 { |
|
133 0x87, // content type text/x-vcard (bio msg) |
|
134 0x92, // Date |
|
135 0x04, // length of field |
|
136 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
137 0x90, |
|
138 0x6a, |
|
139 0xd0, |
|
140 0x94, // Expires |
|
141 0x04, // length of field |
|
142 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
143 0x9a, |
|
144 0x6a, |
|
145 0xd0, |
|
146 0xAF, //X-Wap-Application-ID |
|
147 0x82 // Short int - 0x02 represent x-wap-application:push.ua |
|
148 }; |
|
149 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
150 // create vcard message and approriate text body |
|
151 iBodyBuf.Append(KBIOLine1); |
|
152 iBodyBuf.Append(KBIOLine2); |
|
153 iBodyBuf.Append(KBIOLine3); |
|
154 iBodyBuf.Append(KBIOLine4); |
|
155 iBodyBuf.Append(KBIOLine5); |
|
156 iBodyBuf.Append(KBIOLine6); |
|
157 iBodyBuf.Append(KBIOLine7); |
|
158 iBodyBuf.Append(KBIOLine8); |
|
159 iBodyBuf.Append(KBIOLine9); |
|
160 iBodyBuf.Append(KBIOLine10); |
|
161 break; |
|
162 } |
|
163 case 1 : |
|
164 // create unknown message |
|
165 { |
|
166 const TUint8 kHdr[]= |
|
167 { |
|
168 0xFF, // ? unknown |
|
169 0x92, // Date |
|
170 0x04, // length of field |
|
171 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
172 0x90, |
|
173 0x6a, |
|
174 0xd0, |
|
175 0x94, // Expires |
|
176 0x04, // length of field |
|
177 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
178 0x9a, |
|
179 0x6a, |
|
180 0xd0, |
|
181 0xAF, //X-Wap-Application-ID |
|
182 0x82 // Short int - 0x02 represent x-wap-application:push.ua |
|
183 }; |
|
184 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
185 // create text body for message |
|
186 iBodyBuf.Append(KUnkLine1); |
|
187 iBodyBuf.Append(KUnkLine2); |
|
188 break; |
|
189 } |
|
190 case 2: |
|
191 { |
|
192 const TUint8 kHdr[]= |
|
193 { |
|
194 0x88, // content type "text/vnd.wap.wml" // 0x08 |
|
195 0x92, // Date |
|
196 0x04, // length of field |
|
197 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
198 0x90, |
|
199 0x6a, |
|
200 0xd0, |
|
201 0x94, // Expires |
|
202 0x04, // length of field |
|
203 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
204 0x9a, |
|
205 0x6a, |
|
206 0xd0, |
|
207 0xAF, //X-Wap-Application-ID |
|
208 0x82 // Short int - 0x02 represent x-wap-application:push.ua |
|
209 }; |
|
210 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
211 // create vcard message and approriate text body |
|
212 iBodyBuf.Append(KWMLTextLine1); |
|
213 iBodyBuf.Append(KWMLTextLine2); |
|
214 iBodyBuf.Append(KWMLTextLine3); |
|
215 iBodyBuf.Append(KWMLTextLine4); |
|
216 iBodyBuf.Append(KWMLTextLine5); |
|
217 iBodyBuf.Append(KWMLTextLine6); |
|
218 iBodyBuf.Append(KWMLTextLine7); |
|
219 iBodyBuf.Append(KWMLTextLine8); |
|
220 iBodyBuf.Append(KWMLTextLine9); |
|
221 iBodyBuf.Append(KWMLTextLine10); |
|
222 iBodyBuf.Append(KWMLTextLine11); |
|
223 iBodyBuf.Append(KWMLTextLine12); |
|
224 iBodyBuf.Append(KWMLTextLine13); |
|
225 iBodyBuf.Append(KWMLTextLine14); |
|
226 iBodyBuf.Append(KWMLTextLine15); |
|
227 iBodyBuf.Append(KWMLTextLine16); |
|
228 iBodyBuf.Append(KWMLTextLine17); |
|
229 iBodyBuf.Append(KWMLTextLine18); |
|
230 iBodyBuf.Append(KWMLTextLine19); |
|
231 iBodyBuf.Append(KWMLTextLine20); |
|
232 iBodyBuf.Append(KWMLTextLine21); |
|
233 iBodyBuf.Append(KWMLTextLine22); |
|
234 iBodyBuf.Append(KWMLTextLine23); |
|
235 iBodyBuf.Append(KWMLTextLine24); |
|
236 iBodyBuf.Append(KWMLTextLine25); |
|
237 break; |
|
238 } |
|
239 /* case 3 : |
|
240 // create unknown message |
|
241 { |
|
242 const TUint8 kHdr[]= |
|
243 { |
|
244 0xFF, // unknown, default content type "application/octet-stream" |
|
245 0x92, // Date |
|
246 0x04, // length of field |
|
247 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
248 0x90, |
|
249 0x6a, |
|
250 0xd0, |
|
251 0x94, // Expires |
|
252 0x04, // length of field |
|
253 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
254 0x9a, |
|
255 0x6a, |
|
256 0xd0, |
|
257 0xAF, // X-Wap-Application-ID |
|
258 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
259 0x2E, // Content-Disposition (WAP 1.1) |
|
260 0x02, // Length (272 bytes = 0x0110) |
|
261 0x01, |
|
262 0x10, |
|
263 'i', // disposition - inline |
|
264 'n', |
|
265 'l', |
|
266 'i', |
|
267 'n', |
|
268 'e', |
|
269 0x00, // parameter - filename |
|
270 'f', |
|
271 'i', |
|
272 'l', |
|
273 'e', |
|
274 'n', |
|
275 'a', |
|
276 'm', |
|
277 'e', |
|
278 0x00, |
|
279 '1', // parameter value - 255 character file name. |
|
280 '2', |
|
281 '3', |
|
282 '4', |
|
283 '5', |
|
284 '6', |
|
285 '7', |
|
286 '8', |
|
287 '9', |
|
288 '0', |
|
289 '1','2','3','4','5','6','7','8','9','0', //20 |
|
290 '1','2','3','4','5','6','7','8','9','0', //30 |
|
291 '1','2','3','4','5','6','7','8','9','0', //40 |
|
292 '1','2','3','4','5','6','7','8','9','0', //50 |
|
293 '1','2','3','4','5','6','7','8','9','0', //60 |
|
294 '1','2','3','4','5','6','7','8','9','0', //70 |
|
295 '1','2','3','4','5','6','7','8','9','0', //80 |
|
296 '1','2','3','4','5','6','7','8','9','0', //90 |
|
297 '1','2','3','4','5','6','7','8','9','0', //100 |
|
298 '1','2','3','4','5','6','7','8','9','0', //110 |
|
299 '1','2','3','4','5','6','7','8','9','0', //120 |
|
300 '1','2','3','4','5','6','7','8','9','0', //130 |
|
301 '1','2','3','4','5','6','7','8','9','0', //140 |
|
302 '1','2','3','4','5','6','7','8','9','0', //150 |
|
303 '1','2','3','4','5','6','7','8','9','0', //160 |
|
304 '1','2','3','4','5','6','7','8','9','0', //170 |
|
305 '1','2','3','4','5','6','7','8','9','0', //180 |
|
306 '1','2','3','4','5','6','7','8','9','0', //190 |
|
307 '1','2','3','4','5','6','7','8','9','0', //200 |
|
308 '1','2','3','4','5','6','7','8','9','0', //210 |
|
309 '1','2','3','4','5','6','7','8','9','0', //220 |
|
310 '1','2','3','4','5','6','7','8','9','0', //230 |
|
311 '1','2','3','4','5','6','7','8','9','0', //240 |
|
312 '1','2','3','4','5','6','7','8','9','0', //250 |
|
313 '1','2','3','4','5', //255 |
|
314 0x00 |
|
315 }; |
|
316 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
317 // create text body for message |
|
318 iBodyBuf.Append(KUnkLine1); |
|
319 iBodyBuf.Append(KUnkLine2); |
|
320 break; |
|
321 } |
|
322 */ case 3 : |
|
323 // create unknown message |
|
324 { |
|
325 const TUint8 kHdr[]= |
|
326 { |
|
327 0xFF, // unknown, default content type "application/octet-stream" |
|
328 0x92, // Date |
|
329 0x04, // length of field |
|
330 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
331 0x90, |
|
332 0x6a, |
|
333 0xd0, |
|
334 0x94, // Expires |
|
335 0x04, // length of field |
|
336 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
337 0x9a, |
|
338 0x6a, |
|
339 0xd0, |
|
340 0xAF, // X-Wap-Application-ID |
|
341 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
342 0x2E, // Content-Disposition (WAP 1.1) |
|
343 0x1B, // Length |
|
344 'i', // disposition - inline |
|
345 'n', |
|
346 'l', |
|
347 'i', |
|
348 'n', |
|
349 'e', |
|
350 0x00, // parameter - filename |
|
351 'f', |
|
352 'i', |
|
353 'l', |
|
354 'E', |
|
355 'N', |
|
356 'A', |
|
357 'm', |
|
358 'e', |
|
359 0x00, |
|
360 '"', // parameter value - ca?e3.txt - invalid Symbian OS file name. |
|
361 'c', |
|
362 'a', |
|
363 '?', |
|
364 'e', |
|
365 '3', |
|
366 '.', |
|
367 't', |
|
368 'x', |
|
369 't', |
|
370 0x00 |
|
371 }; |
|
372 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
373 // create text body for message |
|
374 iBodyBuf.Append(KUnkLine1); |
|
375 iBodyBuf.Append(KUnkLine2); |
|
376 break; |
|
377 } |
|
378 case 4 : |
|
379 // create unknown message |
|
380 { |
|
381 const TUint8 kHdr[]= |
|
382 { |
|
383 0xFF, // unknown, default content type "application/octet-stream" |
|
384 0x92, // Date |
|
385 0x04, // length of field |
|
386 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
387 0x90, |
|
388 0x6a, |
|
389 0xd0, |
|
390 0x94, // Expires |
|
391 0x04, // length of field |
|
392 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
393 0x9a, |
|
394 0x6a, |
|
395 0xd0, |
|
396 0xAF, // X-Wap-Application-ID |
|
397 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
398 0x2E, // Content-Disposition |
|
399 'i', // inline; name="bob";filename = case4.txt ;size=100 |
|
400 'n', |
|
401 'l', |
|
402 'i', |
|
403 'n', |
|
404 'e', |
|
405 ';', |
|
406 ' ', |
|
407 'n', |
|
408 'a', |
|
409 'm', |
|
410 'e', |
|
411 '=', |
|
412 'b', |
|
413 'o', |
|
414 'b', |
|
415 ';', |
|
416 'F', |
|
417 'i', |
|
418 'l', |
|
419 'E', |
|
420 'n', |
|
421 'a', |
|
422 'M', |
|
423 'e', |
|
424 ' ', |
|
425 '=', |
|
426 ' ', |
|
427 'c', |
|
428 'a', |
|
429 's', |
|
430 'e', |
|
431 '4', |
|
432 '.', |
|
433 't', |
|
434 'x', |
|
435 't', |
|
436 ' ', |
|
437 ';', |
|
438 's', |
|
439 'i', |
|
440 'z', |
|
441 'e', |
|
442 '=', |
|
443 '1', |
|
444 '0', |
|
445 '0', |
|
446 0x0D, //CR |
|
447 0x0A //LF |
|
448 }; |
|
449 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
450 // create text body for message |
|
451 iBodyBuf.Append(KUnkLine1); |
|
452 iBodyBuf.Append(KUnkLine2); |
|
453 break; |
|
454 } |
|
455 case 5 : |
|
456 // create unknown message |
|
457 { |
|
458 // Create test unknown push message with encoded wap-230-wsp-20010705-a section 8.4.2.53 Content-Disposition header. |
|
459 const TUint8 kHdr[]= |
|
460 { |
|
461 0xFF, // unknown, default content type "application/octet-stream" |
|
462 0x92, // Date |
|
463 0x04, // length of field |
|
464 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
465 0x90, |
|
466 0x6a, |
|
467 0xd0, |
|
468 0x94, // Expires |
|
469 0x04, // length of field |
|
470 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
471 0x9a, |
|
472 0x6a, |
|
473 0xd0, |
|
474 0xAF, // X-Wap-Application-ID |
|
475 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
476 0x2E, // Content-Disposition header |
|
477 0x0C, // Value-length (number of bytes to follow) |
|
478 0x80, // Disposition - Form-data |
|
479 0x06, // Parameter - well-known-parameter-token (WAP 1.1 filename) |
|
480 'c', // Parameter value - text-string (case5.txt) |
|
481 'a', |
|
482 's', |
|
483 'e', |
|
484 '5', |
|
485 '.', |
|
486 't', |
|
487 'x', |
|
488 't', |
|
489 0x00 |
|
490 }; |
|
491 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
492 // create text body for message |
|
493 iBodyBuf.Append(KUnkLine1); |
|
494 iBodyBuf.Append(KUnkLine2); |
|
495 break; |
|
496 } |
|
497 case 6 : |
|
498 // create unknown message |
|
499 { |
|
500 // Create test unknown push message with encoded wap-230-wsp-20010705-a section 8.4.2.53 Content-Disposition header. |
|
501 const TUint8 kHdr[]= |
|
502 { |
|
503 0xFF, // unknown, default content type "application/octet-stream" |
|
504 0x92, // Date |
|
505 0x04, // length of field |
|
506 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
507 0x90, |
|
508 0x6a, |
|
509 0xd0, |
|
510 0x94, // Expires |
|
511 0x04, // length of field |
|
512 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
513 0x9a, |
|
514 0x6a, |
|
515 0xd0, |
|
516 0xAF, // X-Wap-Application-ID |
|
517 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
518 0x2E, // Content-Disposition header |
|
519 0x0E, // Value-length (number of bytes to follow) |
|
520 0x80, // Disposition - Form-data |
|
521 0x03, // Parameter - well-known-parameter-token (WAP 1.1 type) |
|
522 0x81, // value 1 (with msb set to 1) |
|
523 0x06, // Parameter - well-known-parameter-token (WAP 1.1 filename) |
|
524 'c', // Parameter value - text-string (case6.txt) |
|
525 'a', |
|
526 's', |
|
527 'e', |
|
528 '6', |
|
529 '.', |
|
530 't', |
|
531 'x', |
|
532 't', |
|
533 0x00 |
|
534 }; |
|
535 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
536 // create text body for message |
|
537 iBodyBuf.Append(KUnkLine1); |
|
538 iBodyBuf.Append(KUnkLine2); |
|
539 break; |
|
540 } |
|
541 case 7 : |
|
542 // create unknown message |
|
543 { |
|
544 // Create test unknown push message with encoded wap-230-wsp-20010705-a section 8.4.2.53 Content-Disposition header. |
|
545 const TUint8 kHdr[]= |
|
546 { |
|
547 0xFF, // unknown, default content type "application/octet-stream" |
|
548 0x92, // Date |
|
549 0x04, // length of field |
|
550 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
551 0x90, |
|
552 0x6a, |
|
553 0xd0, |
|
554 0x94, // Expires |
|
555 0x04, // length of field |
|
556 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
557 0x9a, |
|
558 0x6a, |
|
559 0xd0, |
|
560 0xAF, // X-Wap-Application-ID |
|
561 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
562 0x2E, // Content-Disposition header |
|
563 0x10, // Value-length (number of bytes to follow) |
|
564 0x80, // Disposition - Form-data |
|
565 0x03, // Parameter - well-known-parameter-token (WAP 1.1 type) |
|
566 0x02, // Parameter value - long-integer (0xFFFF) |
|
567 0xFF, // msb |
|
568 0xFF, // lsb |
|
569 0x06, // Parameter - well-known-parameter-token (WAP 1.1 filename) |
|
570 'c', // Parameter value - text-string (case6.txt) |
|
571 'a', |
|
572 's', |
|
573 'e', |
|
574 '7', |
|
575 '.', |
|
576 't', |
|
577 'x', |
|
578 't', |
|
579 0x00 |
|
580 }; |
|
581 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
582 // create text body for message |
|
583 iBodyBuf.Append(KUnkLine1); |
|
584 iBodyBuf.Append(KUnkLine2); |
|
585 break; |
|
586 } |
|
587 case 8 : |
|
588 // create unknown message |
|
589 { |
|
590 // Create test unknown push message with encoded wap-230-wsp-20010705-a section 8.4.2.53 Content-Disposition header. |
|
591 const TUint8 kHdr[]= |
|
592 { |
|
593 0xFF, // unknown, default content type "application/octet-stream" |
|
594 0x92, // Date |
|
595 0x04, // length of field |
|
596 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
597 0x90, |
|
598 0x6a, |
|
599 0xd0, |
|
600 0x94, // Expires |
|
601 0x04, // length of field |
|
602 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
603 0x9a, |
|
604 0x6a, |
|
605 0xd0, |
|
606 0xAF, // X-Wap-Application-ID |
|
607 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
608 0x2E, // Content-Disposition header |
|
609 0x14, // Value-length (number of bytes to follow) |
|
610 0x80, // Disposition - Form-data |
|
611 't', // Parameter - (type) |
|
612 'y', |
|
613 'p', |
|
614 'e', |
|
615 0x00, |
|
616 0x02, // Parameter value - long-integer (0xFFFF) |
|
617 0xFF, // msb |
|
618 0xFF, // lsb |
|
619 0x06, // Parameter - well-known-parameter-token (WAP 1.1 filename) |
|
620 'c', // Parameter value - text-string (case6.txt) |
|
621 'a', |
|
622 's', |
|
623 'e', |
|
624 '8', |
|
625 '.', |
|
626 't', |
|
627 'x', |
|
628 't', |
|
629 0x00 |
|
630 }; |
|
631 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
632 // create text body for message |
|
633 iBodyBuf.Append(KUnkLine1); |
|
634 iBodyBuf.Append(KUnkLine2); |
|
635 break; |
|
636 } |
|
637 case 9 : |
|
638 // create unknown message |
|
639 { |
|
640 // Create test unknown push message with encoded wap-230-wsp-20010705-a section 8.4.2.53 Content-Disposition header. |
|
641 const TUint8 kHdr[]= |
|
642 { |
|
643 0xFF, // unknown, default content type "application/octet-stream" |
|
644 0x92, // Date |
|
645 0x04, // length of field |
|
646 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
647 0x90, |
|
648 0x6a, |
|
649 0xd0, |
|
650 0x94, // Expires |
|
651 0x04, // length of field |
|
652 0x39, // Monday 15 August 2000 10:41:37 GMT |
|
653 0x9a, |
|
654 0x6a, |
|
655 0xd0, |
|
656 0xAF, // X-Wap-Application-ID |
|
657 0x82, // Short int - 0x02 represent x-wap-application:push.ua |
|
658 0x2E, // Content-Disposition header |
|
659 0x1C, // Value-length (number of bytes to follow) |
|
660 0x80, // Disposition - Form-data |
|
661 't', // Parameter - (type) |
|
662 'y', |
|
663 'p', |
|
664 'e', |
|
665 0x00, |
|
666 0x02, // Parameter value - long-integer (0xFFFF) |
|
667 0xFF, // msb |
|
668 0xFF, // lsb |
|
669 'F', // Parameter - (filename) |
|
670 'i', |
|
671 'L', |
|
672 'e', |
|
673 'n', |
|
674 'a', |
|
675 'M', |
|
676 'e', |
|
677 0x00, |
|
678 'c', // Parameter value - text-string (case6.txt) |
|
679 'a', |
|
680 's', |
|
681 'e', |
|
682 '9', |
|
683 '.', |
|
684 't', |
|
685 'x', |
|
686 't', |
|
687 0x00 |
|
688 }; |
|
689 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
690 // create text body for message |
|
691 iBodyBuf.Append(KUnkLine1); |
|
692 iBodyBuf.Append(KUnkLine2); |
|
693 break; |
|
694 } |
|
695 case 10: |
|
696 { |
|
697 // Dummy header / body. This will just load the test wap push plugin |
|
698 // which leaves from HandleMessageL |
|
699 // Test case added for DEF083590 |
|
700 const TUint8 kHdr[]= |
|
701 { |
|
702 0xCE, |
|
703 0xAF, |
|
704 0x8D |
|
705 }; |
|
706 iHeadersBuf.Append(kHdr, sizeof(kHdr)); |
|
707 // create text body for message |
|
708 iBodyBuf.Append(KUnkLine3); |
|
709 break; |
|
710 } |
|
711 default: |
|
712 // do nothing |
|
713 break; |
|
714 } |
|
715 } |
|
716 |
|
717 void CWapPushUnkMessageTest::TestAndPrint(const TDesC& aTestCase, const TDesC& aFilename, const TDesC& aLocalFilename) |
|
718 { |
|
719 TBuf<KPushLogBuffer> buffer; |
|
720 if (aLocalFilename.CompareF(aFilename) == 0) |
|
721 { |
|
722 buffer.Format(KLogOutput, &aTestCase, &KLogSucceeded); |
|
723 } |
|
724 else |
|
725 { |
|
726 buffer.Format(KLogOutput, &aTestCase, &KLogFailed); |
|
727 } |
|
728 WPLPrintf(buffer); |
|
729 } |
|
730 |
|
731 /** confirm the message has been stored. |
|
732 Writes the number of stored messages found to the log file - if present. |
|
733 @param void |
|
734 @return TBool |
|
735 returns ETrue if messages found |
|
736 returns EFalse if no messages found |
|
737 */ |
|
738 TBool CWapPushUnkMessageTest::ConfirmMessagesSavedL() |
|
739 { |
|
740 WPLPrintf(KSpace); |
|
741 WPLPrintf(KUnkTestStart); |
|
742 WPLPrintf(KSpace); |
|
743 |
|
744 #ifndef __MESSAGING_API_V2__ |
|
745 RFs fs; |
|
746 User::LeaveIfError(fs.Connect()); |
|
747 CleanupClosePushL(fs); |
|
748 #endif // __MESSAGING_API_V2__ |
|
749 |
|
750 CWapPushMsgUtils* wapPushUtils = CWapPushMsgUtils::NewL(); |
|
751 CleanupStack::PushL(wapPushUtils); |
|
752 |
|
753 CMsvEntry* msvEntry = wapPushUtils->Session().GetEntryL(KMsvGlobalInBoxIndexEntryId); |
|
754 CleanupStack::PushL(msvEntry); |
|
755 |
|
756 CMsvEntrySelection* selection = msvEntry->ChildrenL(); |
|
757 CleanupStack::PushL(selection); |
|
758 |
|
759 TInt count = selection->Count(); |
|
760 TInt testCase = 1; |
|
761 for (TInt curChild = 0; curChild < count; curChild++) |
|
762 { |
|
763 msvEntry->SetEntryL(selection->At(curChild)); |
|
764 |
|
765 if (msvEntry->Entry().iMtm == KUidMtmWapPush && msvEntry->Entry().iBioType == KUidWapPushMsgUnknown.iUid) |
|
766 { |
|
767 #ifdef __MESSAGING_API_V2__ |
|
768 CMsvStore* store = msvEntry->ReadStoreL(); |
|
769 CleanupStack::PushL(store); |
|
770 MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
771 for( TInt ii=0; ii<manager.AttachmentCount(); ++ii ) |
|
772 { |
|
773 CMsvAttachment* attachment = manager.GetAttachmentInfoL(ii); |
|
774 switch (testCase) |
|
775 { |
|
776 case 1: |
|
777 { |
|
778 TestAndPrint(KTest1, KDefaultFilename, attachment->AttachmentName()); |
|
779 testCase=2; |
|
780 } break; |
|
781 case 2: |
|
782 { |
|
783 TestAndPrint(KTest2, KContentWml, attachment->AttachmentName()); |
|
784 testCase=3; |
|
785 } break; |
|
786 case 3: |
|
787 { |
|
788 TestAndPrint(KTest3, KDefaultFilename, attachment->AttachmentName()); |
|
789 testCase=4; |
|
790 } break; |
|
791 case 4: |
|
792 { |
|
793 TestAndPrint(KTest4, KDefaultFilename, attachment->AttachmentName()); |
|
794 testCase=5; |
|
795 } break; |
|
796 case 5: |
|
797 { |
|
798 TestAndPrint(KTest5, KCase5, attachment->AttachmentName()); |
|
799 testCase=6; |
|
800 } break; |
|
801 case 6: |
|
802 { |
|
803 TestAndPrint(KTest6, KCase6, attachment->AttachmentName()); |
|
804 testCase=7; |
|
805 } break; |
|
806 case 7: |
|
807 { |
|
808 TestAndPrint(KTest7, KCase7, attachment->AttachmentName()); |
|
809 testCase=8; |
|
810 } break; |
|
811 case 8: |
|
812 { |
|
813 TestAndPrint(KTest8, KCase8, attachment->AttachmentName()); |
|
814 testCase=9; |
|
815 } break; |
|
816 case 9: |
|
817 { |
|
818 TestAndPrint(KTest9, KCase9, attachment->AttachmentName()); |
|
819 testCase=10; |
|
820 } break; |
|
821 default: |
|
822 break; |
|
823 } // end of switch |
|
824 delete attachment; |
|
825 } |
|
826 |
|
827 CleanupStack::PopAndDestroy(store); |
|
828 } |
|
829 } |
|
830 CleanupStack::PopAndDestroy(3, wapPushUtils); // selection, msvEntry, wapPushUtils |
|
831 #else |
|
832 TFileName filePath; |
|
833 msvEntry->GetFilePath(filePath); |
|
834 User::LeaveIfError(fs.SetSessionPath(filePath)); |
|
835 |
|
836 CDir* dirList = NULL; |
|
837 User::LeaveIfError(fs.GetDir(filePath, KEntryAttNormal, ESortByName, dirList)); |
|
838 |
|
839 if (dirList) |
|
840 { |
|
841 TFileName localFile; |
|
842 for (TInt i=0; i< dirList->Count(); i++) |
|
843 { |
|
844 localFile = (*dirList)[i].iName; |
|
845 |
|
846 switch (testCase) |
|
847 { |
|
848 case 1: |
|
849 { |
|
850 TestAndPrint(KTest1, KDefaultFilename, localFile); |
|
851 testCase=2; |
|
852 } break; |
|
853 case 2: |
|
854 { |
|
855 TestAndPrint(KTest2, KContentWml, localFile); |
|
856 testCase=3; |
|
857 } break; |
|
858 case 3: |
|
859 { |
|
860 TestAndPrint(KTest3, KDefaultFilename, localFile); |
|
861 testCase=4; |
|
862 } break; |
|
863 case 4: |
|
864 { |
|
865 TestAndPrint(KTest4, KDefaultFilename, localFile); |
|
866 testCase=5; |
|
867 } break; |
|
868 case 5: |
|
869 { |
|
870 TestAndPrint(KTest5, KCase5, localFile); |
|
871 testCase=6; |
|
872 } break; |
|
873 case 6: |
|
874 { |
|
875 TestAndPrint(KTest6, KCase6, localFile); |
|
876 testCase=7; |
|
877 } break; |
|
878 case 7: |
|
879 { |
|
880 TestAndPrint(KTest7, KCase7, localFile); |
|
881 testCase=8; |
|
882 } break; |
|
883 case 8: |
|
884 { |
|
885 TestAndPrint(KTest8, KCase8, localFile); |
|
886 testCase=9; |
|
887 } break; |
|
888 case 9: |
|
889 { |
|
890 TestAndPrint(KTest9, KCase9, localFile); |
|
891 testCase=10; |
|
892 } break; |
|
893 default: |
|
894 break; |
|
895 } |
|
896 } |
|
897 } |
|
898 delete dirList; |
|
899 } |
|
900 } |
|
901 CleanupStack::PopAndDestroy(4, &fs); |
|
902 #endif // __MESSAGING_API_V2__ |
|
903 |
|
904 WPLPrintf(KSpace); |
|
905 WPLPrintf(KUnkTestFinish); |
|
906 WPLPrintf(KSpace); |
|
907 return ETrue; |
|
908 } |