|
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 // |
|
15 |
|
16 #include "cwappushfailmessagetest.h" |
|
17 |
|
18 //#include "pushtests.h" |
|
19 //#include "dummywapstack.h" |
|
20 //#include "WapPushMsgGen.h" |
|
21 |
|
22 /** set test name to 'Service Indication' |
|
23 @param void |
|
24 @return string |
|
25 string represents test name |
|
26 */ |
|
27 const TDesC& CWapPushFailMessageTest::TestName() |
|
28 { |
|
29 _LIT(KTextFailMessageTest, "Failing Messages (were causing panics)"); |
|
30 return KTextFailMessageTest; |
|
31 } |
|
32 |
|
33 /** set the number of test messages to use */ |
|
34 void CWapPushFailMessageTest::NumberTestCasesToRun() |
|
35 { |
|
36 iNumberOfTestCases = 17; |
|
37 } |
|
38 |
|
39 /** build different test messages to test specific SI reception aspects |
|
40 in the SI content handler processing code. |
|
41 @param TInt |
|
42 the number of test messages to create and use |
|
43 @return void |
|
44 */ |
|
45 void CWapPushFailMessageTest::PrepareTestMessageL(TInt aTestCase) |
|
46 { |
|
47 const TUint8 KFailMessageBody[] = |
|
48 { |
|
49 0x02, |
|
50 0x05, |
|
51 0x6a, |
|
52 0x00, |
|
53 0x45, |
|
54 0xc6, |
|
55 0x0c, |
|
56 0x03, |
|
57 0x74, |
|
58 0x65, |
|
59 0x73, |
|
60 0x74, |
|
61 0x2e, |
|
62 0x6c, |
|
63 0x6f, |
|
64 0x63, |
|
65 0x61, |
|
66 0x6c, |
|
67 0x00, |
|
68 0x01, |
|
69 0x03, |
|
70 0x66, |
|
71 0x6f, |
|
72 0x6f, |
|
73 0x00, |
|
74 0x01, |
|
75 0x01 |
|
76 }; |
|
77 |
|
78 iBodyBuf.Delete(0,KBufferSize); |
|
79 iBodyBuf.Append(KFailMessageBody, sizeof(KFailMessageBody)); |
|
80 |
|
81 switch(aTestCase) |
|
82 { |
|
83 case 0: |
|
84 { |
|
85 const TUint8 KFailMessageHeader_0[] = |
|
86 { |
|
87 0xAE, // Content-type: application/vnd.wap.sic |
|
88 0xAF, // X-Wap-Application-Id: |
|
89 0x1E // CORRUPT - should be Integer-value = Short-integer | Long-integer |
|
90 }; |
|
91 |
|
92 iHeadersBuf.Copy(KFailMessageHeader_0, sizeof(KFailMessageHeader_0)); |
|
93 } break; |
|
94 case 1: |
|
95 { |
|
96 const TUint8 KFailMessageHeader_1[] = |
|
97 { |
|
98 0xAE, // Content-type: application/vnd.wap.sic |
|
99 0xAF, // X-Wap-Application-Id: |
|
100 0x1F // CORRUPT - this indicates a UIntVar, which is incorrect |
|
101 }; |
|
102 |
|
103 iHeadersBuf.Copy(KFailMessageHeader_1, sizeof(KFailMessageHeader_1)); |
|
104 } break; |
|
105 case 2: |
|
106 { |
|
107 const TUint8 KFailMessageHeader_2[] = |
|
108 { |
|
109 0x1F, |
|
110 0x00 |
|
111 }; |
|
112 iHeadersBuf.Copy(KFailMessageHeader_2, sizeof(KFailMessageHeader_2)); |
|
113 } break; |
|
114 case 3: |
|
115 { |
|
116 const TUint8 KFailMessageHeader_3[] = |
|
117 { |
|
118 0x1F, |
|
119 0x01, |
|
120 0x00 |
|
121 }; |
|
122 iHeadersBuf.Copy(KFailMessageHeader_3, sizeof(KFailMessageHeader_3)); |
|
123 } break; |
|
124 case 4: |
|
125 { |
|
126 const TUint8 KFailMessageHeader_4[] = |
|
127 { |
|
128 0x1F, |
|
129 0x02, |
|
130 0x00, |
|
131 0x00 |
|
132 }; |
|
133 |
|
134 iHeadersBuf.Copy(KFailMessageHeader_4, sizeof(KFailMessageHeader_4)); |
|
135 } break; |
|
136 case 5: |
|
137 { |
|
138 const TUint8 KFailMessageHeader_5[] = |
|
139 { |
|
140 0x1F, |
|
141 0x02, |
|
142 0x80, |
|
143 0x00 |
|
144 }; |
|
145 |
|
146 iHeadersBuf.Copy(KFailMessageHeader_5, sizeof(KFailMessageHeader_5)); |
|
147 } break; |
|
148 case 6: |
|
149 { |
|
150 const TUint8 KFailMessageHeader_6[] = |
|
151 { |
|
152 0x1F, |
|
153 0x02, |
|
154 0x1E, |
|
155 0x00 |
|
156 }; |
|
157 |
|
158 iHeadersBuf.Copy(KFailMessageHeader_6, sizeof(KFailMessageHeader_6)); |
|
159 } break; |
|
160 case 7: |
|
161 { |
|
162 const TUint8 KFailMessageHeader_7[] = |
|
163 { |
|
164 0x1F, |
|
165 0x02, |
|
166 0x1F, |
|
167 0x00 |
|
168 }; |
|
169 |
|
170 iHeadersBuf.Copy(KFailMessageHeader_7, sizeof(KFailMessageHeader_7)); |
|
171 } break; |
|
172 case 8: |
|
173 { |
|
174 const TUint8 KFailMessageHeader_8[] = |
|
175 { |
|
176 0x1F, |
|
177 0x00, |
|
178 0xAE |
|
179 }; |
|
180 |
|
181 iHeadersBuf.Copy(KFailMessageHeader_8, sizeof(KFailMessageHeader_8)); |
|
182 } break; |
|
183 case 9: |
|
184 { |
|
185 const TUint8 KFailMessageHeader_9[] = |
|
186 { |
|
187 0x1F, |
|
188 0x80, |
|
189 0x00, |
|
190 0xAE |
|
191 }; |
|
192 |
|
193 iHeadersBuf.Copy(KFailMessageHeader_9, sizeof(KFailMessageHeader_9)); |
|
194 } break; |
|
195 case 10: |
|
196 { |
|
197 const TUint8 KFailMessageHeader_10[] = |
|
198 { |
|
199 0x1F, |
|
200 0x9F, |
|
201 0xFF, |
|
202 0xFF, |
|
203 0xFF, |
|
204 0x00, |
|
205 0xAE |
|
206 }; |
|
207 |
|
208 iHeadersBuf.Copy(KFailMessageHeader_10, sizeof(KFailMessageHeader_10)); |
|
209 } break; |
|
210 case 11: |
|
211 { |
|
212 const TUint8 KFailMessageHeader_11[] = |
|
213 { |
|
214 0x1F, |
|
215 0xAE |
|
216 }; |
|
217 |
|
218 iHeadersBuf.Copy(KFailMessageHeader_11, sizeof(KFailMessageHeader_11)); |
|
219 } break; |
|
220 case 12: |
|
221 { |
|
222 const TUint8 KFailMessageHeader_12[] = |
|
223 { |
|
224 0x1F, |
|
225 0x01, |
|
226 0xAE |
|
227 }; |
|
228 |
|
229 iHeadersBuf.Copy(KFailMessageHeader_12, sizeof(KFailMessageHeader_12)); |
|
230 } break; |
|
231 case 13: |
|
232 { |
|
233 const TUint8 KFailMessageHeader_13[] = |
|
234 { |
|
235 0x1F, |
|
236 0x02, |
|
237 0xAE, |
|
238 0x00 |
|
239 }; |
|
240 |
|
241 iHeadersBuf.Copy(KFailMessageHeader_13, sizeof(KFailMessageHeader_13)); |
|
242 } break; |
|
243 case 14: |
|
244 { |
|
245 const TUint8 KFailMessageHeader_14[] = |
|
246 { |
|
247 0x1F, |
|
248 0x02, |
|
249 0xAE, |
|
250 0x80 |
|
251 }; |
|
252 |
|
253 iHeadersBuf.Copy(KFailMessageHeader_14, sizeof(KFailMessageHeader_14)); |
|
254 } break; |
|
255 case 15: |
|
256 { |
|
257 const TUint8 KFailMessageHeader_15[] = |
|
258 { |
|
259 0x1F, |
|
260 0x02, |
|
261 0xAE, |
|
262 0x1F |
|
263 }; |
|
264 |
|
265 iHeadersBuf.Copy(KFailMessageHeader_15, sizeof(KFailMessageHeader_15)); |
|
266 } break; |
|
267 case 16: |
|
268 { |
|
269 const TUint8 KFailMessageHeader_16[] = |
|
270 { |
|
271 0x1F, |
|
272 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
273 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
274 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
275 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
276 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
277 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
278 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
279 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
280 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
281 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
282 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
283 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
284 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
285 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
286 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
287 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
288 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
289 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
290 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
291 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
292 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
293 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
294 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
295 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
296 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
297 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
298 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
299 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
300 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
301 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
302 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
303 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, |
|
304 0xAE |
|
305 }; |
|
306 |
|
307 iHeadersBuf.Copy(KFailMessageHeader_16, sizeof(KFailMessageHeader_16)); |
|
308 } break; |
|
309 |
|
310 default: |
|
311 break; |
|
312 } |
|
313 } |
|
314 |
|
315 /** confirm the message has been stored. |
|
316 Writes the number of stored messages found to the log file - if present. |
|
317 @param void |
|
318 @return TBool |
|
319 returns ETrue if messages found |
|
320 returns EFalse if no messages found |
|
321 */ |
|
322 TBool CWapPushFailMessageTest::ConfirmMessagesSavedL() |
|
323 { |
|
324 return EFalse; |
|
325 } |